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
@@ -114,6 +114,7 @@
114
114
  "contour:btn-group-change": { payload: ["index", "label"], composed: true },
115
115
  "contour:brush-start": { payload: ["end", "start", "value"], composed: true },
116
116
  "contour:brush-end": { payload: ["end", "start", "value"], composed: true },
117
+ "contour:brush": { payload: ["end", "start", "value"], composed: true },
117
118
  "contour:change": { payload: ["checked", "color", "direction", "end", "files", "high", "index", "low", "month", "name", "speed", "start", "unit", "value", "year"], composed: true },
118
119
  "contour:collapse": { payload: ["collapsed"], composed: true },
119
120
  "contour:cluster-toggle": { payload: ["count", "expanded"], composed: true },
@@ -132,7 +133,9 @@
132
133
  "contour:drop": { payload: ["value", "label"], composed: true },
133
134
  "contour:empty-action": { payload: ["state"], composed: true },
134
135
  "contour:filter": { payload: ["query"], composed: true },
135
- "contour:error": { payload: ["src", "message", "name", "status"], composed: true },
136
+ "contour:error": { payload: ["src", "message", "name", "status"], composed: true },
137
+ "contour:export": { payload: ["format"], composed: true },
138
+ "contour:refresh": { payload: [], composed: true },
136
139
  "contour:hide": { payload: [], composed: true },
137
140
  "contour:hover": { payload: ["row"], composed: true },
138
141
  "contour:input": { payload: ["name", "value", "checked"], composed: true },
@@ -232,7 +235,7 @@
232
235
  export const OBSERVED = [
233
236
  "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",
234
237
  "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",
235
- "empty", "exclusive", "fallback", "format", "heading", "help", "hint", "href", "icon", "illustration", "instrument", "interval", "items", "key", "layers", "level", "range-end", "range-start",
238
+ "empty", "exclusive", "fallback", "filename", "format", "heading", "help", "hint", "href", "icon", "illustration", "instrument", "interval", "items", "key", "layers", "level", "range-end", "range-start",
236
239
  "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",
237
240
  "options", "orientation", "page-size", "pages", "pause", "paused", "pausable", "persist", "placeholder", "playing", "point", "points", "prev", "presets", "progress", "prompt", "question", "recent", "required",
238
241
  "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",
@@ -311,7 +314,18 @@
311
314
  return "scaffold";
312
315
  }
313
316
 
314
- // How many times this host has run `render()`, counting the first connect.
317
+ // Brownout helpers (G-16): components read their degraded level from the
318
+ // `brownout` / `brownout-level` attribute and shed non-essential chrome
319
+ // above a threshold. Centralised here so a new component does not
320
+ // re-implement the attribute lookup.
321
+ brownoutLevel() {
322
+ const raw = this.getAttribute("brownout-level") || this.getAttribute("brownout") || "0";
323
+ const n = parseInt(raw, 10);
324
+ return Number.isFinite(n) ? n : 0;
325
+ }
326
+ shed(kind, threshold) {
327
+ return this.brownoutLevel() >= (threshold || 1);
328
+ }
315
329
  // Read-only and diagnostic: it exists so a page can show that `batch()` did
316
330
  // what it claims instead of asking the reader to believe it, and so a test can
317
331
  // assert a re-render happened without watching for a specific node. A consumer
@@ -905,6 +919,22 @@
905
919
  }
906
920
  }
907
921
 
922
+ // Brownout mixin (G-16): opt-in base for components that shed non-essential
923
+ // chrome under degraded conditions. Merges `brownout` / `brownout-level`
924
+ // into the subclass observed list and exposes the helpers already on
925
+ // ContourBase. Usage: `class Foo extends withBrownout(ContourBase) { ... }`.
926
+ export function withBrownout(Base) {
927
+ return class extends Base {
928
+ static get observed() {
929
+ const base = (super.observed && Array.isArray(super.observed)) ? super.observed : [];
930
+ const extra = ["brownout", "brownout-level"];
931
+ return Array.from(new Set(base.concat(extra)));
932
+ }
933
+ brownoutLevel() { return super.brownoutLevel ? super.brownoutLevel() : (parseInt(this.getAttribute("brownout-level") || this.getAttribute("brownout") || "0", 10) || 0); }
934
+ shed(kind, threshold) { return this.brownoutLevel() >= (threshold || 1); }
935
+ };
936
+ }
937
+
908
938
  // Simple component: just adds CSS classes.
