contour-ds 1.1.1 → 1.1.2

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 (52) hide show
  1. package/README.md +1 -1
  2. package/dist/build-manifest.json +37 -37
  3. package/dist/contour-wc.esm.js +315 -39
  4. package/dist/contour-wc.esm.min.js +1 -1
  5. package/dist/contour-wc.js +315 -39
  6. package/dist/contour-wc.min.js +1 -1
  7. package/dist/contour.components.json +38 -18
  8. package/dist/contour.css +15 -1
  9. package/dist/contour.d.ts +1 -0
  10. package/dist/contour.min.css +1 -1
  11. package/dist/contour.themes.json +4 -1
  12. package/dist/contour.tokens.json +3 -0
  13. package/dist/docs/actions.md +1 -1
  14. package/dist/docs/affordances.md +1 -1
  15. package/dist/docs/colour.md +1 -1
  16. package/dist/docs/data.md +1 -1
  17. package/dist/docs/docs.md +1 -1
  18. package/dist/docs/feedback.md +1 -1
  19. package/dist/docs/field.md +1 -1
  20. package/dist/docs/forms.md +1 -1
  21. package/dist/docs/index.json +3 -3
  22. package/dist/docs/install.md +1 -1
  23. package/dist/docs/landing.md +1 -1
  24. package/dist/docs/mapengine.md +1 -1
  25. package/dist/docs/motion.md +1 -1
  26. package/dist/docs/navigation.md +1 -1
  27. package/dist/docs/overlays.md +1 -1
  28. package/dist/docs/overview.md +1 -1
  29. package/dist/docs/patterns.md +1 -1
  30. package/dist/docs/playground.md +1 -1
  31. package/dist/docs/principles.md +1 -1
  32. package/dist/docs/recipes.md +1 -1
  33. package/dist/docs/space.md +1 -1
  34. package/dist/docs/status.md +1 -1
  35. package/dist/docs/surfaces.md +1 -1
  36. package/dist/docs/theming.md +1 -1
  37. package/dist/docs/type.md +1 -1
  38. package/dist/docs/webcomponents.md +1 -1
  39. package/dist/registry/items/contour-core.json +2 -2
  40. package/dist/registry/items/contour-data.json +2 -2
  41. package/dist/registry/items/contour-docs.json +2 -2
  42. package/dist/registry/items/contour-landing.json +2 -2
  43. package/dist/registry/registry.json +8 -8
  44. package/dist/surfaces/contour-core.min.css +1 -1
  45. package/dist/surfaces/contour-data.min.css +1 -1
  46. package/dist/surfaces/contour-docs.min.css +1 -1
  47. package/dist/surfaces/contour-landing.min.css +1 -1
  48. package/dist/wc/core.mjs +7 -0
  49. package/dist/wc/data.mjs +164 -8
  50. package/dist/wc/map.mjs +67 -15
  51. package/dist/wc/ui.mjs +77 -16
  52. package/package.json +1 -1
package/dist/wc/core.mjs CHANGED
@@ -86,6 +86,7 @@
86
86
  "contour:brush-start": { payload: ["value"], composed: true },
87
87
  "contour:brush-end": { payload: ["value"], composed: true },
88
88
  "contour:change": { payload: ["name", "value", "checked"], composed: true },
89
+ "contour:clear": { payload: [], composed: true },
89
90
  "contour:close": { payload: [], composed: true },
90
91
  "contour:copy": { payload: ["text"], composed: true },
91
92
  "contour:dash-action": { payload: ["label"], composed: true },
@@ -122,7 +123,12 @@
122
123
  "contour:remove": { payload: ["label", "key", "layers", "value"], composed: true },
123
124
  "contour:range-change": { payload: ["value"], composed: true },
124
125
  "contour:retry": { payload: ["src"], composed: true },
126
+ "contour:loop-change": { payload: ["loop"], composed: true },
127
+ "contour:pause": { payload: [], composed: true },
128
+ "contour:play": { payload: [], composed: true },
129
+ "contour:seek": { payload: ["progress", "value"], composed: true },
125
130
  "contour:select": { payload: ["series", "index", "label", "value"], composed: true },
131
+ "contour:speed-change": { payload: ["speed"], composed: true },
126
132
  "contour:showcase-activate": { payload: ["title"], composed: true },
127
133
  "contour:step-activate": { payload: ["index", "title"], composed: true },
128
134
  "contour:step-change": { payload: ["index", "title"], composed: true },
@@ -185,6 +191,7 @@
185
191
  "quote", "ramp", "refresh", "removable", "reverse", "rings", "retry", "rows", "scale", "selectable", "segments", "show-header", "sparkline", "start", "end", "threshold", "thresholds", "selected", "separator", "series", "shortcut", "side", "size", "skeleton", "sort", "sort-dir", "speed", "status", "step", "submit", "timeout", "trigger", "virtual",
186
192
  "state", "steps", "subtitle", "summary", "src", "table", "tabs", "tag", "text", "ticks", "title", "type", "unit",
187
193
  "variant", "values", "viewport", "yes", "zoomable", "x", "y",
