@tangle-network/brand 1.31.0 → 1.31.1
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/CHANGELOG.md +6 -0
- package/README.md +3 -2
- package/dist/index.d.ts +111 -111
- package/dist/index.js +111 -111
- package/package.json +1 -1
- package/src/palette.generated.ts +111 -111
- package/src/styles/accent-on-tint.test.ts +4 -1
- package/src/styles/legacy-light.css +1104 -1032
- package/src/styles/named-themes.css +298 -597
- package/src/styles/surface-ladder.test.ts +9 -24
- package/src/styles/system.css +52 -52
- package/src/styles/theme-scopes.ts +12 -21
- package/src/styles/tokens.css +450 -939
- package/src/styles/tokens.test.ts +38 -17
|
@@ -330,31 +330,16 @@ describe("Canonical surface ladder (the spine: :root, .dark, .light, dark, light
|
|
|
330
330
|
}
|
|
331
331
|
});
|
|
332
332
|
|
|
333
|
-
it("
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
["hsl-raised-2", "var(--hsl-card)"],
|
|
342
|
-
["well-raised", "var(--well-card)"],
|
|
343
|
-
["well-raised-2", "var(--well-card)"],
|
|
344
|
-
["edge-highlight", "0 0 0 0 transparent"],
|
|
345
|
-
]) {
|
|
346
|
-
expect(declIn(flatBody, token!), `--${token}`).toBe(value);
|
|
333
|
+
it("gives every named theme its own raised planes and wells", () => {
|
|
334
|
+
for (const body of rules(themes).matchAll(/[^{}]*\{([^{}]*--hsl-background:[^{}]*)\}/g)) {
|
|
335
|
+
const own = body[1]!;
|
|
336
|
+
expect(declIn(own, "hsl-raised")).toBe("var(--hsl-secondary)");
|
|
337
|
+
expect(resolveIn(own, "hsl-raised"), "raised must differ from the card").not.toBe(resolveIn(own, "hsl-card"));
|
|
338
|
+
for (const role of ["well-page", "well-card", "well-raised", "well-raised-2"]) {
|
|
339
|
+
expect(own, role).toContain(`--${role}:`);
|
|
340
|
+
}
|
|
347
341
|
}
|
|
348
|
-
|
|
349
|
-
const ownPlanes = new Set(
|
|
350
|
-
[...rules(themes).matchAll(/([^{}]*)\{([^{}]*)\}/g)]
|
|
351
|
-
.filter((m) => m[2]!.includes("--hsl-background:"))
|
|
352
|
-
.flatMap((m) => names(m[1]!)),
|
|
353
|
-
);
|
|
354
|
-
const tuned = new Set(["hospitality"]);
|
|
355
|
-
expect(new Set(names(flat![1]!))).toEqual(new Set([...ownPlanes].filter((name) => !tuned.has(name!))));
|
|
356
|
-
});
|
|
357
|
-
});
|
|
342
|
+
});});
|
|
358
343
|
|
|
359
344
|
describe("Inset workspace backdrop (canonical themes)", () => {
|
|
360
345
|
// sandbox-ui WorkspaceSurface / WorkspaceLayout surface="inset" paint the
|
package/src/styles/system.css
CHANGED
|
@@ -33,36 +33,36 @@
|
|
|
33
33
|
--accent-soft: var(--iris-3);
|
|
34
34
|
--accent-soft-hover: var(--iris-4);
|
|
35
35
|
--accent-line: var(--iris-7);
|
|
36
|
-
--hsl-background: 270 5.
|
|
37
|
-
--hsl-foreground: 240 6.
|
|
38
|
-
--hsl-card: 270 3.
|
|
39
|
-
--hsl-card-foreground: 240 6.
|
|
40
|
-
--hsl-popover: 260 4.
|
|
41
|
-
--hsl-popover-foreground: 240 6.
|
|
42
|
-
--hsl-primary: 240 60% 59.
|
|
36
|
+
--hsl-background: 270 5.5556% 7.0588%;
|
|
37
|
+
--hsl-foreground: 240 6.25% 93.7255%;
|
|
38
|
+
--hsl-card: 270 3.8462% 10.1961%;
|
|
39
|
+
--hsl-card-foreground: 240 6.25% 93.7255%;
|
|
40
|
+
--hsl-popover: 260 4.2254% 13.9216%;
|
|
41
|
+
--hsl-popover-foreground: 240 6.25% 93.7255%;
|
|
42
|
+
--hsl-primary: 240 60% 59.8039%;
|
|
43
43
|
--hsl-primary-foreground: 0 0% 100%;
|
|
44
|
-
--hsl-secondary: 260 4.
|
|
45
|
-
--hsl-secondary-foreground: 240 6.
|
|
46
|
-
--hsl-muted: 260 4.
|
|
47
|
-
--hsl-muted-foreground: 258 6.
|
|
48
|
-
--hsl-accent: 270 4.
|
|
49
|
-
--hsl-accent-foreground: 240 6.
|
|
50
|
-
--hsl-destructive: 348 68.
|
|
51
|
-
--hsl-destructive-foreground:
|
|
52
|
-
--hsl-border: 270 5% 23.
|
|
53
|
-
--hsl-input:
|
|
54
|
-
--hsl-ring: 242 63.
|
|
55
|
-
--hsl-success: 151 54.
|
|
56
|
-
--hsl-warning: 42 100%
|
|
57
|
-
--hsl-info: 206 100% 50%;
|
|
58
|
-
--sidebar-background: 270 3.
|
|
59
|
-
--sidebar-foreground: 240 6.
|
|
60
|
-
--sidebar-primary: 240 60% 59.
|
|
44
|
+
--hsl-secondary: 260 4.2254% 13.9216%;
|
|
45
|
+
--hsl-secondary-foreground: 240 6.25% 93.7255%;
|
|
46
|
+
--hsl-muted: 260 4.2254% 13.9216%;
|
|
47
|
+
--hsl-muted-foreground: 258 6.9444% 71.7647%;
|
|
48
|
+
--hsl-accent: 270 4.6512% 16.8627%;
|
|
49
|
+
--hsl-accent-foreground: 240 6.25% 93.7255%;
|
|
50
|
+
--hsl-destructive: 348 68.4211% 18.6275%;
|
|
51
|
+
--hsl-destructive-foreground: 349.5652 100% 90.9804%;
|
|
52
|
+
--hsl-border: 270 5% 23.5294%;
|
|
53
|
+
--hsl-input: 250.9091 4.8035% 44.902%;
|
|
54
|
+
--hsl-ring: 242.069 63.7363% 64.3137%;
|
|
55
|
+
--hsl-success: 151.0345 54.717% 41.5686%;
|
|
56
|
+
--hsl-warning: 42.0619 100% 61.9608%;
|
|
57
|
+
--hsl-info: 206.1176 100% 50%;
|
|
58
|
+
--sidebar-background: 270 3.8462% 10.1961%;
|
|
59
|
+
--sidebar-foreground: 240 6.25% 93.7255%;
|
|
60
|
+
--sidebar-primary: 240 60% 59.8039%;
|
|
61
61
|
--sidebar-primary-foreground: 0 0% 100%;
|
|
62
|
-
--sidebar-accent: 270 4.
|
|
63
|
-
--sidebar-accent-foreground: 240 6.
|
|
64
|
-
--sidebar-border: 270 5% 23.
|
|
65
|
-
--sidebar-ring: 242 63.
|
|
62
|
+
--sidebar-accent: 270 4.6512% 16.8627%;
|
|
63
|
+
--sidebar-accent-foreground: 240 6.25% 93.7255%;
|
|
64
|
+
--sidebar-border: 270 5% 23.5294%;
|
|
65
|
+
--sidebar-ring: 242.069 63.7363% 64.3137%;
|
|
66
66
|
--md3-surface: var(--mauve-1);
|
|
67
67
|
--md3-surface-dim: var(--mauve-1);
|
|
68
68
|
--md3-surface-bright: var(--mauve-5);
|
|
@@ -230,35 +230,35 @@
|
|
|
230
230
|
--accent-soft-hover: var(--iris-4);
|
|
231
231
|
--accent-line: var(--iris-7);
|
|
232
232
|
--hsl-background: 0 0% 100%;
|
|
233
|
-
--hsl-foreground: 257 10.
|
|
233
|
+
--hsl-foreground: 257.1429 10.1449% 13.5294%;
|
|
234
234
|
--hsl-card: 0 0% 100%;
|
|
235
|
-
--hsl-card-foreground: 257 10.
|
|
235
|
+
--hsl-card-foreground: 257.1429 10.1449% 13.5294%;
|
|
236
236
|
--hsl-popover: 0 0% 100%;
|
|
237
|
-
--hsl-popover-foreground: 257 10.
|
|
238
|
-
--hsl-primary: 240 60% 59.
|
|
237
|
+
--hsl-popover-foreground: 257.1429 10.1449% 13.5294%;
|
|
238
|
+
--hsl-primary: 240 60% 59.8039%;
|
|
239
239
|
--hsl-primary-foreground: 0 0% 100%;
|
|
240
|
-
--hsl-secondary: 285 14.
|
|
241
|
-
--hsl-secondary-foreground: 257 10.
|
|
242
|
-
--hsl-muted: 285 14.
|
|
243
|
-
--hsl-muted-foreground: 252 4.
|
|
244
|
-
--hsl-accent: 276 11.
|
|
245
|
-
--hsl-accent-foreground: 257 10.
|
|
246
|
-
--hsl-destructive: 358 64.8% 49%;
|
|
240
|
+
--hsl-secondary: 285 14.2857% 94.5098%;
|
|
241
|
+
--hsl-secondary-foreground: 257.1429 10.1449% 13.5294%;
|
|
242
|
+
--hsl-muted: 285 14.2857% 94.5098%;
|
|
243
|
+
--hsl-muted-foreground: 252 4.8077% 40.7843%;
|
|
244
|
+
--hsl-accent: 276 11.6279% 91.5686%;
|
|
245
|
+
--hsl-accent-foreground: 257.1429 10.1449% 13.5294%;
|
|
246
|
+
--hsl-destructive: 358.1481 64.8% 49.0196%;
|
|
247
247
|
--hsl-destructive-foreground: 0 0% 100%;
|
|
248
|
-
--hsl-border: 262 11.
|
|
249
|
-
--hsl-input: 249
|
|
250
|
-
--hsl-ring: 240 60% 59.
|
|
251
|
-
--hsl-success: 151 54.
|
|
252
|
-
--hsl-warning: 42 100%
|
|
253
|
-
--hsl-info: 206 100% 50%;
|
|
254
|
-
--sidebar-background: 270 20% 98%;
|
|
255
|
-
--sidebar-foreground: 257 10.
|
|
256
|
-
--sidebar-primary: 240 60% 59.
|
|
248
|
+
--hsl-border: 262.5 11.4286% 86.2745%;
|
|
249
|
+
--hsl-input: 249.2308 5.9908% 57.451%;
|
|
250
|
+
--hsl-ring: 240 60% 59.8039%;
|
|
251
|
+
--hsl-success: 151.0345 54.717% 41.5686%;
|
|
252
|
+
--hsl-warning: 42.0619 100% 61.9608%;
|
|
253
|
+
--hsl-info: 206.1176 100% 50%;
|
|
254
|
+
--sidebar-background: 270 20% 98.0392%;
|
|
255
|
+
--sidebar-foreground: 257.1429 10.1449% 13.5294%;
|
|
256
|
+
--sidebar-primary: 240 60% 59.8039%;
|
|
257
257
|
--sidebar-primary-foreground: 0 0% 100%;
|
|
258
|
-
--sidebar-accent: 276 11.
|
|
259
|
-
--sidebar-accent-foreground: 257 10.
|
|
260
|
-
--sidebar-border: 262 11.
|
|
261
|
-
--sidebar-ring: 240 60% 59.
|
|
258
|
+
--sidebar-accent: 276 11.6279% 91.5686%;
|
|
259
|
+
--sidebar-accent-foreground: 257.1429 10.1449% 13.5294%;
|
|
260
|
+
--sidebar-border: 262.5 11.4286% 86.2745%;
|
|
261
|
+
--sidebar-ring: 240 60% 59.8039%;
|
|
262
262
|
--md3-surface: #ffffff;
|
|
263
263
|
--md3-surface-dim: var(--mauve-2);
|
|
264
264
|
--md3-surface-bright: #ffffff;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { blockIn, blocksIn,
|
|
3
|
+
import { blockIn, blocksIn, hexIn } from "./css-test-utils";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Every theme scope a consumer can select, each with its CSS sources listed
|
|
@@ -39,7 +39,7 @@ const named = (selector: string) => spine(themes, selector);
|
|
|
39
39
|
* Each scope lists its sources from the most specific to the baseline it
|
|
40
40
|
* inherits from, as the cascade resolves them.
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
const baseScopes: Array<{ name: string; sources: string[] }> = [
|
|
43
43
|
{ name: "canonical dark", sources: [DARK] },
|
|
44
44
|
{ name: "canonical light", sources: [LIGHT, DARK] },
|
|
45
45
|
{
|
|
@@ -80,13 +80,17 @@ export const scopes: Array<{ name: string; sources: string[] }> = [
|
|
|
80
80
|
sources: [named('[data-theme="website"]:where(:not(.dark))'), LIGHT, DARK],
|
|
81
81
|
},
|
|
82
82
|
{ name: "website dark", sources: [named('.dark[data-theme="website"]'), DARK] },
|
|
83
|
-
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
// Accent is promised on any named boundary, so use every real supported mode,
|
|
86
|
+
// including the light-default projection, rather than only canonical planes.
|
|
87
|
+
export const scopes = [
|
|
88
|
+
...baseScopes,
|
|
84
89
|
...[...themes.matchAll(/^\[data-accent="([a-z]+)"\],$/gm)].flatMap(([, hue]) => {
|
|
85
90
|
const rule = blockIn(themes, `[data-accent="${hue}"] :is(.light, .dark, [data-theme], [data-sandbox-ui], [data-sandbox-theme])`);
|
|
86
|
-
return
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
];
|
|
91
|
+
return baseScopes.filter(({ name }) => !name.startsWith("system ")).map(({ name, sources }) => ({
|
|
92
|
+
name: `accent ${hue} on ${name}`, sources: [rule, ...sources],
|
|
93
|
+
}));
|
|
90
94
|
}),
|
|
91
95
|
];
|
|
92
96
|
|
|
@@ -98,18 +102,5 @@ export type Rgb = [number, number, number];
|
|
|
98
102
|
* declares each name.
|
|
99
103
|
*/
|
|
100
104
|
export function resolve(sources: string[], token: string): Rgb {
|
|
101
|
-
|
|
102
|
-
.map((css) => css.match(new RegExp(`(?<![\\w-])--${token}:\\s*([^;]+);`))?.[1]?.trim())
|
|
103
|
-
.find((value) => value !== undefined);
|
|
104
|
-
if (raw === undefined) throw new Error(`--${token} resolves to nothing`);
|
|
105
|
-
|
|
106
|
-
const ref = /^(?:hsl\()?var\(--([a-z0-9-]+)\)\)?$/.exec(raw);
|
|
107
|
-
if (ref) return resolve(sources, ref[1]);
|
|
108
|
-
const hex = /^#([0-9a-fA-F]{6})\b/.exec(raw);
|
|
109
|
-
if (hex) {
|
|
110
|
-
return [0, 2, 4].map((i) => Number.parseInt(hex[1].slice(i, i + 2), 16)) as Rgb;
|
|
111
|
-
}
|
|
112
|
-
const hsl = /^([\d.]+)\s+([\d.]+)%\s+([\d.]+)%/.exec(raw);
|
|
113
|
-
if (hsl) return hslToRgb({ h: Number(hsl[1]), s: Number(hsl[2]), l: Number(hsl[3]) });
|
|
114
|
-
throw new Error(`--${token} has an unreadable value: ${raw}`);
|
|
105
|
+
return hexIn(sources, token);
|
|
115
106
|
}
|