Skip to content

refactor(desktop): move view fonts, spacing and radii onto the design tokens - #1570

Merged
janicduplessis merged 2 commits into
feat/1553-desktop-componentsfrom
feat/1554-desktop-views
Sep 26, 2026
Merged

janicduplessis merged 2 commits into
feat/1553-desktop-componentsfrom
feat/1554-desktop-views

Conversation

@janicduplessis

@janicduplessis janicduplessis commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Description

With the tokens (#1567) and the kit (#1568) in place, the views still passed raw sizes to Theme.body(_:), Theme.heading(_:) and Theme.mono(_:) (about 20 distinct sizes) and used raw spacing, padding and cornerRadius literals, 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:)), and Theme's size helpers are gone. The mapping to the macOS sizes from macosText:

Old size Variant
10.5 caption2
11, mono default caption
11.5 footnote
12 callout
13, heading 13 body (heading 13 as semibold)
heading 14, 15, 16, 17 headline (15 semibold)
heading 20, 22, 26 title (22 semibold)

Spacing, padding and radii map to the nearest token, rounding ties down as the phone did in #1562 (10 to md 8, 14 to lg 12, 9 to md). 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:

  • Headings of 14, 16 and 17 pt (onboarding titles, the wall's workspace titles, sheet titles, the empty state title) are 15 pt; the 20 pt pairing-sheet title and reclaimable figure are 22 pt; Machine's 26 pt free-space figure is 22 pt.
  • Spacing of 10, 14, 18, 22 and 28 shrinks by 2 to 4 pt, so the pages, the inspector and the activity sheet are slightly denser; 3 becomes 2 (title/subtitle stacks and the icon button's badge gap), 5 becomes 4, and the empty state's 40 pt padding becomes 32. Radii of 6 and 8 become 7, 5 becomes 4, and 14 becomes 12.
  • On the Machine page, the divider between nested worktree rows starts at 40 pt instead of 36, aligned with the row text.

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 gc preview 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.

light-0
light-1
light-2
dark-0
dark-1
dark-2

swift build, swift build -c release and swift test pass in apps/desktop.

Fixes #1554

@janicduplessis
janicduplessis added this pull request to stack #1569 September 26, 2026 19:18

@janicduplessis janicduplessis left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/mono call against the PR table (headline and title default to semibold, mono ignores weight), and each spacing/padding/cornerRadius literal against the nearest token with ties rounded down. Every changed line matches. The one script mismatch was FlowLayout(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/mono and Font.stim both return Font, so the Text + Text sites and the .font modifiers still type-check. swift build, swift build -c release and swift test pass 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: 520 and 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

  1. apps/desktop/Sources/StimDesktop/Views/MachineView.swift:38 still has .padding(compact ? 20 : 28), and :381 still 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 to Space.xxxl. Fix: use compact ? Space.xxl : Space.xxxl and nested ? Space.xxxl : 0.
  2. MachineView.swift:310: the separator between nested worktree rows moves from .padding(.leading, 36) to Space.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.
  3. 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 outside Theme.*, 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

  1. "12.5 pt text (regular buttons) is 12 pt" and the 12.5 in 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 of Components.swift in the kit PR. Drop the bullet, or say it comes from #1568.

  2. The visual-change list leaves out several changes in this diff:

    • spacing: 3 becomes 2 in 8 places: title/subtitle stacks in AttentionView, BuildCacheSection, PhonesView and Sidebar, plus IconButton's icon-to-badge gap.
    • spacing: 5 and padding(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.

  3. The description says the 1 pt stacks between a title and its subtitle stay literal. ActivitySheet.swift:340 LazyVStack(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.

  4. 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.

@janicduplessis
janicduplessis marked this pull request as ready for review September 26, 2026 19:51
@janicduplessis
janicduplessis merged commit a450395 into main Sep 26, 2026
1 check passed
@janicduplessis
janicduplessis deleted the feat/1554-desktop-views branch September 26, 2026 19:57
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.

desktop: migrate views to the design tokens and component kit

1 participant