@behavioral-agentic-design-system/core 0.5.0 → 0.7.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 (61) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +39 -7
  3. package/scripts/bads-sync.mjs +1 -1
  4. package/scripts/build-fonts.cjs +97 -0
  5. package/scripts/build-tokens.cjs +202 -10
  6. package/src/api/brand-fonts.ts +301 -0
  7. package/src/api/brand-mark.ts +146 -0
  8. package/src/api/layers/file.ts +8 -5
  9. package/src/api/layers.ts +27 -4
  10. package/src/api/site-auth.ts +50 -0
  11. package/src/app/preview/cards/page.tsx +1 -1
  12. package/src/app/preview/components/page.tsx +78 -1
  13. package/src/app/preview/icons/page.tsx +5 -0
  14. package/src/app/shell.tsx +105 -39
  15. package/src/app/site-login/page.tsx +82 -0
  16. package/src/brand-fonts.css +5 -0
  17. package/src/components/Foundations/Motion.stories.tsx +66 -0
  18. package/src/components/brand-mark.tsx +64 -0
  19. package/src/components/customize/brand-mark-section.tsx +265 -0
  20. package/src/components/customize/font-pickers.tsx +293 -0
  21. package/src/components/customize/letter-spacing.tsx +3 -2
  22. package/src/components/customize/save-bar.tsx +11 -5
  23. package/src/components/customize/type-scale.tsx +3 -2
  24. package/src/components/customize-tab.tsx +330 -24
  25. package/src/components/dev-identity-badge.tsx +92 -0
  26. package/src/components/home-tab.tsx +1291 -380
  27. package/src/components/layers-tab.tsx +179 -12
  28. package/src/components/ui/alert.tsx +10 -2
  29. package/src/components/ui/bottom-sheet.tsx +124 -0
  30. package/src/components/ui/button.tsx +2 -2
  31. package/src/components/ui/calendar.tsx +1 -1
  32. package/src/components/ui/chart.tsx +118 -7
  33. package/src/components/ui/checkbox.tsx +3 -2
  34. package/src/components/ui/dialog.tsx +3 -3
  35. package/src/components/ui/index.ts +1 -0
  36. package/src/components/ui/radio-group.tsx +4 -3
  37. package/src/components/ui/sheet.tsx +1 -1
  38. package/src/components/ui/sidebar.tsx +6 -1
  39. package/src/components/ui/sonner.tsx +18 -0
  40. package/src/components/ui/switch.tsx +9 -3
  41. package/src/components/ui/tabs.tsx +7 -1
  42. package/src/fonts/HyperlegibleSans-Bold.woff2 +0 -0
  43. package/src/fonts/HyperlegibleSans-BoldItalic.woff2 +0 -0
  44. package/src/fonts/HyperlegibleSans-Italic.woff2 +0 -0
  45. package/src/fonts/HyperlegibleSans-Medium.woff2 +0 -0
  46. package/src/fonts/HyperlegibleSans-MediumItalic.woff2 +0 -0
  47. package/src/fonts/HyperlegibleSans-Regular.woff2 +0 -0
  48. package/src/fonts/InterVariable-Italic.woff2 +0 -0
  49. package/src/fonts/InterVariable.woff2 +0 -0
  50. package/src/fonts.css +99 -0
  51. package/src/hooks/use-global-brand-mark.ts +64 -0
  52. package/src/hooks/use-global-mono-font.ts +13 -3
  53. package/src/hooks/use-global-primary-color.ts +192 -9
  54. package/src/hooks/use-global-sans-font.ts +5 -3
  55. package/src/hooks/use-global-serif-font.ts +13 -3
  56. package/src/lib/storage.ts +29 -0
  57. package/src/lib/svg-sanitize.ts +272 -0
  58. package/src/styles.css +126 -6
  59. package/src/tokens.json +100 -9
  60. package/src/app/preview/mail/page.tsx +0 -4
  61. package/src/app/preview/pricing/page.tsx +0 -4