909
939
  /** Create a light-DOM component that only applies block and modifier classes. */
910
940
  export const simple = (classes) => class extends ContourBase {
@@ -5682,7 +5712,7 @@ class ContourGauge extends ContourBase {
5682
5712
  const showHeader = this.getAttribute("show-header") !== "false";
5683
5713
  const description = this.getAttribute("description");
5684
5714
  const noDataMessage = this.getAttribute("no-data-message") || "No readings in view";
5685
- const brownoutLevel = parseInt(this.getAttribute("brownout-level") || this.getAttribute("brownout") || "0", 10) || 0;
5715
+ const brownoutLevel = this.brownoutLevel();
5686
5716
  // empty state
5687
5717
  if (!hasValue) {
5688
5718
  if (heading && showHeader) {
@@ -5716,7 +5746,7 @@ class ContourGauge extends ContourBase {
5716
5746
  }
5717
5747
  }
5718
5748
  // dial (unless brownout >= 3)
5719
- const shedDial = brownoutLevel >= 3;
5749
+ const shedDial = this.shed("dial", 3);
5720
5750
  let dial = this.querySelector(".c-gauge__dial");
5721
5751
  if (shedDial) {
5722
5752
  if (dial) dial.remove();
@@ -5947,6 +5977,7 @@ class ContourBrush extends ContourBase {
5947
5977
  if (eh) eh.style.insetInlineStart = (((ne - mn) / range) * 100) + "%";
5948
5978
  // stash pending values
5949
5979
  this._brushPending = { start: ns, end: ne };
5980
+ this.dispatchEvent(new CustomEvent("contour:brush", { bubbles: true, composed: true, detail: { start: ns, end: ne, value: ns } }));
5950
5981
  });
5951
5982
  this.addEventListener("pointerup", (e) => {
5952
5983
  if (!dragging) return;
@@ -5958,6 +5989,7 @@ class ContourBrush extends ContourBase {
5958
5989
  this._brushPending = null;
5959
5990
  }
5960
5991
  this.dispatchEvent(new CustomEvent("contour:brush-end", { bubbles: true, composed: true, detail: { value: this.getAttribute("end"), start: this.getAttribute("start"), end: this.getAttribute("end") } }));
5992
+ this.dispatchEvent(new CustomEvent("contour:brush", { bubbles: true, composed: true, detail: { start: this.getAttribute("start"), end: this.getAttribute("end"), value: this.getAttribute("end") } }));
5961
5993
  });
5962
5994
  // Keyboard: Enter/Space emits brush-start/brush-end (WC-P1-08).
5963
5995
  if (!this.hasAttribute("tabindex")) this.setAttribute("tabindex", "0");
@@ -5993,7 +6025,7 @@ class ContourStackedBar extends ContourBase {
5993
6025
  segments = authoredSegments.map((el) => ({
5994
6026
  label: el.getAttribute("title") || el.textContent || "",
5995
6027
  value: parseFloat(el.style.inlineSize) || 0,
5996
- color: el.style.background || undefined,
6028
+ color: (el.dataset && el.dataset.color) || el.style.background || undefined,
5997
6029
  }));
5998
6030
  authoredSegments.forEach((el) => el.remove());
5999
6031
  } else {
@@ -6010,6 +6042,7 @@ class ContourStackedBar extends ContourBase {
6010
6042
  el.className = "c-stacked-bar__segment";
6011
6043
  el.style.inlineSize = ((v / denom) * 100) + "%";
6012
6044
  el.style.background = (typeof seg === "object" && seg.color) ? seg.color : "var(--chart-" + ((i % 8) + 1) + ")";
6045
+ el.dataset.color = (typeof seg === "object" && seg.color) ? seg.color : el.style.background;
6013
6046
  el.setAttribute("title", (typeof seg === "object" ? (seg.label || "") : "") + " " + v);
6014
6047
  this.appendChild(el);
6015
6048
  });
@@ -6163,7 +6196,7 @@ class ContourDonut extends ContourBase {
6163
6196
  const lbl = el.querySelector("span:last-child");
6164
6197
  const text = lbl ? lbl.textContent : el.textContent;
6165
6198
  const match = text.match(/—\s*(\d+(?:\.\d+)?)$/);
6166
- items.push({ label: text.replace(/—\s*\d+(?:\.\d+)?$/, "").trim(), value: match ? Number(match[1]) : 0, color: sw ? sw.style.background : undefined });
6199
+ 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 });
6167
6200
  });
6168
6201
  // remove authored items from DOM (they will be regenerated below)
6169
6202
  authoredItems.forEach((el) => el.remove());
@@ -6173,8 +6206,8 @@ class ContourDonut extends ContourBase {
6173
6206
  }
6174
6207
  const values = items.map((it) => (typeof it === "object" ? (it.value || 0) : Number(it) || 0));
6175
6208
  const total = values.reduce((a, b) => a + b, 0) || 1;
6176
- const brownoutLevel = parseInt(this.getAttribute("brownout-level") || this.getAttribute("brownout") || "0", 10) || 0;
6177
- const shedRing = brownoutLevel >= 3;
6209
+ const brownoutLevel = this.brownoutLevel();
6210
+ const shedRing = this.shed("ring", 3);
6178
6211
  if (!shedRing) {
6179
6212
  const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
6180
6213
  svg.setAttribute("class", "c-donut__ring");
@@ -6215,6 +6248,7 @@ class ContourDonut extends ContourBase {
6215
6248
  const sw = document.createElement("span");
6216
6249
  sw.className = "c-donut__swatch";
6217
6250
  sw.style.background = (typeof it === "object" && it.color) ? it.color : "var(--chart-" + ((i % 8) + 1) + ")";
6251
+ if (sw.style.background) sw.dataset.color = (typeof it === "object" && it.color) ? it.color : sw.style.background;
6218
6252
  row.appendChild(sw);
6219
6253
  const lbl = document.createElement("span");
6220
6254
  lbl.textContent = (typeof it === "object" ? (it.label || "") : String(it)) + " — " + values[i];
@@ -6433,6 +6467,7 @@ class ContourPivot extends ContourBase {
6433
6467
  const corner = document.createElement("th");
6434
6468
  corner.textContent = "";
6435
6469
  corner.setAttribute("role", "columnheader");
6470
+ corner.setAttribute("aria-label", "Row");
6436
6471
  hr.appendChild(corner);
6437
6472
  visibleCols.forEach((c) => { const th = document.createElement("th"); th.textContent = c; th.setAttribute("role", "columnheader"); th.setAttribute("tabindex", "0"); hr.appendChild(th); });
6438
6473
  thead.appendChild(hr);
@@ -6460,6 +6495,7 @@ class ContourPivot extends ContourBase {
6460
6495
  } else {
6461
6496
  td.textContent = "";
6462
6497
  }
6498
+ if (!td.textContent.trim()) td.setAttribute("aria-label", "Empty");
6463
6499
  tr.appendChild(td);
6464
6500
  });
6465
6501
  tbody.appendChild(tr);
@@ -6624,7 +6660,7 @@ class ContourBivariate extends ContourBase {
6624
6660
  // Palette runs from bottom-left (low/low) to top-right (high/high):
6625
6661
  // reverse the row order so the first palette row sits at the bottom.
6626
6662
  const srcIndex = (size - 1 - r) * size + c;
6627
- if (colors[srcIndex]) cell.style.background = colors[srcIndex];
6663
+ if (colors[srcIndex]) { cell.style.background = colors[srcIndex]; cell.dataset.color = colors[srcIndex]; }
6628
6664
  matrix.appendChild(cell);
6629
6665
  }
6630
6666
  }
@@ -6885,7 +6921,7 @@ class ContourLegend extends ContourBase {
6885
6921
  items = JSON.stringify(authoredLegendItems.map((el) => {
6886
6922
  const sw = el.querySelector(".c-legend__swatch");
6887
6923
  const lbl = el.querySelector(".c-legend__label") || el;
6888
- return { label: lbl ? lbl.textContent.trim() : el.textContent.trim(), color: sw ? sw.style.background || undefined : undefined };
6924
+ return { label: lbl ? lbl.textContent.trim() : el.textContent.trim(), color: sw ? (sw.dataset && sw.dataset.color) || sw.style.background || undefined : undefined };
6889
6925
  }));
6890
6926
  authoredLegendItems.forEach((el) => el.remove());
6891
6927
  }
