contour-ds 1.8.1 → 1.9.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.
Files changed (147) hide show
  1. package/README.md +227 -378
  2. package/dist/agent-cookbook.json +960 -0
  3. package/dist/agent-examples.json +65 -0
  4. package/dist/agent-map-wiring.json +152 -0
  5. package/dist/build-manifest.json +320 -179
  6. package/dist/contour-wc-content.esm.js +479 -3665
  7. package/dist/contour-wc-content.esm.min.js +1 -1
  8. package/dist/contour-wc-core.esm.js +3724 -0
  9. package/dist/contour-wc-core.esm.min.js +1 -0
  10. package/dist/contour-wc-dashboard.esm.js +2713 -4381
  11. package/dist/contour-wc-dashboard.esm.min.js +1 -1
  12. package/dist/contour-wc-data.esm.js +2658 -4346
  13. package/dist/contour-wc-data.esm.min.js +1 -1
  14. package/dist/contour-wc-docs.esm.js +218 -3547
  15. package/dist/contour-wc-docs.esm.min.js +1 -1
  16. package/dist/contour-wc-feedback.esm.js +483 -3658
  17. package/dist/contour-wc-feedback.esm.min.js +1 -1
  18. package/dist/contour-wc-forms.esm.js +503 -3754
  19. package/dist/contour-wc-forms.esm.min.js +1 -1
  20. package/dist/contour-wc-interaction.esm.js +379 -3616
  21. package/dist/contour-wc-interaction.esm.min.js +1 -1
  22. package/dist/contour-wc-layout.esm.js +234 -3563
  23. package/dist/contour-wc-layout.esm.min.js +1 -1
  24. package/dist/contour-wc-map.esm.js +949 -3743
  25. package/dist/contour-wc-map.esm.min.js +1 -1
  26. package/dist/contour-wc-misc.esm.js +237 -3556
  27. package/dist/contour-wc-misc.esm.min.js +1 -1
  28. package/dist/contour-wc-navigation.esm.js +2235 -5237
  29. package/dist/contour-wc-navigation.esm.min.js +1 -1
  30. package/dist/contour-wc-ui.esm.js +4638 -7128
  31. package/dist/contour-wc-ui.esm.min.js +1 -1
  32. package/dist/contour-wc.esm.js +11971 -7727
  33. package/dist/contour-wc.esm.min.js +1 -1
  34. package/dist/contour-wc.js +11971 -7727
  35. package/dist/contour-wc.min.js +1 -1
  36. package/dist/contour.a11y.json +402 -0
  37. package/dist/contour.code-snippets +96 -74
  38. package/dist/contour.components.json +2591 -741
  39. package/dist/contour.css +2624 -1888
  40. package/dist/contour.d.ts +421 -228
  41. package/dist/contour.esm.js +433 -18
  42. package/dist/contour.esm.min.js +1 -1
  43. package/dist/contour.html-data.json +1231 -199
  44. package/dist/contour.js +433 -18
  45. package/dist/contour.min.css +1 -1
  46. package/dist/contour.min.js +1 -1
  47. package/dist/contour.react.d.ts +100 -98
  48. package/dist/contour.single.html +2 -2
  49. package/dist/contour.single.min.css +1 -1
  50. package/dist/contour.themes.json +56 -12
  51. package/dist/contour.tokens.json +482 -255
  52. package/dist/contour.vue.d.ts +100 -98
  53. package/dist/contour.web-types.json +1226 -226
  54. package/dist/custom-elements.json +7649 -2237
  55. package/dist/docs/actions.md +15 -6
  56. package/dist/docs/affordances.md +18 -96
  57. package/dist/docs/apireference.md +9 -5
  58. package/dist/docs/colour.md +10 -4
  59. package/dist/docs/componentindex.md +9 -26
  60. package/dist/docs/data.md +36 -60
  61. package/dist/docs/docs.md +10 -12
  62. package/dist/docs/feedback.md +30 -12
  63. package/dist/docs/field.md +28 -13
  64. package/dist/docs/forms.md +35 -19
  65. package/dist/docs/index.json +63 -56
  66. package/dist/docs/install.md +12 -7
  67. package/dist/docs/landing.md +7 -4
  68. package/dist/docs/mapengine.md +18 -13
  69. package/dist/docs/motion.md +12 -6
  70. package/dist/docs/navigation.md +31 -7
  71. package/dist/docs/overlays.md +32 -25
  72. package/dist/docs/overview.md +3 -2
  73. package/dist/docs/patterns.md +19 -9
  74. package/dist/docs/playground.md +9 -22
  75. package/dist/docs/principles.md +8 -6
  76. package/dist/docs/recipes.md +113 -14
  77. package/dist/docs/space.md +10 -6
  78. package/dist/docs/status.md +12 -25
  79. package/dist/docs/surfaces.md +17 -22
  80. package/dist/docs/theming.md +18 -32
  81. package/dist/docs/type.md +12 -5
  82. package/dist/docs/webcomponents.md +66 -38
  83. package/dist/hljs.css +1 -20
  84. package/dist/map-chrome.mapbox.css +68 -92
  85. package/dist/map-chrome.maplibre.css +68 -92
  86. package/dist/registry/items/contour-core.json +2 -2
  87. package/dist/registry/items/contour-data.json +2 -2
  88. package/dist/registry/items/contour-docs.json +2 -2
  89. package/dist/registry/items/contour-landing.json +2 -2
  90. package/dist/registry/registry.json +8 -8
  91. package/dist/surfaces/contour-core.min.css +1 -1
  92. package/dist/surfaces/contour-data.min.css +1 -1
  93. package/dist/surfaces/contour-docs.min.css +1 -1
  94. package/dist/surfaces/contour-landing.min.css +1 -1
  95. package/dist/svg/icons.svg +367 -0
  96. package/dist/wc/behaviours.mjs +190 -148
  97. package/dist/wc/content.mjs +273 -129
  98. package/dist/wc/core.mjs +598 -395
  99. package/dist/wc/dashboard.mjs +64 -44
  100. package/dist/wc/data-chart.mjs +1333 -0
  101. package/dist/wc/data-export.mjs +391 -0
  102. package/dist/wc/data-gauge.mjs +779 -0
  103. package/dist/wc/data-geo.mjs +696 -0
  104. package/dist/wc/data-glyphs.mjs +133 -0
  105. package/dist/wc/data-legend.mjs +431 -0
  106. package/dist/wc/data-readout.mjs +227 -0
  107. package/dist/wc/data-series.mjs +1004 -0
  108. package/dist/wc/data-table.mjs +751 -0
  109. package/dist/wc/data.mjs +15 -4322
  110. package/dist/wc/docs.mjs +12 -11
  111. package/dist/wc/feedback.mjs +277 -122
  112. package/dist/wc/forms-controls.mjs +635 -0
  113. package/dist/wc/forms-field.mjs +547 -0
  114. package/dist/wc/forms-groups.mjs +347 -0
  115. package/dist/wc/forms-input.mjs +292 -0
  116. package/dist/wc/forms.mjs +10 -1751
  117. package/dist/wc/glyph.mjs +204 -0
  118. package/dist/wc/index.mjs +11 -9
  119. package/dist/wc/interaction.mjs +173 -80
  120. package/dist/wc/layout.mjs +28 -27
  121. package/dist/wc/map.mjs +743 -207
  122. package/dist/wc/misc.mjs +31 -20
  123. package/dist/wc/navigation-menu.mjs +735 -0
  124. package/dist/wc/navigation-shell.mjs +495 -0
  125. package/dist/wc/navigation-tree.mjs +995 -0
  126. package/dist/wc/navigation.mjs +9 -1905
  127. package/dist/wc/registration.mjs +1 -8
  128. package/dist/wc/shadow.mjs +206 -110
  129. package/dist/wc/states.mjs +54 -75
  130. package/dist/wc/svg.mjs +118 -47
  131. package/dist/wc/ui-atoms.mjs +608 -0
  132. package/dist/wc/ui-data.mjs +1404 -0
  133. package/dist/wc/ui-feedback.mjs +419 -0
  134. package/dist/wc/ui-inputs.mjs +1570 -0
  135. package/dist/wc/ui-menus.mjs +307 -0
  136. package/dist/wc/ui-overlays.mjs +1605 -0
  137. package/integrations/README.md +23 -5
  138. package/integrations/ai/CLAUDE.md +3 -0
  139. package/integrations/ai/COPILOT.md +14 -0
  140. package/integrations/ai/GEMINI.md +14 -0
  141. package/integrations/ai/WINDSURF.md +14 -0
  142. package/integrations/ai/v0-prompt.md +13 -1
  143. package/integrations/native/README.md +0 -3
  144. package/integrations/tailwind/contour-theme.css +66 -7
  145. package/integrations/validate-markup.mjs +172 -0
  146. package/package.json +77 -42
  147. package/dist/wc/ui.mjs +0 -5072
