@behavioral-agentic-design-system/core 0.4.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 +16 -8
- package/scripts/build-fonts.cjs +90 -0
- package/scripts/build-tokens.cjs +99 -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/page.tsx +9 -263
- package/src/app/preview/cards/page.tsx +1 -1
- package/src/app/preview/login/page.tsx +5 -0
- package/src/app/shell.tsx +354 -0
- 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 +331 -26
- 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 +91 -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
|
@@ -14,15 +14,30 @@
|
|
|
14
14
|
|
|
15
15
|
@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&display=swap');
|
|
16
16
|
|
|
17
|
+
/* Tailwind v4 only generates classes it scans. The shell components, hooks,
|
|
18
|
+
* and app routes shipped in this package use plenty of Tailwind classes that
|
|
19
|
+
* the consumer's own source code never references — Button's variants,
|
|
20
|
+
* Dialog's overlay, the customize tab's grid, etc. Without these @source
|
|
21
|
+
* paths a fresh fork imports styles.css and gets unstyled components because
|
|
22
|
+
* the classes never made it into the consumer's bundle.
|
|
23
|
+
*
|
|
24
|
+
* Paths resolve relative to this file (node_modules/@.../core/src/styles.css),
|
|
25
|
+
* so they cover the package's own source files in node_modules. Consumers
|
|
26
|
+
* don't need to touch their own Tailwind content config to get this working. */
|
|
27
|
+
@source "./components/**/*.{ts,tsx}";
|
|
28
|
+
@source "./app/**/*.{ts,tsx}";
|
|
29
|
+
@source "./hooks/**/*.{ts,tsx}";
|
|
30
|
+
@source "./lib/**/*.{ts,tsx}";
|
|
31
|
+
|
|
17
32
|
@custom-variant dark (&:is(.dark *));
|
|
18
33
|
|
|
19
34
|
:root {
|
|
20
35
|
/* Brand sans from tokens.json leads. Atkinson Hyperlegible (loaded via the
|
|
21
36
|
Google Fonts @import above) is the canonical fallback so unbranded
|
|
22
37
|
consumers still get a high-legibility face out of the box. */
|
|
23
|
-
--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;
|
|
24
39
|
--font-mono: 'JetBrains Mono', ui-monospace, monospace;
|
|
25
|
-
--font-serif: ui-serif, Georgia, serif;
|
|
40
|
+
--font-serif: 'Season Serif', 'Season', ui-serif, Georgia, serif;
|
|
26
41
|
--font-size-scale: 1;
|
|
27
42
|
|
|
28
43
|
--background: oklch(1 0 0);
|
|
@@ -31,8 +46,9 @@
|
|
|
31
46
|
--card-foreground: oklch(0.1450 0 0);
|
|
32
47
|
--popover: oklch(1 0 0);
|
|
33
48
|
--popover-foreground: oklch(0.1450 0 0);
|
|
34
|
-
--primary: #
|
|
49
|
+
--primary: #025FFF;
|
|
35
50
|
--primary-foreground: #FAFAFA;
|
|
51
|
+
--link: var(--primary);
|
|
36
52
|
--secondary: oklch(0.9700 0 0);
|
|
37
53
|
--secondary-foreground: oklch(0.2050 0 0);
|
|
38
54
|
--muted: oklch(0.9700 0 0);
|
|
@@ -44,12 +60,12 @@
|
|
|
44
60
|
--border: oklch(0.6100 0 0);
|
|
45
61
|
--input: oklch(0.6100 0 0);
|
|
46
62
|
--ring: oklch(0.4500 0 0);
|
|
47
|
-
--chart-1: oklch(0.
|
|
48
|
-
--chart-2: oklch(0.
|
|
49
|
-
--chart-3: oklch(0.
|
|
50
|
-
--chart-4: oklch(0.
|
|
51
|
-
--chart-5: oklch(0.
|
|
52
|
-
--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);
|
|
53
69
|
--sidebar-foreground: oklch(0.1450 0 0);
|
|
54
70
|
--sidebar-primary: oklch(0.2050 0 0);
|
|
55
71
|
--sidebar-primary-foreground: oklch(0.9850 0 0);
|
|
@@ -91,50 +107,54 @@
|
|
|
91
107
|
|
|
92
108
|
/* Chart palette — derives from --primary so brand changes propagate.
|
|
93
109
|
Override individual --chart-N inline (documentElement.style) to opt out. */
|
|
94
|
-
--chart-
|
|
95
|
-
--chart-
|
|
96
|
-
--chart-
|
|
97
|
-
--chart-
|
|
98
|
-
--chart-
|
|
99
|
-
--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);
|
|
100
115
|
}
|
|
101
116
|
|
|
102
117
|
.dark {
|
|
103
|
-
--background:
|
|
104
|
-
--foreground:
|
|
105
|
-
--card:
|
|
106
|
-
--card-foreground:
|
|
107
|
-
--popover:
|
|
108
|
-
--popover-foreground:
|
|
118
|
+
--background: #040D20;
|
|
119
|
+
--foreground: #FAFCFC;
|
|
120
|
+
--card: #09142A;
|
|
121
|
+
--card-foreground: #FAFCFC;
|
|
122
|
+
--popover: #0E295E;
|
|
123
|
+
--popover-foreground: #FAFCFC;
|
|
109
124
|
--primary: #FAFAFA;
|
|
110
125
|
--primary-foreground: #1F1F1F;
|
|
111
|
-
--
|
|
112
|
-
--secondary
|
|
113
|
-
--
|
|
114
|
-
--muted
|
|
115
|
-
--
|
|
116
|
-
--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;
|
|
117
133
|
--destructive: oklch(0.7500 0.1600 22.2160);
|
|
118
134
|
--destructive-foreground: oklch(0.1500 0 0);
|
|
119
|
-
--border:
|
|
120
|
-
--input:
|
|
121
|
-
--ring:
|
|
122
|
-
--chart-1: oklch(0.7800 0.
|
|
123
|
-
--chart-2: oklch(0.
|
|
124
|
-
--chart-3: oklch(0.
|
|
125
|
-
--chart-4: oklch(0.
|
|
126
|
-
--chart-5: oklch(0.
|
|
127
|
-
--sidebar:
|
|
128
|
-
--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;
|
|
129
145
|
--sidebar-primary: oklch(0.4200 0.2000 264.3760);
|
|
130
|
-
--sidebar-primary-foreground:
|
|
131
|
-
--sidebar-accent:
|
|
132
|
-
--sidebar-accent-foreground:
|
|
133
|
-
--sidebar-border:
|
|
134
|
-
--sidebar-ring:
|
|
146
|
+
--sidebar-primary-foreground: #FAFCFC;
|
|
147
|
+
--sidebar-accent: #0E295E;
|
|
148
|
+
--sidebar-accent-foreground: #FAFCFC;
|
|
149
|
+
--sidebar-border: #527081;
|
|
150
|
+
--sidebar-ring: #B8D6E5;
|
|
135
151
|
|
|
136
|
-
/*
|
|
137
|
-
--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);
|
|
138
158
|
}
|
|
139
159
|
|
|
140
160
|
@theme inline {
|
|
@@ -146,6 +166,7 @@
|
|
|
146
166
|
--color-popover-foreground: var(--popover-foreground);
|
|
147
167
|
--color-primary: var(--primary);
|
|
148
168
|
--color-primary-foreground: var(--primary-foreground);
|
|
169
|
+
--color-link: var(--link);
|
|
149
170
|
--color-secondary: var(--secondary);
|
|
150
171
|
--color-secondary-foreground: var(--secondary-foreground);
|
|
151
172
|
--color-muted: var(--muted);
|
|
@@ -252,7 +273,14 @@
|
|
|
252
273
|
}
|
|
253
274
|
|
|
254
275
|
@layer base {
|
|
255
|
-
|
|
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 * {
|
|
256
284
|
@apply border-border outline-ring/50;
|
|
257
285
|
}
|
|
258
286
|
/* Bind html to --font-sans so the picker propagates everywhere — not just
|
|
@@ -295,10 +323,27 @@
|
|
|
295
323
|
}
|
|
296
324
|
/* WCAG AAA 1.4.8: paragraph spacing ≥ 1.5× line-height inside running
|
|
297
325
|
text. Scope to <p> only — UI primitives stay tight. Last-child has
|
|
298
|
-
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. */
|
|
299
340
|
p:not(:last-child) {
|
|
300
341
|
margin-bottom: 1.5em;
|
|
301
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
|
+
}
|
|
302
347
|
/* WCAG AAA 2.4.13 Focus Appearance: focus indicator must be ≥ 2 CSS
|
|
303
348
|
pixels thick AND have ≥ 3:1 contrast against adjacent colors. The
|
|
304
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",
|