@lace-cloud/design-tokens 0.41.0 → 0.42.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
@@ -101,6 +101,19 @@ the same channels are system colours, for every theme. A host maps its own theme
101
101
  onto `THEMES`; a custom property added to the remap is added to both the theme block and
102
102
  the forced-colors block at the end of `tokens.css`, which a test holds equal.
103
103
 
104
+ ## The reader's theme
105
+
106
+ Product UI offers its reader `PRODUCT_THEMES`, `light` and `dark`, and a third
107
+ choice, `system`, which follows the device (`ThemeChoice`); a switch offers
108
+ `system` first, then the two in that order. The choice is kept in
109
+ the browser under `THEME_STORAGE_KEY` (`lace-theme`), absent for `system`.
110
+ `choiceOf(stored)` reads a stored value (anything else is `system`), and
111
+ `themeOf(choice, systemLight)` gives the theme to draw, `systemLight` being
112
+ `SYSTEM_LIGHT_QUERY`'s answer. `PRE_MOUNT_THEME_SCRIPT` is the same rule as a
113
+ self-contained script: a page runs it in its `<head>` so `<html data-theme>` is
114
+ set before the first paint. Its text is fixed, so a page's Content Security Policy
115
+ can admit it by hash.
116
+
104
117
  ## Conventions
105
118
 
106
119
  - **Tokens first.** No raw hex in consumer code. If a color isn't in
package/dist/index.cjs CHANGED
@@ -21,15 +21,21 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
23
  PAPERS: () => PAPERS,
24
+ PRE_MOUNT_THEME_SCRIPT: () => PRE_MOUNT_THEME_SCRIPT,
25
+ PRODUCT_THEMES: () => PRODUCT_THEMES,
24
26
  PRODUCT_TYPE_SET: () => PRODUCT_TYPE_SET,
27
+ SYSTEM_LIGHT_QUERY: () => SYSTEM_LIGHT_QUERY,
25
28
  THEMES: () => THEMES,
29
+ THEME_STORAGE_KEY: () => THEME_STORAGE_KEY,
26
30
  TYPE_SETS: () => TYPE_SETS,
27
31
  brand: () => brand,
32
+ choiceOf: () => choiceOf,
28
33
  darkTheme: () => darkTheme,
29
34
  lightTheme: () => lightTheme,
30
35
  pin: () => pin,
31
36
  textRoles: () => textRoles,
32
- themeDeclarations: () => themeDeclarations
37
+ themeDeclarations: () => themeDeclarations,
38
+ themeOf: () => themeOf
33
39
  });
34
40
  module.exports = __toCommonJS(src_exports);
35
41
 
