contour-ds 1.5.0 → 1.7.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.
- package/README.md +25 -3
- package/dist/build-manifest.json +79 -79
- package/dist/contour-wc.esm.js +348 -38
- package/dist/contour-wc.esm.min.js +1 -1
- package/dist/contour-wc.js +348 -38
- package/dist/contour-wc.min.js +1 -1
- package/dist/contour.components.json +2280 -204
- package/dist/contour.css +1658 -857
- package/dist/contour.d.ts +10 -1
- package/dist/contour.esm.js +7 -0
- package/dist/contour.esm.min.js +1 -1
- package/dist/contour.js +7 -0
- package/dist/contour.min.css +1 -1
- package/dist/contour.min.js +1 -1
- package/dist/contour.tokens.json +10 -2
- package/dist/docs/actions.md +2 -2
- package/dist/docs/affordances.md +4 -2
- package/dist/docs/apireference.md +30 -0
- package/dist/docs/colour.md +2 -2
- package/dist/docs/componentindex.md +2 -2
- package/dist/docs/data.md +2 -2
- package/dist/docs/docs.md +2 -2
- package/dist/docs/feedback.md +2 -2
- package/dist/docs/field.md +2 -2
- package/dist/docs/forms.md +2 -2
- package/dist/docs/index.json +24 -11
- package/dist/docs/install.md +2 -2
- package/dist/docs/landing.md +2 -2
- package/dist/docs/mapengine.md +2 -2
- package/dist/docs/motion.md +2 -2
- package/dist/docs/navigation.md +2 -2
- package/dist/docs/overlays.md +2 -2
- package/dist/docs/overview.md +2 -2
- package/dist/docs/patterns.md +2 -2
- package/dist/docs/playground.md +2 -2
- package/dist/docs/principles.md +2 -2
- package/dist/docs/recipes.md +2 -2
- package/dist/docs/space.md +2 -2
- package/dist/docs/status.md +2 -2
- package/dist/docs/surfaces.md +2 -2
- package/dist/docs/theming.md +2 -2
- package/dist/docs/type.md +2 -2
- package/dist/docs/webcomponents.md +3 -7
- package/dist/registry/items/contour-core.json +2 -2
- package/dist/registry/items/contour-data.json +2 -2
- package/dist/registry/items/contour-docs.json +2 -2
- package/dist/registry/items/contour-landing.json +2 -2
- package/dist/registry/registry.json +8 -8
- package/dist/surfaces/contour-core.min.css +1 -1
- package/dist/surfaces/contour-data.min.css +1 -1
- package/dist/surfaces/contour-docs.min.css +1 -1
- package/dist/surfaces/contour-landing.min.css +1 -1
- package/dist/wc/content.mjs +1 -0
- package/dist/wc/core.mjs +33 -3
- package/dist/wc/data.mjs +96 -21
- package/dist/wc/docs.mjs +117 -0
- package/dist/wc/forms.mjs +6 -2
- package/dist/wc/index.mjs +25 -1
- package/dist/wc/interaction.mjs +3 -1
- package/dist/wc/layout.mjs +2 -2
- package/dist/wc/map.mjs +21 -0
- package/dist/wc/navigation.mjs +2 -1
- package/dist/wc/ui.mjs +67 -8
- package/package.json +1 -1
package/dist/contour-wc.esm.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
//
|
|
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 {
|
|
@@ -3406,6 +3436,7 @@ class ContourShowcaseFull extends ContourBase {
|
|
|
3406
3436
|
static get properties() { return { title: { attribute: "title" }, text: { attribute: "text" }, media: { attribute: "media" }, reverse: { attribute: "reverse" }, items: { attribute: "items" }, src: { attribute: "src" } }; }
|
|
3407
3437
|
render() {
|
|
3408
3438
|
this.classList.add("c-showcase");
|
|
3439
|
+
this.setAttribute("role", "list");
|
|
3409
3440
|
if (this.hasAttribute("reverse")) this.classList.add("c-showcase--reverse"); else this.classList.remove("c-showcase--reverse");
|
|
3410
3441
|
const title = this.getAttribute("title");
|
|
3411
3442
|
if (title) this.setAttribute("aria-label", title);
|
|
@@ -4394,7 +4425,7 @@ class ContourTable extends ContourBase {
|
|
|
4394
4425
|
btn.className = "c-btn c-btn--ghost c-btn--sm";
|
|
4395
4426
|
btn.type = "button";
|
|
4396
4427
|
btn.textContent = this.getAttribute("retry") || "Retry";
|
|
4397
|
-
btn.
|
|
4428
|
+
btn.classList.add("u-ms-sm");
|
|
4398
4429
|
btn.dataset.action = "retry";
|
|
4399
4430
|
td.appendChild(btn);
|
|
4400
4431
|
}
|
|
@@ -4870,7 +4901,7 @@ class ContourChart extends ContourBase {
|
|
|
4870
4901
|
btn.type = "button";
|
|
4871
4902
|
btn.textContent = this.getAttribute("retry") || "Retry";
|
|
4872
4903
|
btn.dataset.action = "retry";
|
|
4873
|
-
btn.
|
|
4904
|
+
btn.classList.add("u-mbs-sm");
|
|
4874
4905
|
err.appendChild(btn);
|
|
4875
4906
|
}
|
|
4876
4907
|
plot.appendChild(err);
|
|
@@ -4891,7 +4922,7 @@ class ContourChart extends ContourBase {
|
|
|
4891
4922
|
sk.style.display = "block";
|
|
4892
4923
|
sk.style.inlineSize = "100%";
|
|
4893
4924
|
sk.style.blockSize = "0.6rem";
|
|
4894
|
-
sk.
|
|
4925
|
+
sk.classList.add("u-mbe-2xs");
|
|
4895
4926
|
plot.appendChild(sk);
|
|
4896
4927
|
}
|
|
4897
4928
|
const axis = this.getAttribute("axis");
|
|
@@ -5682,7 +5713,7 @@ class ContourGauge extends ContourBase {
|
|
|
5682
5713
|
const showHeader = this.getAttribute("show-header") !== "false";
|
|
5683
5714
|
const description = this.getAttribute("description");
|
|
5684
5715
|
const noDataMessage = this.getAttribute("no-data-message") || "No readings in view";
|
|
5685
|
-
const brownoutLevel =
|
|
5716
|
+
const brownoutLevel = this.brownoutLevel();
|
|
5686
5717
|
// empty state
|
|
5687
5718
|
if (!hasValue) {
|
|
5688
5719
|
if (heading && showHeader) {
|
|
@@ -5716,7 +5747,7 @@ class ContourGauge extends ContourBase {
|
|
|
5716
5747
|
}
|
|
5717
5748
|
}
|
|
5718
5749
|
// dial (unless brownout >= 3)
|
|
5719
|
-
const shedDial =
|
|
5750
|
+
const shedDial = this.shed("dial", 3);
|
|
5720
5751
|
let dial = this.querySelector(".c-gauge__dial");
|
|
5721
5752
|
if (shedDial) {
|
|
5722
5753
|
if (dial) dial.remove();
|
|
@@ -5947,6 +5978,7 @@ class ContourBrush extends ContourBase {
|
|
|
5947
5978
|
if (eh) eh.style.insetInlineStart = (((ne - mn) / range) * 100) + "%";
|
|
5948
5979
|
// stash pending values
|
|
5949
5980
|
this._brushPending = { start: ns, end: ne };
|
|
5981
|
+
this.dispatchEvent(new CustomEvent("contour:brush", { bubbles: true, composed: true, detail: { start: ns, end: ne, value: ns } }));
|
|
5950
5982
|
});
|
|
5951
5983
|
this.addEventListener("pointerup", (e) => {
|
|
5952
5984
|
if (!dragging) return;
|
|
@@ -5958,6 +5990,7 @@ class ContourBrush extends ContourBase {
|
|
|
5958
5990
|
this._brushPending = null;
|
|
5959
5991
|
}
|
|
5960
5992
|
this.dispatchEvent(new CustomEvent("contour:brush-end", { bubbles: true, composed: true, detail: { value: this.getAttribute("end"), start: this.getAttribute("start"), end: this.getAttribute("end") } }));
|
|
5993
|
+
this.dispatchEvent(new CustomEvent("contour:brush", { bubbles: true, composed: true, detail: { start: this.getAttribute("start"), end: this.getAttribute("end"), value: this.getAttribute("end") } }));
|
|
5961
5994
|
});
|
|
5962
5995
|
// Keyboard: Enter/Space emits brush-start/brush-end (WC-P1-08).
|
|
5963
5996
|
if (!this.hasAttribute("tabindex")) this.setAttribute("tabindex", "0");
|
|
@@ -5993,7 +6026,7 @@ class ContourStackedBar extends ContourBase {
|
|
|
5993
6026
|
segments = authoredSegments.map((el) => ({
|
|
5994
6027
|
label: el.getAttribute("title") || el.textContent || "",
|
|
5995
6028
|
value: parseFloat(el.style.inlineSize) || 0,
|
|
5996
|
-
color: el.style.background || undefined,
|
|
6029
|
+
color: (el.dataset && el.dataset.color) || el.style.background || undefined,
|
|
5997
6030
|
}));
|
|
5998
6031
|
authoredSegments.forEach((el) => el.remove());
|
|
5999
6032
|
} else {
|
|
@@ -6010,6 +6043,7 @@ class ContourStackedBar extends ContourBase {
|
|
|
6010
6043
|
el.className = "c-stacked-bar__segment";
|
|
6011
6044
|
el.style.inlineSize = ((v / denom) * 100) + "%";
|
|
6012
6045
|
el.style.background = (typeof seg === "object" && seg.color) ? seg.color : "var(--chart-" + ((i % 8) + 1) + ")";
|
|
6046
|
+
el.dataset.color = (typeof seg === "object" && seg.color) ? seg.color : el.style.background;
|
|
6013
6047
|
el.setAttribute("title", (typeof seg === "object" ? (seg.label || "") : "") + " " + v);
|
|
6014
6048
|
this.appendChild(el);
|
|
6015
6049
|
});
|
|
@@ -6163,7 +6197,7 @@ class ContourDonut extends ContourBase {
|
|
|
6163
6197
|
const lbl = el.querySelector("span:last-child");
|
|
6164
6198
|
const text = lbl ? lbl.textContent : el.textContent;
|
|
6165
6199
|
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 });
|
|
6200
|
+
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
6201
|
});
|
|
6168
6202
|
// remove authored items from DOM (they will be regenerated below)
|
|
6169
6203
|
authoredItems.forEach((el) => el.remove());
|
|
@@ -6173,8 +6207,8 @@ class ContourDonut extends ContourBase {
|
|
|
6173
6207
|
}
|
|
6174
6208
|
const values = items.map((it) => (typeof it === "object" ? (it.value || 0) : Number(it) || 0));
|
|
6175
6209
|
const total = values.reduce((a, b) => a + b, 0) || 1;
|
|
6176
|
-
const brownoutLevel =
|
|
6177
|
-
const shedRing =
|
|
6210
|
+
const brownoutLevel = this.brownoutLevel();
|
|
6211
|
+
const shedRing = this.shed("ring", 3);
|
|
6178
6212
|
if (!shedRing) {
|
|
6179
6213
|
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
6180
6214
|
svg.setAttribute("class", "c-donut__ring");
|
|
@@ -6209,12 +6243,15 @@ class ContourDonut extends ContourBase {
|
|
|
6209
6243
|
// text list
|
|
6210
6244
|
const list = document.createElement("div");
|
|
6211
6245
|
list.className = "c-donut__list";
|
|
6246
|
+
list.setAttribute("role", "list");
|
|
6212
6247
|
items.forEach((it, i) => {
|
|
6213
6248
|
const row = document.createElement("div");
|
|
6214
6249
|
row.className = "c-donut__item";
|
|
6250
|
+
row.setAttribute("role", "listitem");
|
|
6215
6251
|
const sw = document.createElement("span");
|
|
6216
6252
|
sw.className = "c-donut__swatch";
|
|
6217
6253
|
sw.style.background = (typeof it === "object" && it.color) ? it.color : "var(--chart-" + ((i % 8) + 1) + ")";
|
|
6254
|
+
if (sw.style.background) sw.dataset.color = (typeof it === "object" && it.color) ? it.color : sw.style.background;
|
|
6218
6255
|
row.appendChild(sw);
|
|
6219
6256
|
const lbl = document.createElement("span");
|
|
6220
6257
|
lbl.textContent = (typeof it === "object" ? (it.label || "") : String(it)) + " — " + values[i];
|
|
@@ -6395,8 +6432,6 @@ class ContourPivot extends ContourBase {
|
|
|
6395
6432
|
const toolbar = document.createElement("div");
|
|
6396
6433
|
toolbar.className = "c-pivot__toolbar";
|
|
6397
6434
|
toolbar.style.display = "flex";
|
|
6398
|
-
toolbar.style.gap = "0.5rem";
|
|
6399
|
-
toolbar.style.marginBlockEnd = "0.5rem";
|
|
6400
6435
|
const filterInput = document.createElement("input");
|
|
6401
6436
|
filterInput.type = "search";
|
|
6402
6437
|
filterInput.className = "c-input c-pivot__filter";
|
|
@@ -6433,6 +6468,7 @@ class ContourPivot extends ContourBase {
|
|
|
6433
6468
|
const corner = document.createElement("th");
|
|
6434
6469
|
corner.textContent = "";
|
|
6435
6470
|
corner.setAttribute("role", "columnheader");
|
|
6471
|
+
corner.setAttribute("aria-label", "Row");
|
|
6436
6472
|
hr.appendChild(corner);
|
|
6437
6473
|
visibleCols.forEach((c) => { const th = document.createElement("th"); th.textContent = c; th.setAttribute("role", "columnheader"); th.setAttribute("tabindex", "0"); hr.appendChild(th); });
|
|
6438
6474
|
thead.appendChild(hr);
|
|
@@ -6460,6 +6496,7 @@ class ContourPivot extends ContourBase {
|
|
|
6460
6496
|
} else {
|
|
6461
6497
|
td.textContent = "";
|
|
6462
6498
|
}
|
|
6499
|
+
if (!td.textContent.trim()) td.setAttribute("aria-label", "Empty");
|
|
6463
6500
|
tr.appendChild(td);
|
|
6464
6501
|
});
|
|
6465
6502
|
tbody.appendChild(tr);
|
|
@@ -6624,7 +6661,7 @@ class ContourBivariate extends ContourBase {
|
|
|
6624
6661
|
// Palette runs from bottom-left (low/low) to top-right (high/high):
|
|
6625
6662
|
// reverse the row order so the first palette row sits at the bottom.
|
|
6626
6663
|
const srcIndex = (size - 1 - r) * size + c;
|
|
6627
|
-
if (colors[srcIndex]) cell.style.background = colors[srcIndex];
|
|
6664
|
+
if (colors[srcIndex]) { cell.style.background = colors[srcIndex]; cell.dataset.color = colors[srcIndex]; }
|
|
6628
6665
|
matrix.appendChild(cell);
|
|
6629
6666
|
}
|
|
6630
6667
|
}
|
|
@@ -6832,6 +6869,7 @@ class ContourMetricsFull extends ContourBase {
|
|
|
6832
6869
|
static get properties() { return { items: { attribute: "items" }, src: { attribute: "src" } }; }
|
|
6833
6870
|
render() {
|
|
6834
6871
|
this.classList.add("c-metrics");
|
|
6872
|
+
this.setAttribute("role", "list");
|
|
6835
6873
|
wireStates(this);
|
|
6836
6874
|
loadRemote(this, "items");
|
|
6837
6875
|
if (renderStates(this, "metrics")) return;
|
|
@@ -6844,6 +6882,7 @@ class ContourMetricsFull extends ContourBase {
|
|
|
6844
6882
|
parsed.forEach((it) => {
|
|
6845
6883
|
const item = document.createElement("div");
|
|
6846
6884
|
item.className = "c-metrics__item";
|
|
6885
|
+
item.setAttribute("role", "listitem");
|
|
6847
6886
|
const v = document.createElement("div");
|
|
6848
6887
|
v.className = "c-metrics__value";
|
|
6849
6888
|
v.textContent = (typeof it === "object" && it !== null) ? (it.value ?? it.v ?? "") : String(it);
|
|
@@ -6870,6 +6909,12 @@ class ContourLegend extends ContourBase {
|
|
|
6870
6909
|
static get properties() { return { title: { attribute: "title" }, ramp: { attribute: "ramp" }, scale: { attribute: "scale" }, items: { attribute: "items" }, method: { attribute: "method" }, norm: { attribute: "norm" }, selectable: { attribute: "selectable", type: Boolean }, src: { attribute: "src" } }; }
|
|
6871
6910
|
render() {
|
|
6872
6911
|
this.classList.add("c-legend");
|
|
6912
|
+
const continuous = this.hasAttribute("continuous");
|
|
6913
|
+
if (continuous || this.hasAttribute("selectable")) {
|
|
6914
|
+
this.setAttribute("role", "group");
|
|
6915
|
+
} else {
|
|
6916
|
+
this.setAttribute("role", "list");
|
|
6917
|
+
}
|
|
6873
6918
|
wireStates(this);
|
|
6874
6919
|
loadRemote(this, "items");
|
|
6875
6920
|
if (renderStates(this, "legend")) return;
|
|
@@ -6885,7 +6930,7 @@ class ContourLegend extends ContourBase {
|
|
|
6885
6930
|
items = JSON.stringify(authoredLegendItems.map((el) => {
|
|
6886
6931
|
const sw = el.querySelector(".c-legend__swatch");
|
|
6887
6932
|
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 };
|
|
6933
|
+
return { label: lbl ? lbl.textContent.trim() : el.textContent.trim(), color: sw ? (sw.dataset && sw.dataset.color) || sw.style.background || undefined : undefined };
|
|
6889
6934
|
}));
|
|
6890
6935
|
authoredLegendItems.forEach((el) => el.remove());
|
|
6891
6936
|
}
|
|
@@ -6901,17 +6946,20 @@ class ContourLegend extends ContourBase {
|
|
|
6901
6946
|
try {
|
|
6902
6947
|
const parsed = JSON.parse(items);
|
|
6903
6948
|
const list = this.ensure(".c-legend__items", () => { const el = document.createElement("div"); el.className = "c-legend__items"; return el; });
|
|
6904
|
-
|
|
6949
|
+
if (this.hasAttribute("selectable")) {
|
|
6950
|
+
list.setAttribute("role", "group");
|
|
6951
|
+
} else {
|
|
6952
|
+
list.setAttribute("role", "listbox");
|
|
6953
|
+
}
|
|
6905
6954
|
if (title) list.setAttribute("aria-label", title);
|
|
6906
6955
|
list.innerHTML = "";
|
|
6907
6956
|
parsed.forEach((it) => {
|
|
6908
6957
|
const label = typeof it === "string" ? it : (it.label || String(it));
|
|
6909
6958
|
const key = typeof it === "string" ? it : (it.key || it.label || String(it));
|
|
6910
|
-
const item = document.createElement(
|
|
6959
|
+
const item = document.createElement("div");
|
|
6911
6960
|
item.className = "c-legend__item";
|
|
6912
6961
|
item.setAttribute("tabindex", "-1");
|
|
6913
6962
|
if (selectable) {
|
|
6914
|
-
item.type = "button";
|
|
6915
6963
|
item.setAttribute("role", "button");
|
|
6916
6964
|
item.setAttribute("aria-pressed", "true");
|
|
6917
6965
|
item.dataset.key = key;
|
|
@@ -6921,7 +6969,7 @@ class ContourLegend extends ContourBase {
|
|
|
6921
6969
|
}
|
|
6922
6970
|
const sw = document.createElement("span");
|
|
6923
6971
|
sw.className = "c-legend__swatch";
|
|
6924
|
-
if (it && it.color) sw.style.background = it.color;
|
|
6972
|
+
if (it && it.color) { sw.style.background = it.color; sw.dataset.color = it.color; }
|
|
6925
6973
|
item.appendChild(sw);
|
|
6926
6974
|
// geometry glyph
|
|
6927
6975
|
const glyphShape = (it && (it.shape || it.marker || it.glyph)) || this.getAttribute("glyphs");
|
|
@@ -6994,6 +7042,7 @@ class ContourLegend extends ContourBase {
|
|
|
6994
7042
|
const glyph = document.createElement("span");
|
|
6995
7043
|
glyph.className = "glyph";
|
|
6996
7044
|
glyph.style.background = ndColor;
|
|
7045
|
+
glyph.dataset.color = ndColor;
|
|
6997
7046
|
nd.prepend(glyph);
|
|
6998
7047
|
} else {
|
|
6999
7048
|
const nd = this.querySelector(".c-legend__no-data");
|
|
@@ -7130,10 +7179,19 @@ class ContourLegend extends ContourBase {
|
|
|
7130
7179
|
this.addEventListener("click", (e) => {
|
|
7131
7180
|
const btn = e.target && e.target.closest ? e.target.closest(".c-legend__item") : null;
|
|
7132
7181
|
if (!btn || !this.contains(btn)) return;
|
|
7133
|
-
|
|
7134
|
-
btn.
|
|
7182
|
+
let selected;
|
|
7183
|
+
const isPressed = btn.getAttribute("aria-pressed");
|
|
7184
|
+
if (btn.getAttribute("aria-pressed") !== null) {
|
|
7185
|
+
const pressed = btn.getAttribute("aria-pressed") !== "true";
|
|
7186
|
+
btn.setAttribute("aria-pressed", String(pressed));
|
|
7187
|
+
selected = pressed;
|
|
7188
|
+
} else {
|
|
7189
|
+
const selected2 = btn.getAttribute("aria-selected") !== "true";
|
|
7190
|
+
btn.setAttribute("aria-selected", String(selected2));
|
|
7191
|
+
selected = selected2;
|
|
7192
|
+
}
|
|
7135
7193
|
this.dispatchEvent(new CustomEvent("contour:legend-toggle", {
|
|
7136
|
-
detail: { label: btn.textContent.trim(), key: btn.dataset.key || btn.textContent.trim(), pressed },
|
|
7194
|
+
detail: { label: btn.textContent.trim(), key: btn.dataset.key || btn.textContent.trim(), pressed: selected },
|
|
7137
7195
|
bubbles: true,
|
|
7138
7196
|
composed: true,
|
|
7139
7197
|
}));
|
|
@@ -7504,7 +7562,7 @@ class ContourCompare extends ContourBase {
|
|
|
7504
7562
|
this.classList.add("c-compare");
|
|
7505
7563
|
this.setAttribute("role", "group");
|
|
7506
7564
|
this.setAttribute("aria-label", "Comparison");
|
|
7507
|
-
|
|
7565
|
+
|
|
7508
7566
|
wireStates(this);
|
|
7509
7567
|
loadRemote(this, ["no", "text", "yes"]);
|
|
7510
7568
|
if (renderStates(this, "compare")) return;
|
|
@@ -7768,6 +7826,54 @@ class ContourErrorBoundary extends ContourBase {
|
|
|
7768
7826
|
}
|
|
7769
7827
|
define("contour-error-boundary", ContourErrorBoundary);
|
|
7770
7828
|
|
|
7829
|
+
class ContourDataExport extends ContourBase {
|
|
7830
|
+
static get observed() { return ["data", "format", "filename", "label"]; }
|
|
7831
|
+
static get properties() { return { data: { attribute: "data" }, format: { attribute: "format" }, filename: { attribute: "filename" }, label: { attribute: "label" } }; }
|
|
7832
|
+
render() {
|
|
7833
|
+
this.classList.add("c-data-export");
|
|
7834
|
+
const fmt = (this.getAttribute("format") || "json").toLowerCase();
|
|
7835
|
+
const btn = this.ensure(".c-data-export__btn", () => {
|
|
7836
|
+
const b = document.createElement("button");
|
|
7837
|
+
b.className = "c-data-export__btn";
|
|
7838
|
+
b.type = "button";
|
|
7839
|
+
return b;
|
|
7840
|
+
});
|
|
7841
|
+
btn.textContent = this.getAttribute("label") || ("Export " + fmt.toUpperCase());
|
|
7842
|
+
if (btn.parentNode !== this) this.appendChild(btn);
|
|
7843
|
+
}
|
|
7844
|
+
enhance() {
|
|
7845
|
+
if (this._wiredDataExport) return;
|
|
7846
|
+
this._wiredDataExport = true;
|
|
7847
|
+
this.addEventListener("click", (e) => {
|
|
7848
|
+
const btn = e.target && e.target.closest ? e.target.closest(".c-data-export__btn") : null;
|
|
7849
|
+
if (!btn || !this.contains(btn)) return;
|
|
7850
|
+
const fmt = (this.getAttribute("format") || "json").toLowerCase();
|
|
7851
|
+
const raw = this.getAttribute("data") || "[]";
|
|
7852
|
+
let text = raw;
|
|
7853
|
+
if (fmt === "csv") {
|
|
7854
|
+
try {
|
|
7855
|
+
const arr = JSON.parse(raw);
|
|
7856
|
+
if (Array.isArray(arr) && arr.length) {
|
|
7857
|
+
const keys = Object.keys(arr[0]);
|
|
7858
|
+
text = [keys.join(",")].concat(arr.map((r) => keys.map((k) => JSON.stringify(r[k] ?? "")).join(","))).join("\n");
|
|
7859
|
+
}
|
|
7860
|
+
} catch (e) {}
|
|
7861
|
+
}
|
|
7862
|
+
const blob = new Blob([text], { type: fmt === "csv" ? "text/csv" : "application/json" });
|
|
7863
|
+
const url = URL.createObjectURL(blob);
|
|
7864
|
+
const a = document.createElement("a");
|
|
7865
|
+
a.href = url;
|
|
7866
|
+
a.download = this.getAttribute("filename") || ("export." + fmt);
|
|
7867
|
+
document.body.appendChild(a);
|
|
7868
|
+
a.click();
|
|
7869
|
+
a.remove();
|
|
7870
|
+
URL.revokeObjectURL(url);
|
|
7871
|
+
this.dispatchEvent(new CustomEvent("contour:export", { bubbles: true, composed: true, detail: { format: fmt } }));
|
|
7872
|
+
});
|
|
7873
|
+
}
|
|
7874
|
+
}
|
|
7875
|
+
define("contour-data-export", ContourDataExport);
|
|
7876
|
+
|
|
7771
7877
|
|
|
7772
7878
|
|
|
7773
7879
|
class ContourDocsNav extends ContourBase {
|
|
@@ -7928,6 +8034,123 @@ class ContourFileTree extends ContourBase {
|
|
|
7928
8034
|
}
|
|
7929
8035
|
define("contour-file-tree", ContourFileTree);
|
|
7930
8036
|
|
|
8037
|
+
class ContourChangelog extends ContourBase {
|
|
8038
|
+
static get observed() { return ["src", "max", "loading", "error"]; }
|
|
8039
|
+
static get properties() { return { src: { attribute: "src" }, max: { attribute: "max", type: Number } }; }
|
|
8040
|
+
render() {
|
|
8041
|
+
this.classList.add("c-changelog");
|
|
8042
|
+
const src = this.getAttribute("src");
|
|
8043
|
+
if (src) {
|
|
8044
|
+
if (this.dataset.loaded === src) return;
|
|
8045
|
+
this.dataset.loaded = "";
|
|
8046
|
+
const loading = this.ensure(".c-changelog__loading", () => { const el = document.createElement("div"); el.className = "c-changelog__loading"; el.textContent = "Loading…"; return el; });
|
|
8047
|
+
// clear
|
|
8048
|
+
Array.from(this.querySelectorAll(".c-changelog__entry, .c-changelog__error")).forEach((n) => n.remove());
|
|
8049
|
+
if (!this.querySelector(".c-changelog__loading")) this.appendChild(loading);
|
|
8050
|
+
fetch(src).then((r) => {
|
|
8051
|
+
if (!r.ok) throw new Error("HTTP " + r.status);
|
|
8052
|
+
return r.text();
|
|
8053
|
+
}).then((text) => {
|
|
8054
|
+
const ld = this.querySelector(".c-changelog__loading");
|
|
8055
|
+
if (ld) ld.remove();
|
|
8056
|
+
this.dataset.loaded = src;
|
|
8057
|
+
const entries = parseChangelog(text);
|
|
8058
|
+
const max = parseInt(this.getAttribute("max") || "0", 10);
|
|
8059
|
+
const list = (max > 0) ? entries.slice(0, max) : entries;
|
|
8060
|
+
if (!list.length) {
|
|
8061
|
+
const empty = document.createElement("div");
|
|
8062
|
+
empty.className = "c-changelog__empty";
|
|
8063
|
+
empty.textContent = "No releases found.";
|
|
8064
|
+
this.appendChild(empty);
|
|
8065
|
+
return;
|
|
8066
|
+
}
|
|
8067
|
+
list.forEach((e) => {
|
|
8068
|
+
const det = document.createElement("details");
|
|
8069
|
+
det.className = "c-changelog__entry";
|
|
8070
|
+
const sum = document.createElement("summary");
|
|
8071
|
+
sum.className = "c-changelog__summary";
|
|
8072
|
+
const ver = document.createElement("span");
|
|
8073
|
+
ver.className = "c-changelog__version";
|
|
8074
|
+
ver.textContent = e.version;
|
|
8075
|
+
sum.appendChild(ver);
|
|
8076
|
+
if (e.date) {
|
|
8077
|
+
const d = document.createElement("span");
|
|
8078
|
+
d.className = "c-changelog__date";
|
|
8079
|
+
d.textContent = e.date;
|
|
8080
|
+
sum.appendChild(d);
|
|
8081
|
+
}
|
|
8082
|
+
det.appendChild(sum);
|
|
8083
|
+
const body = document.createElement("div");
|
|
8084
|
+
body.className = "c-changelog__body";
|
|
8085
|
+
body.innerHTML = renderChangelogBody(e.body);
|
|
8086
|
+
det.appendChild(body);
|
|
8087
|
+
this.appendChild(det);
|
|
8088
|
+
});
|
|
8089
|
+
}).catch((err) => {
|
|
8090
|
+
const ld = this.querySelector(".c-changelog__loading");
|
|
8091
|
+
if (ld) ld.remove();
|
|
8092
|
+
const er = document.createElement("div");
|
|
8093
|
+
er.className = "c-changelog__error";
|
|
8094
|
+
er.textContent = "Failed to load changelog: " + (err && err.message ? err.message : err);
|
|
8095
|
+
this.appendChild(er);
|
|
8096
|
+
});
|
|
8097
|
+
}
|
|
8098
|
+
}
|
|
8099
|
+
}
|
|
8100
|
+
define("contour-changelog", ContourChangelog);
|
|
8101
|
+
|
|
8102
|
+
function parseChangelog(text) {
|
|
8103
|
+
const lines = String(text).split(/\r?\n/);
|
|
8104
|
+
const entries = [];
|
|
8105
|
+
let cur = null;
|
|
8106
|
+
for (const line of lines) {
|
|
8107
|
+
const m = line.match(/^##\s+\[?([^\]\n]+)\]?\s*[-–—]?\s*(.*)$/);
|
|
8108
|
+
if (m && (line.startsWith("## ") )) {
|
|
8109
|
+
// only treat as version header if it looks like a version or "Unreleased"
|
|
8110
|
+
const ver = m[1].trim();
|
|
8111
|
+
const rest = m[2].trim();
|
|
8112
|
+
if (/^\d|unreleased/i.test(ver)) {
|
|
8113
|
+
if (cur) entries.push(cur);
|
|
8114
|
+
cur = { version: ver, date: rest.replace(/^[-–—]\s*/, "").trim(), body: "" };
|
|
8115
|
+
continue;
|
|
8116
|
+
}
|
|
8117
|
+
}
|
|
8118
|
+
if (cur) cur.body += line + "\n";
|
|
8119
|
+
}
|
|
8120
|
+
if (cur) entries.push(cur);
|
|
8121
|
+
return entries;
|
|
8122
|
+
}
|
|
8123
|
+
|
|
8124
|
+
function escapeHtml(s) {
|
|
8125
|
+
return String(s).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
8126
|
+
}
|
|
8127
|
+
|
|
8128
|
+
function renderChangelogBody(body) {
|
|
8129
|
+
const lines = String(body).trim().split(/\r?\n/);
|
|
8130
|
+
const out = [];
|
|
8131
|
+
let inList = false;
|
|
8132
|
+
for (const raw of lines) {
|
|
8133
|
+
const line = raw.trimEnd();
|
|
8134
|
+
if (/^###\s+/.test(line)) {
|
|
8135
|
+
if (inList) { out.push("</ul>"); inList = false; }
|
|
8136
|
+
out.push("<h4>" + escapeHtml(line.replace(/^###\s+/, "")) + "</h4>");
|
|
8137
|
+
} else if (/^##\s+/.test(line)) {
|
|
8138
|
+
if (inList) { out.push("</ul>"); inList = false; }
|
|
8139
|
+
out.push("<h3>" + escapeHtml(line.replace(/^##\s+/, "")) + "</h3>");
|
|
8140
|
+
} else if (/^[-*]\s+/.test(line)) {
|
|
8141
|
+
if (!inList) { out.push("<ul>"); inList = true; }
|
|
8142
|
+
out.push("<li>" + escapeHtml(line.replace(/^[-*]\s+/, "")) + "</li>");
|
|
8143
|
+
} else if (line.trim() === "") {
|
|
8144
|
+
if (inList) { out.push("</ul>"); inList = false; }
|
|
8145
|
+
} else {
|
|
8146
|
+
if (inList) { out.push("</ul>"); inList = false; }
|
|
8147
|
+
out.push("<p>" + escapeHtml(line) + "</p>");
|
|
8148
|
+
}
|
|
8149
|
+
}
|
|
8150
|
+
if (inList) out.push("</ul>");
|
|
8151
|
+
return out.join("");
|
|
8152
|
+
}
|
|
8153
|
+
|
|
7931
8154
|
|
|
7932
8155
|
|
|
7933
8156
|
|
|
@@ -9786,9 +10009,13 @@ class ContourInputFull extends ContourBase {
|
|
|
9786
10009
|
input.className = "c-input";
|
|
9787
10010
|
input.type = this.getAttribute("type") || "text";
|
|
9788
10011
|
input.placeholder = this.getAttribute("placeholder") || "";
|
|
9789
|
-
|
|
10012
|
+
let label = this.getAttribute("label");
|
|
10013
|
+
if (!label) {
|
|
10014
|
+
const field = this.closest("contour-field");
|
|
10015
|
+
if (field) label = field.getAttribute("label");
|
|
10016
|
+
}
|
|
9790
10017
|
if (label) input.setAttribute("aria-label", label);
|
|
9791
|
-
|
|
10018
|
+
else if (!input.getAttribute("aria-label")) input.setAttribute("aria-label", "Input");
|
|
9792
10019
|
if (this.hasAttribute("value")) input.value = this.getAttribute("value");
|
|
9793
10020
|
if (this.hasAttribute("required")) input.setAttribute("required", "");
|
|
9794
10021
|
else input.removeAttribute("required");
|
|
@@ -10035,6 +10262,7 @@ class ContourShortcutListFull extends ContourBase {
|
|
|
10035
10262
|
static get properties() { return { title: { attribute: "title" } }; }
|
|
10036
10263
|
render() {
|
|
10037
10264
|
this.classList.add("c-shortcut-list");
|
|
10265
|
+
this.setAttribute("role", "list");
|
|
10038
10266
|
const title = this.getAttribute("title");
|
|
10039
10267
|
if (title) {
|
|
10040
10268
|
const t = this.ensure(".c-shortcut-list__title", () => { const el = document.createElement("div"); el.className = "c-shortcut-list__title"; el.style.padding = "var(--space-sm)"; el.style.fontWeight = "var(--weight-semibold)"; return el; });
|
|
@@ -10048,6 +10276,7 @@ class ContourShortcutRowFull extends ContourBase {
|
|
|
10048
10276
|
static get properties() { return { desc: { attribute: "desc" }, key: { attribute: "key" } }; }
|
|
10049
10277
|
render() {
|
|
10050
10278
|
this.classList.add("c-shortcut-row");
|
|
10279
|
+
this.setAttribute("role", "listitem");
|
|
10051
10280
|
const key = this.getAttribute("key");
|
|
10052
10281
|
const desc = this.getAttribute("desc");
|
|
10053
10282
|
if (key) {
|
|
@@ -10092,7 +10321,7 @@ class ContourShortcutPanelFull extends ContourBase {
|
|
|
10092
10321
|
this.classList.add("c-shortcut-overlay");
|
|
10093
10322
|
const title = this.getAttribute("title");
|
|
10094
10323
|
if (title) {
|
|
10095
|
-
const t = this.ensure(".c-shortcut-overlay__title", () => { const el = document.createElement("div"); el.className = "c-shortcut-overlay__title";
|
|
10324
|
+
const t = this.ensure(".c-shortcut-overlay__title", () => { const el = document.createElement("div"); el.className = "c-shortcut-overlay__title"; return el; });
|
|
10096
10325
|
t.textContent = title;
|
|
10097
10326
|
}
|
|
10098
10327
|
if (this.hasAttribute("open")) this.removeAttribute("hidden");
|
|
@@ -10476,7 +10705,7 @@ class ContourBtn extends ContourBase {
|
|
|
10476
10705
|
const header = this.ensure(".c-app__header", () => { const el = document.createElement("header"); el.className = "c-app__header"; return el; });
|
|
10477
10706
|
const title = this.getAttribute("title");
|
|
10478
10707
|
if (title) {
|
|
10479
|
-
const t = this.ensure(".c-app__title", () => { const el = document.createElement("div"); el.className = "c-app__title";
|
|
10708
|
+
const t = this.ensure(".c-app__title", () => { const el = document.createElement("div"); el.className = "c-app__title"; return el; });
|
|
10480
10709
|
t.textContent = title;
|
|
10481
10710
|
if (t.parentNode !== header) header.appendChild(t);
|
|
10482
10711
|
}
|
|
@@ -10494,7 +10723,7 @@ class ContourBtn extends ContourBase {
|
|
|
10494
10723
|
const main = this.ensure(".c-app-body__main", () => { const el = document.createElement("main"); el.className = "c-app-body__main"; return el; });
|
|
10495
10724
|
const title = this.getAttribute("title");
|
|
10496
10725
|
if (title) {
|
|
10497
|
-
const t = this.ensure(".c-app-body__title", () => { const el = document.createElement("div"); el.className = "c-app-body__title";
|
|
10726
|
+
const t = this.ensure(".c-app-body__title", () => { const el = document.createElement("div"); el.className = "c-app-body__title"; return el; });
|
|
10498
10727
|
t.textContent = title;
|
|
10499
10728
|
if (t.parentNode !== main) main.appendChild(t);
|
|
10500
10729
|
}
|
|
@@ -11816,6 +12045,27 @@ class ContourScaleBar extends ContourBase {
|
|
|
11816
12045
|
}
|
|
11817
12046
|
define("contour-scale-bar", ContourScaleBar);
|
|
11818
12047
|
|
|
12048
|
+
class ContourSplitMap extends ContourBase {
|
|
12049
|
+
static get observed() { return ["left", "right"]; }
|
|
12050
|
+
static get properties() { return { left: { attribute: "left" }, right: { attribute: "right" } }; }
|
|
12051
|
+
render() {
|
|
12052
|
+
this.classList.add("c-split-map");
|
|
12053
|
+
const left = this.ensure(".c-split-map__pane--left", () => {
|
|
12054
|
+
const e = document.createElement("div");
|
|
12055
|
+
e.className = "c-split-map__pane c-split-map__pane--left";
|
|
12056
|
+
return e;
|
|
12057
|
+
});
|
|
12058
|
+
const right = this.ensure(".c-split-map__pane--right", () => {
|
|
12059
|
+
const e = document.createElement("div");
|
|
12060
|
+
e.className = "c-split-map__pane c-split-map__pane--right";
|
|
12061
|
+
return e;
|
|
12062
|
+
});
|
|
12063
|
+
if (left.parentNode !== this) this.appendChild(left);
|
|
12064
|
+
if (right.parentNode !== this) this.appendChild(right);
|
|
12065
|
+
}
|
|
12066
|
+
}
|
|
12067
|
+
define("contour-split-map", ContourSplitMap);
|
|
12068
|
+
|
|
11819
12069
|
class ContourResizeObserver extends ContourBase {
|
|
11820
12070
|
static get observed() { return ["debounce"]; }
|
|
11821
12071
|
static get properties() { return { debounce: { attribute: "debounce" } }; }
|
|
@@ -12959,6 +13209,7 @@ class ContourTocFull extends ContourBase {
|
|
|
12959
13209
|
static get properties() { return { title: { attribute: "title" }, items: { attribute: "items" }, src: { attribute: "src" } }; }
|
|
12960
13210
|
render() {
|
|
12961
13211
|
this.classList.add("c-toc");
|
|
13212
|
+
this.setAttribute("role", "list");
|
|
12962
13213
|
wireStates(this);
|
|
12963
13214
|
loadRemote(this, "items");
|
|
12964
13215
|
if (renderStates(this, "toc")) return;
|
|
@@ -13078,7 +13329,7 @@ class ContourFilterBar extends ContourBase {
|
|
|
13078
13329
|
if (modesAttr) { try { modes = JSON.parse(modesAttr); } catch (e) { modes = modesAttr.split(",").map((s) => s.trim()); } }
|
|
13079
13330
|
if (modes || this.hasAttribute("mode")) {
|
|
13080
13331
|
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); }
|
|
13332
|
+
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
13333
|
bar.innerHTML = "";
|
|
13083
13334
|
const current = this.getAttribute("mode");
|
|
13084
13335
|
const list = Array.isArray(modes) ? modes : ["draw", "erase", "select"];
|
|
@@ -13712,6 +13963,8 @@ class ContourAvatar extends ContourBase {
|
|
|
13712
13963
|
img.className = "c-avatar__img";
|
|
13713
13964
|
img.src = src;
|
|
13714
13965
|
img.alt = name || "";
|
|
13966
|
+
img.loading = "lazy";
|
|
13967
|
+
img.decoding = "async";
|
|
13715
13968
|
this.appendChild(img);
|
|
13716
13969
|
} else if (name) {
|
|
13717
13970
|
const initials = name.split(" ").map((w) => w[0]).join("").toUpperCase().slice(0, 2);
|
|
@@ -14776,7 +15029,9 @@ class ContourStylePanel extends ContourBase {
|
|
|
14776
15029
|
const breaksWrap = document.createElement("div"); breaksWrap.className = "c-style-panel__breaks";
|
|
14777
15030
|
breaksArr.forEach((b, i) => {
|
|
14778
15031
|
const br = document.createElement("div"); br.className = "break";
|
|
14779
|
-
|
|
15032
|
+
const span = document.createElement("span"); span.textContent = String(b); br.appendChild(span);
|
|
15033
|
+
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);
|
|
15034
|
+
br.appendChild(inp);
|
|
14780
15035
|
breaksWrap.appendChild(br);
|
|
14781
15036
|
});
|
|
14782
15037
|
body.appendChild(breaksWrap);
|
|
@@ -14796,7 +15051,7 @@ class ContourStylePanel extends ContourBase {
|
|
|
14796
15051
|
body.appendChild(list);
|
|
14797
15052
|
}
|
|
14798
15053
|
// Apply/Revert buttons
|
|
14799
|
-
const actions = document.createElement("div"); actions.className = "c-style-panel__actions";
|
|
15054
|
+
const actions = document.createElement("div"); actions.className = "c-style-panel__actions c-btn-group";
|
|
14800
15055
|
const applyBtn = document.createElement("button"); applyBtn.type = "button"; applyBtn.className = "c-btn c-btn--primary"; applyBtn.textContent = "Apply";
|
|
14801
15056
|
const revertBtn = document.createElement("button"); revertBtn.type = "button"; revertBtn.className = "c-btn"; revertBtn.textContent = "Revert";
|
|
14802
15057
|
actions.appendChild(applyBtn); actions.appendChild(revertBtn);
|
|
@@ -14951,7 +15206,7 @@ class ContourAvatarGroup extends ContourBase {
|
|
|
14951
15206
|
av.className = "c-avatar";
|
|
14952
15207
|
const name = typeof it === "string" ? it : (it.name || it.label || "");
|
|
14953
15208
|
av.textContent = name.slice(0, 2).toUpperCase();
|
|
14954
|
-
if (typeof it === "object" && it.color) av.style.background = it.color;
|
|
15209
|
+
if (typeof it === "object" && it.color) { av.style.background = it.color; av.dataset.color = it.color; }
|
|
14955
15210
|
this.appendChild(av);
|
|
14956
15211
|
});
|
|
14957
15212
|
if (parsed.length > max) {
|
|
@@ -15096,6 +15351,7 @@ class ContourPaletteEditor extends ContourBase {
|
|
|
15096
15351
|
sw.className = "c-palette-editor__swatch c-swatch";
|
|
15097
15352
|
sw.type = "button";
|
|
15098
15353
|
sw.style.background = typeof c === "string" ? c : (c.color || c.value || "");
|
|
15354
|
+
sw.dataset.color = typeof c === "string" ? c : (c.color || c.value || "");
|
|
15099
15355
|
sw.setAttribute("aria-label", typeof c === "string" ? c : (c.name || c.label || "color"));
|
|
15100
15356
|
this.appendChild(sw);
|
|
15101
15357
|
});
|
|
@@ -15108,7 +15364,7 @@ class ContourPaletteEditor extends ContourBase {
|
|
|
15108
15364
|
this.addEventListener("click", (e) => {
|
|
15109
15365
|
const sw = e.target && e.target.closest ? e.target.closest(".c-palette-editor__swatch") : null;
|
|
15110
15366
|
if (sw && this.contains(sw)) {
|
|
15111
|
-
this.dispatchEvent(new CustomEvent("contour:change", { bubbles: true, composed: true, detail: { color: sw.style.background } }));
|
|
15367
|
+
this.dispatchEvent(new CustomEvent("contour:change", { bubbles: true, composed: true, detail: { color: (sw.dataset && sw.dataset.color) || sw.style.background } }));
|
|
15112
15368
|
}
|
|
15113
15369
|
});
|
|
15114
15370
|
this.addEventListener("keydown", (e) => {
|
|
@@ -15544,8 +15800,8 @@ class ContourColorPicker extends ContourBase {
|
|
|
15544
15800
|
btn.type = "button";
|
|
15545
15801
|
btn.className = "c-color-picker__preset";
|
|
15546
15802
|
btn.style.background = c;
|
|
15547
|
-
btn.setAttribute("aria-label", "Preset " + c);
|
|
15548
15803
|
btn.dataset.color = c;
|
|
15804
|
+
btn.setAttribute("aria-label", "Preset " + c);
|
|
15549
15805
|
wrap.appendChild(btn);
|
|
15550
15806
|
});
|
|
15551
15807
|
this.appendChild(wrap);
|
|
@@ -15870,6 +16126,8 @@ class ContourFileUpload extends ContourBase {
|
|
|
15870
16126
|
const img = document.createElement("img");
|
|
15871
16127
|
img.className = "c-file-upload__preview-thumb";
|
|
15872
16128
|
img.alt = f.name;
|
|
16129
|
+
img.loading = "lazy";
|
|
16130
|
+
img.decoding = "async";
|
|
15873
16131
|
try { img.src = URL.createObjectURL(f); } catch (e) {}
|
|
15874
16132
|
item.appendChild(img);
|
|
15875
16133
|
} else {
|
|
@@ -15899,10 +16157,11 @@ class ContourNotificationCenter extends ContourBase {
|
|
|
15899
16157
|
static get properties() { return { count: { attribute: "count" }, items: { attribute: "items" }, color: { attribute: "color" } }; }
|
|
15900
16158
|
render() {
|
|
15901
16159
|
this.classList.add("c-notification-center");
|
|
16160
|
+
this.setAttribute("role", "list");
|
|
15902
16161
|
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
16162
|
const color = this.getAttribute("color");
|
|
15904
16163
|
const bullet = btn.querySelector(".c-notification-center__bullet");
|
|
15905
|
-
if (bullet && color) bullet.style.background = color;
|
|
16164
|
+
if (bullet && color) { bullet.style.background = color; bullet.dataset.color = color; }
|
|
15906
16165
|
const count = this.getAttribute("count");
|
|
15907
16166
|
let badge = btn.querySelector(".c-notification-center__badge");
|
|
15908
16167
|
if (count && Number(count) > 0) {
|
|
@@ -16002,7 +16261,7 @@ class ContourStepper extends ContourBase {
|
|
|
16002
16261
|
li.textContent = typeof s === "string" ? s : (s.title || s.label || "");
|
|
16003
16262
|
list.appendChild(li);
|
|
16004
16263
|
});
|
|
16005
|
-
const nav = this.ensure(".c-stepper__nav", () => { const el = document.createElement("div"); el.className = "c-stepper__nav"; return el; });
|
|
16264
|
+
const nav = this.ensure(".c-stepper__nav", () => { const el = document.createElement("div"); el.className = "c-stepper__nav c-btn-group"; return el; });
|
|
16006
16265
|
const prev = this.ensure(".c-stepper__prev", () => { const el = document.createElement("button"); el.className = "c-btn c-btn--sm c-stepper__prev"; el.type = "button"; el.textContent = "Back"; return el; });
|
|
16007
16266
|
const next = this.ensure(".c-stepper__next", () => { const el = document.createElement("button"); el.className = "c-btn c-btn--sm c-stepper__next"; el.type = "button"; el.textContent = "Next"; return el; });
|
|
16008
16267
|
if (!nav.contains(prev)) nav.appendChild(prev);
|
|
@@ -16400,7 +16659,7 @@ class ContourTour extends ContourBase {
|
|
|
16400
16659
|
const step = parsed[current] || {};
|
|
16401
16660
|
const tip = this.ensure(".c-tour__tip", () => { const el = document.createElement("div"); el.className = "c-tour__tip"; return el; });
|
|
16402
16661
|
tip.textContent = typeof step === "string" ? step : (step.text || step.title || "");
|
|
16403
|
-
const nav = this.ensure(".c-tour__nav", () => { const el = document.createElement("div"); el.className = "c-tour__nav"; return el; });
|
|
16662
|
+
const nav = this.ensure(".c-tour__nav", () => { const el = document.createElement("div"); el.className = "c-tour__nav c-btn-group"; return el; });
|
|
16404
16663
|
const next = this.ensure(".c-tour__next", () => { const el = document.createElement("button"); el.className = "c-btn c-btn--sm c-tour__next"; el.type = "button"; el.textContent = "Next"; return el; });
|
|
16405
16664
|
if (!nav.contains(next)) nav.appendChild(next);
|
|
16406
16665
|
}
|
|
@@ -16917,6 +17176,7 @@ class ContourDataGrid extends ContourBase {
|
|
|
16917
17176
|
td.setAttribute("role", "gridcell");
|
|
16918
17177
|
td.setAttribute("tabindex", "0");
|
|
16919
17178
|
td.textContent = r && r[key] != null ? r[key] : "";
|
|
17179
|
+
if (!String(td.textContent).trim()) td.setAttribute("aria-label", "Empty");
|
|
16920
17180
|
tr.appendChild(td);
|
|
16921
17181
|
});
|
|
16922
17182
|
tbody.appendChild(tr);
|
|
@@ -16966,6 +17226,7 @@ class ContourDataGrid extends ContourBase {
|
|
|
16966
17226
|
td.setAttribute("role", "gridcell");
|
|
16967
17227
|
td.setAttribute("tabindex", "0");
|
|
16968
17228
|
td.textContent = r && r[key] != null ? r[key] : "";
|
|
17229
|
+
if (!String(td.textContent).trim()) td.setAttribute("aria-label", "Empty");
|
|
16969
17230
|
tr.appendChild(td);
|
|
16970
17231
|
});
|
|
16971
17232
|
tbody.appendChild(tr);
|
|
@@ -17184,6 +17445,55 @@ class ContourTreeGrid extends ContourBase {
|
|
|
17184
17445
|
}
|
|
17185
17446
|
define("contour-tree-grid", ContourTreeGrid);
|
|
17186
17447
|
|
|
17448
|
+
class ContourPullToRefresh extends ContourBase {
|
|
17449
|
+
static get observed() { return ["threshold"]; }
|
|
17450
|
+
static get properties() { return { threshold: { attribute: "threshold" } }; }
|
|
17451
|
+
render() {
|
|
17452
|
+
this.classList.add("c-pull-to-refresh");
|
|
17453
|
+
const ind = this.ensure(".c-pull-to-refresh__indicator", () => {
|
|
17454
|
+
const e = document.createElement("div");
|
|
17455
|
+
e.className = "c-pull-to-refresh__indicator";
|
|
17456
|
+
e.textContent = "Pull to refresh";
|
|
17457
|
+
return e;
|
|
17458
|
+
});
|
|
17459
|
+
if (ind.parentNode !== this) this.prepend(ind);
|
|
17460
|
+
}
|
|
17461
|
+
enhance() {
|
|
17462
|
+
if (this._wiredPullToRefresh) return;
|
|
17463
|
+
this._wiredPullToRefresh = true;
|
|
17464
|
+
let startY = 0;
|
|
17465
|
+
let pulling = false;
|
|
17466
|
+
this.addEventListener("touchstart", (e) => {
|
|
17467
|
+
if (this.scrollTop > 0) return;
|
|
17468
|
+
const t = e.touches && e.touches[0];
|
|
17469
|
+
if (t) { startY = t.clientY; pulling = true; }
|
|
17470
|
+
}, { passive: true });
|
|
17471
|
+
this.addEventListener("touchmove", (e) => {
|
|
17472
|
+
if (!pulling) return;
|
|
17473
|
+
const t = e.touches && e.touches[0];
|
|
17474
|
+
if (!t) return;
|
|
17475
|
+
const dy = t.clientY - startY;
|
|
17476
|
+
if (dy > 0 && dy < 120) {
|
|
17477
|
+
this.style.setProperty("--ptr-offset", dy + "px");
|
|
17478
|
+
}
|
|
17479
|
+
}, { passive: true });
|
|
17480
|
+
this.addEventListener("touchend", (e) => {
|
|
17481
|
+
if (!pulling) return;
|
|
17482
|
+
pulling = false;
|
|
17483
|
+
const t = e.changedTouches && e.changedTouches[0];
|
|
17484
|
+
const dy = t ? t.clientY - startY : 0;
|
|
17485
|
+
const thr = Number(this.getAttribute("threshold")) || 60;
|
|
17486
|
+
if (dy >= thr) {
|
|
17487
|
+
this.classList.add("is-refreshing");
|
|
17488
|
+
this.dispatchEvent(new CustomEvent("contour:refresh", { bubbles: true, composed: true }));
|
|
17489
|
+
setTimeout(() => this.classList.remove("is-refreshing"), 800);
|
|
17490
|
+
}
|
|
17491
|
+
this.style.removeProperty("--ptr-offset");
|
|
17492
|
+
}, { passive: true });
|
|
17493
|
+
}
|
|
17494
|
+
}
|
|
17495
|
+
define("contour-pull-to-refresh", ContourPullToRefresh);
|
|
17496
|
+
|
|
17187
17497
|
|
|
17188
17498
|
// ---- Registration: the class-only wrappers run last ------------------
|
|
17189
17499
|
//
|