feat(native): emit canonical Swift/Flutter colour tokens from the DTCG #62
No reviewers
Labels
No labels
priority
P1
priority
P2
priority
P3
priority
P4
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Toilville/toilville-design!62
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/native-token-emitter"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Implements recommendation #1 from the theme-alignment strategy (PR #61): the native apps were the drift surface — Swift/Flutter hand-maintained divergent values under the canonical token names, with no emitter. This adds one.
udg/generators/native.pygenerates, per native-consuming product (rituals, detected from the sync-manifestconsumers:block), from the resolved canonicaldist/<p>/tokens.dtcg.json(keyed byudg.dart-key):dist/rituals/udg_tokens.dart—udgColorLightHex/udgColorDarkHexconst maps in the sibling's exact format → a drop-in for the Flutter udg package colour maps.dist/rituals/udg_colors.json—{ "<theme>": { "<dartKey>": "#AARRGGBB" } }colour manifest for the macOS Swift app.It fixes the proven drift
The emitted values are canonical — e.g.
brandPrimary 0xFFC05734where the Flutter package had drifted to#CC5C37;accentWarning,textDim,textMetalikewise. These are exactly the four divergencesjust align-checkreported. Once the sibling repo source-injectsdist/rituals/udg_tokens.dart, the drift check goes green.Generated + gated
just buildandjust check(native.py check— byte-drift gate, same pattern asartifact.py).packages/udg/lib/src/udg_colors.dart; colour JSON → the macOSudg_tokens.json).Scope
Colour only — the proven drift. The full multi-tier
udg_tokens.json(borders / spaces / radii / types / breakpoints / mode_accents / …) is a documented follow-up: those categories are app-specific and the original generator was deleted, so faithful reproduction is riskier and deserves its own change. The remaining cross-repo step (having the sibling adopt the emitted files via the source-inject) is also a follow-up.Testing
just checkgreen (incl.native.py check— "native OK — 1 product match") ·pytest132 passed ·yamllintclean. Verified drift detection (tampering the emitted file fails the gate) and canonical values in both outputs.Closes the native colour-drift loop — the drift surface identified in the theme- alignment strategy. udg/generators/native.py generates, per native-consuming product (rituals, from the sync-manifest consumers), from the resolved canonical dist/<p>/tokens.dtcg.json keyed by udg.dart-key: - dist/rituals/udg_tokens.dart — `udgColorLightHex` / `udgColorDarkHex` const maps in the sibling's exact format, a drop-in for the Flutter udg package colour maps. - dist/rituals/udg_colors.json — { "<theme>": { "<dartKey>": "#AARRGGBB" } } colour manifest for the macOS Swift app. The emitted values are canonical — brandPrimary 0xFFC05734 (the Flutter pkg had drifted to #CC5C37), and accentWarning / textDim / textMeta likewise (exactly the divergences `just align-check` reported). Wired into `just build` + `just check` (byte-drift gate, like artifact.py); the sync-manifest declares the new source-inject consumers (dart-colors + colour JSON). Colour only — the proven drift. The full multi-tier udg_tokens.json (borders/spaces/radii/types/breakpoints/…) is a documented follow-up (its app-specific categories + deleted original generator make faithful reproduction riskier). Implements recommendation #1 (colour scope) from docs/reviews/theme-alignment-strategy.md (PR #61). just check green · pytest 132/132 · yamllint clean.