package/README.md CHANGED
@@ -6,25 +6,33 @@
6
6
  A token-driven design system for **spatial interfaces** — routing engines, pedestrian
7
7
  simulators, map tooling and geospatial dashboards.
8
8
 
9
- <!-- ds:components-line -->246 components, 310 design tokens<!-- /ds:components-line -->, dark and light themes, zero runtime dependencies, no build step.
9
+ <!-- ds:components-line -->254 components, 317 design tokens<!-- /ds:components-line -->, dark and light themes, zero runtime dependencies, no build step.
10
10
 
11
11
  The [style guide](index.html) is the specification and the test suite.
12
12
 
13
+ ## Key features
14
+
15
+ - **Zero runtime dependencies** — pure CSS + optional JS enhancement
16
+ - **Dark/light themes** via `light-dark()` and `color-scheme`
17
+ - **254 components** across 14 stylesheets (landing, docs, dashboard, data)
18
+ - **317 design tokens** — colours, typography, space, shape, motion, density
19
+ - **Web components** — 247 custom elements (`<contour-*>`, `<contour-shadow-*>`) with attribute reactivity
20
+ - **DTCG 2025.10** token export (Format + Resolver documents) and a **shadcn registry**
21
+ - **WCAG 2.2 AA** — contrast, focus, reflow, reduced motion, forced colours
22
+ - **Self-hosted fonts** — IBM Plex (Sans, Mono, Condensed), subsetted, OFL 1.1
23
+
13
24
  ## Install
14
25
 
15
26
  ```bash
16
27
  npm install contour-ds
17
28
  ```
18
29
 
19
- The tarball ships `dist/` and `integrations/`: `prepack` runs `node tools/build.mjs`, so the
20
- bundle beside the source is derived from it, never hand-copied. (`src/` is not in the
21
- tarball — a consumer takes `src/` from the repository, not the package.)
22
-
23
- ### From the package
30
+ The tarball ships `dist/` and `integrations/`; `prepack` runs `node tools/build.mjs --single`,
31
+ so the bundle beside the source is derived from it. `src/` is not in the tarball — take it
32
+ from the repository.
24
33
 
25
34
  Import by specifier — the `exports` map in `package.json` is the published surface, and
26
- `contour-ds/dist/contour.css` does **not** resolve, because no key under `./dist/` is
27
- exposed:
35
+ `contour-ds/dist/contour.css` does **not** resolve:
28
36
 
29
37
  ```css
30
38
  @import "contour-ds/contour.min.css"; /* every layer, in cascade order */
@@ -34,30 +42,24 @@ exposed:
34
42
  ```
35
43
 
36
44
  `main`, `style` and the bare `exports["."]` condition resolve to the **unminified**
37
- `dist/contour.css`, so a consumer who cares about weight names `contour.min.css`
38
- explicitly. The machine-readable documents ride that same map: `contour-ds/tokens.json`,
45
+ `dist/contour.css`, so a consumer who cares about weight names `contour.min.css` explicitly.
46
+ The machine-readable documents ride the same map: `contour-ds/tokens.json`,
39
47
  `contour-ds/themes.json`, `contour-ds/components.json`.
40
48
 
41
- For progressive enhancement, the built web-component layer is a classic script rather
42
- than a module, so it loads with a plain tag — `dist/contour-wc.js`, minified in
43
- `dist/contour-wc.min.js`, published as `contour-ds/contour-wc.js`.
44
-
45
- ### ESM (tree-shakeable)
46
-
47
- For bundler consumers, ESM builds are available so unused exports can be dropped:
48
-
49
- ```js
50
- import "contour-ds/contour-wc.esm.js"; // all-in convenience bundle (~740 kB minified)
51
- // or, for production and tree-shaking, import individual family bundles:
52
- import "contour-ds/wc/forms.mjs";
53
- ```
54
-
55
- The all-in bundle (`contour-wc.esm.js` / `contour-wc.js`) registers every element as a convenience. For production applications, prefer importing individual family bundles (`contour-ds/wc/<family>.mjs`, or `contour-ds/wc/<family>`) to keep bundle sizes lean. Both register the same custom elements as a side effect on import.
49
+ For progressive enhancement the web-component layer is a classic script, so it loads with a
50
+ plain tag — `contour-ds/contour-wc.js` (minified `contour-wc.min.js`). For bundlers, ESM
51
+ builds let you scope the payload by family: `contour-ds/contour-wc.esm.js` registers
52
+ everything, or import a single family (`contour-ds/wc/<family>.mjs`) to load only that
53
+ family. The modules register their components on import (a side effect), so a bundler keeps
54
+ the family you import — the win is choosing one family over the monolith, not dropping
55
+ individual components within a family (R31-117). Each family bundle imports the shared
56
+ `contour-wc-core.esm.js`, so loading two families on one page shares one element registry
57
+ (R31-20); the monolith stays self-contained.
56
58
 
57
- ### From a checkout — no build step, no dependency
59
+ ### From a checkout — no build, no dependency
58
60
 
