contour-ds 1.8.1 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/README.md +227 -378
  2. package/dist/agent-cookbook.json +960 -0
  3. package/dist/agent-examples.json +65 -0
  4. package/dist/agent-map-wiring.json +152 -0
  5. package/dist/build-manifest.json +320 -179
  6. package/dist/contour-wc-content.esm.js +479 -3665
  7. package/dist/contour-wc-content.esm.min.js +1 -1
  8. package/dist/contour-wc-core.esm.js +3724 -0
  9. package/dist/contour-wc-core.esm.min.js +1 -0
  10. package/dist/contour-wc-dashboard.esm.js +2713 -4381
  11. package/dist/contour-wc-dashboard.esm.min.js +1 -1
  12. package/dist/contour-wc-data.esm.js +2658 -4346
  13. package/dist/contour-wc-data.esm.min.js +1 -1
  14. package/dist/contour-wc-docs.esm.js +218 -3547
  15. package/dist/contour-wc-docs.esm.min.js +1 -1
  16. package/dist/contour-wc-feedback.esm.js +483 -3658
  17. package/dist/contour-wc-feedback.esm.min.js +1 -1
  18. package/dist/contour-wc-forms.esm.js +503 -3754
  19. package/dist/contour-wc-forms.esm.min.js +1 -1
  20. package/dist/contour-wc-interaction.esm.js +379 -3616
  21. package/dist/contour-wc-interaction.esm.min.js +1 -1
  22. package/dist/contour-wc-layout.esm.js +234 -3563
  23. package/dist/contour-wc-layout.esm.min.js +1 -1
  24. package/dist/contour-wc-map.esm.js +949 -3743
  25. package/dist/contour-wc-map.esm.min.js +1 -1
  26. package/dist/contour-wc-misc.esm.js +237 -3556
  27. package/dist/contour-wc-misc.esm.min.js +1 -1
  28. package/dist/contour-wc-navigation.esm.js +2235 -5237
  29. package/dist/contour-wc-navigation.esm.min.js +1 -1
  30. package/dist/contour-wc-ui.esm.js +4638 -7128
  31. package/dist/contour-wc-ui.esm.min.js +1 -1
  32. package/dist/contour-wc.esm.js +11971 -7727
  33. package/dist/contour-wc.esm.min.js +1 -1
  34. package/dist/contour-wc.js +11971 -7727
  35. package/dist/contour-wc.min.js +1 -1
  36. package/dist/contour.a11y.json +402 -0
  37. package/dist/contour.code-snippets +96 -74
  38. package/dist/contour.components.json +2591 -741
  39. package/dist/contour.css +2624 -1888
  40. package/dist/contour.d.ts +421 -228
  41. package/dist/contour.esm.js +433 -18
  42. package/dist/contour.esm.min.js +1 -1
  43. package/dist/contour.html-data.json +1231 -199
  44. package/dist/contour.js +433 -18
  45. package/dist/contour.min.css +1 -1
  46. package/dist/contour.min.js +1 -1
  47. package/dist/contour.react.d.ts +100 -98
  48. package/dist/contour.single.html +2 -2
  49. package/dist/contour.single.min.css +1 -1
  50. package/dist/contour.themes.json +56 -12
  51. package/dist/contour.tokens.json +482 -255
  52. package/dist/contour.vue.d.ts +100 -98
  53. package/dist/contour.web-types.json +1226 -226
  54. package/dist/custom-elements.json +7649 -2237
  55. package/dist/docs/actions.md +15 -6
  56. package/dist/docs/affordances.md +18 -96
  57. package/dist/docs/apireference.md +9 -5
  58. package/dist/docs/colour.md +10 -4
  59. package/dist/docs/componentindex.md +9 -26
  60. package/dist/docs/data.md +36 -60
  61. package/dist/docs/docs.md +10 -12
  62. package/dist/docs/feedback.md +30 -12
  63. package/dist/docs/field.md +28 -13
  64. package/dist/docs/forms.md +35 -19
  65. package/dist/docs/index.json +63 -56
  66. package/dist/docs/install.md +12 -7
  67. package/dist/docs/landing.md +7 -4
  68. package/dist/docs/mapengine.md +18 -13
  69. package/dist/docs/motion.md +12 -6
  70. package/dist/docs/navigation.md +31 -7
  71. package/dist/docs/overlays.md +32 -25
  72. package/dist/docs/overview.md +3 -2
  73. package/dist/docs/patterns.md +19 -9
  74. package/dist/docs/playground.md +9 -22
  75. package/dist/docs/principles.md +8 -6
  76. package/dist/docs/recipes.md +113 -14
  77. package/dist/docs/space.md +10 -6
  78. package/dist/docs/status.md +12 -25
  79. package/dist/docs/surfaces.md +17 -22
  80. package/dist/docs/theming.md +18 -32
  81. package/dist/docs/type.md +12 -5
  82. package/dist/docs/webcomponents.md +66 -38
  83. package/dist/hljs.css +1 -20
  84. package/dist/map-chrome.mapbox.css +68 -92
  85. package/dist/map-chrome.maplibre.css +68 -92
  86. package/dist/registry/items/contour-core.json +2 -2
  87. package/dist/registry/items/contour-data.json +2 -2
  88. package/dist/registry/items/contour-docs.json +2 -2
  89. package/dist/registry/items/contour-landing.json +2 -2
  90. package/dist/registry/registry.json +8 -8
  91. package/dist/surfaces/contour-core.min.css +1 -1
  92. package/dist/surfaces/contour-data.min.css +1 -1
  93. package/dist/surfaces/contour-docs.min.css +1 -1
  94. package/dist/surfaces/contour-landing.min.css +1 -1
  95. package/dist/svg/icons.svg +367 -0
  96. package/dist/wc/behaviours.mjs +190 -148
  97. package/dist/wc/content.mjs +273 -129
  98. package/dist/wc/core.mjs +598 -395
  99. package/dist/wc/dashboard.mjs +64 -44
  100. package/dist/wc/data-chart.mjs +1333 -0
  101. package/dist/wc/data-export.mjs +391 -0
  102. package/dist/wc/data-gauge.mjs +779 -0
  103. package/dist/wc/data-geo.mjs +696 -0
  104. package/dist/wc/data-glyphs.mjs +133 -0
  105. package/dist/wc/data-legend.mjs +431 -0
  106. package/dist/wc/data-readout.mjs +227 -0
  107. package/dist/wc/data-series.mjs +1004 -0
  108. package/dist/wc/data-table.mjs +751 -0
  109. package/dist/wc/data.mjs +15 -4322
  110. package/dist/wc/docs.mjs +12 -11
  111. package/dist/wc/feedback.mjs +277 -122
  112. package/dist/wc/forms-controls.mjs +635 -0
  113. package/dist/wc/forms-field.mjs +547 -0
  114. package/dist/wc/forms-groups.mjs +347 -0
  115. package/dist/wc/forms-input.mjs +292 -0
  116. package/dist/wc/forms.mjs +10 -1751
  117. package/dist/wc/glyph.mjs +204 -0
  118. package/dist/wc/index.mjs +11 -9
  119. package/dist/wc/interaction.mjs +173 -80
  120. package/dist/wc/layout.mjs +28 -27
  121. package/dist/wc/map.mjs +743 -207
  122. package/dist/wc/misc.mjs +31 -20
  123. package/dist/wc/navigation-menu.mjs +735 -0
  124. package/dist/wc/navigation-shell.mjs +495 -0
  125. package/dist/wc/navigation-tree.mjs +995 -0
  126. package/dist/wc/navigation.mjs +9 -1905
  127. package/dist/wc/registration.mjs +1 -8
  128. package/dist/wc/shadow.mjs +206 -110
  129. package/dist/wc/states.mjs +54 -75
  130. package/dist/wc/svg.mjs +118 -47
  131. package/dist/wc/ui-atoms.mjs +608 -0
  132. package/dist/wc/ui-data.mjs +1404 -0
  133. package/dist/wc/ui-feedback.mjs +419 -0
  134. package/dist/wc/ui-inputs.mjs +1570 -0
  135. package/dist/wc/ui-menus.mjs +307 -0
  136. package/dist/wc/ui-overlays.mjs +1605 -0
  137. package/integrations/README.md +23 -5
  138. package/integrations/ai/CLAUDE.md +3 -0
  139. package/integrations/ai/COPILOT.md +14 -0
  140. package/integrations/ai/GEMINI.md +14 -0
  141. package/integrations/ai/WINDSURF.md +14 -0
  142. package/integrations/ai/v0-prompt.md +13 -1
  143. package/integrations/native/README.md +0 -3
  144. package/integrations/tailwind/contour-theme.css +66 -7
  145. package/integrations/validate-markup.mjs +172 -0
  146. package/package.json +77 -42
  147. package/dist/wc/ui.mjs +0 -5072
