contour-ds 1.7.2 → 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.
- package/README.md +244 -326
- package/dist/agent-cookbook.json +960 -0
- package/dist/agent-examples.json +65 -0
- package/dist/agent-map-wiring.json +152 -0
- package/dist/agent-rules.json +16 -0
- package/dist/build-manifest.json +344 -126
- package/dist/contour-wc-content.esm.js +1939 -0
- package/dist/contour-wc-content.esm.min.js +1 -0
- package/dist/contour-wc-core.esm.js +3724 -0
- package/dist/contour-wc-core.esm.min.js +1 -0
- package/dist/contour-wc-dashboard.esm.js +6986 -0
- package/dist/contour-wc-dashboard.esm.min.js +1 -0
- package/dist/contour-wc-data.esm.js +6572 -0
- package/dist/contour-wc-data.esm.min.js +1 -0
- package/dist/contour-wc-docs.esm.js +976 -0
- package/dist/contour-wc-docs.esm.min.js +1 -0
- package/dist/contour-wc-feedback.esm.js +1742 -0
- package/dist/contour-wc-feedback.esm.min.js +1 -0
- package/dist/contour-wc-forms.esm.js +2437 -0
- package/dist/contour-wc-forms.esm.min.js +1 -0
- package/dist/contour-wc-interaction.esm.js +1343 -0
- package/dist/contour-wc-interaction.esm.min.js +1 -0
- package/dist/contour-wc-layout.esm.js +845 -0
- package/dist/contour-wc-layout.esm.min.js +1 -0
- package/dist/contour-wc-map.esm.js +2411 -0
- package/dist/contour-wc-map.esm.min.js +1 -0
- package/dist/contour-wc-misc.esm.js +945 -0
- package/dist/contour-wc-misc.esm.min.js +1 -0
- package/dist/contour-wc-navigation.esm.js +2842 -0
- package/dist/contour-wc-navigation.esm.min.js +1 -0
- package/dist/contour-wc-ui.esm.js +6519 -0
- package/dist/contour-wc-ui.esm.min.js +1 -0
- package/dist/contour-wc.esm.js +14435 -5723
- package/dist/contour-wc.esm.min.js +1 -1
- package/dist/contour-wc.js +14436 -5725
- package/dist/contour-wc.min.js +1 -1
- package/dist/contour.a11y.json +402 -0
- package/dist/contour.code-snippets +4534 -0
- package/dist/contour.components.json +4870 -1222
- package/dist/contour.css +6672 -4711
- package/dist/contour.d.ts +753 -1085
- package/dist/contour.esm.js +440 -18
- package/dist/contour.esm.min.js +1 -1
- package/dist/contour.html-data.json +11343 -0
- package/dist/contour.js +440 -18
- package/dist/contour.min.css +1 -1
- package/dist/contour.min.js +1 -1
- package/dist/contour.react.d.ts +422 -0
- package/dist/contour.single.html +17 -0
- package/dist/contour.single.min.css +1 -0
- package/dist/contour.themes.json +56 -12
- package/dist/contour.tokens.json +1318 -1053
- package/dist/contour.vue.d.ts +420 -0
- package/dist/contour.web-types.json +11703 -0
- package/dist/custom-elements.json +36120 -0
- package/dist/docs/actions.md +16 -6
- package/dist/docs/affordances.md +21 -85
- package/dist/docs/apireference.md +9 -5
- package/dist/docs/colour.md +10 -4
- package/dist/docs/componentindex.md +9 -22
- package/dist/docs/data.md +39 -58
- package/dist/docs/docs.md +12 -7
- package/dist/docs/feedback.md +30 -12
- package/dist/docs/field.md +28 -13
- package/dist/docs/forms.md +35 -19
- package/dist/docs/index.json +70 -61
- package/dist/docs/install.md +12 -7
- package/dist/docs/landing.md +7 -4
- package/dist/docs/mapengine.md +30 -8
- package/dist/docs/motion.md +12 -6
- package/dist/docs/navigation.md +31 -7
- package/dist/docs/overlays.md +32 -25
- package/dist/docs/overview.md +3 -2
- package/dist/docs/patterns.md +20 -10
- package/dist/docs/playground.md +11 -4
- package/dist/docs/principles.md +8 -6
- package/dist/docs/recipes.md +117 -13
- package/dist/docs/space.md +10 -6
- package/dist/docs/status.md +13 -14
- package/dist/docs/surfaces.md +17 -22
- package/dist/docs/theming.md +18 -32
- package/dist/docs/type.md +12 -5
- package/dist/docs/webcomponents.md +75 -33
- package/dist/hljs.css +1 -20
- package/dist/map-chrome.mapbox.css +68 -92
- package/dist/map-chrome.maplibre.css +68 -92
- package/dist/registry/items/contour-core.json +2 -2
- package/dist/registry/items/contour-data.json +2 -2
- package/dist/registry/items/contour-docs.json +2 -2
- package/dist/registry/items/contour-landing.json +2 -2
- package/dist/registry/registry.json +8 -8
- package/dist/surfaces/contour-core.min.css +1 -1
- package/dist/surfaces/contour-data.min.css +1 -1
- package/dist/surfaces/contour-docs.min.css +1 -1
- package/dist/surfaces/contour-landing.min.css +1 -1
- package/dist/svg/icons.svg +367 -0
- package/dist/wc/behaviours.mjs +222 -192
- package/dist/wc/content.mjs +486 -142
- package/dist/wc/core.mjs +917 -395
- package/dist/wc/dashboard.mjs +252 -25
- package/dist/wc/data-chart.mjs +1333 -0
- package/dist/wc/data-export.mjs +391 -0
- package/dist/wc/data-gauge.mjs +779 -0
- package/dist/wc/data-geo.mjs +696 -0
- package/dist/wc/data-glyphs.mjs +133 -0
- package/dist/wc/data-legend.mjs +431 -0
- package/dist/wc/data-readout.mjs +227 -0
- package/dist/wc/data-series.mjs +1004 -0
- package/dist/wc/data-table.mjs +751 -0
- package/dist/wc/data.mjs +15 -3707
- package/dist/wc/docs.mjs +113 -19
- package/dist/wc/feedback.mjs +320 -116
- package/dist/wc/forms-controls.mjs +635 -0
- package/dist/wc/forms-field.mjs +547 -0
- package/dist/wc/forms-groups.mjs +347 -0
- package/dist/wc/forms-input.mjs +292 -0
- package/dist/wc/forms.mjs +10 -1122
- package/dist/wc/glyph.mjs +204 -0
- package/dist/wc/index.mjs +16 -7
- package/dist/wc/interaction.mjs +322 -75
- package/dist/wc/layout.mjs +100 -29
- package/dist/wc/map.mjs +888 -285
- package/dist/wc/misc.mjs +137 -26
- package/dist/wc/navigation-menu.mjs +735 -0
- package/dist/wc/navigation-shell.mjs +495 -0
- package/dist/wc/navigation-tree.mjs +995 -0
- package/dist/wc/navigation.mjs +9 -1636
- package/dist/wc/registration.mjs +1 -8
- package/dist/wc/shadow.mjs +285 -113
- package/dist/wc/states.mjs +75 -78
- package/dist/wc/svg.mjs +209 -34
- package/dist/wc/ui-atoms.mjs +608 -0
- package/dist/wc/ui-data.mjs +1404 -0
- package/dist/wc/ui-feedback.mjs +419 -0
- package/dist/wc/ui-inputs.mjs +1570 -0
- package/dist/wc/ui-menus.mjs +307 -0
- package/dist/wc/ui-overlays.mjs +1605 -0
- package/integrations/README.md +25 -5
- package/integrations/ai/CLAUDE.md +6 -3
- package/integrations/ai/COPILOT.md +14 -0
- package/integrations/ai/GEMINI.md +14 -0
- package/integrations/ai/WINDSURF.md +14 -0
- package/integrations/ai/v0-prompt.md +13 -1
- package/integrations/frameworks/README.md +235 -0
- package/integrations/native/README.md +0 -3
- package/integrations/native/style-dictionary.config.json +1 -1
- package/integrations/tailwind/contour-theme.css +71 -13
- package/integrations/validate-markup.mjs +172 -0
- package/package.json +103 -39
- package/dist/wc/ui.mjs +0 -3560
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 -->
|
|
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
|
|
20
|
-
bundle beside the source is derived from it
|
|
21
|
-
|
|
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
|
|
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,32 +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
|
-
|
|
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
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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.
|
|
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.
|
|
58
58
|
|
|
59
|
-
### From a checkout — no build
|
|
59
|
+
### From a checkout — no build, no dependency
|
|
60
60
|
|
|
61
|
-
`src/css/ds.css` chains the sheets with relative `@import` statements, so a page can link
|
|
62
|
-
|
|
61
|
+
`src/css/ds.css` chains the sheets with relative `@import` statements, so a page can link the
|
|
62
|
+
source straight off disk:
|
|
63
63
|
|
|
64
64
|
```html
|
|
65
65
|
<link rel="stylesheet" href="src/css/ds.css" />
|
|
@@ -68,8 +68,7 @@ the source off a disk or copy the folder:
|
|
|
68
68
|
|
|
69
69
|
### The bundle
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
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:
|
|
73
72
|
|
|
74
73
|
```bash
|
|
75
74
|
node tools/build.mjs
|
|
@@ -80,24 +79,18 @@ node tools/build.mjs
|
|
|
80
79
|
<script src="dist/contour.min.js" defer></script> <!-- optional -->
|
|
81
80
|
```
|
|
82
81
|
|
|
83
|
-
`dist/contour.css` is the same bundle unminified
|
|
84
|
-
`
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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.
|
|
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.
|
|
95
88
|
|
|
96
89
|
### What ships
|
|
97
90
|
|
|
98
91
|
`node tools/build.mjs` writes `dist/`, and every file below is in the tarball. They are
|
|
99
|
-
listed
|
|
100
|
-
|
|
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.
|
|
101
94
|
|
|
102
95
|
| File | What it is |
|
|
103
96
|
|---|---|
|
|
@@ -112,31 +105,57 @@ no document — a bundle nobody names is a bundle nobody finds.
|
|
|
112
105
|
| `svg/contour-mark.svg` | the brand mark |
|
|
113
106
|
| `contour.tokens.json` | the token layer as a **DTCG 2025.10 Format** document |
|
|
114
107
|
| `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
|
|
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 |
|
|
116
115
|
| `docs/index.json` | the guide's prose as a machine-readable package, one file per section, re-derived from `index.html` |
|
|
117
116
|
| `registry/registry.json` | a shadcn registry: one item per surface, pointing at the bundles rather than copying them |
|
|
118
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 |
|
|
119
122
|
| `map-chrome.maplibre.css` / `map-chrome.mapbox.css` | the map control chrome, re-keyed per engine |
|
|
120
123
|
| `map-chrome-contract.json` | the tokens those controls are re-keyed onto |
|
|
121
124
|
| `build-manifest.json` | the sources and outputs of the build that wrote the directory |
|
|
122
125
|
|
|
123
|
-
`
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
committed: it is a derivation, and a committed copy is a second source of truth that the
|
|
127
|
-
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.
|
|
128
129
|
|
|
129
130
|
## Bundler import order
|
|
130
131
|
|
|
131
|
-
If inlining layers with a bundler, import them in this order (`ds.css` declares the same
|
|
132
|
+
If inlining layers with a bundler, import them in this order (`ds.css` declares the same
|
|
133
|
+
order):
|
|
132
134
|
|
|
133
135
|
```css
|
|
134
136
|
@import "src/css/fonts.css";
|
|
135
137
|
@import "src/css/tokens.css" layer(tokens);
|
|
136
138
|
@import "src/css/base.css" layer(base);
|
|
137
|
-
@import "src/css/components.css" layer(components);
|
|
139
|
+
@import "src/css/components-brand.css" layer(components);
|
|
140
|
+
@import "src/css/components-buttons.css" layer(components);
|
|
141
|
+
@import "src/css/components-cards.css" layer(components);
|
|
142
|
+
@import "src/css/components-navigation.css" layer(components);
|
|
143
|
+
@import "src/css/components-forms.css" layer(components);
|
|
144
|
+
@import "src/css/components-display.css" layer(components);
|
|
145
|
+
@import "src/css/components-overlay.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);
|
|
138
153
|
@import "src/css/components-shell.css" layer(components);
|
|
139
|
-
@import "src/css/components-data.css" layer(components);
|
|
154
|
+
@import "src/css/components-data-dashboard.css" layer(components);
|
|
155
|
+
@import "src/css/components-data-charts.css" layer(components);
|
|
156
|
+
@import "src/css/components-data-tables.css" layer(components);
|
|
157
|
+
@import "src/css/components-data-maps.css" layer(components);
|
|
158
|
+
@import "src/css/components-data-widgets.css" layer(components);
|
|
140
159
|
@import "src/css/components-docs.css" layer(components);
|
|
141
160
|
@import "src/css/components-landing.css" layer(components);
|
|
142
161
|
@import "src/css/patterns.css" layer(components);
|
|
@@ -145,9 +164,8 @@ If inlining layers with a bundler, import them in this order (`ds.css` declares
|
|
|
145
164
|
```
|
|
146
165
|
|
|
147
166
|
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
|
|
149
|
-
|
|
150
|
-
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`.
|
|
151
169
|
|
|
152
170
|
## Quick start
|
|
153
171
|
|
|
@@ -164,139 +182,55 @@ by `node tools/check-claims.mjs`.
|
|
|
164
182
|
</contour-card>
|
|
165
183
|
```
|
|
166
184
|
|
|
167
|
-
##
|
|
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
|
-
```
|
|
185
|
+
## Frameworks
|
|
191
186
|
|
|
192
|
-
|
|
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:
|
|
193
190
|
|
|
194
191
|
```js
|
|
195
|
-
// main.js
|
|
196
192
|
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>
|
|
193
|
+
import "contour-ds/contour-wc.esm.js"; // optional web components
|
|
231
194
|
```
|
|
232
195
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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.
|
|
238
203
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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)).
|
|
242
208
|
|
|
243
|
-
##
|
|
209
|
+
## Events
|
|
244
210
|
|
|
245
|
-
Every interactive `<contour-*>` element emits bubbling, composed `contour:*`
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
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.
|
|
249
214
|
|
|
250
215
|
```js
|
|
251
|
-
// Plain JavaScript
|
|
252
216
|
const table = document.querySelector("contour-table");
|
|
253
|
-
table.addEventListener("contour:page", (e) =>
|
|
254
|
-
|
|
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
|
-
}
|
|
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));
|
|
274
219
|
```
|
|
275
220
|
|
|
276
|
-
Because the events are `composed: true`, they cross shadow boundaries: a
|
|
277
|
-
|
|
278
|
-
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`.
|
|
279
223
|
|
|
280
224
|
## Map engine integration
|
|
281
225
|
|
|
282
|
-
Contour ships the **interface** (controls, panels, readouts, legends) and
|
|
283
|
-
|
|
284
|
-
|
|
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:
|
|
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.
|
|
291
229
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
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):
|
|
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:
|
|
300
234
|
|
|
301
235
|
```html
|
|
302
236
|
<div class="c-map-slot">
|
|
@@ -307,34 +241,11 @@ The engine owns the canvas; Contour owns the chrome around it.
|
|
|
307
241
|
</div>
|
|
308
242
|
```
|
|
309
243
|
|
|
310
|
-
3. Listen for
|
|
311
|
-
|
|
312
|
-
engine's API (`map.setLayoutProperty`, `map.setBearing`, …). Contour never
|
|
313
|
-
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.
|
|
314
246
|
|
|
315
247
|
The full token-to-vendor mapping lives in `dist/map-chrome-contract.json`.
|
|
316
248
|
|
|
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
249
|
## Theming
|
|
339
250
|
|
|
340
251
|
```css
|
|
@@ -348,18 +259,27 @@ The full token-to-vendor mapping lives in `dist/map-chrome-contract.json`.
|
|
|
348
259
|
<meta name="color-scheme" content="light dark" />
|
|
349
260
|
```
|
|
350
261
|
|
|
351
|
-
|
|
262
|
+
### Density
|
|
352
263
|
|
|
353
|
-
|
|
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:
|
|
354
266
|
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
|
|
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 */
|
|
267
|
+
```html
|
|
268
|
+
<div data-density="compact">…dense table / dashboard…</div>
|
|
269
|
+
<div data-density="roomy">…comfortable marketing surface…</div>
|
|
361
270
|
```
|
|
362
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
|
+
|
|
363
283
|
## Consumer layering
|
|
364
284
|
|
|
365
285
|
Contour declares four cascade layers in this order:
|
|
@@ -368,8 +288,8 @@ Contour declares four cascade layers in this order:
|
|
|
368
288
|
@layer tokens, base, components, utilities;
|
|
369
289
|
```
|
|
370
290
|
|
|
371
|
-
A consumer who wants to override a component should add their own layer **after**
|
|
372
|
-
|
|
291
|
+
A consumer who wants to override a component should add their own layer **after** `utilities`
|
|
292
|
+
so their rules win without specificity wars:
|
|
373
293
|
|
|
374
294
|
```css
|
|
375
295
|
@layer contour-overrides {
|
|
@@ -377,18 +297,24 @@ A consumer who wants to override a component should add their own layer **after*
|
|
|
377
297
|
}
|
|
378
298
|
```
|
|
379
299
|
|
|
380
|
-
Import Contour first, then declare your override layer; later layers always beat
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
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.
|
|
384
303
|
|
|
385
304
|
## Components
|
|
386
305
|
|
|
387
|
-
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).
|
|
388
309
|
|
|
389
|
-
|
|
310
|
+
### Icons
|
|
390
311
|
|
|
391
|
-
|
|
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.
|
|
392
318
|
|
|
393
319
|
## Web components
|
|
394
320
|
|
|
@@ -397,15 +323,69 @@ Full reference: [style guide](index.html).
|
|
|
397
323
|
<contour-card title="Hello"><p>Slotted content</p></contour-card>
|
|
398
324
|
```
|
|
399
325
|
|
|
400
|
-
Light DOM (`<contour-*>`) and Shadow DOM (`<contour-shadow-*>`) wrappers
|
|
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:
|
|
357
|
+
|
|
358
|
+
```js
|
|
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];
|
|
365
|
+
```
|
|
401
366
|
|
|
402
|
-
|
|
403
|
-
|
|
367
|
+
Nothing else is needed, and the reasons are worth knowing:
|
|
368
|
+
|
|
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.
|
|
381
|
+
|
|
382
|
+
Interactive stories and workflow demonstrations live in the optional
|
|
383
|
+
[Storybook workshop](https://abelvm.github.io/contour-ds/storybook/) (`npm run storybook`).
|
|
404
384
|
|
|
405
385
|
## Starter templates
|
|
406
386
|
|
|
407
|
-
Three complete pages ship in `templates/`, one per surface. They run straight
|
|
408
|
-
|
|
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:
|
|
409
389
|
|
|
410
390
|
| Template | Surface | What it shows |
|
|
411
391
|
|---|---|---|
|
|
@@ -415,128 +395,73 @@ off a checkout (no build) and are the fastest way to start:
|
|
|
415
395
|
| `templates/vite/` | Vite + React | Minimal Vite app importing `contour-ds` from a local checkout |
|
|
416
396
|
| `templates/astro/` | Astro | Minimal Astro site with the stylesheet wired into the base layout |
|
|
417
397
|
|
|
418
|
-
Run any of them:
|
|
419
|
-
|
|
420
398
|
```bash
|
|
421
399
|
python3 -m http.server 8899 --directory /data/projects/DS
|
|
422
400
|
# open http://localhost:8899/templates/landing.html
|
|
423
401
|
```
|
|
424
402
|
|
|
425
|
-
Copy the file, delete what you do not need, and point the stylesheet at your
|
|
426
|
-
own build:
|
|
427
|
-
|
|
428
|
-
```html
|
|
429
|
-
<link rel="stylesheet" href="/css/contour.css" />
|
|
430
|
-
```
|
|
403
|
+
Copy the file, delete what you do not need, and point the stylesheet at your own build.
|
|
431
404
|
|
|
432
405
|
## Figma & design tokens
|
|
433
406
|
|
|
434
|
-
The token layer exports as two DTCG 2025.10 documents, so it round-trips into
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
- `
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
### Tokens Studio (Figma)
|
|
443
|
-
|
|
444
|
-
1. Install the [Tokens Studio](https://tokens.studio/) plugin in Figma.
|
|
445
|
-
2. Create a new token set and choose **Import → DTCG**.
|
|
446
|
-
3. Point it at `node_modules/contour-ds/dist/contour.tokens.json` (or the
|
|
447
|
-
published URL).
|
|
448
|
-
4. Map the `tidal` / `plasma` / `basalt` families to your Figma variables;
|
|
449
|
-
the semantic layer (`color-primary`, `color-text-muted`, …) is what
|
|
450
|
-
components should reference, not the primitives.
|
|
451
|
-
|
|
452
|
-
Because the tokens are the source of truth, re-running `node tools/build.mjs`
|
|
453
|
-
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.
|
|
454
414
|
|
|
455
415
|
## shadcn registry
|
|
456
416
|
|
|
457
|
-
Contour ships a [shadcn](https://ui.shadcn.com/)-compatible registry: one item
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
npx shadcn@latest add https://<host>/r/contour-core.json
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
The registry lives at `dist/registry/registry.json` after a build and is
|
|
466
|
-
validated against the vendored shadcn schemas by
|
|
467
|
-
`node tools/audit/registry-contract.mjs`. It declares no `homepage` or `url`
|
|
468
|
-
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.
|
|
469
422
|
|
|
470
423
|
## Integrations
|
|
471
424
|
|
|
472
|
-
Optional bridges into other toolchains
|
|
473
|
-
|
|
474
|
-
- **Tailwind v4** — `integrations/tailwind/contour-theme.css` exposes Contour
|
|
475
|
-
tokens as Tailwind utilities (`bg-primary`, `text-muted`, `rounded-md`,
|
|
476
|
-
`font-sans`, …). See `integrations/README.md`.
|
|
477
|
-
- **AI assistants** — `integrations/ai/CLAUDE.md`, `integrations/ai/v0-prompt.md`
|
|
478
|
-
and `integrations/ai/v0-prompt.md` teach Cursor / Claude Code / v0 / Bolt /
|
|
479
|
-
Lovable to use Contour correctly. The machine-readable contract they point at
|
|
480
|
-
is `dist/agent-rules.json`.
|
|
481
|
-
- **MapLibre / Mapbox** — `contour-ds/map-chrome/maplibre` (or `/mapbox`)
|
|
482
|
-
re-keys the map controls onto Contour tokens. `templates/map.html` is a CSS
|
|
483
|
-
demo of the map chrome; it does not exercise the `contour-map-*` components.
|
|
484
|
-
- **Native (iOS / Android / Flutter)** — `integrations/native/` feeds Style
|
|
485
|
-
Dictionary from `contour.tokens.json` so native companions stay in sync.
|
|
486
|
-
|
|
487
|
-
## Performance
|
|
425
|
+
Optional bridges into other toolchains; none are required to use the system. See
|
|
426
|
+
`integrations/README.md`.
|
|
488
427
|
|
|
489
|
-
|
|
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.
|
|
490
437
|
|
|
491
438
|
## Browser support
|
|
492
439
|
|
|
493
|
-
Sizes are in `rem`; the layout reflows to 200% zoom and to a 390 px viewport
|
|
494
|
-
with
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
is the most load-bearing (newly available 2024-05-13, widely available
|
|
498
|
-
2026-11-13). Fallback sheet: `src/css/light-dark-fallback.css`, regenerated
|
|
499
|
-
by `node tools/gen-light-dark.mjs --check`.
|
|
500
|
-
|
|
501
|
-
### What is supported
|
|
502
|
-
|
|
503
|
-
| Feature | Status | Notes |
|
|
504
|
-
|---|---|---|
|
|
505
|
-
| `light-dark()` (colour) | Newly available (2024-05) | Fallback sheet ships for older browsers |
|
|
506
|
-
| `light-dark()` (images) | Not used | Do not use; widely available only 2029 |
|
|
507
|
-
| `oklch()` | Widely available | All colour tokens |
|
|
508
|
-
| `:has()` | Widely available | Used for stateful components |
|
|
509
|
-
| Container queries | Widely available | Dense tables drop optional columns |
|
|
510
|
-
| Anchor positioning | Newly available (2026-01) | Behind `@supports` for tooltips/menus |
|
|
511
|
-
| Web components | Widely available | Progressive enhancement only |
|
|
512
|
-
|
|
513
|
-
### Single-file drop
|
|
514
|
-
|
|
515
|
-
For environments that must ship exactly one file (email, embedded widget,
|
|
516
|
-
offline bundle), build with `node tools/build.mjs --single` to get
|
|
517
|
-
`dist/contour.single.min.css` with the self-hosted fonts inlined as data URIs
|
|
518
|
-
(~260 kB larger; defeats font caching, so prefer the two-file drop otherwise).
|
|
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`.
|
|
519
444
|
|
|
520
|
-
|
|
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.
|
|
521
447
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
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.
|
|
527
451
|
|
|
528
452
|
## Commands
|
|
529
453
|
|
|
530
454
|
| Command | What it does |
|
|
531
455
|
|---|---|
|
|
532
|
-
| `
|
|
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 |
|
|
533
458
|
| `node tools/build.mjs --single` | Single-file build with inlined fonts |
|
|
534
|
-
| `
|
|
535
|
-
| `
|
|
536
|
-
| `
|
|
459
|
+
| `npm run snippets` | Regenerate code snippets in `index.html` |
|
|
460
|
+
| `npm run validate` | Validate markup |
|
|
461
|
+
| `npm run doctor` | Run all quality gates |
|
|
537
462
|
| `npm run storybook` | Start the Storybook workshop on port 6006 |
|
|
538
|
-
| `npm run build:storybook` | Build the static Storybook site into `storybook/` |
|
|
539
|
-
| `npm run test:storybook` |
|
|
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 |
|
|
540
465
|
|
|
541
466
|
## Repository
|
|
542
467
|
|
|
@@ -550,17 +475,10 @@ dist/ build output (gitignored)
|
|
|
550
475
|
|
|
551
476
|
## Licence
|
|
552
477
|
|
|
553
|
-
MIT for the design system. Fonts (IBM Plex Sans, Mono, Condensed) are licensed
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
IBM Plex is copyright © 2017 IBM Corp., released under the SIL Open Font
|
|
559
|
-
License, Version 1.1, with the Reserved Font Name "Plex". The binaries shipped
|
|
560
|
-
in `src/css/fonts/` (and `dist/fonts/` after a build) are unmodified upstream
|
|
561
|
-
releases; the OFL text ships beside them as `OFL.txt`. The CSS `font-family`
|
|
562
|
-
names (`Contour Plex Sans`, `Contour Plex Mono`, `Contour Plex Sans Condensed`)
|
|
563
|
-
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.
|
|
564
482
|
|
|
565
483
|
---
|
|
566
484
|
|