@behavioral-agentic-design-system/core 0.5.0 → 0.6.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.
- package/package.json +15 -8
- package/scripts/build-fonts.cjs +90 -0
- package/scripts/build-tokens.cjs +84 -8
- package/src/api/brand-fonts.ts +280 -0
- package/src/api/brand-mark.ts +146 -0
- package/src/api/layers/file.ts +4 -2
- package/src/api/layers.ts +23 -1
- package/src/app/font-ready.tsx +1 -1
- package/src/app/layout.tsx +3 -9
- package/src/app/preview/cards/page.tsx +1 -1
- package/src/app/preview/login/page.tsx +5 -0
- package/src/app/shell.tsx +90 -29
- package/src/components/admin-menu.stories.tsx +68 -0
- package/src/components/admin-menu.tsx +59 -0
- package/src/components/brand-mark.tsx +64 -0
- package/src/components/customize/brand-mark-section.tsx +265 -0
- package/src/components/customize/font-pickers.tsx +293 -0
- package/src/components/customize/save-bar.tsx +11 -5
- package/src/components/customize-tab.tsx +329 -24
- package/src/components/dev-identity-badge.tsx +92 -0
- package/src/components/home-tab.tsx +1022 -374
- package/src/components/layers-tab.tsx +38 -9
- package/src/components/ui/alert.tsx +10 -2
- package/src/components/ui/button.tsx +1 -1
- package/src/components/ui/calendar.tsx +1 -1
- package/src/components/ui/chart.tsx +13 -3
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/radio-group.tsx +1 -1
- package/src/components/ui/sidebar.tsx +6 -1
- package/src/components/ui/sonner.tsx +18 -0
- package/src/components/ui/switch.tsx +7 -1
- package/src/components/ui/tabs.tsx +1 -1
- package/src/hooks/use-global-brand-mark.ts +64 -0
- package/src/hooks/use-global-mono-font.ts +13 -3
- package/src/hooks/use-global-primary-color.ts +145 -8
- package/src/hooks/use-global-sans-font.ts +5 -3
- package/src/hooks/use-global-serif-font.ts +14 -4
- package/src/lib/storage.ts +31 -2
- package/src/lib/svg-sanitize.ts +272 -0
- package/src/styles.css +76 -46
- package/src/tokens.default.json +4 -4
- package/src/tokens.json +172 -78
|
@@ -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
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
/* Brand sans from tokens.json leads. Atkinson Hyperlegible (loaded via the
|
|
36
36
|
Google Fonts @import above) is the canonical fallback so unbranded
|
|
37
37
|
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;
|
|
38
|
+
--font-sans: 'Season', 'Hyperlegible Sans', ui-sans-serif, sans-serif, system-ui, 'Atkinson Hyperlegible', ui-sans-serif, sans-serif, system-ui;
|
|
39
39
|
--font-mono: 'JetBrains Mono', ui-monospace, monospace;
|
|
40
|
-
--font-serif: ui-serif, Georgia, serif;
|
|
40
|
+
--font-serif: 'Season Serif', 'Season', ui-serif, Georgia, serif;
|
|
41
41
|
--font-size-scale: 1;
|
|
42
42
|
|
|
43
43
|
--background: oklch(1 0 0);
|
|
@@ -46,8 +46,9 @@
|
|
|
46
46
|
--card-foreground: oklch(0.1450 0 0);
|
|
47
47
|
--popover: oklch(1 0 0);
|
|
48
48
|
--popover-foreground: oklch(0.1450 0 0);
|
|
49
|
-
--primary: #
|
|
49
|
+
--primary: #025FFF;
|
|
50
50
|
--primary-foreground: #FAFAFA;
|
|
51
|
+
--link: var(--primary);
|
|
51
52
|
--secondary: oklch(0.9700 0 0);
|
|
52
53
|
--secondary-foreground: oklch(0.2050 0 0);
|
|
53
54
|
--muted: oklch(0.9700 0 0);
|
|
@@ -59,12 +60,12 @@
|
|
|
59
60
|
--border: oklch(0.6100 0 0);
|
|
60
61
|
--input: oklch(0.6100 0 0);
|
|
61
62
|
--ring: oklch(0.4500 0 0);
|
|
62
|
-
--chart-1: oklch(0.
|
|
63
|
-
--chart-2: oklch(0.
|
|
64
|
-
--chart-3: oklch(0.
|
|
65
|
-
--chart-4: oklch(0.
|
|
66
|
-
--chart-5: oklch(0.
|
|
67
|
-
--sidebar: oklch(0.
|
|
63
|
+
--chart-1: oklch(0.5836 0.2469 264.05);
|
|
64
|
+
--chart-2: oklch(0.5000 0.2345 264.05);
|
|
65
|
+
--chart-3: oklch(0.4200 0.1975 264.05);
|
|
66
|
+
--chart-4: oklch(0.3400 0.1481 264.05);
|
|
67
|
+
--chart-5: oklch(0.2700 0.0988 264.05);
|
|
68
|
+
--sidebar: oklch(0.9700 0 0);
|
|
68
69
|
--sidebar-foreground: oklch(0.1450 0 0);
|
|
69
70
|
--sidebar-primary: oklch(0.2050 0 0);
|
|
70
71
|
--sidebar-primary-foreground: oklch(0.9850 0 0);
|
|
@@ -106,50 +107,54 @@
|
|
|
106
107
|
|
|
107
108
|
/* Chart palette — derives from --primary so brand changes propagate.
|
|
108
109
|
Override individual --chart-N inline (documentElement.style) to opt out. */
|
|
109
|
-
--chart-
|
|
110
|
-
--chart-
|
|
111
|
-
--chart-
|
|
112
|
-
--chart-
|
|
113
|
-
--chart-
|
|
114
|
-
--chart-5: oklch(from var(--primary) var(--chart-lightness) c calc(h + 140));
|
|
110
|
+
--chart-1: oklch(from var(--primary) 0.58 c h);
|
|
111
|
+
--chart-2: oklch(from var(--primary) 0.50 calc(c * 0.95) h);
|
|
112
|
+
--chart-3: oklch(from var(--primary) 0.42 calc(c * 0.80) h);
|
|
113
|
+
--chart-4: oklch(from var(--primary) 0.34 calc(c * 0.60) h);
|
|
114
|
+
--chart-5: oklch(from var(--primary) 0.27 calc(c * 0.40) h);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
.dark {
|
|
118
|
-
--background:
|
|
119
|
-
--foreground:
|
|
120
|
-
--card:
|
|
121
|
-
--card-foreground:
|
|
122
|
-
--popover:
|
|
123
|
-
--popover-foreground:
|
|
118
|
+
--background: #040D20;
|
|
119
|
+
--foreground: #FAFCFC;
|
|
120
|
+
--card: #09142A;
|
|
121
|
+
--card-foreground: #FAFCFC;
|
|
122
|
+
--popover: #0E295E;
|
|
123
|
+
--popover-foreground: #FAFCFC;
|
|
124
124
|
--primary: #FAFAFA;
|
|
125
125
|
--primary-foreground: #1F1F1F;
|
|
126
|
-
--
|
|
127
|
-
--secondary
|
|
128
|
-
--
|
|
129
|
-
--muted
|
|
130
|
-
--
|
|
131
|
-
--accent
|
|
126
|
+
--link: var(--primary);
|
|
127
|
+
--secondary: #0A1D42;
|
|
128
|
+
--secondary-foreground: #FAFCFC;
|
|
129
|
+
--muted: #0A1D42;
|
|
130
|
+
--muted-foreground: #B8D6E5;
|
|
131
|
+
--accent: #0E295E;
|
|
132
|
+
--accent-foreground: #FAFCFC;
|
|
132
133
|
--destructive: oklch(0.7500 0.1600 22.2160);
|
|
133
134
|
--destructive-foreground: oklch(0.1500 0 0);
|
|
134
|
-
--border:
|
|
135
|
-
--input:
|
|
136
|
-
--ring:
|
|
137
|
-
--chart-1: oklch(0.7800 0.
|
|
138
|
-
--chart-2: oklch(0.
|
|
139
|
-
--chart-3: oklch(0.
|
|
140
|
-
--chart-4: oklch(0.
|
|
141
|
-
--chart-5: oklch(0.
|
|
142
|
-
--sidebar:
|
|
143
|
-
--sidebar-foreground:
|
|
135
|
+
--border: rgb(255 255 255 / 0.10);
|
|
136
|
+
--input: rgb(255 255 255 / 0.10);
|
|
137
|
+
--ring: #B8D6E5;
|
|
138
|
+
--chart-1: oklch(0.7800 0.1850 264.05);
|
|
139
|
+
--chart-2: oklch(0.7000 0.2100 264.05);
|
|
140
|
+
--chart-3: oklch(0.6200 0.1975 264.05);
|
|
141
|
+
--chart-4: oklch(0.5600 0.1481 264.05);
|
|
142
|
+
--chart-5: oklch(0.5200 0.0988 264.05);
|
|
143
|
+
--sidebar: #09142A;
|
|
144
|
+
--sidebar-foreground: #FAFCFC;
|
|
144
145
|
--sidebar-primary: oklch(0.4200 0.2000 264.3760);
|
|
145
|
-
--sidebar-primary-foreground:
|
|
146
|
-
--sidebar-accent:
|
|
147
|
-
--sidebar-accent-foreground:
|
|
148
|
-
--sidebar-border:
|
|
149
|
-
--sidebar-ring:
|
|
146
|
+
--sidebar-primary-foreground: #FAFCFC;
|
|
147
|
+
--sidebar-accent: #0E295E;
|
|
148
|
+
--sidebar-accent-foreground: #FAFCFC;
|
|
149
|
+
--sidebar-border: #527081;
|
|
150
|
+
--sidebar-ring: #B8D6E5;
|
|
150
151
|
|
|
151
|
-
/*
|
|
152
|
-
--chart-
|
|
152
|
+
/* Chart palette (dark) — same derivation, mode-specific L floor for AAA. */
|
|
153
|
+
--chart-1: oklch(from var(--primary) 0.78 c h);
|
|
154
|
+
--chart-2: oklch(from var(--primary) 0.70 calc(c * 0.95) h);
|
|
155
|
+
--chart-3: oklch(from var(--primary) 0.62 calc(c * 0.80) h);
|
|
156
|
+
--chart-4: oklch(from var(--primary) 0.56 calc(c * 0.60) h);
|
|
157
|
+
--chart-5: oklch(from var(--primary) 0.52 calc(c * 0.40) h);
|
|
153
158
|
}
|
|
154
159
|
|
|
155
160
|
@theme inline {
|
|
@@ -161,6 +166,7 @@
|
|
|
161
166
|
--color-popover-foreground: var(--popover-foreground);
|
|
162
167
|
--color-primary: var(--primary);
|
|
163
168
|
--color-primary-foreground: var(--primary-foreground);
|
|
169
|
+
--color-link: var(--link);
|
|
164
170
|
--color-secondary: var(--secondary);
|
|
165
171
|
--color-secondary-foreground: var(--secondary-foreground);
|
|
166
172
|
--color-muted: var(--muted);
|
|
@@ -267,7 +273,14 @@
|
|
|
267
273
|
}
|
|
268
274
|
|
|
269
275
|
@layer base {
|
|
270
|
-
|
|
276
|
+
/* Selector is `:root *` rather than the more obvious `*` so this rule beats
|
|
277
|
+
Tailwind's preflight `* { border: 0 solid }` (which resets border-color to
|
|
278
|
+
currentColor = the text color) regardless of which order the consumer
|
|
279
|
+
imports stylesheets in. Both rules live in @layer base; within a layer,
|
|
280
|
+
specificity decides. `:root *` is (0,1,0), `*` is (0,0,0) — we win. Utility
|
|
281
|
+
classes in @layer utilities still beat both because later layers trump
|
|
282
|
+
specificity, so `border-red-500` and friends keep working normally. */
|
|
283
|
+
:root * {
|
|
271
284
|
@apply border-border outline-ring/50;
|
|
272
285
|
}
|
|
273
286
|
/* Bind html to --font-sans so the picker propagates everywhere — not just
|
|
@@ -310,10 +323,27 @@
|
|
|
310
323
|
}
|
|
311
324
|
/* WCAG AAA 1.4.8: paragraph spacing ≥ 1.5× line-height inside running
|
|
312
325
|
text. Scope to <p> only — UI primitives stay tight. Last-child has
|
|
313
|
-
no trailing margin so containers don't get extra padding.
|
|
326
|
+
no trailing margin so containers don't get extra padding.
|
|
327
|
+
|
|
328
|
+
The second rule bows out of flex / grid contexts because by the
|
|
329
|
+
time an author has wrapped content in display:flex or display:grid,
|
|
330
|
+
they are clearly building UI layout (rows of chips, tile metadata,
|
|
331
|
+
calendar entries, etc.) and not running prose. Without this
|
|
332
|
+
carve-out, every <p> used as a UI label inside a flex row gets
|
|
333
|
+
an extra 1.5em margin-bottom, which silently inflates its margin
|
|
334
|
+
box and breaks vertical alignment with adjacent items (a dot
|
|
335
|
+
beside an uppercase eyebrow drops below the visible text, the
|
|
336
|
+
classic symptom). The proper semantic fix is to use <span> for
|
|
337
|
+
UI labels, but the design system shouldn't punish authors who
|
|
338
|
+
reach for <p> in obvious UI contexts. Specificity 0,2,1 wins
|
|
339
|
+
over the bare 0,1,1 rule above. */
|
|
314
340
|
p:not(:last-child) {
|
|
315
341
|
margin-bottom: 1.5em;
|
|
316
342
|
}
|
|
343
|
+
:is(.flex, .inline-flex, .grid, .inline-grid, [class*="grid-cols"]) p,
|
|
344
|
+
:is(.flex, .inline-flex, .grid, .inline-grid, [class*="grid-cols"]) > * > p {
|
|
345
|
+
margin-block: 0;
|
|
346
|
+
}
|
|
317
347
|
/* WCAG AAA 2.4.13 Focus Appearance: focus indicator must be ≥ 2 CSS
|
|
318
348
|
pixels thick AND have ≥ 3:1 contrast against adjacent colors. The
|
|
319
349
|
--ring token is luminance-tuned for 3:1 against every surface in
|
package/src/tokens.default.json
CHANGED
|
@@ -158,14 +158,14 @@
|
|
|
158
158
|
},
|
|
159
159
|
"fontFamily": {
|
|
160
160
|
"sans": {
|
|
161
|
-
"$value": "'Hyperlegible Sans', ui-sans-serif, sans-serif, system-ui",
|
|
161
|
+
"$value": "'Season', 'Hyperlegible Sans', ui-sans-serif, sans-serif, system-ui",
|
|
162
162
|
"$type": "fontFamily",
|
|
163
|
-
"$description": "Primary sans (body, UI).
|
|
163
|
+
"$description": "Primary sans (body, UI). Season is the Swimtopia default \u2014 brand-forward with Hyperlegible Sans as the safe fallback."
|
|
164
164
|
},
|
|
165
165
|
"serif": {
|
|
166
|
-
"$value": "ui-serif, Georgia, serif",
|
|
166
|
+
"$value": "'Season Serif', 'Season', ui-serif, Georgia, serif",
|
|
167
167
|
"$type": "fontFamily",
|
|
168
|
-
"$description": "
|
|
168
|
+
"$description": "Primary serif stack. Season Serif is the Swimtopia default display face."
|
|
169
169
|
},
|
|
170
170
|
"mono": {
|
|
171
171
|
"$value": "'JetBrains Mono', ui-monospace, monospace",
|