@entifix/style 0.18.1 → 0.19.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/README.md CHANGED
@@ -24,6 +24,27 @@ pnpm add -D @entifix/style
24
24
  | `@entifix/style/presets/fixed-scale.css` | The dense scale, opted into per application |
25
25
  | `@entifix/style/presets/{aurora,sunset,midnight}.css` | Palette presets, each scoped to its `[data-theme]` |
26
26
  | `@entifix/style/theme.css` | Tokens plus all three palettes, for demos |
27
+ | `@entifix/style/testing` | `assertPaletteContract`, for a host's own palettes |
28
+
29
+ ## The token contract
30
+
31
+ Every palette is held to a table of contrast pairs (WCAG 2.2 AA, [ADR 0025](https://github.com/r10c-technologies/entifix/blob/main/docs/adr/0025-the-token-contract.md)): text at 4.5:1, a control's boundary (`--color-border-control`), the focus ring and a selection marker (`--color-selected`) at 3:1. The presets here pass it, and a host holds its own palettes to it in a spec:
32
+
33
+ ```ts
34
+ import { readFileSync } from 'node:fs';
35
+ import { fileURLToPath } from 'node:url';
36
+ import { assertPaletteContract, parsePaletteCss } from '@entifix/style/testing';
37
+
38
+ const tokens = fileURLToPath(import.meta.resolve('@entifix/style/tokens.css'));
39
+ const defaults = parsePaletteCss(readFileSync(tokens, 'utf8'))['default'];
40
+ const ours = parsePaletteCss(readFileSync('src/app/themes.css', 'utf8'));
41
+
42
+ for (const [name, palette] of Object.entries(ours)) {
43
+ assertPaletteContract({ ...defaults, ...palette }, name);
44
+ }
45
+ ```
46
+
47
+ The tokens also carry the tones (`success`, `warning`, `info` beside `danger`, each with `-subtle` and `-content`), `--color-scrim`, a `--z-*` layering scale, overlay sizes, and `--target-min` — the hit-area floor every control reaches, 24px unless a host raises it.
27
48
 
28
49
  ---
29
50
 
@@ -0,0 +1,23 @@
1
+ import { type PalettePair } from './pairs.js';
2
+ /** A palette as a `ThemePalette` writes it: token (no `--color-` prefix) → colour. */
3
+ export type PaletteValues = Readonly<Record<string, string | undefined>>;
4
+ export type PaletteFailure = {
5
+ readonly kind: 'missing';
6
+ readonly token: string;
7
+ } | {
8
+ readonly kind: 'unparseable';
9
+ readonly token: string;
10
+ readonly value: string;
11
+ } | {
12
+ readonly kind: 'contrast';
13
+ readonly pair: PalettePair;
14
+ readonly ratio: number;
15
+ };
16
+ /** Every way `palette` breaks ADR 0025's pair table, in table order. */
17
+ export declare function paletteContractFailures(palette: PaletteValues): PaletteFailure[];
18
+ /**
19
+ * Throws unless `palette` meets every pair of ADR 0025. `name` labels the
20
+ * message, so a host asserting several palettes can tell which one broke.
21
+ */
22
+ export declare function assertPaletteContract(palette: PaletteValues, name?: string): void;
23
+ //# sourceMappingURL=assert-palette-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-palette-contract.d.ts","sourceRoot":"","sources":["../../src/testing/assert-palette-contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAE7D,sFAAsF;AACtF,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;AAEzE,MAAM,MAAM,cAAc,GACtB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpD;IACE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEN,wEAAwE;AACxE,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,aAAa,GACrB,cAAc,EAAE,CAyBlB;AAeD;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,aAAa,EACtB,IAAI,SAAY,GACf,IAAI,CAON"}
@@ -0,0 +1,62 @@
1
+ import { contrastRatio, parseColor } from './contrast.js';
2
+ import { PALETTE_PAIRS } from './pairs.js';
3
+ /** Every way `palette` breaks ADR 0025's pair table, in table order. */ export function paletteContractFailures(palette) {
4
+ const failures = [];
5
+ const reported = new Set();
6
+ const read = (token)=>{
7
+ const value = palette[token];
8
+ if (value === undefined) {
9
+ if (!reported.has(token)) failures.push({
10
+ kind: 'missing',
11
+ token
12
+ });
13
+ reported.add(token);
14
+ return undefined;
15
+ }
16
+ const rgb = parseColor(value);
17
+ if (!rgb && !reported.has(token)) {
18
+ failures.push({
19
+ kind: 'unparseable',
20
+ token,
21
+ value
22
+ });
23
+ }
24
+ reported.add(token);
25
+ return rgb;
26
+ };
27
+ for (const pair of PALETTE_PAIRS){
28
+ const fg = read(pair.foreground);
29
+ const bg = read(pair.background);
30
+ if (!fg || !bg) continue;
31
+ const ratio = contrastRatio(fg, bg);
32
+ if (ratio < pair.minimum) failures.push({
33
+ kind: 'contrast',
34
+ pair,
35
+ ratio
36
+ });
37
+ }
38
+ return failures;
39
+ }
40
+ function describe(failure) {
41
+ switch(failure.kind){
42
+ case 'missing':
43
+ return `missing --color-${failure.token}`;
44
+ case 'unparseable':
45
+ return `--color-${failure.token} is not an opaque hex or rgb() colour: ${failure.value}`;
46
+ case 'contrast':
47
+ {
48
+ const { pair, ratio } = failure;
49
+ return `${pair.foreground} on ${pair.background} (${pair.use}) is ${ratio.toFixed(2)}:1, needs ${pair.minimum}:1`;
50
+ }
51
+ }
52
+ }
53
+ /**
54
+ * Throws unless `palette` meets every pair of ADR 0025. `name` labels the
55
+ * message, so a host asserting several palettes can tell which one broke.
56
+ */ export function assertPaletteContract(palette, name = 'palette') {
57
+ const failures = paletteContractFailures(palette);
58
+ if (failures.length === 0) return;
59
+ throw new Error(`${name} breaks the token contract (ADR 0025):\n` + failures.map((f)=>` - ${describe(f)}`).join('\n'));
60
+ }
61
+
62
+ //# sourceMappingURL=assert-palette-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/testing/assert-palette-contract.ts"],"sourcesContent":["import { contrastRatio, parseColor } from './contrast.js';\nimport { PALETTE_PAIRS, type PalettePair } from './pairs.js';\n\n/** A palette as a `ThemePalette` writes it: token (no `--color-` prefix) → colour. */\nexport type PaletteValues = Readonly<Record<string, string | undefined>>;\n\nexport type PaletteFailure =\n | { readonly kind: 'missing'; readonly token: string }\n | {\n readonly kind: 'unparseable';\n readonly token: string;\n readonly value: string;\n }\n | {\n readonly kind: 'contrast';\n readonly pair: PalettePair;\n readonly ratio: number;\n };\n\n/** Every way `palette` breaks ADR 0025's pair table, in table order. */\nexport function paletteContractFailures(\n palette: PaletteValues,\n): PaletteFailure[] {\n const failures: PaletteFailure[] = [];\n const reported = new Set<string>();\n const read = (token: string) => {\n const value = palette[token];\n if (value === undefined) {\n if (!reported.has(token)) failures.push({ kind: 'missing', token });\n reported.add(token);\n return undefined;\n }\n const rgb = parseColor(value);\n if (!rgb && !reported.has(token)) {\n failures.push({ kind: 'unparseable', token, value });\n }\n reported.add(token);\n return rgb;\n };\n for (const pair of PALETTE_PAIRS) {\n const fg = read(pair.foreground);\n const bg = read(pair.background);\n if (!fg || !bg) continue;\n const ratio = contrastRatio(fg, bg);\n if (ratio < pair.minimum) failures.push({ kind: 'contrast', pair, ratio });\n }\n return failures;\n}\n\nfunction describe(failure: PaletteFailure): string {\n switch (failure.kind) {\n case 'missing':\n return `missing --color-${failure.token}`;\n case 'unparseable':\n return `--color-${failure.token} is not an opaque hex or rgb() colour: ${failure.value}`;\n case 'contrast': {\n const { pair, ratio } = failure;\n return `${pair.foreground} on ${pair.background} (${pair.use}) is ${ratio.toFixed(2)}:1, needs ${pair.minimum}:1`;\n }\n }\n}\n\n/**\n * Throws unless `palette` meets every pair of ADR 0025. `name` labels the\n * message, so a host asserting several palettes can tell which one broke.\n */\nexport function assertPaletteContract(\n palette: PaletteValues,\n name = 'palette',\n): void {\n const failures = paletteContractFailures(palette);\n if (failures.length === 0) return;\n throw new Error(\n `${name} breaks the token contract (ADR 0025):\\n` +\n failures.map(f => ` - ${describe(f)}`).join('\\n'),\n );\n}\n"],"names":["contrastRatio","parseColor","PALETTE_PAIRS","paletteContractFailures","palette","failures","reported","Set","read","token","value","undefined","has","push","kind","add","rgb","pair","fg","foreground","bg","background","ratio","minimum","describe","failure","use","toFixed","assertPaletteContract","name","length","Error","map","f","join"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,gBAAgB;AAC1D,SAASC,aAAa,QAA0B,aAAa;AAkB7D,sEAAsE,GACtE,OAAO,SAASC,wBACdC,OAAsB;IAEtB,MAAMC,WAA6B,EAAE;IACrC,MAAMC,WAAW,IAAIC;IACrB,MAAMC,OAAO,CAACC;QACZ,MAAMC,QAAQN,OAAO,CAACK,MAAM;QAC5B,IAAIC,UAAUC,WAAW;YACvB,IAAI,CAACL,SAASM,GAAG,CAACH,QAAQJ,SAASQ,IAAI,CAAC;gBAAEC,MAAM;gBAAWL;YAAM;YACjEH,SAASS,GAAG,CAACN;YACb,OAAOE;QACT;QACA,MAAMK,MAAMf,WAAWS;QACvB,IAAI,CAACM,OAAO,CAACV,SAASM,GAAG,CAACH,QAAQ;YAChCJ,SAASQ,IAAI,CAAC;gBAAEC,MAAM;gBAAeL;gBAAOC;YAAM;QACpD;QACAJ,SAASS,GAAG,CAACN;QACb,OAAOO;IACT;IACA,KAAK,MAAMC,QAAQf,cAAe;QAChC,MAAMgB,KAAKV,KAAKS,KAAKE,UAAU;QAC/B,MAAMC,KAAKZ,KAAKS,KAAKI,UAAU;QAC/B,IAAI,CAACH,MAAM,CAACE,IAAI;QAChB,MAAME,QAAQtB,cAAckB,IAAIE;QAChC,IAAIE,QAAQL,KAAKM,OAAO,EAAElB,SAASQ,IAAI,CAAC;YAAEC,MAAM;YAAYG;YAAMK;QAAM;IAC1E;IACA,OAAOjB;AACT;AAEA,SAASmB,SAASC,OAAuB;IACvC,OAAQA,QAAQX,IAAI;QAClB,KAAK;YACH,OAAO,CAAC,gBAAgB,EAAEW,QAAQhB,KAAK,EAAE;QAC3C,KAAK;YACH,OAAO,CAAC,QAAQ,EAAEgB,QAAQhB,KAAK,CAAC,uCAAuC,EAAEgB,QAAQf,KAAK,EAAE;QAC1F,KAAK;YAAY;gBACf,MAAM,EAAEO,IAAI,EAAEK,KAAK,EAAE,GAAGG;gBACxB,OAAO,GAAGR,KAAKE,UAAU,CAAC,IAAI,EAAEF,KAAKI,UAAU,CAAC,EAAE,EAAEJ,KAAKS,GAAG,CAAC,KAAK,EAAEJ,MAAMK,OAAO,CAAC,GAAG,UAAU,EAAEV,KAAKM,OAAO,CAAC,EAAE,CAAC;YACnH;IACF;AACF;AAEA;;;CAGC,GACD,OAAO,SAASK,sBACdxB,OAAsB,EACtByB,OAAO,SAAS;IAEhB,MAAMxB,WAAWF,wBAAwBC;IACzC,IAAIC,SAASyB,MAAM,KAAK,GAAG;IAC3B,MAAM,IAAIC,MACR,GAAGF,KAAK,wCAAwC,CAAC,GAC/CxB,SAAS2B,GAAG,CAACC,CAAAA,IAAK,CAAC,IAAI,EAAET,SAASS,IAAI,EAAEC,IAAI,CAAC;AAEnD"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * WCAG 2.x relative luminance and contrast ratio, over the colour forms a
3
+ * palette is written in: `#rgb`, `#rrggbb`, and `rgb()` with comma or space
4
+ * separated channels. A colour with alpha has no contrast of its own (it
5
+ * depends on what is under it), so it is refused rather than guessed.
6
+ */
7
+ export type Rgb = readonly [number, number, number];
8
+ export declare function parseColor(value: string): Rgb | undefined;
9
+ export declare function relativeLuminance([r, g, b]: Rgb): number;
10
+ export declare function contrastRatio(a: Rgb, b: Rgb): number;
11
+ //# sourceMappingURL=contrast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contrast.d.ts","sourceRoot":"","sources":["../../src/testing/contrast.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAKpD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAgBzD;AAOD,wBAAgB,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAExD;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,MAAM,CAIpD"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * WCAG 2.x relative luminance and contrast ratio, over the colour forms a
3
+ * palette is written in: `#rgb`, `#rrggbb`, and `rgb()` with comma or space
4
+ * separated channels. A colour with alpha has no contrast of its own (it
5
+ * depends on what is under it), so it is refused rather than guessed.
6
+ */ const HEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
7
+ const RGB = /^rgba?\(\s*(\d{1,3})[\s,]+(\d{1,3})[\s,]+(\d{1,3})\s*\)$/i;
8
+ export function parseColor(value) {
9
+ const v = value.trim();
10
+ const hex = HEX.exec(v);
11
+ if (hex) {
12
+ const h = hex[1].length === 3 ? [
13
+ ...hex[1]
14
+ ].map((c)=>c + c).join('') : hex[1];
15
+ return [
16
+ 0,
17
+ 2,
18
+ 4
19
+ ].map((i)=>Number.parseInt(h.slice(i, i + 2), 16));
20
+ }
21
+ const rgb = RGB.exec(v);
22
+ if (rgb) {
23
+ const channels = [
24
+ rgb[1],
25
+ rgb[2],
26
+ rgb[3]
27
+ ].map(Number);
28
+ if (channels.every((c)=>c <= 255)) return channels;
29
+ }
30
+ return undefined;
31
+ }
32
+ function channel(c) {
33
+ const s = c / 255;
34
+ return s <= 0.04045 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
35
+ }
36
+ export function relativeLuminance([r, g, b]) {
37
+ return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);
38
+ }
39
+ export function contrastRatio(a, b) {
40
+ const la = relativeLuminance(a);
41
+ const lb = relativeLuminance(b);
42
+ return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);
43
+ }
44
+
45
+ //# sourceMappingURL=contrast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/testing/contrast.ts"],"sourcesContent":["/**\n * WCAG 2.x relative luminance and contrast ratio, over the colour forms a\n * palette is written in: `#rgb`, `#rrggbb`, and `rgb()` with comma or space\n * separated channels. A colour with alpha has no contrast of its own (it\n * depends on what is under it), so it is refused rather than guessed.\n */\nexport type Rgb = readonly [number, number, number];\n\nconst HEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;\nconst RGB = /^rgba?\\(\\s*(\\d{1,3})[\\s,]+(\\d{1,3})[\\s,]+(\\d{1,3})\\s*\\)$/i;\n\nexport function parseColor(value: string): Rgb | undefined {\n const v = value.trim();\n const hex = HEX.exec(v);\n if (hex) {\n const h =\n hex[1].length === 3 ? [...hex[1]].map(c => c + c).join('') : hex[1];\n return [0, 2, 4].map(i =>\n Number.parseInt(h.slice(i, i + 2), 16),\n ) as unknown as Rgb;\n }\n const rgb = RGB.exec(v);\n if (rgb) {\n const channels = [rgb[1], rgb[2], rgb[3]].map(Number);\n if (channels.every(c => c <= 255)) return channels as unknown as Rgb;\n }\n return undefined;\n}\n\nfunction channel(c: number): number {\n const s = c / 255;\n return s <= 0.04045 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;\n}\n\nexport function relativeLuminance([r, g, b]: Rgb): number {\n return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);\n}\n\nexport function contrastRatio(a: Rgb, b: Rgb): number {\n const la = relativeLuminance(a);\n const lb = relativeLuminance(b);\n return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);\n}\n"],"names":["HEX","RGB","parseColor","value","v","trim","hex","exec","h","length","map","c","join","i","Number","parseInt","slice","rgb","channels","every","undefined","channel","s","relativeLuminance","r","g","b","contrastRatio","a","la","lb","Math","max","min"],"mappings":"AAAA;;;;;CAKC,GAGD,MAAMA,MAAM;AACZ,MAAMC,MAAM;AAEZ,OAAO,SAASC,WAAWC,KAAa;IACtC,MAAMC,IAAID,MAAME,IAAI;IACpB,MAAMC,MAAMN,IAAIO,IAAI,CAACH;IACrB,IAAIE,KAAK;QACP,MAAME,IACJF,GAAG,CAAC,EAAE,CAACG,MAAM,KAAK,IAAI;eAAIH,GAAG,CAAC,EAAE;SAAC,CAACI,GAAG,CAACC,CAAAA,IAAKA,IAAIA,GAAGC,IAAI,CAAC,MAAMN,GAAG,CAAC,EAAE;QACrE,OAAO;YAAC;YAAG;YAAG;SAAE,CAACI,GAAG,CAACG,CAAAA,IACnBC,OAAOC,QAAQ,CAACP,EAAEQ,KAAK,CAACH,GAAGA,IAAI,IAAI;IAEvC;IACA,MAAMI,MAAMhB,IAAIM,IAAI,CAACH;IACrB,IAAIa,KAAK;QACP,MAAMC,WAAW;YAACD,GAAG,CAAC,EAAE;YAAEA,GAAG,CAAC,EAAE;YAAEA,GAAG,CAAC,EAAE;SAAC,CAACP,GAAG,CAACI;QAC9C,IAAII,SAASC,KAAK,CAACR,CAAAA,IAAKA,KAAK,MAAM,OAAOO;IAC5C;IACA,OAAOE;AACT;AAEA,SAASC,QAAQV,CAAS;IACxB,MAAMW,IAAIX,IAAI;IACd,OAAOW,KAAK,UAAUA,IAAI,QAAQ,AAAC,CAAA,AAACA,CAAAA,IAAI,KAAI,IAAK,KAAI,KAAM;AAC7D;AAEA,OAAO,SAASC,kBAAkB,CAACC,GAAGC,GAAGC,EAAO;IAC9C,OAAO,SAASL,QAAQG,KAAK,SAASH,QAAQI,KAAK,SAASJ,QAAQK;AACtE;AAEA,OAAO,SAASC,cAAcC,CAAM,EAAEF,CAAM;IAC1C,MAAMG,KAAKN,kBAAkBK;IAC7B,MAAME,KAAKP,kBAAkBG;IAC7B,OAAO,AAACK,CAAAA,KAAKC,GAAG,CAACH,IAAIC,MAAM,IAAG,IAAMC,CAAAA,KAAKE,GAAG,CAACJ,IAAIC,MAAM,IAAG;AAC5D"}
@@ -0,0 +1,5 @@
1
+ export { assertPaletteContract, paletteContractFailures, type PaletteFailure, type PaletteValues, } from './assert-palette-contract.js';
2
+ export { contrastRatio, parseColor, relativeLuminance, type Rgb, } from './contrast.js';
3
+ export { PALETTE_PAIRS, PALETTE_TOKENS, type PalettePair } from './pairs.js';
4
+ export { parsePaletteCss } from './parse-palette-css.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,KAAK,GAAG,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { assertPaletteContract, paletteContractFailures } from './assert-palette-contract.js';
2
+ export { contrastRatio, parseColor, relativeLuminance } from './contrast.js';
3
+ export { PALETTE_PAIRS, PALETTE_TOKENS } from './pairs.js';
4
+ export { parsePaletteCss } from './parse-palette-css.js';
5
+
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/testing/index.ts"],"sourcesContent":["export {\n assertPaletteContract,\n paletteContractFailures,\n type PaletteFailure,\n type PaletteValues,\n} from './assert-palette-contract.js';\nexport {\n contrastRatio,\n parseColor,\n relativeLuminance,\n type Rgb,\n} from './contrast.js';\nexport { PALETTE_PAIRS, PALETTE_TOKENS, type PalettePair } from './pairs.js';\nexport { parsePaletteCss } from './parse-palette-css.js';\n"],"names":["assertPaletteContract","paletteContractFailures","contrastRatio","parseColor","relativeLuminance","PALETTE_PAIRS","PALETTE_TOKENS","parsePaletteCss"],"mappings":"AAAA,SACEA,qBAAqB,EACrBC,uBAAuB,QAGlB,+BAA+B;AACtC,SACEC,aAAa,EACbC,UAAU,EACVC,iBAAiB,QAEZ,gBAAgB;AACvB,SAASC,aAAa,EAAEC,cAAc,QAA0B,aAAa;AAC7E,SAASC,eAAe,QAAQ,yBAAyB"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The pair table of ADR 0025. Every palette — a preset, an app-local
3
+ * `[data-theme]` block, a runtime `ThemePalette` — is held to every row.
4
+ * Token names are written without the `--color-` prefix, as a `ThemePalette`
5
+ * writes them.
6
+ */
7
+ export interface PalettePair {
8
+ readonly use: string;
9
+ readonly foreground: string;
10
+ readonly background: string;
11
+ readonly minimum: number;
12
+ }
13
+ export declare const PALETTE_PAIRS: readonly PalettePair[];
14
+ /** Every token the pair table reads. A palette missing one cannot be held to it. */
15
+ export declare const PALETTE_TOKENS: readonly string[];
16
+ //# sourceMappingURL=pairs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pairs.d.ts","sourceRoot":"","sources":["../../src/testing/pairs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAeD,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAiC/C,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAEpC,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * The pair table of ADR 0025. Every palette — a preset, an app-local
3
+ * `[data-theme]` block, a runtime `ThemePalette` — is held to every row.
4
+ * Token names are written without the `--color-` prefix, as a `ThemePalette`
5
+ * writes them.
6
+ */ const SURFACES = [
7
+ 'surface',
8
+ 'surface-elevated'
9
+ ];
10
+ const TONES = [
11
+ 'danger',
12
+ 'success',
13
+ 'warning',
14
+ 'info'
15
+ ];
16
+ function onSurfaces(use, foregrounds, minimum) {
17
+ return foregrounds.flatMap((foreground)=>SURFACES.map((background)=>({
18
+ use,
19
+ foreground,
20
+ background,
21
+ minimum
22
+ })));
23
+ }
24
+ export const PALETTE_PAIRS = [
25
+ ...onSurfaces('body and muted text', [
26
+ 'content',
27
+ 'content-muted'
28
+ ], 4.5),
29
+ ...onSurfaces('link and ghost-button text', [
30
+ 'primary'
31
+ ], 4.5),
32
+ {
33
+ use: 'filled-button label',
34
+ foreground: 'primary-content',
35
+ background: 'primary',
36
+ minimum: 4.5
37
+ },
38
+ {
39
+ use: 'filled-button label',
40
+ foreground: 'danger-content',
41
+ background: 'danger',
42
+ minimum: 4.5
43
+ },
44
+ ...onSurfaces('accent used as text', [
45
+ 'accent'
46
+ ], 4.5),
47
+ ...TONES.flatMap((tone)=>[
48
+ {
49
+ use: 'tone text',
50
+ foreground: tone,
51
+ background: `${tone}-subtle`,
52
+ minimum: 4.5
53
+ },
54
+ ...onSurfaces('tone text', [
55
+ tone
56
+ ], 4.5)
57
+ ]),
58
+ ...onSurfaces('control boundary', [
59
+ 'border-control'
60
+ ], 3),
61
+ ...onSurfaces('focus indicator', [
62
+ 'focus-ring'
63
+ ], 3),
64
+ {
65
+ use: 'selected (not focused)',
66
+ foreground: 'selected',
67
+ background: 'surface-elevated',
68
+ minimum: 3
69
+ }
70
+ ];
71
+ /** Every token the pair table reads. A palette missing one cannot be held to it. */ export const PALETTE_TOKENS = [
72
+ ...new Set(PALETTE_PAIRS.flatMap((p)=>[
73
+ p.foreground,
74
+ p.background
75
+ ]))
76
+ ].sort();
77
+
78
+ //# sourceMappingURL=pairs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/testing/pairs.ts"],"sourcesContent":["/**\n * The pair table of ADR 0025. Every palette — a preset, an app-local\n * `[data-theme]` block, a runtime `ThemePalette` — is held to every row.\n * Token names are written without the `--color-` prefix, as a `ThemePalette`\n * writes them.\n */\nexport interface PalettePair {\n readonly use: string;\n readonly foreground: string;\n readonly background: string;\n readonly minimum: number;\n}\n\nconst SURFACES = ['surface', 'surface-elevated'] as const;\nconst TONES = ['danger', 'success', 'warning', 'info'] as const;\n\nfunction onSurfaces(\n use: string,\n foregrounds: readonly string[],\n minimum: number,\n): PalettePair[] {\n return foregrounds.flatMap(foreground =>\n SURFACES.map(background => ({ use, foreground, background, minimum })),\n );\n}\n\nexport const PALETTE_PAIRS: readonly PalettePair[] = [\n ...onSurfaces('body and muted text', ['content', 'content-muted'], 4.5),\n ...onSurfaces('link and ghost-button text', ['primary'], 4.5),\n {\n use: 'filled-button label',\n foreground: 'primary-content',\n background: 'primary',\n minimum: 4.5,\n },\n {\n use: 'filled-button label',\n foreground: 'danger-content',\n background: 'danger',\n minimum: 4.5,\n },\n ...onSurfaces('accent used as text', ['accent'], 4.5),\n ...TONES.flatMap(tone => [\n {\n use: 'tone text',\n foreground: tone,\n background: `${tone}-subtle`,\n minimum: 4.5,\n },\n ...onSurfaces('tone text', [tone], 4.5),\n ]),\n ...onSurfaces('control boundary', ['border-control'], 3),\n ...onSurfaces('focus indicator', ['focus-ring'], 3),\n {\n use: 'selected (not focused)',\n foreground: 'selected',\n background: 'surface-elevated',\n minimum: 3,\n },\n];\n\n/** Every token the pair table reads. A palette missing one cannot be held to it. */\nexport const PALETTE_TOKENS: readonly string[] = [\n ...new Set(PALETTE_PAIRS.flatMap(p => [p.foreground, p.background])),\n].sort();\n"],"names":["SURFACES","TONES","onSurfaces","use","foregrounds","minimum","flatMap","foreground","map","background","PALETTE_PAIRS","tone","PALETTE_TOKENS","Set","p","sort"],"mappings":"AAAA;;;;;CAKC,GAQD,MAAMA,WAAW;IAAC;IAAW;CAAmB;AAChD,MAAMC,QAAQ;IAAC;IAAU;IAAW;IAAW;CAAO;AAEtD,SAASC,WACPC,GAAW,EACXC,WAA8B,EAC9BC,OAAe;IAEf,OAAOD,YAAYE,OAAO,CAACC,CAAAA,aACzBP,SAASQ,GAAG,CAACC,CAAAA,aAAe,CAAA;gBAAEN;gBAAKI;gBAAYE;gBAAYJ;YAAQ,CAAA;AAEvE;AAEA,OAAO,MAAMK,gBAAwC;OAChDR,WAAW,uBAAuB;QAAC;QAAW;KAAgB,EAAE;OAChEA,WAAW,8BAA8B;QAAC;KAAU,EAAE;IACzD;QACEC,KAAK;QACLI,YAAY;QACZE,YAAY;QACZJ,SAAS;IACX;IACA;QACEF,KAAK;QACLI,YAAY;QACZE,YAAY;QACZJ,SAAS;IACX;OACGH,WAAW,uBAAuB;QAAC;KAAS,EAAE;OAC9CD,MAAMK,OAAO,CAACK,CAAAA,OAAQ;YACvB;gBACER,KAAK;gBACLI,YAAYI;gBACZF,YAAY,GAAGE,KAAK,OAAO,CAAC;gBAC5BN,SAAS;YACX;eACGH,WAAW,aAAa;gBAACS;aAAK,EAAE;SACpC;OACET,WAAW,oBAAoB;QAAC;KAAiB,EAAE;OACnDA,WAAW,mBAAmB;QAAC;KAAa,EAAE;IACjD;QACEC,KAAK;QACLI,YAAY;QACZE,YAAY;QACZJ,SAAS;IACX;CACD,CAAC;AAEF,kFAAkF,GAClF,OAAO,MAAMO,iBAAoC;OAC5C,IAAIC,IAAIH,cAAcJ,OAAO,CAACQ,CAAAA,IAAK;YAACA,EAAEP,UAAU;YAAEO,EAAEL,UAAU;SAAC;CACnE,CAACM,IAAI,GAAG"}
@@ -0,0 +1,10 @@
1
+ import type { PaletteValues } from './assert-palette-contract.js';
2
+ /**
3
+ * Reads the `--color-*` declarations of every palette block in a stylesheet:
4
+ * `@theme { … }` as `default`, `[data-theme='x'] { … }` as `x`. Comments are
5
+ * dropped first so a commented-out value is never read. A block that only
6
+ * overrides some tokens is returned as written; merging over the defaults is
7
+ * the caller's decision, because a runtime palette may not sit on them.
8
+ */
9
+ export declare function parsePaletteCss(css: string): Record<string, PaletteValues>;
10
+ //# sourceMappingURL=parse-palette-css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-palette-css.d.ts","sourceRoot":"","sources":["../../src/testing/parse-palette-css.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAMlE;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAW1E"}
@@ -0,0 +1,23 @@
1
+ /** The selector a palette block is keyed on, or `@theme` for the defaults. */ const BLOCK = /(@theme|\[data-theme=(?:'([^']+)'|"([^"]+)")\])\s*\{([^{}]*)\}/g;
2
+ const DECLARATION = /--color-([a-z0-9-]+)\s*:\s*([^;]+);/gi;
3
+ /**
4
+ * Reads the `--color-*` declarations of every palette block in a stylesheet:
5
+ * `@theme { … }` as `default`, `[data-theme='x'] { … }` as `x`. Comments are
6
+ * dropped first so a commented-out value is never read. A block that only
7
+ * overrides some tokens is returned as written; merging over the defaults is
8
+ * the caller's decision, because a runtime palette may not sit on them.
9
+ */ export function parsePaletteCss(css) {
10
+ const source = css.replace(/\/\*[\s\S]*?\*\//g, '');
11
+ const palettes = {};
12
+ for (const block of source.matchAll(BLOCK)){
13
+ var _ref, _block_, _palettes, _id, _;
14
+ const id = (_ref = (_block_ = block[2]) != null ? _block_ : block[3]) != null ? _ref : 'default';
15
+ const palette = (_ = (_palettes = palettes)[_id = id]) != null ? _ : _palettes[_id] = {};
16
+ for (const decl of block[4].matchAll(DECLARATION)){
17
+ palette[decl[1]] = decl[2].trim();
18
+ }
19
+ }
20
+ return palettes;
21
+ }
22
+
23
+ //# sourceMappingURL=parse-palette-css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/testing/parse-palette-css.ts"],"sourcesContent":["import type { PaletteValues } from './assert-palette-contract.js';\n\n/** The selector a palette block is keyed on, or `@theme` for the defaults. */\nconst BLOCK = /(@theme|\\[data-theme=(?:'([^']+)'|\"([^\"]+)\")\\])\\s*\\{([^{}]*)\\}/g;\nconst DECLARATION = /--color-([a-z0-9-]+)\\s*:\\s*([^;]+);/gi;\n\n/**\n * Reads the `--color-*` declarations of every palette block in a stylesheet:\n * `@theme { … }` as `default`, `[data-theme='x'] { … }` as `x`. Comments are\n * dropped first so a commented-out value is never read. A block that only\n * overrides some tokens is returned as written; merging over the defaults is\n * the caller's decision, because a runtime palette may not sit on them.\n */\nexport function parsePaletteCss(css: string): Record<string, PaletteValues> {\n const source = css.replace(/\\/\\*[\\s\\S]*?\\*\\//g, '');\n const palettes: Record<string, Record<string, string>> = {};\n for (const block of source.matchAll(BLOCK)) {\n const id = block[2] ?? block[3] ?? 'default';\n const palette = (palettes[id] ??= {});\n for (const decl of block[4].matchAll(DECLARATION)) {\n palette[decl[1]] = decl[2].trim();\n }\n }\n return palettes;\n}\n"],"names":["BLOCK","DECLARATION","parsePaletteCss","css","source","replace","palettes","block","matchAll","id","palette","decl","trim"],"mappings":"AAEA,4EAA4E,GAC5E,MAAMA,QAAQ;AACd,MAAMC,cAAc;AAEpB;;;;;;CAMC,GACD,OAAO,SAASC,gBAAgBC,GAAW;IACzC,MAAMC,SAASD,IAAIE,OAAO,CAAC,qBAAqB;IAChD,MAAMC,WAAmD,CAAC;IAC1D,KAAK,MAAMC,SAASH,OAAOI,QAAQ,CAACR,OAAQ;YAC/BO,MAAAA,SACMD,WAASG,KAATH;QADjB,MAAMG,MAAKF,QAAAA,UAAAA,KAAK,CAAC,EAAE,YAARA,UAAYA,KAAK,CAAC,EAAE,YAApBA,OAAwB;QACnC,MAAMG,WAAWJ,IAAAA,CAAAA,YAAAA,SAAQ,CAACG,MAAAA,GAAG,YAAZH,IAAAA,SAAQ,CAACG,IAAG,GAAK,CAAC;QACnC,KAAK,MAAME,QAAQJ,KAAK,CAAC,EAAE,CAACC,QAAQ,CAACP,aAAc;YACjDS,OAAO,CAACC,IAAI,CAAC,EAAE,CAAC,GAAGA,IAAI,CAAC,EAAE,CAACC,IAAI;QACjC;IACF;IACA,OAAON;AACT"}
package/package.json CHANGED
@@ -3,10 +3,26 @@
3
3
  "nx": {
4
4
  "tags": [
5
5
  "tier:0"
6
- ]
6
+ ],
7
+ "sourceRoot": "packages/style/src",
8
+ "targets": {
9
+ "build": {
10
+ "executor": "@nx/js:swc",
11
+ "outputs": [
12
+ "{options.outputPath}"
13
+ ],
14
+ "options": {
15
+ "outputPath": "packages/style/dist",
16
+ "main": "packages/style/src/testing/index.ts",
17
+ "tsConfig": "packages/style/tsconfig.lib.json",
18
+ "skipTypeCheck": true,
19
+ "stripLeadingPaths": true
20
+ }
21
+ }
22
+ }
7
23
  },
8
- "version": "0.18.1",
9
- "description": "Tailwind v4 design tokens and a semantic color contract, with a fluid and a fixed spacing scale and three palette presets.",
24
+ "version": "0.19.0",
25
+ "description": "Tailwind v4 design tokens and a semantic color contract, with a fluid and a fixed spacing scale and three palette presets, plus `assertPaletteContract`, the WCAG pair table every palette is held to.",
10
26
  "license": "MIT",
11
27
  "repository": {
12
28
  "type": "git",
@@ -24,10 +40,22 @@
24
40
  "./presets/fixed-scale.css": "./src/presets/fixed-scale.css",
25
41
  "./presets/aurora.css": "./src/presets/aurora.css",
26
42
  "./presets/sunset.css": "./src/presets/sunset.css",
27
- "./presets/midnight.css": "./src/presets/midnight.css"
43
+ "./presets/midnight.css": "./src/presets/midnight.css",
44
+ "./testing": {
45
+ "types": "./dist/testing/index.d.ts",
46
+ "import": "./dist/testing/index.js",
47
+ "default": "./dist/testing/index.js"
48
+ }
28
49
  },
29
50
  "files": [
30
- "src",
51
+ "src/tokens.css",
52
+ "src/theme.css",
53
+ "src/presets",
54
+ "dist",
55
+ "!**/*.tsbuildinfo",
31
56
  "LICENSE"
32
- ]
57
+ ],
58
+ "dependencies": {
59
+ "@swc/helpers": "0.5.23"
60
+ }
33
61
  }
