Skip to content

refactor(ui): chat message body → chat-message.css + .maka-prose layer (#546 PR4) - #593

Merged
Astro-Han merged 2 commits into
mainfrom
refactor/546-pr4-chat-message-body
Jul 7, 2026
Merged

refactor(ui): chat message body → chat-message.css + .maka-prose layer (#546 PR4)#593
Astro-Han merged 2 commits into
mainfrom
refactor/546-pr4-chat-message-body

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

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-prose element layer that PR5 tool-result bodies will opt into.

Two commits, both zero visual change:

  1. Relocate.maka-message-row, the .maka-bubble-assistant shell + 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-streaming caret (out of maka-tokens.css @layer components), plus the message-row residue .maka-message-time-inline / .maka-message-meta / [data-slot=message] pre (out of tool-output.css) → styles/chat-message.css. tool-output.css is 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.

  2. .maka-prose layer — 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. bubbleVariants assistant 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-prose without 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 in tool-output.css, body in TSX). .maka-prose is 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 like max-width: 100% downstream… isn't misread as a declaration; border-width + chat-primitive-cascade follow the .maka-prose rename).

Not included: tool-result reuse of .maka-prose (PR5), chat-view.tsx attachment Tailwind convergence (separate polish), token value changes.

Verification

  • Full dist/main suite: 2142 pass, 0 fail (incl. new markdown-prose-contract + all converge contracts).
  • npm run typecheck green (all workspaces).
  • npm run build:renderer (vite) succeeds — CSS imports + chat-message.css syntax valid.
  • turn-narrative screenshot harness: 8/8 variants captured, 0 failed.
  • Zero-visual-change reasoning: declarations are byte-identical (relocate copies verbatim; the rename changes selector scope, not declarations), and the @layer components → unlayered move is cascade-neutral for prose because markdown-body.tsx's components map only overrides a/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 committed turn-narrative baseline 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

  • The relocate changes the cascade layer of these rules (@layer components → unlayered), matching PR1–PR3. Intentional and analyzed safe (see Verification).
  • .maka-prose is authored as a shared layer but only the assistant bubble consumes it today; PR5 wires tool-result bodies onto it.
  • Review focus: the 49 prose selectors renamed in 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-child resets) are correctly preserved.

Checklist

  • Scope matches the PR title and excludes unrelated changes
  • Verification lists commands/results
  • User-facing impact: none
  • Risk/review focus called out (layer move, rename)
  • UI changes: screenshot captured (turn-narrative 8/8); byte-diff skipped with justification

@Astro-Han
Astro-Han force-pushed the refactor/546-pr4-chat-message-body branch from ad08de9 to 0ea0259 Compare July 7, 2026 04:09
Astro-Han added 2 commits July 7, 2026 12:36
 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
Astro-Han force-pushed the refactor/546-pr4-chat-message-body branch from 0ea0259 to e220af5 Compare July 7, 2026 04:36
@Astro-Han
Astro-Han merged commit c0df624 into main Jul 7, 2026
3 checks passed
@Astro-Han
Astro-Han deleted the refactor/546-pr4-chat-message-body branch July 14, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant