contour-ds 1.5.0 → 1.7.1

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 (60) hide show
  1. package/README.md +25 -3
  2. package/dist/build-manifest.json +52 -52
  3. package/dist/contour-wc.esm.js +302 -26
  4. package/dist/contour-wc.esm.min.js +1 -1
  5. package/dist/contour-wc.js +302 -26
  6. package/dist/contour-wc.min.js +1 -1
  7. package/dist/contour.components.json +1468 -47
  8. package/dist/contour.css +689 -527
  9. package/dist/contour.d.ts +10 -1
  10. package/dist/contour.esm.js +7 -0
  11. package/dist/contour.esm.min.js +1 -1
  12. package/dist/contour.js +7 -0
  13. package/dist/contour.min.css +1 -1
  14. package/dist/contour.min.js +1 -1
  15. package/dist/contour.tokens.json +10 -2
  16. package/dist/docs/actions.md +2 -2
  17. package/dist/docs/affordances.md +2 -2
  18. package/dist/docs/apireference.md +30 -0
  19. package/dist/docs/colour.md +2 -2
  20. package/dist/docs/componentindex.md +2 -2
  21. package/dist/docs/data.md +2 -2
  22. package/dist/docs/docs.md +2 -2
  23. package/dist/docs/feedback.md +2 -2
  24. package/dist/docs/field.md +2 -2
  25. package/dist/docs/forms.md +2 -2
  26. package/dist/docs/index.json +24 -11
  27. package/dist/docs/install.md +2 -2
  28. package/dist/docs/landing.md +2 -2
  29. package/dist/docs/mapengine.md +2 -2
  30. package/dist/docs/motion.md +2 -2
  31. package/dist/docs/navigation.md +2 -2
  32. package/dist/docs/overlays.md +2 -2
  33. package/dist/docs/overview.md +2 -2
  34. package/dist/docs/patterns.md +2 -2
  35. package/dist/docs/playground.md +2 -2
  36. package/dist/docs/principles.md +2 -2
  37. package/dist/docs/recipes.md +2 -2
  38. package/dist/docs/space.md +2 -2
  39. package/dist/docs/status.md +2 -2
  40. package/dist/docs/surfaces.md +2 -2
  41. package/dist/docs/theming.md +2 -2
  42. package/dist/docs/type.md +2 -2
  43. package/dist/docs/webcomponents.md +3 -7
  44. package/dist/registry/items/contour-core.json +2 -2
  45. package/dist/registry/items/contour-data.json +2 -2
  46. package/dist/registry/items/contour-docs.json +2 -2
  47. package/dist/registry/items/contour-landing.json +2 -2
  48. package/dist/registry/registry.json +8 -8
  49. package/dist/surfaces/contour-core.min.css +1 -1
  50. package/dist/surfaces/contour-data.min.css +1 -1
  51. package/dist/surfaces/contour-docs.min.css +1 -1
  52. package/dist/surfaces/contour-landing.min.css +1 -1
  53. package/dist/wc/core.mjs +33 -3
  54. package/dist/wc/data.mjs +71 -17
  55. package/dist/wc/docs.mjs +117 -0
  56. package/dist/wc/index.mjs +25 -1
  57. package/dist/wc/map.mjs +21 -0
  58. package/dist/wc/navigation.mjs +1 -1
  59. package/dist/wc/ui.mjs +59 -5
  60. package/package.json +1 -1
@@ -116,6 +116,7 @@ const CONTOUR_EVENTS = Object.freeze({
116
116
  "contour:btn-group-change": { payload: ["index", "label"], composed: true },
117
117
  "contour:brush-start": { payload: ["end", "start", "value"], composed: true },
118
118
  "contour:brush-end": { payload: ["end", "start", "value"], composed: true },
119
+ "contour:brush": { payload: ["end", "start", "value"], composed: true },
119
120
  "contour:change": { payload: ["checked", "color", "direction", "end", "files", "high", "index", "low", "month", "name", "speed", "start", "unit", "value", "year"], composed: true },
120
121
  "contour:collapse": { payload: ["collapsed"], composed: true },
121
122
  "contour:cluster-toggle": { payload: ["count", "expanded"], composed: true },
@@ -134,7 +135,9 @@ const CONTOUR_EVENTS = Object.freeze({
134
135
  "contour:drop": { payload: ["value", "label"], composed: true },
135
136
  "contour:empty-action": { payload: ["state"], composed: true },
136
137
  "contour:filter": { payload: ["query"], composed: true },
137
- "contour:error": { payload: ["src", "message", "name", "status"], composed: true },
138
+ "contour:error": { payload: ["src", "message", "name", "status"], composed: true },
139
+ "contour:export": { payload: ["format"], composed: true },
140
+ "contour:refresh": { payload: [], composed: true },
138
141
  "contour:hide": { payload: [], composed: true },
139
142
  "contour:hover": { payload: ["row"], composed: true },
140
143
  "contour:input": { payload: ["name", "value", "checked"], composed: true },
@@ -234,7 +237,7 @@ function sanitizeHtml(input) {
234
237
  const OBSERVED = [
235
238
  "accept", "action", "actions", "active", "after", "allow-duplicate", "allow-remove", "allow-rename", "allow-zoom", "alpha", "anchor", "answer", "area", "article", "attribution", "attribution-mark", "audit", "autoplay", "axis", "axis-x", "axis-y", "brownout", "brownout-level", "before", "body", "brand", "breakpoint", "breaks", "brush", "brush-end", "brush-max", "brush-min", "brush-start", "cache-key", "canvas", "center", "clearable", "cols", "columns", "color", "command",
236
239
  "cells", "checked", "chrome", "debounce", "closable", "collapsed", "collapsible", "classification", "colors", "continuous", "content", "controls", "copyable", "count", "data", "data-table", "date", "delta", "description", "glyphs", "demo", "density", "desc", "dir", "direction", "disabled", "distance", "dismissible", "divider", "do", "dont", "dot", "ends", "high", "input", "layer", "low", "mode", "modes", "n", "opacity", "palette", "polarity", "precision", "range", "single",
237
- "empty", "exclusive", "fallback", "format", "heading", "help", "hint", "href", "icon", "illustration", "instrument", "interval", "items", "key", "layers", "level", "range-end", "range-start",
240
+ "empty", "exclusive", "fallback", "filename", "format", "heading", "help", "hint", "href", "icon", "illustration", "instrument", "interval", "items", "key", "layers", "level", "range-end", "range-start",
238
241
  "label", "lazy", "lede", "legend", "line", "limit", "link", "links", "live", "loading", "locale", "loop", "max", "media", "message", "method", "menu", "min", "multiple", "name", "needle", "next", "no", "no-cache", "no-data-message", "nodes", "note", "norm", "normalize",
239
242
  "options", "orientation", "page-size", "pages", "pause", "paused", "pausable", "persist", "placeholder", "playing", "point", "points", "prev", "presets", "progress", "prompt", "question", "recent", "required",
240
243
  "quote", "ramp", "refresh", "removable", "resolution", "reverse", "rings", "retry", "results", "rows", "scale", "selectable", "segments", "show-header", "sparkline", "threshold", "thresholds", "selected", "separator", "series", "shortcut", "side", "size", "skeleton", "sort", "sort-dir", "speed", "status", "step", "submit", "submitting", "timeout", "trigger", "virtual", "sticky", "cluster-count", "cluster-expanded", "time", "resizable",
@@ -313,7 +316,18 @@ class ContourBase extends _ContourBaseParent {
313
316
  return "scaffold";
314
317
  }
315
318
 
316
- // How many times this host has run `render()`, counting the first connect.
319
+ // Brownout helpers (G-16): components read their degraded level from the
320
+ // `brownout` / `brownout-level` attribute and shed non-essential chrome
321
+ // above a threshold. Centralised here so a new component does not
322
+ // re-implement the attribute lookup.
323
+ brownoutLevel() {
324
+ const raw = this.getAttribute("brownout-level") || this.getAttribute("brownout") || "0";
325
+ const n = parseInt(raw, 10);
326
+ return Number.isFinite(n) ? n : 0;
327
+ }
328
+ shed(kind, threshold) {
329
+ return this.brownoutLevel() >= (threshold || 1);
330
+ }
317
331
  // Read-only and diagnostic: it exists so a page can show that `batch()` did
318
332
  // what it claims instead of asking the reader to believe it, and so a test can
319
333
  // assert a re-render happened without watching for a specific node. A consumer
@@ -907,6 +921,22 @@ class ContourBase extends _ContourBaseParent {
907
921
  }
908
922
  }
909
923
 
924
+ // Brownout mixin (G-16): opt-in base for components that shed non-essential
925
+ // chrome under degraded conditions. Merges `brownout` / `brownout-level`
926
+ // into the subclass observed list and exposes the helpers already on
927
+ // ContourBase. Usage: `class Foo extends withBrownout(ContourBase) { ... }`.
928
+ function withBrownout(Base) {
929
+ return class extends Base {
930
+ static get observed() {
931
+ const base = (super.observed && Array.isArray(super.observed)) ? super.observed : [];
932
+ const extra = ["brownout", "brownout-level"];
933
+ return Array.from(new Set(base.concat(extra)));
934
+ }
935
+ brownoutLevel() { return super.brownoutLevel ? super.brownoutLevel() : (parseInt(this.getAttribute("brownout-level") || this.getAttribute("brownout") || "0", 10) || 0); }
936
+ shed(kind, threshold) { return this.brownoutLevel() >= (threshold || 1); }
937
+ };
938
+ }
939
+
910
940
  // Simple component: just adds CSS classes.
911
941
  /** Create a light-DOM component that only applies block and modifier classes. */
912
942
  const simple = (classes) => class extends ContourBase {
@@ -5684,7 +5714,7 @@ class ContourGauge extends ContourBase {
5684
5714
  const showHeader = this.getAttribute("show-header") !== "false";
5685
5715
  const description = this.getAttribute("description");
5686
5716
  const noDataMessage = this.getAttribute("no-data-message") || "No readings in view";
5687
- const brownoutLevel = parseInt(this.getAttribute("brownout-level") || this.getAttribute("brownout") || "0", 10) || 0;
5717
+ const brownoutLevel = this.brownoutLevel();
5688
5718
  // empty state
5689
5719
  if (!hasValue) {
5690
5720
  if (heading && showHeader) {
@@ -5718,7 +5748,7 @@ class ContourGauge extends ContourBase {
5718
5748
  }
5719
5749
  }
5720
5750
  // dial (unless brownout >= 3)
5721
- const shedDial = brownoutLevel >= 3;
5751
+ const shedDial = this.shed("dial", 3);
5722
5752
  let dial = this.querySelector(".c-gauge__dial");
5723
5753
  if (shedDial) {
5724
5754
  if (dial) dial.remove();
@@ -5949,6 +5979,7 @@ class ContourBrush extends ContourBase {
5949
5979
  if (eh) eh.style.insetInlineStart = (((ne - mn) / range) * 100) + "%";
5950
5980
  // stash pending values
5951
5981
  this._brushPending = { start: ns, end: ne };
5982
+ this.dispatchEvent(new CustomEvent("contour:brush", { bubbles: true, composed: true, detail: { start: ns, end: ne, value: ns } }));
5952
5983
  });
5953
5984
  this.addEventListener("pointerup", (e) => {
5954
5985
  if (!dragging) return;
@@ -5960,6 +5991,7 @@ class ContourBrush extends ContourBase {
5960
5991
  this._brushPending = null;
5961
5992
  }
5962
5993
  this.dispatchEvent(new CustomEvent("contour:brush-end", { bubbles: true, composed: true, detail: { value: this.getAttribute("end"), start: this.getAttribute("start"), end: this.getAttribute("end") } }));
5994
+ this.dispatchEvent(new CustomEvent("contour:brush", { bubbles: true, composed: true, detail: { start: this.getAttribute("start"), end: this.getAttribute("end"), value: this.getAttribute("end") } }));
5963
5995
  });
5964
5996
  // Keyboard: Enter/Space emits brush-start/brush-end (WC-P1-08).
5965
5997
  if (!this.hasAttribute("tabindex")) this.setAttribute("tabindex", "0");
@@ -5995,7 +6027,7 @@ class ContourStackedBar extends ContourBase {
5995
6027
  segments = authoredSegments.map((el) => ({
5996
6028
  label: el.getAttribute("title") || el.textContent || "",
5997
6029
  value: parseFloat(el.style.inlineSize) || 0,
5998
- color: el.style.background || undefined,
6030
+ color: (el.dataset && el.dataset.color) || el.style.background || undefined,
5999
6031
  }));
6000
6032
  authoredSegments.forEach((el) => el.remove());
6001
6033
  } else {
@@ -6012,6 +6044,7 @@ class ContourStackedBar extends ContourBase {
6012
6044
  el.className = "c-stacked-bar__segment";
6013
6045
  el.style.inlineSize = ((v / denom) * 100) + "%";
6014
6046
  el.style.background = (typeof seg === "object" && seg.color) ? seg.color : "var(--chart-" + ((i % 8) + 1) + ")";
6047
+ el.dataset.color = (typeof seg === "object" && seg.color) ? seg.color : el.style.background;
6015
6048
  el.setAttribute("title", (typeof seg === "object" ? (seg.label || "") : "") + " " + v);
6016
6049
  this.appendChild(el);
6017
6050
  });
@@ -6165,7 +6198,7 @@ class ContourDonut extends ContourBase {
6165
6198
  const lbl = el.querySelector("span:last-child");
6166
6199
  const text = lbl ? lbl.textContent : el.textContent;
6167
6200
  const match = text.match(/—\s*(\d+(?:\.\d+)?)$/);
6168
- items.push({ label: text.replace(/—\s*\d+(?:\.\d+)?$/, "").trim(), value: match ? Number(match[1]) : 0, color: sw ? sw.style.background : undefined });
6201
+ items.push({ label: text.replace(/—\s*\d+(?:\.\d+)?$/, "").trim(), value: match ? Number(match[1]) : 0, color: sw ? (sw.dataset && sw.dataset.color) || sw.style.background : undefined });
6169
6202
  });
6170
6203
  // remove authored items from DOM (they will be regenerated below)
6171
6204
  authoredItems.forEach((el) => el.remove());
@@ -6175,8 +6208,8 @@ class ContourDonut extends ContourBase {
6175
6208
  }
6176
6209
  const values = items.map((it) => (typeof it === "object" ? (it.value || 0) : Number(it) || 0));
6177
6210
  const total = values.reduce((a, b) => a + b, 0) || 1;
6178
- const brownoutLevel = parseInt(this.getAttribute("brownout-level") || this.getAttribute("brownout") || "0", 10) || 0;
6179
- const shedRing = brownoutLevel >= 3;
6211
+ const brownoutLevel = this.brownoutLevel();
6212
+ const shedRing = this.shed("ring", 3);
6180
6213
  if (!shedRing) {
6181
6214
  const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
6182
6215
  svg.setAttribute("class", "c-donut__ring");
@@ -6217,6 +6250,7 @@ class ContourDonut extends ContourBase {
6217
6250
  const sw = document.createElement("span");
6218
6251
  sw.className = "c-donut__swatch";
6219
6252
  sw.style.background = (typeof it === "object" && it.color) ? it.color : "var(--chart-" + ((i % 8) + 1) + ")";
6253
+ if (sw.style.background) sw.dataset.color = (typeof it === "object" && it.color) ? it.color : sw.style.background;
6220
6254
  row.appendChild(sw);
6221
6255
  const lbl = document.createElement("span");
6222
6256
  lbl.textContent = (typeof it === "object" ? (it.label || "") : String(it)) + " — " + values[i];
@@ -6435,6 +6469,7 @@ class ContourPivot extends ContourBase {
6435
6469
  const corner = document.createElement("th");
6436
6470
  corner.textContent = "";
6437
6471
  corner.setAttribute("role", "columnheader");
6472
+ corner.setAttribute("aria-label", "Row");
6438
6473
  hr.appendChild(corner);
6439
6474
  visibleCols.forEach((c) => { const th = document.createElement("th"); th.textContent = c; th.setAttribute("role", "columnheader"); th.setAttribute("tabindex", "0"); hr.appendChild(th); });
6440
6475
  thead.appendChild(hr);
@@ -6462,6 +6497,7 @@ class ContourPivot extends ContourBase {
6462
6497
  } else {
6463
6498
  td.textContent = "";
6464
6499
  }
6500
+ if (!td.textContent.trim()) td.setAttribute("aria-label", "Empty");
6465
6501
  tr.appendChild(td);
6466
6502
  });
6467
6503
  tbody.appendChild(tr);
@@ -6626,7 +6662,7 @@ class ContourBivariate extends ContourBase {
6626
6662
  // Palette runs from bottom-left (low/low) to top-right (high/high):
6627
6663
  // reverse the row order so the first palette row sits at the bottom.
6628
6664
  const srcIndex = (size - 1 - r) * size + c;
6629
- if (colors[srcIndex]) cell.style.background = colors[srcIndex];
6665
+ if (colors[srcIndex]) { cell.style.background = colors[srcIndex]; cell.dataset.color = colors[srcIndex]; }
6630
6666
  matrix.appendChild(cell);
6631
6667
  }
6632
6668
  }
@@ -6887,7 +6923,7 @@ class ContourLegend extends ContourBase {
6887
6923
  items = JSON.stringify(authoredLegendItems.map((el) => {
6888
6924
  const sw = el.querySelector(".c-legend__swatch");
6889
6925
  const lbl = el.querySelector(".c-legend__label") || el;
6890
- return { label: lbl ? lbl.textContent.trim() : el.textContent.trim(), color: sw ? sw.style.background || undefined : undefined };
6926
+ return { label: lbl ? lbl.textContent.trim() : el.textContent.trim(), color: sw ? (sw.dataset && sw.dataset.color) || sw.style.background || undefined : undefined };
6891
6927
  }));
6892
6928
  authoredLegendItems.forEach((el) => el.remove());
6893
6929
  }
@@ -6903,19 +6939,18 @@ class ContourLegend extends ContourBase {
6903
6939
  try {
6904
6940
  const parsed = JSON.parse(items);
6905
6941
  const list = this.ensure(".c-legend__items", () => { const el = document.createElement("div"); el.className = "c-legend__items"; return el; });
6906
- list.setAttribute("role", selectable ? "group" : "listbox");
6942
+ list.setAttribute("role", "listbox");
6907
6943
  if (title) list.setAttribute("aria-label", title);
6908
6944
  list.innerHTML = "";
6909
6945
  parsed.forEach((it) => {
6910
6946
  const label = typeof it === "string" ? it : (it.label || String(it));
6911
6947
  const key = typeof it === "string" ? it : (it.key || it.label || String(it));
6912
- const item = document.createElement(selectable ? "button" : "div");
6948
+ const item = document.createElement("div");
6913
6949
  item.className = "c-legend__item";
6914
6950
  item.setAttribute("tabindex", "-1");
6915
6951
  if (selectable) {
6916
- item.type = "button";
6917
- item.setAttribute("role", "button");
6918
- item.setAttribute("aria-pressed", "true");
6952
+ item.setAttribute("role", "option");
6953
+ item.setAttribute("aria-selected", "true");
6919
6954
  item.dataset.key = key;
6920
6955
  } else {
6921
6956
  item.setAttribute("role", "option");
@@ -6923,7 +6958,7 @@ class ContourLegend extends ContourBase {
6923
6958
  }
6924
6959
  const sw = document.createElement("span");
6925
6960
  sw.className = "c-legend__swatch";
6926
- if (it && it.color) sw.style.background = it.color;
6961
+ if (it && it.color) { sw.style.background = it.color; sw.dataset.color = it.color; }
6927
6962
  item.appendChild(sw);
6928
6963
  // geometry glyph
6929
6964
  const glyphShape = (it && (it.shape || it.marker || it.glyph)) || this.getAttribute("glyphs");
@@ -6996,6 +7031,7 @@ class ContourLegend extends ContourBase {
6996
7031
  const glyph = document.createElement("span");
6997
7032
  glyph.className = "glyph";
6998
7033
  glyph.style.background = ndColor;
7034
+ glyph.dataset.color = ndColor;
6999
7035
  nd.prepend(glyph);
7000
7036
  } else {
7001
7037
  const nd = this.querySelector(".c-legend__no-data");
@@ -7132,10 +7168,10 @@ class ContourLegend extends ContourBase {
7132
7168
  this.addEventListener("click", (e) => {
7133
7169
  const btn = e.target && e.target.closest ? e.target.closest(".c-legend__item") : null;
7134
7170
  if (!btn || !this.contains(btn)) return;
7135
- const pressed = btn.getAttribute("aria-pressed") !== "true";
7136
- btn.setAttribute("aria-pressed", String(pressed));
7171
+ const selected = btn.getAttribute("aria-selected") !== "true";
7172
+ btn.setAttribute("aria-selected", String(selected));
7137
7173
  this.dispatchEvent(new CustomEvent("contour:legend-toggle", {
7138
- detail: { label: btn.textContent.trim(), key: btn.dataset.key || btn.textContent.trim(), pressed },
7174
+ detail: { label: btn.textContent.trim(), key: btn.dataset.key || btn.textContent.trim(), pressed: selected },
7139
7175
  bubbles: true,
7140
7176
  composed: true,
7141
7177
  }));
@@ -7770,6 +7806,54 @@ class ContourErrorBoundary extends ContourBase {
7770
7806
  }
7771
7807
  define("contour-error-boundary", ContourErrorBoundary);
7772
7808
 
7809
+ class ContourDataExport extends ContourBase {
7810
+ static get observed() { return ["data", "format", "filename", "label"]; }
7811
+ static get properties() { return { data: { attribute: "data" }, format: { attribute: "format" }, filename: { attribute: "filename" }, label: { attribute: "label" } }; }
7812
+ render() {
7813
+ this.classList.add("c-data-export");
7814
+ const fmt = (this.getAttribute("format") || "json").toLowerCase();
7815
+ const btn = this.ensure(".c-data-export__btn", () => {
7816
+ const b = document.createElement("button");
7817
+ b.className = "c-data-export__btn";
7818
+ b.type = "button";
7819
+ return b;
7820
+ });
7821
+ btn.textContent = this.getAttribute("label") || ("Export " + fmt.toUpperCase());
7822
+ if (btn.parentNode !== this) this.appendChild(btn);
7823
+ }
7824
+ enhance() {
7825
+ if (this._wiredDataExport) return;
7826
+ this._wiredDataExport = true;
7827
+ this.addEventListener("click", (e) => {
7828
+ const btn = e.target && e.target.closest ? e.target.closest(".c-data-export__btn") : null;
7829
+ if (!btn || !this.contains(btn)) return;
7830
+ const fmt = (this.getAttribute("format") || "json").toLowerCase();
7831
+ const raw = this.getAttribute("data") || "[]";
7832
+ let text = raw;
7833
+ if (fmt === "csv") {
7834
+ try {
7835
+ const arr = JSON.parse(raw);
7836
+ if (Array.isArray(arr) && arr.length) {
7837
+ const keys = Object.keys(arr[0]);
7838
+ text = [keys.join(",")].concat(arr.map((r) => keys.map((k) => JSON.stringify(r[k] ?? "")).join(","))).join("\n");
7839
+ }
7840
+ } catch (e) {}
7841
+ }
7842
+ const blob = new Blob([text], { type: fmt === "csv" ? "text/csv" : "application/json" });
7843
+ const url = URL.createObjectURL(blob);
7844
+ const a = document.createElement("a");
7845
+ a.href = url;
7846
+ a.download = this.getAttribute("filename") || ("export." + fmt);
7847
+ document.body.appendChild(a);
7848
+ a.click();
7849
+ a.remove();
7850
+ URL.revokeObjectURL(url);
7851
+ this.dispatchEvent(new CustomEvent("contour:export", { bubbles: true, composed: true, detail: { format: fmt } }));
7852
+ });
7853
+ }
7854
+ }
7855
+ define("contour-data-export", ContourDataExport);
7856
+
7773
7857
 
7774
7858
 
7775
7859
  class ContourDocsNav extends ContourBase {
@@ -7930,6 +8014,123 @@ class ContourFileTree extends ContourBase {
7930
8014
  }
7931
8015
  define("contour-file-tree", ContourFileTree);
7932
8016
 
8017
+ class ContourChangelog extends ContourBase {
8018
+ static get observed() { return ["src", "max", "loading", "error"]; }
8019
+ static get properties() { return { src: { attribute: "src" }, max: { attribute: "max", type: Number } }; }
8020
+ render() {
8021
+ this.classList.add("c-changelog");
8022
+ const src = this.getAttribute("src");
8023
+ if (src) {
8024
+ if (this.dataset.loaded === src) return;
8025
+ this.dataset.loaded = "";
8026
+ const loading = this.ensure(".c-changelog__loading", () => { const el = document.createElement("div"); el.className = "c-changelog__loading"; el.textContent = "Loading…"; return el; });
8027
+ // clear
8028
+ Array.from(this.querySelectorAll(".c-changelog__entry, .c-changelog__error")).forEach((n) => n.remove());
8029
+ if (!this.querySelector(".c-changelog__loading")) this.appendChild(loading);
8030
+ fetch(src).then((r) => {
8031
+ if (!r.ok) throw new Error("HTTP " + r.status);
8032
+ return r.text();
8033
+ }).then((text) => {
8034
+ const ld = this.querySelector(".c-changelog__loading");
8035
+ if (ld) ld.remove();
8036
+ this.dataset.loaded = src;
8037
+ const entries = parseChangelog(text);
8038
+ const max = parseInt(this.getAttribute("max") || "0", 10);
8039
+ const list = (max > 0) ? entries.slice(0, max) : entries;
8040
+ if (!list.length) {
8041
+ const empty = document.createElement("div");
8042
+ empty.className = "c-changelog__empty";
8043
+ empty.textContent = "No releases found.";
8044
+ this.appendChild(empty);
8045
+ return;
8046
+ }
8047
+ list.forEach((e) => {
8048
+ const det = document.createElement("details");
8049
+ det.className = "c-changelog__entry";
8050
+ const sum = document.createElement("summary");
8051
+ sum.className = "c-changelog__summary";
8052
+ const ver = document.createElement("span");
8053
+ ver.className = "c-changelog__version";
8054
+ ver.textContent = e.version;
8055
+ sum.appendChild(ver);
8056
+ if (e.date) {
8057
+ const d = document.createElement("span");
8058
+ d.className = "c-changelog__date";
8059
+ d.textContent = e.date;
8060
+ sum.appendChild(d);
8061
+ }
8062
+ det.appendChild(sum);
8063
+ const body = document.createElement("div");
8064
+ body.className = "c-changelog__body";
8065
+ body.innerHTML = renderChangelogBody(e.body);
8066
+ det.appendChild(body);
8067
+ this.appendChild(det);
8068
+ });
8069
+ }).catch((err) => {
8070
+ const ld = this.querySelector(".c-changelog__loading");
8071
+ if (ld) ld.remove();
8072
+ const er = document.createElement("div");
8073
+ er.className = "c-changelog__error";
8074
+ er.textContent = "Failed to load changelog: " + (err && err.message ? err.message : err);
8075
+ this.appendChild(er);
8076
+ });
8077
+ }
8078
+ }
8079
+ }
8080
+ define("contour-changelog", ContourChangelog);
8081
+
8082
+ function parseChangelog(text) {
8083
+ const lines = String(text).split(/\r?\n/);
8084
+ const entries = [];
8085
+ let cur = null;
8086
+ for (const line of lines) {
8087
+ const m = line.match(/^##\s+\[?([^\]\n]+)\]?\s*[-–—]?\s*(.*)$/);
8088
+ if (m && (line.startsWith("## ") )) {
8089
+ // only treat as version header if it looks like a version or "Unreleased"
8090
+ const ver = m[1].trim();
8091
+ const rest = m[2].trim();
8092
+ if (/^\d|unreleased/i.test(ver)) {
8093
+ if (cur) entries.push(cur);
8094
+ cur = { version: ver, date: rest.replace(/^[-–—]\s*/, "").trim(), body: "" };
8095
+ continue;
8096
+ }
8097
+ }
8098
+ if (cur) cur.body += line + "\n";
8099
+ }
8100
+ if (cur) entries.push(cur);
8101
+ return entries;
8102
+ }
8103
+
8104
+ function escapeHtml(s) {
8105
+ return String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
8106
+ }
8107
+
8108
+ function renderChangelogBody(body) {
8109
+ const lines = String(body).trim().split(/\r?\n/);
8110
+ const out = [];
8111
+ let inList = false;
8112
+ for (const raw of lines) {
8113
+ const line = raw.trimEnd();
8114
+ if (/^###\s+/.test(line)) {
8115
+ if (inList) { out.push("</ul>"); inList = false; }
8116
+ out.push("<h4>" + escapeHtml(line.replace(/^###\s+/, "")) + "</h4>");
8117
+ } else if (/^##\s+/.test(line)) {
8118
+ if (inList) { out.push("</ul>"); inList = false; }
8119
+ out.push("<h3>" + escapeHtml(line.replace(/^##\s+/, "")) + "</h3>");
8120
+ } else if (/^[-*]\s+/.test(line)) {
8121
+ if (!inList) { out.push("<ul>"); inList = true; }
8122
+ out.push("<li>" + escapeHtml(line.replace(/^[-*]\s+/, "")) + "</li>");
8123
+ } else if (line.trim() === "") {
8124
+ if (inList) { out.push("</ul>"); inList = false; }
8125
+ } else {
8126
+ if (inList) { out.push("</ul>"); inList = false; }
8127
+ out.push("<p>" + escapeHtml(line) + "</p>");
8128
+ }
8129
+ }
8130
+ if (inList) out.push("</ul>");
8131
+ return out.join("");
8132
+ }
8133
+
7933
8134
 
7934
8135
 
7935
8136
 
@@ -11818,6 +12019,27 @@ class ContourScaleBar extends ContourBase {
11818
12019
  }
11819
12020
  define("contour-scale-bar", ContourScaleBar);
11820
12021
 
12022
+ class ContourSplitMap extends ContourBase {
12023
+ static get observed() { return ["left", "right"]; }
12024
+ static get properties() { return { left: { attribute: "left" }, right: { attribute: "right" } }; }
12025
+ render() {
12026
+ this.classList.add("c-split-map");
12027
+ const left = this.ensure(".c-split-map__pane--left", () => {
12028
+ const e = document.createElement("div");
12029
+ e.className = "c-split-map__pane c-split-map__pane--left";
12030
+ return e;
12031
+ });
12032
+ const right = this.ensure(".c-split-map__pane--right", () => {
12033
+ const e = document.createElement("div");
12034
+ e.className = "c-split-map__pane c-split-map__pane--right";
12035
+ return e;
12036
+ });
12037
+ if (left.parentNode !== this) this.appendChild(left);
12038
+ if (right.parentNode !== this) this.appendChild(right);
12039
+ }
12040
+ }
12041
+ define("contour-split-map", ContourSplitMap);
12042
+
11821
12043
  class ContourResizeObserver extends ContourBase {
11822
12044
  static get observed() { return ["debounce"]; }
11823
12045
  static get properties() { return { debounce: { attribute: "debounce" } }; }
@@ -13080,7 +13302,7 @@ class ContourFilterBar extends ContourBase {
13080
13302
  if (modesAttr) { try { modes = JSON.parse(modesAttr); } catch (e) { modes = modesAttr.split(",").map((s) => s.trim()); } }
13081
13303
  if (modes || this.hasAttribute("mode")) {
13082
13304
  let bar = this.querySelector(".c-filter-bar__modes");
13083
- if (!bar) { bar = document.createElement("div"); bar.className = "c-filter-bar__modes"; bar.setAttribute("role", "toolbar"); this.appendChild(bar); }
13305
+ if (!bar) { bar = document.createElement("div"); bar.className = "c-filter-bar__modes"; bar.setAttribute("role", "toolbar"); bar.setAttribute("aria-label", label || "Filter modes"); this.appendChild(bar); }
13084
13306
  bar.innerHTML = "";
13085
13307
  const current = this.getAttribute("mode");
13086
13308
  const list = Array.isArray(modes) ? modes : ["draw", "erase", "select"];
@@ -14778,7 +15000,9 @@ class ContourStylePanel extends ContourBase {
14778
15000
  const breaksWrap = document.createElement("div"); breaksWrap.className = "c-style-panel__breaks";
14779
15001
  breaksArr.forEach((b, i) => {
14780
15002
  const br = document.createElement("div"); br.className = "break";
14781
- br.textContent = String(b);
15003
+ const span = document.createElement("span"); span.textContent = String(b); br.appendChild(span);
15004
+ const inp = document.createElement("input"); inp.type = "number"; inp.className = "c-style-panel__breaks c-input"; inp.setAttribute("aria-label", "Class lower bound"); inp.value = String(b);
15005
+ br.appendChild(inp);
14782
15006
  breaksWrap.appendChild(br);
14783
15007
  });
14784
15008
  body.appendChild(breaksWrap);
@@ -14953,7 +15177,7 @@ class ContourAvatarGroup extends ContourBase {
14953
15177
  av.className = "c-avatar";
14954
15178
  const name = typeof it === "string" ? it : (it.name || it.label || "");
14955
15179
  av.textContent = name.slice(0, 2).toUpperCase();
14956
- if (typeof it === "object" && it.color) av.style.background = it.color;
15180
+ if (typeof it === "object" && it.color) { av.style.background = it.color; av.dataset.color = it.color; }
14957
15181
  this.appendChild(av);
14958
15182
  });
14959
15183
  if (parsed.length > max) {
@@ -15098,6 +15322,7 @@ class ContourPaletteEditor extends ContourBase {
15098
15322
  sw.className = "c-palette-editor__swatch c-swatch";
15099
15323
  sw.type = "button";
15100
15324
  sw.style.background = typeof c === "string" ? c : (c.color || c.value || "");
15325
+ sw.dataset.color = typeof c === "string" ? c : (c.color || c.value || "");
15101
15326
  sw.setAttribute("aria-label", typeof c === "string" ? c : (c.name || c.label || "color"));
15102
15327
  this.appendChild(sw);
15103
15328
  });
@@ -15110,7 +15335,7 @@ class ContourPaletteEditor extends ContourBase {
15110
15335
  this.addEventListener("click", (e) => {
15111
15336
  const sw = e.target && e.target.closest ? e.target.closest(".c-palette-editor__swatch") : null;
15112
15337
  if (sw && this.contains(sw)) {
15113
- this.dispatchEvent(new CustomEvent("contour:change", { bubbles: true, composed: true, detail: { color: sw.style.background } }));
15338
+ this.dispatchEvent(new CustomEvent("contour:change", { bubbles: true, composed: true, detail: { color: (sw.dataset && sw.dataset.color) || sw.style.background } }));
15114
15339
  }
15115
15340
  });
15116
15341
  this.addEventListener("keydown", (e) => {
@@ -15546,8 +15771,8 @@ class ContourColorPicker extends ContourBase {
15546
15771
  btn.type = "button";
15547
15772
  btn.className = "c-color-picker__preset";
15548
15773
  btn.style.background = c;
15549
- btn.setAttribute("aria-label", "Preset " + c);
15550
15774
  btn.dataset.color = c;
15775
+ btn.setAttribute("aria-label", "Preset " + c);
15551
15776
  wrap.appendChild(btn);
15552
15777
  });
15553
15778
  this.appendChild(wrap);
@@ -15904,7 +16129,7 @@ class ContourNotificationCenter extends ContourBase {
15904
16129
  const btn = this.ensure(".c-notification-center__trigger", () => { const el = document.createElement("button"); el.className = "c-btn c-btn--sm c-notification-center__trigger"; el.type = "button"; el.innerHTML = '<span class="c-notification-center__bullet" aria-hidden="true"></span>'; el.setAttribute("aria-haspopup", "dialog"); el.setAttribute("aria-expanded", "false"); return el; });
15905
16130
  const color = this.getAttribute("color");
15906
16131
  const bullet = btn.querySelector(".c-notification-center__bullet");
15907
- if (bullet && color) bullet.style.background = color;
16132
+ if (bullet && color) { bullet.style.background = color; bullet.dataset.color = color; }
15908
16133
  const count = this.getAttribute("count");
15909
16134
  let badge = btn.querySelector(".c-notification-center__badge");
15910
16135
  if (count && Number(count) > 0) {
@@ -16919,6 +17144,7 @@ class ContourDataGrid extends ContourBase {
16919
17144
  td.setAttribute("role", "gridcell");
16920
17145
  td.setAttribute("tabindex", "0");
16921
17146
  td.textContent = r && r[key] != null ? r[key] : "";
17147
+ if (!String(td.textContent).trim()) td.setAttribute("aria-label", "Empty");
16922
17148
  tr.appendChild(td);
16923
17149
  });
16924
17150
  tbody.appendChild(tr);
@@ -16968,6 +17194,7 @@ class ContourDataGrid extends ContourBase {
16968
17194
  td.setAttribute("role", "gridcell");
16969
17195
  td.setAttribute("tabindex", "0");
16970
17196
  td.textContent = r && r[key] != null ? r[key] : "";
17197
+ if (!String(td.textContent).trim()) td.setAttribute("aria-label", "Empty");
16971
17198
  tr.appendChild(td);
16972
17199
  });
16973
17200
  tbody.appendChild(tr);
@@ -17186,6 +17413,55 @@ class ContourTreeGrid extends ContourBase {
17186
17413
  }
17187
17414
  define("contour-tree-grid", ContourTreeGrid);
17188
17415
 
17416
+ class ContourPullToRefresh extends ContourBase {
17417
+ static get observed() { return ["threshold"]; }
17418
+ static get properties() { return { threshold: { attribute: "threshold" } }; }
17419
+ render() {
17420
+ this.classList.add("c-pull-to-refresh");
17421
+ const ind = this.ensure(".c-pull-to-refresh__indicator", () => {
17422
+ const e = document.createElement("div");
17423
+ e.className = "c-pull-to-refresh__indicator";
17424
+ e.textContent = "Pull to refresh";
17425
+ return e;
17426
+ });
17427
+ if (ind.parentNode !== this) this.prepend(ind);
17428
+ }
17429
+ enhance() {
17430
+ if (this._wiredPullToRefresh) return;
17431
+ this._wiredPullToRefresh = true;
17432
+ let startY = 0;
17433
+ let pulling = false;
17434
+ this.addEventListener("touchstart", (e) => {
17435
+ if (this.scrollTop > 0) return;
17436
+ const t = e.touches && e.touches[0];
17437
+ if (t) { startY = t.clientY; pulling = true; }
17438
+ }, { passive: true });
17439
+ this.addEventListener("touchmove", (e) => {
17440
+ if (!pulling) return;
17441
+ const t = e.touches && e.touches[0];
17442
+ if (!t) return;
17443
+ const dy = t.clientY - startY;
17444
+ if (dy > 0 && dy < 120) {
17445
+ this.style.setProperty("--ptr-offset", dy + "px");
17446
+ }
17447
+ }, { passive: true });
17448
+ this.addEventListener("touchend", (e) => {
17449
+ if (!pulling) return;
17450
+ pulling = false;
17451
+ const t = e.changedTouches && e.changedTouches[0];
17452
+ const dy = t ? t.clientY - startY : 0;
17453
+ const thr = Number(this.getAttribute("threshold")) || 60;
17454
+ if (dy >= thr) {
17455
+ this.classList.add("is-refreshing");
17456
+ this.dispatchEvent(new CustomEvent("contour:refresh", { bubbles: true, composed: true }));
17457
+ setTimeout(() => this.classList.remove("is-refreshing"), 800);
17458
+ }
17459
+ this.style.removeProperty("--ptr-offset");
17460
+ }, { passive: true });
17461
+ }
17462
+ }
17463
+ define("contour-pull-to-refresh", ContourPullToRefresh);
17464
+
17189
17465
 
17190
17466
  // ---- Registration: the class-only wrappers run last ------------------
17191
17467
  //