contour-ds 0.0.0-stage → 1.0.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 (92) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +538 -2
  3. package/dist/agent-rules.json +222 -0
  4. package/dist/build-manifest.json +241 -0
  5. package/dist/contour-wc.esm.js +12439 -0
  6. package/dist/contour-wc.esm.min.js +1 -0
  7. package/dist/contour-wc.js +12438 -0
  8. package/dist/contour-wc.min.js +1 -0
  9. package/dist/contour.components.json +9340 -0
  10. package/dist/contour.css +11084 -0
  11. package/dist/contour.d.ts +1002 -0
  12. package/dist/contour.esm.js +1649 -0
  13. package/dist/contour.esm.min.js +1 -0
  14. package/dist/contour.js +1647 -0
  15. package/dist/contour.min.css +1 -0
  16. package/dist/contour.min.js +1 -0
  17. package/dist/contour.themes.json +828 -0
  18. package/dist/contour.tokens.json +2487 -0
  19. package/dist/docs/actions.md +30 -0
  20. package/dist/docs/affordances.md +171 -0
  21. package/dist/docs/colour.md +44 -0
  22. package/dist/docs/data.md +106 -0
  23. package/dist/docs/docs.md +102 -0
  24. package/dist/docs/feedback.md +65 -0
  25. package/dist/docs/field.md +60 -0
  26. package/dist/docs/forms.md +40 -0
  27. package/dist/docs/index.json +272 -0
  28. package/dist/docs/install.md +30 -0
  29. package/dist/docs/landing.md +69 -0
  30. package/dist/docs/mapengine.md +30 -0
  31. package/dist/docs/motion.md +47 -0
  32. package/dist/docs/navigation.md +53 -0
  33. package/dist/docs/overlays.md +60 -0
  34. package/dist/docs/overview.md +21 -0
  35. package/dist/docs/patterns.md +35 -0
  36. package/dist/docs/playground.md +38 -0
  37. package/dist/docs/principles.md +45 -0
  38. package/dist/docs/recipes.md +106 -0
  39. package/dist/docs/space.md +38 -0
  40. package/dist/docs/status.md +30 -0
  41. package/dist/docs/surfaces.md +68 -0
  42. package/dist/docs/theming.md +68 -0
  43. package/dist/docs/type.md +31 -0
  44. package/dist/docs/webcomponents.md +81 -0
  45. package/dist/fonts/OFL.txt +92 -0
  46. package/dist/fonts/ibm-plex-mono-var-italic.woff2 +0 -0
  47. package/dist/fonts/ibm-plex-mono-var.woff2 +0 -0
  48. package/dist/fonts/ibm-plex-sans-condensed-500.woff2 +0 -0
  49. package/dist/fonts/ibm-plex-sans-condensed-600.woff2 +0 -0
  50. package/dist/fonts/ibm-plex-sans-condensed-700.woff2 +0 -0
  51. package/dist/fonts/ibm-plex-sans-var-italic.woff2 +0 -0
  52. package/dist/fonts/ibm-plex-sans-var.woff2 +0 -0
  53. package/dist/hljs.css +154 -0
  54. package/dist/map-chrome-contract.json +34 -0
  55. package/dist/map-chrome.mapbox.css +672 -0
  56. package/dist/map-chrome.maplibre.css +672 -0
  57. package/dist/registry/items/contour-core.json +62 -0
  58. package/dist/registry/items/contour-data.json +62 -0
  59. package/dist/registry/items/contour-docs.json +62 -0
  60. package/dist/registry/items/contour-landing.json +62 -0
  61. package/dist/registry/registry.json +255 -0
  62. package/dist/surfaces/contour-core.min.css +1 -0
  63. package/dist/surfaces/contour-data.min.css +1 -0
  64. package/dist/surfaces/contour-docs.min.css +1 -0
  65. package/dist/surfaces/contour-landing.min.css +1 -0
  66. package/dist/svg/contour-mark.svg +1 -0
  67. package/dist/wc/behaviours.mjs +1092 -0
  68. package/dist/wc/content.mjs +833 -0
  69. package/dist/wc/core.mjs +893 -0
  70. package/dist/wc/dashboard.mjs +122 -0
  71. package/dist/wc/data.mjs +1955 -0
  72. package/dist/wc/docs.mjs +158 -0
  73. package/dist/wc/feedback.mjs +869 -0
  74. package/dist/wc/forms.mjs +724 -0
  75. package/dist/wc/index.mjs +35 -0
  76. package/dist/wc/interaction.mjs +481 -0
  77. package/dist/wc/layout.mjs +167 -0
  78. package/dist/wc/map.mjs +815 -0
  79. package/dist/wc/misc.mjs +199 -0
  80. package/dist/wc/navigation.mjs +1233 -0
  81. package/dist/wc/registration.mjs +12 -0
  82. package/dist/wc/shadow.mjs +378 -0
  83. package/dist/wc/states.mjs +540 -0
  84. package/dist/wc/svg.mjs +207 -0
  85. package/dist/wc/ui.mjs +1748 -0
  86. package/integrations/README.md +14 -0
  87. package/integrations/ai/CLAUDE.md +24 -0
  88. package/integrations/ai/v0-prompt.md +70 -0
  89. package/integrations/native/README.md +19 -0
  90. package/integrations/native/style-dictionary.config.json +38 -0
  91. package/integrations/tailwind/contour-theme.css +64 -0
  92. package/package.json +100 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Abel V. M.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,539 @@