@@ -4,13 +4,25 @@
4
4
  --color-surface-elevated: #ffffff;
5
5
  --color-content: #1b2432;
6
6
  --color-content-muted: #5a6b82;
7
- --color-primary: #3b6ff5;
7
+ --color-primary: #3768e6;
8
8
  --color-primary-content: #ffffff;
9
9
  --color-border: #dbe3ef;
10
- --color-accent: #7c5cff;
10
+ --color-border-control: #898e95;
11
+ --color-selected: #3768e6;
12
+ --color-accent: #7456ee;
11
13
  --color-focus-ring: #2f5fe0;
12
14
 
13
15
  --color-danger: #c0342b;
14
16
  --color-danger-subtle: #fdf2f1;
15
17
  --color-danger-content: #ffffff;
18
+
19
+ --color-success: #11803a;
20
+ --color-success-subtle: #ecf8f1;
21
+ --color-success-content: #ffffff;
22
+ --color-warning: #a75c05;
23
+ --color-warning-subtle: #fcf4eb;
24
+ --color-warning-content: #ffffff;
25
+ --color-info: #0274af;
26
+ --color-info-subtle: #ebf5fb;
27
+ --color-info-content: #ffffff;
16
28
  }
@@ -8,6 +8,8 @@
8
8
  --color-primary: #5b8cff;
