@xenosystem/elements 0.0.10 → 0.0.12
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/dist/elements/activity.d.ts +11 -0
- package/dist/elements/activity.js +22 -0
- package/dist/elements/contact.d.ts +12 -0
- package/dist/elements/contact.js +26 -0
- package/dist/elements/film.d.ts +11 -0
- package/dist/elements/film.js +25 -0
- package/dist/elements/hash.d.ts +10 -0
- package/dist/elements/hash.js +22 -0
- package/dist/elements/mail.d.ts +11 -0
- package/dist/elements/mail.js +23 -0
- package/dist/tokens/dtcg.d.ts +74 -0
- package/dist/tokens/dtcg.js +136 -0
- package/dist/tokens/index.d.ts +3 -0
- package/dist/tokens/index.js +3 -0
- package/dist/tokens/oklch.d.ts +73 -0
- package/dist/tokens/oklch.js +206 -0
- package/dist/tokens/platform-theme.d.ts +71 -0
- package/dist/tokens/platform-theme.js +164 -0
- package/dist/tokens.dtcg.json +393 -0
- package/package.json +4 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ElementDeclaration } from '../schema';
|
|
2
|
+
/**
|
|
3
|
+
* `xeno.activity` — Activity. A degenerate element (pure geometry, no children).
|
|
4
|
+
*
|
|
5
|
+
* A pulse line: flat, one sharp rise and fall, flat. What changed and when — a feed of events, not a
|
|
6
|
+
* metric (that is `trending-up`).
|
|
7
|
+
*
|
|
8
|
+
* Drawn for the XENO Workspace sidebar (2026-10-03), from scratch to DESIGN_SYSTEM.md §3 — no circles.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Activity: ElementDeclaration;
|
|
11
|
+
export default Activity;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `xeno.activity` — Activity. A degenerate element (pure geometry, no children).
|
|
3
|
+
*
|
|
4
|
+
* A pulse line: flat, one sharp rise and fall, flat. What changed and when — a feed of events, not a
|
|
5
|
+
* metric (that is `trending-up`).
|
|
6
|
+
*
|
|
7
|
+
* Drawn for the XENO Workspace sidebar (2026-10-03), from scratch to DESIGN_SYSTEM.md §3 — no circles.
|
|
8
|
+
*/
|
|
9
|
+
export const Activity = {
|
|
10
|
+
id: 'xeno.activity',
|
|
11
|
+
kind: 'icon',
|
|
12
|
+
contract: { viewBox: '0 0 24 24', weight: 'regular', strokeFamily: 'xeno-regular', axes: [], signals: [] },
|
|
13
|
+
geometry: {
|
|
14
|
+
base: [
|
|
15
|
+
{ kind: 'path', d: 'M2.5 12h4.2l2.6-6.5 5.4 13 2.6-6.5h4.2' },
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
bindings: [],
|
|
19
|
+
a11y: { role: 'img', label: 'Activity' },
|
|
20
|
+
meta: { tags: ['activity', 'pulse', 'feed', 'events', 'history', 'changes'], since: '0.0.11' },
|
|
21
|
+
};
|
|
22
|
+
export default Activity;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ElementDeclaration } from '../schema';
|
|
2
|
+
/**
|
|
3
|
+
* `xeno.contact` — Contact. A degenerate element (pure geometry, no children).
|
|
4
|
+
*
|
|
5
|
+
* A contact card: the card, a person on the left (`user` at card scale) and three lines of detail. A
|
|
6
|
+
* customer, a lead, an address-book entry — a person you hold a record of, against `user` for a member.
|
|
7
|
+
* part[0] = card, part[1..2] = person, part[3] = details.
|
|
8
|
+
*
|
|
9
|
+
* Drawn for the XENO Workspace sidebar (2026-10-03), from scratch to DESIGN_SYSTEM.md §3 — no circles.
|
|
10
|
+
*/
|
|
11
|
+
export declare const Contact: ElementDeclaration;
|
|
12
|
+
export default Contact;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `xeno.contact` — Contact. A degenerate element (pure geometry, no children).
|
|
3
|
+
*
|
|
4
|
+
* A contact card: the card, a person on the left (`user` at card scale) and three lines of detail. A
|
|
5
|
+
* customer, a lead, an address-book entry — a person you hold a record of, against `user` for a member.
|
|
6
|
+
* part[0] = card, part[1..2] = person, part[3] = details.
|
|
7
|
+
*
|
|
8
|
+
* Drawn for the XENO Workspace sidebar (2026-10-03), from scratch to DESIGN_SYSTEM.md §3 — no circles.
|
|
9
|
+
*/
|
|
10
|
+
export const Contact = {
|
|
11
|
+
id: 'xeno.contact',
|
|
12
|
+
kind: 'icon',
|
|
13
|
+
contract: { viewBox: '0 0 24 24', weight: 'regular', strokeFamily: 'xeno-regular', axes: [], signals: [] },
|
|
14
|
+
geometry: {
|
|
15
|
+
base: [
|
|
16
|
+
{ kind: 'rect', x: 3, y: 5, w: 18, h: 14, rx: 2 },
|
|
17
|
+
{ kind: 'rect', x: 6.2, y: 8.4, w: 4.4, h: 4.4, rx: 1 },
|
|
18
|
+
{ kind: 'path', d: 'M5.8 16.4a2.4 2.4 0 0 1 2.4-2h0.8a2.4 2.4 0 0 1 2.4 2' },
|
|
19
|
+
{ kind: 'path', d: 'M13.6 9.5h4.4M13.6 12.5h4.4M13.6 15.5h2.8' },
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
bindings: [],
|
|
23
|
+
a11y: { role: 'img', label: 'Contact' },
|
|
24
|
+
meta: { tags: ['contact', 'customer', 'card', 'crm', 'person', 'lead'], since: '0.0.11' },
|
|
25
|
+
};
|
|
26
|
+
export default Contact;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ElementDeclaration } from '../schema';
|
|
2
|
+
/**
|
|
3
|
+
* `xeno.film` — Film. A degenerate element (pure geometry, no children).
|
|
4
|
+
*
|
|
5
|
+
* A strip of film: the frame, the two rails, and the perforations as short bars on each rail (not holes —
|
|
6
|
+
* a hole is a circle). Stands for a render or a clip. part[0] = frame, part[1..2] = rails, part[3] = perforations.
|
|
7
|
+
*
|
|
8
|
+
* Drawn for the XENO Workspace sidebar (2026-10-03), from scratch to DESIGN_SYSTEM.md §3 — no circles.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Film: ElementDeclaration;
|
|
11
|
+
export default Film;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `xeno.film` — Film. A degenerate element (pure geometry, no children).
|
|
3
|
+
*
|
|
4
|
+
* A strip of film: the frame, the two rails, and the perforations as short bars on each rail (not holes —
|
|
5
|
+
* a hole is a circle). Stands for a render or a clip. part[0] = frame, part[1..2] = rails, part[3] = perforations.
|
|
6
|
+
*
|
|
7
|
+
* Drawn for the XENO Workspace sidebar (2026-10-03), from scratch to DESIGN_SYSTEM.md §3 — no circles.
|
|
8
|
+
*/
|
|
9
|
+
export const Film = {
|
|
10
|
+
id: 'xeno.film',
|
|
11
|
+
kind: 'icon',
|
|
12
|
+
contract: { viewBox: '0 0 24 24', weight: 'regular', strokeFamily: 'xeno-regular', axes: [], signals: [] },
|
|
13
|
+
geometry: {
|
|
14
|
+
base: [
|
|
15
|
+
{ kind: 'rect', x: 3.5, y: 4.5, w: 17, h: 15, rx: 2.2 },
|
|
16
|
+
{ kind: 'path', d: 'M7.5 4.5v15' },
|
|
17
|
+
{ kind: 'path', d: 'M16.5 4.5v15' },
|
|
18
|
+
{ kind: 'path', d: 'M3.5 9.5h4M3.5 14.5h4M16.5 9.5h4M16.5 14.5h4' },
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
bindings: [],
|
|
22
|
+
a11y: { role: 'img', label: 'Film' },
|
|
23
|
+
meta: { tags: ['film', 'video', 'render', 'movie', 'clip'], since: '0.0.11' },
|
|
24
|
+
};
|
|
25
|
+
export default Film;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ElementDeclaration } from '../schema';
|
|
2
|
+
/**
|
|
3
|
+
* `xeno.hash` — Channel. A degenerate element (pure geometry, no children).
|
|
4
|
+
*
|
|
5
|
+
* The number sign, slanted the way a channel name is written. A channel or a topic.
|
|
6
|
+
*
|
|
7
|
+
* Drawn for the XENO Workspace sidebar (2026-10-03), from scratch to DESIGN_SYSTEM.md §3 — no circles.
|
|
8
|
+
*/
|
|
9
|
+
export declare const Hash: ElementDeclaration;
|
|
10
|
+
export default Hash;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `xeno.hash` — Channel. A degenerate element (pure geometry, no children).
|
|
3
|
+
*
|
|
4
|
+
* The number sign, slanted the way a channel name is written. A channel or a topic.
|
|
5
|
+
*
|
|
6
|
+
* Drawn for the XENO Workspace sidebar (2026-10-03), from scratch to DESIGN_SYSTEM.md §3 — no circles.
|
|
7
|
+
*/
|
|
8
|
+
export const Hash = {
|
|
9
|
+
id: 'xeno.hash',
|
|
10
|
+
kind: 'icon',
|
|
11
|
+
contract: { viewBox: '0 0 24 24', weight: 'regular', strokeFamily: 'xeno-regular', axes: [], signals: [] },
|
|
12
|
+
geometry: {
|
|
13
|
+
base: [
|
|
14
|
+
{ kind: 'path', d: 'M10 3.5 8 20.5M16 3.5l-2 17' },
|
|
15
|
+
{ kind: 'path', d: 'M4.5 9h15.5M4 15h15.5' },
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
bindings: [],
|
|
19
|
+
a11y: { role: 'img', label: 'Channel' },
|
|
20
|
+
meta: { tags: ['hash', 'channel', 'tag', 'topic', 'number'], since: '0.0.11' },
|
|
21
|
+
};
|
|
22
|
+
export default Hash;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ElementDeclaration } from '../schema';
|
|
2
|
+
/**
|
|
3
|
+
* `xeno.mail` — Mail. A degenerate element (pure geometry, no children).
|
|
4
|
+
*
|
|
5
|
+
* An envelope: the body and the flap folding to a point a little above centre, so it reads as closed
|
|
6
|
+
* at 15px. part[0] = body, part[1] = flap.
|
|
7
|
+
*
|
|
8
|
+
* Drawn for the XENO Workspace sidebar (2026-10-03), from scratch to DESIGN_SYSTEM.md §3 — no circles.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Mail: ElementDeclaration;
|
|
11
|
+
export default Mail;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `xeno.mail` — Mail. A degenerate element (pure geometry, no children).
|
|
3
|
+
*
|
|
4
|
+
* An envelope: the body and the flap folding to a point a little above centre, so it reads as closed
|
|
5
|
+
* at 15px. part[0] = body, part[1] = flap.
|
|
6
|
+
*
|
|
7
|
+
* Drawn for the XENO Workspace sidebar (2026-10-03), from scratch to DESIGN_SYSTEM.md §3 — no circles.
|
|
8
|
+
*/
|
|
9
|
+
export const Mail = {
|
|
10
|
+
id: 'xeno.mail',
|
|
11
|
+
kind: 'icon',
|
|
12
|
+
contract: { viewBox: '0 0 24 24', weight: 'regular', strokeFamily: 'xeno-regular', axes: [], signals: [] },
|
|
13
|
+
geometry: {
|
|
14
|
+
base: [
|
|
15
|
+
{ kind: 'rect', x: 3, y: 5.5, w: 18, h: 13, rx: 2 },
|
|
16
|
+
{ kind: 'path', d: 'M3.8 7.4l8.2 5.8 8.2-5.8' },
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
bindings: [],
|
|
20
|
+
a11y: { role: 'img', label: 'Mail' },
|
|
21
|
+
meta: { tags: ['mail', 'email', 'envelope', 'message', 'inbox'], since: '0.0.11' },
|
|
22
|
+
};
|
|
23
|
+
export default Mail;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* W3C Design Tokens Community Group (DTCG 2025.10) compiler & WCAG 2.2 AA contrast gate.
|
|
3
|
+
*
|
|
4
|
+
* Single machine-readable source for exporting XENO design tokens to Web, Electron, native
|
|
5
|
+
* renderers, XENO Canvas, and `@xenosystem/elements-mcp`, with fail-closed contrast verification
|
|
6
|
+
* across Industrial Warm Dark, Industrial Warm Light, and Soft Dark.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
export interface DtcgToken<T = string | number> {
|
|
11
|
+
readonly $value: T;
|
|
12
|
+
readonly $type: 'color' | 'dimension' | 'duration' | 'cubicBezier' | 'fontFamily' | 'shadow';
|
|
13
|
+
readonly $description?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface DtcgGroup {
|
|
16
|
+
readonly [key: string]: DtcgToken | DtcgGroup;
|
|
17
|
+
}
|
|
18
|
+
/** Reference warm ramps measured across Corpus v9, Creator v3, Motion v12, Workshop v3, Desktop. */
|
|
19
|
+
export declare const REFERENCE_PALETTES: Readonly<{
|
|
20
|
+
industrialDark: Readonly<{
|
|
21
|
+
canvas: "#141312";
|
|
22
|
+
surface: "#1c1b19";
|
|
23
|
+
viewport: "#232220";
|
|
24
|
+
elevated: "#282724";
|
|
25
|
+
control: "#2e2d2a";
|
|
26
|
+
border: "#33312e";
|
|
27
|
+
borderSubtle: "#2e2c29";
|
|
28
|
+
text: "#edebe7";
|
|
29
|
+
active: "#d6d2cb";
|
|
30
|
+
mutedText: "#aaa59d";
|
|
31
|
+
muted: "#7f7a72";
|
|
32
|
+
onAccent: "#1c1b19";
|
|
33
|
+
}>;
|
|
34
|
+
industrialLight: Readonly<{
|
|
35
|
+
canvas: "#e9e6e1";
|
|
36
|
+
surface: "#f6f4f1";
|
|
37
|
+
viewport: "#ffffff";
|
|
38
|
+
elevated: "#ffffff";
|
|
39
|
+
control: "#eae7e2";
|
|
40
|
+
border: "#dedad4";
|
|
41
|
+
borderSubtle: "#e4e0da";
|
|
42
|
+
text: "#1f1f1f";
|
|
43
|
+
active: "#2e2c29";
|
|
44
|
+
mutedText: "#4e4a45";
|
|
45
|
+
muted: "#6e6a64";
|
|
46
|
+
onAccent: "#faf9f7";
|
|
47
|
+
}>;
|
|
48
|
+
softDark: Readonly<{
|
|
49
|
+
canvas: "#08080a";
|
|
50
|
+
surface: "#161618";
|
|
51
|
+
viewport: "#111111";
|
|
52
|
+
elevated: "#111115";
|
|
53
|
+
control: "#2b2b2b";
|
|
54
|
+
text: "#d8d8de";
|
|
55
|
+
mutedText: "#9a9aa1";
|
|
56
|
+
muted: "#7f7f86";
|
|
57
|
+
onAccent: "#08080a";
|
|
58
|
+
}>;
|
|
59
|
+
}>;
|
|
60
|
+
/** Exact WCAG 2.2 relative-luminance contrast ratio (1..21). */
|
|
61
|
+
export declare function wcagContrastRatio(fgHex: string, bgHex: string): number;
|
|
62
|
+
export interface ContrastCheck {
|
|
63
|
+
readonly theme: string;
|
|
64
|
+
readonly pair: string;
|
|
65
|
+
readonly fg: string;
|
|
66
|
+
readonly bg: string;
|
|
67
|
+
readonly ratio: number;
|
|
68
|
+
readonly minRatio: number;
|
|
69
|
+
readonly pass: boolean;
|
|
70
|
+
}
|
|
71
|
+
/** Verify every primary, secondary, and primary-button ink/surface pair meets WCAG 2.2 AA (4.5:1). */
|
|
72
|
+
export declare function verifyThemeContrast(): readonly ContrastCheck[];
|
|
73
|
+
/** Compile the canonical W3C DTCG 2025.10 token document from live XENO token data. */
|
|
74
|
+
export declare function compileDtcgTokens(): DtcgGroup;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* W3C Design Tokens Community Group (DTCG 2025.10) compiler & WCAG 2.2 AA contrast gate.
|
|
3
|
+
*
|
|
4
|
+
* Single machine-readable source for exporting XENO design tokens to Web, Electron, native
|
|
5
|
+
* renderers, XENO Canvas, and `@xenosystem/elements-mcp`, with fail-closed contrast verification
|
|
6
|
+
* across Industrial Warm Dark, Industrial Warm Light, and Soft Dark.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { surface } from './surfaces.js';
|
|
11
|
+
import { text } from './interactive.js';
|
|
12
|
+
import { radius } from './radius.js';
|
|
13
|
+
import { controlSize } from './size.js';
|
|
14
|
+
import { status } from './status.js';
|
|
15
|
+
import { easing, duration } from './motion.js';
|
|
16
|
+
/** Reference warm ramps measured across Corpus v9, Creator v3, Motion v12, Workshop v3, Desktop. */
|
|
17
|
+
export const REFERENCE_PALETTES = Object.freeze({
|
|
18
|
+
industrialDark: Object.freeze({
|
|
19
|
+
canvas: '#141312',
|
|
20
|
+
surface: '#1c1b19',
|
|
21
|
+
viewport: '#232220',
|
|
22
|
+
elevated: '#282724',
|
|
23
|
+
control: '#2e2d2a',
|
|
24
|
+
border: '#33312e',
|
|
25
|
+
borderSubtle: '#2e2c29',
|
|
26
|
+
text: '#edebe7',
|
|
27
|
+
active: '#d6d2cb',
|
|
28
|
+
mutedText: '#aaa59d',
|
|
29
|
+
muted: '#7f7a72',
|
|
30
|
+
onAccent: '#1c1b19',
|
|
31
|
+
}),
|
|
32
|
+
industrialLight: Object.freeze({
|
|
33
|
+
canvas: '#e9e6e1',
|
|
34
|
+
surface: '#f6f4f1',
|
|
35
|
+
viewport: '#ffffff',
|
|
36
|
+
elevated: '#ffffff',
|
|
37
|
+
control: '#eae7e2',
|
|
38
|
+
border: '#dedad4',
|
|
39
|
+
borderSubtle: '#e4e0da',
|
|
40
|
+
text: '#1f1f1f',
|
|
41
|
+
active: '#2e2c29',
|
|
42
|
+
mutedText: '#4e4a45',
|
|
43
|
+
muted: '#6e6a64',
|
|
44
|
+
onAccent: '#faf9f7',
|
|
45
|
+
}),
|
|
46
|
+
softDark: Object.freeze({
|
|
47
|
+
canvas: surface.page,
|
|
48
|
+
surface: surface.panelBody,
|
|
49
|
+
viewport: surface.canvas,
|
|
50
|
+
elevated: surface.dialog,
|
|
51
|
+
control: surface.input,
|
|
52
|
+
text: text.hover,
|
|
53
|
+
mutedText: text.secondary,
|
|
54
|
+
muted: text.idle,
|
|
55
|
+
onAccent: surface.page,
|
|
56
|
+
}),
|
|
57
|
+
});
|
|
58
|
+
function parseHexRgb(hex) {
|
|
59
|
+
const clean = hex.trim().replace(/^#/, '');
|
|
60
|
+
if (!/^[0-9a-fA-F]{6}$/.test(clean)) {
|
|
61
|
+
throw new Error(`Expected 6-digit hex color, got "${hex}"`);
|
|
62
|
+
}
|
|
63
|
+
return [
|
|
64
|
+
parseInt(clean.slice(0, 2), 16) / 255,
|
|
65
|
+
parseInt(clean.slice(2, 4), 16) / 255,
|
|
66
|
+
parseInt(clean.slice(4, 6), 16) / 255,
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
function relativeLuminance(hex) {
|
|
70
|
+
const [r, g, b] = parseHexRgb(hex).map((c) => c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4));
|
|
71
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
72
|
+
}
|
|
73
|
+
/** Exact WCAG 2.2 relative-luminance contrast ratio (1..21). */
|
|
74
|
+
export function wcagContrastRatio(fgHex, bgHex) {
|
|
75
|
+
const l1 = relativeLuminance(fgHex);
|
|
76
|
+
const l2 = relativeLuminance(bgHex);
|
|
77
|
+
const lighter = Math.max(l1, l2);
|
|
78
|
+
const darker = Math.min(l1, l2);
|
|
79
|
+
return Number(((lighter + 0.05) / (darker + 0.05)).toFixed(2));
|
|
80
|
+
}
|
|
81
|
+
/** Verify every primary, secondary, and primary-button ink/surface pair meets WCAG 2.2 AA (4.5:1). */
|
|
82
|
+
export function verifyThemeContrast() {
|
|
83
|
+
const checks = [];
|
|
84
|
+
const push = (theme, pair, fg, bg, minRatio = 4.5) => {
|
|
85
|
+
const ratio = wcagContrastRatio(fg, bg);
|
|
86
|
+
checks.push({ theme, pair, fg, bg, ratio, minRatio, pass: ratio >= minRatio });
|
|
87
|
+
};
|
|
88
|
+
for (const [name, p] of Object.entries(REFERENCE_PALETTES)) {
|
|
89
|
+
push(name, 'text on viewport', p.text, p.viewport, 4.5);
|
|
90
|
+
push(name, 'text on surface', p.text, p.surface, 4.5);
|
|
91
|
+
push(name, 'text on control', p.text, p.control, 4.5);
|
|
92
|
+
push(name, 'mutedText on viewport', p.mutedText, p.viewport, 4.5);
|
|
93
|
+
push(name, 'mutedText on surface', p.mutedText, p.surface, 4.5);
|
|
94
|
+
push(name, 'mutedText on control', p.mutedText, p.control, 4.5);
|
|
95
|
+
push(name, 'onAccent on primary fill (text)', p.onAccent, p.text, 4.5);
|
|
96
|
+
}
|
|
97
|
+
return checks;
|
|
98
|
+
}
|
|
99
|
+
const color = (value, description) => ({
|
|
100
|
+
$value: value,
|
|
101
|
+
$type: 'color',
|
|
102
|
+
$description: description,
|
|
103
|
+
});
|
|
104
|
+
const dim = (px, description) => ({
|
|
105
|
+
$value: `${px}px`,
|
|
106
|
+
$type: 'dimension',
|
|
107
|
+
...(description ? { $description: description } : {}),
|
|
108
|
+
});
|
|
109
|
+
/** Compile the canonical W3C DTCG 2025.10 token document from live XENO token data. */
|
|
110
|
+
export function compileDtcgTokens() {
|
|
111
|
+
const mapPalette = (p, label) => Object.fromEntries(Object.entries(p).map(([k, v]) => [k, color(v, `${label} ${k}`)]));
|
|
112
|
+
return {
|
|
113
|
+
$schema: { $value: 'https://www.designtokens.org/tr/2025.10/format/', $type: 'fontFamily', $description: 'W3C DTCG 2025.10 format marker' },
|
|
114
|
+
color: {
|
|
115
|
+
industrialDark: mapPalette(REFERENCE_PALETTES.industrialDark, 'Industrial warm dark'),
|
|
116
|
+
industrialLight: mapPalette(REFERENCE_PALETTES.industrialLight, 'Industrial warm light'),
|
|
117
|
+
softDark: mapPalette(REFERENCE_PALETTES.softDark, 'Soft dark'),
|
|
118
|
+
status: Object.fromEntries(Object.entries(status).map(([k, v]) => [k, color(v, `Semantic status ${k}`)])),
|
|
119
|
+
},
|
|
120
|
+
radius: Object.fromEntries(Object.entries(radius).map(([k, v]) => [k, dim(v, `Corner radius ${k} (rounded squares, never circles)`)])),
|
|
121
|
+
controlSize: Object.fromEntries(Object.entries(controlSize).map(([k, s]) => [
|
|
122
|
+
k,
|
|
123
|
+
{
|
|
124
|
+
height: dim(s.height),
|
|
125
|
+
padX: dim(s.padX),
|
|
126
|
+
gap: dim(s.gap),
|
|
127
|
+
icon: dim(s.icon),
|
|
128
|
+
font: dim(s.font),
|
|
129
|
+
},
|
|
130
|
+
])),
|
|
131
|
+
motion: {
|
|
132
|
+
duration: Object.fromEntries(Object.entries(duration).map(([k, ms]) => [k, { $value: `${ms}ms`, $type: 'duration' }])),
|
|
133
|
+
easing: Object.fromEntries(Object.entries(easing).map(([k, curve]) => [k, { $value: curve, $type: 'cubicBezier' }])),
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
package/dist/tokens/index.d.ts
CHANGED
package/dist/tokens/index.js
CHANGED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Perceptual OKLCH + APCA (W3 0.0.98G-4g) Parametric Theme Engine.
|
|
3
|
+
*
|
|
4
|
+
* Derives an entire XENO surface/ink/border/semantic ramp mathematically from 3 perceptual knobs
|
|
5
|
+
* (`mode`, `warmthHue`, `chroma`, plus optional `contrast` tier), guaranteeing BOTH:
|
|
6
|
+
* - WCAG 2.2 AA (>= 4.5:1 standard, >= 7.0:1 high-contrast)
|
|
7
|
+
* - APCA Lc (|Lc| >= 75 primary text, |Lc| >= 60 secondary reading text)
|
|
8
|
+
* by construction — eliminating hand-tuned dark/light/high-contrast drift forever.
|
|
9
|
+
*
|
|
10
|
+
* Zero external dependencies. Runs identically in Node, Web, Electron, and MCP.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
export type ThemeMode = 'dark' | 'light';
|
|
15
|
+
export type ContrastTier = 'standard' | 'high' | 'oled';
|
|
16
|
+
export interface OklchThemeSpec {
|
|
17
|
+
readonly mode: ThemeMode;
|
|
18
|
+
/** Warmth hue angle in degrees (default `65` — warm stone matching the 5 XENO references). */
|
|
19
|
+
readonly warmthHue?: number;
|
|
20
|
+
/** Neutral chroma tint (default `0.008` warm neutral; `0` = pure achromatic grey). */
|
|
21
|
+
readonly chroma?: number;
|
|
22
|
+
/** Contrast tier: `'standard'` (AA + Lc 75/60), `'high'` (AAA + Lc 90/75), `'oled'` (true black dark). */
|
|
23
|
+
readonly contrast?: ContrastTier;
|
|
24
|
+
}
|
|
25
|
+
export interface GeneratedThemePalette {
|
|
26
|
+
readonly spec: Required<OklchThemeSpec>;
|
|
27
|
+
readonly canvas: string;
|
|
28
|
+
readonly surface: string;
|
|
29
|
+
readonly viewport: string;
|
|
30
|
+
readonly elevated: string;
|
|
31
|
+
readonly control: string;
|
|
32
|
+
readonly border: string;
|
|
33
|
+
readonly borderSubtle: string;
|
|
34
|
+
readonly text: string;
|
|
35
|
+
readonly active: string;
|
|
36
|
+
readonly mutedText: string;
|
|
37
|
+
readonly muted: string;
|
|
38
|
+
readonly onAccent: string;
|
|
39
|
+
readonly ok: string;
|
|
40
|
+
readonly warn: string;
|
|
41
|
+
readonly danger: string;
|
|
42
|
+
readonly info: string;
|
|
43
|
+
readonly audit: {
|
|
44
|
+
readonly textOnViewportWcag: number;
|
|
45
|
+
readonly textOnViewportApca: number;
|
|
46
|
+
readonly mutedOnSurfaceWcag: number;
|
|
47
|
+
readonly mutedOnSurfaceApca: number;
|
|
48
|
+
readonly mutedOnControlWcag: number;
|
|
49
|
+
readonly mutedOnControlApca: number;
|
|
50
|
+
readonly allPass: boolean;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** Exact OKLCH (L in [0..1], C >= 0, H in degrees) → sRGB 6-digit hex converter. */
|
|
54
|
+
export declare function oklchToHex(l: number, c: number, hDeg: number): string;
|
|
55
|
+
/**
|
|
56
|
+
* APCA W3 (0.0.98G-4g) perceptual lightness contrast (`Lc`).
|
|
57
|
+
* Positive = dark text on light background; negative = light text on dark background.
|
|
58
|
+
* Reading targets: `|Lc| >= 75` for primary UI text, `|Lc| >= 60` for secondary reading text.
|
|
59
|
+
*/
|
|
60
|
+
export declare function apcaContrast(textHex: string, bgHex: string): number;
|
|
61
|
+
/**
|
|
62
|
+
* Compile a mathematically contrast-verified XENO theme from 3 perceptual OKLCH knobs.
|
|
63
|
+
*/
|
|
64
|
+
export declare function generateOklchTheme(input: OklchThemeSpec): GeneratedThemePalette;
|
|
65
|
+
/** Convert a generated OKLCH theme directly into `--xeno-*` CSS custom property assignments. */
|
|
66
|
+
export declare function themeToCssVars(theme: GeneratedThemePalette): Record<string, string>;
|
|
67
|
+
export declare const OKLCH_PRESETS: Readonly<{
|
|
68
|
+
warmDark: GeneratedThemePalette;
|
|
69
|
+
warmLight: GeneratedThemePalette;
|
|
70
|
+
highContrastDark: GeneratedThemePalette;
|
|
71
|
+
highContrastLight: GeneratedThemePalette;
|
|
72
|
+
oledDark: GeneratedThemePalette;
|
|
73
|
+
}>;
|