194
+ "caption", "current-time", "is-playing", "loop-label", "no-data-color", "property", "show-loop", "show-thumb", "show-thumb-caption", "speeds",
188
195
  ];
189
196
 
190
197
  export function headingTag(host, fallback = "h3") {
package/dist/wc/data.mjs CHANGED
@@ -1823,8 +1823,8 @@ class ContourInstrument extends ContourBase {
1823
1823
  }
1824
1824
  define("contour-instrument", ContourInstrument);
1825
1825
  class ContourBivariate extends ContourBase {
1826
- static get observed() { return ["size", "axis-x", "axis-y", "colors"]; }
1827
- static get properties() { return { size: { attribute: "size" }, axisX: { attribute: "axis-x" }, axisY: { attribute: "axis-y" }, colors: { attribute: "colors" } }; }
1826
+ static get observed() { return ["size", "axis-x", "axis-y", "colors", "selected"]; }
1827
+ static get properties() { return { size: { attribute: "size" }, axisX: { attribute: "axis-x" }, axisY: { attribute: "axis-y" }, colors: { attribute: "colors" }, selected: { attribute: "selected" } }; }
1828
1828
  render() {
1829
1829
  this.classList.add("c-bivariate");
1830
1830
  const size = Math.min(12, Math.max(1, parseInt(this.getAttribute("size") || "3", 10) || 3));
@@ -1842,6 +1842,9 @@ class ContourBivariate extends ContourBase {
1842
1842
  for (let c = 0; c < size; c++) {
1843
1843
  const cell = document.createElement("div");
1844
1844
  cell.className = "c-bivariate__cell";
1845
+ cell.setAttribute("role", "button");
1846
+ cell.setAttribute("tabindex", "0");
1847
+ cell.setAttribute("aria-label", "Cell " + c + "," + r);
1845
1848
  // Palette runs from bottom-left (low/low) to top-right (high/high):
1846
1849
  // reverse the row order so the first palette row sits at the bottom.
1847
1850
  const srcIndex = (size - 1 - r) * size + c;
@@ -1849,6 +1852,24 @@ class ContourBivariate extends ContourBase {
1849
1852
  matrix.appendChild(cell);
1850
1853
  }
1851
1854
  }
1855
+ // selected highlight
1856
+ const sel = this.getAttribute("selected");
1857
+ if (sel) {
1858
+ const parts = sel.split(",");
1859
+ const sr = parseInt(parts[0], 10);
1860
+ const sc = parseInt(parts[1], 10);
1861
+ const cells = Array.from(matrix.querySelectorAll(".c-bivariate__cell"));
1862
+ cells.forEach((cell, i) => {
1863
+ const rr = Math.floor(i / size);
1864
+ const cc = i % size;
1865
+ // matrix is row-major in DOM? cells appended row by row r then c, so index = r*size+c
1866
+ if (rr === sr && cc === sc) cell.setAttribute("data-selected", "");
1867
+ else cell.removeAttribute("data-selected");
1868
+ });
1869
+ }
1870
+ // aria-live region
1871
+ let live = this.querySelector(".c-bivariate__live");
1872
+ if (!live) { live = document.createElement("div"); live.className = "c-bivariate__live"; live.setAttribute("aria-live", "polite"); live.style.position = "absolute"; live.style.width = "1px"; live.style.height = "1px"; live.style.overflow = "hidden"; live.style.clip = "rect(0,0,0,0)"; this.appendChild(live); }
1852
1873
  }
1853
1874
  const axisX = this.getAttribute("axis-x");
1854
1875
  if (axisX) {
@@ -1867,11 +1888,47 @@ class ContourBivariate extends ContourBase {
1867
1888
  if (ay) ay.remove();
1868
1889
  }
1869
1890
  }
1891
+ enhance() {
1892
+ if (this._wiredBivariate) return;
1893
+ this._wiredBivariate = true;
1894
+ const selectCell = (cell) => {
1895
+ const matrix = this.querySelector(".c-bivariate__matrix");
1896
+ const cells = Array.from(matrix ? matrix.querySelectorAll(".c-bivariate__cell") : []);
1897
+ const idx = cells.indexOf(cell);
1898
+ if (idx < 0) return;
1899
+ const size = Math.min(12, Math.max(1, parseInt(this.getAttribute("size") || "3", 10) || 3));
1900
+ const row = Math.floor(idx / size);
1901
+ const col = idx % size;
1902
+ cells.forEach((cell, i) => {
1903
+ const rr = Math.floor(i / size);
1904
+ const cc = i % size;
1905
+ if (rr === row && cc === col) cell.setAttribute("data-selected", "");
1906
+ else cell.removeAttribute("data-selected");
1907
+ });
1908
+ this.dispatchEvent(new CustomEvent("contour:select", { detail: { row, col }, bubbles: true, composed: true }));
1909
+ };
1910
+ this.addEventListener("click", (e) => {
1911
+ const cell = e.target && e.target.closest ? e.target.closest(".c-bivariate__cell") : null;
1912
+ if (cell && this.contains(cell)) selectCell(cell);
1913
+ });
1914
+ this.addEventListener("keydown", (e) => {
1915
+ const cell = e.target && e.target.closest ? e.target.closest(".c-bivariate__cell") : null;
1916
+ if (!cell || !this.contains(cell)) return;
1917
+ if (e.key === "Enter" || e.key === " ") {
1918
+ e.preventDefault();
1919
+ selectCell(cell);
1920
+ }
1921
+ });
1922
+ }
1923
+ clear() {
1924
+ this.removeAttribute("selected");
1925
+ this.dispatchEvent(new CustomEvent("contour:clear", { bubbles: true, composed: true }));
1926
+ }
1870
1927
  }
1871
1928
  define("contour-bivariate", ContourBivariate);
1872
1929
  class ContourBivariateLegend extends ContourBase {
1873
- static get observed() { return ["size", "axis-x", "axis-y", "colors"]; }
1874
- static get properties() { return { size: { attribute: "size" }, axisX: { attribute: "axis-x" }, axisY: { attribute: "axis-y" }, colors: { attribute: "colors" } }; }
1930
+ static get observed() { return ["size", "axis-x", "axis-y", "colors", "selected"]; }
1931
+ static get properties() { return { size: { attribute: "size" }, axisX: { attribute: "axis-x" }, axisY: { attribute: "axis-y" }, colors: { attribute: "colors" }, selected: { attribute: "selected" } }; }
1875
1932
  render() {
1876
1933
  this.classList.add("c-bivariate-legend");
1877
1934
  const size = Math.min(8, Math.max(1, parseInt(this.getAttribute("size") || "3", 10) || 3));
@@ -1887,10 +1944,18 @@ class ContourBivariateLegend extends ContourBase {
1887
1944
  for (let i = 0; i < size * size; i++) {
1888
1945
  const cell = document.createElement("div");
1889
1946
  cell.className = "c-bivariate-legend__cell";
1947
+ cell.setAttribute("role", "button");
1948
+ cell.setAttribute("tabindex", "0");
1949
+ const x = i % size;
1950
+ const y = Math.floor(i / size);
1951
+ cell.setAttribute("aria-label", "Cell " + x + "," + y);
1890
1952
  if (colors[i]) cell.style.background = colors[i];
1891
1953
  else cell.style.background = "var(--chart-" + ((i % 8) + 1) + ")";
1892
1954
  matrix.appendChild(cell);
1893
1955
  }
1956
+ // aria-live
1957
+ let live = this.querySelector(".c-bivariate-legend__live");
1958
+ if (!live) { live = document.createElement("div"); live.className = "c-bivariate-legend__live"; live.setAttribute("aria-live", "polite"); live.style.position = "absolute"; live.style.width = "1px"; live.style.height = "1px"; live.style.overflow = "hidden"; live.style.clip = "rect(0,0,0,0)"; this.appendChild(live); }
1894
1959
  }
1895
1960
  const axisX = this.getAttribute("axis-x");
1896
1961
  const ax = this.querySelector(".c-bivariate-legend__axis--x");
@@ -1909,7 +1974,36 @@ class ContourBivariateLegend extends ContourBase {
1909
1974
  ay.remove();
1910
1975
  }
1911
1976
  }
1912
- enhance() {}
1977
+ enhance() {
1978
+ if (this._wiredBivLegend) return;
1979
+ this._wiredBivLegend = true;
1980
+ const selectCell = (cell) => {
1981
+ const matrix = this.querySelector(".c-bivariate-legend__matrix");
1982
+ const cells = Array.from(matrix ? matrix.querySelectorAll(".c-bivariate-legend__cell") : []);
1983
+ const idx = cells.indexOf(cell);
1984
+ if (idx < 0) return;
1985
+ const size = Math.min(8, Math.max(1, parseInt(this.getAttribute("size") || "3", 10) || 3));
1986
+ const row = Math.floor(idx / size);
1987
+ const col = idx % size;
1988
+ cells.forEach((cell, i) => {
1989
+ const rr = Math.floor(i / size);
1990
+ const cc = i % size;
1991
+ if (rr === row && cc === col) cell.setAttribute("data-selected", "");
1992
+ else cell.removeAttribute("data-selected");
1993
+ });
1994
+ this.dispatchEvent(new CustomEvent("contour:select", { detail: { row, col }, bubbles: true, composed: true }));
1995
+ };
1996
+ this.addEventListener("click", (e) => {
1997
+ const cell = e.target && e.target.closest ? e.target.closest(".c-bivariate-legend__cell") : null;
1998
+ if (cell && this.contains(cell)) selectCell(cell);
1999
+ });
2000
+ this.addEventListener("keydown", (e) => {
2001
+ const cell = e.target && e.target.closest ? e.target.closest(".c-bivariate-legend__cell") : null;
2002
+ if (!cell || !this.contains(cell)) return;
2003
+ if (e.key === "Enter" || e.key === " ") { e.preventDefault(); selectCell(cell); }
2004
+ });
2005
+ }
2006
+ clear() { this.removeAttribute("selected"); this.dispatchEvent(new CustomEvent("contour:clear", { bubbles: true, composed: true })); }
1913
2007
  }
1914
2008
  define("contour-bivariate-legend", ContourBivariateLegend);
1915
2009
  class ContourSurvey extends ContourBase {
@@ -2044,13 +2138,18 @@ class ContourLegend extends ContourBase {
2044
2138
  if (items) {
2045
2139
  try {
2046
2140
  const parsed = JSON.parse(items);
2047
- const list = this.ensure(".c-legend__items", () => { const el = document.createElement("div"); el.className = "c-legend__items"; return el; });
2141
+ const list = this.ensure(".c-legend__items", () => { const el = document.createElement("div"); el.className = "c-legend__items"; el.setAttribute("role", "listbox"); return el; });
2142
+ list.setAttribute("role", "listbox");
2143
+ if (title) list.setAttribute("aria-label", title);
2048
2144
  list.innerHTML = "";
2049
2145
  parsed.forEach((it) => {
2050
2146
  const label = typeof it === "string" ? it : (it.label || String(it));
2051
2147
  const key = typeof it === "string" ? it : (it.key || it.label || String(it));
2052
2148
  const item = document.createElement(selectable ? "button" : "div");
2053
2149
  item.className = "c-legend__item";
2150
+ item.setAttribute("role", "option");
2151
+ item.setAttribute("aria-selected", "false");
2152
+ item.setAttribute("tabindex", "-1");
2054
2153
  if (selectable) {
2055
2154
  item.type = "button";
2056
2155
  item.setAttribute("aria-pressed", "true");
@@ -2103,6 +2202,39 @@ class ContourLegend extends ContourBase {
2103
2202
  renderEmpty(this, "legend");
2104
2203
  }
2105
2204
  }
2205
+ // caption as option description (aria-describedby), not part of name
2206
+ const caption = this.getAttribute("caption");
2207
+ let captionEl = this.querySelector(".c-legend__caption");
2208
+ if (caption) {
2209
+ if (!captionEl) { captionEl = document.createElement("span"); captionEl.className = "c-legend__caption"; this.appendChild(captionEl); }
2210
+ captionEl.id = captionEl.id || ("legend-caption-" + Math.random().toString(36).slice(2));
2211
+ captionEl.textContent = caption;
2212
+ captionEl.style.position = "absolute"; captionEl.style.width = "1px"; captionEl.style.height = "1px"; captionEl.style.overflow = "hidden"; captionEl.style.clip = "rect(0,0,0,0)";
2213
+ } else if (captionEl) {
2214
+ captionEl.remove();
2215
+ }
2216
+ // single tab stop: first option
2217
+ const _items = this.querySelector(".c-legend__items");
2218
+ if (_items) {
2219
+ const opts = Array.from(_items.querySelectorAll(".c-legend__item"));
2220
+ opts.forEach((o, i) => o.setAttribute("tabindex", i === 0 ? "0" : "-1"));
2221
+ if (captionEl) opts.forEach((o) => o.setAttribute("aria-describedby", captionEl.id));
2222
+ }
2223
+ // no-data entry from palette / no-data-color
2224
+ const ndColor = this.getAttribute("no-data-color");
2225
+ if (ndColor) {
2226
+ let nd = this.querySelector(".c-legend__no-data");
2227
+ if (!nd) { nd = document.createElement("div"); nd.className = "c-legend__no-data"; this.appendChild(nd); }
2228
+ nd.setAttribute("part", "no-data");
2229
+ nd.textContent = "No data";
2230
+ const glyph = document.createElement("span");
2231
+ glyph.className = "glyph";
2232
+ glyph.style.background = ndColor;
2233
+ nd.prepend(glyph);
2234
+ } else {
2235
+ const nd = this.querySelector(".c-legend__no-data");
2236
+ if (nd) nd.remove();
2237
+ }
2106
2238
  // audit notice
2107
2239
  const audit = this.getAttribute("audit");
2108
2240
  if (audit) {
@@ -2236,6 +2368,7 @@ class ContourLegend extends ContourBase {
2236
2368
  if (!btn || !this.contains(btn)) return;
2237
2369
  const pressed = btn.getAttribute("aria-pressed") !== "true";
2238
2370
  btn.setAttribute("aria-pressed", String(pressed));
2371
+ btn.setAttribute("aria-selected", String(pressed));
2239
2372
  this.dispatchEvent(new CustomEvent("contour:legend-toggle", {
2240
2373
  detail: { label: btn.textContent.trim(), key: btn.dataset.key || btn.textContent.trim(), pressed },
2241
2374
  bubbles: true,
@@ -2268,11 +2401,34 @@ class ContourLegend extends ContourBase {
2268
2401
  if (e.key === "ArrowDown" || e.key === "ArrowRight") {
2269
2402
  e.preventDefault();
2270
2403
  const next = items[(idx + 1) % items.length];
2271
- if (next) next.focus();
2404
+ if (next) { next.focus(); items.forEach((o,i)=>o.setAttribute("tabindex", o===next?"0":"-1")); }
2272
2405
  } else if (e.key === "ArrowUp" || e.key === "ArrowLeft") {
2273
2406
  e.preventDefault();
2274
2407
  const prev = items[(idx - 1 + items.length) % items.length];
2275
- if (prev) prev.focus();
2408
+ if (prev) { prev.focus(); items.forEach((o)=>o.setAttribute("tabindex", o===prev?"0":"-1")); }
2409
+ } else if (e.key === "Home") {
2410
+ if (items.length > 4) { e.preventDefault(); items[0].focus(); items.forEach((o,i)=>o.setAttribute("tabindex", i===0?"0":"-1")); }
2411
+ } else if (e.key === "End") {
2412
+ if (items.length > 4) { e.preventDefault(); const last = items[items.length-1]; last.focus(); items.forEach((o)=>o.setAttribute("tabindex", o===last?"0":"-1")); }
2413
+ } else if (e.key === "Escape") {
2414
+ // clear selection
2415
+ items.forEach((o) => o.setAttribute("aria-selected", "false"));
2416
+ this.dispatchEvent(new CustomEvent("contour:clear", { bubbles: true, composed: true }));
2417
+ } else if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
2418
+ // type-ahead
2419
+ if (items.length > 7) {
2420
+ const start = idx >= 0 ? idx + 1 : 0;
2421
+ for (let i = 0; i < items.length; i++) {
2422
+ const ii = (start + i) % items.length;
2423
+ const txt = (items[ii].textContent || "").trim().toLowerCase();
2424
+ if (txt.startsWith(e.key.toLowerCase())) {
2425
+ e.preventDefault();
2426
+ items[ii].focus();
2427
+ items.forEach((o,j)=>o.setAttribute("tabindex", j===ii?"0":"-1"));
2428
+ break;
2429
+ }
2430
+ }
2431
+ }
2276
2432
  } else if (e.key === "Enter" || e.key === " ") {
2277
2433
  e.preventDefault();
2278
2434
  if (document.activeElement && document.activeElement.classList.contains("c-legend__item")) {
package/dist/wc/map.mjs CHANGED
@@ -391,7 +391,7 @@ class ContourLayerPanel extends ContourBase {
391
391
  }
392
392
  define("contour-layer-panel", ContourLayerPanel);
393
393
  class ContourTimeSlider extends ContourBase {
394
- static get observed() { return ["label", "value", "loop", "speed"]; }
394
+ static get observed() { return ["label", "value", "loop", "speed", "speeds", "show-loop", "loop-label", "current-time", "time-format", "is-playing"]; }
395
395
  static get properties() { return { label: { attribute: "label" }, value: { attribute: "value" }, src: { attribute: "src" } }; }
396
396
  render() {
397
397
  this.classList.add("c-time-slider");
@@ -417,7 +417,41 @@ class ContourTimeSlider extends ContourBase {
417
417
  }
418
418
  track.setAttribute("aria-label", this.getAttribute("label") || "Time");
419
419
  const time = this.ensure(".c-time-slider__time", () => { const el = document.createElement("span"); el.className = "c-time-slider__time"; return el; });
420
- time.textContent = this.getAttribute("label") || "";
420
+ const ct = this.getAttribute("current-time");
421
+ time.textContent = ct ? ct : (this.getAttribute("label") || "");
422
+ // speed selector
423
+ let speeds = null;
424
+ const speedsAttr = this.getAttribute("speeds");
425
+ if (speedsAttr) { try { speeds = JSON.parse(speedsAttr); } catch (e) { speeds = null; } }
426
+ const speedSel = this.ensure(".c-time-slider__speed", () => { const el = document.createElement("select"); el.className = "c-time-slider__speed"; el.setAttribute("aria-label", "Speed"); return el; });
427
+ speedSel.innerHTML = "";
428
+ const speedList = Array.isArray(speeds) ? speeds : [0.5, 1, 2, 5, 10];
429
+ speedList.forEach((sp) => {
430
+ const opt = document.createElement("option");
431
+ opt.value = String(sp);
432
+ opt.textContent = String(sp);
433
+ if (String(sp) === (this.getAttribute("speed") || "")) opt.selected = true;
434
+ speedSel.appendChild(opt);
435
+ });
436
+ const speedAttr = this.getAttribute("speed");
437
+ if (speedAttr) speedSel.value = speedAttr;
438
+ // loop toggle
439
+ const showLoop = this.hasAttribute("show-loop");
440
+ if (showLoop) {
441
+ const loopBtn = this.ensure(".c-time-slider__loop", () => { const el = document.createElement("button"); el.className = "c-time-slider__loop"; el.type = "button"; el.setAttribute("aria-label", this.getAttribute("loop-label") || "Loop"); return el; });
442
+ loopBtn.setAttribute("aria-pressed", this.hasAttribute("loop") ? "true" : "false");
443
+ loopBtn.textContent = this.getAttribute("loop-label") || "Loop";
444
+ } else {
445
+ const lb = this.querySelector(".c-time-slider__loop");
446
+ if (lb) lb.remove();
447
+ }
448
+ // is-playing reflects on play button
449
+ if (this.hasAttribute("is-playing")) {
450
+ play.setAttribute("data-state", "pause");
451
+ play.setAttribute("aria-label", "Pause");
452
+ const use = play.querySelector("use");
453
+ if (use) use.setAttribute("href", "#i-pause");
454
+ }
421
455
  }
422
456
  enhance() {
423
457
  if (this._wiredTimeSlider) return;
@@ -453,20 +487,38 @@ class ContourTimeSlider extends ContourBase {
453
487
  };
454
488
  this.addEventListener("click", (e) => {
455
489
  const btn = e.target && e.target.closest ? e.target.closest(".c-time-slider__play") : null;
456
- if (!btn) return;
457
- const playing = btn.getAttribute("data-state") === "play";
458
- btn.setAttribute("data-state", playing ? "pause" : "play");
459
- btn.setAttribute("aria-label", playing ? "Pause" : "Play");
460
- const use = btn.querySelector("use");
461
- if (use) use.setAttribute("href", playing ? "#i-pause" : "#i-play");
462
- if (playing) {
463
- stop();
464
- const speed = parseFloat(this.getAttribute("speed") || "1") || 1;
465
- const delay = Math.max(100, 1000 / speed);
466
- timer = setInterval(step, delay);
467
- } else {
468
- stop();
490
+ if (btn) {
491
+ const playing = btn.getAttribute("data-state") === "play";
492
+ btn.setAttribute("data-state", playing ? "pause" : "play");
493
+ btn.setAttribute("aria-label", playing ? "Pause" : "Play");
494
+ const use = btn.querySelector("use");
495
+ if (use) use.setAttribute("href", playing ? "#i-pause" : "#i-play");
496
+ if (playing) {
497
+ stop();
498
+ const speed = parseFloat(this.getAttribute("speed") || "1") || 1;
499
+ const delay = Math.max(100, 1000 / speed);
500
+ timer = setInterval(step, delay);
501
+ this.dispatchEvent(new CustomEvent("contour:play", { bubbles: true, composed: true }));
502
+ } else {
503
+ stop();
504
+ this.dispatchEvent(new CustomEvent("contour:pause", { bubbles: true, composed: true }));
505
+ }
506
+ return;
469
507
  }
508
+ const loopBtn = e.target && e.target.closest ? e.target.closest(".c-time-slider__loop") : null;
509
+ if (loopBtn) {
510
+ const next = loopBtn.getAttribute("aria-pressed") !== "true";
511
+ loopBtn.setAttribute("aria-pressed", String(next));
512
+ this.toggleAttribute("loop", next);
513
+ this.dispatchEvent(new CustomEvent("contour:loop-change", { detail: { loop: next }, bubbles: true, composed: true }));
514
+ }
515
+ });
516
+ // speed select change (delegated)
517
+ this.addEventListener("change", (e) => {
518
+ const sel = e.target && e.target.closest ? e.target.closest(".c-time-slider__speed") : null;
519
+ if (!sel) return;
520
+ const speed = Number(sel.value);
521
+ this.dispatchEvent(new CustomEvent("contour:speed-change", { detail: { speed }, bubbles: true, composed: true }));
470
522
  });
471
523
  onDispose(this, stop);
472
524
  }
package/dist/wc/ui.mjs CHANGED
@@ -607,8 +607,8 @@ class ContourMapPopup extends ContourBase {
607
607
  define("contour-map-popup", ContourMapPopup);
608
608
 
609
609
  class ContourAnimationControls extends ContourBase {
610
- static get observed() { return ["playing", "speed"]; }
611
- static get properties() { return { playing: { attribute: "playing", type: Boolean }, speed: { attribute: "speed" } }; }
610
+ static get observed() { return ["playing", "speed", "progress", "min", "max", "caption", "show-thumb", "show-thumb-caption"]; }
611
+ static get properties() { return { playing: { attribute: "playing", type: Boolean }, speed: { attribute: "speed" }, progress: { attribute: "progress" }, min: { attribute: "min" }, max: { attribute: "max" } }; }
612
612
  render() {
613
613
  this.classList.add("c-animation-controls");
614
614
  const playBtn = this.ensure(".c-animation-controls__play", () => { const el = document.createElement("button"); el.className = "c-btn c-btn--sm c-animation-controls__play"; el.type = "button"; return el; });
@@ -617,6 +617,26 @@ class ContourAnimationControls extends ContourBase {
617
617
  const speed = this.getAttribute("speed") || "1x";
618
618
  const speedBtn = this.ensure(".c-animation-controls__speed", () => { const el = document.createElement("button"); el.className = "c-btn c-btn--sm c-animation-controls__speed"; el.type = "button"; return el; });
619
619
  speedBtn.textContent = speed;
620
+ // scrubber
621
+ const scrubber = this.ensure(".c-animation-controls__scrubber", () => { const el = document.createElement("input"); el.className = "c-animation-controls__scrubber"; el.type = "range"; return el; });
622
+ if (this.getAttribute("show-thumb") === "false") scrubber.classList.remove("c-animation-controls__scrubber--thumb");
623
+ else scrubber.classList.add("c-animation-controls__scrubber--thumb");
624
+ scrubber.min = this.getAttribute("min") || "0";
625
+ scrubber.max = this.getAttribute("max") || "100";
626
+ scrubber.value = this.getAttribute("progress") || "0";
627
+ const caption = this.getAttribute("caption");
628
+ if (caption) scrubber.setAttribute("aria-label", caption);
629
+ else if (!scrubber.getAttribute("aria-label")) scrubber.setAttribute("aria-label", "Playhead");
630
+ // caption display
631
+ const showCaption = this.hasAttribute("show-thumb-caption") || this.hasAttribute("show-thumb");
632
+ if (caption && showCaption) {
633
+ const cap = this.ensure(".c-animation-controls__caption", () => { const el = document.createElement("span"); el.className = "c-animation-controls__caption"; return el; });
634
+ cap.textContent = caption;
635
+ } else {
636
+ const cap = this.querySelector(".c-animation-controls__caption");
637
+ if (cap) cap.remove();
638
+ }
639
+ // showThumb: hide thumb via attribute? keep default
620
640
  }
621
641
  enhance() {
622
642
  if (this._wiredAnimControls) return;
@@ -631,6 +651,13 @@ class ContourAnimationControls extends ContourBase {
631
651
  this.dispatchEvent(new CustomEvent("contour:change", { bubbles: true, composed: true, detail: { speed: speed.textContent } }));
632
652
  }
633
653
  });
654
+ this.addEventListener("input", (e) => {
655
+ const scrubber = e.target && e.target.closest ? e.target.closest(".c-animation-controls__scrubber") : null;
656
+ if (scrubber && this.contains(scrubber)) {
657
+ const v = Number(scrubber.value);
658
+ this.dispatchEvent(new CustomEvent("contour:seek", { bubbles: true, composed: true, detail: { progress: v, value: v } }));
659
+ }
660
+ });
634
661
  }
635
662
  }
636
663
  define("contour-animation-controls", ContourAnimationControls);
@@ -737,7 +764,7 @@ class ContourStyleSwitcher extends ContourBase {
737
764
  define("contour-style-switcher", ContourStyleSwitcher);
738
765
 
739
766
  class ContourStylePanel extends ContourBase {
740
- static get observed() { return ["title", "layers", "layer", "single", "classification", "palette", "breaks", "opacity", "n", "colors"]; }
767
+ static get observed() { return ["title", "layers", "layer", "single", "classification", "palette", "breaks", "opacity", "n", "colors", "property"]; }
741
768
  static get properties() { return { title: { attribute: "title" }, layers: { attribute: "layers" }, classification: { attribute: "classification" }, palette: { attribute: "palette" }, breaks: { attribute: "breaks" }, opacity: { attribute: "opacity" } }; }
742
769
  render() {
743
770
  this.classList.add("c-style-panel");
@@ -750,39 +777,64 @@ class ContourStylePanel extends ContourBase {
750
777
  if (singleMode) {
751
778
  const body = this.ensure(".c-style-panel__body", () => { const el = document.createElement("div"); el.className = "c-style-panel__body"; return el; });
752
779
  body.innerHTML = "";
753
- // classification method selector
754
- const clsLabel = document.createElement("label"); clsLabel.textContent = "Classification"; body.appendChild(clsLabel);
755
- const clsSel = document.createElement("select"); clsSel.className = "c-style-panel__classification";
780
+ // property field
781
+ const propLabel = document.createElement("label"); propLabel.textContent = "Colour field"; propLabel.setAttribute("for", "property"); body.appendChild(propLabel);
782
+ const propIn = document.createElement("input"); propIn.type = "text"; propIn.id = "property"; propIn.className = "c-style-panel__property c-input"; propIn.setAttribute("aria-label", "Colour field");
783
+ const pv = this.getAttribute("property"); if (pv) propIn.value = pv;
784
+ body.appendChild(propIn);
785
+ // classification method selector (policy)
786
+ const clsLabel = document.createElement("label"); clsLabel.textContent = "Classification"; clsLabel.setAttribute("for", "policy"); body.appendChild(clsLabel);
787
+ const clsSel = document.createElement("select"); clsSel.id = "policy"; clsSel.className = "c-style-panel__classification c-input"; clsSel.setAttribute("aria-label", "Classification method");
756
788
  ["equal","quantile","jenks","manual"].forEach((m) => { const o = document.createElement("option"); o.value = m; o.textContent = m; clsSel.appendChild(o); });
757
789
  const cls = this.getAttribute("classification"); if (cls) clsSel.value = cls;
758
790
  body.appendChild(clsSel);
759
791
  // palette picker
760
- const pal = document.createElement("input"); pal.type = "text"; pal.className = "c-style-panel__palette"; pal.placeholder = "palette";
792
+ const palLabel = document.createElement("label"); palLabel.textContent = "Palette"; palLabel.setAttribute("for", "palette"); body.appendChild(palLabel);
793
+ const pal = document.createElement("input"); pal.type = "text"; pal.id = "palette"; pal.className = "c-style-panel__palette c-input"; pal.placeholder = "palette"; pal.setAttribute("aria-label", "Palette");
761
794
  const palv = this.getAttribute("palette"); if (palv) pal.value = palv;
762
795
  body.appendChild(pal);
763
796
  // n (class count)
764
- const nIn = document.createElement("input"); nIn.type = "number"; nIn.className = "c-style-panel__n"; nIn.min = "2"; nIn.max = "12";
797
+ const nLabel = document.createElement("label"); nLabel.textContent = "Classes"; nLabel.setAttribute("for", "n"); body.appendChild(nLabel);
798
+ const nIn = document.createElement("input"); nIn.type = "number"; nIn.id = "n"; nIn.className = "c-style-panel__n c-input"; nIn.min = "2"; nIn.max = "12"; nIn.setAttribute("aria-label", "Class count");
765
799
  const nv = this.getAttribute("n"); if (nv) nIn.value = nv; else nIn.value = "5";
766
800
  body.appendChild(nIn);
767
801
  // opacity slider
768
802
  const op = document.createElement("input"); op.type = "range"; op.className = "c-style-panel__opacity"; op.min = "0"; op.max = "100";
769
803
  const ov = this.getAttribute("opacity"); op.value = ov != null ? ov : "100";
770
804
  body.appendChild(op);
771
- // breaks editor
772
- const breaks = document.createElement("input"); breaks.type = "text"; breaks.className = "c-style-panel__breaks"; breaks.placeholder = "breaks";
773
- const bv = this.getAttribute("breaks"); if (bv) breaks.value = bv;
774
- body.appendChild(breaks);
775
- // color list
805
+ // breaks as .break elements per class
806
+ const breaksAttr = this.getAttribute("breaks");
807
+ let breaksArr = null;
808
+ if (breaksAttr) { try { breaksArr = JSON.parse(breaksAttr); } catch (e) { breaksArr = breaksAttr.split(",").map((s) => s.trim()); } }
809
+ if (Array.isArray(breaksArr) && breaksArr.length) {
810
+ const breaksWrap = document.createElement("div"); breaksWrap.className = "c-style-panel__breaks breaks";
811
+ breaksArr.forEach((b, i) => {
812
+ const br = document.createElement("div"); br.className = "break";
813
+ br.textContent = String(b);
814
+ breaksWrap.appendChild(br);
815
+ });
816
+ body.appendChild(breaksWrap);
817
+ }
818
+ // color swatches
776
819
  const colorsAttr = this.getAttribute("colors");
777
820
  let colors = null;
778
821
  if (colorsAttr) { try { colors = JSON.parse(colorsAttr); } catch (e) { colors = colorsAttr.split(",").map((s) => s.trim()); } }
779
822
  if (Array.isArray(colors)) {
780
- const list = document.createElement("div"); list.className = "c-style-panel__colors";
781
- colors.forEach((c) => {
782
- const sw = document.createElement("span"); sw.className = "c-style-panel__color"; sw.style.background = c; list.appendChild(sw);
823
+ const list = document.createElement("div"); list.className = "c-style-panel__colors colours";
824
+ colors.forEach((c, i) => {
825
+ const sw = document.createElement("input"); sw.type = "color"; sw.className = "c-style-panel__color c-input"; sw.setAttribute("aria-label", "Colour for class " + (i + 1));
826
+ sw.value = c;
827
+ sw.addEventListener("input", () => { sw.setAttribute("data-edited", "true"); });
828
+ list.appendChild(sw);
783
829
  });
784
830
  body.appendChild(list);
785
831
  }
832
+ // Apply/Revert buttons
833
+ const actions = document.createElement("div"); actions.className = "c-style-panel__actions actions";
834
+ const applyBtn = document.createElement("button"); applyBtn.type = "button"; applyBtn.className = "c-btn primary"; applyBtn.textContent = "Apply";
835
+ const revertBtn = document.createElement("button"); revertBtn.type = "button"; revertBtn.className = "c-btn"; revertBtn.textContent = "Revert";
836
+ actions.appendChild(applyBtn); actions.appendChild(revertBtn);
837
+ body.appendChild(actions);
786
838
  return;
787
839
  }
788
840
  const layers = this.getAttribute("layers");
@@ -876,6 +928,15 @@ class ContourStylePanel extends ContourBase {
876
928
  this.dispatchEvent(new CustomEvent("contour:style-resolved", { detail: { value: t.value, layer: name, property: t.classList.contains("c-style-panel__palette") ? "palette" : "breaks" }, bubbles: true, composed: true }));
877
929
  }
878
930
  });
931
+ this.addEventListener("click", (e) => {
932
+ const t = e.target && e.target.closest ? e.target.closest("button") : null;
933
+ if (!t || !this.contains(t)) return;
934
+ if (t.textContent.trim() === "Apply") {
935
+ this.dispatchEvent(new CustomEvent("contour:style-resolved", { detail: { applied: true }, bubbles: true, composed: true }));
936
+ } else if (t.textContent.trim() === "Revert") {
937
+ this.dispatchEvent(new CustomEvent("contour:style-resolved", { detail: { applied: false }, bubbles: true, composed: true }));
938
+ }
939
+ });
879
940
  }
880
941
  }
881
942
  define("contour-style-panel", ContourStylePanel);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contour-ds",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "A token-driven design system for spatial interfaces",
5
5
  "license": "MIT",
6
6
  "type": "module",