@designtools/tokens 0.15.0 → 0.16.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
@@ -2,6 +2,35 @@
2
2
 
3
3
  Notable changes to `@designtools/tokens`. Dates are release dates; versions follow semver, with breaking changes in the minor slot while the package is pre-1.0.
4
4
 
5
+ ## 0.16.0
6
+
7
+ ### Minor Changes
8
+
9
+ - edbceee: A ground's border reads on its card: a floor of 1.5:1 against the ground's `--surface`.
10
+
11
+ - Under `tint own`, a ground's `--border` kept the page's separation from the ground and was never measured against the ground's card. After 0.14 re-spaced the ramps, a deep navy band's hairline sat one step off its card (navy 600 on a 700 card, 1.39:1) and all but vanished, with every check passing; on many dark bands the border was the card's own step (1:1). The border is now searched to at least 1.5:1 against the card, the gentlest step of its ramp that gets there, never fading on the ground to do it, so it stays a hairline and well under an input's 3:1. The navy band's border is navy-500, which is what madebymany-com pinned by hand.
12
+ - 1.5:1 sits above the 1.1 that lets a panel draw (a 1px line has far less area), below the 1.6 a tonal button aims for to read as a shape and the 3:1 of a control's edge, and at the page's own dark-mode hairline on its card (1.48 to 1.69:1 across the bench).
13
+ - Under `tint page` or one colour the lines are as asked; a border under 1.5:1 on the card is noted in `--report`.
14
+ - **This changes generated output** for grounds with `tint own` whose border was under 1.5:1 on their card: their `--border` moves, usually one or two steps (a dark band's to a lighter or darker step of its ramp; a pale band's, such as mist or sand at 200, one step darker). Nothing else moves. **Upgrading:** regenerate, and look at each ground's lines; a `--border` pinned in `tokens.local.css` to work around this can come out.
15
+ - b5af598: `--local`: a dark override reaches every dark reader, and the check holds it to that.
16
+
17
+ - `tokens.css` sets dark twice: for the toggle (`[data-theme="dark"]`, `.dark`) and for a visitor whose system is dark (`:root:not([data-theme="light"]):not(.light)` inside `@media (prefers-color-scheme: dark)`), the second at a higher specificity. The `tokens.local.css` check accepted only the toggle's selectors, so a dark override showed on the toggle, missed every system-dark visitor, and passed.
18
+ - The check now accepts the system-dark block exactly as `tokens.css` writes it, and requires each dark override in both places at the same value. One set only for the toggle fails with the block to add: `--surface in [data-theme="dark"] or .dark: a visitor whose system is dark keeps the generated value, since the system-dark block outranks the toggle. Set the same under system dark: @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]):not(.light) { --surface: …; } }`. One set only under system dark fails the other way. Overrides under system dark are re-checked for contrast like the rest. `LocalProblem` has a new kind, `"dark"`.
19
+ - **Upgrading:** a `tokens.local.css` with dark overrides under `[data-theme="dark"]` or `.dark` alone now exits 1. Paste the block the message gives after them. Any other at-rule is still refused.
20
+ - d358fbb: `--color` refuses a reserved name where it is given, with the reason and the list.
21
+
22
+ - `--color "yellow=#ffff00@200"` used to produce no `yellow` ramp: it recoloured warning instead, and the mistake only showed later, as `--ground-action midnight=yellow-200` failing with "names no ramp: yellow". Now it fails at the flag: `"yellow" is warning's second name (written by --aliases), so it never becomes a ramp of its own: recolour warning with --color warning=…, or give this colour another name`, followed by the reserved names.
23
+ - Reserved, with or without `--aliases`: `green`, `red` and `yellow` (the status colours' second names), `white` and `black` (the fixed colours, which a ramp would replace), and the page tokens `canvas`, `surface`, `overlay`, `foreground`, `border`, `input`, `ring` and `shadow` (`--color border=…` wrote a second `--border`). The same names are refused in a seed file's `additionalColors`.
24
+ - **Upgrading:** a command or seed that adds a colour under one of these names now exits 1. To recolour a status colour, name it (`--color warning=…`, `--color destructive=…`); for a colour of your own, give it another name (`sun`, `brick`). With `--aliases`, recolouring by the status name still moves both names.
25
+ - Exported: `RESERVED_COLOR_NAMES`, `reservedColorReason`. The library's `generateTokens` is unchanged.
26
+ - 220e546: The type tiers of the owned scale are closed: a new name there is a step, never a use.
27
+
28
+ - **`scale --verify`** and **`designtools-manifest check`** now fail a name in `--text-*`, `--leading-*`, `--tracking-*` or `--font-weight-*` that is not a step of that tier: `--text-display`, `--text-headline`, `--text-label`, `--text-cta` and `--leading-lead` all fail. The steps are Tailwind's own words, plus the ones between two of them: text `3xs`, `2xs`, `xs`, `sm`, `base`, `lg`, `xl`, `2xl` to `9xl` (with their `--line-height`, `--letter-spacing` and `--font-weight` companions); leading `none`, `tightest`, `tighter`, `tight`, `snug`, `medium`, `normal`, `relaxed`, `loose`, `looser`, `loosest`; tracking `tightest`, `tighter`, `tight`, `normal`, `wide`, `wider`, `widest`; weights `thin`, `extralight`, `light`, `normal`, `medium`, `semibold`, `bold`, `extrabold`, `black`. The message names the tier's steps and says what to do instead: a size that changes by screen is set in the component (`text-5xl lg:text-8xl`); a role a page uses (display, headline, label) is a step, mapped in the docs config's `type.hierarchy`.
29
+ - **Upgrading:** run `generate-tokens scale --verify` on your `scale.css`. For each name it refuses, set the component in a step (`--text-display: 4rem` becomes `--text-6xl: 4rem`, or an existing step), replace the use's utility in the code (`text-display` to `text-6xl`), and map the role to the step in the docs config's `type.hierarchy`. Spacing, size, container, radius, shadow, duration, ease and breakpoint still take any name inside their namespace (`--spacing-section-lg`).
30
+ - **`scale --init`** refuses an `--overrides` name in a type tier that is not a step, so an owned scale starts inside the contract.
31
+ - The owned scale's header no longer invites new names in the type tiers; a scale written before keeps its old header, which is only a comment.
32
+ - `ScaleVerdict` has a new `offScale` list. Exported: `TYPE_STEPS`, `offScaleReason`, `OFF_SCALE_ADVICE`.
33
+
5
34
  ## 0.15.0
6
35
 
7
36
  ### Minor Changes
package/README.md CHANGED
@@ -193,6 +193,8 @@ A **ground** is a section painted one step of a ramp: a deep green band, a lime
193
193
  | `own` | steps from the ground's ramp, searched to the text floors | steps from the ground's ramp, each searched to its floor: a deeper green line on green | a step off the ground on its ramp, as far from it as the page's card is from the page: a lighter green card on deep green |
194
194
  | one colour: `white`, `black`, or a step (`sage-100`) | that colour for body and secondary text both (the report says secondary text is then no quieter) | as `own`, with that colour for every line, edge and ring: white lines on deep green | that colour for the card and the quiet panel, their text the ground's where it reads and white or black where it doesn't. The report notes a card that doesn't draw against the ground |
195
195
 
196
+ **A ground's hairline reads on its card.** Under `tint own` the border keeps the separation the page's has from the page, and then at least 1.5:1 against the ground's card, so a card's edge and a rule inside it still show: on a deep navy band with a navy-700 card, navy-500 rather than 600 (1.39:1, all but gone). It is the gentlest step of its ramp that reaches that, never fading on the ground to do it, so it stays a hairline, well under an input's 3:1. Under `tint page` or one colour the lines are as asked, and the report notes a border under 1.5:1 on the card.
197
+
196
198
  Defaults: `text page`, `tint own`, and panels unset, which follow the lines: the page's under `tint page`, the ground's own otherwise. So text is one standard set across a site, and lines and panels take each ground's hue. A bare value sets every ground; `<name>=<value>` sets one and wins: `--ground-tint own --ground-tint pine=white`. In a seed: `"grounds": { "pine": { "ramp": "pine", "step": 800, "tint": "white", "panels": "page" } }`, `"groundTint"`, `"groundPanels"`, `"groundText"`.
197
199
 
198
200
  **Buttons and other colours keep the page's value unless it fails.** The primary and secondary buttons, accent, success, error and warning are the page's wherever they stand out from the ground (3:1 for a fill, with a label that reads on it). One that doesn't is searched along its own ramp: a navy button on deep green moves to a step that shows. Under `tint own` (and one colour) the primary button is drawn from the ground's ramp (on its own colour it turns over: the deepest step with the ground's colour in its label), and the secondary button is tonal: a tint of the ground's hue whose label carries it.
@@ -351,7 +353,8 @@ Every other flag goes to the colour run, as it would without `init`. Run again,
351
353
 
352
354
  Most changes are an input: a flag, the seed, shade overrides. For the few a flag can't say, there is one place, `tokens.local.css`, loaded straight after `tokens.css`, and the generator holds it to the system's own terms on every run (`--local <file>`; `init` passes it for you):
353
355
 
354
- - **Selectors are the generator's own:** `:root`, `[data-theme="light"]`, `[data-theme="dark"]`, `.dark` and `[data-surface="<ground>"]`, alone or in a list. No at-rules.
356
+ - **Selectors are the generator's own:** `:root`, `[data-theme="light"]`, `[data-theme="dark"]`, `.dark` and `[data-surface="<ground>"]`, alone or in a list, and the system-dark block exactly as `tokens.css` writes it. No other at-rule.
357
+ - **A dark override reaches every dark reader.** `tokens.css` sets dark twice: for the toggle (`[data-theme="dark"]`, `.dark`) and for a visitor whose system is dark (`:root:not([data-theme="light"]):not(.light)` inside `@media (prefers-color-scheme: dark)`), the second at a higher specificity. An override set only for the toggle misses a system-dark visitor, toggle or not, so each dark override is set in both, to the same value. The check names any that isn't, and gives the block to add.
355
358
  - **Names are tokens the generator writes:** never a `--color-*` alias or ramp step (move a step with shade overrides; set a token by its own name), and never a new name. A name of the project's own belongs in its own stylesheet.
356
359
  - **Values point at the system:** `var()` references, or a ramp step nudged with relative colour, never a literal colour.
357
360
 
@@ -360,6 +363,16 @@ Most changes are an input: a flag, the seed, shade overrides. For the few a flag
360
363
  [data-surface="navy"] {
361
364
  --surface: oklch(from var(--color-navy-800) calc(l + 0.07) c h);
362
365
  }
366
+
367
+ /* a dark override, for both dark readers */
368
+ [data-theme="dark"], .dark {
369
+ --surface: var(--color-neutral-800);
370
+ }
371
+ @media (prefers-color-scheme: dark) {
372
+ :root:not([data-theme="light"]):not(.light) {
373
+ --surface: var(--color-neutral-800);
374
+ }
375
+ }
363
376
  ```
364
377
 
365
378
  Each override is listed as pinned by hand, and every pair it touches (a surface and the text set on it) is re-checked for contrast at `--target`, so a pinned card can't quietly fail its text. Any problem exits 1:
@@ -390,7 +403,20 @@ npx @designtools/tokens scale --verify app/styles/scale.css
390
403
  | Screen sizes | `--breakpoint-sm` … `--breakpoint-2xl` | Where a page can change shape, from each size up |
391
404
  | Widths | `--container-3xs` … `--container-7xl` | The widths content is set to |
392
405
 
393
- The values are the project's; **the names are the contract.** Keep every name, and add new ones only inside a tier's namespace (a section step is `--spacing-section`, a page width `--container-measure`), never a system of their own beside it. `--verify`, and `designtools-manifest check` on every commit, hold a project to that and never compare values. The names are Tailwind v4's theme namespaces, so on Tailwind each is a utility as well, and on any other stack a plain custom property. Screen sizes are the one tier a variable can't carry, since CSS can't read one in `@media`: `--format css` writes them as `@custom-media` too (compiled by Lightning CSS or postcss-preset-env), and DTCG, JSON and Tailwind v3 carry them as values.
406
+ The values are the project's; **the names are the contract.** Keep every name, and add new ones only inside a tier's namespace, never a system of their own beside it.
407
+
408
+ **The type tiers are scales, so a new name there is a step, never a use.** A name says where a step sits, and only the tier's own words do that:
409
+
410
+ | Tier | Steps a project can add |
411
+ | --- | --- |
412
+ | `--text-*` | `3xs`, `2xs`, `xs`, `sm`, `base`, `lg`, `xl`, `2xl` to `9xl`, each with its `--line-height`, `--letter-spacing` and `--font-weight` companions |
413
+ | `--leading-*` | `none`, `tightest`, `tighter`, `tight`, `snug`, `medium`, `normal`, `relaxed`, `loose`, `looser`, `loosest` |
414
+ | `--tracking-*` | `tightest`, `tighter`, `tight`, `normal`, `wide`, `wider`, `widest` |
415
+ | `--font-weight-*` | `thin`, `extralight`, `light`, `normal`, `medium`, `semibold`, `bold`, `extrabold`, `black` |
416
+
417
+ Tailwind's own words, and the ones between two of them (`--leading-medium` sits between snug and normal). `--text-display`, `--text-headline`, `--text-label` or `--leading-lead` name a use, and fail. A size that changes by screen is set in the component (`text-5xl lg:text-8xl`); a role a page uses (display, headline, label) is a step, mapped in the docs config's `type.hierarchy`.
418
+
419
+ The other tiers take a project's own names inside their namespace: a section step is `--spacing-section`, a page width `--container-measure`. `--verify`, and `designtools-manifest check` on every commit, hold a project to all of this and never compare values. The names are Tailwind v4's theme namespaces, so on Tailwind each is a utility as well, and on any other stack a plain custom property. Screen sizes are the one tier a variable can't carry, since CSS can't read one in `@media`: `--format css` writes them as `@custom-media` too (compiled by Lightning CSS or postcss-preset-env), and DTCG, JSON and Tailwind v3 carry them as values.
394
420
 
395
421
  `--init` refuses to write over a scale that is already there; `--force` writes over it after listing what changes, for the rare deliberate reset. `--overrides` (JSON by token name: a value, or a value with its description) starts `--init` from other values than the defaults. `--format all` writes css, tailwind-v3, dtcg and json.
396
422
 
@@ -515,7 +541,7 @@ So an agent's contract is *scope, merge, verify* — and a bad merge is caught r
515
541
 
516
542
  ### Aliases move together
517
543
 
518
- With `--aliases`, `destructive`/`red`, `success`/`green` and `warning`/`yellow` are two names for one scale, so overriding either moves both. Without that, `--color destructive=…` would leave `bg-red-500` on the old colour and the two names would silently disagree inside the same file.
544
+ With `--aliases`, `destructive`/`red`, `success`/`green` and `warning`/`yellow` are two names for one scale, so recolouring it (`--color destructive=…`) moves both. Without that, `bg-red-500` would stay on the old colour and the two names would silently disagree inside the same file. The second names can't be given to `--color` at all, with `--aliases` or without: `--color yellow=…` would recolour warning rather than add a yellow, so it is refused, and says so.
519
545
 
520
546
  ## Upgrading to 0.12
521
547
 
@@ -602,7 +628,7 @@ With `gamut: "p3"`, the wide-gamut tiers are on `tokens.p3`, and the checks take
602
628
  |---|---|---|
603
629
  | `--primary <colour>` | — | Your brand colour. Required unless `--seed` supplies it. |
604
630
  | `--neutral <colour>` | `#747474` | Neutral seed. Drives greys, surfaces, borders. |
605
- | `--color <name>=<colour>[@<shade>]` | — | An extra named colour: a ramp and semantic tokens. Repeatable. `@<shade>` anchors its seed on that step. See [Adding colours](#adding-colours). |
631
+ | `--color <name>=<colour>[@<shade>]` | — | An extra named colour: a ramp and semantic tokens. Repeatable. `@<shade>` anchors its seed on that step. See [Adding colours](#adding-colours). Naming a status colour (`--color destructive=…`) recolours it. Some names are reserved, with or without `--aliases`, and refused where they are given: `green`, `red` and `yellow` (the status colours' second names; recolour warning with `--color warning=…`), `white` and `black` (fixed colours), and the page tokens `canvas`, `surface`, `overlay`, `foreground`, `border`, `input`, `ring` and `shadow`. |
606
632
  | `--decorative <name>` | — | Give an added colour its ramp only, with no semantic slots (`--<name>`, `-foreground`, `bg-<name>`), so an accent that must never be text or an action cannot be used as one. Repeatable. In a seed file, `"decorative": true` on the colour. |
607
633
  | `--seed <file.json>` | — | Replay a saved configuration. Flags given alongside it win, so a seed is defaults rather than a lock. |
608
634
  | `--stdin` | off | Read that same JSON from standard input. |
@@ -1083,6 +1083,7 @@ var GROUND_BASE_TOKENS = [
1083
1083
  var GROUND_COLOR_PARTS = ["", "-foreground", "-subdued", "-subdued-foreground", "-hover", "-active"];
1084
1084
  var FILL_FLOOR = 3;
1085
1085
  var PANEL_FLOOR = 1.1;
1086
+ var BORDER_FLOOR = 1.5;
1086
1087
  var TEXT_FLOOR = { "aa-large": 3, aa: 4.5, aaa: 7 };
1087
1088
  var BODY_AIM = 7;
1088
1089
  function groundTokenNames(colors) {
@@ -1092,20 +1093,15 @@ function semanticColors(semantic) {
1092
1093
  const core = ["primary", "neutral", "success", "destructive", "warning"];
1093
1094
  return [...core, ...Object.keys(semantic).filter((n) => !core.includes(n))];
1094
1095
  }
1096
+ var PAGE_NAMES = ["canvas", "surface", "overlay", "foreground", "border", "input", "ring", "shadow", "white", "black"];
1095
1097
  function reservedSurfaceNames(colors) {
1096
- return [
1097
- "canvas",
1098
- "surface",
1099
- "overlay",
1100
- "foreground",
1101
- "border",
1102
- "input",
1103
- "ring",
1104
- "shadow",
1105
- "white",
1106
- "black",
1107
- ...colors.flatMap((c) => [c, `${c}-subdued`])
1108
- ];
1098
+ return [...PAGE_NAMES, ...colors.flatMap((c) => [c, `${c}-subdued`])];
1099
+ }
1100
+ var RESERVED_COLOR_NAMES = [...ALIAS_PAIRS.map(([, alias]) => alias), ...PAGE_NAMES];
1101
+ function reservedColorReason(name) {
1102
+ const pair = ALIAS_PAIRS.find(([, alias]) => alias === name);
1103
+ const why = pair ? `"${name}" is ${pair[0]}'s second name (written by --aliases), so it never becomes a ramp of its own: recolour ${pair[0]} with --color ${pair[0]}=\u2026, or give this colour another name` : name === "white" || name === "black" ? `"${name}" is the fixed --color-${name}: give this colour another name` : PAGE_NAMES.includes(name) ? `"${name}" is the page token --${name}, which a colour of that name would collide with: give this colour another name` : void 0;
1104
+ return why && `${why}. Reserved: ${RESERVED_COLOR_NAMES.join(", ")}`;
1109
1105
  }
1110
1106
  var valueOf = (ref, palette) => {
1111
1107
  switch (ref.type) {
@@ -1445,6 +1441,15 @@ function buildGround(name, given, tiers, views, options) {
1445
1441
  refs.surface = fillRef(panels, srgb);
1446
1442
  if (cr(refs.surface, ground) < PANEL_FLOOR) notes.push(`surface: ${cr(refs.surface, ground).toFixed(2)}:1 against the ground, so the card doesn't draw`);
1447
1443
  }
1444
+ if (cr(refs.border, refs.surface) < BORDER_FLOOR) {
1445
+ const from = refs.border;
1446
+ if (tint === "own" && from.type === "shade") {
1447
+ const strength = (r) => Math.max(cr(r, refs.surface), cr(r, ground));
1448
+ refs.border = active.filter((s) => srgb[from.colorName]?.[s] !== void 0).map((s) => shade(from.colorName, s)).filter((r) => cr(r, refs.surface) >= BORDER_FLOOR && cr(r, ground) >= cr(from, ground)).sort((a, b) => strength(a) - strength(b))[0] ?? bestEnd(refs.surface);
1449
+ } else {
1450
+ notes.push(`border: ${cr(refs.border, refs.surface).toFixed(2)}:1 against the card, under ${BORDER_FLOOR}:1`);
1451
+ }
1452
+ }
1448
1453
  refs.canvas = ground;
1449
1454
  refs["canvas-foreground"] = body;
1450
1455
  refs["surface-foreground"] = cr(body, refs.surface) >= textFloor ? body : bestEnd(refs.surface);
@@ -2555,7 +2560,12 @@ function blocks(css) {
2555
2560
  function decls(body) {
2556
2561
  return [...body.matchAll(/(--[\w-]+)\s*:\s*([^;]+);?/g)].map((m) => [m[1], m[2].trim()]);
2557
2562
  }
2563
+ var SYSTEM_DARK = /^@media\s*\(\s*prefers-color-scheme\s*:\s*dark\s*\)\s+(.+)$/;
2564
+ var isSystemDark = (selector) => SYSTEM_DARK.exec(selector)?.[1].trim() === MODE_SELECTORS.systemDark;
2565
+ var isToggledDark = (selector) => selector.split(",").some((part) => ['[data-theme="dark"]', ".dark"].includes(part.trim()));
2566
+ var SYSTEM_DARK_BLOCK = (decls2) => `@media (prefers-color-scheme: dark) { ${MODE_SELECTORS.systemDark} { ${decls2} } }`;
2558
2567
  function scopesOf(selector) {
2568
+ if (isSystemDark(selector)) return ["dark"];
2559
2569
  const scopes = [];
2560
2570
  for (const part of selector.split(",").map((s) => s.trim())) {
2561
2571
  if (part === ":root" || part === '[data-theme="light"]' || part === '[data-surface="canvas"]') scopes.push("light");
@@ -2633,8 +2643,11 @@ function checkLocalOverrides(generated, local, target = "aa") {
2633
2643
  }
2634
2644
  const touched = /* @__PURE__ */ new Map();
2635
2645
  for (const b of blocks(local)) {
2636
- if (b.selector.startsWith("@")) {
2637
- problems.push({ kind: "selector", message: `${b.selector}: no at-rules; set a mode with [data-theme="dark"]` });
2646
+ if (b.selector.startsWith("@") && !isSystemDark(b.selector)) {
2647
+ problems.push({
2648
+ kind: "selector",
2649
+ message: `${b.selector}: no at-rules but the system-dark block (${SYSTEM_DARK_BLOCK("\u2026")}); set a mode with [data-theme="dark"]`
2650
+ });
2638
2651
  continue;
2639
2652
  }
2640
2653
  const reached = scopesOf(b.selector);
@@ -2666,7 +2679,28 @@ function checkLocalOverrides(generated, local, target = "aa") {
2666
2679
  }
2667
2680
  }
2668
2681
  }
2669
- const localBlocks = blocks(local).filter((b) => !b.selector.startsWith("@"));
2682
+ const darkOf = (match) => {
2683
+ const out = /* @__PURE__ */ new Map();
2684
+ for (const b of blocks(local)) if (match(b.selector)) for (const [n, v] of b.decls) out.set(n, v);
2685
+ return out;
2686
+ };
2687
+ const toggled = darkOf(isToggledDark);
2688
+ const system = darkOf(isSystemDark);
2689
+ const missing = [...toggled].filter(([n, v]) => system.get(n) !== v);
2690
+ if (missing.length) {
2691
+ problems.push({
2692
+ kind: "dark",
2693
+ message: `${missing.map(([n]) => n).join(", ")} in [data-theme="dark"] or .dark: a visitor whose system is dark keeps the generated value, since the system-dark block outranks the toggle. Set the same under system dark: ${SYSTEM_DARK_BLOCK(missing.map(([n, v]) => `${n}: ${v};`).join(" "))}`
2694
+ });
2695
+ }
2696
+ const unpaired = [...system].filter(([n, v]) => toggled.get(n) !== v);
2697
+ if (unpaired.length) {
2698
+ problems.push({
2699
+ kind: "dark",
2700
+ message: `${unpaired.map(([n]) => n).join(", ")} under system dark: a visitor who turns dark on with the toggle on a light system keeps the generated value. Set the same in [data-theme="dark"], .dark { ${unpaired.map(([n, v]) => `${n}: ${v};`).join(" ")} }`
2701
+ });
2702
+ }
2703
+ const localBlocks = blocks(local).filter((b) => !b.selector.startsWith("@") || isSystemDark(b.selector));
2670
2704
  for (const [s, touchedNames] of touched) {
2671
2705
  const map = scope(s);
2672
2706
  for (const b of localBlocks) {
@@ -2700,6 +2734,9 @@ var LOCAL_TEMPLATE = `/* tokens.local.css: the project's overrides of the genera
2700
2734
  Most changes are an input instead (a flag, the seed, shade overrides): use this only for a value
2701
2735
  the generator can't say. generate-tokens --local checks it against the system:
2702
2736
  - selectors: :root, [data-theme="light"], [data-theme="dark"], .dark, [data-surface="<ground>"];
2737
+ - a dark override is set twice, to the same value, so it reaches every dark reader: in
2738
+ [data-theme="dark"], .dark { \u2026 } and in the system-dark block, which outranks the toggle:
2739
+ @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]):not(.light) { \u2026 } }
2703
2740
  - names: tokens the generator writes (never a --color- alias or ramp step, never a new name);
2704
2741
  - values: var() references, or a ramp step nudged with oklch(from var(--color-\u2026) \u2026); never a literal colour.
2705
2742
  Each override is reported as pinned by hand, and the pairs it touches are re-checked for contrast. */
@@ -3022,8 +3059,11 @@ function ownedScaleHeader(version) {
3022
3059
  return [
3023
3060
  `/* ${OWNED_SCALE_MARK} v${version}: scaffolded once, now this project's own.`,
3024
3061
  " Retune any value here by hand: nothing regenerates this file. The names are the contract:",
3025
- " keep every one, and add new ones only inside a tier's namespace (--spacing-*, --text-*, \u2026),",
3026
- " which designtools-manifest check verifies. */"
3062
+ " keep every one. Type sizes, line heights, tracking and weights are scales, so a new name",
3063
+ " there is a step (--text-5xl, --leading-loose), never a use (--text-display): a role is a",
3064
+ " step mapped in the docs config, and a size that changes by screen is set in the component.",
3065
+ " Space, sizes, widths, corners, shadows and motion take a project's own names inside their",
3066
+ " namespace (--spacing-section). designtools-manifest check verifies both. */"
3027
3067
  ].join("\n");
3028
3068
  }
3029
3069
  function isOwnedScale(css) {
@@ -3043,6 +3083,35 @@ var TIER_PREFIX = {
3043
3083
  breakpoint: "--breakpoint-",
3044
3084
  container: "--container-"
3045
3085
  };
3086
+ var TYPE_STEPS = {
3087
+ text: ["3xs", "2xs", "xs", "sm", "base", "lg", "xl", "2xl", "3xl", "4xl", "5xl", "6xl", "7xl", "8xl", "9xl"],
3088
+ leading: ["none", "tightest", "tighter", "tight", "snug", "medium", "normal", "relaxed", "loose", "looser", "loosest"],
3089
+ tracking: ["tightest", "tighter", "tight", "normal", "wide", "wider", "widest"],
3090
+ "font-weight": ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black"]
3091
+ };
3092
+ var TEXT_COMPANIONS = ["line-height", "letter-spacing", "font-weight"];
3093
+ var TYPE_TITLE = {
3094
+ text: "type sizes",
3095
+ leading: "line heights",
3096
+ tracking: "tracking",
3097
+ "font-weight": "weights"
3098
+ };
3099
+ function typeStep(name) {
3100
+ for (const tier of Object.keys(TYPE_STEPS)) {
3101
+ const prefix = TIER_PREFIX[tier];
3102
+ if (!name.startsWith(prefix)) continue;
3103
+ const [step, companion, ...rest] = name.slice(prefix.length).split("--");
3104
+ const steps = TYPE_STEPS[tier];
3105
+ const ok = steps.includes(step) && !rest.length && (companion === void 0 || tier === "text" && TEXT_COMPANIONS.includes(companion));
3106
+ return { tier, step: ok };
3107
+ }
3108
+ return void 0;
3109
+ }
3110
+ function offScaleReason(name) {
3111
+ const tier = typeStep(name)?.tier ?? "text";
3112
+ return `is not a step of the ${TYPE_TITLE[tier]} (${TYPE_STEPS[tier].join(", ")})`;
3113
+ }
3114
+ var OFF_SCALE_ADVICE = "a type step names a place on the scale, never a use. A size that changes by screen is set in the component (text-5xl lg:text-8xl); a role a page uses (display, headline, label) is a step, mapped in the docs config's type.hierarchy.";
3046
3115
  function verifyScale(css) {
3047
3116
  const declared = new Set([...css.matchAll(/(?:^|[;{\s])(--[\w-]+)\s*:/g)].map((m) => m[1]));
3048
3117
  const tiers = defaultScale();
@@ -3050,10 +3119,12 @@ function verifyScale(css) {
3050
3119
  const inTier = (name) => Object.values(TIER_PREFIX).some((prefix) => name === prefix || name.startsWith(prefix.endsWith("-") ? prefix : `${prefix}-`));
3051
3120
  const missing = [...names].filter((name) => !declared.has(name));
3052
3121
  const added = [...declared].filter((name) => !names.has(name));
3122
+ const offScale = added.filter((name) => typeStep(name)?.step === false);
3053
3123
  return {
3054
3124
  missing,
3055
3125
  strays: added.filter((name) => !inTier(name)),
3056
- own: added.filter(inTier)
3126
+ offScale,
3127
+ own: added.filter((name) => inTier(name) && !offScale.includes(name))
3057
3128
  };
3058
3129
  }
3059
3130
 
@@ -3190,6 +3261,8 @@ export {
3190
3261
  GROUND_COLOR_PARTS,
3191
3262
  groundTokenNames,
3192
3263
  reservedSurfaceNames,
3264
+ RESERVED_COLOR_NAMES,
3265
+ reservedColorReason,
3193
3266
  suggestStep,
3194
3267
  generateGroundTokens,
3195
3268
  generateTokens,
@@ -3220,6 +3293,9 @@ export {
3220
3293
  OWNED_SCALE_MARK,
3221
3294
  ownedScaleHeader,
3222
3295
  isOwnedScale,
3296
+ TYPE_STEPS,
3297
+ offScaleReason,
3298
+ OFF_SCALE_ADVICE,
3223
3299
  verifyScale,
3224
3300
  stepContract,
3225
3301
  GENERATOR_NAME,
package/dist/cli.js CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  APCAUnavailableError,
4
4
  DEFAULT_NEUTRAL_COLOR,
5
5
  LOCAL_TEMPLATE,
6
+ OFF_SCALE_ADVICE,
6
7
  SECTIONED_FORMATS,
7
8
  SHADE_PRESETS,
8
9
  TOKEN_SECTIONS,
@@ -28,11 +29,13 @@ import {
28
29
  isInGamut,
29
30
  isOwnedScale,
30
31
  mergeSlice,
32
+ offScaleReason,
31
33
  overrideContract,
32
34
  ownedScaleHeader,
33
35
  parseProvenance,
34
36
  parseToOklch,
35
37
  provenanceComment,
38
+ reservedColorReason,
36
39
  resolveShades,
37
40
  ringBridgeShade,
38
41
  seedFingerprint,
@@ -45,7 +48,7 @@ import {
45
48
  usageReport,
46
49
  verifyScale,
47
50
  withJsonProvenance
48
- } from "./chunk-FY6LQL2A.js";
51
+ } from "./chunk-PG4SXPRL.js";
49
52
 
50
53
  // src/cli.ts
51
54
  import { parseArgs as parseArgs2 } from "util";
@@ -79,13 +82,23 @@ Space (--spacing), size (--size-*), type sizes with their line height and tracki
79
82
  motion (--duration-*, --ease-*), screen sizes (--breakpoint-*) and widths (--container-*).
80
83
 
81
84
  The scale is art direction, so it is written once and then edited by hand: nothing regenerates
82
- it, and no overrides file tracks it. The names are the contract. Keep every one, and add new
83
- ones only inside a tier's namespace; --verify (and designtools-manifest check) holds you to it.
85
+ it, and no overrides file tracks it. The names are the contract. Keep every one. A new name in
86
+ the type tiers is a step of that tier, never a use:
87
+ --text-* 3xs, 2xs, xs, sm, base, lg, xl, 2xl to 9xl (with --line-height,
88
+ --letter-spacing and --font-weight companions)
89
+ --leading-* none, tightest, tighter, tight, snug, medium, normal, relaxed, loose, looser, loosest
90
+ --tracking-* tightest, tighter, tight, normal, wide, wider, widest
91
+ --font-weight-* thin, extralight, light, normal, medium, semibold, bold, extrabold, black
92
+ A size that changes by screen is set in the component (text-5xl lg:text-8xl); a role a page uses
93
+ (display, headline, label) is a step, mapped in the docs config's type.hierarchy. The other tiers
94
+ take a project's own names inside their namespace (--spacing-section, --container-measure).
95
+ --verify (and designtools-manifest check) holds you to it.
84
96
 
85
97
  --init Write the scale once. Refuses if the file exists: it is the project's.
86
98
  --force With --init, write over an existing scale, after showing what changes.
87
99
  --verify <file> Check a scale file's names against the contract. Exit 1 on a missing name,
88
- or on one outside every tier. Values are never compared.
100
+ one outside every tier, or one in a type tier that is no step of it.
101
+ Values are never compared.
89
102
  --format <fmt> css | tailwind-v4 | tailwind-v3 | dtcg | json | all. Default: css.
90
103
  css writes screen sizes as @custom-media too, since a variable can't go in @media.
91
104
  --overrides <file> JSON, by token name, to start --init from other values than the defaults:
@@ -119,7 +132,7 @@ function verify(file, fail2) {
119
132
  } catch {
120
133
  return fail2(`can't read ${file}`);
121
134
  }
122
- const { missing, strays, own } = verifyScale(css);
135
+ const { missing, strays, offScale, own } = verifyScale(css);
123
136
  if (!isOwnedScale(css)) {
124
137
  process.stderr.write(`verify: ${file} is not an owned scale yet; run generate-tokens scale --init --force once to adopt it
125
138
  `);
@@ -128,7 +141,11 @@ function verify(file, fail2) {
128
141
  `);
129
142
  for (const name of strays) process.stderr.write(`verify: ${file} declares ${name}, which belongs to no tier of the scale
130
143
  `);
131
- if (missing.length || strays.length) return 1;
144
+ for (const name of offScale) process.stderr.write(`verify: ${file} declares ${name}, which ${offScaleReason(name)}
145
+ `);
146
+ if (offScale.length) process.stderr.write(`verify: ${OFF_SCALE_ADVICE}
147
+ `);
148
+ if (missing.length || strays.length || offScale.length) return 1;
132
149
  process.stderr.write(`verify: ${file} keeps the scale's names${own.length ? `, with ${own.length} of its own inside the tiers` : ""}
133
150
  `);
134
151
  return 0;
@@ -182,6 +199,10 @@ function runScale(argv, version) {
182
199
  } catch (err) {
183
200
  return fail2(err instanceof Error ? err.message : String(err));
184
201
  }
202
+ if (values2.init) {
203
+ const { offScale } = verifyScale(exportScale(tiers, "css"));
204
+ if (offScale.length) return fail2(`${offScale.map((name) => `--overrides ${name} ${offScaleReason(name)}`).join("; ")}: ${OFF_SCALE_ADVICE}`);
205
+ }
185
206
  const header = values2["no-provenance"] ? void 0 : values2.init ? ownedScaleHeader(version) : `/* Generated by @designtools/tokens v${version} (scale${values2.overrides ? `, overrides ${values2.overrides}` : ""}) - retune with --overrides, do not edit by hand */`;
186
207
  const formats2 = format2 === "all" ? FORMATS.filter((f) => f !== "tailwind-v4") : [format2];
187
208
  const target = (f) => format2 === "all" ? join(values2.out ?? ".", FILE_NAMES[f]) : values2.out;
@@ -321,7 +342,11 @@ Seeds:
321
342
  (--<name>, -foreground, -subdued, -hover, -active) for
322
343
  buttons, badges and text. Repeatable. Append @<shade> to
323
344
  anchor its seed on that step, as --seed-shade does for
324
- the primary: accent=#fde68a@200.
345
+ the primary: accent=#fde68a@200. Reserved, with or
346
+ without --aliases: green, red, yellow (the status
347
+ colours' second names: recolour warning with
348
+ --color warning=\u2026), canvas, surface, overlay,
349
+ foreground, border, input, ring, shadow, white, black.
325
350
  --decorative <name> Give a --color its ramp only, with no semantic slots (no
326
351
  --<name>, no bg-<name>), for an accent that must never be
327
352
  text or an action: --color sand=#e8d5b0 --decorative sand.
@@ -497,8 +522,11 @@ Overrides:
497
522
  after tokens.css: the one place for a value no flag or the
498
523
  seed can say. Checked on every run, with or without
499
524
  --check: only the generator's selectors (:root,
500
- [data-theme], .dark, [data-surface="<ground>"]), only its
501
- token names (never a --color- alias or a ramp step), and
525
+ [data-theme], .dark, [data-surface="<ground>"], and the
526
+ system-dark block as tokens.css writes it), only its
527
+ token names (never a --color- alias or a ramp step), a
528
+ dark override set to the same value under the toggle and
529
+ under system dark, so it reaches every dark reader, and
502
530
  values that point at the system (var(), or a ramp step
503
531
  nudged with oklch(from \u2026)), never a literal colour. Each
504
532
  override is listed as pinned by hand, and each pair it
@@ -666,6 +694,8 @@ var additionalColors = {};
666
694
  var additionalAnchors = {};
667
695
  var decorative = /* @__PURE__ */ new Set();
668
696
  for (const { name, color, seedShade: anchor, decorative: d } of seed.additionalColors ?? []) {
697
+ const reserved = reservedColorReason(name);
698
+ if (reserved) fail(`seed additionalColors ${name}: ${reserved}`);
669
699
  if (d) decorative.add(name);
670
700
  additionalColors[name] = validateColor(`seed colour ${name}`, color);
671
701
  if (anchor !== void 0) additionalAnchors[name] = { flag: `seed (additionalColors ${name})`, raw: anchor };
@@ -678,6 +708,8 @@ for (const entry of values.color ?? []) {
678
708
  if (!/^[a-z][a-z0-9-]*$/i.test(name)) {
679
709
  fail(`--color name must be alphanumeric/kebab-case (got "${name}")`);
680
710
  }
711
+ const reserved = reservedColorReason(name);
712
+ if (reserved) fail(`--color ${name}: ${reserved}`);
681
713
  const at = /^(.*)@(\d+)$/.exec(colour);
682
714
  if (at) {
683
715
  colour = at[1].trim();
package/dist/index.d.ts CHANGED
@@ -1192,6 +1192,14 @@ interface View {
1192
1192
  declare function groundTokenNames(colors: readonly string[]): string[];
1193
1193
  /** The page tokens a page surface's name can't take: it is emitted as `--<name>` beside them */
1194
1194
  declare function reservedSurfaceNames(colors: readonly string[]): string[];
1195
+ /**
1196
+ * The names an added colour (`--color <name>=…`) can't take, whether or not `--aliases` is on: a
1197
+ * status colour's second name (`yellow` is warning's), a fixed colour, or a page token. Each is a name
1198
+ * the generator already writes or deletes, so a colour given one would vanish or collide.
1199
+ */
1200
+ declare const RESERVED_COLOR_NAMES: readonly string[];
1201
+ /** Why an added colour can't take a name, or undefined when it can. */
1202
+ declare function reservedColorReason(name: string): string | undefined;
1195
1203
  /**
1196
1204
  * The step a colour lands on by its lightness, on a ramp anchored where the system anchors by
1197
1205
  * default: a deep green near 900, a pale blue-grey near 200. What `--color name=colour@step`
@@ -1270,7 +1278,11 @@ declare function stepContract(palette: PrimitivePalette): ContractBreak[];
1270
1278
  * to the system's own terms, so every project overrides the same way:
1271
1279
  *
1272
1280
  * - selectors are the generator's own: `:root`, `[data-theme="light"]`, `[data-theme="dark"]`, `.dark`,
1273
- * and `[data-surface="<ground>"]` (or `"canvas"`, the page), alone or in a list; no at-rules;
1281
+ * and `[data-surface="<ground>"]` (or `"canvas"`, the page), alone or in a list, plus the system-dark
1282
+ * block exactly as the generator writes it; no other at-rule;
1283
+ * - a dark override reaches every dark reader: set under `[data-theme="dark"]` or `.dark`, it is set to
1284
+ * the same value under system dark too, and the other way round, or a visitor whose system is dark
1285
+ * (or who toggled dark on a light system) keeps the generated value;
1274
1286
  * - names are tokens the generator writes; never a `--color-*` alias or ramp step (a ramp step is moved
1275
1287
  * with shade overrides, a token by setting the token itself), and never a new name;
1276
1288
  * - values point at the system: `var()` references, a ramp step nudged with relative colour
@@ -1285,7 +1297,7 @@ interface LocalOverride {
1285
1297
  value: string;
1286
1298
  }
1287
1299
  interface LocalProblem {
1288
- kind: "selector" | "name" | "value" | "contrast" | "syntax";
1300
+ kind: "selector" | "name" | "value" | "dark" | "contrast" | "syntax";
1289
1301
  message: string;
1290
1302
  }
1291
1303
  interface LocalReport {
@@ -1303,7 +1315,7 @@ declare const TARGETS: {
1303
1315
  */
1304
1316
  declare function checkLocalOverrides(generated: string, local: string, target?: keyof typeof TARGETS): LocalReport;
1305
1317
  /** The file `init` writes: empty, with its rules at the head. */
1306
- declare const LOCAL_TEMPLATE = "/* tokens.local.css: the project's overrides of the generated colour, loaded after tokens.css.\n Most changes are an input instead (a flag, the seed, shade overrides): use this only for a value\n the generator can't say. generate-tokens --local checks it against the system:\n - selectors: :root, [data-theme=\"light\"], [data-theme=\"dark\"], .dark, [data-surface=\"<ground>\"];\n - names: tokens the generator writes (never a --color- alias or ramp step, never a new name);\n - values: var() references, or a ramp step nudged with oklch(from var(--color-\u2026) \u2026); never a literal colour.\n Each override is reported as pinned by hand, and the pairs it touches are re-checked for contrast. */\n";
1318
+ declare const LOCAL_TEMPLATE = "/* tokens.local.css: the project's overrides of the generated colour, loaded after tokens.css.\n Most changes are an input instead (a flag, the seed, shade overrides): use this only for a value\n the generator can't say. generate-tokens --local checks it against the system:\n - selectors: :root, [data-theme=\"light\"], [data-theme=\"dark\"], .dark, [data-surface=\"<ground>\"];\n - a dark override is set twice, to the same value, so it reaches every dark reader: in\n [data-theme=\"dark\"], .dark { \u2026 } and in the system-dark block, which outranks the toggle:\n @media (prefers-color-scheme: dark) { :root:not([data-theme=\"light\"]):not(.light) { \u2026 } }\n - names: tokens the generator writes (never a --color- alias or ramp step, never a new name);\n - values: var() references, or a ramp step nudged with oklch(from var(--color-\u2026) \u2026); never a literal colour.\n Each override is reported as pinned by hand, and the pairs it touches are re-checked for contrast. */\n";
1307
1319
 
1308
1320
  /**
1309
1321
  * The non-colour scale: space, size, type, radius, shadow, motion, screen sizes and widths. The colour
@@ -1356,19 +1368,39 @@ declare const OWNED_SCALE_MARK = "@designtools/tokens scale";
1356
1368
  declare function ownedScaleHeader(version: string): string;
1357
1369
  /** Whether a stylesheet is an owned scale. */
1358
1370
  declare function isOwnedScale(css: string): boolean;
1371
+ /**
1372
+ * The words a type tier's steps are made of: places on the scale, never uses. A tier is a scale, so a
1373
+ * name in it says where a step sits (`--text-5xl`, `--leading-loose`), and a role a page gives it
1374
+ * (display, headline, label) is mapped onto a step elsewhere. Tailwind's own words, plus the ones that
1375
+ * name a position between two of them (`--leading-medium`, between snug and normal).
1376
+ */
1377
+ declare const TYPE_STEPS: {
1378
+ text: string[];
1379
+ leading: string[];
1380
+ tracking: string[];
1381
+ "font-weight": string[];
1382
+ };
1383
+ /** Why a name in a type tier is refused, naming the tier's steps: "is not a step of the type sizes (xs, sm, …)". */
1384
+ declare function offScaleReason(name: string): string;
1385
+ /** What to do instead of naming a use in a type tier, said once after the names. */
1386
+ declare const OFF_SCALE_ADVICE = "a type step names a place on the scale, never a use. A size that changes by screen is set in the component (text-5xl lg:text-8xl); a role a page uses (display, headline, label) is a step, mapped in the docs config's type.hierarchy.";
1359
1387
  interface ScaleVerdict {
1360
1388
  /** Names the scale promises that the file no longer has. */
1361
1389
  missing: string[];
1362
1390
  /** Names that belong to no tier: a second system beside the scale. */
1363
1391
  strays: string[];
1392
+ /** Names in a type tier (text, leading, tracking, weight) that are no step of it: a use, such as `--text-display`. */
1393
+ offScale: string[];
1364
1394
  /** Names the project added inside a tier: its own steps, which are fine. */
1365
1395
  own: string[];
1366
1396
  }
1367
1397
  /**
1368
1398
  * Check a scale file's names against the contract: every default name is still there, and every
1369
- * name the project added sits inside a tier's namespace. Values are never compared; they are the
1370
- * project's. Reads the custom properties declared anywhere in the file.
1399
+ * name the project added sits inside a tier's namespace. In the type tiers it must also be a step of
1400
+ * the tier's own vocabulary (`TYPE_STEPS`); the other tiers take any name inside their namespace.
1401
+ * Values are never compared; they are the project's. Reads the custom properties declared anywhere
1402
+ * in the file.
1371
1403
  */
1372
1404
  declare function verifyScale(css: string): ScaleVerdict;
1373
1405
 
1374
- export { ALIAS_PAIRS, type APCAContrastResult, APCAUnavailableError, type BrandColors, type CVDType, type ChromaProfile, type ChromaShape, type ColorFormat, type ColorScale, type ContractBreak, type ContrastAlgorithm, type ContrastTarget, DEFAULT_NEUTRAL_COLOR, DEFAULT_SEED_SHADE, type Declaration, type ExportFormat, type ExportOptions, type ExtendedSemanticColor, type FamilyShape, type ForegroundRef, GENERATOR_NAME, GROUND_BASE_TOKENS, GROUND_COLOR_PARTS, GROUND_SELECTOR, type Gamut, type GamutTokens, type GenerationOptions, type GroundAction, type GroundColour, type GroundFill, type GroundRef, type GroundSpec, type GroundTokens, type HueDrift, LOCAL_TEMPLATE, type LightnessStrategy, type LocalOverride, type LocalProblem, type LocalReport, type MergeResult, OWNED_SCALE_MARK, type PageContrast, type PageSurface, type PaletteOptions, type PrimitivePalette, type Provenance, SECTIONED_FORMATS, SHADE_PRESETS, type SavedConfig, type ScaleFormat, type ScaleOptions, type ScaleOverride, type ScaleTier, type ScaleTierId, type ScaleToken, type ScaleVerdict, type SeedFile, type SelectedTokens, type SemanticColorPair, type SemanticGamuts, type SemanticShadeOverrides, type SemanticTokens, type ShadeNumber, type SliceDiff, type SurfaceRef, type SurfaceShadeOverrides, type SurfaceTokens, TAILWIND_SHADES, TOKEN_SECTIONS, type TokenSection, type TokenSystem, type UsageReport, type UsageVerdict, type UtilityShadeOverrides, type UtilityTokens, VALID_SHADES, type VariantShadeOverrides, type WCAGContrastResult, WIDE_GAMUT_QUERY, adjustChroma, adjustLightness, aliasOf, applyScaleOverrides, checkLocalOverrides, checkRampChroma, checkSemanticContrast, checkSemanticContrastAPCA, checkSurfaceContrast, chromaShadeFor, classifyAPCALevel, computeAccessibilityScore, defaultScale, diffSlice, exportScale, exportToCss, exportToDtcg, exportToTailwindV3, exportToTailwindV4, exportTokens, externalReferences, familiesOf, familySeedShade, findContrastingColorAPCA, fingerprint, formatColorAs, formatColorShort, formatOklchInGamut, generateColorScale, generateColorScaleAPCA, generateGroundTokens, generatePrimitivePalette, generateSemanticTokens, generateSurfaceTokens, generateTokens, generateUtilityTokens, getAPCAContrast, getContrastRatio, getOklchString, getRelativeLuminance, getShade, groundTokenNames, isAPCAAvailable, isInGamut, isOwnedScale, meetsWCAG_AA, meetsWCAG_AAA, mergeSlice, modeSelectors, oklchToHex, ownedScaleHeader, parseProvenance, parseToOklch, provenanceComment, rangeOf, readDeclarations, reanchorFactors, reservedSurfaceNames, resolveShades, seedFingerprint, selectTokenSections, serialiseUsage, simulateCVD, snapShade, stableStringify, stepContract, suggestStep, tokenFamilies, usageReport, verifyScale, withJsonProvenance };
1406
+ export { ALIAS_PAIRS, type APCAContrastResult, APCAUnavailableError, type BrandColors, type CVDType, type ChromaProfile, type ChromaShape, type ColorFormat, type ColorScale, type ContractBreak, type ContrastAlgorithm, type ContrastTarget, DEFAULT_NEUTRAL_COLOR, DEFAULT_SEED_SHADE, type Declaration, type ExportFormat, type ExportOptions, type ExtendedSemanticColor, type FamilyShape, type ForegroundRef, GENERATOR_NAME, GROUND_BASE_TOKENS, GROUND_COLOR_PARTS, GROUND_SELECTOR, type Gamut, type GamutTokens, type GenerationOptions, type GroundAction, type GroundColour, type GroundFill, type GroundRef, type GroundSpec, type GroundTokens, type HueDrift, LOCAL_TEMPLATE, type LightnessStrategy, type LocalOverride, type LocalProblem, type LocalReport, type MergeResult, OFF_SCALE_ADVICE, OWNED_SCALE_MARK, type PageContrast, type PageSurface, type PaletteOptions, type PrimitivePalette, type Provenance, RESERVED_COLOR_NAMES, SECTIONED_FORMATS, SHADE_PRESETS, type SavedConfig, type ScaleFormat, type ScaleOptions, type ScaleOverride, type ScaleTier, type ScaleTierId, type ScaleToken, type ScaleVerdict, type SeedFile, type SelectedTokens, type SemanticColorPair, type SemanticGamuts, type SemanticShadeOverrides, type SemanticTokens, type ShadeNumber, type SliceDiff, type SurfaceRef, type SurfaceShadeOverrides, type SurfaceTokens, TAILWIND_SHADES, TOKEN_SECTIONS, TYPE_STEPS, type TokenSection, type TokenSystem, type UsageReport, type UsageVerdict, type UtilityShadeOverrides, type UtilityTokens, VALID_SHADES, type VariantShadeOverrides, type WCAGContrastResult, WIDE_GAMUT_QUERY, adjustChroma, adjustLightness, aliasOf, applyScaleOverrides, checkLocalOverrides, checkRampChroma, checkSemanticContrast, checkSemanticContrastAPCA, checkSurfaceContrast, chromaShadeFor, classifyAPCALevel, computeAccessibilityScore, defaultScale, diffSlice, exportScale, exportToCss, exportToDtcg, exportToTailwindV3, exportToTailwindV4, exportTokens, externalReferences, familiesOf, familySeedShade, findContrastingColorAPCA, fingerprint, formatColorAs, formatColorShort, formatOklchInGamut, generateColorScale, generateColorScaleAPCA, generateGroundTokens, generatePrimitivePalette, generateSemanticTokens, generateSurfaceTokens, generateTokens, generateUtilityTokens, getAPCAContrast, getContrastRatio, getOklchString, getRelativeLuminance, getShade, groundTokenNames, isAPCAAvailable, isInGamut, isOwnedScale, meetsWCAG_AA, meetsWCAG_AAA, mergeSlice, modeSelectors, offScaleReason, oklchToHex, ownedScaleHeader, parseProvenance, parseToOklch, provenanceComment, rangeOf, readDeclarations, reanchorFactors, reservedColorReason, reservedSurfaceNames, resolveShades, seedFingerprint, selectTokenSections, serialiseUsage, simulateCVD, snapShade, stableStringify, stepContract, suggestStep, tokenFamilies, usageReport, verifyScale, withJsonProvenance };
package/dist/index.js CHANGED
@@ -8,11 +8,14 @@ import {
8
8
  GROUND_COLOR_PARTS,
9
9
  GROUND_SELECTOR,
10
10
  LOCAL_TEMPLATE,
11
+ OFF_SCALE_ADVICE,
11
12
  OWNED_SCALE_MARK,
13
+ RESERVED_COLOR_NAMES,
12
14
  SECTIONED_FORMATS,
13
15
  SHADE_PRESETS,
14
16
  TAILWIND_SHADES,
15
17
  TOKEN_SECTIONS,
18
+ TYPE_STEPS,
16
19
  VALID_SHADES,
17
20
  WIDE_GAMUT_QUERY,
18
21
  adjustChroma,
@@ -64,6 +67,7 @@ import {
64
67
  meetsWCAG_AAA,
65
68
  mergeSlice,
66
69
  modeSelectors,
70
+ offScaleReason,
67
71
  oklchToHex,
68
72
  ownedScaleHeader,
69
73
  parseProvenance,
@@ -72,6 +76,7 @@ import {
72
76
  rangeOf,
73
77
  readDeclarations,
74
78
  reanchorFactors,
79
+ reservedColorReason,
75
80
  reservedSurfaceNames,
76
81
  resolveShades,
77
82
  seedFingerprint,
@@ -86,7 +91,7 @@ import {
86
91
  usageReport,
87
92
  verifyScale,
88
93
  withJsonProvenance
89
- } from "./chunk-FY6LQL2A.js";
94
+ } from "./chunk-PG4SXPRL.js";
90
95
  export {
91
96
  ALIAS_PAIRS,
92
97
  APCAUnavailableError,
@@ -97,11 +102,14 @@ export {
97
102
  GROUND_COLOR_PARTS,
98
103
  GROUND_SELECTOR,
99
104
  LOCAL_TEMPLATE,
105
+ OFF_SCALE_ADVICE,
100
106
  OWNED_SCALE_MARK,
107
+ RESERVED_COLOR_NAMES,
101
108
  SECTIONED_FORMATS,
102
109
  SHADE_PRESETS,
103
110
  TAILWIND_SHADES,
104
111
  TOKEN_SECTIONS,
112
+ TYPE_STEPS,
105
113
  VALID_SHADES,
106
114
  WIDE_GAMUT_QUERY,
107
115
  adjustChroma,
@@ -153,6 +161,7 @@ export {
153
161
  meetsWCAG_AAA,
154
162
  mergeSlice,
155
163
  modeSelectors,
164
+ offScaleReason,
156
165
  oklchToHex,
157
166
  ownedScaleHeader,
158
167
  parseProvenance,
@@ -161,6 +170,7 @@ export {
161
170
  rangeOf,
162
171
  readDeclarations,
163
172
  reanchorFactors,
173
+ reservedColorReason,
164
174
  reservedSurfaceNames,
165
175
  resolveShades,
166
176
  seedFingerprint,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designtools/tokens",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Turn one brand colour into a complete design-token system: perceptual OKLCH ramps, contrast-checked semantic tokens (WCAG or APCA), light and dark, as CSS custom properties, Tailwind v4/v3 or DTCG. Deterministic CLI, safe for agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",