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.
Files changed (150) hide show
  1. package/README.md +244 -326
  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/agent-rules.json +16 -0
  6. package/dist/build-manifest.json +344 -126
  7. package/dist/contour-wc-content.esm.js +1939 -0
  8. package/dist/contour-wc-content.esm.min.js +1 -0
  9. package/dist/contour-wc-core.esm.js +3724 -0
  10. package/dist/contour-wc-core.esm.min.js +1 -0
  11. package/dist/contour-wc-dashboard.esm.js +6986 -0
  12. package/dist/contour-wc-dashboard.esm.min.js +1 -0
  13. package/dist/contour-wc-data.esm.js +6572 -0
  14. package/dist/contour-wc-data.esm.min.js +1 -0
  15. package/dist/contour-wc-docs.esm.js +976 -0
  16. package/dist/contour-wc-docs.esm.min.js +1 -0
  17. package/dist/contour-wc-feedback.esm.js +1742 -0
  18. package/dist/contour-wc-feedback.esm.min.js +1 -0
  19. package/dist/contour-wc-forms.esm.js +2437 -0
  20. package/dist/contour-wc-forms.esm.min.js +1 -0
  21. package/dist/contour-wc-interaction.esm.js +1343 -0
  22. package/dist/contour-wc-interaction.esm.min.js +1 -0
  23. package/dist/contour-wc-layout.esm.js +845 -0
  24. package/dist/contour-wc-layout.esm.min.js +1 -0
  25. package/dist/contour-wc-map.esm.js +2411 -0
  26. package/dist/contour-wc-map.esm.min.js +1 -0
  27. package/dist/contour-wc-misc.esm.js +945 -0
  28. package/dist/contour-wc-misc.esm.min.js +1 -0
  29. package/dist/contour-wc-navigation.esm.js +2842 -0
  30. package/dist/contour-wc-navigation.esm.min.js +1 -0
  31. package/dist/contour-wc-ui.esm.js +6519 -0
  32. package/dist/contour-wc-ui.esm.min.js +1 -0
  33. package/dist/contour-wc.esm.js +14435 -5723
  34. package/dist/contour-wc.esm.min.js +1 -1
  35. package/dist/contour-wc.js +14436 -5725
  36. package/dist/contour-wc.min.js +1 -1
  37. package/dist/contour.a11y.json +402 -0
  38. package/dist/contour.code-snippets +4534 -0
  39. package/dist/contour.components.json +4870 -1222
  40. package/dist/contour.css +6672 -4711
  41. package/dist/contour.d.ts +753 -1085
  42. package/dist/contour.esm.js +440 -18
  43. package/dist/contour.esm.min.js +1 -1
  44. package/dist/contour.html-data.json +11343 -0
  45. package/dist/contour.js +440 -18
  46. package/dist/contour.min.css +1 -1
  47. package/dist/contour.min.js +1 -1
  48. package/dist/contour.react.d.ts +422 -0
  49. package/dist/contour.single.html +17 -0
  50. package/dist/contour.single.min.css +1 -0
  51. package/dist/contour.themes.json +56 -12
  52. package/dist/contour.tokens.json +1318 -1053
  53. package/dist/contour.vue.d.ts +420 -0
  54. package/dist/contour.web-types.json +11703 -0
  55. package/dist/custom-elements.json +36120 -0
  56. package/dist/docs/actions.md +16 -6
  57. package/dist/docs/affordances.md +21 -85
  58. package/dist/docs/apireference.md +9 -5
  59. package/dist/docs/colour.md +10 -4
  60. package/dist/docs/componentindex.md +9 -22
  61. package/dist/docs/data.md +39 -58
  62. package/dist/docs/docs.md +12 -7
  63. package/dist/docs/feedback.md +30 -12
  64. package/dist/docs/field.md +28 -13
  65. package/dist/docs/forms.md +35 -19
  66. package/dist/docs/index.json +70 -61
  67. package/dist/docs/install.md +12 -7
  68. package/dist/docs/landing.md +7 -4
  69. package/dist/docs/mapengine.md +30 -8
  70. package/dist/docs/motion.md +12 -6
  71. package/dist/docs/navigation.md +31 -7
  72. package/dist/docs/overlays.md +32 -25
  73. package/dist/docs/overview.md +3 -2
  74. package/dist/docs/patterns.md +20 -10
  75. package/dist/docs/playground.md +11 -4
  76. package/dist/docs/principles.md +8 -6
  77. package/dist/docs/recipes.md +117 -13
  78. package/dist/docs/space.md +10 -6
  79. package/dist/docs/status.md +13 -14
  80. package/dist/docs/surfaces.md +17 -22
  81. package/dist/docs/theming.md +18 -32
  82. package/dist/docs/type.md +12 -5
  83. package/dist/docs/webcomponents.md +75 -33
  84. package/dist/hljs.css +1 -20
  85. package/dist/map-chrome.mapbox.css +68 -92
  86. package/dist/map-chrome.maplibre.css +68 -92
  87. package/dist/registry/items/contour-core.json +2 -2
  88. package/dist/registry/items/contour-data.json +2 -2
  89. package/dist/registry/items/contour-docs.json +2 -2
  90. package/dist/registry/items/contour-landing.json +2 -2
  91. package/dist/registry/registry.json +8 -8
  92. package/dist/surfaces/contour-core.min.css +1 -1
  93. package/dist/surfaces/contour-data.min.css +1 -1
  94. package/dist/surfaces/contour-docs.min.css +1 -1
  95. package/dist/surfaces/contour-landing.min.css +1 -1
  96. package/dist/svg/icons.svg +367 -0
  97. package/dist/wc/behaviours.mjs +222 -192
  98. package/dist/wc/content.mjs +486 -142
  99. package/dist/wc/core.mjs +917 -395
  100. package/dist/wc/dashboard.mjs +252 -25
  101. package/dist/wc/data-chart.mjs +1333 -0
  102. package/dist/wc/data-export.mjs +391 -0
  103. package/dist/wc/data-gauge.mjs +779 -0
  104. package/dist/wc/data-geo.mjs +696 -0
  105. package/dist/wc/data-glyphs.mjs +133 -0
  106. package/dist/wc/data-legend.mjs +431 -0
  107. package/dist/wc/data-readout.mjs +227 -0
  108. package/dist/wc/data-series.mjs +1004 -0
  109. package/dist/wc/data-table.mjs +751 -0
  110. package/dist/wc/data.mjs +15 -3707
  111. package/dist/wc/docs.mjs +113 -19
  112. package/dist/wc/feedback.mjs +320 -116
  113. package/dist/wc/forms-controls.mjs +635 -0
  114. package/dist/wc/forms-field.mjs +547 -0
  115. package/dist/wc/forms-groups.mjs +347 -0
  116. package/dist/wc/forms-input.mjs +292 -0
  117. package/dist/wc/forms.mjs +10 -1122
  118. package/dist/wc/glyph.mjs +204 -0
  119. package/dist/wc/index.mjs +16 -7
  120. package/dist/wc/interaction.mjs +322 -75
  121. package/dist/wc/layout.mjs +100 -29
  122. package/dist/wc/map.mjs +888 -285
  123. package/dist/wc/misc.mjs +137 -26
  124. package/dist/wc/navigation-menu.mjs +735 -0
  125. package/dist/wc/navigation-shell.mjs +495 -0
  126. package/dist/wc/navigation-tree.mjs +995 -0
  127. package/dist/wc/navigation.mjs +9 -1636
  128. package/dist/wc/registration.mjs +1 -8
  129. package/dist/wc/shadow.mjs +285 -113
  130. package/dist/wc/states.mjs +75 -78
  131. package/dist/wc/svg.mjs +209 -34
  132. package/dist/wc/ui-atoms.mjs +608 -0
  133. package/dist/wc/ui-data.mjs +1404 -0
  134. package/dist/wc/ui-feedback.mjs +419 -0
  135. package/dist/wc/ui-inputs.mjs +1570 -0
  136. package/dist/wc/ui-menus.mjs +307 -0
  137. package/dist/wc/ui-overlays.mjs +1605 -0
  138. package/integrations/README.md +25 -5
  139. package/integrations/ai/CLAUDE.md +6 -3
  140. package/integrations/ai/COPILOT.md +14 -0
  141. package/integrations/ai/GEMINI.md +14 -0
  142. package/integrations/ai/WINDSURF.md +14 -0
  143. package/integrations/ai/v0-prompt.md +13 -1
  144. package/integrations/frameworks/README.md +235 -0
  145. package/integrations/native/README.md +0 -3
  146. package/integrations/native/style-dictionary.config.json +1 -1
  147. package/integrations/tailwind/contour-theme.css +71 -13
  148. package/integrations/validate-markup.mjs +172 -0
  149. package/package.json +103 -39
  150. package/dist/wc/ui.mjs +0 -3560
