@dloizides/design-tokens 1.1.0 → 1.3.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 +77 -0
- package/README.md +42 -3
- package/dist/index.d.mts +187 -4
- package/dist/index.d.ts +187 -4
- package/dist/index.js +146 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +142 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -35,13 +35,36 @@ interface ModeColors {
|
|
|
35
35
|
border: string;
|
|
36
36
|
/** Divider lines */
|
|
37
37
|
divider: string;
|
|
38
|
+
/**
|
|
39
|
+
* Subtle inset surface — table header rows, chips, wells. Distinct from both
|
|
40
|
+
* `surface` (cards) and `surfaceElevated` (modals): it recedes rather than
|
|
41
|
+
* lifts. Optional; consumers fall back to `surface` when a preset omits it.
|
|
42
|
+
*/
|
|
43
|
+
surfaceMuted?: string;
|
|
38
44
|
}
|
|
39
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Semantic/status colours. The four base fields match `TenantThemeConfig`'s
|
|
47
|
+
* `SemanticColorOverrides` exactly.
|
|
48
|
+
*
|
|
49
|
+
* Each base colour may also carry a `*Bg` **background tint** — the soft fill a
|
|
50
|
+
* status badge, banner or row-highlight paints behind text of the base colour.
|
|
51
|
+
* A tint is NOT derivable from its base (it is hand-picked for contrast), so it
|
|
52
|
+
* needs its own slot; without one a status surface cannot be themed at all.
|
|
53
|
+
* Optional, so existing presets are unchanged.
|
|
54
|
+
*/
|
|
40
55
|
interface SemanticColors {
|
|
41
56
|
success: string;
|
|
42
57
|
warning: string;
|
|
43
58
|
error: string;
|
|
44
59
|
info: string;
|
|
60
|
+
/** Soft background tint behind `success` content. */
|
|
61
|
+
successBg?: string;
|
|
62
|
+
/** Soft background tint behind `warning` content. */
|
|
63
|
+
warningBg?: string;
|
|
64
|
+
/** Soft background tint behind `error` content. */
|
|
65
|
+
errorBg?: string;
|
|
66
|
+
/** Soft background tint behind `info` content. */
|
|
67
|
+
infoBg?: string;
|
|
45
68
|
}
|
|
46
69
|
/** Typography tokens. `fontFamily` mirrors `TenantThemeConfig`; `monoFamily` is an optional superset. */
|
|
47
70
|
interface Typography {
|
|
@@ -152,6 +175,14 @@ interface DesignTokens {
|
|
|
152
175
|
secondary: string;
|
|
153
176
|
/** Accent/highlight colour */
|
|
154
177
|
accent: string;
|
|
178
|
+
/**
|
|
179
|
+
* Foreground colour for content sitting ON a `primary`-filled surface — a
|
|
180
|
+
* filled button's label, a brand header's text. It is a *contrast partner* of
|
|
181
|
+
* `primary`, not a mode colour, so it lives beside it rather than in
|
|
182
|
+
* `light`/`dark`. Optional; consumers fall back to white, the safe default for
|
|
183
|
+
* a saturated brand. A preset with a pale `primary` MUST set it explicitly.
|
|
184
|
+
*/
|
|
185
|
+
onBrand?: string;
|
|
155
186
|
/** Semantic/status colours */
|
|
156
187
|
semantic: SemanticColors;
|
|
157
188
|
/** Light-mode colours */
|
|
@@ -193,13 +224,19 @@ interface CssVarNames {
|
|
|
193
224
|
primary?: string;
|
|
194
225
|
secondary?: string;
|
|
195
226
|
accent?: string;
|
|
227
|
+
onBrand?: string;
|
|
196
228
|
success?: string;
|
|
197
229
|
warning?: string;
|
|
198
230
|
error?: string;
|
|
199
231
|
info?: string;
|
|
232
|
+
successBg?: string;
|
|
233
|
+
warningBg?: string;
|
|
234
|
+
errorBg?: string;
|
|
235
|
+
infoBg?: string;
|
|
200
236
|
lightBackground?: string;
|
|
201
237
|
lightSurface?: string;
|
|
202
238
|
lightSurfaceElevated?: string;
|
|
239
|
+
lightSurfaceMuted?: string;
|
|
203
240
|
lightText?: string;
|
|
204
241
|
lightTextSecondary?: string;
|
|
205
242
|
lightBorder?: string;
|
|
@@ -207,6 +244,7 @@ interface CssVarNames {
|
|
|
207
244
|
darkBackground?: string;
|
|
208
245
|
darkSurface?: string;
|
|
209
246
|
darkSurfaceElevated?: string;
|
|
247
|
+
darkSurfaceMuted?: string;
|
|
210
248
|
darkText?: string;
|
|
211
249
|
darkTextSecondary?: string;
|
|
212
250
|
darkBorder?: string;
|
|
@@ -325,13 +363,22 @@ interface TailwindColors {
|
|
|
325
363
|
primary: string;
|
|
326
364
|
secondary: string;
|
|
327
365
|
accent: string;
|
|
366
|
+
/** Emitted only when the preset declares `onBrand`. */
|
|
367
|
+
'on-brand'?: string;
|
|
328
368
|
success: string;
|
|
329
369
|
warning: string;
|
|
330
370
|
error: string;
|
|
331
371
|
info: string;
|
|
372
|
+
/** Status background tints. Emitted only when the preset declares them. */
|
|
373
|
+
'success-bg'?: string;
|
|
374
|
+
'warning-bg'?: string;
|
|
375
|
+
'error-bg'?: string;
|
|
376
|
+
'info-bg'?: string;
|
|
332
377
|
background: string;
|
|
333
378
|
surface: string;
|
|
334
379
|
'surface-elevated': string;
|
|
380
|
+
/** Emitted only when the preset declares `light.surfaceMuted`. */
|
|
381
|
+
'surface-muted'?: string;
|
|
335
382
|
text: string;
|
|
336
383
|
'text-secondary': string;
|
|
337
384
|
border: string;
|
|
@@ -340,6 +387,8 @@ interface TailwindColors {
|
|
|
340
387
|
background: string;
|
|
341
388
|
surface: string;
|
|
342
389
|
'surface-elevated': string;
|
|
390
|
+
/** Emitted only when the preset declares `dark.surfaceMuted`. */
|
|
391
|
+
'surface-muted'?: string;
|
|
343
392
|
text: string;
|
|
344
393
|
'text-secondary': string;
|
|
345
394
|
border: string;
|
|
@@ -359,11 +408,89 @@ interface TailwindPreset {
|
|
|
359
408
|
}
|
|
360
409
|
/**
|
|
361
410
|
* Emit a {@link DesignTokens} as a Tailwind preset for the DOM-React ThemeStudio.
|
|
362
|
-
*
|
|
363
|
-
* only when the preset
|
|
411
|
+
* The core colours are always present; the optional colour slots,
|
|
412
|
+
* `borderRadius`/`boxShadow`/`fontFamily` are emitted only when the preset
|
|
413
|
+
* defines the corresponding token.
|
|
364
414
|
*/
|
|
365
415
|
declare function toTailwindPreset(tokens: DesignTokens): TailwindPreset;
|
|
366
416
|
|
|
417
|
+
/**
|
|
418
|
+
* Emit a {@link DesignTokens} as the shared RN UI kit's theme object — the value
|
|
419
|
+
* `@dloizides/ui-feedback`'s `UiProvider` broadcasts and every kit component
|
|
420
|
+
* (NavShell, DataTable, Filters, Pager, StatusBadge, ThemedTextInput, StatCard)
|
|
421
|
+
* reads via `useUi()`.
|
|
422
|
+
*
|
|
423
|
+
* WHY THIS LIVES HERE
|
|
424
|
+
* -------------------
|
|
425
|
+
* Two apps (ichnos, kefi) independently wrote the same adapter, and both hit the
|
|
426
|
+
* same wall: a naive projection assigns ONE value to every step of a scale, which
|
|
427
|
+
* silently discards the deeper brand step and the status background tints. Each
|
|
428
|
+
* then bolted a private overlay onto the result to smuggle the lost values into
|
|
429
|
+
* free slots. That overlay is this function, done twice — so it belongs in the
|
|
430
|
+
* token package, where the token shape that lost the values is defined.
|
|
431
|
+
*
|
|
432
|
+
* The emitted theme is a LOSSLESS carrier: every token the shape can express has
|
|
433
|
+
* an addressable slot, so an app can round-trip its whole palette back out
|
|
434
|
+
* (see the `*Colors` accessors in each app) instead of keeping a parallel static
|
|
435
|
+
* copy that cannot follow a dark-mode toggle or a per-tenant brand.
|
|
436
|
+
*
|
|
437
|
+
* The type is declared structurally here rather than imported, exactly as
|
|
438
|
+
* {@link RnThemeConfig} declares the `TenantThemeConfig` shape: this package
|
|
439
|
+
* stays framework-agnostic and takes no dependency on the kit it feeds.
|
|
440
|
+
*/
|
|
441
|
+
|
|
442
|
+
/** Flat colour fields the kit reads directly. Mirrors `ui-feedback`'s `FeedbackThemeColors`. */
|
|
443
|
+
interface UiThemeColors {
|
|
444
|
+
background: string;
|
|
445
|
+
surface: string;
|
|
446
|
+
surfaceElevated: string;
|
|
447
|
+
text: string;
|
|
448
|
+
textSecondary: string;
|
|
449
|
+
border: string;
|
|
450
|
+
}
|
|
451
|
+
/** A colour scale. The `500` step is guaranteed; other steps are addressable. */
|
|
452
|
+
interface UiColorScale {
|
|
453
|
+
'500': string;
|
|
454
|
+
[step: string]: string;
|
|
455
|
+
}
|
|
456
|
+
/** Brand scales. `primary` is guaranteed; other names are addressable. */
|
|
457
|
+
interface UiThemePalette {
|
|
458
|
+
primary: UiColorScale;
|
|
459
|
+
[name: string]: UiColorScale;
|
|
460
|
+
}
|
|
461
|
+
/** Status scales. `error` is guaranteed; other names are addressable. */
|
|
462
|
+
interface UiThemeSemantic {
|
|
463
|
+
error: UiColorScale;
|
|
464
|
+
[name: string]: UiColorScale;
|
|
465
|
+
}
|
|
466
|
+
/** The kit theme. Structurally identical to `@dloizides/ui-feedback`'s `UiTheme`. */
|
|
467
|
+
interface UiThemeConfig {
|
|
468
|
+
colors: UiThemeColors;
|
|
469
|
+
palette: UiThemePalette;
|
|
470
|
+
semantic: UiThemeSemantic;
|
|
471
|
+
}
|
|
472
|
+
/** Which mode block ({@link DesignTokens.light} / {@link DesignTokens.dark}) to project. */
|
|
473
|
+
type UiThemeMode = 'light' | 'dark';
|
|
474
|
+
/** The soft/tint step of a scale — status background tints, muted brand fills. */
|
|
475
|
+
declare const UI_TINT_STEP = "100";
|
|
476
|
+
/** The step every shipped kit component reads. */
|
|
477
|
+
declare const UI_MAIN_STEP = "500";
|
|
478
|
+
/** The deep/pressed step of a scale. */
|
|
479
|
+
declare const UI_DEEP_STEP = "700";
|
|
480
|
+
/**
|
|
481
|
+
* Project a token set onto the shared kit's theme shape.
|
|
482
|
+
*
|
|
483
|
+
* Every value is carried into an addressable slot:
|
|
484
|
+
* - `palette.primary` / `secondary` / `accent` — the brand scales.
|
|
485
|
+
* - `palette.onBrand` — {@link DesignTokens.onBrand}, the primary's contrast partner.
|
|
486
|
+
* - `palette.surfaceMuted` — the mode's {@link ModeColors.surfaceMuted}.
|
|
487
|
+
* - `semantic.*` — each status colour at `500`, its `*Bg` tint at `100`.
|
|
488
|
+
*
|
|
489
|
+
* @param tokens the app's token set
|
|
490
|
+
* @param mode which mode block to project (default `'light'`)
|
|
491
|
+
*/
|
|
492
|
+
declare function toUiTheme(tokens: DesignTokens, mode?: UiThemeMode): UiThemeConfig;
|
|
493
|
+
|
|
367
494
|
/**
|
|
368
495
|
* PROOViD AML console (Stack A — vanilla JS) tokens.
|
|
369
496
|
*
|
|
@@ -384,6 +511,62 @@ declare function toTailwindPreset(tokens: DesignTokens): TailwindPreset;
|
|
|
384
511
|
*/
|
|
385
512
|
declare const AML_TOKENS: DesignTokens;
|
|
386
513
|
|
|
514
|
+
/**
|
|
515
|
+
* Digital Kin (Greek digital-literacy guide site) tokens.
|
|
516
|
+
*
|
|
517
|
+
* Seeded from the Figma `Typography & Colors Style Guide` (design spec §8): green
|
|
518
|
+
* `#007E4A`, yellow `#FFAB00`, black, white. Unlike the aml/erevna/katalogos
|
|
519
|
+
* presets — which were extracted byte-for-byte from an existing running app — this
|
|
520
|
+
* preset is authored from the brand source, because the app does not exist yet.
|
|
521
|
+
* That difference is not cosmetic: those presets must preserve their app's current
|
|
522
|
+
* pixels, so their AA failures are frozen in `KNOWN_GAPS`. This one has no pixels
|
|
523
|
+
* to preserve, so it is held to the floor the guard actually asks for wherever
|
|
524
|
+
* that is arithmetically reachable (see `border` below).
|
|
525
|
+
*
|
|
526
|
+
* THE ACCENT IS A HIGHLIGHT, NOT A BUTTON COLOUR. `#FFAB00` is light: white text
|
|
527
|
+
* on it measures 1.90:1, nowhere near the 4.5:1 AA floor. It carries stars,
|
|
528
|
+
* focus rings, underlines and small ornaments, always with DARK ink on top
|
|
529
|
+
* (`light.text` on it measures 9.81:1). `digitalkin.test.ts` asserts BOTH halves
|
|
530
|
+
* of that, so "just make the CTA yellow" fails the build rather than shipping
|
|
531
|
+
* unreadable.
|
|
532
|
+
*
|
|
533
|
+
* TYPOGRAPHY (spec D21): Geologica ONLY. It covers Greek, Latin, Cyrillic and
|
|
534
|
+
* Vietnamese, and its `CRSV`/`SHRP` variable axes supply the display voice that
|
|
535
|
+
* DynaPuff would otherwise have provided. DynaPuff has NO Greek glyphs at all, and
|
|
536
|
+
* because browser font fallback is per-GLYPH rather than per-element, a heading
|
|
537
|
+
* like "Digital Kin — Ξεκινήστε εδώ" would render the Latin half in DynaPuff and
|
|
538
|
+
* the Greek half in an arbitrary system font, inside one element. It is therefore
|
|
539
|
+
* deliberately absent from this file: it exists only inside `wordmark.svg`, whose
|
|
540
|
+
* text is converted to vector paths and loads no font at all.
|
|
541
|
+
*
|
|
542
|
+
* Three deliberate divergences from the raw Figma palette, all for AA contrast on
|
|
543
|
+
* an audience of older users who are frequently outdoors:
|
|
544
|
+
* * `light.textSecondary` is `#5A5A5A` (6.41:1 on the `#F5F7F5` card, its worst
|
|
545
|
+
* surface) rather than a mid grey. A muted grey that fails AA is the single
|
|
546
|
+
* most common way a "designed" palette becomes unreadable, and this palette's
|
|
547
|
+
* secondary text carries guide intros and difficulty labels.
|
|
548
|
+
* * `border` is darker than a decorative hairline would be — `#7E8A80` (3.34:1
|
|
549
|
+
* on white) and `#6B7D71` (3.40:1 on the raised dark surface) — so it clears
|
|
550
|
+
* WCAG 1.4.11 as an INPUT OUTLINE. The other three presets have their light
|
|
551
|
+
* borders registered as known gaps because darkening a live portal's hairlines
|
|
552
|
+
* is a visual regression; this preset ships before any pixels exist, so it
|
|
553
|
+
* takes the compliant value instead of inheriting the gap. `divider`, which
|
|
554
|
+
* is decorative only and carries no contrast requirement, stays light.
|
|
555
|
+
* * Dark-mode surfaces lift the green rather than reusing `#007E4A` as a
|
|
556
|
+
* background, which would leave no room for readable text above it.
|
|
557
|
+
*
|
|
558
|
+
* ONE REGISTERED GAP — `dark.semantic.error`. `semantic.error` is a SINGLE token
|
|
559
|
+
* rendered as text in BOTH modes, so one hex must clear 4.5:1 against white AND
|
|
560
|
+
* against `#1E2A22`. Those requirements are mutually exclusive: AA on white caps
|
|
561
|
+
* its relative luminance at 0.183, AA on the raised dark surface demands at least
|
|
562
|
+
* 0.267. No colour satisfies both, so this is not a value that was chosen badly —
|
|
563
|
+
* it needs a mode-aware split of the token, which is a shape change to
|
|
564
|
+
* `SemanticColors` affecting all four presets. Registered in
|
|
565
|
+
* `presets.contrast.test.ts` with its measured ratio, exactly like the identical
|
|
566
|
+
* gap in erevna/katalogos/aml.
|
|
567
|
+
*/
|
|
568
|
+
declare const DIGITALKIN_TOKENS: DesignTokens;
|
|
569
|
+
|
|
387
570
|
/**
|
|
388
571
|
* Erevna (surveys/forms — realm `questioner`) tokens.
|
|
389
572
|
*
|
|
@@ -479,4 +662,4 @@ declare function contrastRatio(foreground: string, background: string): number;
|
|
|
479
662
|
/** True when `foreground` on `background` meets `requiredRatio`. */
|
|
480
663
|
declare function meetsContrast(foreground: string, background: string, requiredRatio: number): boolean;
|
|
481
664
|
|
|
482
|
-
export { AA_LARGE_TEXT_RATIO, AA_NON_TEXT_RATIO, AA_NORMAL_TEXT_RATIO, AML_CSS_VAR_NAMES, AML_TOKENS, type BrandExtras, type Branding, type CssVarNames, DEFAULT_CSS_VAR_NAMES, type DesignTokens, EREVNA_TOKENS, type InkScale, KATALOGOS_TOKENS, type ModeColors, PRESETS, type Radii, type RnThemeConfig, type SemanticColors, type Shadows, type ShellColors, type TailwindColors, type TailwindPreset, type ToCssVarsOptions, type TokenExtensions, type Typography, type VerdictColors, type WorkspaceExtras, contrastRatio, isHexColor, meetsContrast, relativeLuminance, toCssVars, toRnTheme, toTailwindPreset };
|
|
665
|
+
export { AA_LARGE_TEXT_RATIO, AA_NON_TEXT_RATIO, AA_NORMAL_TEXT_RATIO, AML_CSS_VAR_NAMES, AML_TOKENS, type BrandExtras, type Branding, type CssVarNames, DEFAULT_CSS_VAR_NAMES, DIGITALKIN_TOKENS, type DesignTokens, EREVNA_TOKENS, type InkScale, KATALOGOS_TOKENS, type ModeColors, PRESETS, type Radii, type RnThemeConfig, type SemanticColors, type Shadows, type ShellColors, type TailwindColors, type TailwindPreset, type ToCssVarsOptions, type TokenExtensions, type Typography, UI_DEEP_STEP, UI_MAIN_STEP, UI_TINT_STEP, type UiColorScale, type UiThemeColors, type UiThemeConfig, type UiThemeMode, type UiThemePalette, type UiThemeSemantic, type VerdictColors, type WorkspaceExtras, contrastRatio, isHexColor, meetsContrast, relativeLuminance, toCssVars, toRnTheme, toTailwindPreset, toUiTheme };
|
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",
|
|
@@ -333,6 +413,65 @@ var AML_TOKENS = {
|
|
|
333
413
|
}
|
|
334
414
|
};
|
|
335
415
|
|
|
416
|
+
// src/presets/digitalkin.ts
|
|
417
|
+
var DIGITALKIN_TOKENS = {
|
|
418
|
+
primary: "#007E4A",
|
|
419
|
+
secondary: "#005532",
|
|
420
|
+
accent: "#FFAB00",
|
|
421
|
+
// White on the brand green measures 5.14:1 — AA for normal text, so filled
|
|
422
|
+
// buttons carry white labels. Stated explicitly rather than leaning on the
|
|
423
|
+
// consumer-side default, because a future primary tweak must re-prove it.
|
|
424
|
+
onBrand: "#FFFFFF",
|
|
425
|
+
semantic: {
|
|
426
|
+
success: "#007E4A",
|
|
427
|
+
warning: "#B26A00",
|
|
428
|
+
error: "#B3261E",
|
|
429
|
+
info: "#005532"
|
|
430
|
+
},
|
|
431
|
+
light: {
|
|
432
|
+
background: "#FFFFFF",
|
|
433
|
+
surface: "#F5F7F5",
|
|
434
|
+
surfaceElevated: "#FFFFFF",
|
|
435
|
+
text: "#101410",
|
|
436
|
+
textSecondary: "#5A5A5A",
|
|
437
|
+
border: "#7E8A80",
|
|
438
|
+
divider: "#E5E9E5",
|
|
439
|
+
surfaceMuted: "#EDF2ED"
|
|
440
|
+
},
|
|
441
|
+
dark: {
|
|
442
|
+
background: "#0E1410",
|
|
443
|
+
surface: "#16201A",
|
|
444
|
+
surfaceElevated: "#1E2A22",
|
|
445
|
+
text: "#F2F5F2",
|
|
446
|
+
textSecondary: "#BFC7BF",
|
|
447
|
+
border: "#6B7D71",
|
|
448
|
+
divider: "#2C3A30",
|
|
449
|
+
surfaceMuted: "#1A241D"
|
|
450
|
+
},
|
|
451
|
+
typography: {
|
|
452
|
+
// Geologica Variable ships via @fontsource-variable/geologica on the public tier.
|
|
453
|
+
fontFamily: "'Geologica Variable', 'Geologica', system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
454
|
+
headingScale: 1
|
|
455
|
+
},
|
|
456
|
+
radii: {
|
|
457
|
+
xs: "4px",
|
|
458
|
+
sm: "8px",
|
|
459
|
+
md: "12px",
|
|
460
|
+
lg: "20px",
|
|
461
|
+
pill: "999px"
|
|
462
|
+
},
|
|
463
|
+
shadows: {
|
|
464
|
+
sm: "0 1px 2px rgba(16, 20, 16, 0.06)",
|
|
465
|
+
md: "0 2px 8px rgba(16, 20, 16, 0.08)",
|
|
466
|
+
pop: "0 8px 24px rgba(16, 20, 16, 0.12)"
|
|
467
|
+
},
|
|
468
|
+
branding: {
|
|
469
|
+
logoContentId: null,
|
|
470
|
+
faviconContentId: null,
|
|
471
|
+
presetId: "digitalkin"
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
|
|
336
475
|
// src/presets/erevna.ts
|
|
337
476
|
var EREVNA_TOKENS = {
|
|
338
477
|
primary: "#005f73",
|
|
@@ -409,7 +548,8 @@ var KATALOGOS_TOKENS = {
|
|
|
409
548
|
var PRESETS = {
|
|
410
549
|
aml: AML_TOKENS,
|
|
411
550
|
erevna: EREVNA_TOKENS,
|
|
412
|
-
katalogos: KATALOGOS_TOKENS
|
|
551
|
+
katalogos: KATALOGOS_TOKENS,
|
|
552
|
+
digitalkin: DIGITALKIN_TOKENS
|
|
413
553
|
};
|
|
414
554
|
|
|
415
555
|
// src/contrast.ts
|
|
@@ -481,9 +621,13 @@ exports.AA_NORMAL_TEXT_RATIO = AA_NORMAL_TEXT_RATIO;
|
|
|
481
621
|
exports.AML_CSS_VAR_NAMES = AML_CSS_VAR_NAMES;
|
|
482
622
|
exports.AML_TOKENS = AML_TOKENS;
|
|
483
623
|
exports.DEFAULT_CSS_VAR_NAMES = DEFAULT_CSS_VAR_NAMES;
|
|
624
|
+
exports.DIGITALKIN_TOKENS = DIGITALKIN_TOKENS;
|
|
484
625
|
exports.EREVNA_TOKENS = EREVNA_TOKENS;
|
|
485
626
|
exports.KATALOGOS_TOKENS = KATALOGOS_TOKENS;
|
|
486
627
|
exports.PRESETS = PRESETS;
|
|
628
|
+
exports.UI_DEEP_STEP = UI_DEEP_STEP;
|
|
629
|
+
exports.UI_MAIN_STEP = UI_MAIN_STEP;
|
|
630
|
+
exports.UI_TINT_STEP = UI_TINT_STEP;
|
|
487
631
|
exports.contrastRatio = contrastRatio;
|
|
488
632
|
exports.isHexColor = isHexColor;
|
|
489
633
|
exports.meetsContrast = meetsContrast;
|
|
@@ -491,5 +635,6 @@ exports.relativeLuminance = relativeLuminance;
|
|
|
491
635
|
exports.toCssVars = toCssVars;
|
|
492
636
|
exports.toRnTheme = toRnTheme;
|
|
493
637
|
exports.toTailwindPreset = toTailwindPreset;
|
|
638
|
+
exports.toUiTheme = toUiTheme;
|
|
494
639
|
//# sourceMappingURL=index.js.map
|
|
495
640
|
//# sourceMappingURL=index.js.map
|