@reqvire-org/ads 0.3.45 → 0.3.46

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 (98) hide show
  1. package/README.md +3 -1
  2. package/dist/a11y.mjs +100 -0
  3. package/dist/assets.mjs +25 -1
  4. package/dist/capture/worker.mjs +1 -1
  5. package/dist/capture-store.mjs +2 -1
  6. package/dist/capture.mjs +5 -2
  7. package/dist/check.mjs +2 -1
  8. package/dist/cli.mjs +12 -0
  9. package/dist/config.mjs +3 -0
  10. package/dist/contracts/tokens.json +1 -1
  11. package/dist/design-values.mjs +8 -2
  12. package/dist/foundation.mjs +3 -0
  13. package/dist/mcp/apps.mjs +1 -1
  14. package/dist/mcp/preview-widget.bundle.js +19 -13
  15. package/dist/mcp/project-widget.bundle.js +25 -25
  16. package/dist/mcp/server.mjs +3 -1
  17. package/dist/mcp/widget.bundle.js +15 -15
  18. package/dist/preview-resources.mjs +1 -1
  19. package/dist/showcase/client.bundle.js +25 -25
  20. package/dist/showcase/index.html +1 -1
  21. package/dist/skills/ads-break-ui/references/captures.md +3 -2
  22. package/dist/skills/ads-break-ui/references/design-data.md +89 -0
  23. package/dist/skills/ads-designer/SKILL.md +13 -3
  24. package/dist/skills/ads-designer/references/accessibility.md +43 -0
  25. package/dist/skills/ads-designer/references/branding.md +28 -0
  26. package/dist/skills/ads-designer/references/captures.md +3 -2
  27. package/dist/skills/ads-designer/references/design-data.md +89 -0
  28. package/dist/skills/ads-import/references/captures.md +3 -2
  29. package/dist/skills/ads-import/references/design-data.md +89 -0
  30. package/dist/skills/ads-motion/references/build.md +33 -0
  31. package/dist/skills/ads-motion/references/captures.md +3 -2
  32. package/dist/skills/ads-motion/references/design-data.md +89 -0
  33. package/dist/skills/ads-motion/references/motion-review.md +2 -2
  34. package/dist/skills/ads-port/references/captures.md +3 -2
  35. package/dist/skills/ads-port/references/design-data.md +89 -0
  36. package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +76 -0
  37. package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +10 -1
  38. package/dist/starters/preact/ds.config.json +13 -1
  39. package/dist/starters/react/README.md +54 -7
  40. package/dist/starters/react/design-system/assets/glyphs/README.md +12 -0
  41. package/dist/starters/react/design-system/assets/glyphs/aliases.json +1 -0
  42. package/dist/starters/react/design-system/assets/glyphs/check.svg +1 -0
  43. package/dist/starters/react/design-system/assets/glyphs/chevron-down.svg +1 -0
  44. package/dist/starters/react/design-system/assets/glyphs/chevron-right.svg +1 -0
  45. package/dist/starters/react/design-system/assets/glyphs/close.svg +1 -0
  46. package/dist/starters/react/design-system/assets/glyphs/external-link.svg +1 -0
  47. package/dist/starters/react/design-system/assets/glyphs/info.svg +1 -0
  48. package/dist/starters/react/design-system/assets/glyphs/menu.svg +1 -0
  49. package/dist/starters/react/design-system/assets/glyphs/plus.svg +1 -0
  50. package/dist/starters/react/design-system/assets/glyphs/search.svg +1 -0
  51. package/dist/starters/react/design-system/assets/glyphs/warning.svg +1 -0
  52. package/dist/starters/react/design-system/components/Actions/Button/Button.tsx +11 -4
  53. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.fixture.ts +9 -0
  54. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.scenario.tsx +16 -0
  55. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +44 -0
  56. package/dist/starters/react/design-system/components/Actions/IconButton/README.md +14 -0
  57. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.fixture.ts +1 -0
  58. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.scenario.tsx +15 -0
  59. package/dist/starters/react/design-system/components/Content/Icon/Icon.tsx +42 -0
  60. package/dist/starters/react/design-system/components/Content/Icon/README.md +16 -0
  61. package/dist/starters/react/design-system/components/Content/Icon/glyphs.ts +17 -0
  62. package/dist/starters/react/design-system/components/Forms/TextField/TextField.tsx +9 -5
  63. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +12 -0
  64. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +17 -0
  65. package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +75 -0
  66. package/dist/starters/react/design-system/components/Layout/Grid/README.md +21 -0
  67. package/dist/starters/react/design-system/index.ts +3 -0
  68. package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +18 -0
  69. package/dist/starters/react/design-system/review/index.ts +1 -0
  70. package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +10 -1
  71. package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +114 -8
  72. package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +23 -0
  73. package/dist/starters/react/design-system/tokens/{SpaceTypeMotion.ads.scenario.tsx → Layout.ads.scenario.tsx} +1 -1
  74. package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +18 -0
  75. package/dist/starters/react/design-system/tokens/Motion.ads.scenario.tsx +4 -0
  76. package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +30 -0
  77. package/dist/starters/react/design-system/tokens/Shape.ads.scenario.tsx +4 -0
  78. package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +37 -0
  79. package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +4 -0
  80. package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +29 -0
  81. package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +4 -0
  82. package/dist/starters/react/design-system/tokens/base.css +6 -3
  83. package/dist/starters/react/design-system/tokens/colors.css +220 -26
  84. package/dist/starters/react/design-system/tokens/elevation.css +51 -6
  85. package/dist/starters/react/design-system/tokens/spacing.css +67 -3
  86. package/dist/starters/react/design-system/tokens/typography.css +25 -7
  87. package/dist/starters/react/ds.config.json +13 -1
  88. package/dist/themes.mjs +106 -0
  89. package/dist/token-export.mjs +58 -0
  90. package/dist/token-quality.mjs +109 -0
  91. package/dist/tokens.mjs +9 -2
  92. package/docs/ADS.md +34 -5
  93. package/docs/ARCHITECTURE.md +49 -4
  94. package/docs/CHANGELOG.md +64 -12
  95. package/docs/GUIDE.md +31 -3
  96. package/docs/MCP.md +13 -4
  97. package/package.json +1 -1
  98. package/dist/starters/react/design-system/tokens/SpaceTypeMotion.ads.fixture.ts +0 -36