9
9
  --color-primary-content: #0b1220;
10
10
  --color-border: #2a3546;
11
+ --color-border-control: #666e7a;
12
+ --color-selected: #5b8cff;
11
13
  --color-accent: #a17cff;
12
14
  --color-focus-ring: #7ea6ff;
13
15
 
@@ -15,6 +17,18 @@
15
17
  --color-danger-subtle: #2c1a1a;
16
18
  --color-danger-content: #0b1220;
17
19
 
20
+ --color-success: #1da64f;
21
+ --color-success-subtle: #102e24;
22
+ --color-success-content: #0b1220;
23
+ --color-warning: #d97706;
24
+ --color-warning-subtle: #332618;
25
+ --color-warning-content: #0b1220;
26
+ --color-info: #2997d0;
27
+ --color-info-subtle: #0d283b;
28
+ --color-info-content: #0b1220;
29
+
30
+ --color-scrim: rgb(0 0 0 / 0.6);
31
+
18
32
  /* Deeper elevation for dark surfaces. Black at the light scale's alphas is
19
33
  invisible on a dark ground, so the tint carries a strength multiplier —
20
34
  and the two large shadows are restated because a dark surface needs
@@ -4,16 +4,28 @@
4
4
  --color-surface-elevated: #fffdfb;
5
5
  --color-content: #3a2417;
6
6
  --color-content-muted: #8a6b57;
7
- --color-primary: #e5622d;
7
+ --color-primary: #b94f24;
8
8
  --color-primary-content: #fff8f3;
9
9
  --color-border: #f0dccb;
10
- --color-accent: #d9316b;
10
+ --color-border-control: #978b80;
11
+ --color-selected: #b94f24;
12
+ --color-accent: #cf2f66;
11
13
  --color-focus-ring: #c2481c;
12
14
 
13
15
  --color-danger: #c23b1e;
14
16
  --color-danger-subtle: #fdeee8;
15
17
  --color-danger-content: #fff8f3;
16
18
 
19
+ --color-success: #11803a;
20
+ --color-success-subtle: #ecf8f1;
21
+ --color-success-content: #fff8f3;
22
+ --color-warning: #a75c05;
23
+ --color-warning-subtle: #fcf4eb;
24
+ --color-warning-content: #fff8f3;
25
+ --color-info: #0274af;
26
+ --color-info-subtle: #ebf5fb;
27
+ --color-info-content: #fff8f3;
28
+
17
29
  /* Warm-tinted elevation. One line, and it now actually applies: these
18
30
  tokens are plain custom properties, not @theme entries Tailwind bakes. */
