Repository navigation
refactor(desktop): move view fonts, spacing and radii onto the design tokens - #1570
Conversation
janicduplessis
left a comment
There was a problem hiding this comment.
Fresh review of the diff against feat/1553-desktop-components (ebb8378). Nothing blocking.
Verification
- I paired every removed and added line hunk by hunk with a script and checked each
Theme.body/heading/monocall against the PR table (headline and title default to semibold,monoignores weight), and eachspacing/padding/cornerRadiusliteral against the nearest token with ties rounded down. Every changed line matches. The one script mismatch wasFlowLayout(spacing: 8, lineSpacing: 6), which my regex missed; it is correct. - The per-variant counts agree too, for example 15
.headline= 4 heading(14) + 7 heading(15) + 1 heading(16) + 2 heading(17) + 1 body(15, semibold), and 9.title= 2 heading(20) + 6 heading(22) + 1 heading(26). - No type changed.
Theme.body/heading/monoandFont.stimboth returnFont, so theText + Textsites and the.fontmodifiers still type-check.swift build,swift build -c releaseandswift testpass locally. Nothing in the repo still refers to the removed helpers. - Narrow windows: only two kinds of text get bigger. The onboarding popup titles go from 14 to 15; the card is
minWidth: 420, maxWidth: 520and the titles wrap. The Pair a Phone title and the disk popover's reclaimable figure go from 20 to 22, inside fixed 420 pt and 340 pt frames with short strings. Every other size change is a decrease. I found no likely truncation or overflow at 700 pt. - The diff adds no comments.
Non-blocking findings
apps/desktop/Sources/StimDesktop/Views/MachineView.swift:38still has.padding(compact ? 20 : 28), and:381still has.padding(.leading, nested ? 24 : 0). The ternaries escaped the mapping. The Machine page therefore keeps 28 pt outer padding, while Needs attention, the wall and the empty workspace detail moved from 28 toSpace.xxxl. Fix: usecompact ? Space.xxl : Space.xxxlandnested ? Space.xxxl : 0.MachineView.swift:310: the separator between nested worktree rows moves from.padding(.leading, 36)toSpace.huge(32). Nested row text starts at 16 + 24 = 40, so the separator now starts 8 pt before the text instead of 4. This is small, but the visual-change list does not mention it. Fix: leave it literal and say why (no 36 token), or list it.apps/desktop/Sources/StimDesktop/Views/BuildCacheSection.swift:281:Text(change.source).font(.system(size: 11, design: .monospaced))is text that was not moved. It is outsideTheme.*, so the mechanical pass missed it, but the description says every font call now names a variant. Fix:.font(.stim(.caption, mono: true)). That also switches it from SF Mono to JetBrains Mono, like the other mono text. Otherwise, qualify the claim in the description.
PR description accuracy
-
"12.5 pt text (regular buttons) is 12 pt" and the
12.5in the table's callout row describe #1568. There is no 12.5 in this diff or in the base branch; the regular button font moved out ofComponents.swiftin the kit PR. Drop the bullet, or say it comes from #1568. -
The visual-change list leaves out several changes in this diff:
spacing: 3becomes 2 in 8 places: title/subtitle stacks in AttentionView, BuildCacheSection, PhonesView and Sidebar, plusIconButton's icon-to-badge gap.spacing: 5andpadding(5)become 4 in Components, RootView and ViewOptionsMenu.EmptyState's.padding(40)becomes 32.- The separator inset changes (item 2).
- Headings of 15 and 22, and body 15 semibold, stay the same size.
These are 1 to 8 pt changes, but the issue asks for every visible change to be listed.
-
The description says the 1 pt stacks between a title and its subtitle stay literal.
ActivitySheet.swift:340LazyVStack(spacing: 1)also stays literal, and it is a row list, not a title/subtitle stack. That is fine, but the description should say 1 pt stays literal wherever it appears. -
Screenshot coverage: the issue asks for the sidebar, All devices, a workspace with the inspector, Machine, Needs attention, Settings and the action sheet, in light, dark and a narrow window. The test plan covers Needs attention, Machine, narrow Needs attention and Settings > App. The views whose text grows (onboarding popups, Pair a Phone sheet, disk popover), and the activity sheet and inspector whose spacing shrinks most, have no screenshots. Adding the activity sheet and a workspace with the inspector would cover most of the remaining risk.
…he miss-reason mono font
Description
With the tokens (#1567) and the kit (#1568) in place, the views still passed raw sizes to
Theme.body(_:),Theme.heading(_:)andTheme.mono(_:)(about 20 distinct sizes) and used rawspacing,paddingandcornerRadiusliterals, so a token change reached only part of the app.Depends on #1568 (stacked on
feat/1553-desktop-components).Solution
Every font call now names a text variant (including the miss-reason popover's file list, which used SF Mono and now uses JetBrains Mono like the rest of the mono text) with
.font(.stim(_:weight:mono:)), andTheme's size helpers are gone. The mapping to the macOS sizes frommacosText:caption2captionfootnotecalloutbody(heading 13 as semibold)headline(15 semibold)title(22 semibold)Spacing, padding and radii map to the nearest token, rounding ties down as the phone did in #1562 (10 to
md8, 14 tolg12, 9 tomd).spacing: 0, every 1 pt spacing, and the 2 pt radius of the 9 pt disk legend swatches stay literal: no token is that small, and rounding them would change their shape. Frame sizes stay literal.Visual changes:
Test plan
Release test copies on the Mac mini, before (left) and after (right), in light and dark: All devices, a workspace without and with the inspector, the
stim gcpreview sheet, Machine, a workspace and Needs attention in a 700 pt window, and Settings > App and Phones. The mini's test home has one idle workspace and no devices, so device tiles are not shown; an OS "access files on a removable volume" prompt from the test copy's bundle sits over part of the sheet and Settings shots in both columns.swift build,swift build -c releaseandswift testpass inapps/desktop.Fixes #1554