Skip to content

refactor(ui): extend typography/line-height converge contracts to TSX (#546 PR0) - #589

Merged
Astro-Han merged 1 commit into
mainfrom
refactor/546-pr0-tsx-typography-contract
Jul 6, 2026
Merged

refactor(ui): extend typography/line-height converge contracts to TSX (#546 PR0)#589
Astro-Han merged 1 commit into
mainfrom
refactor/546-pr0-tsx-typography-contract

Conversation

@Astro-Han

Copy link
Copy Markdown
Contributor

Summary

Extends the typography/line-height converge contracts to scan .tsx (not just CSS), closing the CSS-only blind spot from #520, and converges ~64 arbitrary text-[..]/leading-[..] Tailwind utilities onto the token scale. First PR of the #546 CSS governance pass.

Why

#520's converge contracts locked every numeric spec in renderer CSS, but they only scanned .css — arbitrary text-[12px] / leading-[1.45] utilities living in .tsx className strings were a complete blind spot (~64 sites across 6 files). #546 PR0 closes that gap so TSX is governed by the same token discipline as CSS.

Refs #546

Scope

Changed:

  • css-test-helpers.ts: add readRendererTsxFiles()
  • typography-converge + line-height-converge contracts: new TSX-scanning test (regex covers numeric arbitrary, length:calc(..), and text-*/[<num>] slash line-height modifier; var/color refs, named scales, and leading-[Npx] icon-centering stay allowed) + negative cases
  • 5 source files converged (primitives/chat.tsx, tool-activity.tsx, primitives/badge.tsx, chat-view.tsx, attachment-file-card.tsx): ≤12.5px→text-xs, 13px→text-sm; leading 1.4/1.45→snug, 1.5/1.6→normal
  • 4 feat(ui): govern chat conversation-flow display onto @maka/ui Base UI primitives #332 chat migration contracts updated (3 desktop cascade + @maka/ui chat-primitives): their typography anti-drift pinned arbitrary literals and banned text-xs/sm; refactor(ui): close out post-#520 renderer surface polish #546 PR0 intentionally converges typography onto the scale, so typography literals are unpinned and text-xs/sm allowed — radius/spacing anti-drift preserved

Not included:

  • markdown prose layer / bubble extraction (later surface-polish PR)
  • surface relocation (Phase A)
  • full tool-cva extraction (separate decision)

Verification

  • npm run typecheck — green (all workspaces)
  • npm run -w @maka/desktop test — 2135/2136 pass
  • npm test --workspace @maka/ui — 45/45 pass
  • codex exec review --base origin/main — PASS (no P0/P1/P2/P3)
  • The one desktop fail (history-compact-artifacts) is pre-existing — a runtime artifact-size classification unrelated to this diff (the test reads artifact block summaries, not renderer className)

User-facing impact

Near-zero visual shift: ≤1px font-size and ≤0.1 line-height deltas on tool-card meta/code/labels. No changelog/docs/migrations.

Reviewer notes

  • The TSX scan covers literal className strings only — not clsx/cva maps, template strings, or inline style={{}} (stated honestly in the contract comments).
  • leading-[12px]/[16px] on fixed-height icon buttons are deliberate px centering, kept (same exception refactor(ui): close out post-#520 renderer surface polish #546 recorded).
  • Rollback: single revert; no token/schema/migration changes.

Checklist

  • Scope matches the PR title and excludes unrelated changes
  • Verification lists commands/results
  • User-facing impact noted (near-zero)
  • Risk/rollback called out
  • UI screenshots — N/A (≤1px shifts on a governance PR; dual-theme screenshots land with the surface-polish PRs where pixels actually change)

…#546 PR0)

Close the CSS-only blind spot in the typography/line-height converge
contracts: ~64 arbitrary text-[..]/leading-[..] Tailwind utilities lived in
.tsx className strings across 6 files that the CSS scanners never read.

- css-test-helpers: add readRendererTsxFiles(); both contracts now scan
  .tsx/.ts for arbitrary font-size (text-[<num>] numeric and
  text-[length:calc(..)] length-typed calc), unitless leading-[<num>], and
  text-*/[<num>] slash line-height modifiers. var/color refs, named scales,
  and leading-[Npx] icon-centering stay allowed.
- Converge all 64 sites onto the existing scale: <=12.5px -> text-xs,
  13px -> text-sm; leading 1.4/1.45 -> snug, 1.5/1.6 -> normal.
- Update the #332 chat migration contracts (3 desktop cascade contracts +
  @maka/ui chat-primitives.test.ts): their typography anti-drift pinned
  arbitrary literals (text-[11.5px]/[12.5px]/[9px]/[12px]) and banned
  text-xs/sm. #546 PR0 intentionally converges typography onto the scale,
  so typography literals are unpinned and text-xs/sm are allowed; radius/
  spacing anti-drift is preserved.

Honest coverage noted in contract comments: the TSX scan catches literal
className strings only — not clsx/cva maps, template strings, or inline
style props.

Pre-existing (not this diff): history-compact-artifacts.test.ts fails on an
unrelated runtime artifact-size classification.
@Astro-Han
Astro-Han merged commit 99fd239 into main Jul 6, 2026
3 checks passed
@Astro-Han
Astro-Han deleted the refactor/546-pr0-tsx-typography-contract 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