59
- `src/css/ds.css` chains the sheets with relative `@import` statements, so a page can link
60
- the source off a disk or copy the folder:
61
+ `src/css/ds.css` chains the sheets with relative `@import` statements, so a page can link the
62
+ source straight off disk:
61
63
 
62
64
  ```html
63
65
  <link rel="stylesheet" href="src/css/ds.css" />
@@ -66,8 +68,7 @@ the source off a disk or copy the folder:
66
68
 
67
69
  ### The bundle
68
70
 
69
- That chain costs a request per sheet, a waterfall on the critical path, so ship one file.
70
- A clone has no `dist/` — it is build output, and gitignored — so build it:
71
+ A clone has no `dist/` (it is gitignored build output), so build it:
71
72
 
72
73
  ```bash
73
74
  node tools/build.mjs
@@ -78,24 +79,18 @@ node tools/build.mjs
78
79
  <script src="dist/contour.min.js" defer></script> <!-- optional -->
79
80
  ```
80
81
 
81
- `dist/contour.css` is the same bundle unminified, for reading a cascade in devtools.
82
- `dist/surfaces/` carries one bundle per surface — `contour-core`, `contour-docs`,
83
- `contour-data`, `contour-landing` — so a product that ships one surface stops downloading
84
- the other three. `node tools/check-size.mjs` prints the weight of each against its
85
- budget; the figures are not restated here, because a hand-copied number rots the moment a
86
- sheet changes.
87
-
88
- The CSS bundles — full and per-surface — pull the self-hosted fonts from `dist/fonts/`
89
- beside them, so take the two together. `hljs.css` and `map-chrome.*.css` are the
90
- exceptions: they reference no font. `node tools/build.mjs --single` additionally writes
91
- `contour.single.min.css`, the minified CSS with those fonts inlined as data URIs, for a
92
- consumer that must ship exactly one file.
82
+ `dist/contour.css` is the same bundle unminified. `dist/surfaces/` carries one bundle per
83
+ surface (`-core`, `-docs`, `-data`, `-landing`) so a product that ships one surface stops
84
+ downloading the other three. `node tools/check-size.mjs` prints each weight against its
85
+ budget. The CSS bundles pull the self-hosted fonts from `dist/fonts/` beside them — take the
86
+ two together. `node tools/build.mjs --single` additionally writes `contour.single.min.css`
87
+ with those fonts inlined as data URIs, for a consumer that must ship exactly one file.
93
88
 
94
89
  ### What ships
95
90
 
96
91
  `node tools/build.mjs` writes `dist/`, and every file below is in the tarball. They are
97
- listed here because `node tools/check-dist.mjs` fails when a shipped artifact is named by
98
- no document — a bundle nobody names is a bundle nobody finds.
92
+ listed because `node tools/check-dist.mjs` fails when a shipped artifact is named by no
93
+ document — a bundle nobody names is a bundle nobody finds.
99
94
 
100
95
  | File | What it is |
101
96
  |---|---|
@@ -110,29 +105,32 @@ no document — a bundle nobody names is a bundle nobody finds.
110
105
  | `svg/contour-mark.svg` | the brand mark |
111
106
  | `contour.tokens.json` | the token layer as a **DTCG 2025.10 Format** document |
112
107
  | `contour.themes.json` | the dark half of every `light-dark()` pair, as a **Resolver** document |
113
- | `contour.components.json` | the component contract: blocks, elements, variants, states, and the custom properties each one reads |
114
- | `contour.html-data.json` | VS Code HTML custom data for registered Contour custom elements and attributes |
115
- | `contour.web-types.json` | JetBrains web-types metadata for Contour custom elements |
116
- | `contour.react.d.ts` | React JSX `IntrinsicElements` augmentation for Contour custom elements |
117
- | `contour.vue.d.ts` | Vue `GlobalComponents` augmentation for Contour custom elements |
118
- | `custom-elements.json` | Custom Elements Manifest (CEM 1.0) for Contour custom elements and global event vocabulary |
119
- | `contour.code-snippets` | VS Code editor snippets for Contour custom elements |
108
+ | `contour.components.json` | the component contract: blocks, elements, variants, states, and the custom properties each reads |
109
+ | `contour.html-data.json` | VS Code HTML custom data for the custom elements and attributes |
110
+ | `contour.web-types.json` | JetBrains web-types metadata |
111
+ | `contour.react.d.ts` | React JSX `IntrinsicElements` augmentation |
112
+ | `contour.vue.d.ts` | Vue `GlobalComponents` augmentation |
113
+ | `custom-elements.json` | Custom Elements Manifest (CEM 1.0), with per-element emitted events |
114
+ | `contour.code-snippets` | VS Code editor snippets |
120
115
  | `docs/index.json` | the guide's prose as a machine-readable package, one file per section, re-derived from `index.html` |
121
116
  | `registry/registry.json` | a shadcn registry: one item per surface, pointing at the bundles rather than copying them |
122
117
  | `agent-rules.json` | the constraints for a machine generating UI, each naming the gate that enforces it |
118
+ | `agent-cookbook.json` | the intent + blueprint layer: single tasks mapped to the block (and variants) that serve them, plus multi-block compositions (a map workspace, a choropleth, a time-slider playback) with the events and tokens that wire them — every name validated against the contract, `CONTOUR_EVENTS` and the token census |
119
+ | `contour.a11y.json` | the accessibility layer: per-block role, required ARIA, keyboard, and the gotchas that make a correct-looking block wrong, every entry validated against the component contract |
120
+ | `agent-map-wiring.json` | the map-engine seam: how Contour chrome attaches to MapLibre / Mapbox / Leaflet (`attachMap`), the engine event behind each `contour:*` event, the chrome to mount and the tokens that theme it — every name validated against `CONTOUR_EVENTS`, the contract and the token census |
121
+ | `agent-examples.json` | clean, copy-pasteable markup for the most-used blocks — real classes, real attributes, the required ARIA, no editor placeholders — every class validated against the shipped CSS and the component contract |
123
122
  | `map-chrome.maplibre.css` / `map-chrome.mapbox.css` | the map control chrome, re-keyed per engine |
124
123
  | `map-chrome-contract.json` | the tokens those controls are re-keyed onto |
125
124
  | `build-manifest.json` | the sources and outputs of the build that wrote the directory |
126
125
 
127
- `node tools/check-export.mjs`, `check-components.mjs`, `check-docs.mjs` and
128
- `check-registry.mjs` each re-derive their artifact from `src/` and `index.html`, so a
129
- stale `dist/` fails the build instead of shipping. That is also why `dist/` is never
130
- committed: it is a derivation, and a committed copy is a second source of truth that the
131
- gates above exist to catch.
126
+ `check-export`, `check-components`, `check-docs` and `check-registry` each re-derive their
127
+ artifact from `src/` and `index.html`, so a stale `dist/` fails the build instead of shipping.
128
+ That is also why `dist/` is never committed: a committed copy is a second source of truth.
132
129
 
133
130
  ## Bundler import order
134
131
 
135
- If inlining layers with a bundler, import them in this order (`ds.css` declares the same order):
132
+ If inlining layers with a bundler, import them in this order (`ds.css` declares the same
133
+ order):
136
134
 
137
135
  ```css