1
- # Temporary Holding Version
1
+ # Contour
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm version](https://img.shields.io/npm/v/contour-ds?label=npm)](https://www.npmjs.com/package/contour-ds)
4
+ [![jsDelivr](https://img.shields.io/jsdelivr/npm/hm/contour-ds?label=jsDelivr)](https://cdn.jsdelivr.net/npm/contour-ds/dist/contour.min.css)
5
+
6
+ A token-driven design system for **spatial interfaces** — routing engines, pedestrian
7
+ simulators, map tooling and geospatial dashboards.
8
+
9
+ <!-- ds:components-line -->203 components, 294 design tokens<!-- /ds:components-line -->, dark and light themes, zero runtime dependencies, no build step.
10
+
11
+ The [style guide](index.html) is the specification and the test suite.
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install contour-ds
17
+ ```
18
+
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
24
+
25
+ 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:
28
+
29
+ ```css
30
+ @import "contour-ds/contour.min.css"; /* every layer, in cascade order */
31
+ @import "contour-ds/surfaces/contour-data.min.css"; /* or -core, -docs, -landing */
32
+ @import "contour-ds/hljs.css"; /* optional companion, not in the bundle */
33
+ @import "contour-ds/map-chrome/maplibre"; /* or /mapbox */
34
+ ```
35
+
36
+ `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`,
39
+ `contour-ds/themes.json`, `contour-ds/components.json`.
40
+
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"; // registers every custom element
51
+ // or, for tree-shaking of individual modules:
52
+ import "contour-ds/wc/forms.mjs";
53
+ ```
54
+
55
+ The classic `contour-wc.js` remains the recommended entry for a plain `<script>` tag
56
+ off disk; the ESM build is for bundlers. Both register the same custom elements as a
57
+ side effect on import.
58
+
59
+ ### From a checkout — no build step, no dependency
60
+
61
+ `src/css/ds.css` chains the sheets with relative `@import` statements, so a page can link
62
+ the source off a disk or copy the folder:
63
+
64
+ ```html
65
+ <link rel="stylesheet" href="src/css/ds.css" />
66
+ <script src="src/js/ds.js" defer></script> <!-- optional -->
67
+ ```
68
+
69
+ ### The bundle
70
+
71
+ That chain costs a request per sheet, a waterfall on the critical path, so ship one file.
72
+ A clone has no `dist/` — it is build output, and gitignored — so build it:
73
+
74
+ ```bash
75
+ node tools/build.mjs
76
+ ```
77
+
78
+ ```html
79
+ <link rel="stylesheet" href="dist/contour.min.css" />
80
+ <script src="dist/contour.min.js" defer></script> <!-- optional -->
81
+ ```
82
+
83
+ `dist/contour.css` is the same bundle unminified, for reading a cascade in devtools.
84
+ `dist/surfaces/` carries one bundle per surface — `contour-core`, `contour-docs`,
85
+ `contour-data`, `contour-landing` — so a product that ships one surface stops downloading
86
+ the other three. `node tools/check-size.mjs` prints the weight of each against its
87
+ budget; the figures are not restated here, because a hand-copied number rots the moment a
88
+ sheet changes.
89
+
90
+ The CSS bundles — full and per-surface — pull the self-hosted fonts from `dist/fonts/`
91
+ beside them, so take the two together. `hljs.css` and `map-chrome.*.css` are the
92
+ exceptions: they reference no font. `node tools/build.mjs --single` additionally writes
93
+ `contour.single.min.css`, the minified CSS with those fonts inlined as data URIs, for a
94
+ consumer that must ship exactly one file.
95
+
96
+ ### What ships
97
+
98
+ `node tools/build.mjs` writes `dist/`, and every file below is in the tarball. They are
99
+ listed here because `node tools/check-dist.mjs` fails when a shipped artifact is named by
100
+ no document — a bundle nobody names is a bundle nobody finds.
101
+
102
+ | File | What it is |
103
+ |---|---|
104
+ | `contour.css` / `contour.min.css` | every layer, in cascade order |
105
+ | `contour.js` / `contour.min.js` | the optional enhancement script |
106
+ | `contour-wc.js` / `contour-wc.min.js` | the web components, as a classic script |
107
+ | `contour.d.ts` | TypeScript definitions: element names, token names, the public API |
108
+ | `contour.single.min.css` | opt-in `--single`: the minified CSS with the fonts inlined |
109
+ | `surfaces/contour-core.min.css` | one bundle per surface, beside `-docs`, `-data`, `-landing` |
110
+ | `fonts/` | the self-hosted woff2 files the CSS references |
111
+ | `hljs.css` | the optional highlight.js companion, kept out of the bundle |
112
+ | `svg/contour-mark.svg` | the brand mark |
113
+ | `contour.tokens.json` | the token layer as a **DTCG 2025.10 Format** document |
114
+ | `contour.themes.json` | the dark half of every `light-dark()` pair, as a **Resolver** document |
115
+ | `contour.components.json` | the component contract: blocks, elements, variants, states, and the custom properties each one reads |
116
+ | `docs/index.json` | the guide's prose as a machine-readable package, one file per section, re-derived from `index.html` |
117
+ | `registry/registry.json` | a shadcn registry: one item per surface, pointing at the bundles rather than copying them |
118
+ | `agent-rules.json` | the constraints for a machine generating UI, each naming the gate that enforces it |
119
+ | `map-chrome.maplibre.css` / `map-chrome.mapbox.css` | the map control chrome, re-keyed per engine |
120
+ | `map-chrome-contract.json` | the tokens those controls are re-keyed onto |
121
+ | `build-manifest.json` | the sources and outputs of the build that wrote the directory |
122
+
123
+ `node tools/check-export.mjs`, `check-components.mjs`, `check-docs.mjs` and
124
+ `check-registry.mjs` each re-derive their artifact from `src/` and `index.html`, so a
125
+ stale `dist/` fails the build instead of shipping. That is also why `dist/` is never
126
+ committed: it is a derivation, and a committed copy is a second source of truth that the
127
+ gates above exist to catch.
128
+
129
+ ## Bundler import order
130
+
131
+ If inlining layers with a bundler, import them in this order (`ds.css` declares the same order):
132
+
133
+ ```css
134
+ @import "src/css/fonts.css";
135
+ @import "src/css/tokens.css" layer(tokens);
136
+ @import "src/css/base.css" layer(base);
137
+ @import "src/css/components.css" layer(components);
138
+ @import "src/css/components-shell.css" layer(components);
139
+ @import "src/css/components-data.css" layer(components);
140
+ @import "src/css/components-docs.css" layer(components);
141
+ @import "src/css/components-landing.css" layer(components);
142
+ @import "src/css/patterns.css" layer(components);
143
+ @import "src/css/utilities.css" layer(utilities);
144
+ @import "src/css/light-dark-fallback.css";
145
+ ```
146
+
147
+ The package does not expose this chain sheet by sheet — take one entry point from
148
+ `contour-ds/contour.min.css`, or one surface from `contour-ds/surfaces/…`, as shown in
149
+ Install. Re-ordering the layers is the build's job, owned by `src/css/ds.css` and checked
150
+ by `node tools/check-claims.mjs`.
151
+
152
+ ## Quick start
153
+
154
+ ```html
155
+ <button class="c-btn c-btn--primary">Compute route</button>
156
+
157
+ <div class="c-kpi">
158
+ <div class="c-kpi__value">42</div>
159
+ <div class="c-kpi__label">Routes matched</div>
160
+ </div>
161
+
162
+ <contour-card title="Hello">
163
+ <p>Slotted content survives re-renders.</p>
164
+ </contour-card>
165
+ ```
166
+
167
+ ## Framework quickstarts
168
+
169
+ Contour is plain CSS plus an optional script, so it drops into any bundler or
170
+ framework without an adapter. Import the stylesheet once at your app entry and
171
+ use the classes (or the `<contour-*>` web components) anywhere.
172
+
173
+ ### React / Next.js
174
+
175
+ ```jsx
176
+ // app/layout.jsx (Next.js) or main.jsx (Vite + React)
177
+ import "contour-ds/contour.min.css";
178
+ import "contour-ds/contour-wc.esm.js"; // optional web components
179
+
180
+ export default function Root({ children }) {
181
+ return <html data-theme="dark"><body>{children}</body></html>;
182
+ }
183
+ ```
184
+
185
+ ```jsx
186
+ // Component.jsx
187
+ export function RouteButton() {
188
+ return <button className="c-btn c-btn--primary">Compute route</button>;
189
+ }
190
+ ```
191
+
192
+ ### Vue / Nuxt
193
+
194
+ ```js
195
+ // main.js
196
+ import "contour-ds/contour.min.css";
197
+ import "contour-ds/contour-wc.esm.js";
198
+ ```
199
+
200
+ ```vue
201
+ <!-- Component.vue -->
202
+ <template>
203
+ <button class="c-btn c-btn--primary">Compute route</button>
204
+ <contour-card title="Hello"><p>Slotted content</p></contour-card>
205
+ </template>
206
+ ```
207
+
208
+ ### Svelte / SvelteKit
209
+
210
+ ```js
211
+ // +layout.svelte
212
+ import "contour-ds/contour.min.css";
213
+ import "contour-ds/contour-wc.esm.js";
214
+ ```
215
+
216
+ ```svelte
217
+ <button class="c-btn c-btn--primary">Compute route</button>
218
+ ```
219
+
220
+ ### Astro
221
+
222
+ ```astro
223
+ ---
224
+ // src/layouts/Base.astro
225
+ import "contour-ds/contour.min.css";
226
+ ---
227
+ <html data-theme="dark">
228
+ <head><title>Contour</title></head>
229
+ <body><slot /></body>
230
+ </html>
231
+ ```
232
+
233
+ ### Plain HTML (no build)
234
+
235
+ ```html
236
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/contour-ds@1.0.0/dist/contour.min.css">
237
+ ```
238
+
239
+ Web components are optional: every interactive block (tabs, combobox, tree,
240
+ menu, segmented, dialog) works as plain markup with `ds.css` alone, and the
241
+ `<contour-*>` elements only add scaffolding and keyboard behaviour.
242
+
243
+ ## Observing component events
244
+
245
+ Every interactive `<contour-*>` element emits bubbling, composed `contour:*`
246
+ CustomEvents, so a host (including one inside a shadow tree) can listen with
247
+ plain `addEventListener`. Events carry a `detail` payload; see the §23 event
248
+ table in the style guide for the full list.
249
+
250
+ ```js
251
+ // Plain JavaScript
252
+ const table = document.querySelector("contour-table");
253
+ table.addEventListener("contour:page", (e) => {
254
+ console.log("page", e.detail.page);
255
+ });
256
+ table.addEventListener("contour:sort", (e) => {
257
+ console.log(e.detail.column, e.detail.direction);
258
+ });
259
+ ```
260
+
261
+ ```jsx
262
+ // React — attach via a ref (events are not props)
263
+ import { useEffect, useRef } from "react";
264
+ export function Table() {
265
+ const ref = useRef(null);
266
+ useEffect(() => {
267
+ const el = ref.current;
268
+ const handler = (e) => console.log("page", e.detail.page);
269
+ el?.addEventListener("contour:page", handler);
270
+ return () => el?.removeEventListener("contour:page", handler);
271
+ }, []);
272
+ return <contour-table ref={ref} page-size="10" />;
273
+ }
274
+ ```
275
+
276
+ Because the events are `composed: true`, they cross shadow boundaries: a
277
+ `contour-table` nested inside another component's shadow tree still reaches a
278
+ listener on `document`.
279
+
280
+ ## Map engine integration
281
+
282
+ Contour ships the **interface** (controls, panels, readouts, legends) and
283
+ deliberately stays out of the map engine's turf: it never imports MapLibre,
284
+ Mapbox or Leaflet, never renders GeoJSON, and never projects coordinates.
285
+ The engine owns the canvas; Contour owns the chrome around it.
286
+
287
+ ### Wiring recipe
288
+
289
+ 1. Import the engine's stylesheet and Contour's map-chrome sheet for that
290
+ engine:
291
+
292
+ ```js
293
+ import "maplibre-gl/dist/maplibre-gl.css";
294
+ import "contour-ds/map-chrome/maplibre"; // re-keys vendor controls onto Contour tokens
295
+ import "contour-ds/contour.min.css";
296
+ ```
297
+
298
+ 2. Create the map in your own code and mount Contour's chrome as siblings of
299
+ the map container (not inside it):
300
+
301
+ ```html
302
+ <div class="c-map-slot">
303
+ <div id="map" class="c-map-area"></div>
304
+ <contour-layer-panel items='[{"name":"Roads","visible":true}]'></contour-layer-panel>
305
+ <contour-scale-bar value="1000"></contour-scale-bar>
306
+ <contour-compass bearing="0"></contour-compass>
307
+ </div>
308
+ ```
309
+
310
+ 3. Listen for Contour's `contour:*` events (`contour:layer-visibility`,
311
+ `contour:layer-opacity`, `contour:bearing`, …) and forward them to the
312
+ engine's API (`map.setLayoutProperty`, `map.setBearing`, …). Contour never
313
+ calls the engine; the seam is the event.
314
+
315
+ The full token-to-vendor mapping lives in `dist/map-chrome-contract.json`.
316
+
317
+ ## Surfaces
318
+
319
+ | Surface | Guide |
320
+ |---|---|
321
+ | Landing | [§15](index.html#landing) |
322
+ | Documentation | [§14](index.html#docs) |
323
+ | Dashboard | [§13](index.html#data) |
324
+ | Recipes | [§18](index.html#recipes) |
325
+
326
+ ## Key features
327
+
328
+ - **Zero runtime dependencies** — pure CSS + optional JS enhancement
329
+ - **Dark/light themes** via `light-dark()` and `color-scheme`
330
+ - **203 components** across 14 stylesheets (landing, docs, dashboard, data)
331
+ - **294 design tokens** — colours, typography, space, shape, motion, density
332
+ - **Web components** — 365 custom elements (`<contour-*>`, `<contour-shadow-*>`) with attribute reactivity
333
+ - **DTCG 2025.10** token export (Format + Resolver documents)
334
+ - **shadcn registry** — one item per surface bundle
335
+ - **WCAG 2.2 AA** — contrast, focus, reflow, reduced motion, forced colours
336
+ - **Self-hosted fonts** — IBM Plex (Sans, Mono, Condensed), subsetted, OFL 1.1
337
+
338
+ ## Theming
339
+
340
+ ```css
341
+ :root {
342
+ --brand-hue: 182.5; /* re-tints every primary surface */
343
+ --radius-scale: 1; /* scales every radius at once */
344
+ }
345
+ ```
346
+
347
+ ```html
348
+ <meta name="color-scheme" content="light dark" />
349
+ ```
350
+
351
+ ## Tokens
352
+
353
+ Four layers: primitives → semantic → component → utilities. Primitives never change between themes.
354
+
355
+ ```css
356
+ @import "src/css/fonts.css";
357
+ @import "src/css/tokens.css" layer(tokens);
358
+ @import "src/css/base.css" layer(base);
359
+ @import "src/css/components.css" layer(components);
360
+ /* + components-shell, components-data, components-docs, components-landing, patterns, utilities */
361
+ ```
362
+
363
+ ## Components
364
+
365
+ Naming: `.c-<block>`, `.c-<block>__<element>`, `.c-<block>--<variant>`.
366
+
367
+ Groups: actions, forms, status, surfaces, navigation, feedback, overlays, data, documentation, landing, layout.
368
+
369
+ Full reference: [style guide](index.html).
370
+
371
+ ## Web components
372
+
373
+ ```html
374
+ <script type="module" src="src/js/wc/index.mjs"></script>
375
+ <contour-card title="Hello"><p>Slotted content</p></contour-card>
376
+ ```
377
+
378
+ Light DOM (`<contour-*>`) and Shadow DOM (`<contour-shadow-*>`) wrappers. Attribute-reactive, form-associated, keyboard-navigable. See [§23](index.html#webcomponents).
379
+
380
+ ## Starter templates
381
+
382
+ Three complete pages ship in `templates/`, one per surface. They run straight
383
+ off a checkout (no build) and are the fastest way to start:
384
+
385
+ | Template | Surface | What it shows |
386
+ |---|---|---|
387
+ | `templates/landing.html` | Marketing | Hero split, install block, metrics band, features, pricing, testimonial, FAQ, CTA band |
388
+ | `templates/documentation.html` | Docs | Nav tree, breadcrumb, prose, code tabs, install, code block, callout, options table, pager, on-this-page |
389
+ | `templates/dashboard.html` | Dashboard | Toolbar, filter pills, KPI row, chart panels with a dash-pattern series, dense sortable table |
390
+ | `templates/vite/` | Vite + React | Minimal Vite app importing `contour-ds` from a local checkout |
391
+ | `templates/astro/` | Astro | Minimal Astro site with the stylesheet wired into the base layout |
392
+
393
+ Run any of them:
394
+
395
+ ```bash
396
+ python3 -m http.server 8899 --directory /data/projects/DS
397
+ # open http://localhost:8899/templates/landing.html
398
+ ```
399
+
400
+ Copy the file, delete what you do not need, and point the stylesheet at your
401
+ own build:
402
+
403
+ ```html
404
+ <link rel="stylesheet" href="/css/contour.css" />
405
+ ```
406
+
407
+ ## Figma & design tokens
408
+
409
+ The token layer exports as two DTCG 2025.10 documents, so it round-trips into
410
+ design tools:
411
+
412
+ - `contour-ds/tokens.json` — the **Format** document (primitives, semantic,
413
+ component and utility tokens, with `light-dark()` resolved per theme).
414
+ - `contour-ds/themes.json` — the **Resolver** document (the dark half of every
415
+ `light-dark()` pair).
416
+
417
+ ### Tokens Studio (Figma)
418
+
419
+ 1. Install the [Tokens Studio](https://tokens.studio/) plugin in Figma.
420
+ 2. Create a new token set and choose **Import → DTCG**.
421
+ 3. Point it at `node_modules/contour-ds/dist/contour.tokens.json` (or the
422
+ published URL).
423
+ 4. Map the `tidal` / `plasma` / `basalt` families to your Figma variables;
424
+ the semantic layer (`color-primary`, `color-text-muted`, …) is what
425
+ components should reference, not the primitives.
426
+
427
+ Because the tokens are the source of truth, re-running `node tools/build.mjs`
428
+ regenerates both documents and the Figma variables stay in sync.
429
+
430
+ ## shadcn registry
431
+
432
+ Contour ships a [shadcn](https://ui.shadcn.com/)-compatible registry: one item
433
+ per surface bundle, pointing at the shipped CSS rather than inlining it.
434
+
435
+ ```bash
436
+ # once the registry is hosted
437
+ npx shadcn@latest add https://<host>/r/contour-core.json
438
+ ```
439
+
440
+ The registry lives at `dist/registry/registry.json` after a build and is
441
+ validated against the vendored shadcn schemas by
442
+ `node tools/audit/registry-contract.mjs`. It declares no `homepage` or `url`
443
+ while the project is private; those are added at v1.0.
444
+
445
+ ## Integrations
446
+
447
+ Optional bridges into other toolchains. None are required to use the system.
448
+
449
+ - **Tailwind v4** — `integrations/tailwind/contour-theme.css` exposes Contour
450
+ tokens as Tailwind utilities (`bg-primary`, `text-muted`, `rounded-md`,
451
+ `font-sans`, …). See `integrations/README.md`.
452
+ - **AI assistants** — `integrations/ai/CLAUDE.md`, `integrations/ai/v0-prompt.md`
453
+ and `integrations/ai/v0-prompt.md` teach Cursor / Claude Code / v0 / Bolt /
454
+ Lovable to use Contour correctly. The machine-readable contract they point at
455
+ is `dist/agent-rules.json`.
456
+ - **MapLibre / Mapbox** — `contour-ds/map-chrome/maplibre` (or `/mapbox`)
457
+ re-keys the map controls onto Contour tokens. `templates/map.html` is a CSS
458
+ demo of the map chrome; it does not exercise the `contour-map-*` components.
459
+ - **Native (iOS / Android / Flutter)** — `integrations/native/` feeds Style
460
+ Dictionary from `contour.tokens.json` so native companions stay in sync.
461
+
462
+ ## Performance
463
+
464
+ 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.
465
+
466
+ ## Browser support
467
+
468
+ Sizes are in `rem`; the layout reflows to 200% zoom and to a 390 px viewport
469
+ with no horizontal page scroll.
470
+
471
+ Baseline newly-available features with progressive enhancement. `light-dark()`
472
+ is the most load-bearing (newly available 2024-05-13, widely available
473
+ 2026-11-13). Fallback sheet: `src/css/light-dark-fallback.css`, regenerated
474
+ by `node tools/gen-light-dark.mjs --check`.
475
+
476
+ ### What is supported
477
+
478
+ | Feature | Status | Notes |
479
+ |---|---|---|
480
+ | `light-dark()` (colour) | Newly available (2024-05) | Fallback sheet ships for older browsers |
481
+ | `light-dark()` (images) | Not used | Do not use; widely available only 2029 |
482
+ | `oklch()` | Widely available | All colour tokens |
483
+ | `:has()` | Widely available | Used for stateful components |
484
+ | Container queries | Widely available | Dense tables drop optional columns |
485
+ | Anchor positioning | Newly available (2026-01) | Behind `@supports` for tooltips/menus |
486
+ | Web components | Widely available | Progressive enhancement only |
487
+
488
+ ### Single-file drop
489
+
490
+ For environments that must ship exactly one file (email, embedded widget,
491
+ offline bundle), build with `node tools/build.mjs --single` to get
492
+ `dist/contour.single.min.css` with the self-hosted fonts inlined as data URIs
493
+ (~260 kB larger; defeats font caching, so prefer the two-file drop otherwise).
494
+
495
+ ### Reduced motion & forced colours
496
+
497
+ `prefers-reduced-motion: reduce` collapses every transition, and Forced
498
+ Colors Mode removes the texture and ridgelines and falls back to a system
499
+ `CanvasText` outline. Both are on by default; no opt-in required.
500
+
501
+ Full details: [Browser support](index.html#browser-support).
502
+
503
+ ## Commands
504
+
505
+ | Command | What it does |
506
+ |---|---|
507
+ | `node tools/build.mjs` | Bundle into `dist/`, export tokens |
508
+ | `node tools/build.mjs --single` | Single-file build with inlined fonts |
509
+ | `node tools/snippets.mjs` | Regenerate code snippets in `index.html` |
510
+ | `npx html-validate index.html templates/*.html` | Validate markup |
511
+ | `node tools/doctor.mjs` | Run all quality gates |
512
+
513
+ ## Repository
514
+
515
+ ```
516
+ src/ the design system (a consumer takes this and nothing else)
517
+ assets/ guide-only (never shipped)
518
+ tools/ build-time scripts (never shipped)
519
+ templates/ three starter pages (landing, docs, dashboard)
520
+ dist/ build output (gitignored)
521
+ ```
522
+
523
+ ## Licence
524
+
525
+ MIT for the design system. Fonts (IBM Plex Sans, Mono, Condensed) are licensed
526
+ under the SIL Open Font License 1.1 — see `src/css/fonts/OFL.txt`.
527
+
528
+ ### Font attribution
529
+
530
+ IBM Plex is copyright © 2017 IBM Corp., released under the SIL Open Font
531
+ License, Version 1.1, with the Reserved Font Name "Plex". The binaries shipped
532
+ in `src/css/fonts/` (and `dist/fonts/` after a build) are unmodified upstream
533
+ releases; the OFL text ships beside them as `OFL.txt`. The CSS `font-family`
534
+ names (`Contour Plex Sans`, `Contour Plex Mono`, `Contour Plex Sans Condensed`)
535
+ are aliases only and do not rename the font software.
536
+
537
+ ---
538
+
539
+ Full reference: [style guide](index.html) · [CHANGELOG](CHANGELOG.md) · [DESIGN.md](DESIGN.md)