Adopt latest design tokens + future-proof TokenLoader for multi-mode collections#89
Adopt latest design tokens + future-proof TokenLoader for multi-mode collections#89khoinguyen-mindera wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the design-token pipeline and token payloads to support multi-mode collections safely (pinning iOS-relevant modes) while adopting the latest exported tokens and regenerated Swift token accessors.
Changes:
- Updated
TokenLoaderto pin thethemecollection toalfie-themeand to fail fast when an unpinned collection becomes multi-mode, with new regression tests. - Replaced/adopted updated design token JSON exports (including newly typed
fontWeight/fontFamilyprimitives). - Regenerated Swift token accessors under
SharedUI/GeneratedTokensto reflect the new token schema/content.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| Tools/DesignTokenGen/Tests/DesignTokenGenCoreTests/GeneratorTests.swift | Adds regression tests for theme mode pinning and unpinned multi-mode fast-fail behavior. |
| Tools/DesignTokenGen/Tests/DesignTokenGenCoreTests/Fixtures/mini/manifest.json | Extends fixture manifest with a second theme mode (selfridges) for regression coverage. |
| Tools/DesignTokenGen/Sources/DesignTokenGenCore/TokenLoader.swift | Pins theme mode selection and adds explicit fast-fail for unpinned multi-mode collections. |
| Alfie/AlfieKit/Sources/SharedUI/GeneratedTokens/Typography+Generated.swift | Regenerated typography tokens; currently contains a compile-breaking type mismatch for mediumStrikethrough. |
| Alfie/AlfieKit/Sources/SharedUI/GeneratedTokens/Theme+Generated.swift | Regenerated theme tokens to include newly exported theme surfaces (e.g., button states, borders). |
| Alfie/AlfieKit/Sources/SharedUI/GeneratedTokens/Primitives+Generated.swift | Regenerated primitives, including fontWeight symbols and normalized numeric literals. |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/typography.styles.tokens.json | Updates typography style definitions; currently contains incorrect font-weight bindings for some styles. |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/typography.alfie-theme.tokens.json | Updates underlying typography tokens and introduces typed font-weight primitives. |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/theme.alfie-theme.tokens.json | Updates theme token definitions (expanded button/state tokens, borders, etc.). |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/system.ios.tokens.json | Updates system token exports (ordering + additional system fields like os). |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/sizing.alfie-theme.tokens.json | Updates sizing token exports (reordering + interactive padding tokens). |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/screen-size.small-(s).tokens.json | Updates screen-size small mode tokens (reordering/grouping). |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/manifest.json | Updates manifest collections/modes and adds theme.selfridges mode to the theme collection. |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/.primitives.alfie-theme.tokens.json | Updates primitive exports and adds typed font-weight primitives that were previously missing. |
| Alfie/AlfieKit/Sources/SharedUI/DesignTokens/.broken-ref-allowlist.json | Clears previously allow-listed missing font-weight primitives and updates the fix strategy note. |
|
✅ Both blockers resolved — this is now ready for review.
Rebased onto the latest branch state (which now includes |
|
Superseded by #91 — the same commits were re-homed onto |
Warning
Draft — blocked on two prerequisites. Do not merge until both are resolved:
feat/figma-plugin-export-tool); it must land on that repo'smainbefore this can be re-pulled from a stable source.What changed
Two logical commits:
feat: future-proofTokenLoadermode selection —Tools/DesignTokenGenthemecollection to thealfie-thememode (it gained a second brand mode,selfridges, which iOS doesn't ship).modeForCollection") instead of a crypticfileNotFounddownstream.chore: adopt latest design tokens —SharedUI/DesignTokens+GeneratedTokensfigma-plugin/export (replaces the old third-party-plugin export).fontWeight(previously filtered out entirely) and font-family primitives typedfontFamily, so generated Swift references them as symbols (e.g.fontWeight: Primitives.Typography.fontWeightRegular) instead of inlining literals like400.Known blocker (why the app doesn't compile yet)
Typography+Generated.swiftforbody-medium-strikethroughemits:This is not a codegen bug — the generator faithfully reflects Figma, where
body-medium-strikethrough's font-weight is mis-bound to a font-family variable. The correct-typing improvement above simply made this pre-existing mistake visible (it was previously flattened to a silent400). It resolves once the Figma binding is fixed and tokens are re-pulled. Three sibling styles (body-large,display-small,heading-x-small) are also bound to the wrong style's weight variable but currently resolve to a coincidentally-correct value; worth fixing in the same pass.Test plan
Tools/DesignTokenGenunit tests pass (41 tests), including new multi-mode regression tests./Alfie/scripts/verify.sh— fails at build on the knownbody-medium-strikethroughtype mismatch; will pass once the Figma binding is fixed