refactor(ui): chat message body → chat-message.css + .maka-prose layer (#546 PR4) - #593
Merged
Merged
Conversation
Astro-Han
force-pushed
the
refactor/546-pr4-chat-message-body
branch
from
July 7, 2026 04:09
ad08de9 to
0ea0259
Compare
PR4) Pure relocation, zero visual change. Moves the message-body CSS that lived in maka-tokens.css (@layer components) — .maka-message-row, the .maka-bubble-assistant shell + Markdown prose (p / h* / ul / code / pre / blockquote / table / hr), task-list checkboxes, .maka-code-block*, .hljs*, .maka-bubble-with-actions + .maka-message-copy*, and the .maka-bubble- streaming caret — plus the message-row residue in tool-output.css (.maka-message-time-inline / .maka-message-meta / [data-slot="message"] pre) into one per-surface file styles/chat-message.css. Follows the #546 PR1–PR3 unlayered pattern: prose elements are react-markdown HTML with no Tailwind utility competing for them, so the @layer components → unlayered move is visually neutral. tool-output.css is deleted (its only live CSS was the message-row residue). Three contracts that hardcoded the old file home are updated to follow the relocated rules: visible-copy-hygiene reads chat-message.css for .maka-message-copy / .maka-code-block-copy; chat-preview-cascade scans the whole renderer tree (readAllRendererCss) instead of the deleted tool-output.css for the retired maka-tool-card-enter keyframe; renderer-css-duplicate-decl now tracks multi-line comment state so a prose comment line like "max-width: 100% downstream…" is not mis-read as a declaration (the contract only scanned styles/ before, so this surfaced once the rules moved there). Verification: full dist/main suite stays green (2138 pass); vite renderer build succeeds. The .maka-prose element-layer extraction + a dedicated markdown-prose-contract follow in the next commit.
…546 PR4) Extracts the assistant-message Markdown typography (p / h* / ul / code / pre / blockquote / table / hr / task-list) off the .maka-bubble-assistant shell into a standalone .maka-prose element layer, so #546 PR5 tool-result bodies can opt into the same prose rules without inheriting bubble geometry (max-width 72ch, padding, first/last-child margin reset). The shell (.maka-bubble-assistant) keeps only container geometry + the generic first/last-child margin reset; bubbleVariants assistant now emits "maka-bubble-assistant maka-prose" so an assistant message renders the prose layer. Zero visual change — same declarations, new scope. New markdown-prose-contract.test.ts locks three invariants: prose element rules live under .maka-prose (not .maka-bubble-assistant), the assistant Bubble variant carries maka-prose, and .maka-prose is authored in chat-message.css. Two existing contracts follow the rename: border-width allowlists the task-list checkmark caret under its new .maka-prose scope; chat-primitive-cascade checks .maka-prose p/pre/table instead of the old .maka-bubble-assistant prefix. Verification: full dist/main suite green (2142 pass); vite renderer build succeeds.
Astro-Han
force-pushed
the
refactor/546-pr4-chat-message-body
branch
from
July 7, 2026 04:36
0ea0259 to
e220af5
Compare
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#546 PR4 (first of Phase B). Consolidates the chat message-body CSS into a single per-surface file
chat-message.css, then splits the Markdown prose typography off the assistant bubble shell into a reusable.maka-proseelement layer that PR5 tool-result bodies will opt into.Two commits, both zero visual change:
Relocate —
.maka-message-row, the.maka-bubble-assistantshell + all Markdown prose (p / h* / ul / code / pre / blockquote / table / hr), task-list checkboxes,.maka-code-block*,.hljs*,.maka-bubble-with-actions+.maka-message-copy*, and the.maka-bubble-streamingcaret (out ofmaka-tokens.css@layer components), plus the message-row residue.maka-message-time-inline/.maka-message-meta/[data-slot=message] pre(out oftool-output.css) →styles/chat-message.css.tool-output.cssis deleted. Follows the PR1–PR3 unlayered pattern — prose elements are react-markdown HTML with no Tailwind utility competing for them, so the layer move is visually neutral..maka-proselayer — the shell (.maka-bubble-assistant) keeps only container geometry (max-width 72ch, padding, generic first/last-child margin reset); element typography moves to.maka-prose.bubbleVariantsassistant now emits"maka-bubble-assistant maka-prose"so an assistant message renders the prose layer. Same declarations, new scope — PR5 tool-result bodies can reuse.maka-prosewithout inheriting bubble geometry.Why
Refs #546. Phase A (PR0–3) dissolved the grab-bag files; Phase B polishes each surface onto its own correctly-named file. PR4 is the chat message body: it had no home of its own (prose lived in
maka-tokens.css, meta residue intool-output.css, body in TSX)..maka-proseis extracted now so PR5's tool-result Markdown reuses the same rules instead of duplicating them.Scope
Changed:
chat-message.css(new),maka-tokens.css(−440 lines),tool-output.css(deleted),styles.css(import swap),primitives/chat.tsx(cva + 2 stale-comment updates),markdown-prose-contract.test.ts(new), 4 existing contracts adapted (visible-copy-hygiene reads chat-message.css; chat-preview-cascade scans the renderer tree instead of the deleted tool-output.css; renderer-css-duplicate-decl tracks multi-line comment state so a prose comment line likemax-width: 100% downstream…isn't misread as a declaration; border-width + chat-primitive-cascade follow the.maka-proserename).Not included: tool-result reuse of
.maka-prose(PR5), chat-view.tsx attachment Tailwind convergence (separate polish), token value changes.Verification
dist/mainsuite: 2142 pass, 0 fail (incl. newmarkdown-prose-contract+ all converge contracts).npm run typecheckgreen (all workspaces).npm run build:renderer(vite) succeeds — CSS imports + chat-message.css syntax valid.turn-narrativescreenshot harness: 8/8 variants captured, 0 failed.@layer components→ unlayered move is cascade-neutral for prose becausemarkdown-body.tsx's components map only overridesa/code/pre— every other prose element (p / h* / ul / li / blockquote / table …) is bare react-markdown HTML with no Tailwind utility competing, so unlayered rules win the same way the layered rules did over preflight. Not done: main-baseline byte-for-byte screenshot diff — the only committedturn-narrativebaseline predates PR0–3 (2026-07-05 vs HEAD 07-07), so a diff would conflate PR4 with Phase A; the contract + declaration-equivalence evidence above is the stronger guarantee for a pure relocate.User-facing impact
None — pure CSS relocation + selector rename, zero visual change.
Reviewer notes
@layer components→ unlayered), matching PR1–PR3. Intentional and analyzed safe (see Verification)..maka-proseis authored as a shared layer but only the assistant bubble consumes it today; PR5 wires tool-result bodies onto it.chat-message.css(.maka-bubble-assistant X→.maka-prose X), and that the 4 shell selectors on.maka-bubble-assistant(the container + 3 generic:first/last/nth-last-childresets) are correctly preserved.Checklist