@designtools/tokens 0.10.0 → 0.11.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/dist/cli.js CHANGED
@@ -18,6 +18,7 @@ import {
18
18
  externalReferences,
19
19
  familiesOf,
20
20
  generateTokens,
21
+ getContrastRatio,
21
22
  isAPCAAvailable,
22
23
  isInGamut,
23
24
  mergeSlice,
@@ -35,7 +36,7 @@ import {
35
36
  tokenFamilies,
36
37
  usageReport,
37
38
  withJsonProvenance
38
- } from "./chunk-YOUMF42P.js";
39
+ } from "./chunk-RQGC7LES.js";
39
40
 
40
41
  // src/cli.ts
41
42
  import { parseArgs } from "util";
@@ -52,12 +53,15 @@ Seeds:
52
53
  unless supplied by --seed.
53
54
  --neutral <colour> Neutral seed. Default: ${DEFAULT_NEUTRAL_COLOR}
54
55
  --color <name>=<colour>[@<shade>]
55
- Additional brand colour scale. Repeatable. Append
56
- @<shade> to anchor its seed on that step, as
57
- --seed-shade does for the primary: accent=#fde68a@200.
58
- --decorative <name> Give an added colour its ramp only, with no semantic
59
- slots (no --<name>, no bg-<name>), for an accent that
60
- must never be text or an action. Repeatable.
56
+ Additional brand colour: a ramp plus semantic tokens
57
+ (--<name>, -foreground, -subdued, -hover, -active) for
58
+ buttons, badges and text. Repeatable. Append @<shade> to
59
+ anchor its seed on that step, as --seed-shade does for
60
+ the primary: accent=#fde68a@200.
61
+ --decorative <name> Give a --color its ramp only, with no semantic slots (no
62
+ --<name>, no bg-<name>), for an accent that must never be
63
+ text or an action: --color sand=#e8d5b0 --decorative sand.
64
+ Repeatable.
61
65
  --canvas <colour>[/<dark>]
62
66
  --surface <colour>[/<dark>]
63
67
  --overlay <colour>[/<dark>]
@@ -65,9 +69,19 @@ Seeds:
65
69
  (light, then dark after a slash), in place of the
66
70
  neutral steps they default to. Text on each is measured.
67
71
  --background <name>=<colour>[/<dark>]
68
- A brand background a section is painted with, as
69
- --surface-<name> with measured text. Repeatable. Every
70
- semantic colour is measured against it (--report).
72
+ A colour a whole section is painted with (a band on a
73
+ marketing page), not a ramp: --surface-<name> with
74
+ measured text, and a ground. Inside data-surface="<name>"
75
+ every token (buttons, muted text, borders, inputs, the
76
+ ring, status text) is searched again against it, so
77
+ components need no change. Repeatable. A name a token or
78
+ ground already uses (canvas, primary, warning-subdued\u2026)
79
+ is refused.
80
+ --grounds <full|text|none>
81
+ What data-surface gives each ground. full (default):
82
+ every token, tinted to the ground and contrast-checked
83
+ on it. text: the background and its text only; buttons,
84
+ borders and the rest keep the page's. none: no grounds.
71
85
  --usage <file.json> Also write where each colour can go: every fill, status
72
86
  text tone and muted text on every background, per mode,
73
87
  as text, shape or neither. @designtools/manifest reads it
@@ -142,8 +156,9 @@ Selection:
142
156
  the contrast search runs inside it.
143
157
  Use with --merge to regenerate part of a token file
144
158
  without rewriting regions a human has edited.
145
- Surfaces and utilities belong to no single colour, so a
146
- family-scoped slice leaves them alone.
159
+ Surfaces, utilities and grounds belong to no single
160
+ colour, so a family-scoped slice leaves them alone:
161
+ refresh grounds with --only grounds.
147
162
 
148
163
  --only <sections> Emit only these slices, comma-separated or repeated:
