mobileui-os 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/AGENTS.md +47 -0
  2. package/CHANGELOG.md +25 -0
  3. package/README.md +78 -0
  4. package/bin/cli.mjs +375 -0
  5. package/knowledge/android/00-apple-to-android-adaption.md +1499 -0
  6. package/knowledge/android/accessibility.md +333 -0
  7. package/knowledge/android/components-controls.md +270 -0
  8. package/knowledge/android/material-design-3.md +174 -0
  9. package/knowledge/android/navigation-patterns.md +212 -0
  10. package/knowledge/apple/00-skill-reading-protocol.md +1296 -0
  11. package/knowledge/apple/Accessibility, Inclusive Design & Human Factors Intelligence.md +735 -0
  12. package/knowledge/apple/Advanced Interaction Patterns, Gestures, Feedback & State Transitions.md +1140 -0
  13. package/knowledge/apple/Advanced Navigation, Information Architecture & Wayfinding.md +551 -0
  14. package/knowledge/apple/Autonomus Ui-UX Improvement Loop.md +611 -0
  15. package/knowledge/apple/Color, Materials, Contrast, Themes & Visual Depth.md +1351 -0
  16. package/knowledge/apple/Content, Copy, Microinteractions & UX Communication.md +642 -0
  17. package/knowledge/apple/Data-Heavy Interfaces, Tables, Lists, Search, Filtering & Large-Scale Content.md +721 -0
  18. package/knowledge/apple/Design Systems & Component Architecture.md +412 -0
  19. package/knowledge/apple/Forms, Input, Data Entry & Validation Intelligence.md +705 -0
  20. package/knowledge/apple/Interaction, State & Edge-Case Engineering.md +491 -0
  21. package/knowledge/apple/Interaction-behaviour.md +1378 -0
  22. package/knowledge/apple/Layout Architecture, Responsive Design & Spatial Systems.md +1365 -0
  23. package/knowledge/apple/MASTER UI-UX ORCHESTRATOR.md +1210 -0
  24. package/knowledge/apple/Navigation Architecture, Routing, Deep Linking & State Restoration.md +1392 -0
  25. package/knowledge/apple/Navigation, Information Architecture & Spatial Hierarchy.md +1613 -0
  26. package/knowledge/apple/Notifications, Permissions, Privacy and Trust.md +1540 -0
  27. package/knowledge/apple/Patterns-templates-composition.md +647 -0
  28. package/knowledge/apple/Performance, Perceived Speed, Motion & Rendering Intelligence.md +855 -0
  29. package/knowledge/apple/Responsive, Adaptive & Cross-Platform UI Intelligence.md +669 -0
  30. package/knowledge/apple/Responsive, Adaptive, Accessible & Performant UI.md +545 -0
  31. package/knowledge/apple/Tablet Adaptation & Multi-Device UX.md +1447 -0
  32. package/knowledge/apple/UI Implementation & Refactoring.md +498 -0
  33. package/knowledge/apple/UI-UX Decision-Making, Prioritization & Trade-offs.md +533 -0
  34. package/knowledge/apple/UI-UX Project Lifecycle & Delivery.md +544 -0
  35. package/knowledge/apple/User Flows & Experience Architecture.md +335 -0
  36. package/knowledge/apple/Visual Design Systems, Theming, Tokens & Brand Intelligence.md +764 -0
  37. package/knowledge/apple/Visual QA, Testing & Validation.md +557 -0
  38. package/knowledge/apple/accessibility-inclusive-interaction.md +1361 -0
  39. package/knowledge/apple/accessibility.md +2162 -0
  40. package/knowledge/apple/color.md +1933 -0
  41. package/knowledge/apple/component-architecture.md +2208 -0
  42. package/knowledge/apple/components.md +2172 -0
  43. package/knowledge/apple/design-decision-framework.md +1883 -0
  44. package/knowledge/apple/design-review-engine.md +2108 -0
  45. package/knowledge/apple/design-tokens.md +1943 -0
  46. package/knowledge/apple/designing-for-ios.md +1680 -0
  47. package/knowledge/apple/gestures, touch behavior, feedback, motion, and micro-interactions.md +1538 -0
  48. package/knowledge/apple/hig-foundation.md +1806 -0
  49. package/knowledge/apple/iconography.md +1903 -0
  50. package/knowledge/apple/interaction-patterns.md +2513 -0
  51. package/knowledge/apple/interaction.md +2141 -0
  52. package/knowledge/apple/ios-alerts-confirmations-destructive-actions.md +1342 -0
  53. package/knowledge/apple/ios-components-and-controls.md +1634 -0
  54. package/knowledge/apple/ios-components-patterns.md +1343 -0
  55. package/knowledge/apple/ios-design-system-architecture.md +1520 -0
  56. package/knowledge/apple/ios-empty-error-offline-states.md +1370 -0
  57. package/knowledge/apple/ios-empty-loading-error-recovery.md +1674 -0
  58. package/knowledge/apple/ios-forms-and-input.md +1458 -0
  59. package/knowledge/apple/ios-forms-input-data-entry.md +1308 -0
  60. package/knowledge/apple/ios-gestures-and-touch.md +1272 -0
  61. package/knowledge/apple/ios-lists-collections-and-data-display.md +1735 -0
  62. package/knowledge/apple/ios-loading-progress-async-states.md +1378 -0
  63. package/knowledge/apple/ios-materials-and-surfaces.md +1543 -0
  64. package/knowledge/apple/ios-motion-animation-transitions.md +1178 -0
  65. package/knowledge/apple/ios-navigation-and-information-architecture.md +1674 -0
  66. package/knowledge/apple/ios-navigation-user-flows-design-architecture.md +1195 -0
  67. package/knowledge/apple/ios-search-and-discovery.md +1456 -0
  68. package/knowledge/apple/ios-search-filtering-discovery.md +1402 -0
  69. package/knowledge/apple/ios-sheets-modals-popovers.md +1205 -0
  70. package/knowledge/apple/ios-typography-icons-visual-hierarchy.md +1431 -0
  71. package/knowledge/apple/layout.md +2331 -0
  72. package/knowledge/apple/media-centric-content-ui-patterns.md +1470 -0
  73. package/knowledge/apple/motion, transitions, physics, and animation language.md +1535 -0
  74. package/knowledge/apple/motion-and-animation.md +1698 -0
  75. package/knowledge/apple/motion.md +2087 -0
  76. package/knowledge/apple/navigation.md +2281 -0
  77. package/knowledge/apple/responsive-adaptive.md +2159 -0
  78. package/knowledge/apple/screen-architecture.md +2067 -0
  79. package/knowledge/apple/typography, Content Hierarchy & Readability.md +1411 -0
  80. package/knowledge/apple/typography.md +1802 -0
  81. package/knowledge/apple/ui-ux inteligence audit.md +106 -0
  82. package/knowledge/apple/visual-design-and-premium-ui.md +1555 -0
  83. package/knowledge/apple/visual-hierarchy-engine.md +1647 -0
  84. package/knowledge/apple/visual-materials.md +2189 -0
  85. package/package.json +53 -0
  86. package/principles/design-principles.md +37 -0
  87. package/principles/platform-principles.md +25 -0
  88. package/principles/ux-principles.md +16 -0
  89. package/references/official-links.md +11 -0
  90. package/skills/accessibility-engineer/SKILL.md +125 -0
  91. package/skills/analytics-engineer/SKILL.md +283 -0
  92. package/skills/animation-engineer/SKILL.md +316 -0
  93. package/skills/component-designer/SKILL.md +75 -0
  94. package/skills/component-library-engineer/SKILL.md +140 -0
  95. package/skills/component-library-ops/SKILL.md +155 -0
  96. package/skills/design-system/SKILL.md +77 -0
  97. package/skills/design-token-engineer/SKILL.md +203 -0
  98. package/skills/design-token-pipeline/SKILL.md +277 -0
  99. package/skills/device-lab-engineer/SKILL.md +387 -0
  100. package/skills/forms-engineer/SKILL.md +79 -0
  101. package/skills/internationalization-engineer/SKILL.md +256 -0
  102. package/skills/motion-designer/SKILL.md +77 -0
  103. package/skills/native-data-fetching/SKILL.md +50 -0
  104. package/skills/navigation-architect/SKILL.md +65 -0
  105. package/skills/performance-engineer/SKILL.md +250 -0
  106. package/skills/platform-specialist/SKILL.md +95 -0
  107. package/skills/pre-release-gate/SKILL.md +75 -0
  108. package/skills/screen-designer/SKILL.md +117 -0
  109. package/skills/security-engineer/SKILL.md +375 -0
  110. package/skills/skills.json +134 -0
  111. package/skills/testing-auditor/SKILL.md +62 -0
  112. package/skills/ui-architect/SKILL.md +86 -0
  113. package/skills/ui-implementer/SKILL.md +188 -0
  114. package/skills/ux-architect/SKILL.md +49 -0
  115. package/skills/ux-auditor/SKILL.md +52 -0
  116. package/skills/visual-auditor/SKILL.md +71 -0
  117. package/templates/audit-report.md +29 -0
  118. package/templates/design-tokens.ts +33 -0
  119. package/templates/screen-spec.md +61 -0
  120. package/workflows/new-screen.md +17 -0
  121. package/workflows/pre-release.md +21 -0
  122. package/workflows/redesign.md +14 -0
  123. package/workflows/ui-audit.md +22 -0
