@dloizides/design-tokens 1.13.0 → 1.14.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 CHANGED
@@ -1,341 +1,349 @@
1
- # Changelog
2
-
3
- ## 1.13.0
4
-
5
- - New overlay stacking scale `Z_INDEX` (`base` 0 < `sticky` 2 < `raised` 30 < `drawer` 50 < `palette` 60 < `dropdown` 1000 < `modal` 9999 < `popover` 10000 < `toast` 10100 < `blocking` 100000), plus `Z_INDEX_ORDER`, `RN_WEB_MODAL_Z_INDEX` and type `ZIndexLayer`. `modal` is react-native-web's fixed Modal layer; body-portalled menus use `popover` so they paint above an open Modal (UI-ZINDEX-SCALE-1 "Shared overlay z-index scale").
6
-
7
- ## 1.12.0
8
-
9
- - New `INTERVIEWPREP_TOKENS` preset + `INTERVIEWPREP_CSS_VAR_NAMES`, seeded from InterviewPrep theme.css (REDESIGN-IP-1 Q-TOKENS "New interviewprep preset").
10
- - `toCssVars` `lightSelector` option: dark-first output (dark in `:root`, light in the given selector). Light-first output is byte-identical.
11
- - `CssVarNames` gains per-mode names for the optional `ModeColors` fields (textTertiary, focusRing, brandFill, onBrandFill, successText, dangerText, dangerFill).
12
-
13
- ## 1.11.0
14
-
15
- **Optional mode extras, increased-contrast overrides, motion springs, and the D1 "Living Room" `nextgame` preset.**
16
-
17
- Additive types: no existing field changes and no emitter reads the new ones, so other presets
18
- and consumers are byte-identical.
19
-
20
- - `ModeColors` gains optional `textTertiary`, `focusRing`, `brandFill`, `onBrandFill`,
21
- `successText`, `dangerText`, `dangerFill`.
22
- - `DesignTokens.contrastMore?: ContrastMoreOverrides` — per-mode `Partial<ModeColors>` plus
23
- `focusRingWidth`, applied under `prefers-contrast: more`.
24
- - `Motion.springs?: MotionSprings` (`focus` / `settle` / `press`, each `{ stiffness, damping }`).
25
- `DEFAULT_MOTION` is unchanged.
26
- - New exported types: `MotionSpring`, `MotionSprings`, `ContrastMoreOverrides`.
27
- - `NEXTGAME_TOKENS` rebuilt for the dark console dashboard (sole consumer: nextgame-web):
28
- graphite dark grounds (`#0A0D12` / `#121720` / `#1A212C`), amber `#FFD37A` brand fill with
29
- `#1A1204` ink, white focus ring, dark-tuned success and danger text, contrast-more tiers,
30
- Barlow type, spec §6 durations (160/240/320ms) and easings, springs. The light-surface
31
- amber/teal/magenta triad is kept for OG images and email. `monoFamily` is dropped and
32
- `headingScale` is now 1.
33
-
34
- ## 1.10.0
35
-
36
- **New `nextgame` preset — the NextGame game-recommendation app.**
37
-
38
- Additive. No existing preset, emitter or exported type changes.
39
-
40
- - `NEXTGAME_TOKENS` + the `nextgame` slug in `PRESETS`.
41
- - Signal amber `#FF8C1A` / deep teal `#0E7C86` / arcade magenta `#F5008B` on warm grounds.
42
- The app renders PlayStation, Xbox and Nintendo cards side by side, so blue, green and red
43
- are all unavailable as a brand primary: a platform badge must never read as chrome. No hue
44
- in the triad sits within 60 degrees of a console brand colour.
45
- - Both borders are authored to clear WCAG 1.4.11 (3:1) in both modes rather than inheriting
46
- the older presets' registered gaps. It registers only the usual dark-mode
47
- `semantic.error` gap (2.77:1) — one hex cannot serve error-as-text in both modes.
48
-
49
- ## 1.7.0
50
-
51
- **New `Motion` token group (durations + easings) — additive, optional, non-breaking.**
52
-
53
- Adds the first motion tokens to the package. The kit was almost entirely static and every
54
- animating component (ui-feedback ToastHost/PageSkeleton, ui-layout Accordion) re-declared its own
55
- durations/curves inline. This introduces a single shared source that `@dloizides/ui-motion` reads
56
- to build its RN `Easing.bezier(...)` map, and that web/CSS consumers can read directly.
57
-
58
- Fully back-compat: `motion` is OPTIONAL on `DesignTokens`, no preset declares it, and no emitter
59
- reads it — existing consumers are byte-identical.
60
-
61
- ### New
62
-
63
- - `DEFAULT_MOTION` constant — the app-agnostic motion scale (motion is uniform across portals, so
64
- there is ONE default rather than one per preset):
65
- - `durations` (ms, numbers): `instant 0`, `fast 140`, `base 200`, `slow 300`. `instant` (0) is
66
- the reduced-motion collapse target.
67
- - `easings` (Material-like), each carrying BOTH a web `css` `cubic-bezier(...)` string AND the
68
- `bezier` `[x1,y1,x2,y2]` control points for RN `Easing.bezier(...)`, so web and native animate
69
- on the same curve: `standard [0.2,0,0,1]`, `decelerate [0,0,0,1]`, `accelerate [0.3,0,1,1]`.
70
- - Types: `Motion`, `MotionDurations`, `MotionEasing`, `MotionEasings`.
71
- - `DesignTokens.motion?` — optional field so a preset MAY override the default motion scale.
72
-
73
- ## 1.6.0
74
-
75
- **FINREG rebrand to the OFFICIAL brand palette + navy surface tokens — additive/retune, non-breaking to other apps.**
76
-
77
- The owner supplied FINREG's official, single-source-of-truth logo palette. The interim EDA hexes
78
- were slightly off it, so the three `FINREG_MODULE_COLORS.base` values are re-tuned to the official
79
- cyan/magenta/violet and each `onWhite` companion is RECOMPUTED (same derivation, same
80
- `contrast.ts` maths). Only FINREG-scoped tokens change; every per-app preset, emitter and type is
81
- byte-identical, so aml/erevna/katalogos/digitalkin consumers are untouched.
82
-
83
- ### Changed
84
-
85
- - `FINREG_MODULE_COLORS` re-tuned to the official palette:
86
- - Payments (cyan): `base #52E2F2` (1.55:1 on white, fill only) / `onWhite #0B8290` (4.56:1).
87
- - Accounting (magenta): `base #F266CD` (2.78:1) / `onWhite #DA12A5` (4.55:1).
88
- - CRM (violet): `base #7997F2` (2.79:1) / `onWhite #426CED` (4.57:1).
89
- - `onWhite` = lightest shade of the same hue that clears the 4.5:1 AA text floor on white,
90
- carried a hair past so rounding cannot drop it under. Both halves re-pinned in
91
- `finregModules.test.ts`.
92
-
93
- ### New
94
-
95
- - `FINREG_SURFACE_COLORS` — the official navy dark grounds: `surface #0C2240` (hero band / dark
96
- sections / logo field top) and `deepest #071526` (footer/closing band / darkest body ink / logo
97
- field bottom). Exported so consumers stop hardcoding the dark-band literals. Payments cyan reads
98
- as an AA-safe accent on both (10.25:1 / 11.81:1), pinned in the test.
99
- - `FinregSurfaceColors` type.
100
-
101
- ## 1.5.0
102
-
103
- **FINREG per-module brand colours (task R-01) — additive, non-breaking.**
104
-
105
- FINREG's interim EDA logo binds a colour to each of its three product modules, so colour is module
106
- identity, not one app's brand primary. Adds `FINREG_MODULE_COLORS` beside the per-app presets. No
107
- existing token, preset, emitter or type is touched, so every current consumer is byte-identical.
108
-
109
- ### New
110
-
111
- - `FINREG_MODULE_COLORS` — the three decided EDA module colours, each with an AA-safe on-white
112
- companion:
113
- - Payments (cyan): `base #4FD8F0` (1.69:1 on white, fill only) / `onWhite #0C7D91` (4.82:1).
114
- - Accounting (magenta): `base #E85FBF` (3.08:1) / `onWhite #D11E9B` (4.81:1).
115
- - CRM (violet): `base #7B8FF7` (2.95:1) / `onWhite #4763F4` (4.82:1).
116
- - `FinregModuleColor`, `FinregModuleColors` types.
117
-
118
- The `base` hexes are transcribed verbatim from the logo decision — this package did not choose
119
- them. The `onWhite` companions were DERIVED with the `contrast.ts` WCAG maths (lightest shade of
120
- the same hue that clears the 4.5:1 AA text floor on white, carried a little past the floor), and
121
- both halves are pinned by `finregModules.test.ts` so a drift below AA fails the build. This is the
122
- SOURCE of the hexes; a later rebrand wave adopts the token into the apps, which read it rather than
123
- re-declaring the literal (`no-raw-color-literal`).
124
-
125
- ## 1.4.0
126
-
127
- **The on-brand foreground is now DERIVED, not defaulted to white.**
128
-
129
- This package already shipped the WCAG maths (`contrast.ts`) and an optional `onBrand`
130
- slot — and a live AA failure shipped anyway: **white on `#38bdf8` at 2.14:1** on a
131
- production primary button. The slot was optional *with a white default*, so the safe
132
- path required opting in and the default was the failing one. An optional safety feature
133
- with an unsafe default is not a safety feature; it is a trap that reads as protection in
134
- review. The same pair was then hand-patched five separate times across the codebase, one
135
- of them inside a verification EMAIL where CSS cannot be patched after sending.
136
-
137
- ### New
138
-
139
- - `resolveOnBrand(background, explicit?)` — returns the higher-contrast of a light ink
140
- (`#ffffff`) and a dark ink (`#03121f`) for the given brand colour. An explicit value is
141
- honoured as given; a non-hex background (no fixed luminance) falls back to light ink as
142
- a documented last resort rather than as the unexamined default for everything.
143
- - `onBrandRatio(background, explicit?)` — the measured ratio, or `null` when unmeasurable.
144
- Returns the NUMBER, so a consumer can assert the pair instead of assuming it.
145
- - `canCarryAccessibleInk(background)` — false for a mid-luminance fill that fails against
146
- BOTH inks. Distinguishes "we picked the wrong ink" from "no ink works" — different bugs
147
- with different owners.
148
- - `ON_BRAND_LIGHT_INK`, `ON_BRAND_DARK_INK`.
149
-
150
- Exported from the package root so a consumer that accepts a brand colour at RUNTIME (a
151
- per-tenant branding endpoint) derives its foreground with the same maths that guards the
152
- shipped presets. The runtime path is how an AA failure re-enters a codebase whose static
153
- presets all pass.
154
-
155
- ### Changed (behaviour)
156
-
157
- All three emitters now derive the on-brand ink instead of skipping or whitening it:
158
-
159
- - `toUiTheme` — `palette.onBrand` was `tokens.onBrand ?? '#ffffff'`, now
160
- `resolveOnBrand(tokens.primary, tokens.onBrand)`.
161
- - `toCssVars` — `--on-brand` was emitted only when the preset declared `onBrand`. It is
162
- now always emitted (when the name map asks for it): a MISSING custom property sends the
163
- stylesheet to its own hardcoded fallback, which is how white-on-pale-brand shipped.
164
- - `toTailwindPreset` — `colors['on-brand']` is likewise always emitted, and its type
165
- changed from `string | undefined` to `string`.
166
-
167
- **No shipped preset's emitted value changes.** All four presets have a `primary` that
168
- white genuinely wins on (aml `#4f46e5` 6.29:1, erevna/katalogos `#005f73` 7.28:1,
169
- digitalkin `#007E4A` 5.14:1 explicit), so the derivation returns exactly what they emitted
170
- before. The change is visible only to a consumer with a PALE brand — which is the defect.
171
-
172
- `onBrand` remains OPTIONAL. Making it required would be a compile break for every consumer
173
- on a published, adopted interface, and it would push the decision back onto exactly the
174
- caller who already got it wrong five times. Derivation fixes the DEFAULT, which is where
175
- the defect actually lives.
176
-
177
- ### Guards
178
-
179
- - `presets.contrast.test.ts` now asserts every preset's `primary`/derived-ink pair clears
180
- 4.5:1, MEASURES any explicit `onBrand` rather than trusting it, and records on the
181
- record which brand fills can carry no accessible ink at all.
182
- - `toCssVars` / `toTailwindPreset` had **zero** `onBrand` coverage — they emitted it
183
- blind. Both now assert the derived value, including the pale-brand case.
184
- - 144 tests (was 140 + 4 new files/cases; `onBrand.test.ts` pins every ratio as a measured
185
- number so a change to the derivation cannot quietly re-tune what "accessible" means).
186
-
187
- ### Known finding (not fixed here)
188
-
189
- `accent: #008d5c` (erevna, katalogos) peaks at **4.47:1** against its best ink and can
190
- carry NO AA foreground. Nothing in the fleet paints text on an accent fill today — it is
191
- read as a text *colour*, never a text-bearing fill — so this is recorded and asserted as a
192
- known state rather than silently fixed by redesigning two live portals' brand green. It
193
- becomes a real failure the moment anything paints text on that fill.
194
-
195
- All notable changes to `@dloizides/design-tokens` are documented here.
196
-
197
- ## [1.3.0]
198
-
199
- ### Added
200
-
201
- - **`DIGITALKIN_TOKENS`** — the Digital Kin brand preset (green `#007E4A`, yellow `#FFAB00`,
202
- Geologica as the sole text family). Registered in `PRESETS` under `digitalkin` and
203
- re-exported from the package root.
204
-
205
- Purely additive: the other 20 exports are byte-identical to 1.2.0, and all four emitters
206
- produce identical output for `aml` / `erevna` / `katalogos`. `PRESETS` gains one key and
207
- loses none. Verified by diffing this build against the published 1.2.0 tarball.
208
-
209
- ### Notes
210
-
211
- - The Digital Kin accent (`#FFAB00`) is a HIGHLIGHT colour: white on it measures **1.90:1**,
212
- so it carries stars, focus rings and ornaments with dark ink on top (**9.81:1**) — never a
213
- white-on-yellow button. Both halves are asserted by `digitalkin.test.ts`.
214
- - DynaPuff is deliberately absent from the token set. It has **no Greek glyphs**, and browser
215
- font fallback is per-glyph, so a mixed Greek/Latin heading would render in two typefaces at
216
- once. It lives only inside the wordmark SVG as vector paths.
217
- - Unlike the other three presets, `digitalkin`'s **borders meet WCAG 1.4.11** (3.34:1 light,
218
- 3.40:1 dark) rather than inheriting the registered `*.border` gaps. Those gaps are frozen
219
- current values of live portals; this preset ships before it has pixels to regress, so it
220
- takes the compliant value.
221
- - One registered gap: **`digitalkin.dark.semantic.error`** (2.28:1). `semantic.error` is a
222
- single token rendered as text in both modes, and AA on white caps its luminance at 0.183
223
- while AA on the raised dark surface demands ≥0.267 — mutually exclusive. Fixing it needs a
224
- mode-aware split of `SemanticColors` affecting all four presets, not a colour nudge.
225
-
226
- ## [1.2.0]
227
-
228
- ### Added
229
-
230
- `DesignTokens` was a **lossy carrier**. Two RN-web apps (ichnos, kefi) discovered this
231
- independently and wrote the *same* private workaround: the shape had no slot for the muted
232
- inset surface, the on-brand foreground, or the three status background tints, so each app
233
- smuggled those five values into free slots of the broadcast theme via a hand-rolled overlay.
234
- Two independent uses of one workaround is the trigger to extract it. These are now
235
- first-class slots, and the overlay is a shipped emitter.
236
-
237
- - **`ModeColors.surfaceMuted?`** — the subtle inset surface (table header rows, chips, wells).
238
- Distinct from `surface` (cards) and `surfaceElevated` (modals): it recedes rather than lifts.
239
- - **`DesignTokens.onBrand?`** — the foreground for content sitting ON a `primary`-filled
240
- surface. It is a *contrast partner* of `primary`, not a mode colour, so it lives beside it.
241
- - **`SemanticColors.successBg?` / `warningBg?` / `errorBg?` / `infoBg?`** — the soft fill a
242
- status badge, banner or row-highlight paints behind text of the base colour. A tint is NOT
243
- derivable from its base (it is hand-picked for contrast), so it needs its own slot; without
244
- one a status surface could not be themed at all.
245
- - **`toUiTheme(tokens, mode?)`** — a fourth emitter: the shared RN UI kit's `UiTheme` (what
246
- `@dloizides/ui-feedback`'s `UiProvider` broadcasts). It is **lossless** — every token the
247
- shape can express lands in an addressable slot (`palette.onBrand`, `palette.surfaceMuted`,
248
- each status tint at the `100` step), so an app can round-trip its entire palette back out
249
- of the live provider instead of keeping a parallel static copy that can never follow a
250
- dark-mode toggle or a per-tenant brand. The theme type is declared **structurally** here,
251
- exactly as `RnThemeConfig` declares the `TenantThemeConfig` shape, so the package keeps its
252
- zero-dependency / zero-peer guarantee and takes no dependency on the kit it feeds.
253
- - **`UI_TINT_STEP` / `UI_MAIN_STEP` / `UI_DEEP_STEP`** — the step names, exported so a consumer
254
- addresses a scale by name rather than by a magic `'500'`.
255
- - CSS-variable names (`--on-brand`, `--surface-muted`, `--success-bg`, …) and Tailwind colour
256
- keys (`on-brand`, `surface-muted`, `success-bg`, …) for the new tokens.
257
-
258
- ### Fixed
259
-
260
- - **Scale collapse.** The naive `value => ({ '100': v, '500': v, '700': v })` projection that
261
- both apps used writes ONE value into every step, silently discarding the deeper brand step
262
- and every status tint — a theme built that way cannot reproduce the palette it came from.
263
- `toUiTheme` emits `secondary` as its own scale and each status tint at the `100` step, so
264
- the values survive. The package's own emitters (`toCssVars`, `toRnTheme`,
265
- `toTailwindPreset`) were checked and carry no equivalent collapse.
266
-
267
- ### Compatibility
268
-
269
- Entirely additive. Every new token is optional and every new emitted key appears **only** when
270
- a preset declares the token, so `AML_TOKENS`, `EREVNA_TOKENS` and `KATALOGOS_TOKENS` emit
271
- byte-identical CSS, RN-theme and Tailwind output — verified by the pre-existing emitter test
272
- suites passing unmodified.
273
-
274
- ## [1.1.0]
275
-
276
- ### Fixed
277
-
278
- - **WCAG AA contrast (UX-11)**: `light.textSecondary` in `EREVNA_TOKENS` and `KATALOGOS_TOKENS`
279
- was `#777777`, which measures **4.48:1 on `#ffffff` and 4.18:1 on the `#f7f7f7` card surface** —
280
- both under the AA 4.5:1 floor for normal text, and form-field labels render in this colour.
281
- Now `#717171` (**4.88:1** and **4.56:1** against those same two surfaces, verified against each
282
- preset's ACTUAL surfaces rather than assumed from another package's).
283
- `AML_TOKENS` was already compliant (`#4a5567`, worst case 6.97:1) and is unchanged.
284
-
285
- This is the same defect `@dloizides/theme-web@1.2.0` fixed in its `DEFAULT_THEME_CONFIG`, but
286
- that fix does NOT reach these presets — apps resolving colours through a preset bypass
287
- theme-web's defaults entirely. The bad value survived here independently.
288
-
289
- ### Added
290
-
291
- - **`src/contrast.ts`** — a correct WCAG 2.1 contrast implementation (sRGB gamma linearization +
292
- ITU-R BT.709 weighting; NOT a naive channel average, which mis-scores exactly the mid-greys that
293
- matter). Deliberately a COPY of theme-web's, not an import: this package ships **zero
294
- dependencies and zero peers** by design, and depending on a React theming package for pure
295
- arithmetic would invert the layering (theme-web already depends on this package).
296
- Exported (`contrastRatio`, `relativeLuminance`, `meetsContrast`, `isHexColor`, and the
297
- `AA_*_RATIO` thresholds) so consumers that let users override tokens at runtime can validate
298
- those overrides with the same maths that guards the shipped presets.
299
- - **`src/contrast.test.ts`** — pins the calculator against external reference pairs
300
- (`#767676`/white = 4.54:1, `#777777`/white = 4.48:1, black/white = 21:1, and `#808080`'s true
301
- luminance of 0.2159 vs a channel-average's 0.502) so the guard cannot silently be wrong.
302
- - **`src/presets/presets.contrast.test.ts`** — a permanent guard measuring every text-role colour
303
- in EVERY preset against every surface it renders on, in BOTH modes. Failures must be registered
304
- in `KNOWN_GAPS` with their exact measured ratio, and the registry is asserted to be exactly
305
- accurate — so a gap cannot be added silently, a stale entry fails once the colour is fixed, and
306
- a newly failing colour nobody registered fails the suite outright. Non-hex token values (AML's
307
- `rgba()` dark border, which has no fixed luminance) are excluded by an asserted explicit list
308
- rather than silently skipped.
309
-
310
- ### Notes
311
-
312
- - Only TEXT and essential-boundary roles are asserted. Decorative fills (`primary`/`secondary`/
313
- `accent`, and the `success`/`warning`/`info` semantic bases) carry no contrast requirement;
314
- asserting them would turn a compliance guard into a brand redesign.
315
- - 8 pre-existing gaps are registered, all one root cause: a single token serving both a text role
316
- and a fill/decorative role across both modes (`border`/`divider`, `semantic.error`). These need
317
- the roles split before any value can move — a design change, not a colour nudge. They mirror the
318
- gaps already registered in `@dloizides/theme-web`.
319
-
320
- ## [1.0.0]
321
-
322
- ### Added
323
-
324
- - Initial release (task #78) — the cross-stack design-token source.
325
- - **Token shape** (`DesignTokens`) whose core fields mirror `@dloizides/tenant-theme-web`'s
326
- `TenantThemeConfig` (`primary`/`secondary`/`accent`/`semantic`/`light`/`dark`/`typography`/
327
- `branding`), plus optional `radii`/`shadows`/`extensions` supersets for richer stacks.
328
- - **Three emitters from one source**: `toCssVars` (CSS custom properties for vanilla-JS),
329
- `toRnTheme` (a `TenantThemeConfig`-compatible object for RN-web), `toTailwindPreset` (a Tailwind
330
- preset for the DOM-React ThemeStudio).
331
- - **Per-app presets** seeded byte-for-byte from current values: `EREVNA_TOKENS`,
332
- `KATALOGOS_TOKENS` (from each RN app's `default` theme preset), and `AML_TOKENS` (from the AML
333
- console's `wwwroot/shared/ui.css` `:root`). Plus the `PRESETS` map.
334
- - **The cross-stack naming contract (#78b)**: `DEFAULT_CSS_VAR_NAMES` (canonical kebab names) and
335
- `AML_CSS_VAR_NAMES` (the AML console's existing `ui.css` variable names), documented in the
336
- README with the full name-mapping table and the open naming decisions.
337
- - Behaviour-preserving by design: runtime tests assert `toRnTheme(EREVNA_TOKENS)` deep-equals the
338
- app's current `DEFAULT_THEME_CONFIG` and `toCssVars(AML_TOKENS, AML_CSS_VAR_NAMES)` reproduces
339
- `ui.css`'s `:root` verbatim. Zero visual change on adoption.
340
- - Values only — no components (those live in `@dloizides/ui-layout`/`ui-forms`/`ui-feedback`/
341
- `ui-icons`/`ui-tables`). Zero runtime dependencies.
1
+ # Changelog
2
+
3
+ ## 1.14.0
4
+
5
+ - One fleet focus ring (FOCUS-RING-1 "One focus ring across the shared kit"): `FOCUS_RING` (2 px solid, 2 px offset), `resolveFocusRingColor` (the mode's `focusRing` token, else the first of primary / a lighter brand step / text reaching 3:1 on the ground), `focusRingOutline` and `isFocusVisible` (keyboard focus only). Consumed by ui-buttons, ui-forms and ui-payments.
6
+
7
+ ## 1.13.1
8
+
9
+ - `prepublishOnly` now runs `jest --coverage`, so the 100% coverage threshold blocks a publish (DT-COV-1 "design-tokens coverage threshold failing"). `contrast.ts` shorthand-hex expansion rewritten without unreachable fallbacks; output unchanged.
10
+
11
+ ## 1.13.0
12
+
13
+ - New overlay stacking scale `Z_INDEX` (`base` 0 < `sticky` 2 < `raised` 30 < `drawer` 50 < `palette` 60 < `dropdown` 1000 < `modal` 9999 < `popover` 10000 < `toast` 10100 < `blocking` 100000), plus `Z_INDEX_ORDER`, `RN_WEB_MODAL_Z_INDEX` and type `ZIndexLayer`. `modal` is react-native-web's fixed Modal layer; body-portalled menus use `popover` so they paint above an open Modal (UI-ZINDEX-SCALE-1 "Shared overlay z-index scale").
14
+
15
+ ## 1.12.0
16
+
17
+ - New `INTERVIEWPREP_TOKENS` preset + `INTERVIEWPREP_CSS_VAR_NAMES`, seeded from InterviewPrep theme.css (REDESIGN-IP-1 Q-TOKENS "New interviewprep preset").
18
+ - `toCssVars` `lightSelector` option: dark-first output (dark in `:root`, light in the given selector). Light-first output is byte-identical.
19
+ - `CssVarNames` gains per-mode names for the optional `ModeColors` fields (textTertiary, focusRing, brandFill, onBrandFill, successText, dangerText, dangerFill).
20
+
21
+ ## 1.11.0
22
+
23
+ **Optional mode extras, increased-contrast overrides, motion springs, and the D1 "Living Room" `nextgame` preset.**
24
+
25
+ Additive types: no existing field changes and no emitter reads the new ones, so other presets
26
+ and consumers are byte-identical.
27
+
28
+ - `ModeColors` gains optional `textTertiary`, `focusRing`, `brandFill`, `onBrandFill`,
29
+ `successText`, `dangerText`, `dangerFill`.
30
+ - `DesignTokens.contrastMore?: ContrastMoreOverrides` — per-mode `Partial<ModeColors>` plus
31
+ `focusRingWidth`, applied under `prefers-contrast: more`.
32
+ - `Motion.springs?: MotionSprings` (`focus` / `settle` / `press`, each `{ stiffness, damping }`).
33
+ `DEFAULT_MOTION` is unchanged.
34
+ - New exported types: `MotionSpring`, `MotionSprings`, `ContrastMoreOverrides`.
35
+ - `NEXTGAME_TOKENS` rebuilt for the dark console dashboard (sole consumer: nextgame-web):
36
+ graphite dark grounds (`#0A0D12` / `#121720` / `#1A212C`), amber `#FFD37A` brand fill with
37
+ `#1A1204` ink, white focus ring, dark-tuned success and danger text, contrast-more tiers,
38
+ Barlow type, spec §6 durations (160/240/320ms) and easings, springs. The light-surface
39
+ amber/teal/magenta triad is kept for OG images and email. `monoFamily` is dropped and
40
+ `headingScale` is now 1.
41
+
42
+ ## 1.10.0
43
+
44
+ **New `nextgame` preset — the NextGame game-recommendation app.**
45
+
46
+ Additive. No existing preset, emitter or exported type changes.
47
+
48
+ - `NEXTGAME_TOKENS` + the `nextgame` slug in `PRESETS`.
49
+ - Signal amber `#FF8C1A` / deep teal `#0E7C86` / arcade magenta `#F5008B` on warm grounds.
50
+ The app renders PlayStation, Xbox and Nintendo cards side by side, so blue, green and red
51
+ are all unavailable as a brand primary: a platform badge must never read as chrome. No hue
52
+ in the triad sits within 60 degrees of a console brand colour.
53
+ - Both borders are authored to clear WCAG 1.4.11 (3:1) in both modes rather than inheriting
54
+ the older presets' registered gaps. It registers only the usual dark-mode
55
+ `semantic.error` gap (2.77:1) — one hex cannot serve error-as-text in both modes.
56
+
57
+ ## 1.7.0
58
+
59
+ **New `Motion` token group (durations + easings) — additive, optional, non-breaking.**
60
+
61
+ Adds the first motion tokens to the package. The kit was almost entirely static and every
62
+ animating component (ui-feedback ToastHost/PageSkeleton, ui-layout Accordion) re-declared its own
63
+ durations/curves inline. This introduces a single shared source that `@dloizides/ui-motion` reads
64
+ to build its RN `Easing.bezier(...)` map, and that web/CSS consumers can read directly.
65
+
66
+ Fully back-compat: `motion` is OPTIONAL on `DesignTokens`, no preset declares it, and no emitter
67
+ reads it — existing consumers are byte-identical.
68
+
69
+ ### New
70
+
71
+ - `DEFAULT_MOTION` constant — the app-agnostic motion scale (motion is uniform across portals, so
72
+ there is ONE default rather than one per preset):
73
+ - `durations` (ms, numbers): `instant 0`, `fast 140`, `base 200`, `slow 300`. `instant` (0) is
74
+ the reduced-motion collapse target.
75
+ - `easings` (Material-like), each carrying BOTH a web `css` `cubic-bezier(...)` string AND the
76
+ `bezier` `[x1,y1,x2,y2]` control points for RN `Easing.bezier(...)`, so web and native animate
77
+ on the same curve: `standard [0.2,0,0,1]`, `decelerate [0,0,0,1]`, `accelerate [0.3,0,1,1]`.
78
+ - Types: `Motion`, `MotionDurations`, `MotionEasing`, `MotionEasings`.
79
+ - `DesignTokens.motion?` — optional field so a preset MAY override the default motion scale.
80
+
81
+ ## 1.6.0
82
+
83
+ **FINREG rebrand to the OFFICIAL brand palette + navy surface tokens — additive/retune, non-breaking to other apps.**
84
+
85
+ The owner supplied FINREG's official, single-source-of-truth logo palette. The interim EDA hexes
86
+ were slightly off it, so the three `FINREG_MODULE_COLORS.base` values are re-tuned to the official
87
+ cyan/magenta/violet and each `onWhite` companion is RECOMPUTED (same derivation, same
88
+ `contrast.ts` maths). Only FINREG-scoped tokens change; every per-app preset, emitter and type is
89
+ byte-identical, so aml/erevna/katalogos/digitalkin consumers are untouched.
90
+
91
+ ### Changed
92
+
93
+ - `FINREG_MODULE_COLORS` re-tuned to the official palette:
94
+ - Payments (cyan): `base #52E2F2` (1.55:1 on white, fill only) / `onWhite #0B8290` (4.56:1).
95
+ - Accounting (magenta): `base #F266CD` (2.78:1) / `onWhite #DA12A5` (4.55:1).
96
+ - CRM (violet): `base #7997F2` (2.79:1) / `onWhite #426CED` (4.57:1).
97
+ - `onWhite` = lightest shade of the same hue that clears the 4.5:1 AA text floor on white,
98
+ carried a hair past so rounding cannot drop it under. Both halves re-pinned in
99
+ `finregModules.test.ts`.
100
+
101
+ ### New
102
+
103
+ - `FINREG_SURFACE_COLORS` — the official navy dark grounds: `surface #0C2240` (hero band / dark
104
+ sections / logo field top) and `deepest #071526` (footer/closing band / darkest body ink / logo
105
+ field bottom). Exported so consumers stop hardcoding the dark-band literals. Payments cyan reads
106
+ as an AA-safe accent on both (10.25:1 / 11.81:1), pinned in the test.
107
+ - `FinregSurfaceColors` type.
108
+
109
+ ## 1.5.0
110
+
111
+ **FINREG per-module brand colours (task R-01) — additive, non-breaking.**
112
+
113
+ FINREG's interim EDA logo binds a colour to each of its three product modules, so colour is module
114
+ identity, not one app's brand primary. Adds `FINREG_MODULE_COLORS` beside the per-app presets. No
115
+ existing token, preset, emitter or type is touched, so every current consumer is byte-identical.
116
+
117
+ ### New
118
+
119
+ - `FINREG_MODULE_COLORS` — the three decided EDA module colours, each with an AA-safe on-white
120
+ companion:
121
+ - Payments (cyan): `base #4FD8F0` (1.69:1 on white, fill only) / `onWhite #0C7D91` (4.82:1).
122
+ - Accounting (magenta): `base #E85FBF` (3.08:1) / `onWhite #D11E9B` (4.81:1).
123
+ - CRM (violet): `base #7B8FF7` (2.95:1) / `onWhite #4763F4` (4.82:1).
124
+ - `FinregModuleColor`, `FinregModuleColors` types.
125
+
126
+ The `base` hexes are transcribed verbatim from the logo decision — this package did not choose
127
+ them. The `onWhite` companions were DERIVED with the `contrast.ts` WCAG maths (lightest shade of
128
+ the same hue that clears the 4.5:1 AA text floor on white, carried a little past the floor), and
129
+ both halves are pinned by `finregModules.test.ts` so a drift below AA fails the build. This is the
130
+ SOURCE of the hexes; a later rebrand wave adopts the token into the apps, which read it rather than
131
+ re-declaring the literal (`no-raw-color-literal`).
132
+
133
+ ## 1.4.0
134
+
135
+ **The on-brand foreground is now DERIVED, not defaulted to white.**
136
+
137
+ This package already shipped the WCAG maths (`contrast.ts`) and an optional `onBrand`
138
+ slot — and a live AA failure shipped anyway: **white on `#38bdf8` at 2.14:1** on a
139
+ production primary button. The slot was optional *with a white default*, so the safe
140
+ path required opting in and the default was the failing one. An optional safety feature
141
+ with an unsafe default is not a safety feature; it is a trap that reads as protection in
142
+ review. The same pair was then hand-patched five separate times across the codebase, one
143
+ of them inside a verification EMAIL where CSS cannot be patched after sending.
144
+
145
+ ### New
146
+
147
+ - `resolveOnBrand(background, explicit?)` — returns the higher-contrast of a light ink
148
+ (`#ffffff`) and a dark ink (`#03121f`) for the given brand colour. An explicit value is
149
+ honoured as given; a non-hex background (no fixed luminance) falls back to light ink as
150
+ a documented last resort rather than as the unexamined default for everything.
151
+ - `onBrandRatio(background, explicit?)` — the measured ratio, or `null` when unmeasurable.
152
+ Returns the NUMBER, so a consumer can assert the pair instead of assuming it.
153
+ - `canCarryAccessibleInk(background)` — false for a mid-luminance fill that fails against
154
+ BOTH inks. Distinguishes "we picked the wrong ink" from "no ink works" — different bugs
155
+ with different owners.
156
+ - `ON_BRAND_LIGHT_INK`, `ON_BRAND_DARK_INK`.
157
+
158
+ Exported from the package root so a consumer that accepts a brand colour at RUNTIME (a
159
+ per-tenant branding endpoint) derives its foreground with the same maths that guards the
160
+ shipped presets. The runtime path is how an AA failure re-enters a codebase whose static
161
+ presets all pass.
162
+
163
+ ### Changed (behaviour)
164
+
165
+ All three emitters now derive the on-brand ink instead of skipping or whitening it:
166
+
167
+ - `toUiTheme` — `palette.onBrand` was `tokens.onBrand ?? '#ffffff'`, now
168
+ `resolveOnBrand(tokens.primary, tokens.onBrand)`.
169
+ - `toCssVars` — `--on-brand` was emitted only when the preset declared `onBrand`. It is
170
+ now always emitted (when the name map asks for it): a MISSING custom property sends the
171
+ stylesheet to its own hardcoded fallback, which is how white-on-pale-brand shipped.
172
+ - `toTailwindPreset` — `colors['on-brand']` is likewise always emitted, and its type
173
+ changed from `string | undefined` to `string`.
174
+
175
+ **No shipped preset's emitted value changes.** All four presets have a `primary` that
176
+ white genuinely wins on (aml `#4f46e5` 6.29:1, erevna/katalogos `#005f73` 7.28:1,
177
+ digitalkin `#007E4A` 5.14:1 explicit), so the derivation returns exactly what they emitted
178
+ before. The change is visible only to a consumer with a PALE brand — which is the defect.
179
+
180
+ `onBrand` remains OPTIONAL. Making it required would be a compile break for every consumer
181
+ on a published, adopted interface, and it would push the decision back onto exactly the
182
+ caller who already got it wrong five times. Derivation fixes the DEFAULT, which is where
183
+ the defect actually lives.
184
+
185
+ ### Guards
186
+
187
+ - `presets.contrast.test.ts` now asserts every preset's `primary`/derived-ink pair clears
188
+ 4.5:1, MEASURES any explicit `onBrand` rather than trusting it, and records on the
189
+ record which brand fills can carry no accessible ink at all.
190
+ - `toCssVars` / `toTailwindPreset` had **zero** `onBrand` coverage — they emitted it
191
+ blind. Both now assert the derived value, including the pale-brand case.
192
+ - 144 tests (was 140 + 4 new files/cases; `onBrand.test.ts` pins every ratio as a measured
193
+ number so a change to the derivation cannot quietly re-tune what "accessible" means).
194
+
195
+ ### Known finding (not fixed here)
196
+
197
+ `accent: #008d5c` (erevna, katalogos) peaks at **4.47:1** against its best ink and can
198
+ carry NO AA foreground. Nothing in the fleet paints text on an accent fill today — it is
199
+ read as a text *colour*, never a text-bearing fill — so this is recorded and asserted as a
200
+ known state rather than silently fixed by redesigning two live portals' brand green. It
201
+ becomes a real failure the moment anything paints text on that fill.
202
+
203
+ All notable changes to `@dloizides/design-tokens` are documented here.
204
+
205
+ ## [1.3.0]
206
+
207
+ ### Added
208
+
209
+ - **`DIGITALKIN_TOKENS`** — the Digital Kin brand preset (green `#007E4A`, yellow `#FFAB00`,
210
+ Geologica as the sole text family). Registered in `PRESETS` under `digitalkin` and
211
+ re-exported from the package root.
212
+
213
+ Purely additive: the other 20 exports are byte-identical to 1.2.0, and all four emitters
214
+ produce identical output for `aml` / `erevna` / `katalogos`. `PRESETS` gains one key and
215
+ loses none. Verified by diffing this build against the published 1.2.0 tarball.
216
+
217
+ ### Notes
218
+
219
+ - The Digital Kin accent (`#FFAB00`) is a HIGHLIGHT colour: white on it measures **1.90:1**,
220
+ so it carries stars, focus rings and ornaments with dark ink on top (**9.81:1**) — never a
221
+ white-on-yellow button. Both halves are asserted by `digitalkin.test.ts`.
222
+ - DynaPuff is deliberately absent from the token set. It has **no Greek glyphs**, and browser
223
+ font fallback is per-glyph, so a mixed Greek/Latin heading would render in two typefaces at
224
+ once. It lives only inside the wordmark SVG as vector paths.
225
+ - Unlike the other three presets, `digitalkin`'s **borders meet WCAG 1.4.11** (3.34:1 light,
226
+ 3.40:1 dark) rather than inheriting the registered `*.border` gaps. Those gaps are frozen
227
+ current values of live portals; this preset ships before it has pixels to regress, so it
228
+ takes the compliant value.
229
+ - One registered gap: **`digitalkin.dark.semantic.error`** (2.28:1). `semantic.error` is a
230
+ single token rendered as text in both modes, and AA on white caps its luminance at 0.183
231
+ while AA on the raised dark surface demands ≥0.267 — mutually exclusive. Fixing it needs a
232
+ mode-aware split of `SemanticColors` affecting all four presets, not a colour nudge.
233
+
234
+ ## [1.2.0]
235
+
236
+ ### Added
237
+
238
+ `DesignTokens` was a **lossy carrier**. Two RN-web apps (ichnos, kefi) discovered this
239
+ independently and wrote the *same* private workaround: the shape had no slot for the muted
240
+ inset surface, the on-brand foreground, or the three status background tints, so each app
241
+ smuggled those five values into free slots of the broadcast theme via a hand-rolled overlay.
242
+ Two independent uses of one workaround is the trigger to extract it. These are now
243
+ first-class slots, and the overlay is a shipped emitter.
244
+
245
+ - **`ModeColors.surfaceMuted?`** — the subtle inset surface (table header rows, chips, wells).
246
+ Distinct from `surface` (cards) and `surfaceElevated` (modals): it recedes rather than lifts.
247
+ - **`DesignTokens.onBrand?`** — the foreground for content sitting ON a `primary`-filled
248
+ surface. It is a *contrast partner* of `primary`, not a mode colour, so it lives beside it.
249
+ - **`SemanticColors.successBg?` / `warningBg?` / `errorBg?` / `infoBg?`** — the soft fill a
250
+ status badge, banner or row-highlight paints behind text of the base colour. A tint is NOT
251
+ derivable from its base (it is hand-picked for contrast), so it needs its own slot; without
252
+ one a status surface could not be themed at all.
253
+ - **`toUiTheme(tokens, mode?)`** — a fourth emitter: the shared RN UI kit's `UiTheme` (what
254
+ `@dloizides/ui-feedback`'s `UiProvider` broadcasts). It is **lossless** — every token the
255
+ shape can express lands in an addressable slot (`palette.onBrand`, `palette.surfaceMuted`,
256
+ each status tint at the `100` step), so an app can round-trip its entire palette back out
257
+ of the live provider instead of keeping a parallel static copy that can never follow a
258
+ dark-mode toggle or a per-tenant brand. The theme type is declared **structurally** here,
259
+ exactly as `RnThemeConfig` declares the `TenantThemeConfig` shape, so the package keeps its
260
+ zero-dependency / zero-peer guarantee and takes no dependency on the kit it feeds.
261
+ - **`UI_TINT_STEP` / `UI_MAIN_STEP` / `UI_DEEP_STEP`** — the step names, exported so a consumer
262
+ addresses a scale by name rather than by a magic `'500'`.
263
+ - CSS-variable names (`--on-brand`, `--surface-muted`, `--success-bg`, …) and Tailwind colour
264
+ keys (`on-brand`, `surface-muted`, `success-bg`, …) for the new tokens.
265
+
266
+ ### Fixed
267
+
268
+ - **Scale collapse.** The naive `value => ({ '100': v, '500': v, '700': v })` projection that
269
+ both apps used writes ONE value into every step, silently discarding the deeper brand step
270
+ and every status tint — a theme built that way cannot reproduce the palette it came from.
271
+ `toUiTheme` emits `secondary` as its own scale and each status tint at the `100` step, so
272
+ the values survive. The package's own emitters (`toCssVars`, `toRnTheme`,
273
+ `toTailwindPreset`) were checked and carry no equivalent collapse.
274
+
275
+ ### Compatibility
276
+
277
+ Entirely additive. Every new token is optional and every new emitted key appears **only** when
278
+ a preset declares the token, so `AML_TOKENS`, `EREVNA_TOKENS` and `KATALOGOS_TOKENS` emit
279
+ byte-identical CSS, RN-theme and Tailwind output — verified by the pre-existing emitter test
280
+ suites passing unmodified.
281
+
282
+ ## [1.1.0]
283
+
284
+ ### Fixed
285
+
286
+ - **WCAG AA contrast (UX-11)**: `light.textSecondary` in `EREVNA_TOKENS` and `KATALOGOS_TOKENS`
287
+ was `#777777`, which measures **4.48:1 on `#ffffff` and 4.18:1 on the `#f7f7f7` card surface** —
288
+ both under the AA 4.5:1 floor for normal text, and form-field labels render in this colour.
289
+ Now `#717171` (**4.88:1** and **4.56:1** against those same two surfaces, verified against each
290
+ preset's ACTUAL surfaces rather than assumed from another package's).
291
+ `AML_TOKENS` was already compliant (`#4a5567`, worst case 6.97:1) and is unchanged.
292
+
293
+ This is the same defect `@dloizides/theme-web@1.2.0` fixed in its `DEFAULT_THEME_CONFIG`, but
294
+ that fix does NOT reach these presets — apps resolving colours through a preset bypass
295
+ theme-web's defaults entirely. The bad value survived here independently.
296
+
297
+ ### Added
298
+
299
+ - **`src/contrast.ts`** — a correct WCAG 2.1 contrast implementation (sRGB gamma linearization +
300
+ ITU-R BT.709 weighting; NOT a naive channel average, which mis-scores exactly the mid-greys that
301
+ matter). Deliberately a COPY of theme-web's, not an import: this package ships **zero
302
+ dependencies and zero peers** by design, and depending on a React theming package for pure
303
+ arithmetic would invert the layering (theme-web already depends on this package).
304
+ Exported (`contrastRatio`, `relativeLuminance`, `meetsContrast`, `isHexColor`, and the
305
+ `AA_*_RATIO` thresholds) so consumers that let users override tokens at runtime can validate
306
+ those overrides with the same maths that guards the shipped presets.
307
+ - **`src/contrast.test.ts`** — pins the calculator against external reference pairs
308
+ (`#767676`/white = 4.54:1, `#777777`/white = 4.48:1, black/white = 21:1, and `#808080`'s true
309
+ luminance of 0.2159 vs a channel-average's 0.502) so the guard cannot silently be wrong.
310
+ - **`src/presets/presets.contrast.test.ts`** — a permanent guard measuring every text-role colour
311
+ in EVERY preset against every surface it renders on, in BOTH modes. Failures must be registered
312
+ in `KNOWN_GAPS` with their exact measured ratio, and the registry is asserted to be exactly
313
+ accurate — so a gap cannot be added silently, a stale entry fails once the colour is fixed, and
314
+ a newly failing colour nobody registered fails the suite outright. Non-hex token values (AML's
315
+ `rgba()` dark border, which has no fixed luminance) are excluded by an asserted explicit list
316
+ rather than silently skipped.
317
+
318
+ ### Notes
319
+
320
+ - Only TEXT and essential-boundary roles are asserted. Decorative fills (`primary`/`secondary`/
321
+ `accent`, and the `success`/`warning`/`info` semantic bases) carry no contrast requirement;
322
+ asserting them would turn a compliance guard into a brand redesign.
323
+ - 8 pre-existing gaps are registered, all one root cause: a single token serving both a text role
324
+ and a fill/decorative role across both modes (`border`/`divider`, `semantic.error`). These need
325
+ the roles split before any value can move — a design change, not a colour nudge. They mirror the
326
+ gaps already registered in `@dloizides/theme-web`.
327
+
328
+ ## [1.0.0]
329
+
330
+ ### Added
331
+
332
+ - Initial release (task #78) — the cross-stack design-token source.
333
+ - **Token shape** (`DesignTokens`) whose core fields mirror `@dloizides/tenant-theme-web`'s
334
+ `TenantThemeConfig` (`primary`/`secondary`/`accent`/`semantic`/`light`/`dark`/`typography`/
335
+ `branding`), plus optional `radii`/`shadows`/`extensions` supersets for richer stacks.
336
+ - **Three emitters from one source**: `toCssVars` (CSS custom properties for vanilla-JS),
337
+ `toRnTheme` (a `TenantThemeConfig`-compatible object for RN-web), `toTailwindPreset` (a Tailwind
338
+ preset for the DOM-React ThemeStudio).
339
+ - **Per-app presets** seeded byte-for-byte from current values: `EREVNA_TOKENS`,
340
+ `KATALOGOS_TOKENS` (from each RN app's `default` theme preset), and `AML_TOKENS` (from the AML
341
+ console's `wwwroot/shared/ui.css` `:root`). Plus the `PRESETS` map.
342
+ - **The cross-stack naming contract (#78b)**: `DEFAULT_CSS_VAR_NAMES` (canonical kebab names) and
343
+ `AML_CSS_VAR_NAMES` (the AML console's existing `ui.css` variable names), documented in the
344
+ README with the full name-mapping table and the open naming decisions.
345
+ - Behaviour-preserving by design: runtime tests assert `toRnTheme(EREVNA_TOKENS)` deep-equals the
346
+ app's current `DEFAULT_THEME_CONFIG` and `toCssVars(AML_TOKENS, AML_CSS_VAR_NAMES)` reproduces
347
+ `ui.css`'s `:root` verbatim. Zero visual change on adoption.
348
+ - Values only — no components (those live in `@dloizides/ui-layout`/`ui-forms`/`ui-feedback`/
349
+ `ui-icons`/`ui-tables`). Zero runtime dependencies.