@@ -0,0 +1,608 @@
1
+ import { setHTML, ContourBase, define, contourId, onDispose, navKey, safeColor, safeHref, cssLength , warnBadJson, labelText, flagOn, formatValue, wcEmitOverlay } from './core.mjs';
2
+ import { wireRemovable, modalContain } from './behaviours.mjs';
3
+ import { parseArrayAttr, renderEmpty } from './states.mjs';
4
+
5
+ /**
6
+ * Avatar: a circular avatar with initials (from `name`) or an image (`src`),
7
+ * optional size/variant modifiers and a status dot. Attributes: `name`, `size`,
8
+ * `variant`, `src`, `status`.
9
+ */
10
+ class ContourAvatar extends ContourBase {
11
+ static get observed() { return ["name", "size", "variant", "src", "status"]; }
12
+ static get properties() { return { name: { attribute: "name" }, size: { attribute: "size" }, variant: { attribute: "variant" }, src: { attribute: "src" }, status: { attribute: "status" } }; }
13
+ render() {
14
+ this.classList.add("c-avatar");
15
+ Array.from(this.classList).forEach((c) => { if (c.startsWith("c-avatar--")) this.classList.remove(c); });
16
+ const name = this.getAttribute("name");
17
+ const size = this.getAttribute("size");
18
+ if (size) this.classList.add("c-avatar--" + size);
19
+ const variant = this.getAttribute("variant");
20
+ if (variant) this.classList.add("c-avatar--" + variant);
21
+ const oldImg = this.querySelector("img.c-avatar__img");
22
+ if (oldImg) oldImg.remove();
23
+ const oldDot = this.querySelector(".c-avatar__status");
24
+ if (oldDot) oldDot.remove();
25
+ const src = this.getAttribute("src");
26
+ if (src) {
27
+ this.textContent = "";
28
+ const img = document.createElement("img");
29
+ img.className = "c-avatar__img";
30
+ img.src = src;
31
+ img.alt = name || "";
32
+ img.loading = "lazy";
33
+ img.decoding = "async";
34
+ img.addEventListener("error", () => {
35
+ img.remove();
36
+ if (name) {
37
+ const initials = name.split(" ").map((w) => w[0]).join("").toUpperCase().slice(0, 2);
38
+ this.textContent = initials;
39
+ }
40
+ });
41
+ this.appendChild(img);
42
+ } else if (name) {
43
+ const initials = name.split(" ").map((w) => w[0]).join("").toUpperCase().slice(0, 2);
44
+ if (!this.querySelector("img.c-avatar__img")) {
45
+ }
46
+ this.textContent = initials;
47
+ }
48
+ const status = this.getAttribute("status");
49
+ if (status) {
50
+ const dot = document.createElement("span");
51
+ dot.className = "c-avatar__status c-avatar__status--" + status;
52
+ dot.setAttribute("aria-hidden", "true");
53
+ this.appendChild(dot);
54
+ }
55
+ }
56
+ }
57
+ define("contour-avatar", ContourAvatar);
58
+ /**
59
+ * Badge: a small status label with variant/size modifiers and an optional
60
+ * removable (×) button. Attributes: `variant`, `label`, `size`, `removable`.
61
+ */
62
+ class ContourBadgeFull extends ContourBase {
63
+ static get observed() { return ["variant", "label", "size", "removable"]; }
64
+ static get properties() { return { variant: { attribute: "variant" }, label: { attribute: "label" }, size: { attribute: "size" }, removable: { attribute: "removable", type: Boolean } }; }
65
+ render() {
66
+ this.classList.add("c-badge");
67
+ Array.from(this.classList).forEach((c) => { if (c.startsWith("c-badge--")) this.classList.remove(c); });
68
+ const variant = this.getAttribute("variant");
69
+ if (variant) this.classList.add("c-badge--" + variant);
70
+ const size = this.getAttribute("size");
71
+ if (size) this.classList.add("c-badge--" + size);
72
+ const label = this.getAttribute("label");
73
+ if (label) {
74
+ let textNode = null;
75
+ for (const n of this.childNodes) { if (n.nodeType === 3) { textNode = n; break; } }
76
+ if (textNode) textNode.nodeValue = label;
77
+ else this.insertBefore(document.createTextNode(label), this.firstChild);
78
+ }
79
+ if (flagOn(this, "removable")) {
80
+ this.ensure(".c-badge__remove", () => {
81
+ const btn = document.createElement("button");
82
+ btn.className = "c-badge__remove";
83
+ btn.type = "button";
84
+ btn.setAttribute("aria-label", labelText(this, "remove", "Remove"));
85
+ btn.textContent = "×";
86
+ return btn;
87
+ });
88
+ } else {
89
+ const btn = this.querySelector(".c-badge__remove");
90
+ if (btn) btn.remove();
91
+ }
92
+ }
93
+ enhance() {
94
+ wireRemovable(this);
95
+ }
96
+ }
97
+ define("contour-badge", ContourBadgeFull);
98
+ /**
99
+ * Chip: a compact status pill with `key`/`value` text and a variant modifier.
100
+ * Attributes: `variant`, `key`, `value`.
101
+ */
102
+ class ContourChipFull extends ContourBase {
103
+ static get observed() { return ["variant", "key", "value", "live"]; }
104
+ static get properties() { return { variant: { attribute: "variant" }, key: { attribute: "key" }, value: { attribute: "value" }, live: { attribute: "live", type: Boolean } }; }
105
+ render() {
106
+ this.classList.add("c-chip");
107
+ if (flagOn(this, "live") && !this.hasAttribute("role")) this.setAttribute("role", "status");
108
+ else if (!flagOn(this, "live") && this.getAttribute("role") === "status" && this._autoChipRole) this.removeAttribute("role");
109
+ this._autoChipRole = flagOn(this, "live");
110
+ Array.from(this.classList).forEach((c) => { if (c.startsWith("c-chip--")) this.classList.remove(c); });
111
+ const variant = this.getAttribute("variant");
112
+ if (variant) this.classList.add("c-chip--" + variant);
113
+ const key = this.getAttribute("key");
114
+ const value = this.getAttribute("value");
115
+ if (key) {
116
+ const k = this.ensure(".c-chip__key", () => { const el = document.createElement("span"); el.className = "c-chip__key"; return el; });
117
+ k.textContent = key;
118
+ } else {
119
+ const k = this.querySelector(".c-chip__key");
120
+ if (k) k.remove();
121
+ }
122
+ if (value) {
123
+ const v = this.ensure(".c-chip__value", () => { const el = document.createElement("span"); el.className = "c-chip__value"; return el; });
124
+ v.textContent = value;
125
+ } else {
126
+ const v = this.querySelector(".c-chip__value");
127
+ if (v) v.remove();
128
+ }
129
+ }
130
+ }
131
+ define("contour-chip", ContourChipFull);
132
+ /**
133
+ * Tag: a removable status label with a variant modifier. Attributes: `label`,
134
+ * `removable`, `variant`.
135
+ */
136
+ class ContourTag extends ContourBase {
137
+ static get observed() { return ["label", "removable", "variant", "live"]; }
138
+ static get properties() { return { label: { attribute: "label" }, removable: { attribute: "removable", type: Boolean }, variant: { attribute: "variant" }, live: { attribute: "live", type: Boolean } }; }
139
+ render() {
140
+ this.classList.add("c-tag");
141
+ if (flagOn(this, "live") && !this.hasAttribute("role")) this.setAttribute("role", "status");
142
+ else if (!flagOn(this, "live") && this.getAttribute("role") === "status" && this._autoTagRole) this.removeAttribute("role");
143
+ this._autoTagRole = flagOn(this, "live");
144
+ Array.from(this.classList).forEach((c) => { if (c.startsWith("c-tag--")) this.classList.remove(c); });
145
+ const variant = this.getAttribute("variant");
146
+ if (variant) this.classList.add("c-tag--" + variant);
147
+ const label = this.getAttribute("label");
148
+ if (label) {
149
+ let textNode = null;
150
+ for (const n of this.childNodes) {
151
+ if (n.nodeType === 3) { textNode = n; break; }
152
+ }
153
+ if (textNode) textNode.nodeValue = label + " ";
154
+ else this.insertBefore(document.createTextNode(label + " "), this.firstChild);
155
+ }
156
+ if (flagOn(this, "removable")) {
157
+ this.ensure(".c-tag__remove", () => {
158
+ const btn = document.createElement("button");
159
+ btn.className = "c-tag__remove";
160
+ btn.type = "button";
161
+ btn.setAttribute("aria-label", labelText(this, "remove", "Remove"));
162
+ btn.textContent = "×";
163
+ return btn;
164
+ });
165
+ } else {
166
+ const btn = this.querySelector(".c-tag__remove");
167
+ if (btn) btn.remove();
168
+ }
169
+ }
170
+ enhance() {
171
+ wireRemovable(this);
172
+ }
173
+ }
174
+ define("contour-tag", ContourTag);
175
+ /**
176
+ * Dot: a small status indicator with variant and live states. Attributes:
177
+ * `variant`, `live`.
178
+ */
179
+ class ContourDot extends ContourBase {
180
+ static get observed() { return ["variant", "live"]; }
181
+ static get properties() { return { variant: { attribute: "variant" }, live: { attribute: "live", type: Boolean } }; }
182
+ render() {
183
+ this.classList.add("c-dot");
184
+ if (!this.hasAttribute("role")) this.setAttribute("role", "img");
185
+ if (!this.hasAttribute("aria-label")) this.setAttribute("aria-label", "status indicator");
186
+ Array.from(this.classList).forEach((c) => { if (c.startsWith("c-dot--")) this.classList.remove(c); });
187
+ const variant = this.getAttribute("variant");
188
+ if (variant) this.classList.add("c-dot--" + variant);
189
+ if (flagOn(this, "live")) this.classList.add("c-dot--live"); else this.classList.remove("c-dot--live");
190
+ }
191
+ }
192
+ define("contour-dot", ContourDot);
193
+ /**
194
+ * Pill: a rounded status label with live state and variant modifier.
195
+ * Attributes: `label`, `live`, `variant`.
196
+ */
197
+ class ContourPill extends ContourBase {
198
+ static get observed() { return ["label", "live", "variant"]; }
199
+ static get properties() { return { label: { attribute: "label" }, live: { attribute: "live", type: Boolean }, variant: { attribute: "variant" } }; }
200
+ render() {
201
+ this.classList.add("c-pill");
202
+ if (flagOn(this, "live") && !this.hasAttribute("role")) this.setAttribute("role", "status");
203
+ else if (!flagOn(this, "live") && this.getAttribute("role") === "status" && this._autoPillRole) this.removeAttribute("role");
204
+ this._autoPillRole = flagOn(this, "live");
205
+ Array.from(this.classList).forEach((c) => { if (c.startsWith("c-pill--")) this.classList.remove(c); });
206
+ const variant = this.getAttribute("variant");
207
+ if (variant) this.classList.add("c-pill--" + variant);
208
+ const label = this.getAttribute("label");
209
+ if (label) {
210
+ this.textContent = label;
211
+ }
212
+ if (flagOn(this, "live")) this.classList.add("c-pill--live"); else this.classList.remove("c-pill--live");
213
+ }
214
+ }
215
+ define("contour-pill", ContourPill);
216
+ /**
217
+ * Kbd: a keyboard key display. Attribute: `key`.
218
+ */
219
+ class ContourKbd extends ContourBase {
220
+ static get observed() { return ["key"]; }
221
+ static get properties() { return { key: { attribute: "key" } }; }
222
+ render() {
223
+ this.classList.add("c-kbd");
224
+ const key = this.getAttribute("key");
225
+ if (key) {
226
+ this.textContent = key;
227
+ }
228
+ }
229
+ }
230
+ define("contour-kbd", ContourKbd);
231
+ /**
232
+ * Spinner: a loading indicator with size modifier. Attribute: `size`.
233
+ */
234
+ class ContourSpinner extends ContourBase {
235
+ static get observed() { return ["size"]; }
236
+ static get properties() { return { size: { attribute: "size" } }; }
237
+ render() {
238
+ this.classList.add("c-spinner");
239
+ Array.from(this.classList).forEach((c) => { if (c.startsWith("c-spinner--")) this.classList.remove(c); });
240
+ const size = this.getAttribute("size");
241
+ if (size) this.classList.add("c-spinner--" + size);
242
+ if (!this.hasAttribute("role")) this.setAttribute("role", "status");
243
+ if (!this.hasAttribute("aria-label")) this.setAttribute("aria-label", labelText(this, "loading", "Loading"));
244
+ }
245
+ }
246
+ define("contour-spinner", ContourSpinner);
247
+ /**
248
+ * Skeleton: a loading placeholder with size and shimmer options. Attributes:
249
+ * `size`, `shimmer`.
250
+ */
251
+ class ContourSkeleton extends ContourBase {
252
+ static get observed() { return ["size", "shimmer"]; }
253
+ static get properties() { return { size: { attribute: "size" }, shimmer: { attribute: "shimmer", type: Boolean } }; }
254
+ render() {
255
+ this.classList.add("c-skeleton");
256
+ Array.from(this.classList).forEach((c) => { if (c.startsWith("c-skeleton--")) this.classList.remove(c); });
257
+ const size = this.getAttribute("size");
258
+ if (size) this.classList.add("c-skeleton--" + size);
259
+ if (!this.hasAttribute("aria-hidden")) this.setAttribute("aria-hidden", "true");
260
+ const shimmer = this.getAttribute("shimmer");
261
+ if (!flagOn(this, "shimmer") || shimmer === "off") this.classList.add("c-skeleton--static");
262
+ else this.classList.remove("c-skeleton--static");
263
+ }
264
+ }
265
+ define("contour-skeleton", ContourSkeleton);
266
+ /**
267
+ * Mark: a highlighted text marker. No attributes.
268
+ */
269
+ class ContourMark extends ContourBase {
270
+ static get observed() { return ["src", "icon", "label"]; }
271
+ static get properties() { return { src: { attribute: "src" }, icon: { attribute: "icon" }, label: { attribute: "label" } }; }
272
+ render() {
273
+ this.classList.add("c-mark");
274
+ // Span-vs-SVG boundary: inline when wrapping SVG, block when standalone; inline-grid keeps it inline-level.
275
+ const src = this.getAttribute("src") || this.getAttribute("icon");
276
+ if (src) {
277
+ // SVG namespace required; createElement("svg") makes HTMLUnknownElement whose <use> never resolves.
278
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
279
+ svg.setAttribute("aria-hidden", "true");
280
+ setHTML(svg, '<use href="' + safeHref(src) + '" />');
281
+ this.appendChild(svg);
282
+ }
283
+ const label = this.getAttribute("label");
284
+ if (label && !this.querySelector("[data-mark-label]")) {
285
+ const span = document.createElement("span");
286
+ span.className = "c-mark__label";
287
+ span.setAttribute("data-mark-label", "");
288
+ span.textContent = label;
289
+ this.appendChild(span);
290
+ }
291
+ }
292
+ }
293
+ define("contour-mark", ContourMark);
294
+ /**
295
+ * Loading: a spinner wrapped in a container. No attributes.
296
+ */
297
+ class ContourLoading extends ContourBase {
298
+ static get observed() { return ["label"]; }
299
+ static get properties() { return { label: { attribute: "label" } }; }
300
+ render() {
301
+ this.classList.add("c-loading");
302
+ if (!this.hasAttribute("role")) this.setAttribute("role", "status");
303
+ if (!this.hasAttribute("aria-live")) this.setAttribute("aria-live", "polite");
304
+ this.ensure(".c-spinner", () => { const el = document.createElement("span"); el.className = "c-spinner"; el.setAttribute("aria-hidden", "true"); return el; });
305
+ // Status region needs a label to announce; visually hidden keeps spinner visual.
306
+ const label = this.getAttribute("label") || "Loading";
307
+ let text = this.querySelector("[data-loading-label]");
308
+ if (!text) { text = document.createElement("span"); text.className = "visually-hidden"; text.setAttribute("data-loading-label", ""); this.appendChild(text); }
309
+ text.textContent = label;
310
+ if (!this.hasAttribute("aria-label")) this.setAttribute("aria-label", label);
311
+ }
312
+ }
313
+ define("contour-loading", ContourLoading);
314
+ /**
315
+ * Elevation: a single step of the elevation ramp (`.c-elevation` carries
316
+ * `--shadow-md`). Raises the surface it is given. No attributes.
317
+ */
318
+ class ContourElevation extends ContourBase {
319
+ render() {
320
+ // .c-elevation carries --shadow-md (one ramp step); this raises the surface and stops.
321
+ this.classList.add("c-elevation");
322
+ }
323
+ }
324
+ define("contour-elevation", ContourElevation);
325
+ /**
326
+ * FilterPill: a key/value filter chip with an optional remove button.
327
+ * Attributes: `key`, `value`, `removable`.
328
+ */
329
+ class ContourFilterPill extends ContourBase {
330
+ static get observed() { return ["key", "value", "removable"]; }
331
+ static get properties() { return { key: { attribute: "key" }, value: { attribute: "value" }, removable: { attribute: "removable", type: Boolean } }; }
332
+ render() {
333
+ this.classList.add("c-filter-pill");
334
+ const key = this.getAttribute("key");
335
+ const value = this.getAttribute("value");
336
+ if (key) {
337
+ const k = this.ensure(".c-filter-pill__key", () => { const el = document.createElement("span"); el.className = "c-filter-pill__key"; return el; });
338
+ k.textContent = key;
339
+ } else {
340
+ const k = this.querySelector(".c-filter-pill__key");
341
+ if (k) k.remove();
342
+ }
343
+ if (value) {
344
+ const v = this.ensure(".c-filter-pill__value", () => { const el = document.createElement("span"); el.className = "c-filter-pill__value"; return el; });
345
+ v.textContent = value;
346
+ } else {
347
+ const v = this.querySelector(".c-filter-pill__value");
348
+ if (v) v.remove();
349
+ }
350
+ if (flagOn(this, "removable")) {
351
+ this.ensure(".c-filter-pill__remove", () => {
352
+ const btn = document.createElement("button");
353
+ btn.className = "c-filter-pill__remove";
354
+ btn.type = "button";
355
+ btn.setAttribute("aria-label", labelText(this, "remove-filter", "Remove filter"));
356
+ btn.textContent = "×";
357
+ return btn;
358
+ });
359
+ } else {
360
+ const btn = this.querySelector(".c-filter-pill__remove");
361
+ if (btn) btn.remove();
362
+ }
363
+ }
364
+ enhance() {
365
+ // Interaction in behaviours.mjs (shared with shadow wrappers) so layers can't drift.
366
+ wireRemovable(this);
367
+ }
368
+ }
369
+ define("contour-filter-pill", ContourFilterPill);
370
+ /**
371
+ * Datamark: a data value display with optional unit and label. Attributes:
372
+ * `value`, `unit`, `label`, `format`, `locale`.
373
+ */
374
+ class ContourDatamark extends ContourBase {
375
+ static get observed() { return ["value", "unit", "label", "format", "locale"]; }
376
+ static get properties() { return { value: { attribute: "value" }, unit: { attribute: "unit" }, label: { attribute: "label" }, format: { attribute: "format" }, locale: { attribute: "locale" } }; }
377
+ render() {
378
+ this.classList.add("c-datamark");
379
+ // Guide sets value on this element; read value, not only label.
380
+ const value = this.getAttribute("value");
381
+ const unit = this.getAttribute("unit");
382
+ const label = this.getAttribute("label");
383
+ const format = this.getAttribute("format");
384
+ const locale = this.getAttribute("locale");
385
+ const text = value || label;
386
+ if (text) {
387
+ const formatted = value ? formatValue(value, format, locale, unit) : text;
388
+ this.textContent = formatted;
389
+ if (unit && value) {
390
+ const u = document.createElement("span");
391
+ u.className = "u-subtle";
392
+ u.textContent = " " + unit;
393
+ this.appendChild(u);
394
+ }
395
+ }
396
+ }
397
+ }
398
+ define("contour-datamark", ContourDatamark);
399
+ /**
400
+ * DestructiveHint: a text hint for destructive actions. Attribute: `text`.
401
+ */
402
+ class ContourDestructiveHint extends ContourBase {
403
+ static get observed() { return ["text"]; }
404
+ static get properties() { return { text: { attribute: "text" } }; }
405
+ render() {
406
+ this.classList.add("c-destructive-hint");
407
+ const text = this.getAttribute("text");
408
+ if (text) this.textContent = text;
409
+ }
410
+ }
411
+ define("contour-destructive-hint", ContourDestructiveHint);
412
+ /**
413
+ * IconBadge: an icon from the sprite (i-* convention) with a warning if the
414
+ * name doesn't match. Attribute: `icon`.
415
+ */
416
+ class ContourIconBadge extends ContourBase {
417
+ static get observed() { return ["icon"]; }
418
+ static get properties() { return { icon: { attribute: "icon" } }; }
419
+ render() {
420
+ this.classList.add("c-icon-badge");
421
+ const icon = this.getAttribute("icon");
422
+ if (icon) {
423
+ const sanitized = String(icon).replace(/[^a-zA-Z0-9_-]/g, "");
424
+ if (sanitized && !sanitized.startsWith("i-")) {
425
+ // Warn if icon name doesn't follow i-* convention.
426
+ if (typeof console !== "undefined" && console.warn) {
427
+ console.warn("ContourIconBadge: icon '" + icon + "' may not exist in the sprite (expected i-* name).");
428
+ }
429
+ }
430
+ const existing = this.querySelector("svg");
431
+ const svg = existing || document.createElementNS("http://www.w3.org/2000/svg", "svg");
432
+ if (!existing) {
433
+ svg.setAttribute("aria-hidden", "true");
434
+ const use = document.createElementNS("http://www.w3.org/2000/svg", "use");
435
+ use.setAttribute("href", "#" + sanitized);
436
+ svg.appendChild(use);
437
+ this.appendChild(svg);
438
+ } else {
439
+ const use = svg.querySelector("use");
440
+ if (use) use.setAttribute("href", "#" + sanitized);
441
+ }
442
+ } else {
443
+ const svg = this.querySelector("svg");
444
+ if (svg) svg.remove();
445
+ }
446
+ }
447
+ }
448
+ define("contour-icon-badge", ContourIconBadge);
449
+ /**
450
+ * LiveBadge: a connection status badge with state/live modifiers and label.
451
+ * Attributes: `label`, `state`, `live`.
452
+ */
453
+ class ContourLiveBadge extends ContourBase {
454
+ static get observed() { return ["label", "state", "live"]; }
455
+ static get properties() { return { label: { attribute: "label" }, state: { attribute: "state" }, live: { attribute: "live", type: Boolean } }; }
456
+ render() {
457
+ this.classList.add("c-live-badge");
458
+ if (!this.hasAttribute("role")) this.setAttribute("role", "status");
459
+ // Remove previous state modifiers.
460
+ Array.from(this.classList).forEach((c) => { if (c.startsWith("c-live-badge--")) this.classList.remove(c); });
461
+ const state = this.getAttribute("state");
462
+ if (state) {
463
+ this.classList.add("c-live-badge--" + state);
464
+ } else if (flagOn(this, "live")) {
465
+ this.classList.add("c-live-badge--connected");
466
+ }
467
+ const label = this.getAttribute("label");
468
+ if (label && !this.hasChildNodes()) this.textContent = label;
469
+ }
470
+ }
471
+ define("contour-live-badge", ContourLiveBadge);
472
+
473
+ /**
474
+ * SkeletonGroup: a group of N skeleton placeholders. Attributes: `count`, `size`, `shimmer`.
475
+ */
476
+ class ContourSkeletonGroup extends ContourBase {
477
+ static get observed() { return ["count", "size", "shimmer"]; }
478
+ static get properties() { return { count: { attribute: "count", type: Number }, size: { attribute: "size" }, shimmer: { attribute: "shimmer", type: Boolean } }; }
479
+ render() {
480
+ this.classList.add("c-skeleton-group");
481
+ const count = Math.max(0, parseInt(this.getAttribute("count") || "3", 10) || 3);
482
+ const size = this.getAttribute("size");
483
+ const shimmer = this.getAttribute("shimmer");
484
+ Array.from(this.querySelectorAll(".c-skeleton")).forEach((n) => n.remove());
485
+ for (let i = 0; i < count; i++) {
486
+ const sk = document.createElement("div");
487
+ sk.className = "c-skeleton";
488
+ if (size) sk.classList.add("c-skeleton--" + size);
489
+ // Same rule as contour-skeleton: placeholder is decorative, aria-hidden avoids noise.
490
+ sk.setAttribute("aria-hidden", "true");
491
+ if (!flagOn(this, "shimmer") || shimmer === "off") sk.classList.add("c-skeleton--static");
492
+ else sk.classList.remove("c-skeleton--static");
493
+ this.appendChild(sk);
494
+ }
495
+ }
496
+ }
497
+ define("contour-skeleton-group", ContourSkeletonGroup);
498
+ /**
499
+ * Avatar Group: web component wrapper.
500
+ * Attributes: `items`, `max`.
501
+ */
502
+ class ContourAvatarGroup extends ContourBase {
503
+ static get observed() { return ["items", "max"]; }
504
+ static get properties() { return { items: { attribute: "items" }, max: { attribute: "max", type: Number } }; }
505
+ render() {
506
+ this.classList.add("c-avatar-group");
507
+ const items = this.getAttribute("items");
508
+ const max = parseInt(this.getAttribute("max") || "4", 10) || 4;
509
+ Array.from(this.querySelectorAll(".c-avatar, .c-avatar-group__overflow")).forEach((n) => n.remove());
510
+ if (items) {
511
+ try {
512
+ const parsed = JSON.parse(items);
513
+ const shown = parsed.slice(0, max);
514
+ shown.forEach((it) => {
515
+ const av = document.createElement("span");
516
+ av.className = "c-avatar";
517
+ const name = typeof it === "string" ? it : (it.name || it.label || "");
518
+ // Match ContourAvatar: initials = first letter of each word ("David Ross" → "DR", not "DA").
519
+ av.textContent = name.split(" ").map((w) => w[0]).join("").toUpperCase().slice(0, 2);
520
+ if (typeof it === "object" && it.color) {
521
+ const safe = safeColor(it.color);
522
+ if (safe) { av.style.background = safe; av.dataset.color = safe; }
523
+ }
524
+ this.appendChild(av);
525
+ });
526
+ if (parsed.length > max) {
527
+ const overflow = document.createElement("span");
528
+ overflow.className = "c-avatar c-avatar-group__overflow";
529
+ const overCount = parsed.length - max;
530
+ overflow.textContent = "+" + overCount;
531
+ overflow.setAttribute("aria-label", "+" + overCount + " more");
532
+ this.appendChild(overflow);
533
+ }
534
+ } catch (e) { warnBadJson(this, "attribute", e); }
535
+ }
536
+ }
537
+ }
538
+ define("contour-avatar-group", ContourAvatarGroup);
539
+
540
+ /**
541
+ * Divider: web component wrapper.
542
+ * Attributes: `label`, `orientation`.
543
+ */
544
+ class ContourDivider extends ContourBase {
545
+ static get observed() { return ["label", "orientation"]; }
546
+ static get properties() { return { label: { attribute: "label" }, orientation: { attribute: "orientation" } }; }
547
+ render() {
548
+ this.classList.add("c-divider");
549
+ if (!this.hasAttribute("role")) this.setAttribute("role", "separator");
550
+ const orientation = this.getAttribute("orientation") || "horizontal";
551
+ this.classList.add("c-divider--" + orientation);
552
+ const label = this.getAttribute("label");
553
+ if (label) {
554
+ const l = this.ensure(".c-divider__label", () => { const el = document.createElement("span"); el.className = "c-divider__label"; return el; });
555
+ l.textContent = label;
556
+ }
557
+ }
558
+ }
559
+ define("contour-divider", ContourDivider);
560
+
561
+ /**
562
+ * Status Light: web component wrapper.
563
+ * Attributes: `status`, `label`.
564
+ */
565
+ class ContourStatusLight extends ContourBase {
566
+ static get observed() { return ["status", "label"]; }
567
+ static get properties() { return { status: { attribute: "status" }, label: { attribute: "label" } }; }
568
+ render() {
569
+ this.classList.add("c-status-light");
570
+ const status = this.getAttribute("status") || "neutral";
571
+ this.classList.add("c-status-light--" + status);
572
+ // Status light is a labelled graphic: role + name so colour isn't only state carrier.
573
+ if (!this.hasAttribute("role")) this.setAttribute("role", "img");
574
+ const label = this.getAttribute("label");
575
+ if (label && !this.hasAttribute("aria-label")) this.setAttribute("aria-label", label);
576
+ else if (!label && !this.hasAttribute("aria-label")) this.setAttribute("aria-label", status);
577
+ if (label) {
578
+ const l = this.ensure(".c-status-light__label", () => { const el = document.createElement("span"); el.className = "c-status-light__label"; return el; });
579
+ l.textContent = label;
580
+ }
581
+ }
582
+ }
583
+ define("contour-status-light", ContourStatusLight);
584
+ /**
585
+ * Badge Overflow: web component wrapper.
586
+ * Attributes: `count`, `max`.
587
+ */
588
+ class ContourBadgeOverflow extends ContourBase {
589
+ static get observed() { return ["count", "max"]; }
590
+ static get properties() { return { count: { attribute: "count" }, max: { attribute: "max" } }; }
591
+ render() {
592
+ this.classList.add("c-badge-overflow");
593
+ const count = Number(this.getAttribute("count") || 0);
594
+ const max = Number(this.getAttribute("max") || 3);
595
+ const extra = Math.max(0, count - max);
596
+ // Keep authored children: the component adds the "+N" overflow badge, it
597
+ // does not replace whatever the author put inside.
598
+ const existing = this.querySelector(".c-badge-overflow__more");
599
+ if (existing) existing.remove();
600
+ if (extra > 0) {
601
+ const b = document.createElement("span");
602
+ b.className = "c-badge c-badge-overflow__more";
603
+ b.textContent = "+" + extra;
604
+ this.appendChild(b);
605
+ }
606
+ }
607
+ }
608
+ define("contour-badge-overflow", ContourBadgeOverflow);