@phcdevworks/spectre-tokens 4.11.0 → 4.12.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/README.md CHANGED
@@ -17,7 +17,7 @@ contracts for specific frameworks and runtimes.
17
17
  | Project team | `project-design` |
18
18
  | Repository role | Spectre L1 design-token contract |
19
19
  | Package/artifact | `@phcdevworks/spectre-tokens` |
20
- | Current version/status | 4.11.0 |
20
+ | Current version/status | 4.12.0 |
21
21
 
22
22
  ## Standard Workflow
23
23
 
@@ -297,7 +297,47 @@ consumers get a text-role contract instead of hand-picking a raw
297
297
  `--sp-form-default-{bg,text,placeholder}` are redeclared in the
298
298
  `[data-spectre-theme="dark"]` block from `modes.dark.forms.default.*`, so they
299
299
  follow the active mode. Other `forms.*` variables, including
300
- `--sp-form-default-border`, are declared once in `:root`.
300
+ `--sp-form-default-border`, keep their `:root` value in every mode, except
301
+ that high-contrast mode overrides `forms.valid.*` and `forms.invalid.*`.
302
+
303
+ Color modes apply wherever the attribute is set, not only on the root.
304
+ `data-spectre-theme="dark"`, `"high-contrast"`, or `"light"` on any element
305
+ switches every mode variable for that element and its descendants, so a
306
+ section can differ from the page (`light` restores default values inside a
307
+ dark ancestor). `data-spectre-theme="system"` follows the visitor's OS setting
308
+ through `prefers-color-scheme`, with no script. A page with no attribute is
309
+ light.
310
+
311
+ `modes.highContrast` is a third mode alongside `default` and `dark`. It is
312
+ light-based, and every text pair in it meets WCAG AAA (7:1). Borders and
313
+ dividers are darkened too. Set `data-spectre-theme="high-contrast"` on the
314
+ root, or on a section, to apply it. Buttons, links, and the valid/invalid form states don't
315
+ change between light and dark, but high-contrast mode overrides them
316
+ (`modes.highContrast.buttons`, `.link`, and `.forms.{valid,invalid}`), so
317
+ those also meet 7:1.
318
+
319
+ `control.{sm,md,lg}` gives the shared height, inline padding, and icon size
320
+ for buttons, inputs, and selects (`--sp-control-md-height`,
321
+ `--sp-control-md-padding-inline`, `--sp-control-md-icon-size`), and
322
+ `control.compact.*` is the denser set. Any element with
323
+ `data-spectre-density="compact"` swaps the default sizes for the compact
324
+ ones inside it. Every height except `lg` is below
325
+ `accessibility.minTouchTarget` (44px), so on touch layouts give smaller
326
+ controls a 44px hit area (for example with padding or a pseudo-element)
327
+ rather than shrinking it to the visible height.
328
+
329
+ `elevation.{flat,raised,overlay,modal}` pairs a shadow with its surface and
330
+ z-index, so consumers pick one level instead of combining raw steps. The
331
+ `--sp-elevation-*` variables are `var()` references to the shadow, surface,
332
+ and z-index variables, so the surface follows the active color mode.
333
+
334
+ `component.chart` is the data-visualization palette: eight categorical
335
+ `series` colors that differ in lightness as well as hue and meet 3:1 against
336
+ `chart.bg`, seven-step `sequential` and `diverging` ramps, and `grid`,
337
+ `axis`, and `label` roles. `component.selection`, `component.caret`,
338
+ `component.scrollbar`, `component.skeleton`, and `component.prose.kbd` cover
339
+ text selection, caret, scrollbar, skeleton-loading, and keycap colors. All of
340
+ them are set for every mode.
301
341
 
302
342
  ### Token model
303
343
 
@@ -327,6 +367,8 @@ The generated token object includes these namespaces:
327
367
  - `component`
328
368
  - `modes`
329
369
  - `tracking`
370
+ - `control`
371
+ - `elevation`
330
372
 
331
373
  The exported runtime token object is a flattened string-based tree generated
332
374
  from `tokens/`. Source-only wrapper fields such as `value` and `metadata` are
@@ -346,6 +388,17 @@ plus fixed layout width tokens for common consumer shells:
346
388
  `layout.container.maxWidth`, `layout.container.maxWidthProse`,
347
389
  `layout.container.maxWidthWide`, and `layout.sidebar.width`.
348
390
 
391
+ Layout spacing sits on one 8px grid; `check:structure` fails on any off-grid
392
+ step. Section padding, section gap, stack gap, and container inline padding
393
+ run `sm | md | lg | xl | 2xl | 3xl | 4xl`. `sm`–`lg` are fixed. `xl`–`4xl`
394
+ are responsive: the base value applies on narrow viewports and
395
+ `layout.responsive.lg.*` takes over at the `lg` breakpoint. In CSS, the
396
+ `@media (min-width: 1024px)` block re-points `--sp-layout-*-{xl..4xl}` at
397
+ `--sp-layout-responsive-lg-*`, so consumers keep using one variable name.
398
+ `layout.hero.paddingTop` and `layout.hero.paddingBottom` (`sm | md | lg`)
399
+ reference section padding steps, and their CSS variables are `var()`
400
+ references that follow the responsive override.
401
+
349
402
  ## Public Contract Guarantees
350
403
 
351
404
  `contract.manifest.json` is the machine-readable contract authority for this
@@ -544,7 +597,7 @@ treated as downstream UI primitives.
544
597
  | ---------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
545
598
  | `check:regression` fails | A token value changed vs the recorded baseline | Revert the unintended change, or update the baseline if the change was intentional |
546
599
  | `check:locked` fails | A protected color family was modified | Revert unless Bradley Potts has explicitly approved the change |
547
- | `check:contrast` fails | A text/background token pair does not meet WCAG AA | Adjust the token value or the `metadata.pair` reference in the source JSON |
600
+ | `check:contrast` fails | A token pair is below WCAG AA, AAA in high-contrast mode, or its `minContrast` | Adjust the token value or the `metadata.pair` reference in the source JSON |
548
601
  | `check:dist` fails | Generated dist is out of sync | Run `npm run build` then re-run `npm run check` |
549
602
  | `check:manifest` fails | A namespace exists in outputs but is not declared in `contract.manifest.json` | Add the namespace to the manifest or remove it from the source |
550
603
  | `check:docs` fails | README or TOKEN_CONTRACT.md has drifted from the manifest | Update the doc to match the current contract |