@@ -0,0 +1,272 @@
1
+ import { DOMParser, XMLSerializer } from "@xmldom/xmldom";
2
+ import type { Element as XmlElement } from "@xmldom/xmldom";
3
+
4
+ /**
5
+ * Server-side SVG sanitizer + monotone detector.
6
+ *
7
+ * Threat model: a designer pastes or uploads SVG via the Customize tab on
8
+ * their own dev server. Worst-case is an SVG with `<script>` or `on*` handlers
9
+ * executing JS in the design system shell. Stripping those plus dangerous URL
10
+ * protocols closes the obvious holes.
11
+ *
12
+ * Theming: monotone marks (every visible color is the same single value)
13
+ * get their fill/stroke rewritten to `currentColor` so the logo adopts the
14
+ * surrounding text color. Multi-color marks are preserved exactly — those
15
+ * are intentional brand color choices.
16
+ */
17
+
18
+ const ALLOWED_TAGS = new Set([
19
+ "svg",
20
+ "g",
21
+ "path",
22
+ "circle",
23
+ "rect",
24
+ "line",
25
+ "polyline",
26
+ "polygon",
27
+ "ellipse",
28
+ "text",
29
+ "tspan",
30
+ "defs",
31
+ "linearGradient",
32
+ "radialGradient",
33
+ "stop",
34
+ "clipPath",
35
+ "mask",
36
+ "use",
37
+ "symbol",
38
+ "title",
39
+ "desc",
40
+ "marker",
41
+ "pattern",
42
+ "filter",
43
+ "feGaussianBlur",
44
+ "feOffset",
45
+ "feBlend",
46
+ "feFlood",
47
+ "feComposite",
48
+ "feMerge",
49
+ "feMergeNode",
50
+ "feColorMatrix",
51
+ ]);
52
+
53
+ const ALLOWED_ATTRS = new Set([
54
+ "id",
55
+ "class",
56
+ "viewBox",
57
+ "width",
58
+ "height",
59
+ "x",
60
+ "y",
61
+ "x1",
62
+ "y1",
63
+ "x2",
64
+ "y2",
65
+ "cx",
66
+ "cy",
67
+ "r",
68
+ "rx",
69
+ "ry",
70
+ "d",
71
+ "points",
72
+ "fill",
73
+ "stroke",
74
+ "stroke-width",
75
+ "stroke-linecap",
76
+ "stroke-linejoin",
77
+ "stroke-dasharray",
78
+ "stroke-opacity",
79
+ "fill-opacity",
80
+ "fill-rule",
81
+ "clip-rule",
82
+ "opacity",
83
+ "transform",
84
+ "gradientTransform",
85
+ "gradientUnits",
86
+ "spreadMethod",
87
+ "offset",
88
+ "stop-color",
89
+ "stop-opacity",
90
+ "xmlns",
91
+ "xmlns:xlink",
92
+ "xlink:href",
93
+ "href",
94
+ "clip-path",
95
+ "mask",
96
+ "filter",
97
+ "style",
98
+ "preserveAspectRatio",
99
+ "vector-effect",
100
+ "stdDeviation",
101
+ "in",
102
+ "in2",
103
+ "result",
104
+ "mode",
105
+ "type",
106
+ "values",
107
+ "color-interpolation-filters",
108
+ "patternUnits",
109
+ "patternContentUnits",
110
+ ]);
111
+
112
+ const URL_ATTRS = new Set(["href", "xlink:href"]);
113
+
114
+ function stripDangerous(node: XmlElement): boolean {
115
+ // Returns true if the node should be removed.
116
+ const name = node.tagName?.toLowerCase?.();
117
+ if (!name) return true;
118
+ if (!ALLOWED_TAGS.has(name)) return true;
119
+
120
+ const attrs = Array.from(node.attributes ?? []);
121
+ for (const attr of attrs) {
122
+ const an = attr.name.toLowerCase();
123
+ // Strip every event handler attribute outright.
124
+ if (an.startsWith("on")) {
125
+ node.removeAttribute(attr.name);
126
+ continue;
127
+ }
128
+ if (!ALLOWED_ATTRS.has(an)) {
129
+ node.removeAttribute(attr.name);
130
+ continue;
131
+ }
132
+ // Block javascript: and data: URLs in href / xlink:href.
133
+ if (URL_ATTRS.has(an)) {
134
+ const v = (attr.value || "").trim().toLowerCase();
135
+ if (v.startsWith("javascript:") || v.startsWith("data:") || v.startsWith("vbscript:")) {
136
+ node.removeAttribute(attr.name);
137
+ }
138
+ }
139
+ }
140
+
141
+ // Recurse — but copy children first since live NodeList mutation is wonky.
142
+ const children = Array.from(node.childNodes ?? []);
143
+ for (const child of children) {
144
+ if (child.nodeType === 1 /* ELEMENT_NODE */) {
145
+ const drop = stripDangerous(child as unknown as XmlElement);
146
+ if (drop) node.removeChild(child);
147
+ }
148
+ }
149
+ return false;
150
+ }
151
+
152
+ function normalizeColor(raw: string): string | null {
153
+ const v = raw.trim().toLowerCase();
154
+ if (!v) return null;
155
+ if (v === "none" || v === "transparent" || v === "inherit" || v === "currentcolor") return null;
156
+ // Expand 3-char hex (#abc) to 6-char (#aabbcc) so matches across formats.
157
+ if (/^#[0-9a-f]{3}$/.test(v)) {
158
+ return `#${v[1]}${v[1]}${v[2]}${v[2]}${v[3]}${v[3]}`;
159
+ }
160
+ if (/^#[0-9a-f]{6}$/.test(v)) return v;
161
+ // rgb(), rgba(), named colors, etc. — keep verbatim for set-equality.
162
+ return v;
163
+ }
164
+
165
+ function collectColors(node: XmlElement, bag: Set<string>): void {
166
+ const fill = node.getAttribute?.("fill");
167
+ const stroke = node.getAttribute?.("stroke");
168
+ const style = node.getAttribute?.("style");
169
+
170
+ if (fill) {
171
+ const c = normalizeColor(fill);
172
+ if (c) bag.add(c);
173
+ }
174
+ if (stroke) {
175
+ const c = normalizeColor(stroke);
176
+ if (c) bag.add(c);
177
+ }
178
+ if (style) {
179
+ // Minimal parser: split on `;`, find fill: / stroke: declarations.
180
+ for (const decl of style.split(";")) {
181
+ const [prop, val] = decl.split(":").map((s) => s?.trim());
182
+ if (!prop || !val) continue;
183
+ if (prop.toLowerCase() === "fill" || prop.toLowerCase() === "stroke") {
184
+ const c = normalizeColor(val);
185
+ if (c) bag.add(c);
186
+ }
187
+ }
188
+ }
189
+
190
+ for (const child of Array.from(node.childNodes ?? [])) {
191
+ if (child.nodeType === 1) collectColors(child as unknown as XmlElement, bag);
192
+ }
193
+ }
194
+
195
+ function rewriteToCurrentColor(node: XmlElement): void {
196
+ const fill = node.getAttribute?.("fill");
197
+ const stroke = node.getAttribute?.("stroke");
198
+ if (fill && normalizeColor(fill)) {
199
+ node.setAttribute("fill", "currentColor");
200
+ }
201
+ if (stroke && normalizeColor(stroke)) {
202
+ node.setAttribute("stroke", "currentColor");
203
+ }
204
+ const style = node.getAttribute?.("style");
205
+ if (style) {
206
+ const next = style
207
+ .split(";")
208
+ .map((decl) => {
209
+ const [prop, val] = decl.split(":").map((s) => s?.trim());
210
+ if (!prop || !val) return decl;
211
+ const p = prop.toLowerCase();
212
+ if ((p === "fill" || p === "stroke") && normalizeColor(val)) {
213
+ return `${prop}: currentColor`;
214
+ }
215
+ return decl;
216
+ })
217
+ .join(";");
218
+ node.setAttribute("style", next);
219
+ }
220
+ for (const child of Array.from(node.childNodes ?? [])) {
221
+ if (child.nodeType === 1) rewriteToCurrentColor(child as unknown as XmlElement);
222
+ }
223
+ }
224
+
225
+ export type SanitizeResult = {
226
+ ok: true;
227
+ svg: string;
228
+ monotone: boolean;
229
+ colorCount: number;
230
+ } | {
231
+ ok: false;
232
+ error: string;
233
+ };
234
+
235
+ /**
236
+ * Parse, sanitize, and (if monotone) recolor the input SVG. Returns the
237
+ * cleaned string ready to embed via `dangerouslySetInnerHTML`.
238
+ */
239
+ export function sanitizeSvg(input: string): SanitizeResult {
240
+ const trimmed = (input || "").trim();
241
+ if (!trimmed) return { ok: false, error: "Empty SVG" };
242
+ if (!/^<svg[\s>]/i.test(trimmed) && !trimmed.startsWith("<?xml")) {
243
+ return { ok: false, error: "Input does not look like an SVG document" };
244
+ }
245
+
246
+ let doc;
247
+ try {
248
+ doc = new DOMParser({
249
+ onError: () => {
250
+ // Swallow non-fatal parse warnings; we'll catch real errors via
251
+ // the missing documentElement check below.
252
+ },
253
+ }).parseFromString(trimmed, "image/svg+xml");
254
+ } catch (err) {
255
+ return { ok: false, error: `Parse failed: ${(err as Error).message}` };
256
+ }
257
+
258
+ const root = doc?.documentElement as unknown as XmlElement | null;
259
+ if (!root || root.tagName?.toLowerCase() !== "svg") {
260
+ return { ok: false, error: "Root element is not <svg>" };
261
+ }
262
+
263
+ stripDangerous(root);
264
+
265
+ const bag = new Set<string>();
266
+ collectColors(root, bag);
267
+ const monotone = bag.size === 1;
268
+ if (monotone) rewriteToCurrentColor(root);
269
+
270
+ const serialized = new XMLSerializer().serializeToString(root);
271
+ return { ok: true, svg: serialized, monotone, colorCount: bag.size };
272
+ }
package/src/styles.css CHANGED
@@ -12,8 +12,26 @@
12
12
  * Override any token by re-declaring it after this @import.
13
13
  */
14
14
 
15
+ /* Inter Variable leads (the default sans) as the zero-setup CDN fallback;
16
+ * Atkinson Hyperlegible stays as the accessibility-preserving secondary.
17
+ * Self-hosted equivalents in fonts.css win when consumers copy the binaries
18
+ * (see note below). */
19
+ @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
15
20
  @import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&display=swap');
16
21
 
22
+ /* Self-hosted brand faces shipped inside this package. fonts.css holds the
23
+ * canonical SIL OFL defaults (Hyperlegible Sans, 6 weights). brand-fonts.css
24
+ * is generated from brand-fonts.json by `pnpm build:fonts` and carries any
25
+ * client-uploaded faces (Season, etc.). Both reference URLs at /fonts/<file>
26
+ * — consumers copy the binaries from
27
+ * `node_modules/@behavioral-agentic-design-system/core/fonts/` into their own
28
+ * `public/fonts/` so the URLs resolve. See CLIENT_ONBOARDING.md → Shipping
29
+ * fonts. CSS @import order: Google Fonts first (lowest priority fallback),
30
+ * then local @font-face rules so the brand stack wins.
31
+ */
32
+ @import "./fonts.css";
33
+ @import "./brand-fonts.css";
34
+
17
35
  /* Tailwind v4 only generates classes it scans. The shell components, hooks,
18
36
  * and app routes shipped in this package use plenty of Tailwind classes that
19
37
  * the consumer's own source code never references — Button's variants,
@@ -35,9 +53,10 @@
35
53
  /* Brand sans from tokens.json leads. Atkinson Hyperlegible (loaded via the
36
54
  Google Fonts @import above) is the canonical fallback so unbranded
37
55
  consumers still get a high-legibility face out of the box. */
38
- --font-sans: 'Hyperlegible Sans', ui-sans-serif, sans-serif, system-ui, 'Atkinson Hyperlegible', ui-sans-serif, sans-serif, system-ui;
56
+ --font-sans: 'Inter', 'Hyperlegible Sans', ui-sans-serif, sans-serif, system-ui, 'Atkinson Hyperlegible', ui-sans-serif, sans-serif, system-ui;
39
57
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
40
58
  --font-serif: ui-serif, Georgia, serif;
59
+ --font-variation-settings: normal;
41
60
  --font-size-scale: 1;
42
61
 
43
62
  --background: oklch(1 0 0);
@@ -48,6 +67,7 @@
48
67
  --popover-foreground: oklch(0.1450 0 0);
49
68
  --primary: #1F1F1F;
50
69
  --primary-foreground: #FAFAFA;
70
+ --link: var(--primary);
51
71
  --secondary: oklch(0.9700 0 0);
52
72
  --secondary-foreground: oklch(0.2050 0 0);
53
73
  --muted: oklch(0.9700 0 0);
@@ -61,7 +81,7 @@
61
81
  --ring: oklch(0.4500 0 0);
62
82
  --chart-1: oklch(0.6200 0.2000 220);
63
83
  --chart-2: oklch(0.6200 0.2200 145);
64
- --chart-3: oklch(0.6500 0.1800 88);
84
+ --chart-3: oklch(0.6700 0.2000 70);
65
85
  --chart-4: oklch(0.6000 0.2600 340);
66
86
  --chart-5: oklch(0.6200 0.2200 25);
67
87
  --sidebar: oklch(0.9850 0 0);
@@ -102,6 +122,19 @@
102
122
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
103
123
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
104
124
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
125
+ --spring-gentle: cubic-bezier(0.4, 0, 0.2, 1);
126
+ --spring-snappy: cubic-bezier(0.3, 0, 0, 1);
127
+ --spring-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
128
+ --motion-fade-duration: 200ms;
129
+ --motion-fade-ease: cubic-bezier(0, 0, 0.2, 1);
130
+ --motion-slide-duration: 200ms;
131
+ --motion-slide-ease: cubic-bezier(0, 0, 0.2, 1);
132
+ --motion-scale-duration: 150ms;
133
+ --motion-scale-ease: cubic-bezier(0.3, 0, 0, 1);
134
+ --motion-expand-duration: 300ms;
135
+ --motion-expand-ease: cubic-bezier(0.4, 0, 0.2, 1);
136
+ --motion-spin-duration: 300ms;
137
+ --motion-spin-ease: cubic-bezier(0, 0, 1, 1);
105
138
  --spacing: 0.25rem;
106
139
 
107
140
  /* Chart palette — derives from --primary so brand changes propagate.
@@ -123,6 +156,7 @@
123
156
  --popover-foreground: oklch(0.9850 0 0);
124
157
  --primary: #FAFAFA;
125
158
  --primary-foreground: #1F1F1F;
159
+ --link: var(--primary);
126
160
  --secondary: oklch(0.2690 0 0);
127
161
  --secondary-foreground: oklch(0.9850 0 0);
128
162
  --muted: oklch(0.2690 0 0);
@@ -136,10 +170,10 @@
136
170
  --ring: oklch(0.7000 0 0);
137
171
  --chart-1: oklch(0.7800 0.1800 220);
138
172
  --chart-2: oklch(0.8000 0.2000 145);
139
- --chart-3: oklch(0.8500 0.1700 90);
173
+ --chart-3: oklch(0.8500 0.2000 75);
140
174
  --chart-4: oklch(0.7600 0.2200 340);
141
175
  --chart-5: oklch(0.7800 0.1800 25);
142
- --sidebar: oklch(0.2050 0 0);
176
+ --sidebar: oklch(0.1450 0 0);
143
177
  --sidebar-foreground: oklch(0.9850 0 0);
144
178
  --sidebar-primary: oklch(0.4200 0.2000 264.3760);
145
179
  --sidebar-primary-foreground: oklch(0.9850 0 0);
@@ -148,8 +182,13 @@
148
182
  --sidebar-border: oklch(0.5500 0 0);
149
183
  --sidebar-ring: oklch(0.7000 0 0);
150
184
 
151
- /* Lift lightness on dark backgrounds so charts stay readable. */
185
+ /* Chart palette (dark) — same derivation, mode-specific L floor for AAA. */
152
186
  --chart-lightness: 0.78;
187
+ --chart-1: oklch(from var(--primary) var(--chart-lightness) c calc(h + 0));
188
+ --chart-2: oklch(from var(--primary) var(--chart-lightness) calc(c * 0.65) calc(h + 35));
189
+ --chart-3: oklch(from var(--primary) var(--chart-lightness) c calc(h + 70));
190
+ --chart-4: oklch(from var(--primary) var(--chart-lightness) c calc(h + 105));
191
+ --chart-5: oklch(from var(--primary) var(--chart-lightness) c calc(h + 140));
153
192
  }