@@ -1,14 +1,34 @@
1
1
  # Integrations
2
2
 
3
- Optional, non-core artifacts that help Contour fit into other toolchains. None
4
- of these are required to use the system; `src/` and `dist/` remain the product.
3
+ Optional, non-core artifacts that help Contour fit into other toolchains. None are required
4
+ to use the system; `src/` and `dist/` remain the product. All ship in the npm tarball under
5
+ `integrations/` (see `package.json` `files`).
5
6
 
6
7
  | Path | What it is |
7
8
  |---|---|
8
- | `integrations/tailwind/contour-theme.css` | Tailwind v4 `@theme` bridge exposing Contour tokens as utilities |
9
+ | `integrations/tailwind/contour-theme.css` | Tailwind v4 `@theme inline` bridge exposing Contour tokens as utilities (semantic + chart colours, radius, spacing, type scale, elevation, motion) |
9
10
  | `integrations/native/style-dictionary.config.json` | Style Dictionary config emitting Swift / Android / Flutter tokens from the DTCG export |
10
- | `integrations/ai/.cursorrules` | Drop-in rules file for Cursor / Claude Code / similar agents |
11
+ | `.cursorrules` | Drop-in rules file for Cursor / Claude Code / similar agents (repo root) |
11
12
  | `integrations/ai/v0-prompt.md` | System prompt for v0 / Bolt / Lovable / similar generators |