@@ -0,0 +1,77 @@
1
+ # Design System Engineer
2
+
3
+ Use semantic tokens. Build a shared, versioned, platform-agnostic design system.
4
+
5
+ ## Token Families (Required)
6
+
7
+ | Family | Examples | Purpose |
8
+ |--------|----------|---------|
9
+ | **color** | `primary`, `onPrimary`, `surface`, `onSurface`, `error`, `outline`, `scrim` | Meaning, not hue |
10
+ | **typography** | `display`, `heading`, `subheading`, `body`, `caption`, `label`, `overline` | Scale + weight + line height |
11
+ | **spacing** | `xs:4`, `sm:8`, `md:12`, `lg:16`, `xl:24`, `xxl:32`, `xxxl:48` | Rhythm, not pixels |
12
+ | **radius** | `sm:8`, `md:12`, `lg:16`, `xl:24`, `pill:999` | Shape language |
13
+ | **elevation** | `level0`–`level5` (shadow + surface tint) | Depth, not decoration |
14
+ | **opacity** | `disabled:0.38`, `hover:0.08`, `pressed:0.12`, `focus:0.18` | State, not magic numbers |
15
+ | **motion** | `fast:150`, `standard:250`, `expressive:400` + easing curves | Timing, not guesswork |
16
+ | **icon sizing** | `xs:16`, `sm:20`, `md:24`, `lg:28`, `xl:32` | Consistent scale |
17
+ | **dimensions** | `touchTarget:48`, `navBar:56`, `tabBar:56`, `header:64` | Layout anchors |
18
+
19
+ ## Token Hierarchy
20
+
21
+ ```
22
+ Primitive (raw values) → blue.500, #0ea5e9, 16px
23
+ ↓
24
+ Semantic (meaning) → color.primaryAction, spacing.md
25
+ ↓
26
+ Component (specific usage) → button.primary.background, card.padding
27
+ ↓
28
+ Theme Override (context) → dark.button.primary.background
29
+ ```
30
+
31
+ ## Rules
32
+
33
+ - **No raw values in components** — `backgroundColor: tokens.color.primaryAction`
34
+ - **Semantic > primitive** — Never use `blue.500` directly; alias to `color.primaryAction`
35
+ - **One token per intent** — Don't create `color.primaryButtonBg` if `color.primaryAction` exists
36
+ - **Dark mode in tokens** — Every semantic color has `light`/`dark` mode values
37
+ - **Contrast verified** — All text token pairs ≥4.5:1 (AA) / 7:1 (AAA)
38
+
39
+ ## Theming
40
+
41
+ ```json
42
+ {
43
+ "color": {
44
+ "primaryAction": {
45
+ "light": { "value": "{blue.600}" },
46
+ "dark": { "value": "{blue.400}" }
47
+ },
48
+ "surface": {
49
+ "light": { "value": "{white}" },
50
+ "dark": { "value": "{gray.950}" }
51
+ }
52
+ }
53
+ }
54
+ ```
55
+
56
+ ## Platform Outputs (via `design-token-pipeline`)
57
+
58
+ - **React Native / Expo** → TypeScript (`tokens.ts`)
59
+ - **Web** → CSS Custom Properties (`variables.css`)
60
+ - **Android (Compose)** → Kotlin (`Tokens.kt`)
61
+ - **iOS (SwiftUI)** → Swift (`Tokens.swift`)
62
+ - **Documentation** → Markdown + Figma sync
63
+
64
+ ## Governance
65
+
66
+ - **Versioning**: Semver (patch=token value tweak, minor=new token, major=rename/remove)
67
+ - **Breaking changes**: 3-month deprecation, codemod provided
68
+ - **Figma sync**: Tokens Studio → JSON → CI → publish
69
+ - **Consumer packages**: `@org/design-tokens`, `@org/ui-components`
70
+
71
+ ## Anti-Patterns
72
+
73
+ - Component-specific tokens in shared system
74
+ - Hardcoded dark mode values (use mode overrides)
75
+ - Chained aliases >2 deep
76
+ - Skipping contrast verification
77
+ - Platform-specific tokens in base package
@@ -0,0 +1,203 @@
1
+ # Design Token Engineer
2
+
3
+ Build and maintain the token pipeline: Figma → semantic tokens → platform outputs.
4
+
5
+ ## Responsibilities
6
+
7
+ - Define token architecture (primitive → semantic → component)
8
+ - Automate Figma → code sync
9
+ - Build transformers for each platform (iOS, Android, Web, RN)
10
+ - Manage theming (light/dark, brand, high contrast)
11
+ - Version tokens independently from components
12
+ - Enforce token usage (no raw values in components)
13
+
14
+ ## Token Hierarchy
15
+
16
+ ```
17
+ Primitive (raw values)
18
+ ↓
19
+ Semantic (meaning: color.primary, spacing.md)
20
+ ↓
21
+ Component (specific: button.primary.background)
22
+ ```
23
+
24
+ ### Primitive Tokens (Source of Truth)
25
+ ```json
26
+ // tokens/primitive/color.json
27
+ {
28
+ "blue": { "50": "#eff6ff", "100": "#dbeafe", ..., "900": "#1e3a5f", "950": "#172554" },
29
+ "gray": { "50": "#f9fafb", ..., "950": "#030712" },
30
+ "red": { "500": "#ef4444", "600": "#dc2626" }
31
+ }
32
+ ```
33
+
34
+ ### Semantic Tokens (Product Meaning)
35
+ ```json
36
+ // tokens/semantic/color.json
37
+ {
38
+ "color": {
39
+ "primary": { "value": "{blue.600}", "type": "color" },
40
+ "onPrimary": { "value": "{white}", "type": "color" },
41
+ "primaryContainer": { "value": "{blue.100}", "type": "color" },
42
+ "onPrimaryContainer": { "value": "{blue.900}", "type": "color" },
43
+ "secondary": { "value": "{gray.600}", "type": "color" },
44
+ "surface": { "value": "{white}", "type": "color" },
45
+ "onSurface": { "value": "{gray.900}", "type": "color" },
46
+ "error": { "value": "{red.600}", "type": "color" },
47
+ "outline": { "value": "{gray.300}", "type": "color" }
48
+ }
49
+ }
50
+ ```
51
+
52
+ ### Component Tokens (Specific Usage)
53
+ ```json
54
+ // tokens/component/button.json
55
+ {
56
+ "button": {
57
+ "primary": {
58
+ "background": { "value": "{color.primary}" },
59
+ "label": { "value": "{color.onPrimary}" },
60
+ "backgroundHover": { "value": "{color.primaryContainer}" },
61
+ "backgroundPressed": { "value": "{color.primaryContainer}" }
62
+ },
63
+ "secondary": {
64
+ "background": { "value": "{color.secondary}" },
65
+ "label": { "value": "{color.onSecondary}" }
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ ## Platform Transformers
72
+
73
+ | Platform | Output Format | Tool |
74
+ |----------|---------------|------|
75
+ | React Native / Expo | TypeScript (`tokens.ts`) | Style Dictionary |
76
+ | iOS (SwiftUI) | Swift (`Tokens.swift`) | Figma Tokens Plugin / Custom |
77
+ | Android (Compose) | Kotlin (`Tokens.kt`) | Material Theme Builder / Custom |
78
+ | Web (CSS) | CSS Custom Properties (`tokens.css`) | Style Dictionary |
79
+ | Design Tools | Figma Variables / Tokens Studio | Figma Plugin |
80
+
81
+ ### Transformer Example (Style Dictionary)
82
+ ```javascript
83
+ // transformers/rn.ts
84
+ export const rnTransform = {
85
+ name: 'rn/typescript',
86
+ transform: (tokens) => {
87
+ const output = {};
88
+ for (const [path, token] of Object.entries(tokens)) {
89
+ if (token.type === 'color') output[path] = token.value;
90
+ else if (token.type === 'dimension') output[path] = parseFloat(token.value);
91
+ else output[path] = token.value;
92
+ }
93
+ return `export const tokens = ${JSON.stringify(output, null, 2)} as const;`;
94
+ }
95
+ };
96
+ ```
97
+
98
+ ## Theming
99
+
100
+ ### Theme Definition
101
+ ```json
102
+ // themes/light.json
103
+ {
104
+ "color": {
105
+ "surface": { "value": "{white}" },
106
+ "onSurface": { "value": "{gray.900}" }
107
+ }
108
+ }
109
+
110
+ // themes/dark.json
111
+ {
112
+ "color": {
113
+ "surface": { "value": "{gray.950}" },
114
+ "onSurface": { "value": "{gray.50}" }
115
+ }
116
+ }
117
+
118
+ // themes/high-contrast.json
119
+ {
120
+ "color": {
121
+ "surface": { "value": "{white}" },
122
+ "onSurface": { "value": "{black}" },
123
+ "primary": { "value": "{blue.700}" }
124
+ }
125
+ }
126
+ ```
127
+
128
+ ### Theme Switching (RN)
129
+ ```typescript
130
+ // useTheme.ts
131
+ export function useTheme() {
132
+ const colorScheme = useColorScheme();
133
+ const [theme, setTheme] = useState<'light' | 'dark' | 'high-contrast'>('light');
134
+ return { theme, tokens: themes[theme], setTheme };
135
+ }
136
+ ```
137
+
138
+ ## Figma Sync
139
+
140
+ ### Workflow
141
+ ```
142
+ Figma (Variables)
143
+ → Figma Tokens Plugin / Tokens Studio
144
+ → JSON (primitive)
145
+ → GitHub PR (automated)
146
+ → CI validates
147
+ → Merge → Build transforms
148
+ → Publish @my-org/design-tokens
149
+ ```
150
+
151
+ ### Validation Rules
152
+ - [ ] All semantic tokens reference primitive tokens (no raw hex)
153
+ - [ ] Dark mode tokens defined for every light token
154
+ - [ ] Contrast ratios ≥ 4.5:1 (AA) for text tokens
155
+ - [ ] No duplicate values (alias instead)
156
+ - [ ] Naming convention: `category.subcategory.property.state`
157
+
158
+ ## Versioning
159
+
160
+ | Change | Version | Example |
161
+ |--------|---------|---------|
162
+ | New primitive color | Minor | `1.2.0` |
163
+ | Semantic token alias change | Minor | `1.3.0` |
164
+ | Component token added | Minor | `1.4.0` |
165
+ | Primitive value changed | Patch* | `1.4.1` |
166
+ | Token removed/renamed | Major | `2.0.0` |
167
+
168
+ *Patch if visual change is negligible; minor if noticeable.
169
+
170
+ ## Consumption
171
+
172
+ ```typescript
173
+ // Component using tokens
174
+ import { tokens } from '@my-org/design-tokens';
175
+
176
+ export const Button = ({ variant = 'primary' }) => (
177
+ <Pressable style={[
178
+ styles.base,
179
+ { backgroundColor: tokens.button[variant].background }
180
+ ]}>
181
+ <Text style={{ color: tokens.button[variant].label }}>
182
+ {children}
183
+ </Text>
184
+ </Pressable>
185
+ );
186
+ ```
187
+
188
+ ## CI Gates
189
+
190
+ - [ ] Token validation: no raw values in semantic/component
191
+ - [ ] Contrast check: all text tokens pass AA
192
+ - [ ] Duplicate detection: no unused primitives
193
+ - [ ] Transform build: all platforms generate
194
+ - [ ] TypeScript: generated types valid
195
+ - [ ] Visual regression: token changes tested
196
+
197
+ ## Anti-Patterns
198
+
199
+ - Raw hex/rgba in component code
200
+ - Semantic tokens referencing other semantic tokens (chain > 2)
201
+ - Platform-specific tokens in shared package
202
+ - Hardcoded dark mode values (use theme overlays)
203
+ - Skipping Figma sync (drift)
@@ -0,0 +1,277 @@
1
+ # Design Token Pipeline Engineer
2
+
3
+ Transform design decisions into platform-agnostic tokens and deliver them to every target.
4
+
5
+ ## Token Architecture
6
+
7
+ ```
8
+ Figma / Design Tool
9
+ │
10
+ ▼
11
+ Token Source (JSON / Tokens Studio / Style Dictionary)
12
+ │
13
+ ▼
14
+ Transform Pipeline (Style Dictionary / Token Transformer)
15
+ │
16
+ ├──▶ Web (CSS Custom Properties, JS/TS, SCSS)
17
+ ├──▶ React Native (TypeScript, NativeWind, StyleSheet)
18
+ ├──▶ Expo (CSS-in-JS, @expo/ui)
19
+ ├──▶ Android (XML, Compose ColorScheme, MaterialTheme)
20
+ ├──▶ iOS (SwiftUI Color/Font tokens, UIColor extensions)
21
+ └──▶ Documentation (Markdown, Figma sync)
22
+ ```
23
+
24
+ ## Token Structure (W3C DTCG Format)
25
+
26
+ ```json
27
+ {
28
+ "color": {
29
+ "primary": {
30
+ "50": { "value": "#f0f9ff", "type": "color" },
31
+ "100": { "value": "#e0f2fe", "type": "color" },
32
+ "500": { "value": "#0ea5e9", "type": "color" },
33
+ "900": { "value": "#0c4a6e", "type": "color" }
34
+ },
35
+ "semantic": {
36
+ "background": { "value": "{color.primary.50}", "type": "color" },
37
+ "onBackground": { "value": "{color.primary.900}", "type": "color" },
38
+ "primaryAction": { "value": "{color.primary.500}", "type": "color" }
39
+ }
40
+ },
41
+ "spacing": {
42
+ "xs": { "value": "4", "type": "dimension", "unit": "px" },
43
+ "md": { "value": "16", "type": "dimension", "unit": "px" }
44
+ },
45
+ "typography": {
46
+ "heading": {
47
+ "fontFamily": { "value": "Inter", "type": "fontFamily" },
48
+ "fontSize": { "value": "28", "type": "dimension", "unit": "px" },
49
+ "fontWeight": { "value": "600", "type": "fontWeight" },
50
+ "lineHeight": { "value": "36", "type": "dimension", "unit": "px" },
51
+ "letterSpacing": { "value": "-0.5", "type": "dimension", "unit": "px" }
52
+ }
53
+ }
54
+ }
55
+ ```
56
+
57
+ ## Transform Pipeline (Style Dictionary)
58
+
59
+ ```js
60
+ // build-tokens.js
61
+ const StyleDictionary = require('style-dictionary');
62
+
63
+ StyleDictionary.registerTransform({
64
+ name: 'color/hex-to-rgb',
65
+ type: 'value',
66
+ matcher: token => token.type === 'color',
67
+ transformer: token => hexToRgb(token.value)
68
+ });
69
+
70
+ StyleDictionary.registerTransformGroup({
71
+ name: 'rn',
72
+ transforms: [
73
+ 'attribute/cti',
74
+ 'name/cti/kebab',
75
+ 'color/hex-to-rgb',
76
+ 'dimension/px-to-dp' // RN uses dp
77
+ ]
78
+ });
79
+
80
+ const sd = StyleDictionary.extend({
81
+ source: ['tokens/**/*.json'],
82
+ platforms: {
83
+ rn: {
84
+ transformGroup: 'rn',
85
+ buildPath: 'dist/rn/',
86
+ files: [{
87
+ destination: 'tokens.ts',
88
+ format: 'typescript/module-deep'
89
+ }]
90
+ },
91
+ css: {
92
+ transformGroup: 'css',
93
+ buildPath: 'dist/css/',
94
+ files: [{
95
+ destination: 'variables.css',
96
+ format: 'css/variables'
97
+ }]
98
+ },
99
+ compose: {
100
+ transforms: ['attribute/cti', 'name/cti/pascal', 'color/hex-to-compose'],
101
+ buildPath: 'dist/compose/',
102
+ files: [{
103
+ destination: 'Tokens.kt',
104
+ format: 'kotlin/color-scheme'
105
+ }]
106
+ },
107
+ swift: {
108
+ transforms: ['attribute/cti', 'name/cti/swift', 'color/hex-to-uicolor'],
109
+ buildPath: 'dist/swift/',
110
+ files: [{
111
+ destination: 'Tokens.swift',
112
+ format: 'swift/uicolor'
113
+ }]
114
+ }
115
+ }
116
+ });
117
+
118
+ sd.buildAllPlatforms();
119
+ ```
120
+
121
+ ## Platform Outputs
122
+
123
+ ### React Native (TypeScript)
124
+ ```ts
125
+ // dist/rn/tokens.ts
126
+ export const tokens = {
127
+ color: {
128
+ primary: {
129
+ 50: '#f0f9ff',
130
+ 500: '#0ea5e9',
131
+ },
132
+ semantic: {
133
+ background: '#f0f9ff',
134
+ primaryAction: '#0ea5e9',
135
+ }
136
+ },
137
+ spacing: { xs: 4, md: 16 },
138
+ typography: {
139
+ heading: { fontSize: 28, lineHeight: 36, fontWeight: '600' }
140
+ }
141
+ } as const;
142
+ ```
143
+
144
+ ### CSS Custom Properties
145
+ ```css
146
+ /* dist/css/variables.css */
147
+ :root {
148
+ --color-primary-50: #f0f9ff;
149
+ --color-primary-500: #0ea5e9;
150
+ --color-semantic-background: var(--color-primary-50);
151
+ --color-semantic-primary-action: var(--color-primary-500);
152
+ --spacing-xs: 4px;
153
+ --spacing-md: 16px;
154
+ --typography-heading-font-size: 28px;
155
+ --typography-heading-line-height: 36px;
156
+ }
157
+ ```
158
+
159
+ ### Compose (Kotlin)
160
+ ```kotlin
161
+ // dist/compose/Tokens.kt
162
+ object Tokens {
163
+ object Color {
164
+ val Primary50 = Color(0xFFF0F9FF)
165
+ val Primary500 = Color(0xFF0EA5E9)
166
+ val SemanticBackground = Primary50
167
+ val SemanticPrimaryAction = Primary500
168
+ }
169
+ object Spacing {
170
+ val Xs = 4.dp
171
+ val Md = 16.dp
172
+ }
173
+ object Typography {
174
+ val Heading = TextStyle(
175
+ fontSize = 28.sp,
176
+ lineHeight = 36.sp,
177
+ fontWeight = FontWeight.SemiBold
178
+ )
179
+ }
180
+ }
181
+ ```
182
+
183
+ ### SwiftUI
184
+ ```swift
185
+ // dist/swift/Tokens.swift
186
+ extension Color {
187
+ static let primary50 = Color(hex: "f0f9ff")
188
+ static let primary500 = Color(hex: "0ea5e9")
189
+ static let semanticBackground = primary50
190
+ static let semanticPrimaryAction = primary500
191
+ }
192
+
193
+ extension CGFloat {
194
+ static let spacingXs: CGFloat = 4
195
+ static let spacingMd: CGFloat = 16
196
+ }
197
+
198
+ extension Font {
199
+ static let heading = Font.system(size: 28, weight: .semibold, design: .default)
200
+ }
201
+ ```
202
+
203
+ ## Theming
204
+
205
+ ### Token Layers
206
+ ```
207
+ Base (Primitive) → color.primary.500, spacing.4
208
+ │
209
+ ▼
210
+ Semantic → color.action.primary, spacing.md
211
+ │
212
+ ▼
213
+ Component → button.primary.background, button.padding.horizontal
214
+ │
215
+ ▼
216
+ Theme Override → brand.theme.dark.button.primary.background
217
+ ```
218
+
219
+ ### Dark Mode
220
+ ```json
221
+ {
222
+ "color": {
223
+ "semantic": {
224
+ "background": {
225
+ "value": "{color.primary.50}",
226
+ "type": "color",
227
+ "modes": {
228
+ "dark": { "value": "{color.primary.900}" }
229
+ }
230
+ }
231
+ }
232
+ }
233
+ }
234
+ ```
235
+
236
+ ## Figma Sync
237
+
238
+ ### Tokens Studio Plugin
239
+ 1. Define tokens in Figma (Tokens Studio)
240
+ 2. Export → JSON → commit to repo
241
+ 3. CI builds all platforms
242
+ 4. PR updates token packages
243
+
244
+ ### Automation
245
+ ```yaml
246
+ # .github/workflows/tokens.yml
247
+ on:
248
+ push:
249
+ paths: ['tokens/**']
250
+ jobs:
251
+ build:
252
+ runs-on: ubuntu-latest
253
+ steps:
254
+ - uses: actions/checkout@v4
255
+ - run: npm ci && npm run build:tokens
256
+ - uses: changesets/action@v1
257
+ with:
258
+ publish: npm publish
259
+ ```
260
+
261
+ ## Versioning & Breaking Changes
262
+
263
+ | Change | Version |
264
+ |--------|---------|
265
+ | New token | Minor |
266
+ | Token value change | Patch (if semantic intent preserved) |
267
+ | Token removed/renamed | Major |
268
+ | Transform logic change | Major |
269
+
270
+ ## Validation
271
+
272
+ - [ ] All tokens resolve (no circular refs)
273
+ - [ ] Contrast ratios meet AA for semantic pairs
274
+ - [ ] Naming convention: `category.concept.modifier`
275
+ - [ ] No raw values in semantic/component layers
276
+ - [ ] Platform outputs build without errors
277
+ - [ ] Bundle size within budget