@@ -1,29 +1,223 @@
1
- :root {
2
-
3
- --bg-canvas: #faf9f6;
4
- --bg-surface: #fff;
5
- --bg-hover: #f1efea;
6
- --text-strong: #1e293b;
7
- --text-body: #334155;
8
- --text-muted: #64748b;
9
- --text-inverse: #fff;
10
- --border-default: #d6d3cc;
11
- --accent: #c62648;
12
- --accent-hover: #a91c3a;
13
- --accent-fg: #fff;
14
- --border-focus: var(--accent);
1
+ /* Primitives: 12-step ramps, each step with one job (1–2 backgrounds, 3–5 component
2
+ states, 6–8 borders, 9–10 solid fills, 11–12 text). Themes redefine the ramps under the
3
+ same names, on the page or on one section ([data-theme] on any element). */
4
+ :root, [data-theme="light"] {
5
+ --slate-1: #fdfdfe;
6
+ --slate-2: #f7f9fd;
7
+ --slate-3: #eef1f7;
8
+ --slate-4: #e6eaf1;
9
+ --slate-5: #dde2ea;
10
+ --slate-6: #d4d9e2;
11
+ --slate-7: #c6ccd6;
12
+ --slate-8: #b1b8c2;
13
+ --slate-9: #868d97;
14
+ --slate-10: #747b85;
15
+ --slate-11: #555b64;
16
+ --slate-12: #1d2229;
17
+
18
+ --color-accent-1: #fefdfd;
19
+ --color-accent-2: #fef7f7;
20
+ --color-accent-3: #feeced;
21
+ --color-accent-4: #ffe2e3;
22
+ --color-accent-5: #ffd6d8;
23
+ --color-accent-6: #fec9cc;
24
+ --color-accent-7: #ffb6ba;
25
+ --color-accent-8: #fe949d;
26
+ --color-accent-9: #c90a44;
27
+ --color-accent-10: #b7013c;
28
+ --color-accent-11: #a31d3b;
29
+ --color-accent-12: #440312;
30
+
31
+ --color-green-1: #fbfffb;
32
+ --color-green-2: #f2fdf3;
33
+ --color-green-3: #e3f7e7;
34
+ --color-green-4: #d7f2db;
35
+ --color-green-5: #c9edcf;
36
+ --color-green-6: #bae6c1;
37
+ --color-green-7: #a5dcaf;
38
+ --color-green-8: #82cb92;
39
+ --color-green-9: #04833b;
40
+ --color-green-10: #027634;
41
+ --color-green-11: #006e30;
42
+ --color-green-12: #002a0d;
43
+
44
+ --color-amber-1: #fefdfc;
45
+ --color-amber-2: #fef8f0;
46
+ --color-amber-3: #feefdb;
47
+ --color-amber-4: #fbe6cb;
48
+ --color-amber-5: #f8debb;
49
+ --color-amber-6: #f4d3a7;
50
+ --color-amber-7: #edc58d;
51
+ --color-amber-8: #e7b369;
52
+ --color-amber-9: #fcab05;
53
+ --color-amber-10: #eba005;
54
+ --color-amber-11: #865900;
55
+ --color-amber-12: #402800;
56
+
57
+ --color-red-1: #fefdfd;
58
+ --color-red-2: #fef7f7;
59
+ --color-red-3: #feecea;
60
+ --color-red-4: #fee3e0;
61
+ --color-red-5: #ffd7d3;
62
+ --color-red-6: #fecac5;
63
+ --color-red-7: #feb8b1;
64
+ --color-red-8: #fe968e;
65
+ --color-red-9: #cb1125;
66
+ --color-red-10: #b9031d;
67
+ --color-red-11: #a42025;
68
+ --color-red-12: #450407;
69
+
70
+ --color-blue-1: #fdfdfe;
71
+ --color-blue-2: #f6f9ff;
72
+ --color-blue-3: #e9f2fe;
73
+ --color-blue-4: #dcebff;
74
+ --color-blue-5: #d0e4fe;
75
+ --color-blue-6: #c1dbfe;
76
+ --color-blue-7: #aacfff;
77
+ --color-blue-8: #85baff;
78
+ --color-blue-9: #006bd0;
79
+ --color-blue-10: #0060bb;
80
+ --color-blue-11: #115aa9;
81
+ --color-blue-12: #012147;
82
+ }
83
+
84
+ /* Semantic roles alias ramp steps. They are declared on every themed element too, so a
85
+ section with its own data-theme resolves them against its own ramps. Text pairs meet
86
+ WCAG AA (4.5:1); focus and strong borders 3:1. Disabled roles are neutral and exempt
87
+ from contrast (WCAG); the overlay is the modal scrim. */
88
+ :root, [data-theme] {
89
+ --bg-canvas: var(--slate-2);
90
+ --bg-surface: var(--slate-1);
91
+ --bg-raised: var(--slate-1);
92
+ --bg-field: var(--slate-1);
93
+ --bg-hover: var(--slate-3);
94
+ --bg-active: var(--slate-4);
95
+ --bg-selected: var(--color-accent-3);
96
+ --bg-disabled: var(--slate-3);
97
+ --bg-skeleton: var(--slate-4);
98
+ --bg-overlay: rgb(16 24 40 / 0.45);
99
+ --text-strong: var(--slate-12);
100
+ --text-body: var(--slate-12);
101
+ --text-muted: var(--slate-11);
102
+ --text-inverse: var(--slate-1);
103
+ --text-link: var(--color-accent-11);
104
+ --text-disabled: var(--slate-8);
105
+ --border-subtle: var(--slate-5);
106
+ --border-default: var(--slate-6);
107
+ --border-strong: var(--slate-9);
108
+ --border-focus: var(--color-accent-9);
109
+ --border-disabled: var(--slate-5);
110
+ --accent: var(--color-accent-9);
111
+ --accent-hover: var(--color-accent-10);
112
+ --accent-fg: var(--slate-1);
113
+ --accent-subtle: var(--color-accent-3);
114
+ --accent-text: var(--color-accent-11);
115
+ --success: var(--color-green-9);
116
+ --success-fg: var(--slate-1);
117
+ --success-bg: var(--color-green-3);
118
+ --success-border: var(--color-green-7);
119
+ --success-text: var(--color-green-11);
120
+ --warning: var(--color-amber-9);
121
+ --warning-fg: var(--slate-12);
122
+ --warning-bg: var(--color-amber-3);
123
+ --warning-border: var(--color-amber-7);
124
+ --warning-text: var(--color-amber-11);
125
+ --danger: var(--color-red-9);
126
+ --danger-fg: var(--slate-1);
127
+ --danger-bg: var(--color-red-3);
128
+ --danger-border: var(--color-red-7);
129
+ --danger-text: var(--color-red-11);
130
+ --info: var(--color-blue-9);
131
+ --info-fg: var(--slate-1);
132
+ --info-bg: var(--color-blue-3);
133
+ --info-border: var(--color-blue-7);
134
+ --info-text: var(--color-blue-11);
15
135
  }
16
136
 
17
- :root[data-theme="dark"] {
18
-
19
- --bg-canvas: #17191e;
20
- --bg-surface: #20232a;
21
- --bg-hover: #2c3039;
22
- --text-strong: #f8fafc;
23
- --text-body: #e2e8f0;
24
- --text-muted: #94a3b8;
25
- --border-default: #3b414c;
26
- --accent: #fb7185;
27
- --accent-hover: #fda4af;
28
- --accent-fg: #17191e;
137
+ [data-theme="dark"] {
138
+ --slate-1: #0f1112;
139
+ --slate-2: #16171a;
140
+ --slate-3: #1e2125;
141
+ --slate-4: #25282d;
142
+ --slate-5: #2c2f35;
143
+ --slate-6: #353940;
144
+ --slate-7: #434850;
145
+ --slate-8: #585e67;
146
+ --slate-9: #6e757f;
147
+ --slate-10: #808791;
148
+ --slate-11: #b8bec9;
149
+ --slate-12: #eaf1fb;
150
+
151
+ --color-accent-1: #160e0f;
152
+ --color-accent-2: #201314;
153
+ --color-accent-3: #30191b;
154
+ --color-accent-4: #3e1c1f;
155
+ --color-accent-5: #4b1f24;
156
+ --color-accent-6: #5d242b;
157
+ --color-accent-7: #762b35;
158
+ --color-accent-8: #9b3544;
159
+ --color-accent-9: #f74867;
160
+ --color-accent-10: #fe687c;
161
+ --color-accent-11: #fe9fa6;
162
+ --color-accent-12: #ffeaeb;
163
+
164
+ --color-green-1: #0d120e;
165
+ --color-green-2: #121913;
166
+ --color-green-3: #162519;
167
+ --color-green-4: #172e1c;
168
+ --color-green-5: #193720;
169
+ --color-green-6: #1b4326;
170
+ --color-green-7: #1f542e;
171
+ --color-green-8: #236e3a;
172
+ --color-green-9: #24ae56;
173
+ --color-green-10: #45bd69;
174
+ --color-green-11: #78d68e;
175
+ --color-green-12: #cdffd6;
176
+
177
+ --color-amber-1: #13100c;
178
+ --color-amber-2: #1c160e;
179
+ --color-amber-3: #291e0f;
180
+ --color-amber-4: #34240e;
181
+ --color-amber-5: #3f2b0b;
182
+ --color-amber-6: #4e3306;
183
+ --color-amber-7: #624000;
184
+ --color-amber-8: #7e5402;
185
+ --color-amber-9: #c38406;
186
+ --color-amber-10: #d79202;
187
+ --color-amber-11: #f0b04d;
188
+ --color-amber-12: #feedd7;
189
+
190
+ --color-red-1: #160e0e;
191
+ --color-red-2: #201312;
192
+ --color-red-3: #301917;
193
+ --color-red-4: #3e1c1a;
194
+ --color-red-5: #4c201d;
195
+ --color-red-6: #5d2522;
196
+ --color-red-7: #762c29;
197
+ --color-red-8: #9c3634;
198
+ --color-red-9: #f84b4b;
199
+ --color-red-10: #ff6b65;
200
+ --color-red-11: #ffa098;
201
+ --color-red-12: #feebe9;
202
+
203
+ --color-blue-1: #0d1115;
204
+ --color-blue-2: #12181f;
205
+ --color-blue-3: #162130;
206
+ --color-blue-4: #18283d;
207
+ --color-blue-5: #1a304b;
208
+ --color-blue-6: #1d3a5e;
209
+ --color-blue-7: #234877;
210
+ --color-blue-8: #2a5e9e;
211
+ --color-blue-9: #3792fd;
212
+ --color-blue-10: #5aa3fe;
213
+ --color-blue-11: #91c1ff;
214
+ --color-blue-12: #e7f1ff;
215
+
216
+ /* Each layer up is a step lighter in the dark theme: canvas, surface, raised, field. */
217
+ --bg-canvas: var(--slate-1);
218
+ --bg-surface: var(--slate-2);
219
+ --bg-raised: var(--slate-3);
220
+ --bg-field: var(--slate-3);
221
+ --bg-overlay: rgb(0 0 0 / 0.6);
222
+ --warning-fg: var(--slate-1);
29
223
  }
@@ -1,15 +1,60 @@
1
+ /* Layered shadows at low opacity, softer-looking but stronger in the dark theme; fixed
2
+ stacking layers; motion durations and easing for staying, entering and leaving elements. */
3
+ :root, [data-theme="light"] {
4
+ --shadow-xs: 0 1px 2px 0 rgb(16 24 40 / 0.06);
5
+ --shadow-sm: 0 1px 3px 0 rgb(16 24 40 / 0.1), 0 1px 2px -1px rgb(16 24 40 / 0.1);
6
+ --shadow-md: 0 4px 8px -2px rgb(16 24 40 / 0.1), 0 2px 4px -2px rgb(16 24 40 / 0.06);
7
+ --shadow-lg: 0 12px 16px -4px rgb(16 24 40 / 0.08), 0 4px 6px -2px rgb(16 24 40 / 0.04);
8
+ --shadow-xl: 0 20px 24px -4px rgb(16 24 40 / 0.1), 0 8px 8px -4px rgb(16 24 40 / 0.04);
9
+ }
10
+
11
+ /* Re-resolved on themed sections, like the color roles. */
12
+ :root, [data-theme] {
13
+ --shadow-raised: var(--shadow-md);
14
+ }
15
+
1
16
  :root {
2
- --shadow-xs: 0 1px 2px rgb(15 23 42 / 8%);
3
- --shadow-raised: 0 4px 12px rgb(15 23 42 / 12%);
4
- --dur-fast: 120ms;
5
- --dur-normal: 200ms;
6
- --ease-standard: cubic-bezier(0.2, 0, 0, 1);
7
- --z-overlay: 1000;
17
+ --z-base: 0;
18
+ --z-dropdown: 1000;
19
+ --z-sticky: 1100;
20
+ --z-overlay: 1300;
21
+ --z-modal: 1400;
22
+ --z-toast: 1500;
23
+ --z-tooltip: 1600;
24
+
25
+ /* Durations grow with distance and size: control states, fades, small expansions and
26
+ short moves, expansions and toasts, large changes, background dimming. */
27
+ --dur-instant: 70ms;
28
+ --dur-fast: 110ms;
29
+ --dur-moderate: 150ms;
30
+ --dur-normal: 240ms;
31
+ --dur-slow: 400ms;
32
+ --dur-slower: 700ms;
33
+ /* Everyday curves, and strong ones for rare important moments. Standard moves between
34
+ visible places, enter decelerates in, exit accelerates out. */
35
+ --ease-standard: cubic-bezier(0.2, 0, 0.38, 0.9);
36
+ --ease-enter: cubic-bezier(0, 0, 0.38, 0.9);
37
+ --ease-exit: cubic-bezier(0.2, 0, 1, 0.9);
38
+ --ease-strong: cubic-bezier(0.4, 0.14, 0.3, 1);
39
+ --ease-enter-strong: cubic-bezier(0, 0, 0.3, 1);
40
+ --ease-exit-strong: cubic-bezier(0.4, 0.14, 1, 1);
41
+ }
42
+
43
+ [data-theme="dark"] {
44
+ --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.3);
45
+ --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.35), 0 1px 2px -1px rgb(0 0 0 / 0.35);
46
+ --shadow-md: 0 4px 8px -2px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
47
+ --shadow-lg: 0 12px 16px -4px rgb(0 0 0 / 0.45), 0 4px 6px -2px rgb(0 0 0 / 0.3);
48
+ --shadow-xl: 0 20px 24px -4px rgb(0 0 0 / 0.5), 0 8px 8px -4px rgb(0 0 0 / 0.3);
8
49
  }