149
164
  ramp the twelve-step colour ramps alone
@@ -151,6 +166,7 @@ Selection:
151
166
  semantic intent tokens (primary, destructive, muted, \u2026)
152
167
  surface canvas / surface / overlay
153
168
  utility border / input / ring / shadow
169
+ grounds --on-<ground>-* and the data-surface scopes
154
170
  Keeps generated colour separable from hand-tuned files,
155
171
  so a re-theme does not clobber them. Supported by the
156
172
  css, tailwind-v4 and json formats.
@@ -250,6 +266,7 @@ try {
250
266
  lightness: { type: "string" },
251
267
  foreground: { type: "string" },
252
268
  "no-wcag-floor": { type: "boolean" },
269
+ grounds: { type: "string" },
253
270
  gamut: { type: "string" },
254
271
  "seed-shade": { type: "string" },
255
272
  "neutral-seed-shade": { type: "string" },
@@ -365,6 +382,7 @@ var contrastTarget = validateChoice("target", values.target ?? seed.contrastTarg
365
382
  var lightnessStrategy = validateChoice("lightness", values.lightness ?? seed.lightnessStrategy, ["fixed", "perceptual"], "fixed");
366
383
  var foreground = validateChoice("foreground", values.foreground ?? seed.foreground, ["balanced", "max"], "balanced");
367
384
  var wcagFloor = values["no-wcag-floor"] === true ? false : seed.wcagFloor ?? true;
385
+ var grounds = validateChoice("grounds", values.grounds ?? seed.grounds, ["full", "text", "none"], "full");
368
386
  function lightDark(flag, raw) {
369
387
  const [light, dark] = raw.split("/").map((s) => s.trim());
370
388
  return { light: validateColor(flag, light), ...dark ? { dark: validateColor(flag, dark) } : {} };
@@ -526,6 +544,7 @@ var options = {
526
544
  ...!wcagFloor ? { wcagFloor } : {},
527
545
  ...hasSurfaceColors ? { surfaceColors } : {},
528
546
  ...Object.keys(backgrounds).length ? { backgrounds } : {},
547
+ ...grounds !== "full" ? { grounds } : {},
529
548
  seedShade,
530
549
  ...Object.keys(seedShades).length > 0 ? { seedShades } : {},
531
550
  ...lightnessRange ? { lightnessRange: { ...lightnessRange.light !== void 0 ? { light: lightnessRange.light / 100 } : {}, ...lightnessRange.dark !== void 0 ? { dark: lightnessRange.dark / 100 } : {} } } : {},
@@ -636,6 +655,8 @@ var resolvedSeed = {
636
655
  ...!wcagFloor ? { wcagFloor } : {},
637
656
  ...hasSurfaceColors ? { surfaceColors } : {},
638
657
  ...Object.keys(backgrounds).length ? { backgrounds } : {},
658
+ // left out at the default, so a seed from before grounds keeps its fingerprint
659
+ ...grounds !== "full" ? { grounds } : {},
639
660
  seedShade,
640
661
  neutralSeedShade,
641
662
  // left out when unset, so a seed without them keeps the fingerprint it always had
@@ -821,14 +842,14 @@ function reportPage() {
821
842
  for (const mode of ["light", "dark"]) {
822
843
  const grid = tokens.pageContrast?.[mode];
823
844
  if (!grid) continue;
824
- const grounds = Object.keys(Object.values(grid)[0] ?? {});
845
+ const grounds2 = Object.keys(Object.values(grid)[0] ?? {});
825
846
  process.stderr.write(`
826
847
  ${mode} mode: each colour on each background (T text ${floor}:1, S shape 3:1, - neither)
827
848
  `);
828
- process.stderr.write(` ${"".padEnd(18)}${grounds.map((g) => g.padStart(16)).join("")}
849
+ process.stderr.write(` ${"".padEnd(18)}${grounds2.map((g) => g.padStart(16)).join("")}
829
850
  `);
830
851
  for (const [colour, row] of Object.entries(grid)) {
831
- const cells = grounds.map((g) => {
852
+ const cells = grounds2.map((g) => {
832
853
  const r = row[g];
833
854
  const mark = r >= floor ? "T" : r >= 3 ? "S" : "-";
834
855
  return `${r.toFixed(2)} ${mark}`.padStart(16);
@@ -874,6 +895,33 @@ ${mode} mode${label} (${contrastAlgorithm}, target ${contrastTarget})
874
895
  }
875
896
  }
876
897
  reportSurfaces();
898
+ reportGrounds();
899
+ }
900
+ function reportGrounds() {
901
+ const grounds2 = tokens.grounds;
902
+ if (!grounds2) return;
903
+ const step = (ref) => ref.type === "shade" ? `${ref.colorName}-${ref.shade}` : ref.type === "value" ? "computed" : ref.type;
904
+ process.stderr.write(`
905
+ grounds: what data-surface="<ground>" changes from the page (ratio against the ground; a label's against its fill)
906
+ `);
907
+ const under = (token) => token.endsWith("-foreground") && token !== "canvas-foreground" && token !== "muted-foreground" ? token.slice(0, -"-foreground".length) : "canvas";
908
+ for (const mode of ["light", "dark"]) {
909
+ for (const [name, g] of Object.entries(grounds2[mode])) {
910
+ if (g.kind === "base") continue;
911
+ const shown = g.changed.filter((t) => !t.endsWith("-hover") && !t.endsWith("-active"));
912
+ const head = ` ${mode.padEnd(6)}${name.padEnd(22)}`;
913
+ if (!shown.length) {
914
+ process.stderr.write(`${head}the page's tokens already work here
915
+ `);
916
+ } else {
917
+ const items = shown.map((t) => `${t} ${step(g._refs[t])} ${getContrastRatio(g.tokens[t], g.tokens[under(t)]).toFixed(1)}`);
918
+ process.stderr.write(`${head}${items.join(", ")}
919
+ `);
920
+ }
921
+ for (const note of g.notes) process.stderr.write(` ${"".padEnd(28)}! ${note}
922
+ `);
923
+ }
924
+ }
877
925
  }
878
926
  if (values.report) report();
879
927
  if (values.contract) {
package/dist/index.d.ts CHANGED
@@ -172,9 +172,45 @@ interface TokenSystem {
172
172
  light: Record<string, string>;
173
173
  dark: Record<string, string>;
174
174
  };
175
+ /**
176
+ * Every token content needs, searched again against each ground it can sit on, per mode:
177
+ * the canvas and surface (today's values), the status tints and each named background.
178
+ * Emitted as `--on-<ground>-<token>`, and as a `[data-surface="<ground>"]` scope that points
179
+ * the everyday names (`--primary`, `--muted-foreground`) at them. See `grounds.ts`.
180
+ */
181
+ grounds?: {
182
+ light: Record<string, GroundTokens>;
183
+ dark: Record<string, GroundTokens>;
184
+ };
175
185
  /** The same system on wide-gamut ramps. Present only with `gamut: "p3"`. */
176
186
  p3?: GamutTokens;
177
187
  }
188
+ /** How much each ground carries: every token, the background and its text, or nothing */
189
+ type GroundsMode = "full" | "text" | "none";
190
+ /** Where a ground token comes from: a ramp step, black or white, or a colour given as it is */
191
+ type GroundRef = ForegroundRef | {
192
+ type: "value";
193
+ value: string;
194
+ };
195
+ /**
196
+ * One ground's tokens: a background content sits on, and everything content needs on it.
197
+ *
198
+ * Keys are the names the tokens take inside the ground, the page's own names: `canvas` and
199
+ * `canvas-foreground` are the ground and its text, then `muted`, `muted-foreground`, `border`,
200
+ * `input`, `ring`, and for every semantic colour its fill, `-foreground`, `-subdued`,
201
+ * `-subdued-foreground`, `-hover` and `-active`. A token keeps its page value wherever that
202
+ * still works on the ground; `changed` lists the ones that were searched again.
203
+ */
204
+ interface GroundTokens {
205
+ /** `base` for the canvas and surface, `status` for a status tint, `background` for a named one */
206
+ kind: "base" | "status" | "background";
207
+ tokens: Record<string, string>;
208
+ _refs: Record<string, GroundRef>;
209
+ /** Tokens whose value differs from the page's in this mode */
210
+ changed: string[];
211
+ /** What the search could not reach, in words, for the report */
212
+ notes: string[];
213
+ }
178
214
  /** Contrast algorithm choice */
179
215
  type ContrastAlgorithm = "wcag" | "apca";
180
216
  /** Contrast target level — controls minimum threshold for foreground selection */
@@ -353,12 +389,20 @@ interface GenerationOptions {
353
389
  /**
354
390
  * More backgrounds a brand paints sections with, by name: `{ stone: { light: "#E8E8DB" } }`.
355
391
  * Each becomes `--surface-<name>` with a measured `-foreground`; `dark` defaults to `light`.
356
- * Every semantic colour is measured against each of them (see `pageContrast`).
392
+ * Every semantic colour is measured against each of them (see `pageContrast`), and each is a
393
+ * ground: content inside `data-surface="<name>"` gets its own searched tokens (see `grounds`).
394
+ * A name a ground or token already uses (`canvas`, `primary`, `warning-subdued`) is refused.
357
395
  */
358
396
  backgrounds?: Record<string, {
359
397
  light: string;
360
398
  dark?: string;
361
399
  }>;
400
+ /**
401
+ * How much a ground carries (see `grounds.ts`). `full` (default): every token, tinted to the
402
+ * ground and contrast-checked on it. `text`: the ground and its text only, so `data-surface`
403
+ * paints a section and everything else on it keeps the page's tokens. `none`: no grounds at all.
404
+ */
405
+ grounds?: GroundsMode;
362
406
  /**
363
407
  * Which steps to emit. Default: all twelve (25–950).
364
408
  * Tokens naming a dropped step are snapped to the nearest emitted one.
@@ -432,6 +476,7 @@ interface SavedConfig {
432
476
  wcagFloor?: boolean;
433
477
  surfaceColors?: GenerationOptions["surfaceColors"];
434
478
  backgrounds?: GenerationOptions["backgrounds"];
479
+ grounds?: GroundsMode;
435
480
  shadeOverrides: SemanticShadeOverrides;
436
481
  surfaceShadeOverrides?: GenerationOptions["surfaceShadeOverrides"];
437
482
  utilityShadeOverrides?: GenerationOptions["utilityShadeOverrides"];
@@ -820,6 +865,8 @@ declare function computeAccessibilityScore(tokens: SemanticTokens, algorithm: Co
820
865
  * keeps the sRGB values, which are complete and contrast-checked on their own.
821
866
  */
822
867
  declare const WIDE_GAMUT_QUERY = "@media (color-gamut: p3)";
868
+ /** The selector a ground's scope is emitted under */
869
+ declare const GROUND_SELECTOR: (ground: string) => string;
823
870
  /**
824
871
  * Export tokens as CSS custom properties
825
872
  */
@@ -834,7 +881,7 @@ declare function exportToCss(tokens: TokenSystem, colorFormat?: ColorFormat, sha
834
881
  * Note there is no non-colour section: the TokenSystem carries spacing, type,
835
882
  * radii and shadow defaults, but they are not yet serialised to CSS.
836
883
  */
837
- declare const TOKEN_SECTIONS: readonly ["primitives", "ramp", "semantic", "surface", "utility"];
884
+ declare const TOKEN_SECTIONS: readonly ["primitives", "ramp", "semantic", "surface", "utility", "grounds"];
838
885
  type TokenSection = (typeof TOKEN_SECTIONS)[number];
839
886
  /**
840
887
  * Export tokens as Tailwind v4 CSS.
@@ -1030,6 +1077,55 @@ declare class APCAUnavailableError extends Error {
1030
1077
  /** Whether apca-w3 is installed, so APCA contrast can be measured. */
1031
1078
  declare function isAPCAAvailable(): boolean;
1032
1079
 
1080
+ /**
1081
+ * Grounds: every background content sits on, each with the tokens content needs on it.
1082
+ *
1083
+ * The page tokens are searched against the canvas, the surface and the overlay. Content also
1084
+ * sits on other backgrounds: a warning banner with a button in it, a brand-coloured band on a
1085
+ * marketing page with a caption and a call to action. There the page tokens were only measured,
1086
+ * never chosen: a primary button on a primary band is 1:1, a caption on a navy band 2.3:1.
1087
+ *
1088
+ * So each ground gets the page's tokens again, searched against it. A token keeps its page value
1089
+ * wherever that still works on the ground, so a pale banner changes little; anything that fails
1090
+ * is searched again by the same rules the page uses. Markup names the ground once
1091
+ * (`<section data-surface="brand">`) and every component inside reads the right values through
1092
+ * the everyday names, `bg-primary` and `text-muted-foreground`, with no change to the component.
1093
+ *
1094
+ * The grounds are the canvas and the surface (today's values, so a card inside a band can reset
1095
+ * to them), the status tints, and every named background. The surface and overlay tokens
1096
+ * themselves are not part of a ground: a card is still a card, on any band.
1097
+ */
1098
+
1099
+ /** The status colours whose tints are grounds by default: a banner, an alert, an inline message */
1100
+ declare const STATUS_GROUNDS: readonly ["success", "warning", "destructive"];
1101
+ /** The non-colour tokens every ground carries, in the order they are emitted */
1102
+ declare const GROUND_BASE_TOKENS: readonly ["canvas", "canvas-foreground", "muted", "muted-foreground", "border", "input", "ring"];
1103
+ /** What each semantic colour carries inside a ground */
1104
+ declare const GROUND_COLOR_PARTS: readonly ["", "-foreground", "-subdued", "-subdued-foreground", "-hover", "-active"];
1105
+ interface View {
1106
+ palette: PrimitivePalette;
1107
+ gamut: Gamut;
1108
+ }
1109
+ /** Every token name a ground carries, for these semantic colours */
1110
+ declare function groundTokenNames(colors: readonly string[]): string[];
1111
+ /**
1112
+ * Names a `--background` cannot take: each ground is a `data-surface` value and the prefix of
1113
+ * `--on-<ground>-*`, and `--surface-<name>` sits beside the surface tokens. A band called
1114
+ * `primary` or `warning-subdued` would be two grounds under one name.
1115
+ */
1116
+ declare function reservedGroundNames(colors: readonly string[]): string[];
1117
+ /**
1118
+ * Every ground's tokens for one mode.
1119
+ *
1120
+ * `views` is the palette the tokens resolve against, then any other gamut's: a pairing must
1121
+ * pass on every display the system is generated for.
1122
+ */
1123
+ declare function generateGroundTokens(tiers: {
1124
+ semantic: Record<"light" | "dark", SemanticTokens>;
1125
+ surface: Record<"light" | "dark", SurfaceTokens>;
1126
+ utility: Record<"light" | "dark", UtilityTokens>;
1127
+ }, mode: "light" | "dark", views: readonly View[], options?: Partial<GenerationOptions>): Record<string, GroundTokens>;
1128
+
1033
1129
  /**
1034
1130
  * Where each colour can go: every semantic fill, status text tone and muted text measured
1035
1131
  * against every background a mode paints, with a verdict. Written beside the CSS with
@@ -1085,4 +1181,4 @@ interface ContractBreak {
1085
1181
  /** Every step whose promise differs between colours, light to dark. Empty when every step means the same everywhere. */
1086
1182
  declare function stepContract(palette: PrimitivePalette): ContractBreak[];
1087
1183
 
1088
- 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, type Gamut, type GamutTokens, type GenerationOptions, type HueDrift, type LightnessStrategy, type MergeResult, type NamedBackground, type PageContrast, type PaletteOptions, type PrimitivePalette, type Provenance, SECTIONED_FORMATS, SHADE_PRESETS, type SavedConfig, type ScaleOptions, 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, checkRampChroma, checkSemanticContrast, checkSemanticContrastAPCA, checkSurfaceContrast, chromaShadeFor, classifyAPCALevel, computeAccessibilityScore, diffSlice, exportToCss, exportToDtcg, exportToTailwindV3, exportToTailwindV4, exportTokens, externalReferences, familiesOf, familySeedShade, findContrastingColorAPCA, fingerprint, formatColorAs, formatColorShort, formatOklchInGamut, generateColorScale, generateColorScaleAPCA, generatePrimitivePalette, generateSemanticTokens, generateSurfaceTokens, generateTokens, generateUtilityTokens, getAPCAContrast, getContrastRatio, getOklchString, getRelativeLuminance, getShade, isAPCAAvailable, isInGamut, meetsWCAG_AA, meetsWCAG_AAA, mergeSlice, oklchToHex, parseProvenance, parseToOklch, provenanceComment, rangeOf, readDeclarations, reanchorFactors, resolveShades, seedFingerprint, selectTokenSections, serialiseUsage, simulateCVD, snapShade, stableStringify, stepContract, tokenFamilies, usageReport, withJsonProvenance };
1184
+ 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 GroundRef, type GroundTokens, type GroundsMode, type HueDrift, type LightnessStrategy, type MergeResult, type NamedBackground, type PageContrast, type PaletteOptions, type PrimitivePalette, type Provenance, SECTIONED_FORMATS, SHADE_PRESETS, STATUS_GROUNDS, type SavedConfig, type ScaleOptions, 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, checkRampChroma, checkSemanticContrast, checkSemanticContrastAPCA, checkSurfaceContrast, chromaShadeFor, classifyAPCALevel, computeAccessibilityScore, diffSlice, 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, meetsWCAG_AA, meetsWCAG_AAA, mergeSlice, oklchToHex, parseProvenance, parseToOklch, provenanceComment, rangeOf, readDeclarations, reanchorFactors, reservedGroundNames, resolveShades, seedFingerprint, selectTokenSections, serialiseUsage, simulateCVD, snapShade, stableStringify, stepContract, tokenFamilies, usageReport, withJsonProvenance };
package/dist/index.js CHANGED
@@ -4,8 +4,12 @@ import {
4
4
  DEFAULT_NEUTRAL_COLOR,
5
5
  DEFAULT_SEED_SHADE,
6
6
  GENERATOR_NAME,
7
+ GROUND_BASE_TOKENS,
8
+ GROUND_COLOR_PARTS,
9
+ GROUND_SELECTOR,
7
10
  SECTIONED_FORMATS,
8
11
  SHADE_PRESETS,
12
+ STATUS_GROUNDS,
9
13
  TAILWIND_SHADES,
10
14
  TOKEN_SECTIONS,
11
15
  VALID_SHADES,
@@ -36,6 +40,7 @@ import {
36
40
  formatOklchInGamut,
37
41
  generateColorScale,
38
42
  generateColorScaleAPCA,
43
+ generateGroundTokens,
39
44
  generatePrimitivePalette,
40
45
  generateSemanticTokens,
41
46
  generateSurfaceTokens,
@@ -46,6 +51,7 @@ import {
46
51
  getOklchString,
47
52
  getRelativeLuminance,
48
53
  getShade,
54
+ groundTokenNames,
49
55
  isAPCAAvailable,
50
56
  isInGamut,
51
57
  meetsWCAG_AA,
@@ -58,6 +64,7 @@ import {
58
64
  rangeOf,
59
65
  readDeclarations,
60
66
  reanchorFactors,
67
+ reservedGroundNames,
61
68
  resolveShades,
62
69
  seedFingerprint,
63
70
  selectTokenSections,
@@ -69,15 +76,19 @@ import {
69
76
  tokenFamilies,
70
77
  usageReport,
71
78
  withJsonProvenance
72
- } from "./chunk-YOUMF42P.js";
79
+ } from "./chunk-RQGC7LES.js";
73
80
  export {
74
81
  ALIAS_PAIRS,
75
82
  APCAUnavailableError,
76
83
  DEFAULT_NEUTRAL_COLOR,
77
84
  DEFAULT_SEED_SHADE,
78
85
  GENERATOR_NAME,
86
+ GROUND_BASE_TOKENS,
87
+ GROUND_COLOR_PARTS,
88
+ GROUND_SELECTOR,
79
89
  SECTIONED_FORMATS,
80
90
  SHADE_PRESETS,
91
+ STATUS_GROUNDS,
81
92
  TAILWIND_SHADES,
82
93
  TOKEN_SECTIONS,
83
94
  VALID_SHADES,
@@ -108,6 +119,7 @@ export {
108
119
  formatOklchInGamut,
109
120
  generateColorScale,
110
121
  generateColorScaleAPCA,
122
+ generateGroundTokens,
111
123
  generatePrimitivePalette,
112
124
  generateSemanticTokens,
113
125
  generateSurfaceTokens,
@@ -118,6 +130,7 @@ export {
118
130
  getOklchString,
119
131
  getRelativeLuminance,
120
132
  getShade,
133
+ groundTokenNames,
121
134
  isAPCAAvailable,
122
135
  isInGamut,
123
136
  meetsWCAG_AA,
@@ -130,6 +143,7 @@ export {
130
143
  rangeOf,
131
144
  readDeclarations,
132
145
  reanchorFactors,
146
+ reservedGroundNames,
133
147
  resolveShades,
134
148
  seedFingerprint,
135
149
  selectTokenSections,
@@ -108,6 +108,9 @@ export function parseCommand(command) {
108
108
  case "--no-wcag-floor":
109
109
  seed.wcagFloor = false;
110
110
  break;
111
+ case "--grounds":
112
+ seed.grounds = value();
113
+ break;
111
114
  case "--gamut":
112
115
  seed.gamut = value();
113
116
  break;
@@ -221,6 +224,7 @@ export function optionsFromSeed(seed) {
221
224
  ...(seed.wcagFloor === false ? { wcagFloor: false } : {}),
222
225
  ...(seed.surfaceColors ? { surfaceColors: seed.surfaceColors } : {}),
223
226
  ...(seed.backgrounds ? { backgrounds: seed.backgrounds } : {}),
227
+ ...(seed.grounds && seed.grounds !== "full" ? { grounds: seed.grounds } : {}),
224
228
  seedShade: seed.seedShade,
225
229
  ...(Object.keys(seedShades).length ? { seedShades } : {}),
226
230
  ...(rangeOf(seed) ? { lightnessRange: rangeOf(seed) } : {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designtools/tokens",
3
- "version": "0.10.0",
3
+ "version": "0.11.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",
@@ -86,7 +86,7 @@
86
86
  "tsx": "^4.19.0",
87
87
  "typescript": "^5.9.3",
88
88
  "vitest": "^4.1.11",
89
- "@designtools/widgets": "0.1.4"
89
+ "@designtools/widgets": "0.1.5"
90
90
  },
91
91
  "keywords": [
92
92
  "design-tokens",