@@ -59,6 +65,9 @@ var darkTheme = {
59
65
  "--lace-color-accent-alpha-subtle": "rgba(206, 254, 101, 0.1)",
60
66
  "--lace-color-accent-alpha-medium": "rgba(206, 254, 101, 0.2)",
61
67
  "--lace-color-accent-strong": "#e0ff8a",
68
+ "--lace-color-blue-mark": "#60a5fa",
69
+ "--lace-color-amber-mark": "#f5a623",
70
+ "--lace-color-green-mark": "#4ade80",
62
71
  "--lace-color-success": "#4ade80",
63
72
  "--lace-color-success-hover": "#22c55e",
64
73
  "--lace-color-danger": "#e5484d",
@@ -76,27 +85,30 @@ var darkTheme = {
76
85
  "--lace-color-series-6": "#cefe65"
77
86
  };
78
87
  var lightTheme = {
79
- "--lace-color-bg-canvas": "#f6f7f5",
88
+ "--lace-color-bg-canvas": "#ffffff",
80
89
  "--lace-color-bg-surface": "#ffffff",
81
- "--lace-color-bg-surface-alt": "#f1f3f0",
90
+ "--lace-color-bg-surface-alt": "#f4f5f2",
82
91
  "--lace-color-bg-input": "#ffffff",
83
92
  "--lace-color-bg-context-menu": "#ffffff",
84
- "--lace-color-border-default": "rgba(22, 22, 22, 0.1)",
85
- "--lace-color-border-subtle": "#e2e8f0",
93
+ "--lace-color-border-default": "#eef0f3",
94
+ "--lace-color-border-subtle": "#dfe3ea",
86
95
  "--lace-color-border-input": "rgba(22, 22, 22, 0.2)",
87
96
  "--lace-color-border-control": "#7a7a7a",
88
97
  "--lace-color-border-input-hover": "#4b5563",
89
- "--lace-color-text-primary": "#161616",
98
+ "--lace-color-text-primary": "#0f172a",
90
99
  "--lace-color-text-label": "#1f2937",
91
- "--lace-color-text-muted": "#5c635e",
92
- "--lace-color-text-description": "#454b47",
100
+ "--lace-color-text-muted": "#606f85",
101
+ "--lace-color-text-description": "#475569",
93
102
  "--lace-color-text-danger": "#dc2626",
94
103
  "--lace-color-text-danger-soft": "#ef4444",
95
104
  "--lace-color-row-hover": "rgba(0, 0, 0, 0.02)",
96
- "--lace-color-ink": "#4a6e12",
97
- "--lace-color-accent-alpha-subtle": "rgba(132, 204, 22, 0.08)",
105
+ "--lace-color-ink": "#3d6600",
106
+ "--lace-color-accent-alpha-subtle": "#f1fcd9",
98
107
  "--lace-color-accent-alpha-medium": "rgba(132, 204, 22, 0.16)",
99
108
  "--lace-color-accent-strong": "#2d4a00",
109
+ "--lace-color-blue-mark": "#2563eb",
110
+ "--lace-color-amber-mark": "#8a5a10",
111
+ "--lace-color-green-mark": "#047857",
100
112
  "--lace-color-success": "#047857",
101
113
  "--lace-color-success-hover": "#065f46",
102
114
  "--lace-color-danger": "#dc2626",
@@ -105,8 +117,8 @@ var lightTheme = {
105
117
  "--lace-color-warning-bg": "#fffbeb",
106
118
  "--lace-color-warning-fg": "#b45309",
107
119
  "--lace-color-info": "#2563eb",
108
- "--lace-color-focus-ring": "#4a6e12",
109
- "--lace-color-series-1": "#2c9db9",
120
+ "--lace-color-focus-ring": "#3d6600",
121
+ "--lace-color-series-1": "#268fa9",
110
122
  "--lace-color-series-2": "#5c3e9a",
111
123
  "--lace-color-series-3": "#8a5a10",
112
124
  "--lace-color-series-4": "#8a2e5c",
@@ -170,6 +182,32 @@ var textRoles = {
170
182
  "--lace-text-note": 'italic 400 14px / 20px "Instrument Serif", Georgia, "Times New Roman", serif'
171
183
  };
172
184
 
185
+ // src/theme-choice.ts
186
+ var PRODUCT_THEMES = [
187
+ "light",
188
+ "dark"
189
+ ];
190
+ var THEME_STORAGE_KEY = "lace-theme";
191
+ var SYSTEM_LIGHT_QUERY = "(prefers-color-scheme: light)";
192
+ function choiceOf(stored) {
193
+ return PRODUCT_THEMES.find((theme) => theme === stored) ?? "system";
194
+ }
195
+ function themeOf(choice, systemLight) {
196
+ if (choice !== "system") return choice;
197
+ return systemLight ? "light" : "dark";
198
+ }
199
+ var literal = JSON.stringify;
200
+ var PRE_MOUNT_THEME_SCRIPT = `(function () {
201
+ var stored = null;
202
+ var systemLight = false;
203
+ try { stored = localStorage.getItem(${literal(THEME_STORAGE_KEY)}); } catch (e) {}
204
+ try { systemLight = window.matchMedia(${literal(SYSTEM_LIGHT_QUERY)}).matches; } catch (e) {}
205
+ var theme = ${literal(PRODUCT_THEMES)}.indexOf(stored) < 0
206
+ ? (systemLight ? ${literal(themeOf("system", true))} : ${literal(themeOf("system", false))})
207
+ : stored;
208
+ document.documentElement.setAttribute("data-theme", theme);
209
+ })();`;
210
+
173
211
  // src/index.ts
174
212
  var brand = {
175
213
  green: "#CEFE65",
@@ -199,14 +237,20 @@ function themeDeclarations(theme) {
199
237
  // Annotate the CommonJS export names for ESM import in node:
200
238
  0 && (module.exports = {
201
239
  PAPERS,
240
+ PRE_MOUNT_THEME_SCRIPT,
241
+ PRODUCT_THEMES,
202
242
  PRODUCT_TYPE_SET,
243
+ SYSTEM_LIGHT_QUERY,
203
244
  THEMES,
245
+ THEME_STORAGE_KEY,
204
246
  TYPE_SETS,
205
247
  brand,
248
+ choiceOf,
206
249
  darkTheme,
207
250
  lightTheme,
208
251
  pin,
209
252
  textRoles,
210
- themeDeclarations
253
+ themeDeclarations,
254
+ themeOf
211
255
  });
212
256
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/themes.gen.ts"],"sourcesContent":["// @lace-cloud/design-tokens — JS/TS token exports\n// Primary distribution is tokens.css; use this for JS/TS consumers that\n// need programmatic access to token values (e.g., pinColor.ts).\n\nexport const brand = {\n green: '#CEFE65',\n greenBright: '#e0ff8a',\n gunmetal: '#153238',\n gunmetalLight: '#1a3f47',\n night: '#161616',\n cyan: '#95E7FF',\n grey: '#ECEFED',\n} as const;\n\nexport const pin = {\n string: { fill: '#95E7FF', stroke: '#2C9DB9' },\n number: { fill: '#F5A623', stroke: '#8A5A10' },\n bool: { fill: '#B084F0', stroke: '#5C3E9A' },\n list: { fill: '#CEFE65', stroke: '#5E8A1A' },\n map: { fill: '#F288C6', stroke: '#8A2E5C' },\n object: { fill: '#FF8A4C', stroke: '#8A3A10' },\n any: { fill: '#9BA19E', stroke: '#4A4F4C' },\n} as const;\n\n// The themes' semantic colours and the compact text roles, generated from\n// tokens.css at build (`src/themes-source.ts`): `darkTheme`, `lightTheme` and\n// `textRoles`, for a consumer that cannot load the stylesheet.\nexport { darkTheme, lightTheme, textRoles } from './themes.gen';\n\nimport type { textRoles } from './themes.gen';\n\n/** A text role tokens.css declares, by the name in its `--lace-text-<role>` custom properties. */\nexport type TextRole = keyof typeof textRoles extends infer Name\n ? Name extends `--lace-text-${infer Role}-size`\n ? Role\n : never\n : never;\n\n/** The themes tokens.css declares, read through `data-theme` on <html>: `dark` is the default,\n * the rest are `[data-theme=\"<name>\"]` blocks. A host maps its own theme names onto these. */\nexport const THEMES = ['dark', 'light', 'high-contrast', 'high-contrast-light'] as const;\n\n/** The type sets tokens.css declares, read through `data-lace-type-set` on a region's root: each\n * sizes the text roles for one kind of region. `compact` is the default (`:root`) and the\n * canvas's own root; `comfortable` is product UI, the portal's document root; `expressive` is\n * prose, the editorial and article templates' prose regions. */\nexport const TYPE_SETS = ['compact', 'comfortable', 'expressive'] as const;\n\n/** A type set, the value of a region's `data-lace-type-set`. */\nexport type TypeSet = (typeof TYPE_SETS)[number];\n\n/** The type set product UI reads: the one the portal's document root declares. */\nexport const PRODUCT_TYPE_SET = 'comfortable' satisfies TypeSet;\n\n/** The papers tokens.css declares beside the paper of now (`:root`), read through\n * `data-lace-paper` on a region's root: `blueprint` is the paper a page drawn as of an earlier\n * revision is drawn on, its ground, threads and ink in one blue in every theme. */\nexport const PAPERS = ['blueprint'] as const;\n\n/** A paper, the value of a region's `data-lace-paper`. */\nexport type Paper = (typeof PAPERS)[number];\n\n/** Custom properties (a theme's colours, the text roles) as the declarations of one CSS rule,\n * `name:value` joined by `;`, for a page that declares the tokens in a rule of its own. */\nexport function themeDeclarations(theme: Readonly<Record<string, string>>): string {\n return Object.entries(theme)\n .map(([name, value]) => `${name}:${value}`)\n .join(';');\n}\n","// Generated from tokens.css by scripts/gen-themes.mjs; `pnpm --filter @lace-cloud/design-tokens build`\n// rewrites it. Edit tokens.css, never this file.\n\n/**\n * The dark theme's semantic colours — every `--lace-color-*` of tokens.css's semantic tier, at the\n * value it resolves to in the default (dark) theme — for a consumer that cannot load tokens.css: a\n * server-rendered page declares them in its own `:root` and reads them by the names the\n * stylesheet uses.\n */\nexport const darkTheme = {\n '--lace-color-bg-canvas': '#161616',\n '--lace-color-bg-surface': '#1e1e1e',\n '--lace-color-bg-surface-alt': '#252526',\n '--lace-color-bg-input': '#0f0f0f',\n '--lace-color-bg-context-menu': '#1a1a1a',\n '--lace-color-border-default': 'rgba(255, 255, 255, 0.08)',\n '--lace-color-border-subtle': '#3c3c3c',\n '--lace-color-border-input': 'rgba(255, 255, 255, 0.15)',\n '--lace-color-border-control': '#757575',\n '--lace-color-border-input-hover': '#888888',\n '--lace-color-text-primary': '#ecefed',\n '--lace-color-text-label': '#e6e6e6',\n '--lace-color-text-muted': '#8f9691',\n '--lace-color-text-description': '#b3bab5',\n '--lace-color-text-danger': '#e5484d',\n '--lace-color-text-danger-soft': '#f87171',\n '--lace-color-row-hover': 'rgba(255, 255, 255, 0.025)',\n '--lace-color-accent': '#cefe65',\n '--lace-color-text-on-accent': '#111111',\n '--lace-color-accent-edge': '#cefe65',\n '--lace-color-ink': '#cefe65',\n '--lace-color-accent-alpha-subtle': 'rgba(206, 254, 101, 0.1)',\n '--lace-color-accent-alpha-medium': 'rgba(206, 254, 101, 0.2)',\n '--lace-color-accent-strong': '#e0ff8a',\n '--lace-color-success': '#4ade80',\n '--lace-color-success-hover': '#22c55e',\n '--lace-color-danger': '#e5484d',\n '--lace-color-danger-bg-soft': 'rgba(248, 113, 113, 0.12)',\n '--lace-color-danger-fg': '#f87171',\n '--lace-color-warning-bg': '#3b2507',\n '--lace-color-warning-fg': '#fbbf24',\n '--lace-color-info': '#9ecbff',\n '--lace-color-focus-ring': '#cefe65',\n '--lace-color-series-1': '#95e7ff',\n '--lace-color-series-2': '#b084f0',\n '--lace-color-series-3': '#f5a623',\n '--lace-color-series-4': '#f288c6',\n '--lace-color-series-5': '#ff8a4c',\n '--lace-color-series-6': '#cefe65',\n} as const;\n\n/**\n * The light theme's semantic colours — every `--lace-color-*` tokens.css's `[data-theme=\"light\"]`\n * block overrides, at the value it resolves to there — declared after `darkTheme` under the\n * page's own `[data-theme=\"light\"]`.\n */\nexport const lightTheme = {\n '--lace-color-bg-canvas': '#f6f7f5',\n '--lace-color-bg-surface': '#ffffff',\n '--lace-color-bg-surface-alt': '#f1f3f0',\n '--lace-color-bg-input': '#ffffff',\n '--lace-color-bg-context-menu': '#ffffff',\n '--lace-color-border-default': 'rgba(22, 22, 22, 0.1)',\n '--lace-color-border-subtle': '#e2e8f0',\n '--lace-color-border-input': 'rgba(22, 22, 22, 0.2)',\n '--lace-color-border-control': '#7a7a7a',\n '--lace-color-border-input-hover': '#4b5563',\n '--lace-color-text-primary': '#161616',\n '--lace-color-text-label': '#1f2937',\n '--lace-color-text-muted': '#5c635e',\n '--lace-color-text-description': '#454b47',\n '--lace-color-text-danger': '#dc2626',\n '--lace-color-text-danger-soft': '#ef4444',\n '--lace-color-row-hover': 'rgba(0, 0, 0, 0.02)',\n '--lace-color-ink': '#4a6e12',\n '--lace-color-accent-alpha-subtle': 'rgba(132, 204, 22, 0.08)',\n '--lace-color-accent-alpha-medium': 'rgba(132, 204, 22, 0.16)',\n '--lace-color-accent-strong': '#2d4a00',\n '--lace-color-success': '#047857',\n '--lace-color-success-hover': '#065f46',\n '--lace-color-danger': '#dc2626',\n '--lace-color-danger-bg-soft': '#fef2f2',\n '--lace-color-danger-fg': '#b91c1c',\n '--lace-color-warning-bg': '#fffbeb',\n '--lace-color-warning-fg': '#b45309',\n '--lace-color-info': '#2563eb',\n '--lace-color-focus-ring': '#4a6e12',\n '--lace-color-series-1': '#2c9db9',\n '--lace-color-series-2': '#5c3e9a',\n '--lace-color-series-3': '#8a5a10',\n '--lace-color-series-4': '#8a2e5c',\n '--lace-color-series-5': '#8a3a10',\n '--lace-color-series-6': '#5e8a1a',\n} as const;\n\n/**\n * The text roles in the default (compact) type set — each `--lace-text-<role>` `font` shorthand\n * and its `-size`, `-line`, `-weight`, `-family` and `-tracking`, resolved — for a consumer\n * that cannot load tokens.css: it declares them in its own `:root` and sets a run's type with\n * `font: var(--lace-text-<role>)` and `letter-spacing: var(--lace-text-<role>-tracking)`.\n */\nexport const textRoles = {\n '--lace-text-display-size': '22px',\n '--lace-text-display-line': '28px',\n '--lace-text-title-size': '16px',\n '--lace-text-title-line': '22px',\n '--lace-text-heading-size': '14px',\n '--lace-text-heading-line': '20px',\n '--lace-text-body-size': '13px',\n '--lace-text-body-line': '18px',\n '--lace-text-control-size': '12px',\n '--lace-text-control-line': '16px',\n '--lace-text-caption-size': '11px',\n '--lace-text-caption-line': '14px',\n '--lace-text-label-size': '10px',\n '--lace-text-label-line': '14px',\n '--lace-text-code-size': '12px',\n '--lace-text-code-line': '16px',\n '--lace-text-note-size': '14px',\n '--lace-text-note-line': '20px',\n '--lace-text-display-weight': '600',\n '--lace-text-display-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-display-tracking': '-0.01em',\n '--lace-text-title-weight': '600',\n '--lace-text-title-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-title-tracking': '0',\n '--lace-text-heading-weight': '600',\n '--lace-text-heading-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-heading-tracking': '0',\n '--lace-text-body-weight': '400',\n '--lace-text-body-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-body-tracking': '0',\n '--lace-text-control-weight': '500',\n '--lace-text-control-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-control-tracking': '0',\n '--lace-text-caption-weight': '400',\n '--lace-text-caption-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-caption-tracking': '0',\n '--lace-text-label-weight': '500',\n '--lace-text-label-family': '\"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", monospace',\n '--lace-text-label-tracking': '0.06em',\n '--lace-text-code-weight': '400',\n '--lace-text-code-family': '\"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", monospace',\n '--lace-text-code-tracking': '0',\n '--lace-text-note-weight': '400',\n '--lace-text-note-family': '\"Instrument Serif\", Georgia, \"Times New Roman\", serif',\n '--lace-text-note-tracking': '0',\n '--lace-text-display': '600 22px / 28px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-title': '600 16px / 22px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-heading': '600 14px / 20px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-body': '400 13px / 18px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-control': '500 12px / 16px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-caption': '400 11px / 14px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-label': '500 10px / 14px \"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", monospace',\n '--lace-text-code': '400 12px / 16px \"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", monospace',\n '--lace-text-note': 'italic 400 14px / 20px \"Instrument Serif\", Georgia, \"Times New Roman\", serif',\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,IAAM,YAAY;AAAA,EACvB,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B,+BAA+B;AAAA,EAC/B,yBAAyB;AAAA,EACzB,gCAAgC;AAAA,EAChC,+BAA+B;AAAA,EAC/B,8BAA8B;AAAA,EAC9B,6BAA6B;AAAA,EAC7B,+BAA+B;AAAA,EAC/B,mCAAmC;AAAA,EACnC,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,2BAA2B;AAAA,EAC3B,iCAAiC;AAAA,EACjC,4BAA4B;AAAA,EAC5B,iCAAiC;AAAA,EACjC,0BAA0B;AAAA,EAC1B,uBAAuB;AAAA,EACvB,+BAA+B;AAAA,EAC/B,4BAA4B;AAAA,EAC5B,oBAAoB;AAAA,EACpB,oCAAoC;AAAA,EACpC,oCAAoC;AAAA,EACpC,8BAA8B;AAAA,EAC9B,wBAAwB;AAAA,EACxB,8BAA8B;AAAA,EAC9B,uBAAuB;AAAA,EACvB,+BAA+B;AAAA,EAC/B,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B,2BAA2B;AAAA,EAC3B,qBAAqB;AAAA,EACrB,2BAA2B;AAAA,EAC3B,yBAAyB;AAAA,EACzB,yBAAyB;AAAA,EACzB,yBAAyB;AAAA,EACzB,yBAAyB;AAAA,EACzB,yBAAyB;AAAA,EACzB,yBAAyB;AAC3B;AAOO,IAAM,aAAa;AAAA,EACxB,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B,+BAA+B;AAAA,EAC/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,CAAC,WAAW,eAAe,YAAY;AAMzD,IAAM,mBAAmB;AAKzB,IAAM,SAAS,CAAC,WAAW;AAO3B,SAAS,kBAAkB,OAAiD;AACjF,SAAO,OAAO,QAAQ,KAAK,EACxB,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,GAAG,IAAI,IAAI,KAAK,EAAE,EACzC,KAAK,GAAG;AACb;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/themes.gen.ts","../src/theme-choice.ts"],"sourcesContent":["// @lace-cloud/design-tokens — JS/TS token exports\n// Primary distribution is tokens.css; use this for JS/TS consumers that\n// need programmatic access to token values (e.g., pinColor.ts).\n\nexport const brand = {\n green: '#CEFE65',\n greenBright: '#e0ff8a',\n gunmetal: '#153238',\n gunmetalLight: '#1a3f47',\n night: '#161616',\n cyan: '#95E7FF',\n grey: '#ECEFED',\n} as const;\n\nexport const pin = {\n string: { fill: '#95E7FF', stroke: '#2C9DB9' },\n number: { fill: '#F5A623', stroke: '#8A5A10' },\n bool: { fill: '#B084F0', stroke: '#5C3E9A' },\n list: { fill: '#CEFE65', stroke: '#5E8A1A' },\n map: { fill: '#F288C6', stroke: '#8A2E5C' },\n object: { fill: '#FF8A4C', stroke: '#8A3A10' },\n any: { fill: '#9BA19E', stroke: '#4A4F4C' },\n} as const;\n\n// The themes' semantic colours and the compact text roles, generated from\n// tokens.css at build (`src/themes-source.ts`): `darkTheme`, `lightTheme` and\n// `textRoles`, for a consumer that cannot load the stylesheet.\nexport { darkTheme, lightTheme, textRoles } from './themes.gen';\n\nimport type { textRoles } from './themes.gen';\n\n/** A text role tokens.css declares, by the name in its `--lace-text-<role>` custom properties. */\nexport type TextRole = keyof typeof textRoles extends infer Name\n ? Name extends `--lace-text-${infer Role}-size`\n ? Role\n : never\n : never;\n\n/** The themes tokens.css declares, read through `data-theme` on <html>: `dark` is the default,\n * the rest are `[data-theme=\"<name>\"]` blocks. A host maps its own theme names onto these. */\nexport const THEMES = ['dark', 'light', 'high-contrast', 'high-contrast-light'] as const;\n\n// The themes product UI offers (`PRODUCT_THEMES`) and the rule that picks one from the reader's\n// choice and the device's setting.\nexport * from './theme-choice';\n\n/** The type sets tokens.css declares, read through `data-lace-type-set` on a region's root: each\n * sizes the text roles for one kind of region. `compact` is the default (`:root`) and the\n * canvas's own root; `comfortable` is product UI, the portal's document root; `expressive` is\n * prose, the editorial and article templates' prose regions. */\nexport const TYPE_SETS = ['compact', 'comfortable', 'expressive'] as const;\n\n/** A type set, the value of a region's `data-lace-type-set`. */\nexport type TypeSet = (typeof TYPE_SETS)[number];\n\n/** The type set product UI reads: the one the portal's document root declares. */\nexport const PRODUCT_TYPE_SET = 'comfortable' satisfies TypeSet;\n\n/** The papers tokens.css declares beside the paper of now (`:root`), read through\n * `data-lace-paper` on a region's root: `blueprint` is the paper a page drawn as of an earlier\n * revision is drawn on, its ground, threads and ink in one blue in every theme. */\nexport const PAPERS = ['blueprint'] as const;\n\n/** A paper, the value of a region's `data-lace-paper`. */\nexport type Paper = (typeof PAPERS)[number];\n\n/** Custom properties (a theme's colours, the text roles) as the declarations of one CSS rule,\n * `name:value` joined by `;`, for a page that declares the tokens in a rule of its own. */\nexport function themeDeclarations(theme: Readonly<Record<string, string>>): string {\n return Object.entries(theme)\n .map(([name, value]) => `${name}:${value}`)\n .join(';');\n}\n","// Generated from tokens.css by scripts/gen-themes.mjs; `pnpm --filter @lace-cloud/design-tokens build`\n// rewrites it. Edit tokens.css, never this file.\n\n/**\n * The dark theme's semantic colours — every `--lace-color-*` of tokens.css's semantic tier, at the\n * value it resolves to in the default (dark) theme — for a consumer that cannot load tokens.css: a\n * server-rendered page declares them in its own `:root` and reads them by the names the\n * stylesheet uses.\n */\nexport const darkTheme = {\n '--lace-color-bg-canvas': '#161616',\n '--lace-color-bg-surface': '#1e1e1e',\n '--lace-color-bg-surface-alt': '#252526',\n '--lace-color-bg-input': '#0f0f0f',\n '--lace-color-bg-context-menu': '#1a1a1a',\n '--lace-color-border-default': 'rgba(255, 255, 255, 0.08)',\n '--lace-color-border-subtle': '#3c3c3c',\n '--lace-color-border-input': 'rgba(255, 255, 255, 0.15)',\n '--lace-color-border-control': '#757575',\n '--lace-color-border-input-hover': '#888888',\n '--lace-color-text-primary': '#ecefed',\n '--lace-color-text-label': '#e6e6e6',\n '--lace-color-text-muted': '#8f9691',\n '--lace-color-text-description': '#b3bab5',\n '--lace-color-text-danger': '#e5484d',\n '--lace-color-text-danger-soft': '#f87171',\n '--lace-color-row-hover': 'rgba(255, 255, 255, 0.025)',\n '--lace-color-accent': '#cefe65',\n '--lace-color-text-on-accent': '#111111',\n '--lace-color-accent-edge': '#cefe65',\n '--lace-color-ink': '#cefe65',\n '--lace-color-accent-alpha-subtle': 'rgba(206, 254, 101, 0.1)',\n '--lace-color-accent-alpha-medium': 'rgba(206, 254, 101, 0.2)',\n '--lace-color-accent-strong': '#e0ff8a',\n '--lace-color-blue-mark': '#60a5fa',\n '--lace-color-amber-mark': '#f5a623',\n '--lace-color-green-mark': '#4ade80',\n '--lace-color-success': '#4ade80',\n '--lace-color-success-hover': '#22c55e',\n '--lace-color-danger': '#e5484d',\n '--lace-color-danger-bg-soft': 'rgba(248, 113, 113, 0.12)',\n '--lace-color-danger-fg': '#f87171',\n '--lace-color-warning-bg': '#3b2507',\n '--lace-color-warning-fg': '#fbbf24',\n '--lace-color-info': '#9ecbff',\n '--lace-color-focus-ring': '#cefe65',\n '--lace-color-series-1': '#95e7ff',\n '--lace-color-series-2': '#b084f0',\n '--lace-color-series-3': '#f5a623',\n '--lace-color-series-4': '#f288c6',\n '--lace-color-series-5': '#ff8a4c',\n '--lace-color-series-6': '#cefe65',\n} as const;\n\n/**\n * The light theme's semantic colours — every `--lace-color-*` tokens.css's `[data-theme=\"light\"]`\n * block overrides, at the value it resolves to there — declared after `darkTheme` under the\n * page's own `[data-theme=\"light\"]`.\n */\nexport const lightTheme = {\n '--lace-color-bg-canvas': '#ffffff',\n '--lace-color-bg-surface': '#ffffff',\n '--lace-color-bg-surface-alt': '#f4f5f2',\n '--lace-color-bg-input': '#ffffff',\n '--lace-color-bg-context-menu': '#ffffff',\n '--lace-color-border-default': '#eef0f3',\n '--lace-color-border-subtle': '#dfe3ea',\n '--lace-color-border-input': 'rgba(22, 22, 22, 0.2)',\n '--lace-color-border-control': '#7a7a7a',\n '--lace-color-border-input-hover': '#4b5563',\n '--lace-color-text-primary': '#0f172a',\n '--lace-color-text-label': '#1f2937',\n '--lace-color-text-muted': '#606f85',\n '--lace-color-text-description': '#475569',\n '--lace-color-text-danger': '#dc2626',\n '--lace-color-text-danger-soft': '#ef4444',\n '--lace-color-row-hover': 'rgba(0, 0, 0, 0.02)',\n '--lace-color-ink': '#3d6600',\n '--lace-color-accent-alpha-subtle': '#f1fcd9',\n '--lace-color-accent-alpha-medium': 'rgba(132, 204, 22, 0.16)',\n '--lace-color-accent-strong': '#2d4a00',\n '--lace-color-blue-mark': '#2563eb',\n '--lace-color-amber-mark': '#8a5a10',\n '--lace-color-green-mark': '#047857',\n '--lace-color-success': '#047857',\n '--lace-color-success-hover': '#065f46',\n '--lace-color-danger': '#dc2626',\n '--lace-color-danger-bg-soft': '#fef2f2',\n '--lace-color-danger-fg': '#b91c1c',\n '--lace-color-warning-bg': '#fffbeb',\n '--lace-color-warning-fg': '#b45309',\n '--lace-color-info': '#2563eb',\n '--lace-color-focus-ring': '#3d6600',\n '--lace-color-series-1': '#268fa9',\n '--lace-color-series-2': '#5c3e9a',\n '--lace-color-series-3': '#8a5a10',\n '--lace-color-series-4': '#8a2e5c',\n '--lace-color-series-5': '#8a3a10',\n '--lace-color-series-6': '#5e8a1a',\n} as const;\n\n/**\n * The text roles in the default (compact) type set — each `--lace-text-<role>` `font` shorthand\n * and its `-size`, `-line`, `-weight`, `-family` and `-tracking`, resolved — for a consumer\n * that cannot load tokens.css: it declares them in its own `:root` and sets a run's type with\n * `font: var(--lace-text-<role>)` and `letter-spacing: var(--lace-text-<role>-tracking)`.\n */\nexport const textRoles = {\n '--lace-text-display-size': '22px',\n '--lace-text-display-line': '28px',\n '--lace-text-title-size': '16px',\n '--lace-text-title-line': '22px',\n '--lace-text-heading-size': '14px',\n '--lace-text-heading-line': '20px',\n '--lace-text-body-size': '13px',\n '--lace-text-body-line': '18px',\n '--lace-text-control-size': '12px',\n '--lace-text-control-line': '16px',\n '--lace-text-caption-size': '11px',\n '--lace-text-caption-line': '14px',\n '--lace-text-label-size': '10px',\n '--lace-text-label-line': '14px',\n '--lace-text-code-size': '12px',\n '--lace-text-code-line': '16px',\n '--lace-text-note-size': '14px',\n '--lace-text-note-line': '20px',\n '--lace-text-display-weight': '600',\n '--lace-text-display-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-display-tracking': '-0.01em',\n '--lace-text-title-weight': '600',\n '--lace-text-title-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-title-tracking': '0',\n '--lace-text-heading-weight': '600',\n '--lace-text-heading-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-heading-tracking': '0',\n '--lace-text-body-weight': '400',\n '--lace-text-body-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-body-tracking': '0',\n '--lace-text-control-weight': '500',\n '--lace-text-control-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-control-tracking': '0',\n '--lace-text-caption-weight': '400',\n '--lace-text-caption-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-caption-tracking': '0',\n '--lace-text-label-weight': '500',\n '--lace-text-label-family': '\"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", monospace',\n '--lace-text-label-tracking': '0.06em',\n '--lace-text-code-weight': '400',\n '--lace-text-code-family': '\"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", monospace',\n '--lace-text-code-tracking': '0',\n '--lace-text-note-weight': '400',\n '--lace-text-note-family': '\"Instrument Serif\", Georgia, \"Times New Roman\", serif',\n '--lace-text-note-tracking': '0',\n '--lace-text-display': '600 22px / 28px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-title': '600 16px / 22px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-heading': '600 14px / 20px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-body': '400 13px / 18px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-control': '500 12px / 16px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-caption': '400 11px / 14px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-label': '500 10px / 14px \"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", monospace',\n '--lace-text-code': '400 12px / 16px \"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", monospace',\n '--lace-text-note': 'italic 400 14px / 20px \"Instrument Serif\", Georgia, \"Times New Roman\", serif',\n} as const;\n","// The theme rule: which product theme a page draws, from the reader's stored choice and the\n// device's setting. Pure, with no DOM access at import: a build config and the API Worker import\n// it as well as the pages that apply it.\n\nimport type { THEMES } from './index';\n\n/** The themes product UI offers its reader, in the order its switch lists them; a host with\n * high-contrast themes of its own maps onto the rest. */\nexport const PRODUCT_THEMES = [\n 'light',\n 'dark',\n] as const satisfies readonly (typeof THEMES)[number][];\n\n/** A product theme, the value of `<html data-theme>` on a page that follows the rule. */\nexport type ProductTheme = (typeof PRODUCT_THEMES)[number];\n\n/** What a reader chose: `system` follows the device; a product theme is stored and wins over it. */\nexport type ThemeChoice = 'system' | ProductTheme;\n\n/** The theme choice a reader's switch stores in their browser, `light` or `dark`; absent, the\n * page follows the system. */\nexport const THEME_STORAGE_KEY = 'lace-theme';\n\n/** The media query that matches while the device asks for light. */\nexport const SYSTEM_LIGHT_QUERY = '(prefers-color-scheme: light)';\n\n/** The choice a stored value holds: a product theme is itself; anything else, absence included,\n * is `system`. */\nexport function choiceOf(stored: string | null): ThemeChoice {\n return PRODUCT_THEMES.find((theme) => theme === stored) ?? 'system';\n}\n\n/** The theme a page draws: a chosen product theme wins; `system` draws light while the device\n * asks for light, and dark otherwise. */\nexport function themeOf(choice: ThemeChoice, systemLight: boolean): ProductTheme {\n if (choice !== 'system') return choice;\n return systemLight ? 'light' : 'dark';\n}\n\nconst literal = JSON.stringify;\n\n/** The script a page's `<head>` runs before anything paints: it sets `<html data-theme>` to\n * `themeOf(choiceOf(stored), systemLight)`, its every value written from the rule above. It is\n * ES5 and self-contained, and it never throws: storage that refuses reads as no choice, and a\n * window without `matchMedia` as a device that does not ask for light. Its text is fixed at\n * load, so a CSP admits it by its hash. */\nexport const PRE_MOUNT_THEME_SCRIPT = `(function () {\n var stored = null;\n var systemLight = false;\n try { stored = localStorage.getItem(${literal(THEME_STORAGE_KEY)}); } catch (e) {}\n try { systemLight = window.matchMedia(${literal(SYSTEM_LIGHT_QUERY)}).matches; } catch (e) {}\n var theme = ${literal(PRODUCT_THEMES)}.indexOf(stored) < 0\n ? (systemLight ? ${literal(themeOf('system', true))} : ${literal(themeOf('system', false))})\n : stored;\n document.documentElement.setAttribute(\"data-theme\", theme);\n})();`;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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Q,UAAU;AAAA,EAC7C,QAAQ,EAAE,MAAM,WAAW,QAAQ,UAAU;AAAA,EAC7C,MAAM,EAAE,MAAM,WAAW,QAAQ,UAAU;AAAA,EAC3C,MAAM,EAAE,MAAM,WAAW,QAAQ,UAAU;AAAA,EAC3C,KAAK,EAAE,MAAM,WAAW,QAAQ,UAAU;AAAA,EAC1C,QAAQ,EAAE,MAAM,WAAW,QAAQ,UAAU;AAAA,EAC7C,KAAK,EAAE,MAAM,WAAW,QAAQ,UAAU;AAC5C;AAkBO,IAAM,SAAS,CAAC,QAAQ,SAAS,iBAAiB,qBAAqB;AAUvE,IAAM,YAAY,CAAC,WAAW,eAAe,YAAY;AAMzD,IAAM,mBAAmB;AAKzB,IAAM,SAAS,CAAC,WAAW;AAO3B,SAAS,kBAAkB,OAAiD;AACjF,SAAO,OAAO,QAAQ,KAAK,EACxB,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,GAAG,IAAI,IAAI,KAAK,EAAE,EACzC,KAAK,GAAG;AACb;","names":[]}
package/dist/index.d.cts CHANGED
@@ -29,6 +29,9 @@ declare const darkTheme: {
29
29
  readonly '--lace-color-accent-alpha-subtle': "rgba(206, 254, 101, 0.1)";
30
30
  readonly '--lace-color-accent-alpha-medium': "rgba(206, 254, 101, 0.2)";
31
31
  readonly '--lace-color-accent-strong': "#e0ff8a";
32
+ readonly '--lace-color-blue-mark': "#60a5fa";
33
+ readonly '--lace-color-amber-mark': "#f5a623";
34
+ readonly '--lace-color-green-mark': "#4ade80";
32
35
  readonly '--lace-color-success': "#4ade80";
33
36
  readonly '--lace-color-success-hover': "#22c55e";
34
37
  readonly '--lace-color-danger': "#e5484d";
@@ -51,27 +54,30 @@ declare const darkTheme: {
51
54
  * page's own `[data-theme="light"]`.
52
55
  */
53
56
  declare const lightTheme: {
54
- readonly '--lace-color-bg-canvas': "#f6f7f5";
57
+ readonly '--lace-color-bg-canvas': "#ffffff";
55
58
  readonly '--lace-color-bg-surface': "#ffffff";
56
- readonly '--lace-color-bg-surface-alt': "#f1f3f0";
59
+ readonly '--lace-color-bg-surface-alt': "#f4f5f2";
57
60
  readonly '--lace-color-bg-input': "#ffffff";
58
61
  readonly '--lace-color-bg-context-menu': "#ffffff";
59
- readonly '--lace-color-border-default': "rgba(22, 22, 22, 0.1)";
60
- readonly '--lace-color-border-subtle': "#e2e8f0";
62
+ readonly '--lace-color-border-default': "#eef0f3";
63
+ readonly '--lace-color-border-subtle': "#dfe3ea";
61
64
  readonly '--lace-color-border-input': "rgba(22, 22, 22, 0.2)";
62
65
  readonly '--lace-color-border-control': "#7a7a7a";
63
66
  readonly '--lace-color-border-input-hover': "#4b5563";
64
- readonly '--lace-color-text-primary': "#161616";
67
+ readonly '--lace-color-text-primary': "#0f172a";
65
68
  readonly '--lace-color-text-label': "#1f2937";
66
- readonly '--lace-color-text-muted': "#5c635e";
67
- readonly '--lace-color-text-description': "#454b47";
69
+ readonly '--lace-color-text-muted': "#606f85";
70
+ readonly '--lace-color-text-description': "#475569";
68
71
  readonly '--lace-color-text-danger': "#dc2626";
69
72
  readonly '--lace-color-text-danger-soft': "#ef4444";
70
73
  readonly '--lace-color-row-hover': "rgba(0, 0, 0, 0.02)";
71
- readonly '--lace-color-ink': "#4a6e12";
72
- readonly '--lace-color-accent-alpha-subtle': "rgba(132, 204, 22, 0.08)";
74
+ readonly '--lace-color-ink': "#3d6600";
75
+ readonly '--lace-color-accent-alpha-subtle': "#f1fcd9";
73
76
  readonly '--lace-color-accent-alpha-medium': "rgba(132, 204, 22, 0.16)";
74
77
  readonly '--lace-color-accent-strong': "#2d4a00";
78
+ readonly '--lace-color-blue-mark': "#2563eb";
79
+ readonly '--lace-color-amber-mark': "#8a5a10";
80
+ readonly '--lace-color-green-mark': "#047857";
75
81
  readonly '--lace-color-success': "#047857";
76
82
  readonly '--lace-color-success-hover': "#065f46";
77
83
  readonly '--lace-color-danger': "#dc2626";
@@ -80,8 +86,8 @@ declare const lightTheme: {
80
86
  readonly '--lace-color-warning-bg': "#fffbeb";
81
87
  readonly '--lace-color-warning-fg': "#b45309";
82
88
  readonly '--lace-color-info': "#2563eb";
83
- readonly '--lace-color-focus-ring': "#4a6e12";
84
- readonly '--lace-color-series-1': "#2c9db9";
89
+ readonly '--lace-color-focus-ring': "#3d6600";
90
+ readonly '--lace-color-series-1': "#268fa9";
85
91
  readonly '--lace-color-series-2': "#5c3e9a";
86
92
  readonly '--lace-color-series-3': "#8a5a10";
87
93
  readonly '--lace-color-series-4': "#8a2e5c";
@@ -151,6 +157,31 @@ declare const textRoles: {
151
157
  readonly '--lace-text-note': "italic 400 14px / 20px \"Instrument Serif\", Georgia, \"Times New Roman\", serif";
152
158
  };
153
159
 
160
+ /** The themes product UI offers its reader, in the order its switch lists them; a host with
161
+ * high-contrast themes of its own maps onto the rest. */
162
+ declare const PRODUCT_THEMES: readonly ["light", "dark"];
163
+ /** A product theme, the value of `<html data-theme>` on a page that follows the rule. */
164
+ type ProductTheme = (typeof PRODUCT_THEMES)[number];
165
+ /** What a reader chose: `system` follows the device; a product theme is stored and wins over it. */
166
+ type ThemeChoice = 'system' | ProductTheme;
167
+ /** The theme choice a reader's switch stores in their browser, `light` or `dark`; absent, the
168
+ * page follows the system. */
169
+ declare const THEME_STORAGE_KEY = "lace-theme";
170
+ /** The media query that matches while the device asks for light. */
171
+ declare const SYSTEM_LIGHT_QUERY = "(prefers-color-scheme: light)";
172
+ /** The choice a stored value holds: a product theme is itself; anything else, absence included,
173
+ * is `system`. */
174
+ declare function choiceOf(stored: string | null): ThemeChoice;
175
+ /** The theme a page draws: a chosen product theme wins; `system` draws light while the device
176
+ * asks for light, and dark otherwise. */
177
+ declare function themeOf(choice: ThemeChoice, systemLight: boolean): ProductTheme;
178
+ /** The script a page's `<head>` runs before anything paints: it sets `<html data-theme>` to
179
+ * `themeOf(choiceOf(stored), systemLight)`, its every value written from the rule above. It is
180
+ * ES5 and self-contained, and it never throws: storage that refuses reads as no choice, and a
181
+ * window without `matchMedia` as a device that does not ask for light. Its text is fixed at
182
+ * load, so a CSP admits it by its hash. */
183
+ declare const PRE_MOUNT_THEME_SCRIPT: string;
184
+
154
185
  declare const brand: {
155
186
  readonly green: "#CEFE65";
156
187
  readonly greenBright: "#e0ff8a";
@@ -196,6 +227,7 @@ type TextRole = keyof typeof textRoles extends infer Name ? Name extends `--lace
196
227
  /** The themes tokens.css declares, read through `data-theme` on <html>: `dark` is the default,
197
228
  * the rest are `[data-theme="<name>"]` blocks. A host maps its own theme names onto these. */
198
229
  declare const THEMES: readonly ["dark", "light", "high-contrast", "high-contrast-light"];
230
+
199
231
  /** The type sets tokens.css declares, read through `data-lace-type-set` on a region's root: each
200
232
  * sizes the text roles for one kind of region. `compact` is the default (`:root`) and the
201
233
  * canvas's own root; `comfortable` is product UI, the portal's document root; `expressive` is
@@ -215,5 +247,5 @@ type Paper = (typeof PAPERS)[number];
215
247
  * `name:value` joined by `;`, for a page that declares the tokens in a rule of its own. */
216
248
  declare function themeDeclarations(theme: Readonly<Record<string, string>>): string;
217
249
 
218
- export { PAPERS, PRODUCT_TYPE_SET, THEMES, TYPE_SETS, brand, darkTheme, lightTheme, pin, textRoles, themeDeclarations };
219
- export type { Paper, TextRole, TypeSet };
250
+ export { PAPERS, PRE_MOUNT_THEME_SCRIPT, PRODUCT_THEMES, PRODUCT_TYPE_SET, SYSTEM_LIGHT_QUERY, THEMES, THEME_STORAGE_KEY, TYPE_SETS, brand, choiceOf, darkTheme, lightTheme, pin, textRoles, themeDeclarations, themeOf };
251
+ export type { Paper, ProductTheme, TextRole, ThemeChoice, TypeSet };
package/dist/index.d.ts CHANGED
@@ -29,6 +29,9 @@ declare const darkTheme: {
29
29
  readonly '--lace-color-accent-alpha-subtle': "rgba(206, 254, 101, 0.1)";
30
30
  readonly '--lace-color-accent-alpha-medium': "rgba(206, 254, 101, 0.2)";
31
31
  readonly '--lace-color-accent-strong': "#e0ff8a";
32
+ readonly '--lace-color-blue-mark': "#60a5fa";
33
+ readonly '--lace-color-amber-mark': "#f5a623";
34
+ readonly '--lace-color-green-mark': "#4ade80";
32
35
  readonly '--lace-color-success': "#4ade80";
33
36
  readonly '--lace-color-success-hover': "#22c55e";
34
37
  readonly '--lace-color-danger': "#e5484d";
@@ -51,27 +54,30 @@ declare const darkTheme: {
51
54
  * page's own `[data-theme="light"]`.
52
55
  */
53
56
  declare const lightTheme: {
54
- readonly '--lace-color-bg-canvas': "#f6f7f5";
57
+ readonly '--lace-color-bg-canvas': "#ffffff";
55
58
  readonly '--lace-color-bg-surface': "#ffffff";
56
- readonly '--lace-color-bg-surface-alt': "#f1f3f0";
59
+ readonly '--lace-color-bg-surface-alt': "#f4f5f2";
57
60
  readonly '--lace-color-bg-input': "#ffffff";
58
61
  readonly '--lace-color-bg-context-menu': "#ffffff";
59
- readonly '--lace-color-border-default': "rgba(22, 22, 22, 0.1)";
60
- readonly '--lace-color-border-subtle': "#e2e8f0";
62
+ readonly '--lace-color-border-default': "#eef0f3";
63
+ readonly '--lace-color-border-subtle': "#dfe3ea";
61
64
  readonly '--lace-color-border-input': "rgba(22, 22, 22, 0.2)";
62
65
  readonly '--lace-color-border-control': "#7a7a7a";
63
66
  readonly '--lace-color-border-input-hover': "#4b5563";
64
- readonly '--lace-color-text-primary': "#161616";
67
+ readonly '--lace-color-text-primary': "#0f172a";
65
68
  readonly '--lace-color-text-label': "#1f2937";
66
- readonly '--lace-color-text-muted': "#5c635e";
67
- readonly '--lace-color-text-description': "#454b47";
69
+ readonly '--lace-color-text-muted': "#606f85";
70
+ readonly '--lace-color-text-description': "#475569";
68
71
  readonly '--lace-color-text-danger': "#dc2626";
69
72
  readonly '--lace-color-text-danger-soft': "#ef4444";
70
73
  readonly '--lace-color-row-hover': "rgba(0, 0, 0, 0.02)";
71
- readonly '--lace-color-ink': "#4a6e12";
72
- readonly '--lace-color-accent-alpha-subtle': "rgba(132, 204, 22, 0.08)";
74
+ readonly '--lace-color-ink': "#3d6600";
75
+ readonly '--lace-color-accent-alpha-subtle': "#f1fcd9";
73
76
  readonly '--lace-color-accent-alpha-medium': "rgba(132, 204, 22, 0.16)";
74
77
  readonly '--lace-color-accent-strong': "#2d4a00";
78
+ readonly '--lace-color-blue-mark': "#2563eb";
79
+ readonly '--lace-color-amber-mark': "#8a5a10";
80
+ readonly '--lace-color-green-mark': "#047857";
75
81
  readonly '--lace-color-success': "#047857";
76
82
  readonly '--lace-color-success-hover': "#065f46";
77
83
  readonly '--lace-color-danger': "#dc2626";
@@ -80,8 +86,8 @@ declare const lightTheme: {
80
86
  readonly '--lace-color-warning-bg': "#fffbeb";
81
87
  readonly '--lace-color-warning-fg': "#b45309";
82
88
  readonly '--lace-color-info': "#2563eb";
83
- readonly '--lace-color-focus-ring': "#4a6e12";
84
- readonly '--lace-color-series-1': "#2c9db9";
89
+ readonly '--lace-color-focus-ring': "#3d6600";
90
+ readonly '--lace-color-series-1': "#268fa9";
85
91
  readonly '--lace-color-series-2': "#5c3e9a";
86
92
  readonly '--lace-color-series-3': "#8a5a10";
87
93
  readonly '--lace-color-series-4': "#8a2e5c";
@@ -151,6 +157,31 @@ declare const textRoles: {
151
157
  readonly '--lace-text-note': "italic 400 14px / 20px \"Instrument Serif\", Georgia, \"Times New Roman\", serif";
152
158
  };
153
159
 
160
+ /** The themes product UI offers its reader, in the order its switch lists them; a host with
161
+ * high-contrast themes of its own maps onto the rest. */
162
+ declare const PRODUCT_THEMES: readonly ["light", "dark"];
163
+ /** A product theme, the value of `<html data-theme>` on a page that follows the rule. */
164
+ type ProductTheme = (typeof PRODUCT_THEMES)[number];
165
+ /** What a reader chose: `system` follows the device; a product theme is stored and wins over it. */
166
+ type ThemeChoice = 'system' | ProductTheme;
167
+ /** The theme choice a reader's switch stores in their browser, `light` or `dark`; absent, the
168
+ * page follows the system. */
169
+ declare const THEME_STORAGE_KEY = "lace-theme";
170
+ /** The media query that matches while the device asks for light. */
171
+ declare const SYSTEM_LIGHT_QUERY = "(prefers-color-scheme: light)";
172
+ /** The choice a stored value holds: a product theme is itself; anything else, absence included,
173
+ * is `system`. */
174
+ declare function choiceOf(stored: string | null): ThemeChoice;
175
+ /** The theme a page draws: a chosen product theme wins; `system` draws light while the device
176
+ * asks for light, and dark otherwise. */
177
+ declare function themeOf(choice: ThemeChoice, systemLight: boolean): ProductTheme;
178
+ /** The script a page's `<head>` runs before anything paints: it sets `<html data-theme>` to
179
+ * `themeOf(choiceOf(stored), systemLight)`, its every value written from the rule above. It is
180
+ * ES5 and self-contained, and it never throws: storage that refuses reads as no choice, and a
181
+ * window without `matchMedia` as a device that does not ask for light. Its text is fixed at
182
+ * load, so a CSP admits it by its hash. */
183
+ declare const PRE_MOUNT_THEME_SCRIPT: string;
184
+
154
185
  declare const brand: {
155
186
  readonly green: "#CEFE65";
156
187
  readonly greenBright: "#e0ff8a";
@@ -196,6 +227,7 @@ type TextRole = keyof typeof textRoles extends infer Name ? Name extends `--lace
196
227
  /** The themes tokens.css declares, read through `data-theme` on <html>: `dark` is the default,
197
228
  * the rest are `[data-theme="<name>"]` blocks. A host maps its own theme names onto these. */
198
229
  declare const THEMES: readonly ["dark", "light", "high-contrast", "high-contrast-light"];
230
+
199
231
  /** The type sets tokens.css declares, read through `data-lace-type-set` on a region's root: each
200
232
  * sizes the text roles for one kind of region. `compact` is the default (`:root`) and the
201
233
  * canvas's own root; `comfortable` is product UI, the portal's document root; `expressive` is
@@ -215,5 +247,5 @@ type Paper = (typeof PAPERS)[number];
215
247
  * `name:value` joined by `;`, for a page that declares the tokens in a rule of its own. */
216
248
  declare function themeDeclarations(theme: Readonly<Record<string, string>>): string;
217
249
 
218
- export { PAPERS, PRODUCT_TYPE_SET, THEMES, TYPE_SETS, brand, darkTheme, lightTheme, pin, textRoles, themeDeclarations };
219
- export type { Paper, TextRole, TypeSet };
250
+ export { PAPERS, PRE_MOUNT_THEME_SCRIPT, PRODUCT_THEMES, PRODUCT_TYPE_SET, SYSTEM_LIGHT_QUERY, THEMES, THEME_STORAGE_KEY, TYPE_SETS, brand, choiceOf, darkTheme, lightTheme, pin, textRoles, themeDeclarations, themeOf };
251
+ export type { Paper, ProductTheme, TextRole, ThemeChoice, TypeSet };
package/dist/index.mjs CHANGED
@@ -24,6 +24,9 @@ var darkTheme = {
24
24
  "--lace-color-accent-alpha-subtle": "rgba(206, 254, 101, 0.1)",
25
25
  "--lace-color-accent-alpha-medium": "rgba(206, 254, 101, 0.2)",
26
26
  "--lace-color-accent-strong": "#e0ff8a",
27
+ "--lace-color-blue-mark": "#60a5fa",
28
+ "--lace-color-amber-mark": "#f5a623",
29
+ "--lace-color-green-mark": "#4ade80",
27
30
  "--lace-color-success": "#4ade80",
28
31
  "--lace-color-success-hover": "#22c55e",
29
32
  "--lace-color-danger": "#e5484d",
@@ -41,27 +44,30 @@ var darkTheme = {
41
44
  "--lace-color-series-6": "#cefe65"
42
45
  };
43
46
  var lightTheme = {
44
- "--lace-color-bg-canvas": "#f6f7f5",
47
+ "--lace-color-bg-canvas": "#ffffff",
45
48
  "--lace-color-bg-surface": "#ffffff",
46
- "--lace-color-bg-surface-alt": "#f1f3f0",
49
+ "--lace-color-bg-surface-alt": "#f4f5f2",
47
50
  "--lace-color-bg-input": "#ffffff",
48
51
  "--lace-color-bg-context-menu": "#ffffff",
49
- "--lace-color-border-default": "rgba(22, 22, 22, 0.1)",
50
- "--lace-color-border-subtle": "#e2e8f0",
52
+ "--lace-color-border-default": "#eef0f3",
53
+ "--lace-color-border-subtle": "#dfe3ea",
51
54
  "--lace-color-border-input": "rgba(22, 22, 22, 0.2)",
52
55
  "--lace-color-border-control": "#7a7a7a",
53
56
  "--lace-color-border-input-hover": "#4b5563",
54
- "--lace-color-text-primary": "#161616",
57
+ "--lace-color-text-primary": "#0f172a",
55
58
  "--lace-color-text-label": "#1f2937",
56
- "--lace-color-text-muted": "#5c635e",
57
- "--lace-color-text-description": "#454b47",
59
+ "--lace-color-text-muted": "#606f85",
60
+ "--lace-color-text-description": "#475569",
58
61
  "--lace-color-text-danger": "#dc2626",
59
62
  "--lace-color-text-danger-soft": "#ef4444",
60
63
  "--lace-color-row-hover": "rgba(0, 0, 0, 0.02)",
61
- "--lace-color-ink": "#4a6e12",
62
- "--lace-color-accent-alpha-subtle": "rgba(132, 204, 22, 0.08)",
64
+ "--lace-color-ink": "#3d6600",
65
+ "--lace-color-accent-alpha-subtle": "#f1fcd9",
63
66
  "--lace-color-accent-alpha-medium": "rgba(132, 204, 22, 0.16)",
64
67
  "--lace-color-accent-strong": "#2d4a00",
68
+ "--lace-color-blue-mark": "#2563eb",
69
+ "--lace-color-amber-mark": "#8a5a10",
70
+ "--lace-color-green-mark": "#047857",
65
71
  "--lace-color-success": "#047857",
66
72
  "--lace-color-success-hover": "#065f46",
67
73
  "--lace-color-danger": "#dc2626",
@@ -70,8 +76,8 @@ var lightTheme = {
70
76
  "--lace-color-warning-bg": "#fffbeb",
71
77
  "--lace-color-warning-fg": "#b45309",
72
78
  "--lace-color-info": "#2563eb",
73
- "--lace-color-focus-ring": "#4a6e12",
74
- "--lace-color-series-1": "#2c9db9",
79
+ "--lace-color-focus-ring": "#3d6600",
80
+ "--lace-color-series-1": "#268fa9",
75
81
  "--lace-color-series-2": "#5c3e9a",
76
82
  "--lace-color-series-3": "#8a5a10",
77
83
  "--lace-color-series-4": "#8a2e5c",
@@ -135,6 +141,32 @@ var textRoles = {
135
141
  "--lace-text-note": 'italic 400 14px / 20px "Instrument Serif", Georgia, "Times New Roman", serif'
136
142
  };
137
143
 
144
+ // src/theme-choice.ts
145
+ var PRODUCT_THEMES = [
146
+ "light",
147
+ "dark"
148
+ ];
149
+ var THEME_STORAGE_KEY = "lace-theme";
150
+ var SYSTEM_LIGHT_QUERY = "(prefers-color-scheme: light)";
151
+ function choiceOf(stored) {
152
+ return PRODUCT_THEMES.find((theme) => theme === stored) ?? "system";
153
+ }
154
+ function themeOf(choice, systemLight) {
155
+ if (choice !== "system") return choice;
156
+ return systemLight ? "light" : "dark";
157
+ }
158
+ var literal = JSON.stringify;
159
+ var PRE_MOUNT_THEME_SCRIPT = `(function () {
160
+ var stored = null;
161
+ var systemLight = false;
162
+ try { stored = localStorage.getItem(${literal(THEME_STORAGE_KEY)}); } catch (e) {}
163
+ try { systemLight = window.matchMedia(${literal(SYSTEM_LIGHT_QUERY)}).matches; } catch (e) {}
164
+ var theme = ${literal(PRODUCT_THEMES)}.indexOf(stored) < 0
165
+ ? (systemLight ? ${literal(themeOf("system", true))} : ${literal(themeOf("system", false))})
166
+ : stored;
167
+ document.documentElement.setAttribute("data-theme", theme);
168
+ })();`;
169
+
138
170
  // src/index.ts
139
171
  var brand = {
140
172
  green: "#CEFE65",
@@ -163,14 +195,20 @@ function themeDeclarations(theme) {
163
195
  }
164
196
  export {
165
197
  PAPERS,
198
+ PRE_MOUNT_THEME_SCRIPT,
199
+ PRODUCT_THEMES,
166
200
  PRODUCT_TYPE_SET,
201
+ SYSTEM_LIGHT_QUERY,
167
202
  THEMES,
203
+ THEME_STORAGE_KEY,
168
204
  TYPE_SETS,
169
205
  brand,
206
+ choiceOf,
170
207
  darkTheme,
171
208
  lightTheme,
172
209
  pin,
173
210
  textRoles,
174
- themeDeclarations
211
+ themeDeclarations,
212
+ themeOf
175
213
  };
176
214
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/themes.gen.ts","../src/index.ts"],"sourcesContent":["// Generated from tokens.css by scripts/gen-themes.mjs; `pnpm --filter @lace-cloud/design-tokens build`\n// rewrites it. Edit tokens.css, never this file.\n\n/**\n * The dark theme's semantic colours — every `--lace-color-*` of tokens.css's semantic tier, at the\n * value it resolves to in the default (dark) theme — for a consumer that cannot load tokens.css: a\n * server-rendered page declares them in its own `:root` and reads them by the names the\n * stylesheet uses.\n */\nexport const darkTheme = {\n '--lace-color-bg-canvas': '#161616',\n '--lace-color-bg-surface': '#1e1e1e',\n '--lace-color-bg-surface-alt': '#252526',\n '--lace-color-bg-input': '#0f0f0f',\n '--lace-color-bg-context-menu': '#1a1a1a',\n '--lace-color-border-default': 'rgba(255, 255, 255, 0.08)',\n '--lace-color-border-subtle': '#3c3c3c',\n '--lace-color-border-input': 'rgba(255, 255, 255, 0.15)',\n '--lace-color-border-control': '#757575',\n '--lace-color-border-input-hover': '#888888',\n '--lace-color-text-primary': '#ecefed',\n '--lace-color-text-label': '#e6e6e6',\n '--lace-color-text-muted': '#8f9691',\n '--lace-color-text-description': '#b3bab5',\n '--lace-color-text-danger': '#e5484d',\n '--lace-color-text-danger-soft': '#f87171',\n '--lace-color-row-hover': 'rgba(255, 255, 255, 0.025)',\n '--lace-color-accent': '#cefe65',\n '--lace-color-text-on-accent': '#111111',\n '--lace-color-accent-edge': '#cefe65',\n '--lace-color-ink': '#cefe65',\n '--lace-color-accent-alpha-subtle': 'rgba(206, 254, 101, 0.1)',\n '--lace-color-accent-alpha-medium': 'rgba(206, 254, 101, 0.2)',\n '--lace-color-accent-strong': '#e0ff8a',\n '--lace-color-success': '#4ade80',\n '--lace-color-success-hover': '#22c55e',\n '--lace-color-danger': '#e5484d',\n '--lace-color-danger-bg-soft': 'rgba(248, 113, 113, 0.12)',\n '--lace-color-danger-fg': '#f87171',\n '--lace-color-warning-bg': '#3b2507',\n '--lace-color-warning-fg': '#fbbf24',\n '--lace-color-info': '#9ecbff',\n '--lace-color-focus-ring': '#cefe65',\n '--lace-color-series-1': '#95e7ff',\n '--lace-color-series-2': '#b084f0',\n '--lace-color-series-3': '#f5a623',\n '--lace-color-series-4': '#f288c6',\n '--lace-color-series-5': '#ff8a4c',\n '--lace-color-series-6': '#cefe65',\n} as const;\n\n/**\n * The light theme's semantic colours — every `--lace-color-*` tokens.css's `[data-theme=\"light\"]`\n * block overrides, at the value it resolves to there — declared after `darkTheme` under the\n * page's own `[data-theme=\"light\"]`.\n */\nexport const lightTheme = {\n '--lace-color-bg-canvas': '#f6f7f5',\n '--lace-color-bg-surface': '#ffffff',\n '--lace-color-bg-surface-alt': '#f1f3f0',\n '--lace-color-bg-input': '#ffffff',\n '--lace-color-bg-context-menu': '#ffffff',\n '--lace-color-border-default': 'rgba(22, 22, 22, 0.1)',\n '--lace-color-border-subtle': '#e2e8f0',\n '--lace-color-border-input': 'rgba(22, 22, 22, 0.2)',\n '--lace-color-border-control': '#7a7a7a',\n '--lace-color-border-input-hover': '#4b5563',\n '--lace-color-text-primary': '#161616',\n '--lace-color-text-label': '#1f2937',\n '--lace-color-text-muted': '#5c635e',\n '--lace-color-text-description': '#454b47',\n '--lace-color-text-danger': '#dc2626',\n '--lace-color-text-danger-soft': '#ef4444',\n '--lace-color-row-hover': 'rgba(0, 0, 0, 0.02)',\n '--lace-color-ink': '#4a6e12',\n '--lace-color-accent-alpha-subtle': 'rgba(132, 204, 22, 0.08)',\n '--lace-color-accent-alpha-medium': 'rgba(132, 204, 22, 0.16)',\n '--lace-color-accent-strong': '#2d4a00',\n '--lace-color-success': '#047857',\n '--lace-color-success-hover': '#065f46',\n '--lace-color-danger': '#dc2626',\n '--lace-color-danger-bg-soft': '#fef2f2',\n '--lace-color-danger-fg': '#b91c1c',\n '--lace-color-warning-bg': '#fffbeb',\n '--lace-color-warning-fg': '#b45309',\n '--lace-color-info': '#2563eb',\n '--lace-color-focus-ring': '#4a6e12',\n '--lace-color-series-1': '#2c9db9',\n '--lace-color-series-2': '#5c3e9a',\n '--lace-color-series-3': '#8a5a10',\n '--lace-color-series-4': '#8a2e5c',\n '--lace-color-series-5': '#8a3a10',\n '--lace-color-series-6': '#5e8a1a',\n} as const;\n\n/**\n * The text roles in the default (compact) type set — each `--lace-text-<role>` `font` shorthand\n * and its `-size`, `-line`, `-weight`, `-family` and `-tracking`, resolved — for a consumer\n * that cannot load tokens.css: it declares them in its own `:root` and sets a run's type with\n * `font: var(--lace-text-<role>)` and `letter-spacing: var(--lace-text-<role>-tracking)`.\n */\nexport const textRoles = {\n '--lace-text-display-size': '22px',\n '--lace-text-display-line': '28px',\n '--lace-text-title-size': '16px',\n '--lace-text-title-line': '22px',\n '--lace-text-heading-size': '14px',\n '--lace-text-heading-line': '20px',\n '--lace-text-body-size': '13px',\n '--lace-text-body-line': '18px',\n '--lace-text-control-size': '12px',\n '--lace-text-control-line': '16px',\n '--lace-text-caption-size': '11px',\n '--lace-text-caption-line': '14px',\n '--lace-text-label-size': '10px',\n '--lace-text-label-line': '14px',\n '--lace-text-code-size': '12px',\n '--lace-text-code-line': '16px',\n '--lace-text-note-size': '14px',\n '--lace-text-note-line': '20px',\n '--lace-text-display-weight': '600',\n '--lace-text-display-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-display-tracking': '-0.01em',\n '--lace-text-title-weight': '600',\n '--lace-text-title-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-title-tracking': '0',\n '--lace-text-heading-weight': '600',\n '--lace-text-heading-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-heading-tracking': '0',\n '--lace-text-body-weight': '400',\n '--lace-text-body-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-body-tracking': '0',\n '--lace-text-control-weight': '500',\n '--lace-text-control-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-control-tracking': '0',\n '--lace-text-caption-weight': '400',\n '--lace-text-caption-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-caption-tracking': '0',\n '--lace-text-label-weight': '500',\n '--lace-text-label-family': '\"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", monospace',\n '--lace-text-label-tracking': '0.06em',\n '--lace-text-code-weight': '400',\n '--lace-text-code-family': '\"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", monospace',\n '--lace-text-code-tracking': '0',\n '--lace-text-note-weight': '400',\n '--lace-text-note-family': '\"Instrument Serif\", Georgia, \"Times New Roman\", serif',\n '--lace-text-note-tracking': '0',\n '--lace-text-display': '600 22px / 28px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-title': '600 16px / 22px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-heading': '600 14px / 20px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-body': '400 13px / 18px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-control': '500 12px / 16px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-caption': '400 11px / 14px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-label': '500 10px / 14px \"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", monospace',\n '--lace-text-code': '400 12px / 16px \"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", monospace',\n '--lace-text-note': 'italic 400 14px / 20px \"Instrument Serif\", Georgia, \"Times New Roman\", serif',\n} as const;\n","// @lace-cloud/design-tokens — JS/TS token exports\n// Primary distribution is tokens.css; use this for JS/TS consumers that\n// need programmatic access to token values (e.g., pinColor.ts).\n\nexport const brand = {\n green: '#CEFE65',\n greenBright: '#e0ff8a',\n gunmetal: '#153238',\n gunmetalLight: '#1a3f47',\n night: '#161616',\n cyan: '#95E7FF',\n grey: '#ECEFED',\n} as const;\n\nexport const pin = {\n string: { fill: '#95E7FF', stroke: '#2C9DB9' },\n number: { fill: '#F5A623', stroke: '#8A5A10' },\n bool: { fill: '#B084F0', stroke: '#5C3E9A' },\n list: { fill: '#CEFE65', stroke: '#5E8A1A' },\n map: { fill: '#F288C6', stroke: '#8A2E5C' },\n object: { fill: '#FF8A4C', stroke: '#8A3A10' },\n any: { fill: '#9BA19E', stroke: '#4A4F4C' },\n} as const;\n\n// The themes' semantic colours and the compact text roles, generated from\n// tokens.css at build (`src/themes-source.ts`): `darkTheme`, `lightTheme` and\n// `textRoles`, for a consumer that cannot load the stylesheet.\nexport { darkTheme, lightTheme, textRoles } from './themes.gen';\n\nimport type { textRoles } from './themes.gen';\n\n/** A text role tokens.css declares, by the name in its `--lace-text-<role>` custom properties. */\nexport type TextRole = keyof typeof textRoles extends infer Name\n ? Name extends `--lace-text-${infer Role}-size`\n ? Role\n : never\n : never;\n\n/** The themes tokens.css declares, read through `data-theme` on <html>: `dark` is the default,\n * the rest are `[data-theme=\"<name>\"]` blocks. A host maps its own theme names onto these. */\nexport const THEMES = ['dark', 'light', 'high-contrast', 'high-contrast-light'] as const;\n\n/** The type sets tokens.css declares, read through `data-lace-type-set` on a region's root: each\n * sizes the text roles for one kind of region. `compact` is the default (`:root`) and the\n * canvas's own root; `comfortable` is product UI, the portal's document root; `expressive` is\n * prose, the editorial and article templates' prose regions. */\nexport const TYPE_SETS = ['compact', 'comfortable', 'expressive'] as const;\n\n/** A type set, the value of a region's `data-lace-type-set`. */\nexport type TypeSet = (typeof TYPE_SETS)[number];\n\n/** The type set product UI reads: the one the portal's document root declares. */\nexport const PRODUCT_TYPE_SET = 'comfortable' satisfies TypeSet;\n\n/** The papers tokens.css declares beside the paper of now (`:root`), read through\n * `data-lace-paper` on a region's root: `blueprint` is the paper a page drawn as of an earlier\n * revision is drawn on, its ground, threads and ink in one blue in every theme. */\nexport const PAPERS = ['blueprint'] as const;\n\n/** A paper, the value of a region's `data-lace-paper`. */\nexport type Paper = (typeof PAPERS)[number];\n\n/** Custom properties (a theme's colours, the text roles) as the declarations of one CSS rule,\n * `name:value` joined by `;`, for a page that declares the tokens in a rule of its own. */\nexport function themeDeclarations(theme: Readonly<Record<string, string>>): string {\n return Object.entries(theme)\n .map(([name, value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,"sources":["../src/themes.gen.ts","../src/theme-choice.ts","../src/index.ts"],"sourcesContent":["// Generated from tokens.css by scripts/gen-themes.mjs; `pnpm --filter @lace-cloud/design-tokens build`\n// rewrites it. Edit tokens.css, never this file.\n\n/**\n * The dark theme's semantic colours — every `--lace-color-*` of tokens.css's semantic tier, at the\n * value it resolves to in the default (dark) theme — for a consumer that cannot load tokens.css: a\n * server-rendered page declares them in its own `:root` and reads them by the names the\n * stylesheet uses.\n */\nexport const darkTheme = {\n '--lace-color-bg-canvas': '#161616',\n '--lace-color-bg-surface': '#1e1e1e',\n '--lace-color-bg-surface-alt': '#252526',\n '--lace-color-bg-input': '#0f0f0f',\n '--lace-color-bg-context-menu': '#1a1a1a',\n '--lace-color-border-default': 'rgba(255, 255, 255, 0.08)',\n '--lace-color-border-subtle': '#3c3c3c',\n '--lace-color-border-input': 'rgba(255, 255, 255, 0.15)',\n '--lace-color-border-control': '#757575',\n '--lace-color-border-input-hover': '#888888',\n '--lace-color-text-primary': '#ecefed',\n '--lace-color-text-label': '#e6e6e6',\n '--lace-color-text-muted': '#8f9691',\n '--lace-color-text-description': '#b3bab5',\n '--lace-color-text-danger': '#e5484d',\n '--lace-color-text-danger-soft': '#f87171',\n '--lace-color-row-hover': 'rgba(255, 255, 255, 0.025)',\n '--lace-color-accent': '#cefe65',\n '--lace-color-text-on-accent': '#111111',\n '--lace-color-accent-edge': '#cefe65',\n '--lace-color-ink': '#cefe65',\n '--lace-color-accent-alpha-subtle': 'rgba(206, 254, 101, 0.1)',\n '--lace-color-accent-alpha-medium': 'rgba(206, 254, 101, 0.2)',\n '--lace-color-accent-strong': '#e0ff8a',\n '--lace-color-blue-mark': '#60a5fa',\n '--lace-color-amber-mark': '#f5a623',\n '--lace-color-green-mark': '#4ade80',\n '--lace-color-success': '#4ade80',\n '--lace-color-success-hover': '#22c55e',\n '--lace-color-danger': '#e5484d',\n '--lace-color-danger-bg-soft': 'rgba(248, 113, 113, 0.12)',\n '--lace-color-danger-fg': '#f87171',\n '--lace-color-warning-bg': '#3b2507',\n '--lace-color-warning-fg': '#fbbf24',\n '--lace-color-info': '#9ecbff',\n '--lace-color-focus-ring': '#cefe65',\n '--lace-color-series-1': '#95e7ff',\n '--lace-color-series-2': '#b084f0',\n '--lace-color-series-3': '#f5a623',\n '--lace-color-series-4': '#f288c6',\n '--lace-color-series-5': '#ff8a4c',\n '--lace-color-series-6': '#cefe65',\n} as const;\n\n/**\n * The light theme's semantic colours — every `--lace-color-*` tokens.css's `[data-theme=\"light\"]`\n * block overrides, at the value it resolves to there — declared after `darkTheme` under the\n * page's own `[data-theme=\"light\"]`.\n */\nexport const lightTheme = {\n '--lace-color-bg-canvas': '#ffffff',\n '--lace-color-bg-surface': '#ffffff',\n '--lace-color-bg-surface-alt': '#f4f5f2',\n '--lace-color-bg-input': '#ffffff',\n '--lace-color-bg-context-menu': '#ffffff',\n '--lace-color-border-default': '#eef0f3',\n '--lace-color-border-subtle': '#dfe3ea',\n '--lace-color-border-input': 'rgba(22, 22, 22, 0.2)',\n '--lace-color-border-control': '#7a7a7a',\n '--lace-color-border-input-hover': '#4b5563',\n '--lace-color-text-primary': '#0f172a',\n '--lace-color-text-label': '#1f2937',\n '--lace-color-text-muted': '#606f85',\n '--lace-color-text-description': '#475569',\n '--lace-color-text-danger': '#dc2626',\n '--lace-color-text-danger-soft': '#ef4444',\n '--lace-color-row-hover': 'rgba(0, 0, 0, 0.02)',\n '--lace-color-ink': '#3d6600',\n '--lace-color-accent-alpha-subtle': '#f1fcd9',\n '--lace-color-accent-alpha-medium': 'rgba(132, 204, 22, 0.16)',\n '--lace-color-accent-strong': '#2d4a00',\n '--lace-color-blue-mark': '#2563eb',\n '--lace-color-amber-mark': '#8a5a10',\n '--lace-color-green-mark': '#047857',\n '--lace-color-success': '#047857',\n '--lace-color-success-hover': '#065f46',\n '--lace-color-danger': '#dc2626',\n '--lace-color-danger-bg-soft': '#fef2f2',\n '--lace-color-danger-fg': '#b91c1c',\n '--lace-color-warning-bg': '#fffbeb',\n '--lace-color-warning-fg': '#b45309',\n '--lace-color-info': '#2563eb',\n '--lace-color-focus-ring': '#3d6600',\n '--lace-color-series-1': '#268fa9',\n '--lace-color-series-2': '#5c3e9a',\n '--lace-color-series-3': '#8a5a10',\n '--lace-color-series-4': '#8a2e5c',\n '--lace-color-series-5': '#8a3a10',\n '--lace-color-series-6': '#5e8a1a',\n} as const;\n\n/**\n * The text roles in the default (compact) type set — each `--lace-text-<role>` `font` shorthand\n * and its `-size`, `-line`, `-weight`, `-family` and `-tracking`, resolved — for a consumer\n * that cannot load tokens.css: it declares them in its own `:root` and sets a run's type with\n * `font: var(--lace-text-<role>)` and `letter-spacing: var(--lace-text-<role>-tracking)`.\n */\nexport const textRoles = {\n '--lace-text-display-size': '22px',\n '--lace-text-display-line': '28px',\n '--lace-text-title-size': '16px',\n '--lace-text-title-line': '22px',\n '--lace-text-heading-size': '14px',\n '--lace-text-heading-line': '20px',\n '--lace-text-body-size': '13px',\n '--lace-text-body-line': '18px',\n '--lace-text-control-size': '12px',\n '--lace-text-control-line': '16px',\n '--lace-text-caption-size': '11px',\n '--lace-text-caption-line': '14px',\n '--lace-text-label-size': '10px',\n '--lace-text-label-line': '14px',\n '--lace-text-code-size': '12px',\n '--lace-text-code-line': '16px',\n '--lace-text-note-size': '14px',\n '--lace-text-note-line': '20px',\n '--lace-text-display-weight': '600',\n '--lace-text-display-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-display-tracking': '-0.01em',\n '--lace-text-title-weight': '600',\n '--lace-text-title-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-title-tracking': '0',\n '--lace-text-heading-weight': '600',\n '--lace-text-heading-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-heading-tracking': '0',\n '--lace-text-body-weight': '400',\n '--lace-text-body-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-body-tracking': '0',\n '--lace-text-control-weight': '500',\n '--lace-text-control-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-control-tracking': '0',\n '--lace-text-caption-weight': '400',\n '--lace-text-caption-family': '\"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-caption-tracking': '0',\n '--lace-text-label-weight': '500',\n '--lace-text-label-family': '\"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", monospace',\n '--lace-text-label-tracking': '0.06em',\n '--lace-text-code-weight': '400',\n '--lace-text-code-family': '\"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", monospace',\n '--lace-text-code-tracking': '0',\n '--lace-text-note-weight': '400',\n '--lace-text-note-family': '\"Instrument Serif\", Georgia, \"Times New Roman\", serif',\n '--lace-text-note-tracking': '0',\n '--lace-text-display': '600 22px / 28px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-title': '600 16px / 22px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-heading': '600 14px / 20px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-body': '400 13px / 18px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-control': '500 12px / 16px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-caption': '400 11px / 14px \"Instrument Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif',\n '--lace-text-label': '500 10px / 14px \"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", monospace',\n '--lace-text-code': '400 12px / 16px \"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", monospace',\n '--lace-text-note': 'italic 400 14px / 20px \"Instrument Serif\", Georgia, \"Times New Roman\", serif',\n} as const;\n","// The theme rule: which product theme a page draws, from the reader's stored choice and the\n// device's setting. Pure, with no DOM access at import: a build config and the API Worker import\n// it as well as the pages that apply it.\n\nimport type { THEMES } from './index';\n\n/** The themes product UI offers its reader, in the order its switch lists them; a host with\n * high-contrast themes of its own maps onto the rest. */\nexport const PRODUCT_THEMES = [\n 'light',\n 'dark',\n] as const satisfies readonly (typeof THEMES)[number][];\n\n/** A product theme, the value of `<html data-theme>` on a page that follows the rule. */\nexport type ProductTheme = (typeof PRODUCT_THEMES)[number];\n\n/** What a reader chose: `system` follows the device; a product theme is stored and wins over it. */\nexport type ThemeChoice = 'system' | ProductTheme;\n\n/** The theme choice a reader's switch stores in their browser, `light` or `dark`; absent, the\n * page follows the system. */\nexport const THEME_STORAGE_KEY = 'lace-theme';\n\n/** The media query that matches while the device asks for light. */\nexport const SYSTEM_LIGHT_QUERY = '(prefers-color-scheme: light)';\n\n/** The choice a stored value holds: a product theme is itself; anything else, absence included,\n * is `system`. */\nexport function choiceOf(stored: string | null): ThemeChoice {\n return PRODUCT_THEMES.find((theme) => theme === stored) ?? 'system';\n}\n\n/** The theme a page draws: a chosen product theme wins; `system` draws light while the device\n * asks for light, and dark otherwise. */\nexport function themeOf(choice: ThemeChoice, systemLight: boolean): ProductTheme {\n if (choice !== 'system') return choice;\n return systemLight ? 'light' : 'dark';\n}\n\nconst literal = JSON.stringify;\n\n/** The script a page's `<head>` runs before anything paints: it sets `<html data-theme>` to\n * `themeOf(choiceOf(stored), systemLight)`, its every value written from the rule above. It is\n * ES5 and self-contained, and it never throws: storage that refuses reads as no choice, and a\n * window without `matchMedia` as a device that does not ask for light. Its text is fixed at\n * load, so a CSP admits it by its hash. */\nexport const PRE_MOUNT_THEME_SCRIPT = `(function () {\n var stored = null;\n var systemLight = false;\n try { stored = localStorage.getItem(${literal(THEME_STORAGE_KEY)}); } catch (e) {}\n try { systemLight = window.matchMedia(${literal(SYSTEM_LIGHT_QUERY)}).matches; } catch (e) {}\n var theme = ${literal(PRODUCT_THEMES)}.indexOf(stored) < 0\n ? (systemLight ? ${literal(themeOf('system', true))} : ${literal(themeOf('system', false))})\n : stored;\n document.documentElement.setAttribute(\"data-theme\", theme);\n})();`;\n","// @lace-cloud/design-tokens — JS/TS token exports\n// Primary distribution is tokens.css; use this for JS/TS consumers that\n// need programmatic access to token values (e.g., pinColor.ts).\n\nexport const brand = {\n green: '#CEFE65',\n greenBright: '#e0ff8a',\n gunmetal: '#153238',\n gunmetalLight: '#1a3f47',\n night: '#161616',\n cyan: '#95E7FF',\n grey: '#ECEFED',\n} as const;\n\nexport const pin = {\n string: { fill: '#95E7FF', stroke: '#2C9DB9' },\n number: { fill: '#F5A623', stroke: '#8A5A10' },\n bool: { fill: '#B084F0', stroke: '#5C3E9A' },\n list: { fill: '#CEFE65', stroke: '#5E8A1A' },\n map: { fill: '#F288C6', stroke: '#8A2E5C' },\n object: { fill: '#FF8A4C', stroke: '#8A3A10' },\n any: { fill: '#9BA19E', stroke: '#4A4F4C' },\n} as const;\n\n// The themes' semantic colours and the compact text roles, generated from\n// tokens.css at build (`src/themes-source.ts`): `darkTheme`, `lightTheme` and\n// `textRoles`, for a consumer that cannot load the stylesheet.\nexport { darkTheme, lightTheme, textRoles } from './themes.gen';\n\nimport type { textRoles } from './themes.gen';\n\n/** A text role tokens.css declares, by the name in its `--lace-text-<role>` custom properties. */\nexport type TextRole = keyof typeof textRoles extends infer Name\n ? Name extends `--lace-text-${infer Role}-size`\n ? Role\n : never\n : never;\n\n/** The themes tokens.css declares, read through `data-theme` on <html>: `dark` is the default,\n * the rest are `[data-theme=\"<name>\"]` blocks. A host maps its own theme names onto these. */\nexport const THEMES = ['dark', 'light', 'high-contrast', 'high-contrast-light'] as const;\n\n// The themes product UI offers (`PRODUCT_THEMES`) and the rule that picks one from the reader's\n// choice and the device's setting.\nexport * from './theme-choice';\n\n/** The type sets tokens.css declares, read through `data-lace-type-set` on a region's root: each\n * sizes the text roles for one kind of region. `compact` is the default (`:root`) and the\n * canvas's own root; `comfortable` is product UI, the portal's document root; `expressive` is\n * prose, the editorial and article templates' prose regions. */\nexport const TYPE_SETS = ['compact', 'comfortable', 'expressive'] as const;\n\n/** A type set, the value of a region's `data-lace-type-set`. */\nexport type TypeSet = (typeof TYPE_SETS)[number];\n\n/** The type set product UI reads: the one the portal's document root declares. */\nexport const PRODUCT_TYPE_SET = 'comfortable' satisfies TypeSet;\n\n/** The papers tokens.css declares beside the paper of now (`:root`), read through\n * `data-lace-paper` on a region's root: `blueprint` is the paper a page drawn as of an earlier\n * revision is drawn on, its ground, threads and ink in one blue in every theme. */\nexport const PAPERS = ['blueprint'] as const;\n\n/** A paper, the value of a region's `data-lace-paper`. */\nexport type Paper = (typeof PAPERS)[number];\n\n/** Custom properties (a theme's colours, the text roles) as the declarations of one CSS rule,\n * `name:value` joined by `;`, for a page that declares the tokens in a rule of its own. */\nexport function themeDeclarations(theme: Readonly<Record<string, string>>): string {\n return Object.entries(theme)\n .map(([name, value]) => `${name}:${value}`)\n .join(';');\n}\n"],"mappings":";AASO,IAAM,YAAY;AAAA,EACvB,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B,+BAA+B;AAAA,EAC/B,yBAAyB;AAAA,EACzB,gCAAgC;AAAA,EAChC,+BAA+B;AAAA,EAC/B,8BAA8B;AAAA,EAC9B,6BAA6B;AAAA,EAC7B,+BAA+B;AAAA,EAC/B,mCAAmC;AAAA,EACnC,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,2BAA2B;AAAA,EAC3B,iCAAiC;AAAA,EACjC,4BAA4B;AAAA,EAC5B,iCAAiC;AAAA,EACjC,0BAA0B;AAAA,EAC1B,uBA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C,WAAW,eAAe,YAAY;AAMzD,IAAM,mBAAmB;AAKzB,IAAM,SAAS,CAAC,WAAW;AAO3B,SAAS,kBAAkB,OAAiD;AACjF,SAAO,OAAO,QAAQ,KAAK,EACxB,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,GAAG,IAAI,IAAI,KAAK,EAAE,EACzC,KAAK,GAAG;AACb;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lace-cloud/design-tokens",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "lace": {
5
5
  "owner": "library"
6
6
  },
package/tokens.css CHANGED
@@ -25,12 +25,14 @@
25
25
 
26
26
  :root {
27
27
  /* ── Palette: brand ── */
28
+ --lace-color-green-50: #f1fcd9;
28
29
  --lace-color-green-300: #e0ff8a;
29
30
  --lace-color-green-500: #cefe65;
30
31
  --lace-color-green-700: #5e8a1a;
31
- --lace-color-green-800: #4a6e12;
32
+ --lace-color-green-900: #3d6600;
32
33
  --lace-color-cyan-500: #95e7ff;
33
34
  --lace-color-cyan-700: #2c9db9;
35
+ --lace-color-cyan-800: #268fa9;
34
36
 
35
37
  /* ── Palette: neutral ── */
36
38
  --lace-color-neutral-100: #ecefed;
@@ -68,14 +70,22 @@
68
70
  --lace-color-mascot-fur-dark: #a8d850;
69
71
 
70
72
  /* ── Palette: warm neutral ── */
71
- --lace-color-warm-50: #f6f7f5;
73
+ --lace-color-warm-75: #f4f5f2;
72
74
  --lace-color-warm-100: #f1f3f0;
73
75
  --lace-color-warm-400: #b3bab5;
74
76
  --lace-color-warm-500: #8f9691;
75
- --lace-color-warm-600: #5c635e;
76
- --lace-color-warm-700: #454b47;
77
77
  --lace-color-warm-900: #1a1815;
78
78
 
79
+ /* ── Palette: cool neutral ── the light theme's lines and inks, and the blueprint's grounds. */
80
+ --lace-color-cool-100: #f1f5f9;
81
+ --lace-color-cool-150: #eef0f3;
82
+ --lace-color-cool-200: #dfe3ea;
83
+ --lace-color-cool-500: #606f85;
84
+ --lace-color-cool-600: #475569;
85
+ --lace-color-cool-800: #1f2937;
86
+ --lace-color-cool-875: #0f172a;
87
+ --lace-color-cool-900: #121619;
88
+
79
89
  /* ── Palette: semantic accents ── */
80
90
  --lace-color-teal-700: #153238;
81
91
  --lace-color-blue-500: #1f6feb;
@@ -122,6 +132,7 @@
122
132
  --lace-color-green-alpha-15: rgba(206, 254, 101, 0.15);
123
133
  --lace-color-green-alpha-20: rgba(206, 254, 101, 0.2);
124
134
  --lace-color-green-alpha-30: rgba(206, 254, 101, 0.3);
135
+ --lace-color-green-900-alpha-30: rgba(61, 102, 0, 0.3);
125
136
  --lace-color-green-alpha-60: rgba(206, 254, 101, 0.6);
126
137
  --lace-color-red-alpha-12: rgba(248, 113, 113, 0.12);
127
138
  --lace-color-red-alpha-25: rgba(229, 72, 77, 0.25);
@@ -135,8 +146,6 @@
135
146
  --lace-color-black-alpha-60: rgba(0, 0, 0, 0.6);
136
147
  --lace-color-blue-alpha-30: rgba(59, 130, 246, 0.3);
137
148
  --lace-color-green-alpha-03: rgba(206, 254, 101, 0.03);
138
- --lace-color-cool-900: #121619;
139
- --lace-color-cool-100: #f1f5f9;
140
149
  --lace-color-blue-accent-alpha-05: rgba(79, 193, 255, 0.05);
141
150
  --lace-color-blue-accent-alpha-11: rgba(79, 193, 255, 0.11);
142
151
  --lace-color-blue-deep-alpha-07: rgba(10, 98, 189, 0.07);
@@ -366,6 +375,14 @@
366
375
  --lace-color-accent-alpha-medium: var(--lace-color-green-alpha-20);
367
376
  --lace-color-accent-strong: var(--lace-color-green-bright, var(--lace-color-green-300));
368
377
 
378
+ /* ── Hue marks ──
379
+ * A hue drawn as a mark (a glyph, a label) at the step of it that reads on the theme's
380
+ * ground: the bright step on the dark surfaces, a deeper one on the light, where the bright
381
+ * steps measure 1.7:1 to 2.5:1 on white. A tint of the hue keeps the bright step in both. */
382
+ --lace-color-blue-mark: var(--lace-color-blue-bright-500);
383
+ --lace-color-amber-mark: var(--lace-color-amber-400);
384
+ --lace-color-green-mark: var(--lace-color-green-bright-500);
385
+
369
386
  /* ── Status ── */
370
387
  --lace-color-success: var(--lace-color-green-bright-500);
371
388
  --lace-color-success-hover: var(--lace-color-green-bright-600);
@@ -410,8 +427,8 @@
410
427
  --lace-color-focus-ring: var(--lace-color-ink);
411
428
 
412
429
  /* ── Series ──
413
- * The strokes of a chart's series, in order, each at least 3:1 against the
414
- * surface it is drawn on. */
430
+ * The strokes of a chart's series, in order, each at least 3:1 against
431
+ * every surface a chart is drawn on: the canvas, a surface, the alt surface. */
415
432
  --lace-color-series-1: var(--lace-color-cyan-500);
416
433
  --lace-color-series-2: var(--lace-color-purple-400);
417
434
  --lace-color-series-3: var(--lace-color-amber-400);
@@ -637,11 +654,12 @@
637
654
  [data-lace-paper="blueprint"] {
638
655
  /* ── Brand aliases (prefer semantic tokens) ── */
639
656
  --lace-green: var(--lace-color-green-500);
640
- --lace-grey: var(--lace-color-neutral-100);
657
+ --lace-grey: var(--lace-color-text-primary);
641
658
 
642
659
  /* ── Chat ── */
643
- /* The one surface the chat panel sits on, the same in both themes: a warm
644
- * near-black its tiles are cut from and its mark's face is drawn in. */
660
+ /* The surface the chat panel sits on, warm in both themes (a warm near-black
661
+ * here, a warm near-white in light): its tiles are cut from it and its
662
+ * mark's face is drawn in it. */
645
663
  --lace-chat-surface: var(--lace-color-warm-900);
646
664
 
647
665
  /* ── Surface aliases (prefer semantic tokens) ── */
@@ -652,11 +670,14 @@
652
670
  --lace-border-subtle: var(--lace-color-border-subtle);
653
671
 
654
672
  /* ── Button ──
655
- * The primary is the brand accent, used sparingly: the one call to
656
- * action of a surface. green-500 holds its value in both themes, and
657
- * text-on-accent is the near-black measured against it. */
673
+ * The primary is the one call to action of a surface, used sparingly:
674
+ * here the brand lime under text-on-accent, the near-black measured
675
+ * against it; in light the near-black under a white label. Its edge is
676
+ * its own fill, so the button is one shape; a high-contrast theme draws
677
+ * the edge in its edge colour. */
658
678
  --lace-btn-primary: var(--lace-color-green-500);
659
679
  --lace-btn-primary-dim: var(--lace-color-green-300);
680
+ --lace-btn-primary-edge: var(--lace-btn-primary);
660
681
  --lace-btn-secondary-bg: #2d2d2d;
661
682
  --lace-btn-secondary-hover: #3a3a3a;
662
683
  --lace-btn-success-hover: var(--lace-color-success-hover);
@@ -792,7 +813,9 @@
792
813
  /* ══════════════════════════════════════════════════════════════════════
793
814
  * LIGHT THEME
794
815
  *
795
- * Override Tier-2 semantic + Tier-3 component tokens for light surfaces.
816
+ * Override Tier-2 semantic + Tier-3 component tokens for light surfaces: a
817
+ * white ground and white cards drawn apart by cool lines, slate inks, the
818
+ * olive brand ink and a near-black primary.
796
819
  * Tier-1 primitives (raw palette + alpha variants) stay theme-neutral.
797
820
  * Apps opt in via `<html data-theme="light">`, or `high-contrast-light`, which
798
821
  * takes these and the high-contrast remap below. A nested surface may apply
@@ -804,26 +827,28 @@
804
827
  [data-theme="light"] [data-lace-paper="blueprint"],
805
828
  [data-theme="high-contrast-light"] [data-lace-paper="blueprint"] {
806
829
  /* ── Tier-2: Surface ── */
807
- --lace-color-bg-canvas: var(--lace-color-warm-50);
830
+ --lace-color-bg-canvas: var(--lace-color-neutral-white);
808
831
  --lace-color-bg-surface: var(--lace-color-neutral-white);
809
- --lace-color-bg-surface-alt: var(--lace-color-warm-100);
810
- --lace-color-bg-input: #ffffff;
811
- --lace-color-bg-context-menu: #ffffff;
832
+ --lace-color-bg-surface-alt: var(--lace-color-warm-75);
833
+ --lace-color-bg-input: var(--lace-color-neutral-white);
834
+ --lace-color-bg-context-menu: var(--lace-color-neutral-white);
812
835
 
813
836
  /* ── Tier-2: Border ── */
814
- --lace-color-border-default: var(--lace-color-neutral-900-alpha-10);
815
- --lace-color-border-subtle: #e2e8f0;
837
+ --lace-color-border-default: var(--lace-color-cool-150);
838
+ --lace-color-border-subtle: var(--lace-color-cool-200);
816
839
  --lace-color-border-input: var(--lace-color-neutral-900-alpha-20);
817
- /* A text control's resting edge, 3:1 by WCAG 2.2 SC 1.4.11: #7a7a7a is 3.99:1 on bg-canvas,
818
- * 4.29:1 on bg-surface and bg-input, 3.85:1 on bg-surface-alt. Hover darkens it further. */
840
+ /* A text control's resting edge, 3:1 by WCAG 2.2 SC 1.4.11: #7a7a7a is 4.29:1 on bg-canvas,
841
+ * bg-surface and bg-input, 3.92:1 on bg-surface-alt. Hover darkens it further. */
819
842
  --lace-color-border-control: #7a7a7a;
820
843
  --lace-color-border-input-hover: #4b5563;
821
844
 
822
845
  /* ── Tier-2: Text ── */
823
- --lace-color-text-primary: var(--lace-color-neutral-900);
824
- --lace-color-text-label: #1f2937;
825
- --lace-color-text-muted: var(--lace-color-warm-600);
826
- --lace-color-text-description: var(--lace-color-warm-700);
846
+ --lace-color-text-primary: var(--lace-color-cool-875);
847
+ --lace-color-text-label: var(--lace-color-cool-800);
848
+ /* The quietest text, a slate dark enough to hold 4.5:1 on the darkest grounds it is set on:
849
+ * 4.67:1 on bg-surface-alt, 4.58:1 on the chat surface. */
850
+ --lace-color-text-muted: var(--lace-color-cool-500);
851
+ --lace-color-text-description: var(--lace-color-cool-600);
827
852
  --lace-color-text-danger: #dc2626;
828
853
  --lace-color-text-danger-soft: #ef4444;
829
854
 
@@ -831,10 +856,18 @@
831
856
  --lace-color-row-hover: rgba(0, 0, 0, 0.02);
832
857
 
833
858
  /* ── Tier-2: Accent (the fill stays lime; ink darkens to olive) ── */
834
- --lace-color-ink: var(--lace-color-green-800);
835
- --lace-color-accent-alpha-subtle: rgba(132, 204, 22, 0.08);
859
+ --lace-color-ink: var(--lace-color-green-900);
860
+ --lace-color-accent-alpha-subtle: var(--lace-color-green-50);
836
861
  --lace-color-accent-alpha-medium: rgba(132, 204, 22, 0.16);
837
862
  --lace-color-accent-strong: #2d4a00;
863
+ /* The glow is the ink's halo: olive on the light ground, as it is lime on the dark. */
864
+ --lace-shadow-glow: 0 4px 16px var(--lace-color-green-900-alpha-30);
865
+ --lace-shadow-glow-none: 0 0 0 rgba(61, 102, 0, 0);
866
+
867
+ /* ── Tier-2: Hue marks ── */
868
+ --lace-color-blue-mark: var(--lace-color-blue-deep-700);
869
+ --lace-color-amber-mark: var(--lace-color-amber-600);
870
+ --lace-color-green-mark: var(--lace-color-green-deep-700);
838
871
 
839
872
  /* ── Tier-2: Status ── */
840
873
  --lace-color-success: var(--lace-color-green-deep-700);
@@ -850,11 +883,9 @@
850
883
  --lace-color-warning-fg: var(--lace-color-amber-deep-700);
851
884
  --lace-color-info: var(--lace-color-blue-deep-700);
852
885
 
853
- /* ── Tier-2: Forbidden state ── */
854
- --lace-forbidden-bg: #f1f5f9;
855
- --lace-forbidden-fg: #475569;
886
+ /* ── Tier-2: Forbidden state (fg and icon follow the text tokens) ── */
887
+ --lace-forbidden-bg: var(--lace-color-cool-100);
856
888
  --lace-forbidden-border: #cbd5e1;
857
- --lace-forbidden-icon: #64748b;
858
889
 
859
890
  /* ── Tier-2: Severity banner (bg/fg cascade from the status tokens) ── */
860
891
  --lace-banner-warning-border: #fde68a;
@@ -864,7 +895,7 @@
864
895
  --lace-color-focus-ring: var(--lace-color-ink);
865
896
 
866
897
  /* ── Tier-2: Series (each hue's darker stroke) ── */
867
- --lace-color-series-1: var(--lace-color-cyan-700);
898
+ --lace-color-series-1: var(--lace-color-cyan-800);
868
899
  --lace-color-series-2: var(--lace-color-purple-700);
869
900
  --lace-color-series-3: var(--lace-color-amber-600);
870
901
  --lace-color-series-4: var(--lace-color-pink-700);
@@ -881,13 +912,20 @@
881
912
  --lace-shadow-lg: 0 1px 3px rgba(0, 0, 0, 0.08);
882
913
  --lace-shadow-xl: 0 4px 12px rgba(0, 0, 0, 0.12);
883
914
 
884
- /* ── Tier-3: Button ── */
885
- --lace-btn-primary: var(--lace-color-green-500);
886
- --lace-btn-primary-dim: var(--lace-color-green-300);
887
- --lace-btn-secondary-bg: #f1f5f9;
915
+ /* ── Tier-3: Button (a near-black primary under a white label) ── */
916
+ --lace-btn-primary: var(--lace-color-neutral-925);
917
+ --lace-btn-primary-dim: var(--lace-color-neutral-850);
918
+ --lace-btn-text-primary: var(--lace-color-neutral-white);
919
+ --lace-btn-secondary-bg: var(--lace-color-neutral-white);
888
920
  --lace-btn-secondary-hover: #e2e8f0;
889
921
  --lace-btn-text-disabled: rgba(0, 0, 0, 0.35);
890
922
 
923
+ /* ── Tier-3: Chat ── */
924
+ --lace-chat-surface: var(--lace-color-warm-100);
925
+
926
+ /* ── Tier-3: Card ── */
927
+ --lace-card-border: var(--lace-color-border-default);
928
+
891
929
  /* ── Tier-3: Toast (alpha-over-dark won't work on light) ── */
892
930
  --lace-toast-success-bg: #ecfdf5;
893
931
  --lace-toast-success-border: #a7f3d0;
@@ -904,7 +942,7 @@
904
942
  --lace-pin-any-ring: var(--lace-pin-any-stroke);
905
943
 
906
944
  /* ── Tier-3: Canvas controls + minimap ── */
907
- --lace-canvas-minimap-bg: #ffffff;
945
+ --lace-canvas-minimap-bg: var(--lace-color-neutral-white);
908
946
  --lace-canvas-minimap-mask: rgba(0, 0, 0, 0.08);
909
947
  --lace-canvas-edge-stroke: var(--lace-color-ink);
910
948
  --lace-canvas-edge-stroke-selected: #2d4a00;
@@ -1010,6 +1048,7 @@
1010
1048
  --lace-forbidden-border: var(--lace-hc-edge);
1011
1049
  --lace-card-border: var(--lace-hc-edge);
1012
1050
  --lace-color-accent-edge: var(--lace-hc-edge);
1051
+ --lace-btn-primary-edge: var(--lace-hc-edge);
1013
1052
  --lace-banner-error-border: var(--lace-hc-edge);
1014
1053
  --lace-banner-warning-border: var(--lace-hc-edge);
1015
1054
  --lace-toast-error-border: var(--lace-hc-edge);
@@ -1259,6 +1298,7 @@ body,
1259
1298
  --lace-forbidden-border: var(--lace-hc-edge);
1260
1299
  --lace-card-border: var(--lace-hc-edge);
1261
1300
  --lace-color-accent-edge: var(--lace-hc-edge);
1301
+ --lace-btn-primary-edge: var(--lace-hc-edge);
1262
1302
  --lace-banner-error-border: var(--lace-hc-edge);
1263
1303
  --lace-banner-warning-border: var(--lace-hc-edge);
1264
1304
  --lace-toast-error-border: var(--lace-hc-edge);