19
31
  --shadow-tint: 120 60 20;
package/src/tokens.css CHANGED
@@ -138,8 +138,21 @@
138
138
  --color-content-muted: #626b76;
139
139
  --color-primary: #3d4653;
140
140
  --color-primary-content: #ffffff;
141
+ --color-accent: #676f7b;
142
+
143
+ /* Two borders, because they answer different questions (ADR 0025).
144
+ `--color-border` is decorative — a divider, a card edge — and may stay
145
+ subtle. `--color-border-control` is the boundary of something a person
146
+ operates (an input, a select, a checkbox, a switch track), and WCAG 1.4.11
147
+ asks 3:1 of it against both surfaces. One token cannot be both: the
148
+ decorative border at 3:1 makes every card look outlined in pen. */
141
149
  --color-border: #dfe3e8;
142
- --color-accent: #6b7480;
150
+ --color-border-control: #888a8e;
151
+
152
+ /* A selected-but-not-focused item: the chosen row, the current option. A
153
+ background swap from surface to surface-elevated is about 1.05:1 and so
154
+ invisible; this is a marker colour, held to 3:1 on surface-elevated. */
155
+ --color-selected: #3d4653;
143
156
 
144
157
  /* The focus ring is a color in the contract, not a reuse of --color-accent.
145
158
  Operator efficiency IS keyboard use, so where the ring lands must be
@@ -156,6 +169,66 @@
156
169
  --color-danger: #b42318;
157
170
  --color-danger-subtle: #fef3f2;
158
171
  --color-danger-content: #ffffff;
172
+
173
+ /* The other three tones, shaped exactly like danger: the tone is the text
174
+ and the marker, `-subtle` the surface it sits on, `-content` the label on a
175
+ filled tone. Status needs them so it is never colour borrowed from
176
+ `accent`, and never colour alone — a StatusTag always carries text. */
177
+ --color-success: #11803a;
178
+ --color-success-subtle: #ecf8f1;
179
+ --color-success-content: #ffffff;
180
+ --color-warning: #a75c05;
181
+ --color-warning-subtle: #fcf4eb;
182
+ --color-warning-content: #ffffff;
183
+ --color-info: #0274af;
184
+ --color-info-subtle: #ebf5fb;
185
+ --color-info-content: #ffffff;
186
+
187
+ /* The backdrop behind a dialog, a drawer or the command palette. A token
188
+ rather than `bg-black/40` so a dark palette can deepen it. */
189
+ --color-scrim: rgb(15 23 42 / 0.4);
190
+ }
191
+
192
+ /*
193
+ * Layering. Tailwind v4 has no z-index theme namespace, so these are plain
194
+ * custom properties read as `z-(--z-overlay)`. Named for what sits there, in
195
+ * the order they stack; a literal `z-50` beside them is a guess about where
196
+ * everything else is.
197
+ */
198
+ :root {
199
+ --z-dropdown: 10;
200
+ --z-sticky: 20;
201
+ --z-overlay: 40;
202
+ --z-toast: 50;
203
+ --z-palette: 60;
204
+ }
205
+
206
+ /*
207
+ * Target size (WCAG 2.5.8, ADR 0025). The floor every interactive control's
208
+ * HIT area reaches, in every scale and density: compact density may shrink
209
+ * what is painted, never what is hit. A control axe measures by its own box
210
+ * carries `min-block-size: var(--target-min)`; one whose box must stay small
211
+ * (a checkbox, a tab close) extends a pseudo-element to it. A touch-first host
212
+ * raises the floor by overriding this one token — 44px is the usual choice.
213
+ */
214
+ :root {
215
+ --target-min: 24px;
216
+ }
217
+
218
+ /*
219
+ * Overlay geometry, relative to the viewport rather than the scale: how far
220
+ * down the command palette opens, and how much of the screen a drawer or a
221
+ * results list may take. Tokens, because a literal `pt-[12vh]` in a control is
222
+ * a decision nobody can find to change (ADR 0025).
223
+ */
224
+ :root {
225
+ --overlay-offset-block: 12vh;
226
+ --overlay-max-inline: 85vw;
227
+ --overlay-max-block: 60vh;
228
+
229
+ /* One em of the surrounding text: a skeleton line stands in for a line of
230
+ text at that text's own size, whatever scale it is set in. */
231
+ --glyph-block: 1em;
159
232
  }
160
233
 
161
234
  /*