154
193
 
155
194
  @theme inline {
@@ -161,6 +200,7 @@
161
200
  --color-popover-foreground: var(--popover-foreground);
162
201
  --color-primary: var(--primary);
163
202
  --color-primary-foreground: var(--primary-foreground);
203
+ --color-link: var(--link);
164
204
  --color-secondary: var(--secondary);
165
205
  --color-secondary-foreground: var(--secondary-foreground);
166
206
  --color-muted: var(--muted);
@@ -222,6 +262,9 @@
222
262
  --ease-out: var(--ease-out);
223
263
  --ease-in-out: var(--ease-in-out);
224
264
  --ease-spring: var(--ease-spring);
265
+ --ease-spring-gentle: var(--spring-gentle);
266
+ --ease-spring-snappy: var(--spring-snappy);
267
+ --ease-spring-bounce: var(--spring-bounce);
225
268
 
226
269
  /* Accessibility floor — minimum 14px for text-xs (vs Tailwind's 12px default).
227
270
  Font sizes are dynamically computed by useGlobalTypeScale hook and set as
@@ -267,7 +310,17 @@
267
310
  }
268
311
 
269
312
  @layer base {
270
- * {
313
+ /* Selector is `:root *` rather than the more obvious `*` so this rule beats
314
+ Tailwind's preflight `* { border: 0 solid }` (which resets border-color to
315
+ currentColor = the text color) regardless of which order the consumer
316
+ imports stylesheets in. Both rules live in @layer base; within a layer,
317
+ specificity decides. `:root *` is (0,1,0), `*` is (0,0,0) — we win. Utility
318
+ classes in @layer utilities still beat both because later layers trump
319
+ specificity, so `border-red-500` and friends keep working normally.
320
+ Without this bump, consumers who @import the design system BEFORE
321
+ tailwindcss get a cascade-order race where preflight wins and naked
322
+ `border` utilities render as text color (near-white on dark themes). */
323
+ :root * {
271
324
  @apply border-border outline-ring/50;
272
325
  }
273
326
  /* Bind html to --font-sans so the picker propagates everywhere — not just
@@ -277,6 +330,11 @@
277
330
  fall through to system-ui regardless of the brand-font selection. */
278
331
  html {
279
332
  font-family: var(--font-sans);
333
+ /* Variable-font axis settings (Inter Variable ships by default). Sourced
334
+ from tokens.json → --font-variation-settings so forks tune optical
335
+ size / weight axes without touching component source. "normal" is a
336
+ no-op for static fonts. */
337
+ font-variation-settings: var(--font-variation-settings, normal);
280
338
  }
281
339
  /* Match: monospace elements pick up --font-mono without each component
282
340
  having to remember a `font-mono` class. */
@@ -314,6 +372,20 @@
314
372
  p:not(:last-child) {
315
373
  margin-bottom: 1.5em;
316
374
  }
375
+ /* Flex / grid layout carve-out for the rule above. When <p> is used as
376
+ a UI label inside a flex row or grid cell, the 1.5em ghost margin-
377
+ bottom inflates its margin box, which drags its geometric center
378
+ down. items-center then aligns siblings (org-color dots, icons,
379
+ badges) to a lower y than the visible text. Zero the block margins
380
+ on <p> one level deep into any flex/grid container, and through one
381
+ wrapper, so authors who reach for <p> in obvious UI contexts don't
382
+ silently break alignment. Specificity ties the bare prose rule at
383
+ 0,1,1 — source order resolves the tie, which is why this block must
384
+ follow the rule above. */
385
+ :is(.flex, .inline-flex, .grid, .inline-grid, [class*="grid-cols"]) p,
386
+ :is(.flex, .inline-flex, .grid, .inline-grid, [class*="grid-cols"]) > * > p {
387
+ margin-block: 0;
388
+ }
317
389
  /* WCAG AAA 2.4.13 Focus Appearance: focus indicator must be ≥ 2 CSS
318
390
  pixels thick AND have ≥ 3:1 contrast against adjacent colors. The
319
391
  --ring token is luminance-tuned for 3:1 against every surface in
@@ -336,6 +408,54 @@
336
408
  scroll-behavior: auto !important;
337
409
  }
338
410
  }
411
+ /* Windows High Contrast Mode (forced-colors). Supports SC 1.4.1 (Use of
412
+ Color) and 1.4.11 (Non-text Contrast) for the ~3% of Windows users who
413
+ run HCM. When the OS forces its own palette it discards our custom
414
+ background fills — so a ghost/secondary Button, a selected tab, or a
415
+ checked control that relied on a background tint to read as distinct
416
+ collapses into the body text. The UA keeps token *borders* (mapping
417
+ them to system colors) but cannot invent a boundary where none was
418
+ drawn. These rules restore the structure the override drops; they do
419
+ NOT hardcode brand colors (that's forbidden) — they use the CSS
420
+ system-color keywords HCM actually honors. */
421
+ @media (forced-colors: active) {
422
+ /* Every interactive control gets a drawn boundary so it survives the
423
+ loss of its background fill. ButtonBorder is the system color the UA
424
+ uses for control edges. */
425
+ button,
426
+ [role="button"],
427
+ input,
428
+ select,
429
+ textarea {
430
+ border: 1px solid ButtonBorder;
431
+ }
432
+ /* Focus ring maps to the system Highlight so it is never invisible,
433
+ regardless of the user's chosen high-contrast theme. */
434
+ :focus-visible {
435
+ outline: 2px solid Highlight;
436
+ outline-offset: 2px;
437
+ }
438
+ /* Selected / checked / pressed / active states lose their background
439
+ tint under HCM. Opt out of forced-color-adjust for just these state
440
+ markers and paint the system Highlight so on/off stays legible on
441
+ toggles, switches, selected tabs, and checkboxes. */
442
+ [aria-selected="true"],
443
+ [aria-checked="true"],
444
+ [aria-pressed="true"],
445
+ [data-state="checked"],
446
+ [data-state="active"],
447
+ [data-state="on"] {
448
+ forced-color-adjust: none;
449
+ background-color: Highlight;
450
+ color: HighlightText;
451
+ }
452
+ /* Disabled controls should read as dimmed via the system GrayText color
453
+ rather than our muted token (which the override would flatten). */
454
+ :disabled,
455
+ [aria-disabled="true"] {
456
+ color: GrayText;
457
+ }
458
+ }
339
459
  }