12
13
  | `integrations/ai/CLAUDE.md` | Snippet to append to a project's `CLAUDE.md` |
14
+ | `integrations/ai/COPILOT.md` | Drop-in for GitHub Copilot (`.github/copilot-instructions.md`, or copy the body) |
15
+ | `integrations/ai/GEMINI.md` | Drop-in for Gemini / Code Assist (`GEMINI.md`) |
16
+ | `integrations/ai/WINDSURF.md` | Drop-in for Windsurf (`.windsurfrules`, or copy the body) |
17
+ | `integrations/validate-markup.mjs` | Consumer-facing validator: `node integrations/validate-markup.mjs page.html` checks class resolution, table-wrap, icon-button/dialog ARIA, `<img alt>` and raw hex/px against the installed `contour-ds` |
18
+ | `integrations/frameworks/README.md` | React, Vue, Svelte and Astro recipes; every import, tag and event is checked by `node tools/check-recipes.mjs` |
19
+ | `LIBRESHIP.md` | Libreship geospatial integration guide: imports, bundles, map chrome, stability matrix |
13
20
 
14
- These ship in the npm tarball under `integrations/` (see `package.json` `files`).
21
+ ## Tailwind v4
22
+
23
+ The bridge is a single `@theme inline` block, so Contour's variables stay the
24
+ source of truth and every utility references them directly (no redeclaration,
25
+ no regeneration). Import it after Tailwind and the Contour stylesheet:
26
+
27
+ ```css
28
+ @import "tailwindcss";
29
+ @import "contour-ds/contour.min.css";
30
+ @import "contour-ds/integrations/tailwind/contour-theme.css";
31
+ ```
32
+
33
+ Then `bg-primary`, `text-muted`, `rounded-md`, `shadow-sm`, `p-md`,
34
+ `text-h1`, `font-display`, `bg-chart-3`, … resolve to Contour tokens.
@@ -18,7 +18,10 @@ This project uses Contour (`contour-ds`) for all UI. Rules:
18
18
  - Depth is lightness, not shadow.
19
19
  - Charts carry a dash pattern as well as a hue.
20
20
  - Mono type is for data, labels, code — never body copy.
