Repository navigation
feat(native): Swift font tokens group by type style and scale - #8418
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec d7bdff4 |
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Visual Regression48 of 502 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 28 more. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
Requesting changes: the grouped Swift font tokens match the owner-approved theme generator spec and every generated value is unchanged, but two items need fixing first.
- Attach the AST-093 FR5 captures of Text and Heading from this head in light, dark, and the largest text size, or mark any state you could not capture as not measured, so the no-visual-change claim rests on captures rather than source.
- In
packages/native/specs/swift/library/theme-generator.md, the G10 acceptance row still namesfont.familyBody; it should befont.family.body.
[Automated review]
| | `radius-<rest>` | `radius.<rest>`: `radius-element` → `radius.element` | | ||
| | `size-element-<rest>`, `border-width` | `size.element<Rest>`: `size-element-md` → `size.elementMd`; `size.borderWidth` | | ||
| | `text-<style>-<part>` | `font.<style>.<part>`, one `TypeStyleTokens` per style with `size`, `weight`, and `leading`: `text-body-size` → `font.body.size`, `text-heading-1-weight` → `font.heading1.weight` | | ||
| | `font-family-<rest>` | `font.family.<rest>`: `font-family-body` → `font.family.body` | |
There was a problem hiding this comment.
Renaming the family members to font.family.<rest> here leaves the G10 acceptance row (line 163) naming font.familyBody, which no longer exists; please update that row to font.family.body in this pull request.
|
/approve-spec a580e77 |
There was a problem hiding this comment.
Approval now waits on an engineering owner's decision: the rewritten G3, G6 and G10 text in the draft packages/native/specs/swift/library/theme-generator.md was approved on the previous head, and the G10 fix commit invalidated that approval. Any engineering owner, including the author if they are one, can record the decision by commenting /approve-spec a580e77860c3e8fad22adeb6c8f6f082ffd6c521 on this pull request, or say what the Swift font token shape should be instead. Separately, AST-093 FR5 still needs captures of Text and Heading in light, dark and at the largest text size attached to the change, or each state you could not capture (and the rendered tree's accessibility) reported as not measured in the description; the regenerated token values themselves are unchanged.
[Automated review]
Summary
Swift font tokens now come grouped the way people use them: each type style holds its size, weight, and line height together (
tokens.font.body.size,tokens.font.heading1.weight), and the family, size, and weight scales sit under their own names (tokens.font.family.body,tokens.font.size.s2xl,tokens.font.weight.bold).Who it helps: app developers styling SwiftUI views from an Astryx theme. Before,
FontTokensheld 63 flat members (bodySize,bodyWeight,bodyLeading,heading1Size, …), so you had to read three members to build one style, and autocomplete was a wall of names. Nowfont.bodyis one value you pass whole, and a theme that leaves out part of a style fails generation with the style's name instead of compiling with a hole.What changes
text-<style>-<part>→font.<style>.<part>with oneTypeStyleTokensstruct (size,weight,leading) per style: body, code, display1–3, heading1–6, label, large, supporting.font-family-<name>→font.family.<name>.font-size-<name>andfont-weight-<name>→font.size.<name>andfont.weight.<name>. A name that starts with a digit takess, asspace.s4does (font.size.s2xl). A style missing its size, weight, or leading fails the run, naming the style.Tokens.swiftand every theme file.TypeStyle(font.body, families: font.family.body)builds a style. Two helpers move onto their scales:font.size.value(for:)andfont.weight.value(named:).theme-generator.mdG3 (the font struct's shape), the G6 table, the G6 verification row, and Current state. README token example.This is Cindy's decision: "For fonts those tokens are complex so I'd rather have it grouped by type."
Existing authority searched
Search terms:
FontTokens,font.bodySize,text-<style>-<part>,TypeStyle,font-family, theme-generator G3/G6. Records found: the Swift theme generator spec (G3, G6), which this pull request amends. Overlapping open pull requests inspected: #8307, #8308, #8310 (Swift views stack; they read flat font members and rebase onto this), and the Swift theme CSS-value converter (in progress; it touches the generator's value parsing, not the token surface). No other record defines the Swift font token shape.Writing rubric results
Tests
vitest run packages/native/src: 52 passed. Covers the G6 cases for every font form, a groupedTokens.swift, a style missing its leading failing with its name, and the drift test against the committed Swift.tsc --noEmitfor the native package.swiftc -typecheckofAstryxNative,Astryx, the tests, and the templates. Text and Heading tests read the grouped tokens.pnpm check:knowledge.Captures (AST-093 FR5)
iPhone 16 simulator, iOS 18.5, Xcode 16.4, built from this PR's head (
a580e77): every Text type, size, weight and color; Heading levels, display types,justify, andmaxLines; light, dark, and the largest text size (AX5, top and end).Accessibility tree: not measured. The captures show pixels; the Swift tests check the accessible names.