138
136
  @import "src/css/fonts.css";
@@ -145,7 +143,13 @@ If inlining layers with a bundler, import them in this order (`ds.css` declares
145
143
  @import "src/css/components-forms.css" layer(components);
146
144
  @import "src/css/components-display.css" layer(components);
147
145
  @import "src/css/components-overlay.css" layer(components);
148
- @import "src/css/components-misc.css" layer(components);
146
+ @import "src/css/components-misc-feedback.css" layer(components);
147
+ @import "src/css/components-misc-atoms.css" layer(components);
148
+ @import "src/css/components-misc-shell.css" layer(components);
149
+ @import "src/css/components-misc-inputs.css" layer(components);
150
+ @import "src/css/components-misc-overlays.css" layer(components);
151
+ @import "src/css/components-misc-widgets.css" layer(components);
152
+ @import "src/css/components-misc-contract.css" layer(components);
149
153
  @import "src/css/components-shell.css" layer(components);
150
154
  @import "src/css/components-data-dashboard.css" layer(components);
151
155
  @import "src/css/components-data-charts.css" layer(components);
@@ -160,9 +164,8 @@ If inlining layers with a bundler, import them in this order (`ds.css` declares
160
164
  ```
161
165
 
162
166
  The package does not expose this chain sheet by sheet — take one entry point from
163
- `contour-ds/contour.min.css`, or one surface from `contour-ds/surfaces/…`, as shown in
164
- Install. Re-ordering the layers is the build's job, owned by `src/css/ds.css` and checked
165
- by `node tools/check-claims.mjs`.
167
+ `contour-ds/contour.min.css`, or one surface from `contour-ds/surfaces/…`. Re-ordering the
168
+ layers is the build's job, owned by `src/css/ds.css` and checked by `node tools/check-claims.mjs`.
166
169
 
167
170
  ## Quick start
168
171
 
@@ -179,158 +182,55 @@ by `node tools/check-claims.mjs`.
179
182
  </contour-card>
180
183
  ```
181
184
 
182
- ## Framework quickstarts
183
-
184
- Contour is plain CSS plus an optional script, so it drops into any bundler or
185
- framework without an adapter. Import the stylesheet once at your app entry and
186
- use the classes (or the `<contour-*>` web components) anywhere.
187
-
188
- ### React / Next.js
189
-
190
- ```jsx
191
- // app/layout.jsx (Next.js) or main.jsx (Vite + React)
192
- import "contour-ds/contour.min.css";
193
- import "contour-ds/contour-wc.esm.js"; // optional web components
194
-
195
- export default function Root({ children }) {
196
- return <html data-theme="dark"><body>{children}</body></html>;
197
- }
198
- ```
199
-
200
- ```jsx
201
- // Component.jsx
202
- export function RouteButton() {
203
- return <button className="c-btn c-btn--primary">Compute route</button>;
204
- }
205
- ```
206
-
207
- **React 19 vs React 18 and custom elements.** React 19 sets a *property* on a
208
- custom element when one exists (so `<contour-switch value="x">` writes
209
- `el.value = "x"`), while React 18 only sets *attributes* (so the same JSX writes
210
- `value="x"` and a component that reads a property, not an attribute, sees
211
- nothing). Contour components read attributes and reflect properties, so both
212
- work — but on React 18 a component that only exposes a property (no attribute)
213
- needs a `ref`:
214
-
215
- ```jsx
216
- // React 18: set a property the attribute path cannot reach
217
- const ref = useRef(null);
218
- useEffect(() => { if (ref.current) ref.current.value = "x"; }, []);
219
- return <contour-switch ref={ref} />;
220
- ```
185
+ ## Frameworks
221
186
 
222
- The typed `contour.react.d.ts` augmentation (`import "contour-ds/react"`) types
223
- every `<contour-*>` tag, so JSX checks the attributes and properties you pass.
224
- *(Note: `./react` and `./vue` are TypeScript type definitions, not runtime wrapper libraries. Custom elements need no framework wrappers — state travels as native attributes and events).*
225
-
226
- ### Vue / Nuxt
227
-
228
- ```js
229
- // main.js
230
- import "contour-ds/contour.min.css";
231
- import "contour-ds/contour-wc.esm.js";
232
- ```
233
-
234
- ```vue
235
- <!-- Component.vue -->
236
- <template>
237
- <button class="c-btn c-btn--primary">Compute route</button>
238
- <contour-card title="Hello"><p>Slotted content</p></contour-card>
239
- </template>
240
- ```
241
-
242
- ### Svelte / SvelteKit
187
+ Contour is plain CSS plus an optional script, so it drops into any bundler without an
188
+ adapter. Import the stylesheet once at your app entry and use the classes (or the
189
+ `<contour-*>` elements) anywhere:
243
190
 
244
191
  ```js
245
- // +layout.svelte
246
192
  import "contour-ds/contour.min.css";
247
- import "contour-ds/contour-wc.esm.js";
248
- ```
249
-
250
- ```svelte
251
- <button class="c-btn c-btn--primary">Compute route</button>
252
- ```
253
-
254
- ### Astro
255
-
256
- ```astro
257
- ---
258
- // src/layouts/Base.astro
259
- import "contour-ds/contour.min.css";
260
- ---
261
- <html data-theme="dark">
262
- <head><title>Contour</title></head>
263
- <body><slot /></body>
264
- </html>
193
+ import "contour-ds/contour-wc.esm.js"; // optional web components
265
194
  ```
266
195
 
267
- ### Plain HTML (no build)
268
-
269
- ```html
270
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/contour-ds@1.0.0/dist/contour.min.css">
271
- ```
196
+ The same two imports work in React/Next, Vue/Nuxt, Svelte/SvelteKit and Astro. The typed
197
+ `contour.react.d.ts` (`import "contour-ds/react"`) and `contour.vue.d.ts`
198
+ (`import "contour-ds/vue"`) augment JSX and `GlobalComponents`; they are type definitions,
199
+ not runtime wrappers — custom elements need no wrapper, state travels as native attributes
200
+ and events. On React 18 a component that exposes only a property (no attribute) needs a
201
+ `ref`; Contour components read attributes and reflect properties, so both React 18 and 19
202
+ work.
272
203
 
273
- Web components are optional: every interactive block (tabs, combobox, tree,
274
- menu, segmented, dialog) works as plain markup with `ds.css` alone, and the
275
- `<contour-*>` elements only add scaffolding and keyboard behaviour.
204
+ > **Theming.** Stock Contour ships exactly two themes — light and dark — via `light-dark()`
205
+ > and `color-scheme`. Set `<meta name="color-scheme" content="light dark" />` to follow the
206
+ > OS, or `content="dark"` to pin dark. There is **no `data-theme` attribute in the system**: a
207
+ > named third palette is a product decision (see [Theming](#theming)).
276
208
 
277
- ## Observing component events
209
+ ## Events
278
210
 
279
- Every interactive `<contour-*>` element emits bubbling, composed `contour:*`
280
- CustomEvents, so a host (including one inside a shadow tree) can listen with
281
- plain `addEventListener`. Events carry a `detail` payload; see the §23 event
282
- table in the style guide for the full list.
211
+ Every interactive `<contour-*>` element emits bubbling, composed `contour:*` CustomEvents,
212
+ so a host (including one inside a shadow tree) can listen with plain `addEventListener`.
213
+ Events carry a `detail` payload; the full list is the §23 event table in the style guide.
283
214
 
284
215
  ```js
285
- // Plain JavaScript
286
216
  const table = document.querySelector("contour-table");
287
- table.addEventListener("contour:page", (e) => {
288
- console.log("page", e.detail.page);
289
- });
290
- table.addEventListener("contour:sort", (e) => {
291
- console.log(e.detail.column, e.detail.direction);
292
- });
217
+ table.addEventListener("contour:page", (e) => console.log("page", e.detail.page));
218
+ table.addEventListener("contour:sort", (e) => console.log(e.detail.column, e.detail.direction));
293
219
  ```
294
220
 
295
- ```jsx
296
- // React — attach via a ref (events are not props)
297
- import { useEffect, useRef } from "react";
298
- export function Table() {
299
- const ref = useRef(null);
300
- useEffect(() => {
301
- const el = ref.current;
302
- const handler = (e) => console.log("page", e.detail.page);
303
- el?.addEventListener("contour:page", handler);
304
- return () => el?.removeEventListener("contour:page", handler);
305
- }, []);
306
- return <contour-table ref={ref} page-size="10" />;
307
- }
308
- ```
309
-
310
- Because the events are `composed: true`, they cross shadow boundaries: a
311
- `contour-table` nested inside another component's shadow tree still reaches a
312
- listener on `document`.
221
+ Because the events are `composed: true`, they cross shadow boundaries: a `contour-table`
222
+ nested inside another component's shadow tree still reaches a listener on `document`.
313
223
 
314
224
  ## Map engine integration
315
225
 
316
- Contour ships the **interface** (controls, panels, readouts, legends) and
317
- deliberately stays out of the map engine's turf: it never imports MapLibre,
318
- Mapbox or Leaflet, never renders GeoJSON, and never projects coordinates.
319
- The engine owns the canvas; Contour owns the chrome around it.
226
+ Contour ships the **interface** (controls, panels, readouts, legends) and stays out of the
227
+ map engine's turf: it never imports MapLibre, Mapbox or Leaflet, never renders GeoJSON, and
228
+ never projects coordinates. The engine owns the canvas; Contour owns the chrome around it.
320
229
 
321
- ### Wiring recipe
322
-
323
- 1. Import the engine's stylesheet and Contour's map-chrome sheet for that
324
- engine:
325
-
326
- ```js
327
- import "maplibre-gl/dist/maplibre-gl.css";
328
- import "contour-ds/map-chrome/maplibre"; // re-keys vendor controls onto Contour tokens
329
- import "contour-ds/contour.min.css";
330
- ```
331
-
332
- 2. Create the map in your own code and mount Contour's chrome as siblings of
333
- the map container (not inside it):
230
+ 1. Import the engine's stylesheet and Contour's map-chrome sheet for that engine
231
+ (`contour-ds/map-chrome/maplibre`, or `/mapbox`), then `contour-ds/contour.min.css`.
232
+ 2. Create the map in your own code and mount Contour's chrome as **siblings** of the map
233
+ container, not inside it:
334
234
 
335
235
  ```html
336
236
  <div class="c-map-slot">
@@ -341,34 +241,11 @@ The engine owns the canvas; Contour owns the chrome around it.
341
241
  </div>
342
242
  ```
343
243
 
344
- 3. Listen for Contour's `contour:*` events (`contour:layer-visibility`,
345
- `contour:layer-opacity`, `contour:bearing`, …) and forward them to the
346
- engine's API (`map.setLayoutProperty`, `map.setBearing`, …). Contour never
347
- calls the engine; the seam is the event.
244
+ 3. Listen for `contour:*` events (`contour:layer-visibility`, `contour:bearing`, …) and
245
+ forward them to the engine's API. Contour never calls the engine; the seam is the event.
348
246
 
349
247
  The full token-to-vendor mapping lives in `dist/map-chrome-contract.json`.
350
248
 
351
- ## Surfaces
352
-
353
- | Surface | Guide |
354
- |---|---|
355
- | Landing | [§15](index.html#landing) |
356
- | Documentation | [§14](index.html#docs) |
357
- | Dashboard | [§13](index.html#data) |
358
- | Recipes | [§18](index.html#recipes) |
359
-
360
- ## Key features
361
-
362
- - **Zero runtime dependencies** — pure CSS + optional JS enhancement
363
- - **Dark/light themes** via `light-dark()` and `color-scheme`
364
- - **203 components** across 14 stylesheets (landing, docs, dashboard, data)
365
- - **294 design tokens** — colours, typography, space, shape, motion, density
366
- - **Web components** — 365 custom elements (`<contour-*>`, `<contour-shadow-*>`) with attribute reactivity
367
- - **DTCG 2025.10** token export (Format + Resolver documents)
368
- - **shadcn registry** — one item per surface bundle
369
- - **WCAG 2.2 AA** — contrast, focus, reflow, reduced motion, forced colours
370
- - **Self-hosted fonts** — IBM Plex (Sans, Mono, Condensed), subsetted, OFL 1.1
371
-
372
249
  ## Theming
373
250
 
374
251
  ```css
@@ -382,25 +259,27 @@ The full token-to-vendor mapping lives in `dist/map-chrome-contract.json`.
382
259
  <meta name="color-scheme" content="light dark" />
383
260
  ```
384
261
 
385
- ## Tokens
262
+ ### Density
386
263
 
387
- Four layers: primitives → semantic → component → utilities. Primitives never change between themes.
264
+ Density is a scoped multiplier, not a build variant. Set `data-density` on any element and
265
+ its subtree re-derives row heights, control targets and spacing from the same tokens:
388
266
 
389
- ```css
390
- @import "src/css/fonts.css";
391
- @import "src/css/tokens.css" layer(tokens);
392
- @import "src/css/base.css" layer(base);
393
- @import "src/css/components-brand.css" layer(components);
394
- @import "src/css/components-buttons.css" layer(components);
395
- @import "src/css/components-cards.css" layer(components);
396
- @import "src/css/components-navigation.css" layer(components);
397
- @import "src/css/components-forms.css" layer(components);
398
- @import "src/css/components-display.css" layer(components);
399
- @import "src/css/components-overlay.css" layer(components);
400
- @import "src/css/components-misc.css" layer(components);
401
- /* + components-shell, components-data-dashboard, components-data-charts, components-data-tables, components-data-maps, components-data-widgets, components-docs, components-landing, patterns, utilities */
267
+ ```html
268
+ <div data-density="compact">…dense table / dashboard…</div>
269
+ <div data-density="roomy">…comfortable marketing surface…</div>
402
270
  ```
403
271
 
272
+ `compact` (0.72), the default (1) and `roomy` (1.28) are the shipped steps; `--density` is a
273
+ registered `<number>` property, so a product can set any value inline
274
+ (`style="--density: 0.9"`). `<contour-density-toggle>` flips `data-density` on itself and
275
+ emits `contour:change`; forward that event to the scope you want to resize.
276
+
277
+ ## Tokens
278
+
279
+ Four layers: primitives → semantic → component → utilities. Primitives never change between
280
+ themes. The full import chain is in [Bundler import order](#bundler-import-order); the
281
+ package exposes one entry point (`contour.min.css`) or one surface bundle.
282
+
404
283
  ## Consumer layering
405
284
 
406
285
  Contour declares four cascade layers in this order:
@@ -409,8 +288,8 @@ Contour declares four cascade layers in this order:
409
288
  @layer tokens, base, components, utilities;
410
289
  ```
411
290
 
412
- A consumer who wants to override a component should add their own layer **after**
413
- `utilities` so their rules win without specificity wars:
291
+ A consumer who wants to override a component should add their own layer **after** `utilities`
292
+ so their rules win without specificity wars:
414
293
 
415
294
  ```css
416
295
  @layer contour-overrides {
@@ -418,18 +297,24 @@ A consumer who wants to override a component should add their own layer **after*
418
297
  }
419
298
  ```
420
299
 
421
- Import Contour first, then declare your override layer; later layers always beat
422
- earlier ones regardless of source order within a layer. Never put overrides in
423
- an unlayered stylesheet — unlayered rules beat every layered rule, which makes
424
- future Contour updates fight your overrides.
300
+ Import Contour first, then declare your override layer; later layers always beat earlier
301
+ ones. Never put overrides in an unlayered stylesheet — unlayered rules beat every layered
302
+ rule, which makes future Contour updates fight your overrides.
425
303
 
426
304
  ## Components
427
305
 
428
- Naming: `.c-<block>`, `.c-<block>__<element>`, `.c-<block>--<variant>`.
306
+ Naming: `.c-<block>`, `.c-<block>__<element>`, `.c-<block>--<variant>`. Groups: actions,
307
+ forms, status, surfaces, navigation, feedback, overlays, data, documentation, landing,
308
+ layout. Full reference: [style guide](index.html).
429
309
 
430
- Groups: actions, forms, status, surfaces, navigation, feedback, overlays, data, documentation, landing, layout.
310
+ ### Icons
431
311
 
432
- Full reference: [style guide](index.html).
312
+ Contour uses **Lucide** (v1.83.0, ISC, with Feather-derived glyphs under MIT) as its
313
+ single icon set, plus the custom contour brand mark. The sprite (`src/svg/icons.svg`) is
314
+ generated from `tools/icons/manifest.json` — it is inlined and self-hosted, with no icon
315
+ font, CDN, or runtime dependency. Use the sprite glyphs (`<use href="#i-…">`) consistently
316
+ across your UI, and add a Lucide name to the manifest (then run `node tools/gen-icons.mjs`)
317
+ rather than inlining a one-off SVG, so the whole system stays on one set.
433
318
 
434
319
  ## Web components
435
320
 
@@ -438,43 +323,69 @@ Full reference: [style guide](index.html).
438
323
  <contour-card title="Hello"><p>Slotted content</p></contour-card>
439
324
  ```
440
325
 
441
- Light DOM (`<contour-*>`) and Shadow DOM (`<contour-shadow-*>`) wrappers. Attribute-reactive, form-associated, keyboard-navigable. See [§23](https://abelvm.github.io/contour-ds/index.html#webcomponents).
442
-
443
- ### Server-side rendering
444
-
445
- The shadow layer can emit Declarative Shadow DOM, so a server-rendered page
446
- arrives with its shadow trees already attached and needs no JavaScript to look
447
- right. `renderShadowDSD` is exported from the web-component entry and returns a
448
- string, or `null` for a tag it does not know:
326
+ Light DOM (`<contour-*>`) and Shadow DOM (`<contour-shadow-*>`) wrappers, attribute-reactive,
327
+ form-associated and keyboard-navigable. See [§23](index.html#webcomponents).
328
+
329
+ **Attributes are strings.** Attributes are the canonical wire format; properties mirror them.
330
+ Structured inputs (arrays, objects) are written as JSON and parsed by the element. Setting the
331
+ matching property with a real array/object also works — the setter JSON-stringifies it — so a
332
+ framework that assigns DOM properties (React 19, Vue 3) does not corrupt the value. Two traps:
333
+
334
+ - **Boolean presence.** A bare attribute (`disabled`, `removable`) is *on*. The
335
+ native-`disabled` family (btn/pressable/row-action) treats `disabled="false"` as **on**
336
+ (HTML presence convention); the `flagOn` family (closable, live, pausable, shimmer,
337
+ removable, readonly) treats `"false"`/`"0"`/`"no"`/`"off"` as off. Write `el.disabled = false`
338
+ or remove the attribute to turn it off.
339
+ - **Numbers and strings.** `value="70"` reflects as the string `"70"`; read it back as a
340
+ number where the API documents a number.
341
+
342
+ **Internationalisation (`labels`).** User-facing strings the system ships are overridable
343
+ through a `labels` JSON attribute — a flat `{ key: "text" }` map merged over the built-in
344
+ English defaults. Keys are component-specific; an unknown key is ignored and an omitted key
345
+ keeps its default. This is the only i18n seam — there is no locale negotiation.
346
+
347
+ **Server-side rendering.** The shadow layer can emit Declarative Shadow DOM, so a
348
+ server-rendered page arrives with its shadow trees already attached and needs no JavaScript
349
+ to look right. `renderShadowDSD` (exported from the web-component entry) returns a string,
350
+ or `null` for a tag it does not know; `SHADOW_MARKUP` is the full tag → markup record. The
351
+ light-DOM elements need no server help — they upgrade on the client.
352
+
353
+ **Your own shadow roots.** A shadow root does not inherit the document's stylesheet, so a
354
+ component class inside one renders as an unstyled box unless you adopt the sheet. Adopt one
355
+ parsed sheet per document and share it — `new CSSStyleSheet()` once, `adoptedStyleSheets`
356
+ on every root:
449
357
 
450
358
  ```js
451
- import { renderShadowDSD, SHADOW_MARKUP } from "contour-ds/contour-wc.esm.js";
452
-
453
- const html = renderShadowDSD(
454
- "contour-shadow-badge",
455
- 'class="c-badge c-badge--primary"',
456
- "Live"
457
- );
458
- // <contour-shadow-badge class="c-badge c-badge--primary"><template shadowrootmode="open">…</template>Live</contour-shadow-badge>
359
+ const css = await (await fetch(new URL("contour-ds/contour.css", import.meta.url))).text();
360
+ const sheet = new CSSStyleSheet();
361
+ sheet.replaceSync(css);
362
+
363
+ const root = host.attachShadow({ mode: "open" });
364
+ root.adoptedStyleSheets = [sheet];
459
365
  ```
460
366
 
461
- `SHADOW_MARKUP` is the full tag → markup record (171 entries), frozen and also
462
- published as `globalThis.ContourShadowTemplates` for tooling that reads the
463
- registry rather than calling the function. The markup is recorded wherever the
464
- module runs, including Node with no `document`, which is the environment this
465
- exists for.
367
+ Nothing else is needed, and the reasons are worth knowing:
466
368
 
467
- The light-DOM elements need no server help: they are plain custom elements and
468
- upgrade on the client. What DSD buys is the shadow wrappers, which would
469
- otherwise render empty until their upgrade.
369
+ - **Tokens cross the boundary by inheritance.** Custom properties inherit into a shadow
370
+ tree, so `--color-primary` defined on `:root` is readable inside it. The sheet's own
371
+ `:root` rule matches nothing inside a shadow tree (there is no `:root` there), which is
372
+ why the values must already be on the host — they are, on any page that links the sheet.
373
+ - **`light-dark()` resolves from `color-scheme`,** an inherited property, so a shadow tree
374
+ follows the document's scheme without extra rules. Do not re-declare the tokens on
375
+ `:host` to change the theme: a `var()` inside a custom property was already substituted
376
+ at `:root`, so override the *scope* with `.c-theme-scope`, which re-derives the brand
377
+ layer, rather than one value.
378
+ - Measured on the shipped sheet: a `.c-btn--primary` inside an adopting shadow root
379
+ computes the same background, colour, font size, radius and `color-scheme` as the one in
380
+ the light DOM.
470
381
 
471
- Interactive stories, controls, keyboard paths and workflow demonstrations live in the
472
- optional [Storybook workshop](https://abelvm.github.io/contour-ds/storybook/) (`npm run storybook`).
382
+ Interactive stories and workflow demonstrations live in the optional
383
+ [Storybook workshop](https://abelvm.github.io/contour-ds/storybook/) (`npm run storybook`).
473
384
 
474
385
  ## Starter templates
475
386
 
476
- Three complete pages ship in `templates/`, one per surface. They run straight
477
- off a checkout (no build) and are the fastest way to start:
387
+ Three complete pages ship in `templates/`, one per surface. They run straight off a checkout
388
+ (no build) and are the fastest way to start:
478
389
 
479
390
  | Template | Surface | What it shows |
480
391
  |---|---|---|
@@ -484,128 +395,73 @@ off a checkout (no build) and are the fastest way to start:
484
395
  | `templates/vite/` | Vite + React | Minimal Vite app importing `contour-ds` from a local checkout |
485
396
  | `templates/astro/` | Astro | Minimal Astro site with the stylesheet wired into the base layout |
486
397
 
487
- Run any of them:
488
-
489
398
  ```bash
490
399
  python3 -m http.server 8899 --directory /data/projects/DS
491
400
  # open http://localhost:8899/templates/landing.html
492
401
  ```
493
402
 
494
- Copy the file, delete what you do not need, and point the stylesheet at your
495
- own build:
496
-
497
- ```html
498
- <link rel="stylesheet" href="/css/contour.css" />
499
- ```
403
+ Copy the file, delete what you do not need, and point the stylesheet at your own build.
500
404
 
501
405
  ## Figma & design tokens
502
406
 
503
- The token layer exports as two DTCG 2025.10 documents, so it round-trips into
504
- design tools:
505
-
506
- - `contour-ds/tokens.json` — the **Format** document (primitives, semantic,
507
- component and utility tokens, with `light-dark()` resolved per theme).
508
- - `contour-ds/themes.json` — the **Resolver** document (the dark half of every
509
- `light-dark()` pair).
510
-
511
- ### Tokens Studio (Figma)
512
-
513
- 1. Install the [Tokens Studio](https://tokens.studio/) plugin in Figma.
514
- 2. Create a new token set and choose **Import → DTCG**.
515
- 3. Point it at `contour-ds/tokens.json` (the DTCG 2025.10 Format document, or the
516
- published URL).
517
- 4. Map the `tidal` / `plasma` / `basalt` families to your Figma variables;
518
- the semantic layer (`color-primary`, `color-text-muted`, …) is what
519
- components should reference, not the primitives.
520
-
521
- Because the tokens are the source of truth, re-running `node tools/build.mjs`
522
- regenerates both documents and the Figma variables stay in sync.
407
+ The token layer exports as two DTCG 2025.10 documents, so it round-trips into design tools:
408
+ `contour-ds/tokens.json` (the **Format** document) and `contour-ds/themes.json` (the
409
+ **Resolver** document, the dark half of every `light-dark()` pair). Import the Format document
410
+ through the [Tokens Studio](https://tokens.studio/) plugin (**Import → DTCG**) and map the
411
+ semantic layer (`color-primary`, `color-text-muted`, …) to your Figma variables rather than
412
+ the primitives. Re-running `node tools/build.mjs` regenerates both documents, so the Figma
413
+ variables stay in sync.
523
414
 
524
415
  ## shadcn registry
525
416
 
526
- Contour ships a [shadcn](https://ui.shadcn.com/)-compatible registry: one item
527
- per surface bundle, pointing at the shipped CSS rather than inlining it.
528
-
529
- ```bash
530
- # once the registry is hosted
531
- npx shadcn@latest add https://<host>/r/contour-core.json
532
- ```
533
-
534
- The registry lives at `dist/registry/registry.json` after a build and is
535
- validated against the vendored shadcn schemas by
536
- `node tools/audit/registry-contract.mjs`. It declares no `homepage` or `url`
537
- while the project is private; those are added at v1.0.
417
+ Contour ships a [shadcn](https://ui.shadcn.com/)-compatible registry: one item per surface
418
+ bundle, pointing at the shipped CSS rather than inlining it. It lives at
419
+ `dist/registry/registry.json` after a build and is validated against the vendored shadcn
420
+ schemas by `node tools/audit/registry-contract.mjs`. It declares no `homepage` or `url` while
421
+ the project is private; those are added at v1.0.
538
422
 
539
423
  ## Integrations
540
424
 
541
- Optional bridges into other toolchains. None are required to use the system.
542
-
543
- - **Tailwind v4** — `integrations/tailwind/contour-theme.css` exposes Contour
544
- tokens as Tailwind utilities (`bg-primary`, `text-muted`, `rounded-md`,
545
- `font-sans`, …). See `integrations/README.md`.
546
- - **AI assistants** — `integrations/ai/CLAUDE.md`, `integrations/ai/v0-prompt.md`
547
- and `integrations/ai/v0-prompt.md` teach Cursor / Claude Code / v0 / Bolt /
548
- Lovable to use Contour correctly. The machine-readable contract they point at
549
- is `dist/agent-rules.json`.
550
- - **MapLibre / Mapbox** — `contour-ds/map-chrome/maplibre` (or `/mapbox`)
551
- re-keys the map controls onto Contour tokens. `templates/map.html` is a CSS
552
- demo of the map chrome; it does not exercise the `contour-map-*` components.
553
- - **Native (iOS / Android / Flutter)** — `integrations/native/` feeds Style
554
- Dictionary from `contour.tokens.json` so native companions stay in sync.
555
-
556
- ## Performance
425
+ Optional bridges into other toolchains; none are required to use the system. See
426
+ `integrations/README.md`.
557
427
 
558
- The guide itself loads every component and 4 external scripts (highlight.js from a CDN, `ds.js`, `wc/index.mjs`, `guide.js`); its Lighthouse score is not the system's score.
428
+ - **Tailwind v4** — `integrations/tailwind/contour-theme.css` exposes Contour tokens as
429
+ utilities (`bg-primary`, `text-muted`, `rounded-md`, `font-sans`, …).
430
+ - **AI assistants** — `integrations/ai/CLAUDE.md` and `integrations/ai/v0-prompt.md` teach
431
+ Cursor / Claude Code / v0 / Bolt / Lovable to use Contour correctly; the contract they point
432
+ at is `dist/agent-rules.json`.
433
+ - **MapLibre / Mapbox** — `contour-ds/map-chrome/maplibre` (or `/mapbox`) re-keys the map
434
+ controls onto Contour tokens.
435
+ - **Native (iOS / Android / Flutter)** — `integrations/native/` feeds Style Dictionary from
436
+ `contour.tokens.json` so native companions stay in sync.
559
437
 
560
438
  ## Browser support
561
439
 
562
- Sizes are in `rem`; the layout reflows to 200% zoom and to a 390 px viewport
563
- with no horizontal page scroll.
440
+ Sizes are in `rem`; the layout reflows to 200% zoom and to a 390 px viewport with no horizontal
441
+ page scroll. Baseline features with progressive enhancement; `light-dark()` is the most
442
+ load-bearing (newly available 2024-05-13, widely available 2026-11-13), with a fallback sheet
443
+ at `src/css/light-dark-fallback.css` regenerated by `node tools/gen-light-dark.mjs --check`.
564
444
 
565
- Baseline newly-available features with progressive enhancement. `light-dark()`
566
- is the most load-bearing (newly available 2024-05-13, widely available
567
- 2026-11-13). Fallback sheet: `src/css/light-dark-fallback.css`, regenerated
568
- by `node tools/gen-light-dark.mjs --check`.
569
-
570
- ### What is supported
571
-
572
- | Feature | Status | Notes |
573
- |---|---|---|
574
- | `light-dark()` (colour) | Newly available (2024-05) | Fallback sheet ships for older browsers |
575
- | `light-dark()` (images) | Not used | Do not use; widely available only 2029 |
576
- | `oklch()` | Widely available | All colour tokens |
577
- | `:has()` | Widely available | Used for stateful components |
578
- | Container queries | Widely available | Dense tables drop optional columns |
579
- | Anchor positioning | Newly available (2026-01) | Behind `@supports` for tooltips/menus |
580
- | Web components | Widely available | Progressive enhancement only |
445
+ `prefers-reduced-motion: reduce` collapses every transition, and Forced Colors Mode removes the
446
+ texture and ridgelines and falls back to a system `CanvasText` outline — both on by default.
581
447
 
582
- ### Single-file drop
583
-
584
- For environments that must ship exactly one file (email, embedded widget,
585
- offline bundle), build with `node tools/build.mjs --single` to get
586
- `dist/contour.single.min.css` with the self-hosted fonts inlined as data URIs
587
- (~260 kB larger; defeats font caching, so prefer the two-file drop otherwise).
588
-
589
- ### Reduced motion & forced colours
590
-
591
- `prefers-reduced-motion: reduce` collapses every transition, and Forced
592
- Colors Mode removes the texture and ridgelines and falls back to a system
593
- `CanvasText` outline. Both are on by default; no opt-in required.
594
-
595
- Full details: [Browser support](index.html#browser-support).
448
+ The guide itself loads every component and 6 external scripts (highlight.js from a CDN,
449
+ maplibre-gl from a CDN, `ds.js`, `wc/hydrate.mjs`, `wc/index.mjs`, `guide.js`); its
450
+ Lighthouse score is not the system's score.
596
451
 
597
452
  ## Commands
598
453
 
599
454
  | Command | What it does |
600
455
  |---|---|
601
- | `node tools/build.mjs` | Bundle into `dist/`, export tokens |
456
+ | `npm run build:core` | Bundle into `dist/`, export tokens |
457
+ | `npm run build` | Full build: `dist/`, the guide, the story index and the static Storybook site |
602
458
  | `node tools/build.mjs --single` | Single-file build with inlined fonts |
603
- | `node tools/snippets.mjs` | Regenerate code snippets in `index.html` |
604
- | `npx html-validate index.html templates/*.html` | Validate markup |
605
- | `node tools/doctor.mjs` | Run all quality gates |
459
+ | `npm run snippets` | Regenerate code snippets in `index.html` |
460
+ | `npm run validate` | Validate markup |
461
+ | `npm run doctor` | Run all quality gates |
606
462
  | `npm run storybook` | Start the Storybook workshop on port 6006 |
607
- | `npm run build:storybook` | Build the static Storybook site into `storybook/` |
608
- | `npm run test:storybook` | Run Storybook interaction/a11y tests |
463
+ | `npm run build:storybook` | Build the static Storybook site into `storybook/` (run `build:core` first) |
464
+ | `npm run test:storybook` | Build and run the Storybook interaction/a11y suite plus coverage |
609
465
 
610
466
  ## Repository
611
467
 
@@ -619,17 +475,10 @@ dist/ build output (gitignored)
619
475
 
620
476
  ## Licence
621
477
 
622
- MIT for the design system. Fonts (IBM Plex Sans, Mono, Condensed) are licensed
623
- under the SIL Open Font License 1.1 — see `src/css/fonts/OFL.txt`.
624
-
625
- ### Font attribution
626
-
627
- IBM Plex is copyright © 2017 IBM Corp., released under the SIL Open Font
628
- License, Version 1.1, with the Reserved Font Name "Plex". The binaries shipped
629
- in `src/css/fonts/` (and `dist/fonts/` after a build) are unmodified upstream
630
- releases; the OFL text ships beside them as `OFL.txt`. The CSS `font-family`
631
- names (`Contour Plex Sans`, `Contour Plex Mono`, `Contour Plex Sans Condensed`)
632
- are aliases only and do not rename the font software.
478
+ MIT for the design system. Fonts (IBM Plex Sans, Mono, Condensed) are licensed under the SIL
479
+ Open Font License 1.1 — see `src/css/fonts/OFL.txt`. IBM Plex is copyright © 2017 IBM Corp.,
480
+ released under the SIL OFL 1.1 with the Reserved Font Name "Plex"; the shipped binaries are
481
+ unmodified upstream releases and the CSS `font-family` names are aliases only.
633
482
 
634
483
  ---
635
484