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,4 +1,4 @@
1
- import { ContourBase, define } from './core.mjs';
1
+ import { ContourBase, define, navKey, isRtl , safeHref, warnBadJson, headingTag } from './core.mjs';
2
2
  class ContourApp extends ContourBase {
3
3
  static get observed() { return ["title"]; }
4
4
  static get properties() { return { title: { attribute: "title" } }; }
@@ -14,6 +14,11 @@ import { ContourBase, define } from './core.mjs';
14
14
  const main = this.ensure(".c-app__main", () => { const el = document.createElement("main"); el.className = "c-app__main"; return el; });
15
15
  if (main.parentNode !== this) this.appendChild(main);
16
16
  if (header.parentNode !== this) this.insertBefore(header, main);
17
+ // Authored children move into <main>; siblings took flex share and sat outside the only main landmark.
18
+ Array.from(this.children).forEach((child) => {
19
+ if (child === header || child === main) return;
20
+ main.appendChild(child);
21
+ });
17
22
  }
18
23
  }
19
24
  define("contour-app", ContourApp);
@@ -22,7 +27,16 @@ import { ContourBase, define } from './core.mjs';
22
27
  static get properties() { return { title: { attribute: "title" } }; }
23
28
  render() {
24
29
  this.classList.add("c-app-body");
25
- const main = this.ensure(".c-app-body__main", () => { const el = document.createElement("main"); el.className = "c-app-body__main"; return el; });
30
+ // One visible <main> per document; nested → plain div, standalone → main.
31
+ const nested = !!(this.parentElement && this.parentElement.closest && this.parentElement.closest("contour-app"));
32
+ const tag = nested ? "div" : "main";
33
+ let main = this.querySelector(":scope > .c-app-body__main");
34
+ if (main && main.tagName.toLowerCase() !== tag) { main.remove(); main = null; }
35
+ if (!main) {
36
+ main = document.createElement(tag);
37
+ main.className = "c-app-body__main";
38
+ this.appendChild(main);
39
+ }
26
40
  const title = this.getAttribute("title");
27
41
  if (title) {
28
42
  const t = this.ensure(".c-app-body__title", () => { const el = document.createElement("div"); el.className = "c-app-body__title"; return el; });
@@ -40,15 +54,7 @@ class ContourBtnGroup extends ContourBase {
40
54
  this.classList.add("c-btn-group");
41
55
  this.setAttribute("role", "group");
42
56
  if (this.getAttribute("title")) this.setAttribute("aria-label", this.getAttribute("title"));
43
- if (!this.querySelector(".c-btn")) {
44
- for (const lbl of ["One", "Two", "Three"]) {
45
- const b = document.createElement("button");
46
- b.className = "c-btn c-btn--sm";
47
- b.type = "button";
48
- b.textContent = lbl;
49
- this.appendChild(b);
50
- }
51
- }
57
+ // Author supplies <button> children; component doesn't invent them.
52
58
  }
53
59
  enhance() {
54
60
  if (this._wiredBtnGroup) return;
@@ -64,27 +70,14 @@ class ContourBtnGroup extends ContourBase {
64
70
  this.addEventListener("keydown", (e) => {
65
71
  const buttons = Array.from(this.querySelectorAll(".c-btn"));
66
72
  if (!buttons.length) return;
67
- const active = document.activeElement;
68
- const idx = buttons.indexOf(active);
69
- let next = -1;
70
- const rtl = (this.getAttribute("dir") || document.documentElement.getAttribute("dir") || "").toLowerCase() === "rtl";
71
- if (e.key === "ArrowDown") next = idx < 0 ? 0 : Math.min(buttons.length - 1, idx + 1);
72
- else if (e.key === "ArrowUp") next = idx < 0 ? 0 : Math.max(0, idx - 1);
73
- else if (e.key === "ArrowRight") next = rtl ? (idx < 0 ? 0 : Math.max(0, idx - 1)) : (idx < 0 ? 0 : Math.min(buttons.length - 1, idx + 1));
74
- else if (e.key === "ArrowLeft") next = rtl ? (idx < 0 ? 0 : Math.min(buttons.length - 1, idx + 1)) : (idx < 0 ? 0 : Math.max(0, idx - 1));
75
- else if (e.key === "Home") next = 0;
76
- else if (e.key === "End") next = buttons.length - 1;
77
- if (next >= 0 && next !== idx) {
78
- e.preventDefault();
79
- buttons[next].focus();
80
- }
73
+ navKey(e, buttons, { wrap: false, homeEnd: true, rtl: isRtl(this) });
81
74
  });
82
75
  }
83
76
  }
84
77
  define("contour-btn-group", ContourBtnGroup);
85
78
  class ContourRangeScale extends ContourBase {
86
- static get observed() { return ["label", "value", "ticks"]; }
87
- static get properties() { return { label: { attribute: "label" }, value: { attribute: "value" }, ticks: { attribute: "ticks" } }; }
79
+ static get observed() { return ["label", "ticks"]; }
80
+ static get properties() { return { label: { attribute: "label" }, ticks: { attribute: "ticks" } }; }
88
81
  render() {
89
82
  this.classList.add("c-range-scale");
90
83
  this.setAttribute("role", "group");
@@ -125,8 +118,8 @@ class ContourBtnGroup extends ContourBase {
125
118
  }
126
119
  define("contour-range-scale", ContourRangeScale);
127
120
  class ContourTimeRange extends ContourBase {
128
- static get observed() { return ["label", "value", "ticks"]; }
129
- static get properties() { return { label: { attribute: "label" }, value: { attribute: "value" }, ticks: { attribute: "ticks" } }; }
121
+ static get observed() { return ["label", "value", "ticks", "required", "disabled"]; }
122
+ static get properties() { return { label: { attribute: "label" }, value: { attribute: "value" }, ticks: { attribute: "ticks" }, required: { attribute: "required", type: Boolean }, disabled: { attribute: "disabled", type: Boolean } }; }
130
123
  render() {
131
124
  this.classList.add("c-time-range");
132
125
  this.setAttribute("role", "group");
@@ -136,6 +129,12 @@ class ContourBtnGroup extends ContourBase {
136
129
  const t = this.ensure(".c-time-range__label", () => { const el = document.createElement("span"); el.className = "c-time-range__label"; return el; });
137
130
  t.textContent = label;
138
131
  }
132
+ // Slotted input gets host's label when unnamed.
133
+ const inp = this.querySelector("input");
134
+ if (inp && label && !inp.hasAttribute("aria-label") && !(inp.labels && inp.labels.length)) inp.setAttribute("aria-label", label);
135
+ // sync observed `value` onto slotted input.
136
+ const value = this.getAttribute("value");
137
+ if (value !== null && inp && inp.value !== value) inp.value = value;
139
138
  const ticksAttr = this.getAttribute("ticks");
140
139
  Array.from(this.querySelectorAll(".c-time-range__tick")).forEach((n) => n.remove());
141
140
  if (ticksAttr) {
@@ -165,3 +164,75 @@ class ContourBtnGroup extends ContourBase {
165
164
  }
166
165
  }
167
166
  define("contour-time-range", ContourTimeRange);
167
+
168
+ // Skip link: visually hidden until focused; class does the work.
169
+ class ContourSkipLink extends ContourBase {
170
+ static get observed() { return ["href", "label"]; }
171
+ static get properties() { return { href: { attribute: "href" }, label: { attribute: "label" } }; }
172
+ render() {
173
+ // drop authored text nodes so the authored label isn't rendered a
174
+ // second time beside the generated <a> (which carries the `label` attribute).
175
+ Array.from(this.childNodes).forEach((n) => { if (n.nodeType === Node.TEXT_NODE) n.remove(); });
176
+ const a = this.ensure("a", () => { const el = document.createElement("a"); el.className = "c-skip-link"; return el; });
177
+ a.setAttribute("href", safeHref(this.getAttribute("href") || "#main"));
178
+ a.textContent = this.getAttribute("label") || "Skip to content";
179
+ }
180
+ }
181
+ define("contour-skip-link", ContourSkipLink);
182
+
183
+ // Icon: renders sprite <use> by name; consumer points name at an id.
184
+ class ContourIcon extends ContourBase {
185
+ static get observed() { return ["name", "size", "label"]; }
186
+ static get properties() { return { name: { attribute: "name" }, size: { attribute: "size" }, label: { attribute: "label" } }; }
187
+ render() {
188
+ const name = this.getAttribute("name") || "";
189
+ // accept `name="check"` or `name="i-check"` (prevents "#i-i-check").
190
+ const iconName = name.startsWith("i-") ? name.slice(2) : name;
191
+ const size = this.getAttribute("size");
192
+ const label = this.getAttribute("label");
193
+ this.innerHTML = "";
194
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
195
+ svg.setAttribute("class", "c-icon");
196
+ svg.setAttribute("aria-hidden", "true");
197
+ if (size) svg.style.width = size, svg.style.height = size;
198
+ const use = document.createElementNS("http://www.w3.org/2000/svg", "use");
199
+ use.setAttribute("href", "#i-" + iconName);
200
+ svg.appendChild(use);
201
+ this.appendChild(svg);
202
+ if (label) { this.setAttribute("role", "img"); this.setAttribute("aria-label", label); }
203
+ else { this.removeAttribute("role"); this.removeAttribute("aria-label"); }
204
+ }
205
+ }
206
+ define("contour-icon", ContourIcon);
207
+
208
+ // Dashboard grid: layout primitive for responsive grid of widget cells.
209
+ class ContourDashboardGrid extends ContourBase {
210
+ static get observed() { return ["cols", "gap"]; }
211
+ static get properties() { return { cols: { attribute: "cols" }, gap: { attribute: "gap" } }; }
212
+ render() {
213
+ this.classList.add("c-dashboard-grid");
214
+ const cols = this.getAttribute("cols");
215
+ if (cols) this.style.setProperty("--dashboard-grid-cols", cols);
216
+ const gap = this.getAttribute("gap");
217
+ if (gap) this.style.setProperty("--dashboard-grid-gap", gap);
218
+ }
219
+ }
220
+ define("contour-dashboard-grid", ContourDashboardGrid);
221
+
222
+ // Analysis stack: vertical stack of panels with shared header.
223
+ class ContourAnalysisStack extends ContourBase {
224
+ static get observed() { return ["title", "heading"]; }
225
+ static get properties() { return { title: { attribute: "title" }, heading: { attribute: "heading" } }; }
226
+ render() {
227
+ this.classList.add("c-analysis-stack");
228
+ const title = this.getAttribute("title");
229
+ let header = this.querySelector(".c-analysis-stack__header");
230
+ if (title) {
231
+ if (!header) { header = document.createElement("div"); header.className = "c-analysis-stack__header"; this.prepend(header); }
232
+ let h = header.querySelector(".c-analysis-stack__title");
233
+ if (!h) { h = document.createElement(headingTag(this, "h3")); h.className = "c-analysis-stack__title"; header.appendChild(h); }
234
+ h.textContent = title;
235
+ } else if (header) header.remove();
236
+ }
237
+ }
238
+ define("contour-analysis-stack", ContourAnalysisStack);