@@ -6901,19 +6937,18 @@ class ContourLegend extends ContourBase {
6901
6937
  try {
6902
6938
  const parsed = JSON.parse(items);
6903
6939
  const list = this.ensure(".c-legend__items", () => { const el = document.createElement("div"); el.className = "c-legend__items"; return el; });
6904
- list.setAttribute("role", selectable ? "group" : "listbox");
6940
+ list.setAttribute("role", "listbox");
6905
6941
  if (title) list.setAttribute("aria-label", title);
6906
6942
  list.innerHTML = "";
6907
6943
  parsed.forEach((it) => {
6908
6944
  const label = typeof it === "string" ? it : (it.label || String(it));
6909
6945
  const key = typeof it === "string" ? it : (it.key || it.label || String(it));
6910
- const item = document.createElement(selectable ? "button" : "div");
6946
+ const item = document.createElement("div");
6911
6947
  item.className = "c-legend__item";
6912
6948
  item.setAttribute("tabindex", "-1");
6913
6949
  if (selectable) {
6914
- item.type = "button";
6915
- item.setAttribute("role", "button");
6916
- item.setAttribute("aria-pressed", "true");
6950
+ item.setAttribute("role", "option");
6951
+ item.setAttribute("aria-selected", "true");
6917
6952
  item.dataset.key = key;
6918
6953
  } else {
6919
6954
  item.setAttribute("role", "option");
@@ -6921,7 +6956,7 @@ class ContourLegend extends ContourBase {
6921
6956
  }
6922
6957
  const sw = document.createElement("span");
6923
6958
  sw.className = "c-legend__swatch";
6924
- if (it && it.color) sw.style.background = it.color;
6959
+ if (it && it.color) { sw.style.background = it.color; sw.dataset.color = it.color; }
6925
6960
  item.appendChild(sw);
6926
6961
  // geometry glyph
6927
6962
  const glyphShape = (it && (it.shape || it.marker || it.glyph)) || this.getAttribute("glyphs");
@@ -6994,6 +7029,7 @@ class ContourLegend extends ContourBase {
6994
7029
  const glyph = document.createElement("span");
6995
7030
  glyph.className = "glyph";
6996
7031
  glyph.style.background = ndColor;
7032
+ glyph.dataset.color = ndColor;
6997
7033
  nd.prepend(glyph);
6998
7034
  } else {
6999
7035
  const nd = this.querySelector(".c-legend__no-data");
@@ -7130,10 +7166,10 @@ class ContourLegend extends ContourBase {
7130
7166
  this.addEventListener("click", (e) => {
7131
7167
  const btn = e.target && e.target.closest ? e.target.closest(".c-legend__item") : null;
7132
7168
  if (!btn || !this.contains(btn)) return;
7133
- const pressed = btn.getAttribute("aria-pressed") !== "true";
7134
- btn.setAttribute("aria-pressed", String(pressed));
7169
+ const selected = btn.getAttribute("aria-selected") !== "true";
7170
+ btn.setAttribute("aria-selected", String(selected));
7135
7171
  this.dispatchEvent(new CustomEvent("contour:legend-toggle", {
7136
- detail: { label: btn.textContent.trim(), key: btn.dataset.key || btn.textContent.trim(), pressed },
7172
+ detail: { label: btn.textContent.trim(), key: btn.dataset.key || btn.textContent.trim(), pressed: selected },
7137
7173
  bubbles: true,
7138
7174
  composed: true,
7139
7175
  }));
@@ -7768,6 +7804,54 @@ class ContourErrorBoundary extends ContourBase {
7768
7804
  }
7769
7805
  define("contour-error-boundary", ContourErrorBoundary);
7770
7806
 
7807
+ class ContourDataExport extends ContourBase {
7808
+ static get observed() { return ["data", "format", "filename", "label"]; }
7809
+ static get properties() { return { data: { attribute: "data" }, format: { attribute: "format" }, filename: { attribute: "filename" }, label: { attribute: "label" } }; }
7810
+ render() {
7811
+ this.classList.add("c-data-export");
7812
+ const fmt = (this.getAttribute("format") || "json").toLowerCase();
7813
+ const btn = this.ensure(".c-data-export__btn", () => {
7814
+ const b = document.createElement("button");
7815
+ b.className = "c-data-export__btn";
7816
+ b.type = "button";
7817
+ return b;
7818
+ });
7819
+ btn.textContent = this.getAttribute("label") || ("Export " + fmt.toUpperCase());
7820
+ if (btn.parentNode !== this) this.appendChild(btn);
7821
+ }
7822
+ enhance() {
7823
+ if (this._wiredDataExport) return;
7824
+ this._wiredDataExport = true;
7825
+ this.addEventListener("click", (e) => {
7826
+ const btn = e.target && e.target.closest ? e.target.closest(".c-data-export__btn") : null;
7827
+ if (!btn || !this.contains(btn)) return;
7828
+ const fmt = (this.getAttribute("format") || "json").toLowerCase();
7829
+ const raw = this.getAttribute("data") || "[]";
7830
+ let text = raw;
7831
+ if (fmt === "csv") {
7832
+ try {
7833
+ const arr = JSON.parse(raw);
7834
+ if (Array.isArray(arr) && arr.length) {
7835
+ const keys = Object.keys(arr[0]);
7836
+ text = [keys.join(",")].concat(arr.map((r) => keys.map((k) => JSON.stringify(r[k] ?? "")).join(","))).join("\n");
7837
+ }
7838
+ } catch (e) {}
7839
+ }
7840
+ const blob = new Blob([text], { type: fmt === "csv" ? "text/csv" : "application/json" });
7841
+ const url = URL.createObjectURL(blob);
7842
+ const a = document.createElement("a");
7843
+ a.href = url;
7844
+ a.download = this.getAttribute("filename") || ("export." + fmt);
7845
+ document.body.appendChild(a);
7846
+ a.click();
7847
+ a.remove();
7848
+ URL.revokeObjectURL(url);
7849
+ this.dispatchEvent(new CustomEvent("contour:export", { bubbles: true, composed: true, detail: { format: fmt } }));
7850
+ });
7851
+ }
7852
+ }
7853
+ define("contour-data-export", ContourDataExport);
7854
+
7771
7855
 
7772
7856
 
7773
7857
  class ContourDocsNav extends ContourBase {
@@ -7928,6 +8012,123 @@ class ContourFileTree extends ContourBase {
7928
8012
  }
7929
8013
  define("contour-file-tree", ContourFileTree);
7930
8014
 
8015
+ class ContourChangelog extends ContourBase {
8016
+ static get observed() { return ["src", "max", "loading", "error"]; }
8017
+ static get properties() { return { src: { attribute: "src" }, max: { attribute: "max", type: Number } }; }
8018
+ render() {
8019
+ this.classList.add("c-changelog");
8020
+ const src = this.getAttribute("src");
8021
+ if (src) {
8022
+ if (this.dataset.loaded === src) return;
8023
+ this.dataset.loaded = "";
8024
+ const loading = this.ensure(".c-changelog__loading", () => { const el = document.createElement("div"); el.className = "c-changelog__loading"; el.textContent = "Loading…"; return el; });
8025
+ // clear
8026
+ Array.from(this.querySelectorAll(".c-changelog__entry, .c-changelog__error")).forEach((n) => n.remove());
8027
+ if (!this.querySelector(".c-changelog__loading")) this.appendChild(loading);
8028
+ fetch(src).then((r) => {
8029
+ if (!r.ok) throw new Error("HTTP " + r.status);
8030
+ return r.text();
8031
+ }).then((text) => {
8032
+ const ld = this.querySelector(".c-changelog__loading");
8033
+ if (ld) ld.remove();
8034
+ this.dataset.loaded = src;
8035
+ const entries = parseChangelog(text);
8036
+ const max = parseInt(this.getAttribute("max") || "0", 10);
8037
+ const list = (max > 0) ? entries.slice(0, max) : entries;
8038
+ if (!list.length) {
8039
+ const empty = document.createElement("div");
8040
+ empty.className = "c-changelog__empty";
8041
+ empty.textContent = "No releases found.";
8042
+ this.appendChild(empty);
8043
+ return;
8044
+ }
8045
+ list.forEach((e) => {
8046
+ const det = document.createElement("details");
8047
+ det.className = "c-changelog__entry";
8048
+ const sum = document.createElement("summary");
8049
+ sum.className = "c-changelog__summary";
8050
+ const ver = document.createElement("span");
8051
+ ver.className = "c-changelog__version";
8052
+ ver.textContent = e.version;
8053
+ sum.appendChild(ver);
8054
+ if (e.date) {
8055
+ const d = document.createElement("span");
8056
+ d.className = "c-changelog__date";
8057
+ d.textContent = e.date;
8058
+ sum.appendChild(d);
8059
+ }
8060
+ det.appendChild(sum);
8061
+ const body = document.createElement("div");
8062
+ body.className = "c-changelog__body";
8063
+ body.innerHTML = renderChangelogBody(e.body);
8064
+ det.appendChild(body);
8065
+ this.appendChild(det);
8066
+ });
8067
+ }).catch((err) => {
8068
+ const ld = this.querySelector(".c-changelog__loading");
8069
+ if (ld) ld.remove();
8070
+ const er = document.createElement("div");
8071
+ er.className = "c-changelog__error";
8072
+ er.textContent = "Failed to load changelog: " + (err && err.message ? err.message : err);
8073
+ this.appendChild(er);
8074
+ });
8075
+ }
8076
+ }
8077
+ }
8078
+ define("contour-changelog", ContourChangelog);
8079
+
8080
+ function parseChangelog(text) {
8081
+ const lines = String(text).split(/\r?\n/);
8082
+ const entries = [];
8083
+ let cur = null;
8084
+ for (const line of lines) {
8085
+ const m = line.match(/^##\s+\[?([^\]\n]+)\]?\s*[-–—]?\s*(.*)$/);
8086
+ if (m && (line.startsWith("## ") )) {
8087
+ // only treat as version header if it looks like a version or "Unreleased"
8088
+ const ver = m[1].trim();
8089
+ const rest = m[2].trim();
8090
+ if (/^\d|unreleased/i.test(ver)) {
8091
+ if (cur) entries.push(cur);
8092
+ cur = { version: ver, date: rest.replace(/^[-–—]\s*/, "").trim(), body: "" };
8093
+ continue;
8094
+ }
8095
+ }
8096
+ if (cur) cur.body += line + "\n";
8097
+ }
8098
+ if (cur) entries.push(cur);
8099
+ return entries;
8100
+ }
8101
+
8102
+ function escapeHtml(s) {
8103
+ return String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
8104
+ }
8105
+
8106
+ function renderChangelogBody(body) {
8107
+ const lines = String(body).trim().split(/\r?\n/);
8108
+ const out = [];
8109
+ let inList = false;
8110
+ for (const raw of lines) {
8111
+ const line = raw.trimEnd();
8112
+ if (/^###\s+/.test(line)) {
8113
+ if (inList) { out.push("</ul>"); inList = false; }
8114
+ out.push("<h4>" + escapeHtml(line.replace(/^###\s+/, "")) + "</h4>");
8115
+ } else if (/^##\s+/.test(line)) {
8116
+ if (inList) { out.push("</ul>"); inList = false; }
8117
+ out.push("<h3>" + escapeHtml(line.replace(/^##\s+/, "")) + "</h3>");
8118
+ } else if (/^[-*]\s+/.test(line)) {
8119
+ if (!inList) { out.push("<ul>"); inList = true; }
8120
+ out.push("<li>" + escapeHtml(line.replace(/^[-*]\s+/, "")) + "</li>");
8121
+ } else if (line.trim() === "") {
8122
+ if (inList) { out.push("</ul>"); inList = false; }
8123
+ } else {
8124
+ if (inList) { out.push("</ul>"); inList = false; }
8125
+ out.push("<p>" + escapeHtml(line) + "</p>");
8126
+ }
8127
+ }
8128
+ if (inList) out.push("</ul>");
8129
+ return out.join("");
8130
+ }
8131
+
7931
8132
 
7932
8133
 
7933
8134
 
@@ -11816,6 +12017,27 @@ class ContourScaleBar extends ContourBase {
11816
12017
  }
11817
12018
  define("contour-scale-bar", ContourScaleBar);
11818
12019
 
12020
+ class ContourSplitMap extends ContourBase {
12021
+ static get observed() { return ["left", "right"]; }
12022
+ static get properties() { return { left: { attribute: "left" }, right: { attribute: "right" } }; }
12023
+ render() {
12024
+ this.classList.add("c-split-map");
12025
+ const left = this.ensure(".c-split-map__pane--left", () => {
12026
+ const e = document.createElement("div");
12027
+ e.className = "c-split-map__pane c-split-map__pane--left";
12028
+ return e;
12029
+ });
12030
+ const right = this.ensure(".c-split-map__pane--right", () => {
12031
+ const e = document.createElement("div");
12032
+ e.className = "c-split-map__pane c-split-map__pane--right";
12033
+ return e;
12034
+ });
12035
+ if (left.parentNode !== this) this.appendChild(left);
12036
+ if (right.parentNode !== this) this.appendChild(right);
12037
+ }
12038
+ }
12039
+ define("contour-split-map", ContourSplitMap);
12040
+
11819
12041
  class ContourResizeObserver extends ContourBase {
11820
12042
  static get observed() { return ["debounce"]; }
11821
12043
  static get properties() { return { debounce: { attribute: "debounce" } }; }
@@ -13078,7 +13300,7 @@ class ContourFilterBar extends ContourBase {
13078
13300
  if (modesAttr) { try { modes = JSON.parse(modesAttr); } catch (e) { modes = modesAttr.split(",").map((s) => s.trim()); } }
13079
13301
  if (modes || this.hasAttribute("mode")) {
13080
13302
  let bar = this.querySelector(".c-filter-bar__modes");
13081
- if (!bar) { bar = document.createElement("div"); bar.className = "c-filter-bar__modes"; bar.setAttribute("role", "toolbar"); this.appendChild(bar); }
13303
+ 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); }
13082
13304
  bar.innerHTML = "";
13083
13305
  const current = this.getAttribute("mode");
13084
13306
  const list = Array.isArray(modes) ? modes : ["draw", "erase", "select"];
@@ -14776,7 +14998,9 @@ class ContourStylePanel extends ContourBase {
14776
14998
  const breaksWrap = document.createElement("div"); breaksWrap.className = "c-style-panel__breaks";
14777
14999
  breaksArr.forEach((b, i) => {
14778
15000
  const br = document.createElement("div"); br.className = "break";
14779
- br.textContent = String(b);
15001
+ const span = document.createElement("span"); span.textContent = String(b); br.appendChild(span);
15002
+ 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);
15003
+ br.appendChild(inp);
14780
15004
  breaksWrap.appendChild(br);
14781
15005
  });
14782
15006
  body.appendChild(breaksWrap);
@@ -14951,7 +15175,7 @@ class ContourAvatarGroup extends ContourBase {
14951
15175
  av.className = "c-avatar";
14952
15176
  const name = typeof it === "string" ? it : (it.name || it.label || "");
14953
15177
  av.textContent = name.slice(0, 2).toUpperCase();
14954
- if (typeof it === "object" && it.color) av.style.background = it.color;
15178
+ if (typeof it === "object" && it.color) { av.style.background = it.color; av.dataset.color = it.color; }
14955
15179
  this.appendChild(av);
14956
15180
  });
14957
15181
  if (parsed.length > max) {
@@ -15096,6 +15320,7 @@ class ContourPaletteEditor extends ContourBase {
15096
15320
  sw.className = "c-palette-editor__swatch c-swatch";
15097
15321
  sw.type = "button";
15098
15322
  sw.style.background = typeof c === "string" ? c : (c.color || c.value || "");
15323
+ sw.dataset.color = typeof c === "string" ? c : (c.color || c.value || "");
15099
15324
  sw.setAttribute("aria-label", typeof c === "string" ? c : (c.name || c.label || "color"));
15100
15325
  this.appendChild(sw);
15101
15326
  });
@@ -15108,7 +15333,7 @@ class ContourPaletteEditor extends ContourBase {
15108
15333
  this.addEventListener("click", (e) => {
15109
15334
  const sw = e.target && e.target.closest ? e.target.closest(".c-palette-editor__swatch") : null;
15110
15335
  if (sw && this.contains(sw)) {
15111
- this.dispatchEvent(new CustomEvent("contour:change", { bubbles: true, composed: true, detail: { color: sw.style.background } }));
15336
+ this.dispatchEvent(new CustomEvent("contour:change", { bubbles: true, composed: true, detail: { color: (sw.dataset && sw.dataset.color) || sw.style.background } }));
15112
15337
  }
15113
15338
  });
15114
15339
  this.addEventListener("keydown", (e) => {
@@ -15544,8 +15769,8 @@ class ContourColorPicker extends ContourBase {
15544
15769
  btn.type = "button";
15545
15770
  btn.className = "c-color-picker__preset";
15546
15771
  btn.style.background = c;
15547
- btn.setAttribute("aria-label", "Preset " + c);
15548
15772
  btn.dataset.color = c;
15773
+ btn.setAttribute("aria-label", "Preset " + c);
15549
15774
  wrap.appendChild(btn);
15550
15775
  });
15551
15776
  this.appendChild(wrap);
@@ -15902,7 +16127,7 @@ class ContourNotificationCenter extends ContourBase {
15902
16127
  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; });
15903
16128
  const color = this.getAttribute("color");
15904
16129
  const bullet = btn.querySelector(".c-notification-center__bullet");
15905
- if (bullet && color) bullet.style.background = color;
16130
+ if (bullet && color) { bullet.style.background = color; bullet.dataset.color = color; }
15906
16131
  const count = this.getAttribute("count");
15907
16132
  let badge = btn.querySelector(".c-notification-center__badge");
15908
16133
  if (count && Number(count) > 0) {
@@ -16917,6 +17142,7 @@ class ContourDataGrid extends ContourBase {
16917
17142
  td.setAttribute("role", "gridcell");
16918
17143
  td.setAttribute("tabindex", "0");
16919
17144
  td.textContent = r && r[key] != null ? r[key] : "";
17145
+ if (!String(td.textContent).trim()) td.setAttribute("aria-label", "Empty");
16920
17146
  tr.appendChild(td);
16921
17147
  });
16922
17148
  tbody.appendChild(tr);
@@ -16966,6 +17192,7 @@ class ContourDataGrid extends ContourBase {
16966
17192
  td.setAttribute("role", "gridcell");
16967
17193
  td.setAttribute("tabindex", "0");
16968
17194
  td.textContent = r && r[key] != null ? r[key] : "";
17195
+ if (!String(td.textContent).trim()) td.setAttribute("aria-label", "Empty");
16969
17196
  tr.appendChild(td);
16970
17197
  });
16971
17198
  tbody.appendChild(tr);
@@ -17184,6 +17411,55 @@ class ContourTreeGrid extends ContourBase {
17184
17411
  }
17185
17412
  define("contour-tree-grid", ContourTreeGrid);
17186
17413
 
17414
+ class ContourPullToRefresh extends ContourBase {
17415
+ static get observed() { return ["threshold"]; }
17416
+ static get properties() { return { threshold: { attribute: "threshold" } }; }
17417
+ render() {
17418
+ this.classList.add("c-pull-to-refresh");
17419
+ const ind = this.ensure(".c-pull-to-refresh__indicator", () => {
17420
+ const e = document.createElement("div");
17421
+ e.className = "c-pull-to-refresh__indicator";
17422
+ e.textContent = "Pull to refresh";
17423
+ return e;
17424
+ });
17425
+ if (ind.parentNode !== this) this.prepend(ind);
17426
+ }
17427
+ enhance() {
17428
+ if (this._wiredPullToRefresh) return;
17429
+ this._wiredPullToRefresh = true;
17430
+ let startY = 0;
17431
+ let pulling = false;
17432
+ this.addEventListener("touchstart", (e) => {
17433
+ if (this.scrollTop > 0) return;
17434
+ const t = e.touches && e.touches[0];
17435
+ if (t) { startY = t.clientY; pulling = true; }
17436
+ }, { passive: true });
17437
+ this.addEventListener("touchmove", (e) => {
17438
+ if (!pulling) return;
17439
+ const t = e.touches && e.touches[0];
17440
+ if (!t) return;
17441
+ const dy = t.clientY - startY;
17442
+ if (dy > 0 && dy < 120) {
17443
+ this.style.setProperty("--ptr-offset", dy + "px");
17444
+ }
17445
+ }, { passive: true });
17446
+ this.addEventListener("touchend", (e) => {
17447
+ if (!pulling) return;
17448
+ pulling = false;
17449
+ const t = e.changedTouches && e.changedTouches[0];
17450
+ const dy = t ? t.clientY - startY : 0;
17451
+ const thr = Number(this.getAttribute("threshold")) || 60;
17452
+ if (dy >= thr) {
17453
+ this.classList.add("is-refreshing");
17454
+ this.dispatchEvent(new CustomEvent("contour:refresh", { bubbles: true, composed: true }));
17455
+ setTimeout(() => this.classList.remove("is-refreshing"), 800);
17456
+ }
17457
+ this.style.removeProperty("--ptr-offset");
17458
+ }, { passive: true });
17459
+ }
17460
+ }
17461
+ define("contour-pull-to-refresh", ContourPullToRefresh);
17462
+
17187
17463
 
17188
17464
  // ---- Registration: the class-only wrappers run last ------------------
17189
17465
  //