fix: restyle block components to match playground CSS classes #86
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/pal-e-docs-app!86
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "71-port-note-detail"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Changes
src/lib/components/blocks/HeadingBlock.svelte: replaced Tailwind classes with playground.block-heading+.anchor-link; eliminated 107-line if/else repetitionsrc/lib/components/blocks/ParagraphBlock.svelte: replaced.note-paragraphscoped styles with playground.block.block--paragraph; removed 26-line<style>blocksrc/lib/components/blocks/TableBlock.svelte: replaced custom.table-header/.table-row/.table-cellwith playground.block--table > .table-wrap > table; removed 28-line<style>blocksrc/lib/components/blocks/ListBlock.svelte: replaced Tailwind classes with playground.block.block--list; replaced deprecated<svelte:self>with self-import; removed 20-line<style>blocksrc/lib/components/blocks/CodeBlock.svelte: replaced.code-block+ custom styles with playground.block--code > .code-header > .code-lang; removed 23-line<style>blocksrc/lib/components/blocks/MermaidBlock.svelte: replaced.mermaid-blockwith playground.block.block--mermaid; removed scoped styles referencing undefined CSS varssrc/lib/components/blocks/BlockRenderer.svelte: replaced Tailwind fallback div with.block.empty-stateTest Plan
npm run buildpasses with no errorsReview Checklist
Related Notes
pal-e-app-- SvelteKit frontendQA Review: PR #86
Verified
block-heading,block--paragraph,block--code,block--table,block--list,block--mermaid,anchor-link,code-header,code-lang,table-wrap,empty-state) exist insrc/app.css.blockclass exists in app.css (providesmargin-bottom: 1rem).block-heading--h1,.block-heading--h3) correctly override the global.block-headingfor level-specific sizingimport ListBlock from './ListBlock.svelte') instead of deprecated<svelte:self>-- resolves Svelte warning<style>blocksNits (non-blocking)
block-heading--h3is applied to h4 and h5 elements. Considerblock-heading--h4andblock-heading--h5for semantic clarity, even if the styles are identical today. (Cosmetic -- not blocking.)class="flex justify-center"on the mermaid container div. The playground CSS.block--mermaidhastext-align: centerwhich handles this, so the removal is correct. Just noting for awareness.No Issues Found
app.cssdefinitions exactlyVERDICT: APPROVED
PR #86 Review
DOMAIN REVIEW
Tech stack: SvelteKit / TypeScript / CSS (pure CSS design system, no Tailwind)
This PR replaces orphaned Tailwind utility classes across 7 block components with playground CSS class names defined in
app.css. All CSS classes referenced in the components (block,block--paragraph,block--code,code-header,code-lang,block-heading,anchor-link,block--list,block--table,table-wrap,block--mermaid,empty-state) have matching definitions insrc/app.css(lines 360-480, 788-793). No dangling class references.Component architecture: Clean. Each block component is now a thin template that delegates all styling to the design system in
app.css, with scoped<style>only for heading-level modifiers (block-heading--h1,block-heading--h3) that override the base.block-headingrule. This is the correct Svelte pattern -- global design system handles the common case, scoped styles handle component-specific overrides.Svelte 5 compliance:
<svelte:self>replaced with self-import in ListBlock -- correct fix for thesvelte_self_deprecatedwarning.state_referenced_locallywarning also resolved (not visible in diff, but PR body claims it and no grep hits remain).XSS protection: All
{@html}usages are sanitized. BlockRenderer passes content throughautolink()(which callssanitize()via DOMPurify),sanitize()directly, orsanitizeListItems()(recursive DOMPurify). No unprotected raw HTML rendering.DRY improvement: HeadingBlock eliminated ~60 lines of repeated per-level markup. Each heading level is now 2 lines. The h4/h5 sharing
block-heading--h3class is intentional per the "h3+ are smaller, no border" design decision.Net change: +97 / -258 = 161 lines deleted. Pure cleanup.
BLOCKERS
None.
{@html}goes through DOMPurify.NITS
Inline style in MermaidBlock (
src/lib/components/blocks/MermaidBlock.svelteline 39):style="font-size: 0.8rem; color: var(--color-text-muted);"on the error fallback<pre>. This is the only remaining inline style across all 7 block components. Could be a scoped style or a utility class in app.css for consistency. Low priority since it is an error display path.PR body template: Uses
## Related Notesinstead of the standard## Relatedsection header. Minor template drift.SOP COMPLIANCE
71-port-note-detailreferences #71)PROCESS OBSERVATIONS
app.csswas ported in prior PRs (#75, #79). This PR aligns the block components to use those classes.npm run buildandnpm run check, which would catch broken imports or type errors, but visual correctness requires manual verification. This is expected for a CSS-only PR.VERDICT: APPROVED