@dloizides/design-tokens 1.1.0 → 1.2.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/CHANGELOG.md +48 -0
- package/README.md +42 -3
- package/dist/index.d.mts +131 -4
- package/dist/index.d.ts +131 -4
- package/dist/index.js +84 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,13 +5,19 @@ var DEFAULT_CSS_VAR_NAMES = {
|
|
|
5
5
|
primary: "--primary",
|
|
6
6
|
secondary: "--secondary",
|
|
7
7
|
accent: "--accent",
|
|
8
|
+
onBrand: "--on-brand",
|
|
8
9
|
success: "--success",
|
|
9
10
|
warning: "--warning",
|
|
10
11
|
error: "--error",
|
|
11
12
|
info: "--info",
|
|
13
|
+
successBg: "--success-bg",
|
|
14
|
+
warningBg: "--warning-bg",
|
|
15
|
+
errorBg: "--error-bg",
|
|
16
|
+
infoBg: "--info-bg",
|
|
12
17
|
lightBackground: "--background",
|
|
13
18
|
lightSurface: "--surface",
|
|
14
19
|
lightSurfaceElevated: "--surface-elevated",
|
|
20
|
+
lightSurfaceMuted: "--surface-muted",
|
|
15
21
|
lightText: "--text",
|
|
16
22
|
lightTextSecondary: "--text-secondary",
|
|
17
23
|
lightBorder: "--border",
|
|
@@ -19,6 +25,7 @@ var DEFAULT_CSS_VAR_NAMES = {
|
|
|
19
25
|
darkBackground: "--background",
|
|
20
26
|
darkSurface: "--surface",
|
|
21
27
|
darkSurfaceElevated: "--surface-elevated",
|
|
28
|
+
darkSurfaceMuted: "--surface-muted",
|
|
22
29
|
darkText: "--text",
|
|
23
30
|
darkTextSecondary: "--text-secondary",
|
|
24
31
|
darkBorder: "--border",
|
|
@@ -104,13 +111,19 @@ function toCssVars(tokens, names, options) {
|
|
|
104
111
|
declaration(names.primary, tokens.primary),
|
|
105
112
|
declaration(names.secondary, tokens.secondary),
|
|
106
113
|
declaration(names.accent, tokens.accent),
|
|
114
|
+
declaration(names.onBrand, tokens.onBrand),
|
|
107
115
|
declaration(names.success, tokens.semantic.success),
|
|
108
116
|
declaration(names.warning, tokens.semantic.warning),
|
|
109
117
|
declaration(names.error, tokens.semantic.error),
|
|
110
118
|
declaration(names.info, tokens.semantic.info),
|
|
119
|
+
declaration(names.successBg, tokens.semantic.successBg),
|
|
120
|
+
declaration(names.warningBg, tokens.semantic.warningBg),
|
|
121
|
+
declaration(names.errorBg, tokens.semantic.errorBg),
|
|
122
|
+
declaration(names.infoBg, tokens.semantic.infoBg),
|
|
111
123
|
declaration(names.lightBackground, tokens.light.background),
|
|
112
124
|
declaration(names.lightSurface, tokens.light.surface),
|
|
113
125
|
declaration(names.lightSurfaceElevated, tokens.light.surfaceElevated),
|
|
126
|
+
declaration(names.lightSurfaceMuted, tokens.light.surfaceMuted),
|
|
114
127
|
declaration(names.lightText, tokens.light.text),
|
|
115
128
|
declaration(names.lightTextSecondary, tokens.light.textSecondary),
|
|
116
129
|
declaration(names.lightBorder, tokens.light.border),
|
|
@@ -155,6 +168,7 @@ function toCssVars(tokens, names, options) {
|
|
|
155
168
|
declaration(names.darkBackground, tokens.dark.background),
|
|
156
169
|
declaration(names.darkSurface, tokens.dark.surface),
|
|
157
170
|
declaration(names.darkSurfaceElevated, tokens.dark.surfaceElevated),
|
|
171
|
+
declaration(names.darkSurfaceMuted, tokens.dark.surfaceMuted),
|
|
158
172
|
declaration(names.darkText, tokens.dark.text),
|
|
159
173
|
declaration(names.darkTextSecondary, tokens.dark.textSecondary),
|
|
160
174
|
declaration(names.darkBorder, tokens.dark.border),
|
|
@@ -191,6 +205,30 @@ function toRnTheme(tokens) {
|
|
|
191
205
|
}
|
|
192
206
|
|
|
193
207
|
// src/emit/toTailwindPreset.ts
|
|
208
|
+
function addOptionalColors(colors, tokens) {
|
|
209
|
+
const { semantic } = tokens;
|
|
210
|
+
if (tokens.onBrand !== void 0) {
|
|
211
|
+
colors["on-brand"] = tokens.onBrand;
|
|
212
|
+
}
|
|
213
|
+
if (semantic.successBg !== void 0) {
|
|
214
|
+
colors["success-bg"] = semantic.successBg;
|
|
215
|
+
}
|
|
216
|
+
if (semantic.warningBg !== void 0) {
|
|
217
|
+
colors["warning-bg"] = semantic.warningBg;
|
|
218
|
+
}
|
|
219
|
+
if (semantic.errorBg !== void 0) {
|
|
220
|
+
colors["error-bg"] = semantic.errorBg;
|
|
221
|
+
}
|
|
222
|
+
if (semantic.infoBg !== void 0) {
|
|
223
|
+
colors["info-bg"] = semantic.infoBg;
|
|
224
|
+
}
|
|
225
|
+
if (tokens.light.surfaceMuted !== void 0) {
|
|
226
|
+
colors["surface-muted"] = tokens.light.surfaceMuted;
|
|
227
|
+
}
|
|
228
|
+
if (tokens.dark.surfaceMuted !== void 0) {
|
|
229
|
+
colors.dark["surface-muted"] = tokens.dark.surfaceMuted;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
194
232
|
function toTailwindPreset(tokens) {
|
|
195
233
|
const colors = {
|
|
196
234
|
primary: tokens.primary,
|
|
@@ -217,6 +255,7 @@ function toTailwindPreset(tokens) {
|
|
|
217
255
|
divider: tokens.dark.divider
|
|
218
256
|
}
|
|
219
257
|
};
|
|
258
|
+
addOptionalColors(colors, tokens);
|
|
220
259
|
const extend = { colors };
|
|
221
260
|
if (tokens.radii !== void 0) {
|
|
222
261
|
extend.borderRadius = {
|
|
@@ -244,6 +283,47 @@ function toTailwindPreset(tokens) {
|
|
|
244
283
|
return { theme: { extend } };
|
|
245
284
|
}
|
|
246
285
|
|
|
286
|
+
// src/emit/toUiTheme.ts
|
|
287
|
+
var UI_TINT_STEP = "100";
|
|
288
|
+
var UI_MAIN_STEP = "500";
|
|
289
|
+
var UI_DEEP_STEP = "700";
|
|
290
|
+
var DEFAULT_ON_BRAND = "#ffffff";
|
|
291
|
+
var ON_BRAND_SCALE = "onBrand";
|
|
292
|
+
var SURFACE_MUTED_SCALE = "surfaceMuted";
|
|
293
|
+
function flat(value) {
|
|
294
|
+
return { [UI_TINT_STEP]: value, [UI_MAIN_STEP]: value, [UI_DEEP_STEP]: value };
|
|
295
|
+
}
|
|
296
|
+
function tinted(base, tint) {
|
|
297
|
+
return { [UI_TINT_STEP]: tint ?? base, [UI_MAIN_STEP]: base, [UI_DEEP_STEP]: base };
|
|
298
|
+
}
|
|
299
|
+
function toUiTheme(tokens, mode = "light") {
|
|
300
|
+
const modeColors = mode === "dark" ? tokens.dark : tokens.light;
|
|
301
|
+
const { semantic } = tokens;
|
|
302
|
+
return {
|
|
303
|
+
colors: {
|
|
304
|
+
background: modeColors.background,
|
|
305
|
+
surface: modeColors.surface,
|
|
306
|
+
surfaceElevated: modeColors.surfaceElevated,
|
|
307
|
+
text: modeColors.text,
|
|
308
|
+
textSecondary: modeColors.textSecondary,
|
|
309
|
+
border: modeColors.border
|
|
310
|
+
},
|
|
311
|
+
palette: {
|
|
312
|
+
primary: flat(tokens.primary),
|
|
313
|
+
secondary: flat(tokens.secondary),
|
|
314
|
+
accent: flat(tokens.accent),
|
|
315
|
+
[ON_BRAND_SCALE]: flat(tokens.onBrand ?? DEFAULT_ON_BRAND),
|
|
316
|
+
[SURFACE_MUTED_SCALE]: flat(modeColors.surfaceMuted ?? modeColors.surface)
|
|
317
|
+
},
|
|
318
|
+
semantic: {
|
|
319
|
+
error: tinted(semantic.error, semantic.errorBg),
|
|
320
|
+
success: tinted(semantic.success, semantic.successBg),
|
|
321
|
+
warning: tinted(semantic.warning, semantic.warningBg),
|
|
322
|
+
info: tinted(semantic.info, semantic.infoBg)
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
247
327
|
// src/presets/aml.ts
|
|
248
328
|
var AML_TOKENS = {
|
|
249
329
|
primary: "#4f46e5",
|
|
@@ -484,6 +564,9 @@ exports.DEFAULT_CSS_VAR_NAMES = DEFAULT_CSS_VAR_NAMES;
|
|
|
484
564
|
exports.EREVNA_TOKENS = EREVNA_TOKENS;
|
|
485
565
|
exports.KATALOGOS_TOKENS = KATALOGOS_TOKENS;
|
|
486
566
|
exports.PRESETS = PRESETS;
|
|
567
|
+
exports.UI_DEEP_STEP = UI_DEEP_STEP;
|
|
568
|
+
exports.UI_MAIN_STEP = UI_MAIN_STEP;
|
|
569
|
+
exports.UI_TINT_STEP = UI_TINT_STEP;
|
|
487
570
|
exports.contrastRatio = contrastRatio;
|
|
488
571
|
exports.isHexColor = isHexColor;
|
|
489
572
|
exports.meetsContrast = meetsContrast;
|
|
@@ -491,5 +574,6 @@ exports.relativeLuminance = relativeLuminance;
|
|
|
491
574
|
exports.toCssVars = toCssVars;
|
|
492
575
|
exports.toRnTheme = toRnTheme;
|
|
493
576
|
exports.toTailwindPreset = toTailwindPreset;
|
|
577
|
+
exports.toUiTheme = toUiTheme;
|
|
494
578
|
//# sourceMappingURL=index.js.map
|
|
495
579
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/varNames.ts","../src/emit/toCssVars.ts","../src/emit/toRnTheme.ts","../src/emit/toTailwindPreset.ts","../src/presets/aml.ts","../src/presets/erevna.ts","../src/presets/katalogos.ts","../src/presets/index.ts","../src/contrast.ts"],"names":[],"mappings":";;;AA+FO,IAAM,qBAAA,GAAqC;AAAA,EAChD,OAAA,EAAS,WAAA;AAAA,EACT,SAAA,EAAW,aAAA;AAAA,EACX,MAAA,EAAQ,UAAA;AAAA,EACR,OAAA,EAAS,WAAA;AAAA,EACT,OAAA,EAAS,WAAA;AAAA,EACT,KAAA,EAAO,SAAA;AAAA,EACP,IAAA,EAAM,QAAA;AAAA,EACN,eAAA,EAAiB,cAAA;AAAA,EACjB,YAAA,EAAc,WAAA;AAAA,EACd,oBAAA,EAAsB,oBAAA;AAAA,EACtB,SAAA,EAAW,QAAA;AAAA,EACX,kBAAA,EAAoB,kBAAA;AAAA,EACpB,WAAA,EAAa,UAAA;AAAA,EACb,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AA;AACrE,EAAA,MAAM,KAAA,GAAQ,gBAAA,CAAiB,YAAA,CAAa,MAAA,EAAQ,oBAAoB,CAAC,CAAA;AACzE,EAAA,MAAM,IAAA,GAAO,gBAAA,CAAiB,YAAA,CAAa,MAAA,EAAQ,mBAAmB,CAAC,CAAA;AAEvE,EAAA,OACE,oBAAA,GAAuB,GAAA,GACvB,sBAAA,GAAyB,KAAA,GACzB,qBAAA,GAAwB,IAAA;AAE5B;AAMO,SAAS,aAAA,CAAc,YAAoB,UAAA,EAA4B;AAC5E,EAAA,MAAM,KAAA,GAAQ,kBAAkB,UAAU,CAAA;AAC1C,EAAA,MAAM,MAAA,GAAS,kBAAkB,UAAU,CAAA;AAC3C,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,GAAA,CAAI,KAAA,EAAO,MAAM,CAAA;AACtC,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,GAAA,CAAI,KAAA,EAAO,MAAM,CAAA;AACrC,EAAA,OAAA,CAAQ,OAAA,GAAU,mBAAmB,MAAA,GAAS,cAAA,CAAA;AAChD;AAGO,SAAS,aAAA,CACd,UAAA,EACA,UAAA,EACA,aAAA,EACS;AACT,EAAA,OAAO,aAAA,CAAc,UAAA,EAAY,UAAU,CAAA,IAAK,aAAA;AAClD","file":"index.js","sourcesContent":["/**\n * CSS custom-property NAME MAPS — the cross-stack naming contract.\n *\n * `toCssVars(tokens, names)` reads a {@link DesignTokens} and a {@link CssVarNames}\n * map that says which CSS variable each token field is emitted as. A field whose\n * name is `undefined` in the map is skipped, which lets a stack emit only the\n * variables it actually consumes.\n *\n * Two maps ship:\n * - {@link DEFAULT_CSS_VAR_NAMES} — canonical kebab names (`--primary`, `--bg`, …).\n * The dark-mode fields have names, so a dark-mode block is emitted.\n * - {@link AML_CSS_VAR_NAMES} — the vanilla-JS AML console's existing variable\n * names (`--brand`, `--shell`, `--ok`, `--r`, …), so `wwwroot/shared/ui.css`\n * keeps working byte-for-byte. Core fields that AML expresses via an extension\n * variable are mapped to `undefined` (skipped) to avoid emitting duplicates,\n * and the dark-mode fields are `undefined` (AML has no light/dark toggle — its\n * dark app-shell is captured in the `shell*` extension inside `:root`).\n */\n\n/** Maps each {@link DesignTokens} field to the CSS variable it is emitted as (or `undefined` to skip). */\nexport interface CssVarNames {\n // brand\n primary?: string;\n secondary?: string;\n accent?: string;\n // semantic\n success?: string;\n warning?: string;\n error?: string;\n info?: string;\n // light-mode colours (emitted in :root)\n lightBackground?: string;\n lightSurface?: string;\n lightSurfaceElevated?: string;\n lightText?: string;\n lightTextSecondary?: string;\n lightBorder?: string;\n lightDivider?: string;\n // dark-mode colours (emitted in the dark selector block; omit all to skip the block)\n darkBackground?: string;\n darkSurface?: string;\n darkSurfaceElevated?: string;\n darkText?: string;\n darkTextSecondary?: string;\n darkBorder?: string;\n darkDivider?: string;\n // radii\n radiusXs?: string;\n radiusSm?: string;\n radiusMd?: string;\n radiusLg?: string;\n radiusPill?: string;\n // shadows\n shadowSm?: string;\n shadowMd?: string;\n shadowPop?: string;\n // fonts\n fontFamily?: string;\n monoFamily?: string;\n // extensions — shell\n shellBackground?: string;\n shellBackgroundAlt?: string;\n shellLine?: string;\n shellOn?: string;\n shellOnDim?: string;\n // extensions — brand extras\n brandPress?: string;\n brandSoft?: string;\n brandRing?: string;\n // extensions — ink scale\n inkBase?: string;\n inkSoft?: string;\n inkFaint?: string;\n inkOverlay?: string;\n // extensions — workspace extras\n surfaceAlt?: string;\n lineStrong?: string;\n // extensions — verdict palette\n ok?: string;\n okSoft?: string;\n okInk?: string;\n warn?: string;\n warnSoft?: string;\n warnInk?: string;\n bad?: string;\n badSoft?: string;\n badSoft2?: string;\n badInk?: string;\n}\n\n/**\n * Canonical kebab-case variable names. A stack with no existing CSS-variable\n * convention (or a fresh consumer) should adopt these. Extension fields are\n * omitted because the RN/DOM presets carry no extensions.\n */\nexport const DEFAULT_CSS_VAR_NAMES: CssVarNames = {\n primary: '--primary',\n secondary: '--secondary',\n accent: '--accent',\n success: '--success',\n warning: '--warning',\n error: '--error',\n info: '--info',\n lightBackground: '--background',\n lightSurface: '--surface',\n lightSurfaceElevated: '--surface-elevated',\n lightText: '--text',\n lightTextSecondary: '--text-secondary',\n lightBorder: '--border',\n lightDivider: '--divider',\n darkBackground: '--background',\n darkSurface: '--surface',\n darkSurfaceElevated: '--surface-elevated',\n darkText: '--text',\n darkTextSecondary: '--text-secondary',\n darkBorder: '--border',\n darkDivider: '--divider',\n radiusXs: '--radius-xs',\n radiusSm: '--radius-sm',\n radiusMd: '--radius',\n radiusLg: '--radius-lg',\n radiusPill: '--radius-pill',\n shadowSm: '--shadow-sm',\n shadowMd: '--shadow',\n shadowPop: '--shadow-pop',\n fontFamily: '--font',\n monoFamily: '--font-mono',\n};\n\n/**\n * The AML console's existing `wwwroot/shared/ui.css` variable names. Emitting the\n * `aml` preset with this map reproduces AML's current `:root` byte-for-byte, so\n * ui.css keeps working with zero visual change.\n *\n * Core fields that AML already expresses through an extension variable are mapped\n * to `undefined` to avoid duplicate declarations:\n * - `secondary`/`accent` — AML has a single brand; ui.css never reads them.\n * - `success`/`warning`/`error`/`info` — emitted via the verdict extension\n * (`--ok`/`--warn`/`--bad`); `info` has no AML variable.\n * - `light.surfaceElevated` → via `workspace.surfaceAlt` (`--surface-2`).\n * - `light.text` → via `ink.base` (`--ink`); `light.textSecondary` → `ink.soft`.\n * - `light.divider` — AML reuses `--line`, so no separate variable.\n * - all `dark*` — AML has no dark-mode toggle (its shell lives in the extension).\n */\nexport const AML_CSS_VAR_NAMES: CssVarNames = {\n primary: '--brand',\n // secondary/accent intentionally omitted (single-brand console)\n // semantic emitted via verdict extension; info has no AML variable\n lightBackground: '--bg',\n lightSurface: '--surface',\n // lightSurfaceElevated via workspace.surfaceAlt (--surface-2)\n // lightText via ink.base (--ink); lightTextSecondary via ink.soft (--ink-soft)\n lightBorder: '--line',\n // lightDivider reuses --line\n // dark* omitted (no dark-mode toggle)\n radiusXs: '--r-xs',\n radiusSm: '--r-sm',\n radiusMd: '--r',\n radiusLg: '--r-lg',\n radiusPill: '--r-pill',\n shadowSm: '--sh-1',\n shadowMd: '--sh-2',\n shadowPop: '--sh-pop',\n fontFamily: '--font',\n monoFamily: '--mono',\n shellBackground: '--shell',\n shellBackgroundAlt: '--shell-2',\n shellLine: '--shell-line',\n shellOn: '--on-shell',\n shellOnDim: '--on-shell-dim',\n brandPress: '--brand-press',\n brandSoft: '--brand-soft',\n brandRing: '--brand-ring',\n inkBase: '--ink',\n inkSoft: '--ink-soft',\n inkFaint: '--ink-faint',\n inkOverlay: '--ink-2',\n surfaceAlt: '--surface-2',\n lineStrong: '--line-strong',\n ok: '--ok',\n okSoft: '--ok-soft',\n okInk: '--ok-ink',\n warn: '--warn',\n warnSoft: '--warn-soft',\n warnInk: '--warn-ink',\n bad: '--bad',\n badSoft: '--bad-soft',\n badSoft2: '--bad-soft2',\n badInk: '--bad-ink',\n};\n","import type { DesignTokens } from '../types';\nimport type { CssVarNames } from '../varNames';\n\n/** Options for {@link toCssVars}. */\nexport interface ToCssVarsOptions {\n /**\n * Selector for the dark-mode block. Only used when the name map defines any\n * `dark*` variables. Defaults to `:root[data-theme=\"dark\"]`.\n */\n darkSelector?: string;\n}\n\nconst INDENT = ' ';\nconst DEFAULT_DARK_SELECTOR = ':root[data-theme=\"dark\"]';\n\n/** A single ` --name: value;` line, or `null` when the name or value is absent. */\nfunction declaration(name: string | undefined, value: string | undefined): string | null {\n if (name === undefined || value === undefined) {\n return null;\n }\n return `${INDENT}${name}: ${value};`;\n}\n\nfunction isLine(entry: string | null): entry is string {\n return entry !== null;\n}\n\nfunction block(selector: string, lines: readonly string[]): string {\n return `${selector} {\\n${lines.join('\\n')}\\n}`;\n}\n\n/**\n * Emit a {@link DesignTokens} as CSS custom properties. Base tokens (brand,\n * semantic, light-mode, radii, shadows, fonts and any extensions) go in a\n * `:root {}` block; dark-mode tokens go in a separate selector block, emitted\n * only when the name map defines at least one `dark*` variable.\n */\nexport function toCssVars(\n tokens: DesignTokens,\n names: CssVarNames,\n options?: ToCssVarsOptions,\n): string {\n const ext = tokens.extensions;\n const baseEntries: Array<string | null> = [\n declaration(names.primary, tokens.primary),\n declaration(names.secondary, tokens.secondary),\n declaration(names.accent, tokens.accent),\n declaration(names.success, tokens.semantic.success),\n declaration(names.warning, tokens.semantic.warning),\n declaration(names.error, tokens.semantic.error),\n declaration(names.info, tokens.semantic.info),\n declaration(names.lightBackground, tokens.light.background),\n declaration(names.lightSurface, tokens.light.surface),\n declaration(names.lightSurfaceElevated, tokens.light.surfaceElevated),\n declaration(names.lightText, tokens.light.text),\n declaration(names.lightTextSecondary, tokens.light.textSecondary),\n declaration(names.lightBorder, tokens.light.border),\n declaration(names.lightDivider, tokens.light.divider),\n declaration(names.radiusXs, tokens.radii?.xs),\n declaration(names.radiusSm, tokens.radii?.sm),\n declaration(names.radiusMd, tokens.radii?.md),\n declaration(names.radiusLg, tokens.radii?.lg),\n declaration(names.radiusPill, tokens.radii?.pill),\n declaration(names.shadowSm, tokens.shadows?.sm),\n declaration(names.shadowMd, tokens.shadows?.md),\n declaration(names.shadowPop, tokens.shadows?.pop),\n declaration(names.fontFamily, tokens.typography?.fontFamily),\n declaration(names.monoFamily, tokens.typography?.monoFamily),\n declaration(names.shellBackground, ext?.shell?.background),\n declaration(names.shellBackgroundAlt, ext?.shell?.backgroundAlt),\n declaration(names.shellLine, ext?.shell?.line),\n declaration(names.shellOn, ext?.shell?.on),\n declaration(names.shellOnDim, ext?.shell?.onDim),\n declaration(names.brandPress, ext?.brand?.press),\n declaration(names.brandSoft, ext?.brand?.soft),\n declaration(names.brandRing, ext?.brand?.ring),\n declaration(names.inkBase, ext?.ink?.base),\n declaration(names.inkSoft, ext?.ink?.soft),\n declaration(names.inkFaint, ext?.ink?.faint),\n declaration(names.inkOverlay, ext?.ink?.overlay),\n declaration(names.surfaceAlt, ext?.workspace?.surfaceAlt),\n declaration(names.lineStrong, ext?.workspace?.lineStrong),\n declaration(names.ok, ext?.verdict?.ok),\n declaration(names.okSoft, ext?.verdict?.okSoft),\n declaration(names.okInk, ext?.verdict?.okInk),\n declaration(names.warn, ext?.verdict?.warn),\n declaration(names.warnSoft, ext?.verdict?.warnSoft),\n declaration(names.warnInk, ext?.verdict?.warnInk),\n declaration(names.bad, ext?.verdict?.bad),\n declaration(names.badSoft, ext?.verdict?.badSoft),\n declaration(names.badSoft2, ext?.verdict?.badSoft2),\n declaration(names.badInk, ext?.verdict?.badInk),\n ];\n const baseBlock = block(':root', baseEntries.filter(isLine));\n\n const darkEntries: Array<string | null> = [\n declaration(names.darkBackground, tokens.dark.background),\n declaration(names.darkSurface, tokens.dark.surface),\n declaration(names.darkSurfaceElevated, tokens.dark.surfaceElevated),\n declaration(names.darkText, tokens.dark.text),\n declaration(names.darkTextSecondary, tokens.dark.textSecondary),\n declaration(names.darkBorder, tokens.dark.border),\n declaration(names.darkDivider, tokens.dark.divider),\n ];\n const darkLines = darkEntries.filter(isLine);\n if (darkLines.length === 0) {\n return baseBlock;\n }\n\n const selector = options?.darkSelector ?? DEFAULT_DARK_SELECTOR;\n return `${baseBlock}\\n\\n${block(selector, darkLines)}`;\n}\n","import type { Branding, DesignTokens, ModeColors } from '../types';\n\n/**\n * The RN-web theme-config shape. Structurally compatible with\n * `@dloizides/tenant-theme-web`'s `TenantThemeConfig` (and each RN app's local\n * `TenantThemeConfig`), so a preset can be dropped in as the `defaultThemeConfig`\n * fallback without any mapping. Semantic and typography are optional (an RN app\n * may leave them unset, exactly as the current `default` preset does).\n */\nexport interface RnThemeConfig {\n primary: string;\n secondary: string;\n accent: string;\n semantic?: { success?: string; warning?: string; error?: string; info?: string };\n light: ModeColors;\n dark: ModeColors;\n typography?: { fontFamily?: string; headingScale?: number };\n branding: Branding;\n}\n\n/**\n * Emit a {@link DesignTokens} as an RN-web `TenantThemeConfig`-compatible object.\n * Only the core fields are projected; the `radii`/`shadows`/`extensions`\n * supersets are intentionally dropped (RN-web has no centralized token for them).\n * `typography` is included only when the preset defines it, so a preset with no\n * typography yields a config with no `typography` key — byte-identical to the RN\n * apps' current `DEFAULT_THEME_CONFIG`.\n */\nexport function toRnTheme(tokens: DesignTokens): RnThemeConfig {\n const config: RnThemeConfig = {\n primary: tokens.primary,\n secondary: tokens.secondary,\n accent: tokens.accent,\n semantic: { ...tokens.semantic },\n light: { ...tokens.light },\n dark: { ...tokens.dark },\n branding: { ...tokens.branding },\n };\n if (tokens.typography !== undefined) {\n config.typography = {\n fontFamily: tokens.typography.fontFamily,\n headingScale: tokens.typography.headingScale,\n };\n }\n return config;\n}\n","import type { DesignTokens } from '../types';\n\n/** Nested colour scale emitted under `theme.extend.colors`. */\nexport interface TailwindColors {\n primary: string;\n secondary: string;\n accent: string;\n success: string;\n warning: string;\n error: string;\n info: string;\n background: string;\n surface: string;\n 'surface-elevated': string;\n text: string;\n 'text-secondary': string;\n border: string;\n divider: string;\n dark: {\n background: string;\n surface: string;\n 'surface-elevated': string;\n text: string;\n 'text-secondary': string;\n border: string;\n divider: string;\n };\n}\n\n/** A Tailwind preset object: `{ theme: { extend: { … } } }`. Spread into a `tailwind.config`'s `presets`. */\nexport interface TailwindPreset {\n theme: {\n extend: {\n colors: TailwindColors;\n borderRadius?: Record<string, string>;\n boxShadow?: Record<string, string>;\n fontFamily?: Record<string, string[]>;\n };\n };\n}\n\n/**\n * Emit a {@link DesignTokens} as a Tailwind preset for the DOM-React ThemeStudio.\n * Colours are always present; `borderRadius`/`boxShadow`/`fontFamily` are emitted\n * only when the preset defines the corresponding token group.\n */\nexport function toTailwindPreset(tokens: DesignTokens): TailwindPreset {\n const colors: TailwindColors = {\n primary: tokens.primary,\n secondary: tokens.secondary,\n accent: tokens.accent,\n success: tokens.semantic.success,\n warning: tokens.semantic.warning,\n error: tokens.semantic.error,\n info: tokens.semantic.info,\n background: tokens.light.background,\n surface: tokens.light.surface,\n 'surface-elevated': tokens.light.surfaceElevated,\n text: tokens.light.text,\n 'text-secondary': tokens.light.textSecondary,\n border: tokens.light.border,\n divider: tokens.light.divider,\n dark: {\n background: tokens.dark.background,\n surface: tokens.dark.surface,\n 'surface-elevated': tokens.dark.surfaceElevated,\n text: tokens.dark.text,\n 'text-secondary': tokens.dark.textSecondary,\n border: tokens.dark.border,\n divider: tokens.dark.divider,\n },\n };\n\n const extend: TailwindPreset['theme']['extend'] = { colors };\n\n if (tokens.radii !== undefined) {\n extend.borderRadius = {\n xs: tokens.radii.xs,\n sm: tokens.radii.sm,\n DEFAULT: tokens.radii.md,\n lg: tokens.radii.lg,\n pill: tokens.radii.pill,\n };\n }\n if (tokens.shadows !== undefined) {\n extend.boxShadow = {\n sm: tokens.shadows.sm,\n DEFAULT: tokens.shadows.md,\n pop: tokens.shadows.pop,\n };\n }\n if (tokens.typography !== undefined) {\n const fontFamily: Record<string, string[]> = { sans: [tokens.typography.fontFamily] };\n if (tokens.typography.monoFamily !== undefined) {\n fontFamily.mono = [tokens.typography.monoFamily];\n }\n extend.fontFamily = fontFamily;\n }\n\n return { theme: { extend } };\n}\n","import type { DesignTokens } from '../types';\n\n/**\n * PROOViD AML console (Stack A — vanilla JS) tokens.\n *\n * Seeded byte-for-byte from `PROOViD/AMLService/AMLService/wwwroot/shared/ui.css`\n * `:root`. Emitting via `toCssVars(AML_TOKENS, AML_CSS_VAR_NAMES)` reproduces that\n * `:root` block exactly, so ui.css keeps working with zero visual change.\n *\n * Name-mapping notes (AML has no `TenantThemeConfig`-style secondary/accent or\n * light/dark toggle):\n * - `primary` = `--brand`. `secondary`/`accent` mirror it (ui.css reads neither);\n * they exist only so the core shape is complete.\n * - `semantic` mirrors the verdict palette (`--ok`/`--warn`/`--bad`); `info` has\n * no AML variable, so it mirrors `--brand`.\n * - `light` = the light workspace (`--bg`/`--surface`/…); `dark` = the dark app\n * SHELL (`--shell`/`--shell-2`/…) so the shape is complete. The AML name map\n * omits all `dark*` names, so no dark-mode block is emitted; the shell is\n * emitted from the `extensions.shell` group inside `:root`, matching ui.css.\n */\nexport const AML_TOKENS: DesignTokens = {\n primary: '#4f46e5',\n secondary: '#4f46e5',\n accent: '#4f46e5',\n\n semantic: {\n success: '#0c9d6c',\n warning: '#b9690a',\n error: '#d4302b',\n info: '#4f46e5',\n },\n\n light: {\n background: '#f4f6fa',\n surface: '#ffffff',\n surfaceElevated: '#f8fafc',\n text: '#0d1526',\n textSecondary: '#4a5567',\n border: '#e6e9f0',\n divider: '#e6e9f0',\n },\n\n dark: {\n background: '#0b1220',\n surface: '#111a2c',\n surfaceElevated: '#111a2c',\n text: '#e8edf6',\n textSecondary: '#95a3bb',\n border: 'rgba(255, 255, 255, .09)',\n divider: 'rgba(255, 255, 255, .09)',\n },\n\n typography: {\n fontFamily: '\"IBM Plex Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif',\n monoFamily: '\"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, monospace',\n headingScale: 1,\n },\n\n radii: {\n xs: '7px',\n sm: '9px',\n md: '12px',\n lg: '16px',\n pill: '999px',\n },\n\n shadows: {\n sm: '0 1px 2px rgba(13, 21, 38, .06)',\n md: '0 6px 20px -8px rgba(13, 21, 38, .14), 0 1px 2px rgba(13, 21, 38, .05)',\n pop: '0 24px 60px -16px rgba(13, 21, 38, .32)',\n },\n\n branding: {\n logoContentId: null,\n faviconContentId: null,\n presetId: 'aml',\n },\n\n extensions: {\n shell: {\n background: '#0b1220',\n backgroundAlt: '#111a2c',\n line: 'rgba(255, 255, 255, .09)',\n on: '#e8edf6',\n onDim: '#95a3bb',\n },\n brand: {\n press: '#4035c9',\n soft: '#eef0fe',\n ring: 'rgba(79, 70, 229, .16)',\n },\n ink: {\n base: '#0d1526',\n soft: '#4a5567',\n faint: '#75839a',\n overlay: '#46506220',\n },\n workspace: {\n surfaceAlt: '#f8fafc',\n lineStrong: '#d7dce6',\n },\n verdict: {\n ok: '#0c9d6c',\n okSoft: '#e4f6ef',\n okInk: '#0a7a55',\n warn: '#b9690a',\n warnSoft: '#fcf1e3',\n warnInk: '#985608',\n bad: '#d4302b',\n badSoft: '#fcebea',\n badSoft2: '#fdecec',\n badInk: '#b21f1f',\n },\n },\n};\n","import type { DesignTokens } from '../types';\n\n/**\n * Erevna (surveys/forms — realm `questioner`) tokens.\n *\n * Seeded byte-for-byte from `erevna-web/src/theme/presets/default.ts`\n * (`DEFAULT_THEME_CONFIG`) and `erevna-web/src/theme/utils/palette.ts`\n * (`basePalette`). No `typography`/`radii`/`shadows` — the RN theme has no\n * centralized tokens for those today, so they are omitted (nothing to emit →\n * zero visual change).\n *\n * ONE deliberate divergence from that seed (UX-11): `light.textSecondary` is\n * `#717171`, not the app's `#777777`. `#777777` measures 4.48:1 on `#ffffff` and\n * 4.18:1 on the `#f7f7f7` card surface — both under the WCAG AA 4.5:1 floor for\n * normal text, and form-field labels render in this colour. `#717171` measures\n * 4.88:1 and 4.56:1 against those same two surfaces. Do not \"restore\" it to\n * match the app; `presets.contrast.test.ts` will fail if you do. The app's own\n * local preset still carries `#777777` and needs the same fix separately.\n */\nexport const EREVNA_TOKENS: DesignTokens = {\n primary: '#005f73',\n secondary: '#94d2bd',\n accent: '#008d5c',\n\n semantic: {\n success: '#0a9396',\n warning: '#ee9b00',\n error: '#ae2012',\n info: '#005f73',\n },\n\n light: {\n background: '#ffffff',\n surface: '#f7f7f7',\n surfaceElevated: '#ffffff',\n text: '#001219',\n textSecondary: '#717171',\n border: '#e6e6e6',\n divider: '#e6e6e6',\n },\n\n dark: {\n background: '#001219',\n surface: '#052f33',\n surfaceElevated: '#073b40',\n text: '#e9d8a6',\n textSecondary: '#a8a090',\n border: '#053f40',\n divider: '#053f40',\n },\n\n branding: {\n logoContentId: null,\n faviconContentId: null,\n presetId: 'default',\n },\n};\n","import type { DesignTokens } from '../types';\n\n/**\n * Katalogos (online menus — realm `onlinemenu`) tokens.\n *\n * Seeded byte-for-byte from `katalogos-web/src/theme/presets/default.ts`\n * (`DEFAULT_THEME_CONFIG`), which is currently identical to Erevna's default.\n * Kept as a separate preset so the two apps can diverge later without touching\n * the other.\n *\n * ONE deliberate divergence from that seed (UX-11): `light.textSecondary` is\n * `#717171`, not the app's `#777777`. `#777777` measures 4.48:1 on `#ffffff` and\n * 4.18:1 on the `#f7f7f7` card surface — both under the WCAG AA 4.5:1 floor for\n * normal text, and form-field labels render in this colour. `#717171` measures\n * 4.88:1 and 4.56:1 against those same two surfaces. Do not \"restore\" it to\n * match the app; `presets.contrast.test.ts` will fail if you do. The app's own\n * local preset still carries `#777777` and needs the same fix separately.\n */\nexport const KATALOGOS_TOKENS: DesignTokens = {\n primary: '#005f73',\n secondary: '#94d2bd',\n accent: '#008d5c',\n\n semantic: {\n success: '#0a9396',\n warning: '#ee9b00',\n error: '#ae2012',\n info: '#005f73',\n },\n\n light: {\n background: '#ffffff',\n surface: '#f7f7f7',\n surfaceElevated: '#ffffff',\n text: '#001219',\n textSecondary: '#717171',\n border: '#e6e6e6',\n divider: '#e6e6e6',\n },\n\n dark: {\n background: '#001219',\n surface: '#052f33',\n surfaceElevated: '#073b40',\n text: '#e9d8a6',\n textSecondary: '#a8a090',\n border: '#053f40',\n divider: '#053f40',\n },\n\n branding: {\n logoContentId: null,\n faviconContentId: null,\n presetId: 'default',\n },\n};\n","import type { DesignTokens } from '../types';\n\nimport { AML_TOKENS } from './aml';\nimport { EREVNA_TOKENS } from './erevna';\nimport { KATALOGOS_TOKENS } from './katalogos';\n\nexport { AML_TOKENS } from './aml';\nexport { EREVNA_TOKENS } from './erevna';\nexport { KATALOGOS_TOKENS } from './katalogos';\n\n/** Every shipped app preset keyed by app slug. */\nexport const PRESETS: Readonly<Record<string, DesignTokens>> = {\n aml: AML_TOKENS,\n erevna: EREVNA_TOKENS,\n katalogos: KATALOGOS_TOKENS,\n};\n","/**\n * WCAG 2.1 contrast-ratio maths.\n *\n * Exists so every packaged preset can be *proved* accessible instead of\n * eyeballed. `presets/presets.contrast.test.ts` uses it as a permanent guard:\n * any future edit to a text-role colour that drops it under the AA floor fails\n * the build.\n *\n * This is a deliberate COPY of the same function in `@dloizides/theme-web`, not\n * an import. `@dloizides/design-tokens` ships zero dependencies and zero peers\n * by design — it is framework-agnostic values only — so taking a dependency on\n * a React theming package to borrow ~60 lines of pure arithmetic would invert\n * the layering (theme-web already depends on this package). The duplication is\n * bounded, pure, and pinned by `contrast.test.ts` against external reference\n * pairs, so the two copies cannot silently disagree.\n *\n * The relative-luminance formula is the real one from WCAG 2.1 §\"relative\n * luminance\" — sRGB channels are linearized through the gamma transfer function\n * before the ITU-R BT.709 weighting. A naive channel average (or an HSL\n * lightness comparison) is NOT equivalent and will silently pass colours that\n * fail in a browser, which is exactly how `#777777` shipped at 4.48:1.\n *\n * @see https://www.w3.org/TR/WCAG21/#dfn-relative-luminance\n * @see https://www.w3.org/TR/WCAG21/#dfn-contrast-ratio\n */\n\n/** WCAG 1.4.3 Contrast (Minimum), AA, normal-size text. */\nexport const AA_NORMAL_TEXT_RATIO = 4.5;\n/** WCAG 1.4.3 AA for large text (>=18.66px bold, or >=24px). */\nexport const AA_LARGE_TEXT_RATIO = 3;\n/** WCAG 1.4.11 Non-text Contrast — UI-component boundaries and graphical objects. */\nexport const AA_NON_TEXT_RATIO = 3;\n\nconst SRGB_CHANNEL_MAX = 255;\nconst GAMMA_LINEAR_THRESHOLD = 0.03928;\nconst GAMMA_LINEAR_DIVISOR = 12.92;\nconst GAMMA_OFFSET = 0.055;\nconst GAMMA_DIVISOR = 1.055;\nconst GAMMA_EXPONENT = 2.4;\n\n// ITU-R BT.709 luma coefficients, per the WCAG relative-luminance definition.\nconst LUMA_COEFFICIENT_RED = 0.2126;\nconst LUMA_COEFFICIENT_GREEN = 0.7152;\nconst LUMA_COEFFICIENT_BLUE = 0.0722;\n\n/** The +0.05 flare constant in the WCAG contrast-ratio formula. */\nconst CONTRAST_FLARE = 0.05;\n\nconst HEX_RADIX = 16;\nconst HEX_PAIR_LENGTH = 2;\nconst HEX_SHORTHAND_LENGTH = 3;\nconst HEX_FULL_LENGTH = 6;\nconst CHANNEL_OFFSET_RED = 0;\nconst CHANNEL_OFFSET_GREEN = 2;\nconst CHANNEL_OFFSET_BLUE = 4;\n\n/** Strip `#` and expand `#abc` to `aabbcc`, so both notations parse identically. */\nfunction normalizeHexDigits(hex: string): string {\n const clean = hex.trim().replace('#', '').toLowerCase();\n if (clean.length === HEX_SHORTHAND_LENGTH) {\n return `${clean[0] ?? ''}${clean[0] ?? ''}${clean[1] ?? ''}${clean[1] ?? ''}${clean[2] ?? ''}${clean[2] ?? ''}`;\n }\n return clean;\n}\n\nfunction parseChannel(digits: string, offset: number): number {\n const pair = digits.slice(offset, offset + HEX_PAIR_LENGTH);\n return parseInt(pair, HEX_RADIX) / SRGB_CHANNEL_MAX;\n}\n\n/** Undo the sRGB gamma transfer function for one 0-1 channel. */\nfunction linearizeChannel(channel: number): number {\n if (channel <= GAMMA_LINEAR_THRESHOLD) {\n return channel / GAMMA_LINEAR_DIVISOR;\n }\n return Math.pow((channel + GAMMA_OFFSET) / GAMMA_DIVISOR, GAMMA_EXPONENT);\n}\n\n/**\n * True when `value` is an `#rgb` / `#rrggbb` colour this module can score.\n *\n * Tokens may legitimately hold `rgba()` (AML's dark border is a white overlay),\n * which has no fixed luminance without knowing the backdrop. The guard uses this\n * to EXCLUDE such values explicitly rather than let them throw or, worse, be\n * silently skipped.\n */\nexport function isHexColor(value: string): boolean {\n const digits = normalizeHexDigits(value);\n return digits.length === HEX_FULL_LENGTH && /^[0-9a-f]{6}$/.test(digits);\n}\n\n/**\n * WCAG relative luminance (0 = black, 1 = white) of an `#rgb` / `#rrggbb` colour.\n *\n * @throws if the value is not a parseable hex colour — a typo must be loud, not\n * silently scored as black (which would make every ratio look compliant).\n */\nexport function relativeLuminance(hex: string): number {\n if (!isHexColor(hex)) {\n throw new Error(`relativeLuminance: not a hex colour: ${hex}`);\n }\n const digits = normalizeHexDigits(hex);\n\n const red = linearizeChannel(parseChannel(digits, CHANNEL_OFFSET_RED));\n const green = linearizeChannel(parseChannel(digits, CHANNEL_OFFSET_GREEN));\n const blue = linearizeChannel(parseChannel(digits, CHANNEL_OFFSET_BLUE));\n\n return (\n LUMA_COEFFICIENT_RED * red +\n LUMA_COEFFICIENT_GREEN * green +\n LUMA_COEFFICIENT_BLUE * blue\n );\n}\n\n/**\n * WCAG contrast ratio between two colours, in the range 1 (identical) to 21\n * (black on white). Order-independent.\n */\nexport function contrastRatio(foreground: string, background: string): number {\n const first = relativeLuminance(foreground);\n const second = relativeLuminance(background);\n const lighter = Math.max(first, second);\n const darker = Math.min(first, second);\n return (lighter + CONTRAST_FLARE) / (darker + CONTRAST_FLARE);\n}\n\n/** True when `foreground` on `background` meets `requiredRatio`. */\nexport function meetsContrast(\n foreground: string,\n background: string,\n requiredRatio: number,\n): boolean {\n return contrastRatio(foreground, background) >= requiredRatio;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/varNames.ts","../src/emit/toCssVars.ts","../src/emit/toRnTheme.ts","../src/emit/toTailwindPreset.ts","../src/emit/toUiTheme.ts","../src/presets/aml.ts","../src/presets/erevna.ts","../src/presets/katalogos.ts","../src/presets/index.ts","../src/contrast.ts"],"names":[],"mappings":";;;AAuGO,IAAM,qBAAA,GAAqC;AAAA,EAChD,OAAA,EAAS,WAAA;AAAA,EACT,SAAA,EAAW,aAAA;AAAA,EACX,MAAA,EAAQ,UAAA;AAAA,EACR,OAAA,EAAS,YAAA;AAAA,EACT,OAAA,EAAS,WAAA;AAAA,EACT,OAAA,EAAS,WAAA;AAAA,EACT,KAAA,EAAO,SAAA;AAAA,EACP,IAAA,EAAM,QAAA;AAAA,EACN,SAAA,EAAW,cAAA;AAAA,EACX,SAAA,EAAW,cAAA;AAAA,EACX,OAAA,EAAS,YAAA;AAAA,EACT,MAAA,EAAQ,WAAA;AAAA,EACR,eAAA,EAAiB,cAAA;AAAA,EACjB,YAAA,EAAc,WAAA;AAAA,EACd,oBAAA,EAAsB,oBAAA;AAAA,EACtB,iBAAA,EAAmB,iBAAA;AAAA,EACnB,SAAA,EAAW,QAAA;AAAA,EAC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4B;AAC5E,EAAA,MAAM,KAAA,GAAQ,kBAAkB,UAAU,CAAA;AAC1C,EAAA,MAAM,MAAA,GAAS,kBAAkB,UAAU,CAAA;AAC3C,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,GAAA,CAAI,KAAA,EAAO,MAAM,CAAA;AACtC,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,GAAA,CAAI,KAAA,EAAO,MAAM,CAAA;AACrC,EAAA,OAAA,CAAQ,OAAA,GAAU,mBAAmB,MAAA,GAAS,cAAA,CAAA;AAChD;AAGO,SAAS,aAAA,CACd,UAAA,EACA,UAAA,EACA,aAAA,EACS;AACT,EAAA,OAAO,aAAA,CAAc,UAAA,EAAY,UAAU,CAAA,IAAK,aAAA;AAClD","file":"index.js","sourcesContent":["/**\n * CSS custom-property NAME MAPS — the cross-stack naming contract.\n *\n * `toCssVars(tokens, names)` reads a {@link DesignTokens} and a {@link CssVarNames}\n * map that says which CSS variable each token field is emitted as. A field whose\n * name is `undefined` in the map is skipped, which lets a stack emit only the\n * variables it actually consumes.\n *\n * Two maps ship:\n * - {@link DEFAULT_CSS_VAR_NAMES} — canonical kebab names (`--primary`, `--bg`, …).\n * The dark-mode fields have names, so a dark-mode block is emitted.\n * - {@link AML_CSS_VAR_NAMES} — the vanilla-JS AML console's existing variable\n * names (`--brand`, `--shell`, `--ok`, `--r`, …), so `wwwroot/shared/ui.css`\n * keeps working byte-for-byte. Core fields that AML expresses via an extension\n * variable are mapped to `undefined` (skipped) to avoid emitting duplicates,\n * and the dark-mode fields are `undefined` (AML has no light/dark toggle — its\n * dark app-shell is captured in the `shell*` extension inside `:root`).\n */\n\n/** Maps each {@link DesignTokens} field to the CSS variable it is emitted as (or `undefined` to skip). */\nexport interface CssVarNames {\n // brand\n primary?: string;\n secondary?: string;\n accent?: string;\n onBrand?: string;\n // semantic\n success?: string;\n warning?: string;\n error?: string;\n info?: string;\n // semantic background tints\n successBg?: string;\n warningBg?: string;\n errorBg?: string;\n infoBg?: string;\n // light-mode colours (emitted in :root)\n lightBackground?: string;\n lightSurface?: string;\n lightSurfaceElevated?: string;\n lightSurfaceMuted?: string;\n lightText?: string;\n lightTextSecondary?: string;\n lightBorder?: string;\n lightDivider?: string;\n // dark-mode colours (emitted in the dark selector block; omit all to skip the block)\n darkBackground?: string;\n darkSurface?: string;\n darkSurfaceElevated?: string;\n darkSurfaceMuted?: string;\n darkText?: string;\n darkTextSecondary?: string;\n darkBorder?: string;\n darkDivider?: string;\n // radii\n radiusXs?: string;\n radiusSm?: string;\n radiusMd?: string;\n radiusLg?: string;\n radiusPill?: string;\n // shadows\n shadowSm?: string;\n shadowMd?: string;\n shadowPop?: string;\n // fonts\n fontFamily?: string;\n monoFamily?: string;\n // extensions — shell\n shellBackground?: string;\n shellBackgroundAlt?: string;\n shellLine?: string;\n shellOn?: string;\n shellOnDim?: string;\n // extensions — brand extras\n brandPress?: string;\n brandSoft?: string;\n brandRing?: string;\n // extensions — ink scale\n inkBase?: string;\n inkSoft?: string;\n inkFaint?: string;\n inkOverlay?: string;\n // extensions — workspace extras\n surfaceAlt?: string;\n lineStrong?: string;\n // extensions — verdict palette\n ok?: string;\n okSoft?: string;\n okInk?: string;\n warn?: string;\n warnSoft?: string;\n warnInk?: string;\n bad?: string;\n badSoft?: string;\n badSoft2?: string;\n badInk?: string;\n}\n\n/**\n * Canonical kebab-case variable names. A stack with no existing CSS-variable\n * convention (or a fresh consumer) should adopt these. Extension fields are\n * omitted because the RN/DOM presets carry no extensions.\n */\nexport const DEFAULT_CSS_VAR_NAMES: CssVarNames = {\n primary: '--primary',\n secondary: '--secondary',\n accent: '--accent',\n onBrand: '--on-brand',\n success: '--success',\n warning: '--warning',\n error: '--error',\n info: '--info',\n successBg: '--success-bg',\n warningBg: '--warning-bg',\n errorBg: '--error-bg',\n infoBg: '--info-bg',\n lightBackground: '--background',\n lightSurface: '--surface',\n lightSurfaceElevated: '--surface-elevated',\n lightSurfaceMuted: '--surface-muted',\n lightText: '--text',\n lightTextSecondary: '--text-secondary',\n lightBorder: '--border',\n lightDivider: '--divider',\n darkBackground: '--background',\n darkSurface: '--surface',\n darkSurfaceElevated: '--surface-elevated',\n darkSurfaceMuted: '--surface-muted',\n darkText: '--text',\n darkTextSecondary: '--text-secondary',\n darkBorder: '--border',\n darkDivider: '--divider',\n radiusXs: '--radius-xs',\n radiusSm: '--radius-sm',\n radiusMd: '--radius',\n radiusLg: '--radius-lg',\n radiusPill: '--radius-pill',\n shadowSm: '--shadow-sm',\n shadowMd: '--shadow',\n shadowPop: '--shadow-pop',\n fontFamily: '--font',\n monoFamily: '--font-mono',\n};\n\n/**\n * The AML console's existing `wwwroot/shared/ui.css` variable names. Emitting the\n * `aml` preset with this map reproduces AML's current `:root` byte-for-byte, so\n * ui.css keeps working with zero visual change.\n *\n * Core fields that AML already expresses through an extension variable are mapped\n * to `undefined` to avoid duplicate declarations:\n * - `secondary`/`accent` — AML has a single brand; ui.css never reads them.\n * - `success`/`warning`/`error`/`info` — emitted via the verdict extension\n * (`--ok`/`--warn`/`--bad`); `info` has no AML variable.\n * - `light.surfaceElevated` → via `workspace.surfaceAlt` (`--surface-2`).\n * - `light.text` → via `ink.base` (`--ink`); `light.textSecondary` → `ink.soft`.\n * - `light.divider` — AML reuses `--line`, so no separate variable.\n * - all `dark*` — AML has no dark-mode toggle (its shell lives in the extension).\n */\nexport const AML_CSS_VAR_NAMES: CssVarNames = {\n primary: '--brand',\n // secondary/accent intentionally omitted (single-brand console)\n // semantic emitted via verdict extension; info has no AML variable\n lightBackground: '--bg',\n lightSurface: '--surface',\n // lightSurfaceElevated via workspace.surfaceAlt (--surface-2)\n // lightText via ink.base (--ink); lightTextSecondary via ink.soft (--ink-soft)\n lightBorder: '--line',\n // lightDivider reuses --line\n // dark* omitted (no dark-mode toggle)\n radiusXs: '--r-xs',\n radiusSm: '--r-sm',\n radiusMd: '--r',\n radiusLg: '--r-lg',\n radiusPill: '--r-pill',\n shadowSm: '--sh-1',\n shadowMd: '--sh-2',\n shadowPop: '--sh-pop',\n fontFamily: '--font',\n monoFamily: '--mono',\n shellBackground: '--shell',\n shellBackgroundAlt: '--shell-2',\n shellLine: '--shell-line',\n shellOn: '--on-shell',\n shellOnDim: '--on-shell-dim',\n brandPress: '--brand-press',\n brandSoft: '--brand-soft',\n brandRing: '--brand-ring',\n inkBase: '--ink',\n inkSoft: '--ink-soft',\n inkFaint: '--ink-faint',\n inkOverlay: '--ink-2',\n surfaceAlt: '--surface-2',\n lineStrong: '--line-strong',\n ok: '--ok',\n okSoft: '--ok-soft',\n okInk: '--ok-ink',\n warn: '--warn',\n warnSoft: '--warn-soft',\n warnInk: '--warn-ink',\n bad: '--bad',\n badSoft: '--bad-soft',\n badSoft2: '--bad-soft2',\n badInk: '--bad-ink',\n};\n","import type { DesignTokens } from '../types';\nimport type { CssVarNames } from '../varNames';\n\n/** Options for {@link toCssVars}. */\nexport interface ToCssVarsOptions {\n /**\n * Selector for the dark-mode block. Only used when the name map defines any\n * `dark*` variables. Defaults to `:root[data-theme=\"dark\"]`.\n */\n darkSelector?: string;\n}\n\nconst INDENT = ' ';\nconst DEFAULT_DARK_SELECTOR = ':root[data-theme=\"dark\"]';\n\n/** A single ` --name: value;` line, or `null` when the name or value is absent. */\nfunction declaration(name: string | undefined, value: string | undefined): string | null {\n if (name === undefined || value === undefined) {\n return null;\n }\n return `${INDENT}${name}: ${value};`;\n}\n\nfunction isLine(entry: string | null): entry is string {\n return entry !== null;\n}\n\nfunction block(selector: string, lines: readonly string[]): string {\n return `${selector} {\\n${lines.join('\\n')}\\n}`;\n}\n\n/**\n * Emit a {@link DesignTokens} as CSS custom properties. Base tokens (brand,\n * semantic, light-mode, radii, shadows, fonts and any extensions) go in a\n * `:root {}` block; dark-mode tokens go in a separate selector block, emitted\n * only when the name map defines at least one `dark*` variable.\n */\nexport function toCssVars(\n tokens: DesignTokens,\n names: CssVarNames,\n options?: ToCssVarsOptions,\n): string {\n const ext = tokens.extensions;\n const baseEntries: Array<string | null> = [\n declaration(names.primary, tokens.primary),\n declaration(names.secondary, tokens.secondary),\n declaration(names.accent, tokens.accent),\n declaration(names.onBrand, tokens.onBrand),\n declaration(names.success, tokens.semantic.success),\n declaration(names.warning, tokens.semantic.warning),\n declaration(names.error, tokens.semantic.error),\n declaration(names.info, tokens.semantic.info),\n declaration(names.successBg, tokens.semantic.successBg),\n declaration(names.warningBg, tokens.semantic.warningBg),\n declaration(names.errorBg, tokens.semantic.errorBg),\n declaration(names.infoBg, tokens.semantic.infoBg),\n declaration(names.lightBackground, tokens.light.background),\n declaration(names.lightSurface, tokens.light.surface),\n declaration(names.lightSurfaceElevated, tokens.light.surfaceElevated),\n declaration(names.lightSurfaceMuted, tokens.light.surfaceMuted),\n declaration(names.lightText, tokens.light.text),\n declaration(names.lightTextSecondary, tokens.light.textSecondary),\n declaration(names.lightBorder, tokens.light.border),\n declaration(names.lightDivider, tokens.light.divider),\n declaration(names.radiusXs, tokens.radii?.xs),\n declaration(names.radiusSm, tokens.radii?.sm),\n declaration(names.radiusMd, tokens.radii?.md),\n declaration(names.radiusLg, tokens.radii?.lg),\n declaration(names.radiusPill, tokens.radii?.pill),\n declaration(names.shadowSm, tokens.shadows?.sm),\n declaration(names.shadowMd, tokens.shadows?.md),\n declaration(names.shadowPop, tokens.shadows?.pop),\n declaration(names.fontFamily, tokens.typography?.fontFamily),\n declaration(names.monoFamily, tokens.typography?.monoFamily),\n declaration(names.shellBackground, ext?.shell?.background),\n declaration(names.shellBackgroundAlt, ext?.shell?.backgroundAlt),\n declaration(names.shellLine, ext?.shell?.line),\n declaration(names.shellOn, ext?.shell?.on),\n declaration(names.shellOnDim, ext?.shell?.onDim),\n declaration(names.brandPress, ext?.brand?.press),\n declaration(names.brandSoft, ext?.brand?.soft),\n declaration(names.brandRing, ext?.brand?.ring),\n declaration(names.inkBase, ext?.ink?.base),\n declaration(names.inkSoft, ext?.ink?.soft),\n declaration(names.inkFaint, ext?.ink?.faint),\n declaration(names.inkOverlay, ext?.ink?.overlay),\n declaration(names.surfaceAlt, ext?.workspace?.surfaceAlt),\n declaration(names.lineStrong, ext?.workspace?.lineStrong),\n declaration(names.ok, ext?.verdict?.ok),\n declaration(names.okSoft, ext?.verdict?.okSoft),\n declaration(names.okInk, ext?.verdict?.okInk),\n declaration(names.warn, ext?.verdict?.warn),\n declaration(names.warnSoft, ext?.verdict?.warnSoft),\n declaration(names.warnInk, ext?.verdict?.warnInk),\n declaration(names.bad, ext?.verdict?.bad),\n declaration(names.badSoft, ext?.verdict?.badSoft),\n declaration(names.badSoft2, ext?.verdict?.badSoft2),\n declaration(names.badInk, ext?.verdict?.badInk),\n ];\n const baseBlock = block(':root', baseEntries.filter(isLine));\n\n const darkEntries: Array<string | null> = [\n declaration(names.darkBackground, tokens.dark.background),\n declaration(names.darkSurface, tokens.dark.surface),\n declaration(names.darkSurfaceElevated, tokens.dark.surfaceElevated),\n declaration(names.darkSurfaceMuted, tokens.dark.surfaceMuted),\n declaration(names.darkText, tokens.dark.text),\n declaration(names.darkTextSecondary, tokens.dark.textSecondary),\n declaration(names.darkBorder, tokens.dark.border),\n declaration(names.darkDivider, tokens.dark.divider),\n ];\n const darkLines = darkEntries.filter(isLine);\n if (darkLines.length === 0) {\n return baseBlock;\n }\n\n const selector = options?.darkSelector ?? DEFAULT_DARK_SELECTOR;\n return `${baseBlock}\\n\\n${block(selector, darkLines)}`;\n}\n","import type { Branding, DesignTokens, ModeColors } from '../types';\n\n/**\n * The RN-web theme-config shape. Structurally compatible with\n * `@dloizides/tenant-theme-web`'s `TenantThemeConfig` (and each RN app's local\n * `TenantThemeConfig`), so a preset can be dropped in as the `defaultThemeConfig`\n * fallback without any mapping. Semantic and typography are optional (an RN app\n * may leave them unset, exactly as the current `default` preset does).\n */\nexport interface RnThemeConfig {\n primary: string;\n secondary: string;\n accent: string;\n semantic?: { success?: string; warning?: string; error?: string; info?: string };\n light: ModeColors;\n dark: ModeColors;\n typography?: { fontFamily?: string; headingScale?: number };\n branding: Branding;\n}\n\n/**\n * Emit a {@link DesignTokens} as an RN-web `TenantThemeConfig`-compatible object.\n * Only the core fields are projected; the `radii`/`shadows`/`extensions`\n * supersets are intentionally dropped (RN-web has no centralized token for them).\n * `typography` is included only when the preset defines it, so a preset with no\n * typography yields a config with no `typography` key — byte-identical to the RN\n * apps' current `DEFAULT_THEME_CONFIG`.\n */\nexport function toRnTheme(tokens: DesignTokens): RnThemeConfig {\n const config: RnThemeConfig = {\n primary: tokens.primary,\n secondary: tokens.secondary,\n accent: tokens.accent,\n semantic: { ...tokens.semantic },\n light: { ...tokens.light },\n dark: { ...tokens.dark },\n branding: { ...tokens.branding },\n };\n if (tokens.typography !== undefined) {\n config.typography = {\n fontFamily: tokens.typography.fontFamily,\n headingScale: tokens.typography.headingScale,\n };\n }\n return config;\n}\n","import type { DesignTokens } from '../types';\n\n/** Nested colour scale emitted under `theme.extend.colors`. */\nexport interface TailwindColors {\n primary: string;\n secondary: string;\n accent: string;\n /** Emitted only when the preset declares `onBrand`. */\n 'on-brand'?: string;\n success: string;\n warning: string;\n error: string;\n info: string;\n /** Status background tints. Emitted only when the preset declares them. */\n 'success-bg'?: string;\n 'warning-bg'?: string;\n 'error-bg'?: string;\n 'info-bg'?: string;\n background: string;\n surface: string;\n 'surface-elevated': string;\n /** Emitted only when the preset declares `light.surfaceMuted`. */\n 'surface-muted'?: string;\n text: string;\n 'text-secondary': string;\n border: string;\n divider: string;\n dark: {\n background: string;\n surface: string;\n 'surface-elevated': string;\n /** Emitted only when the preset declares `dark.surfaceMuted`. */\n 'surface-muted'?: string;\n text: string;\n 'text-secondary': string;\n border: string;\n divider: string;\n };\n}\n\n/** A Tailwind preset object: `{ theme: { extend: { … } } }`. Spread into a `tailwind.config`'s `presets`. */\nexport interface TailwindPreset {\n theme: {\n extend: {\n colors: TailwindColors;\n borderRadius?: Record<string, string>;\n boxShadow?: Record<string, string>;\n fontFamily?: Record<string, string[]>;\n };\n };\n}\n\n/**\n * Add the optional colour tokens, each only when the preset declares it — so a\n * preset that predates these slots emits a byte-identical colour object.\n */\nfunction addOptionalColors(colors: TailwindColors, tokens: DesignTokens): void {\n const { semantic } = tokens;\n if (tokens.onBrand !== undefined) {\n colors['on-brand'] = tokens.onBrand;\n }\n if (semantic.successBg !== undefined) {\n colors['success-bg'] = semantic.successBg;\n }\n if (semantic.warningBg !== undefined) {\n colors['warning-bg'] = semantic.warningBg;\n }\n if (semantic.errorBg !== undefined) {\n colors['error-bg'] = semantic.errorBg;\n }\n if (semantic.infoBg !== undefined) {\n colors['info-bg'] = semantic.infoBg;\n }\n if (tokens.light.surfaceMuted !== undefined) {\n colors['surface-muted'] = tokens.light.surfaceMuted;\n }\n if (tokens.dark.surfaceMuted !== undefined) {\n colors.dark['surface-muted'] = tokens.dark.surfaceMuted;\n }\n}\n\n/**\n * Emit a {@link DesignTokens} as a Tailwind preset for the DOM-React ThemeStudio.\n * The core colours are always present; the optional colour slots,\n * `borderRadius`/`boxShadow`/`fontFamily` are emitted only when the preset\n * defines the corresponding token.\n */\nexport function toTailwindPreset(tokens: DesignTokens): TailwindPreset {\n const colors: TailwindColors = {\n primary: tokens.primary,\n secondary: tokens.secondary,\n accent: tokens.accent,\n success: tokens.semantic.success,\n warning: tokens.semantic.warning,\n error: tokens.semantic.error,\n info: tokens.semantic.info,\n background: tokens.light.background,\n surface: tokens.light.surface,\n 'surface-elevated': tokens.light.surfaceElevated,\n text: tokens.light.text,\n 'text-secondary': tokens.light.textSecondary,\n border: tokens.light.border,\n divider: tokens.light.divider,\n dark: {\n background: tokens.dark.background,\n surface: tokens.dark.surface,\n 'surface-elevated': tokens.dark.surfaceElevated,\n text: tokens.dark.text,\n 'text-secondary': tokens.dark.textSecondary,\n border: tokens.dark.border,\n divider: tokens.dark.divider,\n },\n };\n addOptionalColors(colors, tokens);\n\n const extend: TailwindPreset['theme']['extend'] = { colors };\n\n if (tokens.radii !== undefined) {\n extend.borderRadius = {\n xs: tokens.radii.xs,\n sm: tokens.radii.sm,\n DEFAULT: tokens.radii.md,\n lg: tokens.radii.lg,\n pill: tokens.radii.pill,\n };\n }\n if (tokens.shadows !== undefined) {\n extend.boxShadow = {\n sm: tokens.shadows.sm,\n DEFAULT: tokens.shadows.md,\n pop: tokens.shadows.pop,\n };\n }\n if (tokens.typography !== undefined) {\n const fontFamily: Record<string, string[]> = { sans: [tokens.typography.fontFamily] };\n if (tokens.typography.monoFamily !== undefined) {\n fontFamily.mono = [tokens.typography.monoFamily];\n }\n extend.fontFamily = fontFamily;\n }\n\n return { theme: { extend } };\n}\n","/**\n * Emit a {@link DesignTokens} as the shared RN UI kit's theme object — the value\n * `@dloizides/ui-feedback`'s `UiProvider` broadcasts and every kit component\n * (NavShell, DataTable, Filters, Pager, StatusBadge, ThemedTextInput, StatCard)\n * reads via `useUi()`.\n *\n * WHY THIS LIVES HERE\n * -------------------\n * Two apps (ichnos, kefi) independently wrote the same adapter, and both hit the\n * same wall: a naive projection assigns ONE value to every step of a scale, which\n * silently discards the deeper brand step and the status background tints. Each\n * then bolted a private overlay onto the result to smuggle the lost values into\n * free slots. That overlay is this function, done twice — so it belongs in the\n * token package, where the token shape that lost the values is defined.\n *\n * The emitted theme is a LOSSLESS carrier: every token the shape can express has\n * an addressable slot, so an app can round-trip its whole palette back out\n * (see the `*Colors` accessors in each app) instead of keeping a parallel static\n * copy that cannot follow a dark-mode toggle or a per-tenant brand.\n *\n * The type is declared structurally here rather than imported, exactly as\n * {@link RnThemeConfig} declares the `TenantThemeConfig` shape: this package\n * stays framework-agnostic and takes no dependency on the kit it feeds.\n */\nimport type { DesignTokens, ModeColors } from '../types';\n\n/** Flat colour fields the kit reads directly. Mirrors `ui-feedback`'s `FeedbackThemeColors`. */\nexport interface UiThemeColors {\n background: string;\n surface: string;\n surfaceElevated: string;\n text: string;\n textSecondary: string;\n border: string;\n}\n\n/** A colour scale. The `500` step is guaranteed; other steps are addressable. */\nexport interface UiColorScale {\n '500': string;\n [step: string]: string;\n}\n\n/** Brand scales. `primary` is guaranteed; other names are addressable. */\nexport interface UiThemePalette {\n primary: UiColorScale;\n [name: string]: UiColorScale;\n}\n\n/** Status scales. `error` is guaranteed; other names are addressable. */\nexport interface UiThemeSemantic {\n error: UiColorScale;\n [name: string]: UiColorScale;\n}\n\n/** The kit theme. Structurally identical to `@dloizides/ui-feedback`'s `UiTheme`. */\nexport interface UiThemeConfig {\n colors: UiThemeColors;\n palette: UiThemePalette;\n semantic: UiThemeSemantic;\n}\n\n/** Which mode block ({@link DesignTokens.light} / {@link DesignTokens.dark}) to project. */\nexport type UiThemeMode = 'light' | 'dark';\n\n/** The soft/tint step of a scale — status background tints, muted brand fills. */\nexport const UI_TINT_STEP = '100';\n/** The step every shipped kit component reads. */\nexport const UI_MAIN_STEP = '500';\n/** The deep/pressed step of a scale. */\nexport const UI_DEEP_STEP = '700';\n\n/**\n * Fallback foreground for a `primary`-filled surface when a preset declares no\n * {@link DesignTokens.onBrand}. White is correct for a saturated brand; a preset\n * with a pale primary must set `onBrand` rather than rely on this.\n */\nconst DEFAULT_ON_BRAND = '#ffffff';\n\n/** Palette scale carrying the on-brand foreground. */\nconst ON_BRAND_SCALE = 'onBrand';\n/** Palette scale carrying the muted inset surface. */\nconst SURFACE_MUTED_SCALE = 'surfaceMuted';\n\n/**\n * A colour with no distinct tint or deep variant, expressed as a full scale so\n * every step is addressable and no consumer reads `undefined`.\n */\nfunction flat(value: string): UiColorScale {\n return { [UI_TINT_STEP]: value, [UI_MAIN_STEP]: value, [UI_DEEP_STEP]: value };\n}\n\n/**\n * A status scale: the base at `500`/`700` and its background tint at `100`.\n * Falls back to a flat scale when the preset declares no tint, so behaviour is\n * unchanged for presets that predate the `*Bg` slots.\n */\nfunction tinted(base: string, tint: string | undefined): UiColorScale {\n return { [UI_TINT_STEP]: tint ?? base, [UI_MAIN_STEP]: base, [UI_DEEP_STEP]: base };\n}\n\n/**\n * Project a token set onto the shared kit's theme shape.\n *\n * Every value is carried into an addressable slot:\n * - `palette.primary` / `secondary` / `accent` — the brand scales.\n * - `palette.onBrand` — {@link DesignTokens.onBrand}, the primary's contrast partner.\n * - `palette.surfaceMuted` — the mode's {@link ModeColors.surfaceMuted}.\n * - `semantic.*` — each status colour at `500`, its `*Bg` tint at `100`.\n *\n * @param tokens the app's token set\n * @param mode which mode block to project (default `'light'`)\n */\nexport function toUiTheme(tokens: DesignTokens, mode: UiThemeMode = 'light'): UiThemeConfig {\n const modeColors: ModeColors = mode === 'dark' ? tokens.dark : tokens.light;\n const { semantic } = tokens;\n return {\n colors: {\n background: modeColors.background,\n surface: modeColors.surface,\n surfaceElevated: modeColors.surfaceElevated,\n text: modeColors.text,\n textSecondary: modeColors.textSecondary,\n border: modeColors.border,\n },\n palette: {\n primary: flat(tokens.primary),\n secondary: flat(tokens.secondary),\n accent: flat(tokens.accent),\n [ON_BRAND_SCALE]: flat(tokens.onBrand ?? DEFAULT_ON_BRAND),\n [SURFACE_MUTED_SCALE]: flat(modeColors.surfaceMuted ?? modeColors.surface),\n },\n semantic: {\n error: tinted(semantic.error, semantic.errorBg),\n success: tinted(semantic.success, semantic.successBg),\n warning: tinted(semantic.warning, semantic.warningBg),\n info: tinted(semantic.info, semantic.infoBg),\n },\n };\n}\n","import type { DesignTokens } from '../types';\n\n/**\n * PROOViD AML console (Stack A — vanilla JS) tokens.\n *\n * Seeded byte-for-byte from `PROOViD/AMLService/AMLService/wwwroot/shared/ui.css`\n * `:root`. Emitting via `toCssVars(AML_TOKENS, AML_CSS_VAR_NAMES)` reproduces that\n * `:root` block exactly, so ui.css keeps working with zero visual change.\n *\n * Name-mapping notes (AML has no `TenantThemeConfig`-style secondary/accent or\n * light/dark toggle):\n * - `primary` = `--brand`. `secondary`/`accent` mirror it (ui.css reads neither);\n * they exist only so the core shape is complete.\n * - `semantic` mirrors the verdict palette (`--ok`/`--warn`/`--bad`); `info` has\n * no AML variable, so it mirrors `--brand`.\n * - `light` = the light workspace (`--bg`/`--surface`/…); `dark` = the dark app\n * SHELL (`--shell`/`--shell-2`/…) so the shape is complete. The AML name map\n * omits all `dark*` names, so no dark-mode block is emitted; the shell is\n * emitted from the `extensions.shell` group inside `:root`, matching ui.css.\n */\nexport const AML_TOKENS: DesignTokens = {\n primary: '#4f46e5',\n secondary: '#4f46e5',\n accent: '#4f46e5',\n\n semantic: {\n success: '#0c9d6c',\n warning: '#b9690a',\n error: '#d4302b',\n info: '#4f46e5',\n },\n\n light: {\n background: '#f4f6fa',\n surface: '#ffffff',\n surfaceElevated: '#f8fafc',\n text: '#0d1526',\n textSecondary: '#4a5567',\n border: '#e6e9f0',\n divider: '#e6e9f0',\n },\n\n dark: {\n background: '#0b1220',\n surface: '#111a2c',\n surfaceElevated: '#111a2c',\n text: '#e8edf6',\n textSecondary: '#95a3bb',\n border: 'rgba(255, 255, 255, .09)',\n divider: 'rgba(255, 255, 255, .09)',\n },\n\n typography: {\n fontFamily: '\"IBM Plex Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif',\n monoFamily: '\"IBM Plex Mono\", ui-monospace, SFMono-Regular, Menlo, monospace',\n headingScale: 1,\n },\n\n radii: {\n xs: '7px',\n sm: '9px',\n md: '12px',\n lg: '16px',\n pill: '999px',\n },\n\n shadows: {\n sm: '0 1px 2px rgba(13, 21, 38, .06)',\n md: '0 6px 20px -8px rgba(13, 21, 38, .14), 0 1px 2px rgba(13, 21, 38, .05)',\n pop: '0 24px 60px -16px rgba(13, 21, 38, .32)',\n },\n\n branding: {\n logoContentId: null,\n faviconContentId: null,\n presetId: 'aml',\n },\n\n extensions: {\n shell: {\n background: '#0b1220',\n backgroundAlt: '#111a2c',\n line: 'rgba(255, 255, 255, .09)',\n on: '#e8edf6',\n onDim: '#95a3bb',\n },\n brand: {\n press: '#4035c9',\n soft: '#eef0fe',\n ring: 'rgba(79, 70, 229, .16)',\n },\n ink: {\n base: '#0d1526',\n soft: '#4a5567',\n faint: '#75839a',\n overlay: '#46506220',\n },\n workspace: {\n surfaceAlt: '#f8fafc',\n lineStrong: '#d7dce6',\n },\n verdict: {\n ok: '#0c9d6c',\n okSoft: '#e4f6ef',\n okInk: '#0a7a55',\n warn: '#b9690a',\n warnSoft: '#fcf1e3',\n warnInk: '#985608',\n bad: '#d4302b',\n badSoft: '#fcebea',\n badSoft2: '#fdecec',\n badInk: '#b21f1f',\n },\n },\n};\n","import type { DesignTokens } from '../types';\n\n/**\n * Erevna (surveys/forms — realm `questioner`) tokens.\n *\n * Seeded byte-for-byte from `erevna-web/src/theme/presets/default.ts`\n * (`DEFAULT_THEME_CONFIG`) and `erevna-web/src/theme/utils/palette.ts`\n * (`basePalette`). No `typography`/`radii`/`shadows` — the RN theme has no\n * centralized tokens for those today, so they are omitted (nothing to emit →\n * zero visual change).\n *\n * ONE deliberate divergence from that seed (UX-11): `light.textSecondary` is\n * `#717171`, not the app's `#777777`. `#777777` measures 4.48:1 on `#ffffff` and\n * 4.18:1 on the `#f7f7f7` card surface — both under the WCAG AA 4.5:1 floor for\n * normal text, and form-field labels render in this colour. `#717171` measures\n * 4.88:1 and 4.56:1 against those same two surfaces. Do not \"restore\" it to\n * match the app; `presets.contrast.test.ts` will fail if you do. The app's own\n * local preset still carries `#777777` and needs the same fix separately.\n */\nexport const EREVNA_TOKENS: DesignTokens = {\n primary: '#005f73',\n secondary: '#94d2bd',\n accent: '#008d5c',\n\n semantic: {\n success: '#0a9396',\n warning: '#ee9b00',\n error: '#ae2012',\n info: '#005f73',\n },\n\n light: {\n background: '#ffffff',\n surface: '#f7f7f7',\n surfaceElevated: '#ffffff',\n text: '#001219',\n textSecondary: '#717171',\n border: '#e6e6e6',\n divider: '#e6e6e6',\n },\n\n dark: {\n background: '#001219',\n surface: '#052f33',\n surfaceElevated: '#073b40',\n text: '#e9d8a6',\n textSecondary: '#a8a090',\n border: '#053f40',\n divider: '#053f40',\n },\n\n branding: {\n logoContentId: null,\n faviconContentId: null,\n presetId: 'default',\n },\n};\n","import type { DesignTokens } from '../types';\n\n/**\n * Katalogos (online menus — realm `onlinemenu`) tokens.\n *\n * Seeded byte-for-byte from `katalogos-web/src/theme/presets/default.ts`\n * (`DEFAULT_THEME_CONFIG`), which is currently identical to Erevna's default.\n * Kept as a separate preset so the two apps can diverge later without touching\n * the other.\n *\n * ONE deliberate divergence from that seed (UX-11): `light.textSecondary` is\n * `#717171`, not the app's `#777777`. `#777777` measures 4.48:1 on `#ffffff` and\n * 4.18:1 on the `#f7f7f7` card surface — both under the WCAG AA 4.5:1 floor for\n * normal text, and form-field labels render in this colour. `#717171` measures\n * 4.88:1 and 4.56:1 against those same two surfaces. Do not \"restore\" it to\n * match the app; `presets.contrast.test.ts` will fail if you do. The app's own\n * local preset still carries `#777777` and needs the same fix separately.\n */\nexport const KATALOGOS_TOKENS: DesignTokens = {\n primary: '#005f73',\n secondary: '#94d2bd',\n accent: '#008d5c',\n\n semantic: {\n success: '#0a9396',\n warning: '#ee9b00',\n error: '#ae2012',\n info: '#005f73',\n },\n\n light: {\n background: '#ffffff',\n surface: '#f7f7f7',\n surfaceElevated: '#ffffff',\n text: '#001219',\n textSecondary: '#717171',\n border: '#e6e6e6',\n divider: '#e6e6e6',\n },\n\n dark: {\n background: '#001219',\n surface: '#052f33',\n surfaceElevated: '#073b40',\n text: '#e9d8a6',\n textSecondary: '#a8a090',\n border: '#053f40',\n divider: '#053f40',\n },\n\n branding: {\n logoContentId: null,\n faviconContentId: null,\n presetId: 'default',\n },\n};\n","import type { DesignTokens } from '../types';\n\nimport { AML_TOKENS } from './aml';\nimport { EREVNA_TOKENS } from './erevna';\nimport { KATALOGOS_TOKENS } from './katalogos';\n\nexport { AML_TOKENS } from './aml';\nexport { EREVNA_TOKENS } from './erevna';\nexport { KATALOGOS_TOKENS } from './katalogos';\n\n/** Every shipped app preset keyed by app slug. */\nexport const PRESETS: Readonly<Record<string, DesignTokens>> = {\n aml: AML_TOKENS,\n erevna: EREVNA_TOKENS,\n katalogos: KATALOGOS_TOKENS,\n};\n","/**\n * WCAG 2.1 contrast-ratio maths.\n *\n * Exists so every packaged preset can be *proved* accessible instead of\n * eyeballed. `presets/presets.contrast.test.ts` uses it as a permanent guard:\n * any future edit to a text-role colour that drops it under the AA floor fails\n * the build.\n *\n * This is a deliberate COPY of the same function in `@dloizides/theme-web`, not\n * an import. `@dloizides/design-tokens` ships zero dependencies and zero peers\n * by design — it is framework-agnostic values only — so taking a dependency on\n * a React theming package to borrow ~60 lines of pure arithmetic would invert\n * the layering (theme-web already depends on this package). The duplication is\n * bounded, pure, and pinned by `contrast.test.ts` against external reference\n * pairs, so the two copies cannot silently disagree.\n *\n * The relative-luminance formula is the real one from WCAG 2.1 §\"relative\n * luminance\" — sRGB channels are linearized through the gamma transfer function\n * before the ITU-R BT.709 weighting. A naive channel average (or an HSL\n * lightness comparison) is NOT equivalent and will silently pass colours that\n * fail in a browser, which is exactly how `#777777` shipped at 4.48:1.\n *\n * @see https://www.w3.org/TR/WCAG21/#dfn-relative-luminance\n * @see https://www.w3.org/TR/WCAG21/#dfn-contrast-ratio\n */\n\n/** WCAG 1.4.3 Contrast (Minimum), AA, normal-size text. */\nexport const AA_NORMAL_TEXT_RATIO = 4.5;\n/** WCAG 1.4.3 AA for large text (>=18.66px bold, or >=24px). */\nexport const AA_LARGE_TEXT_RATIO = 3;\n/** WCAG 1.4.11 Non-text Contrast — UI-component boundaries and graphical objects. */\nexport const AA_NON_TEXT_RATIO = 3;\n\nconst SRGB_CHANNEL_MAX = 255;\nconst GAMMA_LINEAR_THRESHOLD = 0.03928;\nconst GAMMA_LINEAR_DIVISOR = 12.92;\nconst GAMMA_OFFSET = 0.055;\nconst GAMMA_DIVISOR = 1.055;\nconst GAMMA_EXPONENT = 2.4;\n\n// ITU-R BT.709 luma coefficients, per the WCAG relative-luminance definition.\nconst LUMA_COEFFICIENT_RED = 0.2126;\nconst LUMA_COEFFICIENT_GREEN = 0.7152;\nconst LUMA_COEFFICIENT_BLUE = 0.0722;\n\n/** The +0.05 flare constant in the WCAG contrast-ratio formula. */\nconst CONTRAST_FLARE = 0.05;\n\nconst HEX_RADIX = 16;\nconst HEX_PAIR_LENGTH = 2;\nconst HEX_SHORTHAND_LENGTH = 3;\nconst HEX_FULL_LENGTH = 6;\nconst CHANNEL_OFFSET_RED = 0;\nconst CHANNEL_OFFSET_GREEN = 2;\nconst CHANNEL_OFFSET_BLUE = 4;\n\n/** Strip `#` and expand `#abc` to `aabbcc`, so both notations parse identically. */\nfunction normalizeHexDigits(hex: string): string {\n const clean = hex.trim().replace('#', '').toLowerCase();\n if (clean.length === HEX_SHORTHAND_LENGTH) {\n return `${clean[0] ?? ''}${clean[0] ?? ''}${clean[1] ?? ''}${clean[1] ?? ''}${clean[2] ?? ''}${clean[2] ?? ''}`;\n }\n return clean;\n}\n\nfunction parseChannel(digits: string, offset: number): number {\n const pair = digits.slice(offset, offset + HEX_PAIR_LENGTH);\n return parseInt(pair, HEX_RADIX) / SRGB_CHANNEL_MAX;\n}\n\n/** Undo the sRGB gamma transfer function for one 0-1 channel. */\nfunction linearizeChannel(channel: number): number {\n if (channel <= GAMMA_LINEAR_THRESHOLD) {\n return channel / GAMMA_LINEAR_DIVISOR;\n }\n return Math.pow((channel + GAMMA_OFFSET) / GAMMA_DIVISOR, GAMMA_EXPONENT);\n}\n\n/**\n * True when `value` is an `#rgb` / `#rrggbb` colour this module can score.\n *\n * Tokens may legitimately hold `rgba()` (AML's dark border is a white overlay),\n * which has no fixed luminance without knowing the backdrop. The guard uses this\n * to EXCLUDE such values explicitly rather than let them throw or, worse, be\n * silently skipped.\n */\nexport function isHexColor(value: string): boolean {\n const digits = normalizeHexDigits(value);\n return digits.length === HEX_FULL_LENGTH && /^[0-9a-f]{6}$/.test(digits);\n}\n\n/**\n * WCAG relative luminance (0 = black, 1 = white) of an `#rgb` / `#rrggbb` colour.\n *\n * @throws if the value is not a parseable hex colour — a typo must be loud, not\n * silently scored as black (which would make every ratio look compliant).\n */\nexport function relativeLuminance(hex: string): number {\n if (!isHexColor(hex)) {\n throw new Error(`relativeLuminance: not a hex colour: ${hex}`);\n }\n const digits = normalizeHexDigits(hex);\n\n const red = linearizeChannel(parseChannel(digits, CHANNEL_OFFSET_RED));\n const green = linearizeChannel(parseChannel(digits, CHANNEL_OFFSET_GREEN));\n const blue = linearizeChannel(parseChannel(digits, CHANNEL_OFFSET_BLUE));\n\n return (\n LUMA_COEFFICIENT_RED * red +\n LUMA_COEFFICIENT_GREEN * green +\n LUMA_COEFFICIENT_BLUE * blue\n );\n}\n\n/**\n * WCAG contrast ratio between two colours, in the range 1 (identical) to 21\n * (black on white). Order-independent.\n */\nexport function contrastRatio(foreground: string, background: string): number {\n const first = relativeLuminance(foreground);\n const second = relativeLuminance(background);\n const lighter = Math.max(first, second);\n const darker = Math.min(first, second);\n return (lighter + CONTRAST_FLARE) / (darker + CONTRAST_FLARE);\n}\n\n/** True when `foreground` on `background` meets `requiredRatio`. */\nexport function meetsContrast(\n foreground: string,\n background: string,\n requiredRatio: number,\n): boolean {\n return contrastRatio(foreground, background) >= requiredRatio;\n}\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -3,13 +3,19 @@ var DEFAULT_CSS_VAR_NAMES = {
|
|
|
3
3
|
primary: "--primary",
|
|
4
4
|
secondary: "--secondary",
|
|
5
5
|
accent: "--accent",
|
|
6
|
+
onBrand: "--on-brand",
|
|
6
7
|
success: "--success",
|
|
7
8
|
warning: "--warning",
|
|
8
9
|
error: "--error",
|
|
9
10
|
info: "--info",
|
|
11
|
+
successBg: "--success-bg",
|
|
12
|
+
warningBg: "--warning-bg",
|
|
13
|
+
errorBg: "--error-bg",
|
|
14
|
+
infoBg: "--info-bg",
|
|
10
15
|
lightBackground: "--background",
|
|
11
16
|
lightSurface: "--surface",
|
|
12
17
|
lightSurfaceElevated: "--surface-elevated",
|
|
18
|
+
lightSurfaceMuted: "--surface-muted",
|
|
13
19
|
lightText: "--text",
|
|
14
20
|
lightTextSecondary: "--text-secondary",
|
|
15
21
|
lightBorder: "--border",
|
|
@@ -17,6 +23,7 @@ var DEFAULT_CSS_VAR_NAMES = {
|
|
|
17
23
|
darkBackground: "--background",
|
|
18
24
|
darkSurface: "--surface",
|
|
19
25
|
darkSurfaceElevated: "--surface-elevated",
|
|
26
|
+
darkSurfaceMuted: "--surface-muted",
|
|
20
27
|
darkText: "--text",
|
|
21
28
|
darkTextSecondary: "--text-secondary",
|
|
22
29
|
darkBorder: "--border",
|
|
@@ -102,13 +109,19 @@ function toCssVars(tokens, names, options) {
|
|
|
102
109
|
declaration(names.primary, tokens.primary),
|
|
103
110
|
declaration(names.secondary, tokens.secondary),
|
|
104
111
|
declaration(names.accent, tokens.accent),
|
|
112
|
+
declaration(names.onBrand, tokens.onBrand),
|
|
105
113
|
declaration(names.success, tokens.semantic.success),
|
|
106
114
|
declaration(names.warning, tokens.semantic.warning),
|
|
107
115
|
declaration(names.error, tokens.semantic.error),
|
|
108
116
|
declaration(names.info, tokens.semantic.info),
|
|
117
|
+
declaration(names.successBg, tokens.semantic.successBg),
|
|
118
|
+
declaration(names.warningBg, tokens.semantic.warningBg),
|
|
119
|
+
declaration(names.errorBg, tokens.semantic.errorBg),
|
|
120
|
+
declaration(names.infoBg, tokens.semantic.infoBg),
|
|
109
121
|
declaration(names.lightBackground, tokens.light.background),
|
|
110
122
|
declaration(names.lightSurface, tokens.light.surface),
|
|
111
123
|
declaration(names.lightSurfaceElevated, tokens.light.surfaceElevated),
|
|
124
|
+
declaration(names.lightSurfaceMuted, tokens.light.surfaceMuted),
|
|
112
125
|
declaration(names.lightText, tokens.light.text),
|
|
113
126
|
declaration(names.lightTextSecondary, tokens.light.textSecondary),
|
|
114
127
|
declaration(names.lightBorder, tokens.light.border),
|
|
@@ -153,6 +166,7 @@ function toCssVars(tokens, names, options) {
|
|
|
153
166
|
declaration(names.darkBackground, tokens.dark.background),
|
|
154
167
|
declaration(names.darkSurface, tokens.dark.surface),
|
|
155
168
|
declaration(names.darkSurfaceElevated, tokens.dark.surfaceElevated),
|
|
169
|
+
declaration(names.darkSurfaceMuted, tokens.dark.surfaceMuted),
|
|
156
170
|
declaration(names.darkText, tokens.dark.text),
|
|
157
171
|
declaration(names.darkTextSecondary, tokens.dark.textSecondary),
|
|
158
172
|
declaration(names.darkBorder, tokens.dark.border),
|
|
@@ -189,6 +203,30 @@ function toRnTheme(tokens) {
|
|
|
189
203
|
}
|
|
190
204
|
|
|
191
205
|
// src/emit/toTailwindPreset.ts
|
|
206
|
+
function addOptionalColors(colors, tokens) {
|
|
207
|
+
const { semantic } = tokens;
|
|
208
|
+
if (tokens.onBrand !== void 0) {
|
|
209
|
+
colors["on-brand"] = tokens.onBrand;
|
|
210
|
+
}
|
|
211
|
+
if (semantic.successBg !== void 0) {
|
|
212
|
+
colors["success-bg"] = semantic.successBg;
|
|
213
|
+
}
|
|
214
|
+
if (semantic.warningBg !== void 0) {
|
|
215
|
+
colors["warning-bg"] = semantic.warningBg;
|
|
216
|
+
}
|
|
217
|
+
if (semantic.errorBg !== void 0) {
|
|
218
|
+
colors["error-bg"] = semantic.errorBg;
|
|
219
|
+
}
|
|
220
|
+
if (semantic.infoBg !== void 0) {
|
|
221
|
+
colors["info-bg"] = semantic.infoBg;
|
|
222
|
+
}
|
|
223
|
+
if (tokens.light.surfaceMuted !== void 0) {
|
|
224
|
+
colors["surface-muted"] = tokens.light.surfaceMuted;
|
|
225
|
+
}
|
|
226
|
+
if (tokens.dark.surfaceMuted !== void 0) {
|
|
227
|
+
colors.dark["surface-muted"] = tokens.dark.surfaceMuted;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
192
230
|
function toTailwindPreset(tokens) {
|
|
193
231
|
const colors = {
|
|
194
232
|
primary: tokens.primary,
|
|
@@ -215,6 +253,7 @@ function toTailwindPreset(tokens) {
|
|
|
215
253
|
divider: tokens.dark.divider
|
|
216
254
|
}
|
|
217
255
|
};
|
|
256
|
+
addOptionalColors(colors, tokens);
|
|
218
257
|
const extend = { colors };
|
|
219
258
|
if (tokens.radii !== void 0) {
|
|
220
259
|
extend.borderRadius = {
|
|
@@ -242,6 +281,47 @@ function toTailwindPreset(tokens) {
|
|
|
242
281
|
return { theme: { extend } };
|
|
243
282
|
}
|
|
244
283
|
|
|
284
|
+
// src/emit/toUiTheme.ts
|
|
285
|
+
var UI_TINT_STEP = "100";
|
|
286
|
+
var UI_MAIN_STEP = "500";
|
|
287
|
+
var UI_DEEP_STEP = "700";
|
|
288
|
+
var DEFAULT_ON_BRAND = "#ffffff";
|
|
289
|
+
var ON_BRAND_SCALE = "onBrand";
|
|
290
|
+
var SURFACE_MUTED_SCALE = "surfaceMuted";
|
|
291
|
+
function flat(value) {
|
|
292
|
+
return { [UI_TINT_STEP]: value, [UI_MAIN_STEP]: value, [UI_DEEP_STEP]: value };
|
|
293
|
+
}
|
|
294
|
+
function tinted(base, tint) {
|
|
295
|
+
return { [UI_TINT_STEP]: tint ?? base, [UI_MAIN_STEP]: base, [UI_DEEP_STEP]: base };
|
|
296
|
+
}
|
|
297
|
+
function toUiTheme(tokens, mode = "light") {
|
|
298
|
+
const modeColors = mode === "dark" ? tokens.dark : tokens.light;
|
|
299
|
+
const { semantic } = tokens;
|
|
300
|
+
return {
|
|
301
|
+
colors: {
|
|
302
|
+
background: modeColors.background,
|
|
303
|
+
surface: modeColors.surface,
|
|
304
|
+
surfaceElevated: modeColors.surfaceElevated,
|
|
305
|
+
text: modeColors.text,
|
|
306
|
+
textSecondary: modeColors.textSecondary,
|
|
307
|
+
border: modeColors.border
|
|
308
|
+
},
|
|
309
|
+
palette: {
|
|
310
|
+
primary: flat(tokens.primary),
|
|
311
|
+
secondary: flat(tokens.secondary),
|
|
312
|
+
accent: flat(tokens.accent),
|
|
313
|
+
[ON_BRAND_SCALE]: flat(tokens.onBrand ?? DEFAULT_ON_BRAND),
|
|
314
|
+
[SURFACE_MUTED_SCALE]: flat(modeColors.surfaceMuted ?? modeColors.surface)
|
|
315
|
+
},
|
|
316
|
+
semantic: {
|
|
317
|
+
error: tinted(semantic.error, semantic.errorBg),
|
|
318
|
+
success: tinted(semantic.success, semantic.successBg),
|
|
319
|
+
warning: tinted(semantic.warning, semantic.warningBg),
|
|
320
|
+
info: tinted(semantic.info, semantic.infoBg)
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
|
|
245
325
|
// src/presets/aml.ts
|
|
246
326
|
var AML_TOKENS = {
|
|
247
327
|
primary: "#4f46e5",
|
|
@@ -473,6 +553,6 @@ function meetsContrast(foreground, background, requiredRatio) {
|
|
|
473
553
|
return contrastRatio(foreground, background) >= requiredRatio;
|
|
474
554
|
}
|
|
475
555
|
|
|
476
|
-
export { AA_LARGE_TEXT_RATIO, AA_NON_TEXT_RATIO, AA_NORMAL_TEXT_RATIO, AML_CSS_VAR_NAMES, AML_TOKENS, DEFAULT_CSS_VAR_NAMES, EREVNA_TOKENS, KATALOGOS_TOKENS, PRESETS, contrastRatio, isHexColor, meetsContrast, relativeLuminance, toCssVars, toRnTheme, toTailwindPreset };
|
|
556
|
+
export { AA_LARGE_TEXT_RATIO, AA_NON_TEXT_RATIO, AA_NORMAL_TEXT_RATIO, AML_CSS_VAR_NAMES, AML_TOKENS, DEFAULT_CSS_VAR_NAMES, EREVNA_TOKENS, KATALOGOS_TOKENS, PRESETS, UI_DEEP_STEP, UI_MAIN_STEP, UI_TINT_STEP, contrastRatio, isHexColor, meetsContrast, relativeLuminance, toCssVars, toRnTheme, toTailwindPreset, toUiTheme };
|
|
477
557
|
//# sourceMappingURL=index.mjs.map
|
|
478
558
|
//# sourceMappingURL=index.mjs.map
|