refactor(ui): extend typography/line-height converge contracts to TSX (#546 PR0) - #589
Merged
Merged
Conversation
…#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.
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
Extends the typography/line-height converge contracts to scan
.tsx(not just CSS), closing the CSS-only blind spot from #520, and converges ~64 arbitrarytext-[..]/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— arbitrarytext-[12px]/leading-[1.45]utilities living in.tsxclassName 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: addreadRendererTsxFiles()typography-converge+line-height-convergecontracts: new TSX-scanning test (regex covers numeric arbitrary,length:calc(..), andtext-*/[<num>]slash line-height modifier; var/color refs, named scales, andleading-[Npx]icon-centering stay allowed) + negative casesprimitives/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@maka/uichat-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 preservedNot included:
Verification
npm run typecheck— green (all workspaces)npm run -w @maka/desktop test— 2135/2136 passnpm test --workspace @maka/ui— 45/45 passcodex exec review --base origin/main— PASS (no P0/P1/P2/P3)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
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).Checklist