340
460
 
341
461
  /* Global tracking offset — the Letter Spacing slider in the Customize
package/src/tokens.json CHANGED
@@ -158,9 +158,9 @@
158
158
  },
159
159
  "fontFamily": {
160
160
  "sans": {
161
- "$value": "'Hyperlegible Sans', ui-sans-serif, sans-serif, system-ui",
161
+ "$value": "'Inter', 'Hyperlegible Sans', ui-sans-serif, sans-serif, system-ui",
162
162
  "$type": "fontFamily",
163
- "$description": "Primary sans (body, UI). Hyperlegible Sans is the BADS default — production-safe and accessibility-friendly. Override per client."
163
+ "$description": "Primary sans (body, UI). Inter Variable is the BADS default — a single variable woff2 covers weights 100–900, enabling responsive type axes and per-fork weight tuning via --font-variation-settings. Hyperlegible Sans (the Braille Institute's low-vision face) stays second in the stack as the accessibility-preserving fallback and is still self-hosted. ACCESSIBILITY NOTE: forks with a low-vision-heavy audience should reorder to lead with 'Hyperlegible Sans'. Override per client."
164
164
  },
165
165
  "serif": {
166
166
  "$value": "ui-serif, Georgia, serif",
@@ -173,6 +173,11 @@
173
173
  "$description": "Monospace (code, captions). JetBrains Mono is the default fallback."
174
174
  }
175
175
  },
176
+ "fontVariationSettings": {
177
+ "$value": "normal",
178
+ "$type": "other",
179
+ "$description": "Variable-font axis settings applied to html (emitted as --font-variation-settings). Default 'normal' lets the weight/optical-size axes resolve from font-weight + opsz auto. Forks tune type here without touching component source — e.g. \"'opsz' 18\" to pin optical size, or \"'wght' 450\" for a custom default weight. Only takes effect when the active sans is a variable font (Inter Variable ships by default)."
180
+ },
176
181
  "fontSize": {
177
182
  "xs": {
178
183
  "$value": "14px",
@@ -442,7 +447,82 @@
442
447
  },
443
448
  "ease-spring": {
444
449
  "$value": "cubic-bezier(0.34, 1.56, 0.64, 1)",
445
- "$type": "cubic-bezier"
450
+ "$type": "cubic-bezier",
451
+ "$description": "Default spring overshoot. Alias of spring-bounce; kept for back-compat with existing component usage."
452
+ },
453
+ "spring-gentle": {
454
+ "$value": "cubic-bezier(0.4, 0, 0.2, 1)",
455
+ "$type": "cubic-bezier",
456
+ "$description": "No overshoot, soft settle. Use for large surfaces (sheets, dialogs, page transitions) where bounce would feel cheap."
457
+ },
458
+ "spring-snappy": {
459
+ "$value": "cubic-bezier(0.3, 0, 0, 1)",
460
+ "$type": "cubic-bezier",
461
+ "$description": "Fast attack, near-instant settle, no overshoot. Use for small, frequent UI (toggles, tabs, menu open) that should feel immediate."
462
+ },
463
+ "spring-bounce": {
464
+ "$value": "cubic-bezier(0.34, 1.56, 0.64, 1)",
465
+ "$type": "cubic-bezier",
466
+ "$description": "Playful overshoot. Use sparingly for delight moments (success ticks, badge pops). Auto-disabled under prefers-reduced-motion by the base layer."
467
+ }
468
+ },
469
+ "motion": {
470
+ "$description": "Semantic motion layer — intent-named pairings of a duration + easing primitive, so humans and AI pick motion by what it should DO, not by raw numbers. Five intent groups (fade/slide/scale/expand/spin) mirror the slide/fade/scale/rotate/content families. Each emits --motion-<intent>-duration and --motion-<intent>-ease. All motion is auto-killed under prefers-reduced-motion by the base layer. See layer-6-patterns-and-rules/motion.md for the decision tree.",
471
+ "fade": {
472
+ "duration": {
473
+ "$value": "{duration.base}",
474
+ "$type": "dimension",
475
+ "$description": "Opacity in/out — overlays, content swaps, things appearing/disappearing in place."
476
+ },
477
+ "easing": {
478
+ "$value": "{easing.ease-out}",
479
+ "$type": "cubic-bezier"
480
+ }
481
+ },
482
+ "slide": {
483
+ "duration": {
484
+ "$value": "{duration.base}",
485
+ "$type": "dimension",
486
+ "$description": "Positional translate — sheets, drawers, toasts entering from a screen edge."
487
+ },
488
+ "easing": {
489
+ "$value": "{easing.ease-out}",
490
+ "$type": "cubic-bezier"
491
+ }
492
+ },
493
+ "scale": {
494
+ "duration": {
495
+ "$value": "{duration.fast}",
496
+ "$type": "dimension",
497
+ "$description": "Size in/out from an origin — popovers, dropdown menus, tooltips. Snappy spring so it feels instant."
498
+ },
499
+ "easing": {
500
+ "$value": "{easing.spring-snappy}",
501
+ "$type": "cubic-bezier"
502
+ }
503
+ },
504
+ "expand": {
505
+ "duration": {
506
+ "$value": "{duration.slow}",
507
+ "$type": "dimension",
508
+ "$description": "Height / grid-rows reveal — accordions, collapsibles, disclosure (the 'content' family). Slower because the layout shifts around it."
509
+ },
510
+ "easing": {
511
+ "$value": "{easing.ease-in-out}",
512
+ "$type": "cubic-bezier"
513
+ }
514
+ },
515
+ "spin": {
516
+ "duration": {
517
+ "$value": "{duration.slow}",
518
+ "$type": "dimension",
519
+ "$description": "Continuous rotate — loaders, busy chevrons. Pair with infinite iteration; linear timing keeps angular velocity constant."
520
+ },
521
+ "easing": {
522
+ "$value": "cubic-bezier(0, 0, 1, 1)",
523
+ "$type": "cubic-bezier",
524
+ "$description": "Linear (no ease) — the cubic-bezier form of `linear` so $type stays consistent."
525
+ }
446
526
  }
447
527
  },
448
528
  "typography": {
@@ -763,6 +843,11 @@
763
843
  "$type": "color",
764
844
  "$description": "Text on primary. Auto-derived from luminance for custom colors."
765
845
  },
846
+ "link": {
847
+ "$value": "var(--primary)",
848
+ "$type": "color",
849
+ "$description": "Inline link / Button variant=link color. Defaults to --primary so links inherit the brand. Forks whose brand primary fails contrast against the surface (e.g. blurple primary on dark background) can override --link in their theme without monkey-patching the Button component."
850
+ },
766
851
  "secondary": {
767
852
  "$value": "oklch(0.9700 0 0)",
768
853
  "$type": "color"
@@ -824,9 +909,9 @@
824
909
  "$description": "Tuned for AAA 3:1 on white card. Spring green."
825
910
  },
826
911
  "chart-3": {
827
- "$value": "oklch(0.6500 0.1800 88)",
912
+ "$value": "oklch(0.6700 0.2000 70)",
828
913
  "$type": "color",
829
- "$description": "Tuned for AAA 3:1 on white card. Bright gold."
914
+ "$description": "Tuned for AAA 3:1 on white card. Bright orange-yellow."
830
915
  },
831
916
  "chart-4": {
832
917
  "$value": "oklch(0.6000 0.2600 340)",
@@ -956,6 +1041,11 @@
956
1041
  "$type": "color",
957
1042
  "$description": "Near-black text on the inverted dark-mode primary surface."
958
1043
  },
1044
+ "link": {
1045
+ "$value": "var(--primary)",
1046
+ "$type": "color",
1047
+ "$description": "See light-mode --link. In dark mode --primary is near-white (#FAFAFA), so the default link reads at ~19:1 on the dark background. Forks with a dark-mode brand primary that fails contrast (e.g. mid-saturation blurple) should override --link to a lifted variant."
1048
+ },
959
1049
  "secondary": {
960
1050
  "$value": "oklch(0.2690 0 0)",
961
1051
  "$type": "color"
@@ -1017,9 +1107,9 @@
1017
1107
  "$description": "Tuned for AAA 3:1 on dark card. Bright spring green."
1018
1108
  },
1019
1109
  "chart-3": {
1020
- "$value": "oklch(0.8500 0.1700 90)",
1110
+ "$value": "oklch(0.8500 0.2000 75)",
1021
1111
  "$type": "color",
1022
- "$description": "Tuned for AAA 3:1 on dark card. Bright gold."
1112
+ "$description": "Tuned for AAA 3:1 on dark card. Bright orange-yellow."
1023
1113
  },
1024
1114
  "chart-4": {
1025
1115
  "$value": "oklch(0.7600 0.2200 340)",
@@ -1032,8 +1122,9 @@
1032
1122
  "$description": "Tuned for AAA 3:1 on dark card. Bright coral."
1033
1123
  },
1034
1124
  "sidebar": {
1035
- "$value": "oklch(0.2050 0 0)",
1036
- "$type": "color"
1125
+ "$value": "oklch(0.1450 0 0)",
1126
+ "$type": "color",
1127
+ "$description": "Recedes to the page background (matches --background) so chrome sits behind the floating content card (L0.205) instead of level with it. Linear/Vercel calmer-interface pattern. Was L0.205 (== card), which made the sidebar advance."
1037
1128
  },
1038
1129
  "sidebar-foreground": {
1039
1130
  "$value": "oklch(0.9850 0 0)",
@@ -1,4 +0,0 @@
1
- import Mail from "@/components/examples/mail";
2
- export default function MailPreview() {
3
- return <Mail />;
4
- }
@@ -1,4 +0,0 @@
1
- import Pricing from "@/components/examples/pricing/pricing";
2
- export default function PricingPreview() {
3
- return <Pricing />;
4
- }