9
50
 
10
51
  @media (prefers-reduced-motion: reduce) {
11
52
  :root {
53
+ --dur-instant: 0ms;
12
54
  --dur-fast: 0ms;
55
+ --dur-moderate: 0ms;
13
56
  --dur-normal: 0ms;
57
+ --dur-slow: 0ms;
58
+ --dur-slower: 0ms;
14
59
  }
15
60
  }
@@ -1,15 +1,79 @@
1
+ /* One rhythm: --space-N is N × 2 px. 0–8 px inside components, 12–24 px between related
2
+ elements, 32–80 px between sections, 96–160 px around hero and page sections. Values do
3
+ not change by screen size; step down a size at narrow widths instead. */
1
4
  :root {
2
5
  --space-0: 0;
6
+ --space-1: 2px;
3
7
  --space-2: 4px;
8
+ --space-3: 6px;
4
9
  --space-4: 8px;
5
10
  --space-6: 12px;
6
11
  --space-8: 16px;
12
+ --space-10: 20px;
7
13
  --space-12: 24px;
8
14
  --space-16: 32px;
15
+ --space-20: 40px;
16
+ --space-24: 48px;
17
+ --space-32: 64px;
18
+ --space-40: 80px;
19
+ --space-48: 96px;
20
+ --space-80: 160px;
21
+
22
+ /* Gaps between stacked items and between prose blocks. */
23
+ --space-stack-sm: var(--space-4);
24
+ --space-stack-md: var(--space-8);
25
+ --space-stack-lg: var(--space-12);
26
+ --space-flow-paragraph: var(--space-8);
27
+ --space-flow-heading: var(--space-16);
28
+
29
+ /* Controls line up across buttons, inputs and selects; the smallest is 32 px (WCAG 2.5.8 asks 24). */
30
+ --control-height-sm: 32px;
31
+ --control-height-md: 40px;
32
+ --control-height-lg: 48px;
33
+ --control-padding-sm: 10px;
34
+ --control-padding-md: 14px;
35
+ --control-padding-lg: 18px;
36
+
37
+ /* Icons pair with text: 16 px beside sm/base text, 20 px beside lg, 24 and 32 px stand alone. */
38
+ --icon-sm: 16px;
39
+ --icon-md: 20px;
40
+ --icon-lg: 24px;
41
+ --icon-xl: 32px;
42
+
43
+ --radius-xs: 2px;
9
44
  --radius-sm: 4px;
10
- --radius-md: 8px;
11
- --radius-lg: 12px;
45
+ --radius-md: 6px;
46
+ --radius-lg: 8px;
47
+ --radius-xl: 12px;
48
+ --radius-2xl: 16px;
49
+ --radius-full: 9999px;
50
+
12
51
  --border-w: 1px;
52
+ --border-w-thick: 2px;
13
53
  --focus-w: 2px;
14
- --focus-offset: 2px;
54
+ --focus-offset: 3px;
55
+
56
+ /* Layout. Breakpoints cannot be CSS variables; use 640, 768, 1024 and 1280 px in media
57
+ queries, or container queries against these widths. */
58
+ /* The column grid: 4, 8 and 16 columns from 0, 768 and 1024 px of container
59
+ width; gutters 32 px (wide), 16 px (narrow) or 1 px (condensed); margins 0, 16 and
60
+ 24 px from 0, 768 and 1280 px. Every length is a spacing step. */
61
+ --grid-columns-sm: 4;
62
+ --grid-columns-md: 8;
63
+ --grid-columns-lg: 16;
64
+ --grid-gutter: var(--space-16);
65
+ --grid-gutter-narrow: var(--space-8);
66
+ --grid-gutter-condensed: var(--border-w);
67
+ --grid-margin-sm: var(--space-0);
68
+ --grid-margin-md: var(--space-8);
69
+ --grid-margin-lg: var(--space-12);
70
+
71
+ --content-max: 72ch;
72
+ --container-sm: 40rem;
73
+ --container-md: 48rem;
74
+ --container-lg: 64rem;
75
+ --container-xl: 80rem;
76
+ --app-header-height: 56px;
77
+ --side-pane-width: 280px;
78
+ --navigation-rail-width: 64px;
15
79
  }