21
- - Full contract: `node_modules/contour-ds/dist/agent-rules.json`.
22
- - Component inventory: `node_modules/contour-ds/dist/contour.components.json`.
23
- - Tokens: `node_modules/contour-ds/dist/contour.tokens.json`.
21
+ - Full contract: `contour-ds/agent-rules.json`.
22
+ - Component inventory: `contour-ds/components.json`.
23
+ - Intent cookbook (task → block): `contour-ds/cookbook.json`.
24
+ - Map chrome wiring (MapLibre / Mapbox / Leaflet): `contour-ds/map-wiring.json`.
25
+ - Accessibility layer (role/ARIA/keyboard/gotchas per block): `contour-ds/a11y.json`.
26
+ - Tokens: `contour-ds/tokens.json`.
24
27
  ```
@@ -0,0 +1,14 @@
1
+ # Contour — GitHub Copilot instructions (drop-in)
2
+
3
+ This project uses **Contour**, a token-driven design system for spatial / geospatial interfaces. When generating UI, follow `dist/agent-rules.json` and these artifacts (all shipped in `dist/`):
4
+
5
+ - `dist/agent-cookbook.json` — pick a block (`intents`) or a composition (`blueprints`, e.g. `map-workspace`).
6
+ - `dist/contour.components.json` — a block's full element / variant / state / attribute slice.
7
+ - `dist/contour.a11y.json` — the role, required ARIA, keyboard and gotchas per block.
8
+ - `dist/agent-examples.json` — clean, copy-pasteable markup per block.
9
+ - `dist/agent-map-wiring.json` — how chrome attaches to MapLibre / Mapbox / Leaflet.
10
+ - `dist/contour.tokens.json` — the token layer (DTCG 2025.10).
11
+
12
+ Non-negotiable rules: use the `c-` classes (or `<contour-*>` elements) and `var(--color-…)` tokens — never a raw hex or `px`; every control has an accessible name; state is never colour alone; a `table.c-table` sits in a `.c-table-wrap`; a component never owns its heading level.
13
+
14
+ Full ruleset with enforcement pointers: `dist/agent-rules.json`.
@@ -0,0 +1,14 @@
1
+ # Contour — Gemini / Code Assist instructions (drop-in)
2
+
3
+ This project uses **Contour**, a token-driven design system for spatial / geospatial interfaces. When generating UI, read `dist/agent-rules.json` and these shipped artifacts:
4
+
5
+ - `dist/agent-cookbook.json` — pick a block (`intents`) or a composition (`blueprints`, e.g. `map-workspace`).
6
+ - `dist/contour.components.json` — a block's full element / variant / state / attribute slice.
7
+ - `dist/contour.a11y.json` — the role, required ARIA, keyboard and gotchas per block.
8
+ - `dist/agent-examples.json` — clean, copy-pasteable markup per block.
9
+ - `dist/agent-map-wiring.json` — how chrome attaches to MapLibre / Mapbox / Leaflet.
10
+ - `dist/contour.tokens.json` — the token layer (DTCG 2025.10).
11
+
12
+ Non-negotiable rules: use the `c-` classes (or `<contour-*>` elements) and `var(--color-…)` tokens — never a raw hex or `px`; every control has an accessible name; state is never colour alone; a `table.c-table` sits in a `.c-table-wrap`; a component never owns its heading level.
13
+
14
+ Full ruleset with enforcement pointers: `dist/agent-rules.json`.
@@ -0,0 +1,14 @@
1
+ # Contour — Windsurf instructions (drop-in)
2
+
3
+ This project uses **Contour**, a token-driven design system for spatial / geospatial interfaces. When generating UI, follow `dist/agent-rules.json` and these shipped artifacts:
4
+
5
+ - `dist/agent-cookbook.json` — pick a block (`intents`) or a composition (`blueprints`, e.g. `map-workspace`).
6
+ - `dist/contour.components.json` — a block's full element / variant / state / attribute slice.
7
+ - `dist/contour.a11y.json` — the role, required ARIA, keyboard and gotchas per block.
8
+ - `dist/agent-examples.json` — clean, copy-pasteable markup per block.
9
+ - `dist/agent-map-wiring.json` — how chrome attaches to MapLibre / Mapbox / Leaflet.
10
+ - `dist/contour.tokens.json` — the token layer (DTCG 2025.10).
11
+
12
+ Non-negotiable rules: use the `c-` classes (or `<contour-*>` elements) and `var(--color-…)` tokens — never a raw hex or `px`; every control has an accessible name; state is never colour alone; a `table.c-table` sits in a `.c-table-wrap`; a component never owns its heading level.
13
+
14
+ Full ruleset with enforcement pointers: `dist/agent-rules.json`.
@@ -2,7 +2,7 @@
2
2
 
3
3
  You generate UI using **Contour**, a token-driven design system for spatial
4
4
  interfaces (routing engines, pedestrian simulators, map tooling, geospatial
5
- dashboards). Dark and light themes, 203 components, 294 design tokens, zero
5
+ dashboards). Dark and light themes, 254 components, 317 design tokens, zero
6
6
  runtime dependencies.
7
7
 
8
8
  ## How to use it
@@ -61,10 +61,22 @@ dashboard or vice versa.
61
61
 
62
62
  Dark/light via `color-scheme: light dark` on `:root` or `<meta>`.
63
63
 
64
+ ## Density
65
+
66
+ The spacing scale is density-aware. Set `data-density="compact"` (or `roomy`)
67
+ on any scope to re-declare the `--space-*` tokens for that subtree — a data
68
+ table packs tighter, a marketing page breathes. The default (`comfortable`)
69
+ needs no attribute. Wire a segmented control with `data-density-toggle="#scope"`
70
+ and the system script flips the attribute for you; without JavaScript the page
71
+ renders at comfortable.
72
+
64
73
  ## Full reference
65
74
 
66
75
  - Style guide: the repository's `index.html` (hosted once published).
67
76
  - Tokens: `contour-ds/tokens.json` (DTCG 2025.10).
68
77
  - Components: `contour-ds/components.json`.
78
+ - Intent cookbook (task → block, plus compositions like `map-workspace`): `contour-ds/cookbook.json`.
79
+ - Map chrome wiring (MapLibre / Mapbox / Leaflet): `contour-ds/map-wiring.json`.
80
+ - Accessibility layer (role/ARIA/keyboard/gotchas): `contour-ds/a11y.json`.
69
81
  - Agent rules: `contour-ds/agent-rules.json`.
70
82
  - LLM index: `llms.txt` / `llms-full.txt`.
@@ -0,0 +1,235 @@
1
+ # Framework recipes
2
+
3
+ Contour is a CSS design system plus a layer of **custom elements**. There is no
4
+ framework wrapper to install and no adapter to keep in step: the components are
5
+ the platform's, so every framework consumes them the same way it consumes any
6
+ other HTML element. This page shows the shortest path in each one, plus the one
7
+ piece of configuration each framework needs so it does not treat
8
+ `<contour-…>` as a typo.
9
+
10
+ Two rules hold everywhere:
11
+
12
+ - **Register once.** Importing a web-component bundle registers its elements as
13
+ a side effect. Import `contour-ds/contour-wc.esm.js` for every element, or a
14
+ single family from `contour-ds/wc/<family>.mjs` to keep the bundle smaller.
15
+ Importing the same bundle twice is safe — `customElements.define` is guarded.
16
+ - **State travels as attributes and events.** Read and write attributes
17
+ (`label`, `open`, `value`, `rows`, …); listen for `contour:*` events. A
18
+ framework may add sugar on top, but the attribute/event contract is the one
19
+ that always works, and it is the one the type declarations describe.
20
+
21
+ The examples below are checked by `node tools/check-recipes.mjs`: every
22
+ `contour-ds/…` specifier must resolve through the package's `exports` map,
23
+ every `<contour-…>` tag must be declared in `dist/custom-elements.json`, and
24
+ every `contour:*` event name must appear in that manifest's event vocabulary.
25
+
26
+ ## Install and style
27
+
28
+ ```bash
29
+ npm install contour-ds
30
+ ```
31
+
32
+ ```css
33
+ /* every layer, in cascade order */
34
+ @import "contour-ds/contour.min.css";
35
+
36
+ /* or only the surface this product ships */
37
+ @import "contour-ds/surfaces/contour-core.min.css";
38
+ ```
39
+
40
+ ```js
41
+ // every custom element
42
+ import "contour-ds/contour-wc.esm.js";
43
+
44
+ // or one family; the tag you use must be in the family you import
45
+ import "contour-ds/wc/data.mjs";
46
+ ```
47
+
48
+ The CSS bundles expect the self-hosted fonts beside them (`dist/fonts/`), which
49
+ the package ships. `hljs.css` and `map-chrome.*.css` are optional companions and
50
+ are not part of the main bundle.
51
+
52
+ ## React
53
+
54
+ React renders a hyphenated tag as a custom element without configuration. Keep
55
+ the event listener on the DOM node: `ref` is the contract that does not depend
56
+ on React's custom-element event heuristics.
57
+
58
+ ```jsx
59
+ import { useEffect, useRef } from "react";
60
+ import "contour-ds/contour.min.css";
61
+ import "contour-ds/contour-wc.esm.js";
62
+
63
+ export function LayerSearch({ layers, onSelect }) {
64
+ const ref = useRef(null);
65
+
66
+ useEffect(() => {
67
+ const el = ref.current;
68
+ if (!el) return;
69
+ const handle = (e) => onSelect(e.detail);
70
+ el.addEventListener("contour:select", handle);
71
+ return () => el.removeEventListener("contour:select", handle);
72
+ }, [onSelect]);
73
+
74
+ return (
75
+ <contour-table
76
+ ref={ref}
77
+ label="Layers"
78
+ rows={JSON.stringify(layers)}
79
+ columns={JSON.stringify(["name", "features"])}
80
+ virtual
81
+ />
82
+ );
83
+ }
84
+ ```
85
+
86
+ TypeScript: the package ships JSX intrinsics for every tag. Add one reference in
87
+ a `.d.ts` your `tsconfig` already includes:
88
+
89
+ ```ts
90
+ /// <reference types="contour-ds/react" />
91
+ ```
92
+
93
+ Non-string values are properties, not attributes; React sets them on the element
94
+ when the component declares them. When in doubt, pass the string form
95
+ (`rows={JSON.stringify(rows)}`) — it is what the server sends and what the
96
+ attribute contract describes.
97
+
98
+ ## Vue
99
+
100
+ Vue needs to be told that `contour-*` tags are custom elements, or the compiler
101
+ warns and tries to resolve them as components. In Vite:
102
+
103
+ ```js
104
+ // vite.config.js
105
+ import { defineConfig } from "vite";
106
+ import vue from "@vitejs/plugin-vue";
107
+
108
+ export default defineConfig({
109
+ plugins: [
110
+ vue({
111
+ template: {
112
+ compilerOptions: { isCustomElement: (tag) => tag.startsWith("contour-") },
113
+ },
114
+ }),
115
+ ],
116
+ });
117
+ ```
118
+
119
+ ```vue
120
+ <script setup>
121
+ import { onMounted, onBeforeUnmount, ref } from "vue";
122
+ import "contour-ds/contour.min.css";
123
+ import "contour-ds/contour-wc.esm.js";
124
+
125
+ const emit = defineEmits(["select"]);
126
+ const table = ref(null);
127
+
128
+ const onSelect = (e) => emit("select", e.detail);
129
+ onMounted(() => table.value?.addEventListener("contour:select", onSelect));
130
+ onBeforeUnmount(() => table.value?.removeEventListener("contour:select", onSelect));
131
+ </script>
132
+
133
+ <template>
134
+ <contour-table
135
+ ref="table"
136
+ label="Layers"
137
+ :rows="JSON.stringify(rows)"
138
+ :columns="JSON.stringify(['name', 'features'])"
139
+ virtual
140
+ />
141
+ </template>
142
+ ```
143
+
144
+ TypeScript: `contour-ds/vue` augments `GlobalComponents` with every tag, so a
145
+ template type-checks once the file is in the program:
146
+
147
+ ```ts
148
+ /// <reference types="contour-ds/vue" />
149
+ ```
150
+
151
+ ## Svelte
152
+
153
+ Svelte treats a lowercase tag containing a dash as a custom element; no
154
+ configuration is needed. Use `bind:this` for the node and add the listener
155
+ yourself, exactly as in React and Vue:
156
+
157
+ ```svelte
158
+ <script>
159
+ import { onMount } from "svelte";
160
+ import "contour-ds/contour.min.css";
161
+ import "contour-ds/contour-wc.esm.js";
162
+
163
+ export let layers = [];
164
+ let table;
165
+
166
+ onMount(() => {
167
+ const handle = (e) => console.log(e.detail);
168
+ table.addEventListener("contour:select", handle);
169
+ return () => table.removeEventListener("contour:select", handle);
170
+ });
171
+ </script>
172
+
173
+ <contour-table
174
+ bind:this={table}
175
+ label="Layers"
176
+ rows={JSON.stringify(layers)}
177
+ columns={JSON.stringify(["name", "features"])}
178
+ virtual
179
+ />
180
+ ```
181
+
182
+ Svelte passes non-string values to custom elements as properties; the string
183
+ form above keeps the markup honest and identical to what the server sends.
184
+
185
+ ## Astro
186
+
187
+ Astro renders custom elements as static HTML and hydrates nothing by default —
188
+ which is what the component layer expects, because every component is usable
189
+ without JavaScript. Add a client directive only when the component needs its
190
+ enhancement on the client immediately:
191
+
192
+ ```astro
193
+ ---
194
+ import "contour-ds/contour.min.css";
195
+ import "contour-ds/contour-wc.esm.js";
196
+ const layers = [{ name: "Roads", features: 1204 }];
197
+ ---
198
+
199
+ <contour-table
200
+ label="Layers"
201
+ rows={JSON.stringify(layers)}
202
+ columns={JSON.stringify(["name", "features"])}
203
+ virtual
204
+ />
205
+ ```
206
+
207
+ `client:load` is not required for the element to render; it is required for the
208
+ custom-element upgrade to run on the client *before* the reader interacts.
209
+ Astro slots are light-DOM children, which is how Contour composes: a card's
210
+ content is the element's own children.
211
+
212
+ ```astro
213
+ <contour-card title="Elevation">
214
+ <p>Body content is slotted by being a child, not by a named slot.</p>
215
+ </contour-card>
216
+ ```
217
+
218
+ ## Events and state, without a framework
219
+
220
+ The pattern every recipe above uses is the smallest one that is true
221
+ everywhere:
222
+
223
+ ```js
224
+ const el = document.querySelector("contour-table");
225
+ el.addEventListener("contour:select", (e) => {
226
+ // e.detail is the component's intent; the host owns the state.
227
+ render(e.detail);
228
+ });
229
+ el.setAttribute("rows", JSON.stringify(nextRows));
230
+ ```
231
+
232
+ Contour components emit intent and reflect host-owned state
233
+ (`contour:select`, `contour:input`, `contour:change`, `contour:layer-reorder`,
234
+ …). They do not keep a global store, so the host's framework remains the single
235
+ source of truth.
@@ -14,6 +14,3 @@ npx style-dictionary@^5 build --config integrations/native/style-dictionary.conf
14
14
 
15
15
  Spatial interfaces often ship native companions (iOS/Android field apps); this
16
16
  keeps their palette in sync with the web system.
17
-
18
- Spatial interfaces often ship native companions (iOS/Android field apps); this
19
- keeps their palette in sync with the web system.
@@ -1,5 +1,5 @@
1
1
  {
2
- "source": ["../../dist/contour.tokens.json"],
2
+ "source": ["./dist/contour.tokens.json"],
3
3
  "usesDtcg": true,
4
4
  "platforms": {
5
5
  "ios": {
@@ -1,9 +1,17 @@
1
1
  /* Contour → Tailwind v4 theme bridge.
2
2
  *
3
3
  * Drop this into a Tailwind v4 project to expose Contour's tokens as
4
- * Tailwind utilities (bg-primary, text-muted, rounded-md, font-sans, …).
5
- * Contour's CSS variables stay the source of truth, so the bridge tracks
6
- * the system without regeneration.
4
+ * Tailwind utilities (bg-primary, text-muted, rounded-md, shadow-sm,
5
+ * font-sans, p-md, text-h1, …). Contour's CSS variables stay the source of
6
+ * truth, so the bridge tracks the system without regeneration.
7
+ *
8
+ * `@theme inline` is deliberate. A plain `@theme` block re-emits each token as
9
+ * a `:root` variable, so `--color-primary: var(--color-primary)` would
10
+ * redefine the variable to a cyclic reference and resolve to nothing — every
11
+ * utility built on it would break. `inline` tells Tailwind to substitute the
12
+ * referenced variable directly into the generated utility instead of
13
+ * redeclaring it, so `bg-primary` becomes `background-color: var(--color-primary)`
14
+ * and Contour's own declaration keeps winning.
7
15
  *
8
16
  * Usage:
9
17
  * @import "tailwindcss";
@@ -11,7 +19,7 @@
11
19
  * @import "./contour-theme.css"; // this file
12
20
  */
13
21
 
14
- @theme {
22
+ @theme inline {
15
23
  /* Colour — semantic layer (light-dark aware via Contour's vars) */
16
24
  --color-primary: var(--color-primary);
17
25
  --color-primary-hover: var(--color-primary-hover);
@@ -26,39 +34,89 @@
26
34
  --color-canvas-sunken: var(--color-canvas-sunken);
27
35
  --color-border: var(--color-border);
28
36
  --color-border-strong: var(--color-border-strong);
29
- --color-canvas: var(--color-canvas);
30
37
  --color-success: var(--color-success);
31
38
  --color-warning: var(--color-warning);
32
39
  --color-danger: var(--color-danger);
33
40
  --color-info: var(--color-info);
34
41
 
35
- /* Colour — brand families (for data viz / accents) */
36
- --color-tidal-500: var(--tidal-500);
37
- --color-plasma-500: var(--plasma-500);
38
- --color-lumen-500: var(--lumen-500);
39
- --color-sol-500: var(--sol-500);
40
- --color-clay-500: var(--clay-500);
42
+ /* Colour — data + chart series (categorical and cyclic) for data viz */
43
+ --color-data: var(--color-data);
44
+ --color-data-soft: var(--color-data-soft);
45
+ --color-data-text: var(--color-data-text);
46
+ --color-chart-axis: var(--chart-axis);
47
+ --color-chart-1: var(--chart-1);
48
+ --color-chart-2: var(--chart-2);
49
+ --color-chart-3: var(--chart-3);
50
+ --color-chart-4: var(--chart-4);
51
+ --color-chart-5: var(--chart-5);
52
+ --color-chart-6: var(--chart-6);
53
+ --color-chart-7: var(--chart-7);
54
+ --color-chart-8: var(--chart-8);
55
+ --color-chart-9: var(--chart-9);
56
+ --color-chart-10: var(--chart-10);
57
+ --color-chart-11: var(--chart-11);
58
+ --color-chart-12: var(--chart-12);
59
+
60
+ /* Colour — brand families (for accents and custom series) */
61
+ --color-tidal-500: var(--color-tidal-500);
62
+ --color-plasma-500: var(--color-plasma-500);
63
+ --color-lumen-500: var(--color-lumen-500);
64
+ --color-sol-500: var(--color-sol-500);
65
+ --color-clay-500: var(--color-clay-500);
41
66
 
42
67
  /* Radius */
68
+ --radius-xs: var(--radius-xs);
43
69
  --radius-sm: var(--radius-sm);
44
70
  --radius-md: var(--radius-md);
45
71
  --radius-lg: var(--radius-lg);
46
72
  --radius-xl: var(--radius-xl);
73
+ --radius-2xl: var(--radius-2xl);
47
74
  --radius-pill: var(--radius-pill);
48
75
 
49
76
  /* Spacing (Contour's space scale) */
77
+ --spacing-3xs: var(--space-3xs);
78
+ --spacing-2xs: var(--space-2xs);
50
79
  --spacing-xs: var(--space-xs);
51
80
  --spacing-sm: var(--space-sm);
52
81
  --spacing-md: var(--space-md);
53
82
  --spacing-lg: var(--space-lg);
54
83
  --spacing-xl: var(--space-xl);
55
84
  --spacing-2xl: var(--space-2xl);
85
+ --spacing-3xl: var(--space-3xl);
86
+ --spacing-cluster: var(--space-cluster);
87
+ --spacing-stack: var(--space-stack);
88
+ --spacing-section: var(--space-section);
56
89
 
57
- /* Typography */
90
+ /* Typography — families */
58
91
  --font-sans: var(--font-sans);
59
92
  --font-display: var(--font-display);
60
93
  --font-mono: var(--font-mono);
61
94
 
95
+ /* Typography — scale (text-h1, text-lead, text-sm, …) */
96
+ --text-display-1: var(--type-display-1);
97
+ --text-display-2: var(--type-display-2);
98
+ --text-h1: var(--type-h1);
99
+ --text-h2: var(--type-h2);
100
+ --text-h3: var(--type-h3);
101
+ --text-h4: var(--type-h4);
102
+ --text-lead: var(--type-lead);
103
+ --text-body: var(--type-body);
104
+ --text-lg: var(--type-lg);
105
+ --text-sm: var(--type-sm);
106
+ --text-xs: var(--type-xs);
107
+ --text-micro: var(--type-micro);
108
+
109
+ /* Elevation (shadow-sm … shadow-xl resolve to Contour's light-dark shadows) */
110
+ --shadow-xs: var(--shadow-xs);
111
+ --shadow-sm: var(--shadow-sm);
112
+ --shadow-md: var(--shadow-md);
113
+ --shadow-lg: var(--shadow-lg);
114
+ --shadow-xl: var(--shadow-xl);
115
+
62
116
  /* Motion */
63
117
  --ease-standard: var(--ease-standard);
64
- }
118
+ --ease-out-expo: var(--ease-out-expo);
119
+ --ease-in-out: var(--ease-in-out);
120
+ --ease-exit: var(--ease-exit);
121
+ --ease-linear: var(--ease-linear);
122
+ }