@@ -1,13 +1,31 @@
1
+ /* A 16 px body on a modular ladder. Sizes from 3xl up are fluid; line height tightens and
2
+ letter spacing turns negative as size grows. */
1
3
  :root {
2
- --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
3
- --font-mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
4
- --text-sm: 13px;
5
- --text-base: 14px;
6
- --text-lg: 17px;
7
- --text-xl: 21px;
4
+ --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
5
+ --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
6
+
7
+ --text-xs: 0.75rem;
8
+ --text-sm: 0.875rem;
9
+ --text-base: 1rem;
10
+ --text-lg: 1.125rem;
11
+ --text-xl: 1.25rem;
12
+ --text-2xl: 1.5rem;
13
+ --text-3xl: clamp(1.75rem, 1.6rem + 0.6vw, 2rem);
14
+ --text-4xl: clamp(2rem, 1.7rem + 1.3vw, 2.5rem);
15
+ --text-5xl: clamp(2.5rem, 2rem + 2.2vw, 3.25rem);
16
+
8
17
  --weight-normal: 400;
9
18
  --weight-medium: 500;
10
19
  --weight-semibold: 600;
11
- --leading-tight: 1.25;
20
+ --weight-bold: 700;
21
+
22
+ --leading-none: 1;
23
+ --leading-tight: 1.2;
24
+ --leading-snug: 1.35;
12
25
  --leading-normal: 1.5;
26
+ --leading-relaxed: 1.7;
27
+
28
+ --tracking-tight: -0.02em;
29
+ --tracking-normal: 0em;
30
+ --tracking-wide: 0.04em;
13
31
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "framework": "react",
3
+ "themes": [{ "name": "light", "scheme": "light" }, { "name": "dark", "scheme": "dark" }],
3
4
  "behaviorLibraries": [],
4
5
  "acceptance": { "checks": [], "behaviorChecks": false },
5
6
  "validation": { "checks": [], "behaviorChecks": true, "inputs": [] },
@@ -8,6 +9,10 @@
8
9
  },
9
10
  "boundaries": {
10
11
  "styleWrites": [
12
+ {
13
+ "file": "design-system/components/Layout/Grid/Grid.tsx",
14
+ "properties": ["--ds-grid-span-sm", "--ds-grid-span-md", "--ds-grid-span-lg"]
15
+ },
11
16
  {
12
17
  "file": "design-system/review/token-preview/TokenPreview.tsx",
13
18
  "properties": [
@@ -16,5 +21,12 @@
16
21
  }
17
22
  ]
18
23
  },
19
- "assets": { "iconSource": "assets/brand/app-icon.svg" }
24
+ "assets": {
25
+ "iconSource": "assets/brand/app-icon.svg",
26
+ "glyphs": {
27
+ "source": "assets/glyphs",
28
+ "output": "components/Content/Icon/glyphs.ts",
29
+ "attributes": { "fill": "none", "stroke": "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }
30
+ }
31
+ }
20
32
  }
@@ -0,0 +1,106 @@
1
+ import selectorParser from "postcss-selector-parser";
2
+
3
+ // A theme is a named set of token values: roles keep their names, values change. The first
4
+ // declared theme is the default and lives on :root; every other theme overrides values under
5
+ // [data-theme="<name>"], on the document root or on any element (a dark section in a light page).
6
+
7
+ export const defaultThemes = [{ name: "light", scheme: "light" }, { name: "dark", scheme: "dark" }];
8
+
9
+ export function validateThemes(themes) {
10
+ if (!Array.isArray(themes) || !themes.length || themes.length > 8) throw new Error("themes must list 1–8 themes; the first is the default.");
11
+ const names = new Set();
12
+ for (const [index, theme] of themes.entries()) {
13
+ const field = `themes[${index}]`;
14
+ if (!theme || typeof theme !== "object" || Array.isArray(theme)) throw new Error(`${field} must be an object with name and scheme.`);
15
+ const unknown = Object.keys(theme).filter(key => !["name", "scheme"].includes(key));
16
+ if (unknown.length) throw new Error(`${field} has unknown keys: ${unknown.join(", ")}.`);
17
+ if (typeof theme.name !== "string" || !/^[a-z][a-z0-9-]{0,31}$/.test(theme.name)) throw new Error(`${field}.name must be a lowercase name such as "dark" or "high-contrast".`);
18
+ if (!["light", "dark"].includes(theme.scheme)) throw new Error(`${field}.scheme must be "light" or "dark": the color scheme browsers use for native controls.`);
19
+ if (names.has(theme.name)) throw new Error(`Theme "${theme.name}" is declared twice.`);
20
+ names.add(theme.name);
21
+ }
22
+ }
23
+
24
+ const cache = new Map();
25
+ /** What a token definition's scope applies to: every theme ({ base }), named themes
26
+ * ({ themes }), or null for conditions (@media) and selectors that are not themes. */
27
+ export function scopeTheme(scope) {
28
+ if (cache.has(scope)) return cache.get(scope);
29
+ let result = null;
30
+ if (!scope.includes("@") && !scope.includes(" > ")) {
31
+ try {
32
+ let base = false, other = false;
33
+ const themes = new Set();
34
+ selectorParser(root => {
35
+ for (const selector of root.nodes) {
36
+ const nodes = selector.nodes.filter(node => node.type !== "comment");
37
+ const rootNode = node => node.type === "pseudo" && node.value.toLowerCase() === ":root" || node.type === "tag" && node.value.toLowerCase() === "html";
38
+ const themeNode = node => node.type === "attribute" && node.attribute === "data-theme" && (!node.operator || node.operator === "=");
39
+ const rest = nodes.filter(node => !rootNode(node));
40
+ if (rest.length === 0 && nodes.length === 1) base = true;
41
+ else if (rest.length === 1 && themeNode(rest[0]) && nodes.length <= 2) {
42
+ if (rest[0].value === undefined) base = true;
43
+ else themes.add(rest[0].value.replace(/^["']|["']$/g, ""));
44
+ } else other = true;
45
+ }
46
+ }).processSync(scope);
47
+ if (!other) result = base ? { base: true, themes: [...themes] } : themes.size ? { base: false, themes: [...themes] } : null;
48
+ } catch { result = null; }
49
+ }
50
+ cache.set(scope, result);
51
+ return result;
52
+ }
53
+
54
+ /** Theme names a scope mentions, conditional or not, for the declaration check. */
55
+ export const mentionedThemes = scope => [...scope.matchAll(/data-theme\s*=\s*["']?([\w-]+)/g)].map(match => match[1]);
56
+
57
+ /** A token's definition for every theme, if any. */
58
+ export const baseDefinition = token => token.definitions.findLast(definition => scopeTheme(definition.scope)?.base);
59
+
60
+ /** A token's definition in one theme: its own override, else the base one. */
61
+ export function themeDefinition(token, theme) {
62
+ return token.definitions.findLast(definition => { const applies = scopeTheme(definition.scope); return applies && !applies.base && applies.themes.includes(theme); })
63
+ ?? baseDefinition(token);
64
+ }
65
+
66
+ const colorLiteral = /^(?:#[\da-f]{3,8}|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\()/i;
67
+
68
+ /** Themes are declared, add no roles of their own, and override whole color ramps. */
69
+ export function themeFindings(tokens, themes, { dsDir } = {}) {
70
+ const declared = new Set(themes.map(theme => theme.name));
71
+ const diagnostics = [], advisories = [];
72
+ const warn = (rule, at, message, names) => advisories.push({ rule, severity: "warning", file: at.file, line: at.line, column: at.column, ...(names ? { tokens: names } : {}), guidanceUri: "ads://guides/tokens", message });
73
+ const reported = new Set();
74
+ for (const token of tokens) for (const definition of token.definitions) for (const name of mentionedThemes(definition.scope)) {
75
+ if (declared.has(name) || reported.has(`${definition.file}:${definition.line}:${name}`)) continue;
76
+ reported.add(`${definition.file}:${definition.line}:${name}`);
77
+ diagnostics.push({ rule: "theme-undeclared", file: definition.file, line: definition.line, column: definition.column, message: `${token.name} is set for theme "${name}", which ds.config.json does not declare (themes: ${[...declared].join(", ")}). Declare it or fix the name.` });
78
+ }
79
+ for (const token of tokens) {
80
+ if (baseDefinition(token)) continue;
81
+ const themed = token.definitions.find(definition => scopeTheme(definition.scope)?.themes.length);
82
+ if (themed) warn("theme-new-token", themed, `${token.name} exists only in a theme; every theme shares one set of roles, so define it for all themes and change only its value per theme.`, [token.name]);
83
+ }
84
+ // A theme that redefines part of a color ramp mixes two ramps in one theme.
85
+ const ramps = new Map();
86
+ for (const token of tokens) {
87
+ const match = token.name.match(/^(--[\w-]+?)-(\d+)$/), base = baseDefinition(token);
88
+ if (!match || !base || !colorLiteral.test(base.value.trim())) continue;
89
+ if (!ramps.has(match[1])) ramps.set(match[1], []);
90
+ ramps.get(match[1]).push(token);
91
+ }
92
+ for (const theme of themes.slice(1)) {
93
+ const own = token => token.definitions.find(definition => { const applies = scopeTheme(definition.scope); return applies && !applies.base && applies.themes.includes(theme.name); });
94
+ if (!tokens.some(own)) {
95
+ if (dsDir) warn("theme-empty", { file: dsDir, line: 1, column: 1 }, `Theme "${theme.name}" is declared but sets no token values; give it values under [data-theme="${theme.name}"] or remove it from ds.config.json.`);
96
+ continue;
97
+ }
98
+ for (const [ramp, steps] of ramps) {
99
+ const set = steps.filter(own);
100
+ if (!set.length || set.length === steps.length) continue;
101
+ const missing = steps.filter(step => !own(step)).map(step => step.name).sort((a, b) => Number(a.match(/\d+$/)[0]) - Number(b.match(/\d+$/)[0]));
102
+ warn("theme-coverage", own(set[0]), `Theme "${theme.name}" sets ${set.length} of ${steps.length} ${ramp}-* steps; it also needs ${missing.join(", ")}, or the ramp mixes two themes.`, missing);
103
+ }
104
+ }
105
+ return { diagnostics, advisories };
106
+ }
@@ -0,0 +1,58 @@
1
+ import { inspectTokens } from "./tokens.mjs";
2
+ import { parseColor } from "./token-quality.mjs";
3
+ import { baseDefinition, themeDefinition } from "./themes.mjs";
4
+
5
+ // The W3C Design Tokens Community Group format (draft): JSON groups of tokens with $value,
6
+ // $type and {group.token} references. The format has no themes yet: a document holds one
7
+ // theme's values, and the other definitions travel in this tool's $extensions entry, as do
8
+ // CSS values the format cannot express.
9
+ const extension = "org.reqvire.ads";
10
+
11
+ /** A token's path in the export: its family, then the rest of its name. */
12
+ function tokenPath(name) {
13
+ const bare = name.slice(2), dash = bare.indexOf("-");
14
+ return dash < 0 ? [bare, "$root"] : [bare.slice(0, dash), bare.slice(dash + 1)];
15
+ }
16
+ const reference = name => `{${tokenPath(name).join(".")}}`;
17
+
18
+ /** A CSS value as a DTCG value and type, or null when the format cannot express it. */
19
+ function typed(name, value) {
20
+ const text = value.trim();
21
+ const alias = text.match(/^var\(\s*(--[\w-]+)\s*\)$/);
22
+ if (alias) return { $value: reference(alias[1]) };
23
+ const color = parseColor(text);
24
+ if (color && !/^(?:--font-|--weight-|--leading-|--z-)/.test(name)) {
25
+ const hex = `#${color.slice(0, 3).map(channel => Math.round(channel).toString(16).padStart(2, "0")).join("")}`;
26
+ return { $type: "color", $value: { colorSpace: "srgb", components: color.slice(0, 3).map(channel => Number((channel / 255).toFixed(4))), ...(color[3] < 1 ? { alpha: color[3] } : {}), hex } };
27
+ }
28
+ let match = text.match(/^(-?\d*\.?\d+)(px|rem)$/);
29
+ if (match) return { $type: "dimension", $value: { value: Number(match[1]), unit: match[2] } };
30
+ match = text.match(/^(\d*\.?\d+)(ms|s)$/);
31
+ if (match) return { $type: "duration", $value: { value: Number(match[1]), unit: match[2] } };
32
+ match = text.match(/^cubic-bezier\(([^)]*)\)$/);
33
+ if (match) return { $type: "cubicBezier", $value: match[1].split(",").map(Number) };
34
+ if (name.startsWith("--font-")) return { $type: "fontFamily", $value: text.split(",").map(family => family.trim().replace(/^["']|["']$/g, "")) };
35
+ if (name.startsWith("--weight-") && /^\d+$/.test(text)) return { $type: "fontWeight", $value: Number(text) };
36
+ if (/^-?\d*\.?\d+$/.test(text)) return { $type: "number", $value: Number(text) };
37
+ return null;
38
+ }
39
+
40
+ /** The project's tokens as one DTCG document, with the values of one theme (default: the first). */
41
+ export function exportTokensDtcg(directory, { theme } = {}) {
42
+ const { tokens, themes } = inspectTokens(directory);
43
+ if (theme !== undefined && !themes.some(item => item.name === theme)) throw new Error(`Unknown theme "${theme}"; the project declares ${themes.map(item => item.name).join(", ")}.`);
44
+ const document = {};
45
+ for (const token of tokens) {
46
+ const base = theme === undefined ? baseDefinition(token) : themeDefinition(token, theme);
47
+ if (!base) continue;
48
+ const entry = typed(token.name, base.value) ?? { $value: base.value.trim() };
49
+ if (!("$type" in entry) && !entry.$value.toString().startsWith("{")) entry.$extensions = { [extension]: { css: base.value.trim() } };
50
+ if (token.meaning) entry.$description = token.meaning;
51
+ const themes = Object.fromEntries(token.definitions.filter(definition => definition !== base).map(definition => [definition.scope, (typed(token.name, definition.value) ?? { $value: definition.value.trim() }).$value]));
52
+ if (Object.keys(themes).length) entry.$extensions = { ...entry.$extensions, [extension]: { ...entry.$extensions?.[extension], scopes: themes } };
53
+ const [group, key] = tokenPath(token.name);
54
+ document[group] ??= {};
55
+ document[group][key] = entry;
56
+ }
57
+ return document;
58
+ }