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.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
//
|
|
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 {
|
|
@@ -3408,6 +3438,7 @@ class ContourShowcaseFull extends ContourBase {
|
|
|
3408
3438
|
static get properties() { return { title: { attribute: "title" }, text: { attribute: "text" }, media: { attribute: "media" }, reverse: { attribute: "reverse" }, items: { attribute: "items" }, src: { attribute: "src" } }; }
|
|
3409
3439
|
render() {
|
|
3410
3440
|
this.classList.add("c-showcase");
|
|
3441
|
+
this.setAttribute("role", "list");
|
|
3411
3442
|
if (this.hasAttribute("reverse")) this.classList.add("c-showcase--reverse"); else this.classList.remove("c-showcase--reverse");
|
|
3412
3443
|
const title = this.getAttribute("title");
|
|
3413
3444
|
if (title) this.setAttribute("aria-label", title);
|
|
@@ -4396,7 +4427,7 @@ class ContourTable extends ContourBase {
|
|
|
4396
4427
|
btn.className = "c-btn c-btn--ghost c-btn--sm";
|
|
4397
4428
|
btn.type = "button";
|
|
4398
4429
|
btn.textContent = this.getAttribute("retry") || "Retry";
|
|
4399
|
-
btn.
|
|
4430
|
+
btn.classList.add("u-ms-sm");
|
|
4400
4431
|
btn.dataset.action = "retry";
|
|
4401
4432
|
td.appendChild(btn);
|
|
4402
4433
|
}
|
|
@@ -4872,7 +4903,7 @@ class ContourChart extends ContourBase {
|
|
|
4872
4903
|
btn.type = "button";
|
|
4873
4904
|
btn.textContent = this.getAttribute("retry") || "Retry";
|
|
4874
4905
|
btn.dataset.action = "retry";
|
|
4875
|
-
btn.
|
|
4906
|
+
btn.classList.add("u-mbs-sm");
|
|
4876
4907
|
err.appendChild(btn);
|
|
4877
4908
|
}
|
|
4878
4909
|
plot.appendChild(err);
|
|
@@ -4893,7 +4924,7 @@ class ContourChart extends ContourBase {
|
|
|
4893
4924
|
sk.style.display = "block";
|
|
4894
4925
|
sk.style.inlineSize = "100%";
|
|
4895
4926
|
sk.style.blockSize = "0.6rem";
|
|
4896
|
-
sk.
|
|
4927
|
+
sk.classList.add("u-mbe-2xs");
|
|
4897
4928
|
plot.appendChild(sk);
|
|
4898
4929
|
}
|
|
4899
4930
|
const axis = this.getAttribute("axis");
|
|
@@ -5684,7 +5715,7 @@ class ContourGauge extends ContourBase {
|
|
|
5684
5715
|
const showHeader = this.getAttribute("show-header") !== "false";
|
|
5685
5716
|
const description = this.getAttribute("description");
|
|
5686
5717
|
const noDataMessage = this.getAttribute("no-data-message") || "No readings in view";
|
|
5687
|
-
const brownoutLevel =
|
|
5718
|
+
const brownoutLevel = this.brownoutLevel();
|
|
5688
5719
|
// empty state
|
|
5689
5720
|
if (!hasValue) {
|
|
5690
5721
|
if (heading && showHeader) {
|
|
@@ -5718,7 +5749,7 @@ class ContourGauge extends ContourBase {
|
|
|
5718
5749
|
}
|
|
5719
5750
|
}
|
|
5720
5751
|
// dial (unless brownout >= 3)
|
|
5721
|
-
const shedDial =
|
|
5752
|
+
const shedDial = this.shed("dial", 3);
|
|
5722
5753
|
let dial = this.querySelector(".c-gauge__dial");
|
|
5723
5754
|
if (shedDial) {
|
|
5724
5755
|
if (dial) dial.remove();
|
|
@@ -5949,6 +5980,7 @@ class ContourBrush extends ContourBase {
|
|
|
5949
5980
|
if (eh) eh.style.insetInlineStart = (((ne - mn) / range) * 100) + "%";
|
|
5950
5981
|
// stash pending values
|
|
5951
5982
|
this._brushPending = { start: ns, end: ne };
|
|
5983
|
+
this.dispatchEvent(new CustomEvent("contour:brush", { bubbles: true, composed: true, detail: { start: ns, end: ne, value: ns } }));
|
|
5952
5984
|
});
|
|
5953
5985
|
this.addEventListener("pointerup", (e) => {
|
|
5954
5986
|
if (!dragging) return;
|
|
@@ -5960,6 +5992,7 @@ class ContourBrush extends ContourBase {
|
|
|
5960
5992
|
this._brushPending = null;
|
|
5961
5993
|
}
|
|
5962
5994
|
this.dispatchEvent(new CustomEvent("contour:brush-end", { bubbles: true, composed: true, detail: { value: this.getAttribute("end"), start: this.getAttribute("start"), end: this.getAttribute("end") } }));
|
|
5995
|
+
this.dispatchEvent(new CustomEvent("contour:brush", { bubbles: true, composed: true, detail: { start: this.getAttribute("start"), end: this.getAttribute("end"), value: this.getAttribute("end") } }));
|
|
5963
5996
|
});
|
|
5964
5997
|
// Keyboard: Enter/Space emits brush-start/brush-end (WC-P1-08).
|
|
5965
5998
|
if (!this.hasAttribute("tabindex")) this.setAttribute("tabindex", "0");
|
|
@@ -5995,7 +6028,7 @@ class ContourStackedBar extends ContourBase {
|
|
|
5995
6028
|
segments = authoredSegments.map((el) => ({
|
|
5996
6029
|
label: el.getAttribute("title") || el.textContent || "",
|
|
5997
6030
|
value: parseFloat(el.style.inlineSize) || 0,
|
|
5998
|
-
color: el.style.background || undefined,
|
|
6031
|
+
color: (el.dataset && el.dataset.color) || el.style.background || undefined,
|
|
5999
6032
|
}));
|
|
6000
6033
|
authoredSegments.forEach((el) => el.remove());
|
|
6001
6034
|
} else {
|
|
@@ -6012,6 +6045,7 @@ class ContourStackedBar extends ContourBase {
|
|
|
6012
6045
|
el.className = "c-stacked-bar__segment";
|
|
6013
6046
|
el.style.inlineSize = ((v / denom) * 100) + "%";
|
|
6014
6047
|
el.style.background = (typeof seg === "object" && seg.color) ? seg.color : "var(--chart-" + ((i % 8) + 1) + ")";
|
|
6048
|
+
el.dataset.color = (typeof seg === "object" && seg.color) ? seg.color : el.style.background;
|
|
6015
6049
|
el.setAttribute("title", (typeof seg === "object" ? (seg.label || "") : "") + " " + v);
|
|
6016
6050
|
this.appendChild(el);
|
|
6017
6051
|
});
|
|
@@ -6165,7 +6199,7 @@ class ContourDonut extends ContourBase {
|
|
|
6165
6199
|
const lbl = el.querySelector("span:last-child");
|
|
6166
6200
|
const text = lbl ? lbl.textContent : el.textContent;
|
|
6167
6201
|
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 });
|
|
6202
|
+
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
6203
|
});
|
|
6170
6204
|
// remove authored items from DOM (they will be regenerated below)
|
|
6171
6205
|
authoredItems.forEach((el) => el.remove());
|
|
@@ -6175,8 +6209,8 @@ class ContourDonut extends ContourBase {
|
|
|
6175
6209
|
}
|
|
6176
6210
|
const values = items.map((it) => (typeof it === "object" ? (it.value || 0) : Number(it) || 0));
|
|
6177
6211
|
const total = values.reduce((a, b) => a + b, 0) || 1;
|
|
6178
|
-
const brownoutLevel =
|
|
6179
|
-
const shedRing =
|
|
6212
|
+
const brownoutLevel = this.brownoutLevel();
|
|
6213
|
+
const shedRing = this.shed("ring", 3);
|
|
6180
6214
|
if (!shedRing) {
|
|
6181
6215
|
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
6182
6216
|
svg.setAttribute("class", "c-donut__ring");
|
|
@@ -6211,12 +6245,15 @@ class ContourDonut extends ContourBase {
|
|
|
6211
6245
|
// text list
|
|
6212
6246
|
const list = document.createElement("div");
|
|
6213
6247
|
list.className = "c-donut__list";
|
|
6248
|
+
list.setAttribute("role", "list");
|
|
6214
6249
|
items.forEach((it, i) => {
|
|
6215
6250
|
const row = document.createElement("div");
|
|
6216
6251
|
row.className = "c-donut__item";
|
|
6252
|
+
row.setAttribute("role", "listitem");
|
|
6217
6253
|
const sw = document.createElement("span");
|
|
6218
6254
|
sw.className = "c-donut__swatch";
|
|
6219
6255
|
sw.style.background = (typeof it === "object" && it.color) ? it.color : "var(--chart-" + ((i % 8) + 1) + ")";
|
|
6256
|
+
if (sw.style.background) sw.dataset.color = (typeof it === "object" && it.color) ? it.color : sw.style.background;
|
|
6220
6257
|
row.appendChild(sw);
|
|
6221
6258
|
const lbl = document.createElement("span");
|
|
6222
6259
|
lbl.textContent = (typeof it === "object" ? (it.label || "") : String(it)) + " — " + values[i];
|
|
@@ -6397,8 +6434,6 @@ class ContourPivot extends ContourBase {
|
|
|
6397
6434
|
const toolbar = document.createElement("div");
|
|
6398
6435
|
toolbar.className = "c-pivot__toolbar";
|
|
6399
6436
|
toolbar.style.display = "flex";
|
|
6400
|
-
toolbar.style.gap = "0.5rem";
|
|
6401
|
-
toolbar.style.marginBlockEnd = "0.5rem";
|
|
6402
6437
|
const filterInput = document.createElement("input");
|
|
6403
6438
|
filterInput.type = "search";
|
|
6404
6439
|
filterInput.className = "c-input c-pivot__filter";
|
|
@@ -6435,6 +6470,7 @@ class ContourPivot extends ContourBase {
|
|
|
6435
6470
|
const corner = document.createElement("th");
|
|
6436
6471
|
corner.textContent = "";
|
|
6437
6472
|
corner.setAttribute("role", "columnheader");
|
|
6473
|
+
corner.setAttribute("aria-label", "Row");
|
|
6438
6474
|
hr.appendChild(corner);
|
|
6439
6475
|
visibleCols.forEach((c) => { const th = document.createElement("th"); th.textContent = c; th.setAttribute("role", "columnheader"); th.setAttribute("tabindex", "0"); hr.appendChild(th); });
|
|
6440
6476
|
thead.appendChild(hr);
|
|
@@ -6462,6 +6498,7 @@ class ContourPivot extends ContourBase {
|
|
|
6462
6498
|
} else {
|
|
6463
6499
|
td.textContent = "";
|
|
6464
6500
|
}
|
|
6501
|
+
if (!td.textContent.trim()) td.setAttribute("aria-label", "Empty");
|
|
6465
6502
|
tr.appendChild(td);
|
|
6466
6503
|
});
|
|
6467
6504
|
tbody.appendChild(tr);
|
|
@@ -6626,7 +6663,7 @@ class ContourBivariate extends ContourBase {
|
|
|
6626
6663
|
// Palette runs from bottom-left (low/low) to top-right (high/high):
|
|
6627
6664
|
// reverse the row order so the first palette row sits at the bottom.
|
|
6628
6665
|
const srcIndex = (size - 1 - r) * size + c;
|
|
6629
|
-
if (colors[srcIndex]) cell.style.background = colors[srcIndex];
|
|
6666
|
+
if (colors[srcIndex]) { cell.style.background = colors[srcIndex]; cell.dataset.color = colors[srcIndex]; }
|
|
6630
6667
|
matrix.appendChild(cell);
|
|
6631
6668
|
}
|
|
6632
6669
|
}
|
|
@@ -6834,6 +6871,7 @@ class ContourMetricsFull extends ContourBase {
|
|
|
6834
6871
|
static get properties() { return { items: { attribute: "items" }, src: { attribute: "src" } }; }
|
|
6835
6872
|
render() {
|
|
6836
6873
|
this.classList.add("c-metrics");
|
|
6874
|
+
this.setAttribute("role", "list");
|
|
6837
6875
|
wireStates(this);
|
|
6838
6876
|
loadRemote(this, "items");
|
|
6839
6877
|
if (renderStates(this, "metrics")) return;
|
|
@@ -6846,6 +6884,7 @@ class ContourMetricsFull extends ContourBase {
|
|
|
6846
6884
|
parsed.forEach((it) => {
|
|
6847
6885
|
const item = document.createElement("div");
|
|
6848
6886
|
item.className = "c-metrics__item";
|
|
6887
|
+
item.setAttribute("role", "listitem");
|
|
6849
6888
|
const v = document.createElement("div");
|
|
6850
6889
|
v.className = "c-metrics__value";
|
|
6851
6890
|
v.textContent = (typeof it === "object" && it !== null) ? (it.value ?? it.v ?? "") : String(it);
|
|
@@ -6872,6 +6911,12 @@ class ContourLegend extends ContourBase {
|
|
|
6872
6911
|
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" } }; }
|
|
6873
6912
|
render() {
|
|
6874
6913
|
this.classList.add("c-legend");
|
|
6914
|
+
const continuous = this.hasAttribute("continuous");
|
|
6915
|
+
if (continuous || this.hasAttribute("selectable")) {
|
|
6916
|
+
this.setAttribute("role", "group");
|
|
6917
|
+
} else {
|
|
6918
|
+
this.setAttribute("role", "list");
|
|
6919
|
+
}
|
|
6875
6920
|
wireStates(this);
|
|
6876
6921
|
loadRemote(this, "items");
|
|
6877
6922
|
if (renderStates(this, "legend")) return;
|
|
@@ -6887,7 +6932,7 @@ class ContourLegend extends ContourBase {
|
|
|
6887
6932
|
items = JSON.stringify(authoredLegendItems.map((el) => {
|
|
6888
6933
|
const sw = el.querySelector(".c-legend__swatch");
|
|
6889
6934
|
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 };
|
|
6935
|
+
return { label: lbl ? lbl.textContent.trim() : el.textContent.trim(), color: sw ? (sw.dataset && sw.dataset.color) || sw.style.background || undefined : undefined };
|
|
6891
6936
|
}));
|
|
6892
6937
|
authoredLegendItems.forEach((el) => el.remove());
|
|
6893
6938
|
}
|
|
@@ -6903,17 +6948,20 @@ class ContourLegend extends ContourBase {
|
|
|
6903
6948
|
try {
|
|
6904
6949
|
const parsed = JSON.parse(items);
|
|
6905
6950
|
const list = this.ensure(".c-legend__items", () => { const el = document.createElement("div"); el.className = "c-legend__items"; return el; });
|
|
6906
|
-
|
|
6951
|
+
if (this.hasAttribute("selectable")) {
|
|
6952
|
+
list.setAttribute("role", "group");
|
|
6953
|
+
} else {
|
|
6954
|
+
list.setAttribute("role", "listbox");
|
|
6955
|
+
}
|
|
6907
6956
|
if (title) list.setAttribute("aria-label", title);
|
|
6908
6957
|
list.innerHTML = "";
|
|
6909
6958
|
parsed.forEach((it) => {
|
|
6910
6959
|
const label = typeof it === "string" ? it : (it.label || String(it));
|
|
6911
6960
|
const key = typeof it === "string" ? it : (it.key || it.label || String(it));
|
|
6912
|
-
const item = document.createElement(
|
|
6961
|
+
const item = document.createElement("div");
|
|
6913
6962
|
item.className = "c-legend__item";
|
|
6914
6963
|
item.setAttribute("tabindex", "-1");
|
|
6915
6964
|
if (selectable) {
|
|
6916
|
-
item.type = "button";
|
|
6917
6965
|
item.setAttribute("role", "button");
|
|
6918
6966
|
item.setAttribute("aria-pressed", "true");
|
|
6919
6967
|
item.dataset.key = key;
|
|
@@ -6923,7 +6971,7 @@ class ContourLegend extends ContourBase {
|
|
|
6923
6971
|
}
|
|
6924
6972
|
const sw = document.createElement("span");
|
|
6925
6973
|
sw.className = "c-legend__swatch";
|
|
6926
|
-
if (it && it.color) sw.style.background = it.color;
|
|
6974
|
+
if (it && it.color) { sw.style.background = it.color; sw.dataset.color = it.color; }
|
|
6927
6975
|
item.appendChild(sw);
|
|
6928
6976
|
// geometry glyph
|
|
6929
6977
|
const glyphShape = (it && (it.shape || it.marker || it.glyph)) || this.getAttribute("glyphs");
|
|
@@ -6996,6 +7044,7 @@ class ContourLegend extends ContourBase {
|
|
|
6996
7044
|
const glyph = document.createElement("span");
|
|
6997
7045
|
glyph.className = "glyph";
|
|
6998
7046
|
glyph.style.background = ndColor;
|
|
7047
|
+
glyph.dataset.color = ndColor;
|
|
6999
7048
|
nd.prepend(glyph);
|
|
7000
7049
|
} else {
|
|
7001
7050
|
const nd = this.querySelector(".c-legend__no-data");
|
|
@@ -7132,10 +7181,19 @@ class ContourLegend extends ContourBase {
|
|
|
7132
7181
|
this.addEventListener("click", (e) => {
|
|
7133
7182
|
const btn = e.target && e.target.closest ? e.target.closest(".c-legend__item") : null;
|
|
7134
7183
|
if (!btn || !this.contains(btn)) return;
|
|
7135
|
-
|
|
7136
|
-
btn.
|
|
7184
|
+
let selected;
|
|
7185
|
+
const isPressed = btn.getAttribute("aria-pressed");
|
|
7186
|
+
if (btn.getAttribute("aria-pressed") !== null) {
|
|
7187
|
+
const pressed = btn.getAttribute("aria-pressed") !== "true";
|
|
7188
|
+
btn.setAttribute("aria-pressed", String(pressed));
|
|
7189
|
+
selected = pressed;
|
|
7190
|
+
} else {
|
|
7191
|
+
const selected2 = btn.getAttribute("aria-selected") !== "true";
|
|
7192
|
+
btn.setAttribute("aria-selected", String(selected2));
|
|
7193
|
+
selected = selected2;
|
|
7194
|
+
}
|
|
7137
7195
|
this.dispatchEvent(new CustomEvent("contour:legend-toggle", {
|
|
7138
|
-
detail: { label: btn.textContent.trim(), key: btn.dataset.key || btn.textContent.trim(), pressed },
|
|
7196
|
+
detail: { label: btn.textContent.trim(), key: btn.dataset.key || btn.textContent.trim(), pressed: selected },
|
|
7139
7197
|
bubbles: true,
|
|
7140
7198
|
composed: true,
|
|
7141
7199
|
}));
|
|
@@ -7506,7 +7564,7 @@ class ContourCompare extends ContourBase {
|
|
|
7506
7564
|
this.classList.add("c-compare");
|
|
7507
7565
|
this.setAttribute("role", "group");
|
|
7508
7566
|
this.setAttribute("aria-label", "Comparison");
|
|
7509
|
-
|
|
7567
|
+
|
|
7510
7568
|
wireStates(this);
|
|
7511
7569
|
loadRemote(this, ["no", "text", "yes"]);
|
|
7512
7570
|
if (renderStates(this, "compare")) return;
|
|
@@ -7770,6 +7828,54 @@ class ContourErrorBoundary extends ContourBase {
|
|
|
7770
7828
|
}
|
|
7771
7829
|
define("contour-error-boundary", ContourErrorBoundary);
|
|
7772
7830
|
|
|
7831
|
+
class ContourDataExport extends ContourBase {
|
|
7832
|
+
static get observed() { return ["data", "format", "filename", "label"]; }
|
|
7833
|
+
static get properties() { return { data: { attribute: "data" }, format: { attribute: "format" }, filename: { attribute: "filename" }, label: { attribute: "label" } }; }
|
|
7834
|
+
render() {
|
|
7835
|
+
this.classList.add("c-data-export");
|
|
7836
|
+
const fmt = (this.getAttribute("format") || "json").toLowerCase();
|
|
7837
|
+
const btn = this.ensure(".c-data-export__btn", () => {
|
|
7838
|
+
const b = document.createElement("button");
|
|
7839
|
+
b.className = "c-data-export__btn";
|
|
7840
|
+
b.type = "button";
|
|
7841
|
+
return b;
|
|
7842
|
+
});
|
|
7843
|
+
btn.textContent = this.getAttribute("label") || ("Export " + fmt.toUpperCase());
|
|
7844
|
+
if (btn.parentNode !== this) this.appendChild(btn);
|
|
7845
|
+
}
|
|
7846
|
+
enhance() {
|
|
7847
|
+
if (this._wiredDataExport) return;
|
|
7848
|
+
this._wiredDataExport = true;
|
|
7849
|
+
this.addEventListener("click", (e) => {
|
|
7850
|
+
const btn = e.target && e.target.closest ? e.target.closest(".c-data-export__btn") : null;
|
|
7851
|
+
if (!btn || !this.contains(btn)) return;
|
|
7852
|
+
const fmt = (this.getAttribute("format") || "json").toLowerCase();
|
|
7853
|
+
const raw = this.getAttribute("data") || "[]";
|
|
7854
|
+
let text = raw;
|
|
7855
|
+
if (fmt === "csv") {
|
|
7856
|
+
try {
|
|
7857
|
+
const arr = JSON.parse(raw);
|
|
7858
|
+
if (Array.isArray(arr) && arr.length) {
|
|
7859
|
+
const keys = Object.keys(arr[0]);
|
|
7860
|
+
text = [keys.join(",")].concat(arr.map((r) => keys.map((k) => JSON.stringify(r[k] ?? "")).join(","))).join("\n");
|
|
7861
|
+
}
|
|
7862
|
+
} catch (e) {}
|
|
7863
|
+
}
|
|
7864
|
+
const blob = new Blob([text], { type: fmt === "csv" ? "text/csv" : "application/json" });
|
|
7865
|
+
const url = URL.createObjectURL(blob);
|
|
7866
|
+
const a = document.createElement("a");
|
|
7867
|
+
a.href = url;
|
|
7868
|
+
a.download = this.getAttribute("filename") || ("export." + fmt);
|
|
7869
|
+
document.body.appendChild(a);
|
|
7870
|
+
a.click();
|
|
7871
|
+
a.remove();
|
|
7872
|
+
URL.revokeObjectURL(url);
|
|
7873
|
+
this.dispatchEvent(new CustomEvent("contour:export", { bubbles: true, composed: true, detail: { format: fmt } }));
|
|
7874
|
+
});
|
|
7875
|
+
}
|
|
7876
|
+
}
|
|
7877
|
+
define("contour-data-export", ContourDataExport);
|
|
7878
|
+
|
|
7773
7879
|
|
|
7774
7880
|
|
|
7775
7881
|
class ContourDocsNav extends ContourBase {
|
|
@@ -7930,6 +8036,123 @@ class ContourFileTree extends ContourBase {
|
|
|
7930
8036
|
}
|
|
7931
8037
|
define("contour-file-tree", ContourFileTree);
|
|
7932
8038
|
|
|
8039
|
+
class ContourChangelog extends ContourBase {
|
|
8040
|
+
static get observed() { return ["src", "max", "loading", "error"]; }
|
|
8041
|
+
static get properties() { return { src: { attribute: "src" }, max: { attribute: "max", type: Number } }; }
|
|
8042
|
+
render() {
|
|
8043
|
+
this.classList.add("c-changelog");
|
|
8044
|
+
const src = this.getAttribute("src");
|
|
8045
|
+
if (src) {
|
|
8046
|
+
if (this.dataset.loaded === src) return;
|
|
8047
|
+
this.dataset.loaded = "";
|
|
8048
|
+
const loading = this.ensure(".c-changelog__loading", () => { const el = document.createElement("div"); el.className = "c-changelog__loading"; el.textContent = "Loading…"; return el; });
|
|
8049
|
+
// clear
|
|
8050
|
+
Array.from(this.querySelectorAll(".c-changelog__entry, .c-changelog__error")).forEach((n) => n.remove());
|
|
8051
|
+
if (!this.querySelector(".c-changelog__loading")) this.appendChild(loading);
|
|
8052
|
+
fetch(src).then((r) => {
|
|
8053
|
+
if (!r.ok) throw new Error("HTTP " + r.status);
|
|
8054
|
+
return r.text();
|
|
8055
|
+
}).then((text) => {
|
|
8056
|
+
const ld = this.querySelector(".c-changelog__loading");
|
|
8057
|
+
if (ld) ld.remove();
|
|
8058
|
+
this.dataset.loaded = src;
|
|
8059
|
+
const entries = parseChangelog(text);
|
|
8060
|
+
const max = parseInt(this.getAttribute("max") || "0", 10);
|
|
8061
|
+
const list = (max > 0) ? entries.slice(0, max) : entries;
|
|
8062
|
+
if (!list.length) {
|
|
8063
|
+
const empty = document.createElement("div");
|
|
8064
|
+
empty.className = "c-changelog__empty";
|
|
8065
|
+
empty.textContent = "No releases found.";
|
|
8066
|
+
this.appendChild(empty);
|
|
8067
|
+
return;
|
|
8068
|
+
}
|
|
8069
|
+
list.forEach((e) => {
|
|
8070
|
+
const det = document.createElement("details");
|
|
8071
|
+
det.className = "c-changelog__entry";
|
|
8072
|
+
const sum = document.createElement("summary");
|
|
8073
|
+
sum.className = "c-changelog__summary";
|
|
8074
|
+
const ver = document.createElement("span");
|
|
8075
|
+
ver.className = "c-changelog__version";
|
|
8076
|
+
ver.textContent = e.version;
|
|
8077
|
+
sum.appendChild(ver);
|
|
8078
|
+
if (e.date) {
|
|
8079
|
+
const d = document.createElement("span");
|
|
8080
|
+
d.className = "c-changelog__date";
|
|
8081
|
+
d.textContent = e.date;
|
|
8082
|
+
sum.appendChild(d);
|
|
8083
|
+
}
|
|
8084
|
+
det.appendChild(sum);
|
|
8085
|
+
const body = document.createElement("div");
|
|
8086
|
+
body.className = "c-changelog__body";
|
|
8087
|
+
body.innerHTML = renderChangelogBody(e.body);
|
|
8088
|
+
det.appendChild(body);
|
|
8089
|
+
this.appendChild(det);
|
|
8090
|
+
});
|
|
8091
|
+
}).catch((err) => {
|
|
8092
|
+
const ld = this.querySelector(".c-changelog__loading");
|
|
8093
|
+
if (ld) ld.remove();
|
|
8094
|
+
const er = document.createElement("div");
|
|
8095
|
+
er.className = "c-changelog__error";
|
|
8096
|
+
er.textContent = "Failed to load changelog: " + (err && err.message ? err.message : err);
|
|
8097
|
+
this.appendChild(er);
|
|
8098
|
+
});
|
|
8099
|
+
}
|
|
8100
|
+
}
|
|
8101
|
+
}
|
|
8102
|
+
define("contour-changelog", ContourChangelog);
|
|
8103
|
+
|
|
8104
|
+
function parseChangelog(text) {
|
|
8105
|
+
const lines = String(text).split(/\r?\n/);
|
|
8106
|
+
const entries = [];
|
|
8107
|
+
let cur = null;
|
|
8108
|
+
for (const line of lines) {
|
|
8109
|
+
const m = line.match(/^##\s+\[?([^\]\n]+)\]?\s*[-–—]?\s*(.*)$/);
|
|
8110
|
+
if (m && (line.startsWith("## ") )) {
|
|
8111
|
+
// only treat as version header if it looks like a version or "Unreleased"
|
|
8112
|
+
const ver = m[1].trim();
|
|
8113
|
+
const rest = m[2].trim();
|
|
8114
|
+
if (/^\d|unreleased/i.test(ver)) {
|
|
8115
|
+
if (cur) entries.push(cur);
|
|
8116
|
+
cur = { version: ver, date: rest.replace(/^[-–—]\s*/, "").trim(), body: "" };
|
|
8117
|
+
continue;
|
|
8118
|
+
}
|
|
8119
|
+
}
|
|
8120
|
+
if (cur) cur.body += line + "\n";
|
|
8121
|
+
}
|
|
8122
|
+
if (cur) entries.push(cur);
|
|
8123
|
+
return entries;
|
|
8124
|
+
}
|
|
8125
|
+
|
|
8126
|
+
function escapeHtml(s) {
|
|
8127
|
+
return String(s).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
8128
|
+
}
|
|
8129
|
+
|
|
8130
|
+
function renderChangelogBody(body) {
|
|
8131
|
+
const lines = String(body).trim().split(/\r?\n/);
|
|
8132
|
+
const out = [];
|
|
8133
|
+
let inList = false;
|
|
8134
|
+
for (const raw of lines) {
|
|
8135
|
+
const line = raw.trimEnd();
|
|
8136
|
+
if (/^###\s+/.test(line)) {
|
|
8137
|
+
if (inList) { out.push("</ul>"); inList = false; }
|
|
8138
|
+
out.push("<h4>" + escapeHtml(line.replace(/^###\s+/, "")) + "</h4>");
|
|
8139
|
+
} else if (/^##\s+/.test(line)) {
|
|
8140
|
+
if (inList) { out.push("</ul>"); inList = false; }
|
|
8141
|
+
out.push("<h3>" + escapeHtml(line.replace(/^##\s+/, "")) + "</h3>");
|
|
8142
|
+
} else if (/^[-*]\s+/.test(line)) {
|
|
8143
|
+
if (!inList) { out.push("<ul>"); inList = true; }
|
|
8144
|
+
out.push("<li>" + escapeHtml(line.replace(/^[-*]\s+/, "")) + "</li>");
|
|
8145
|
+
} else if (line.trim() === "") {
|
|
8146
|
+
if (inList) { out.push("</ul>"); inList = false; }
|
|
8147
|
+
} else {
|
|
8148
|
+
if (inList) { out.push("</ul>"); inList = false; }
|
|
8149
|
+
out.push("<p>" + escapeHtml(line) + "</p>");
|
|
8150
|
+
}
|
|
8151
|
+
}
|
|
8152
|
+
if (inList) out.push("</ul>");
|
|
8153
|
+
return out.join("");
|
|
8154
|
+
}
|
|
8155
|
+
|
|
7933
8156
|
|
|
7934
8157
|
|
|
7935
8158
|
|
|
@@ -9788,9 +10011,13 @@ class ContourInputFull extends ContourBase {
|
|
|
9788
10011
|
input.className = "c-input";
|
|
9789
10012
|
input.type = this.getAttribute("type") || "text";
|
|
9790
10013
|
input.placeholder = this.getAttribute("placeholder") || "";
|
|
9791
|
-
|
|
10014
|
+
let label = this.getAttribute("label");
|
|
10015
|
+
if (!label) {
|
|
10016
|
+
const field = this.closest("contour-field");
|
|
10017
|
+
if (field) label = field.getAttribute("label");
|
|
10018
|
+
}
|
|
9792
10019
|
if (label) input.setAttribute("aria-label", label);
|
|
9793
|
-
|
|
10020
|
+
else if (!input.getAttribute("aria-label")) input.setAttribute("aria-label", "Input");
|
|
9794
10021
|
if (this.hasAttribute("value")) input.value = this.getAttribute("value");
|
|
9795
10022
|
if (this.hasAttribute("required")) input.setAttribute("required", "");
|
|
9796
10023
|
else input.removeAttribute("required");
|
|
@@ -10037,6 +10264,7 @@ class ContourShortcutListFull extends ContourBase {
|
|
|
10037
10264
|
static get properties() { return { title: { attribute: "title" } }; }
|
|
10038
10265
|
render() {
|
|
10039
10266
|
this.classList.add("c-shortcut-list");
|
|
10267
|
+
this.setAttribute("role", "list");
|
|
10040
10268
|
const title = this.getAttribute("title");
|
|
10041
10269
|
if (title) {
|
|
10042
10270
|
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; });
|
|
@@ -10050,6 +10278,7 @@ class ContourShortcutRowFull extends ContourBase {
|
|
|
10050
10278
|
static get properties() { return { desc: { attribute: "desc" }, key: { attribute: "key" } }; }
|
|
10051
10279
|
render() {
|
|
10052
10280
|
this.classList.add("c-shortcut-row");
|
|
10281
|
+
this.setAttribute("role", "listitem");
|
|
10053
10282
|
const key = this.getAttribute("key");
|
|
10054
10283
|
const desc = this.getAttribute("desc");
|
|
10055
10284
|
if (key) {
|
|
@@ -10094,7 +10323,7 @@ class ContourShortcutPanelFull extends ContourBase {
|
|
|
10094
10323
|
this.classList.add("c-shortcut-overlay");
|
|
10095
10324
|
const title = this.getAttribute("title");
|
|
10096
10325
|
if (title) {
|
|
10097
|
-
const t = this.ensure(".c-shortcut-overlay__title", () => { const el = document.createElement("div"); el.className = "c-shortcut-overlay__title";
|
|
10326
|
+
const t = this.ensure(".c-shortcut-overlay__title", () => { const el = document.createElement("div"); el.className = "c-shortcut-overlay__title"; return el; });
|
|
10098
10327
|
t.textContent = title;
|
|
10099
10328
|
}
|
|
10100
10329
|
if (this.hasAttribute("open")) this.removeAttribute("hidden");
|
|
@@ -10478,7 +10707,7 @@ class ContourBtn extends ContourBase {
|
|
|
10478
10707
|
const header = this.ensure(".c-app__header", () => { const el = document.createElement("header"); el.className = "c-app__header"; return el; });
|
|
10479
10708
|
const title = this.getAttribute("title");
|
|
10480
10709
|
if (title) {
|
|
10481
|
-
const t = this.ensure(".c-app__title", () => { const el = document.createElement("div"); el.className = "c-app__title";
|
|
10710
|
+
const t = this.ensure(".c-app__title", () => { const el = document.createElement("div"); el.className = "c-app__title"; return el; });
|
|
10482
10711
|
t.textContent = title;
|
|
10483
10712
|
if (t.parentNode !== header) header.appendChild(t);
|
|
10484
10713
|
}
|
|
@@ -10496,7 +10725,7 @@ class ContourBtn extends ContourBase {
|
|
|
10496
10725
|
const main = this.ensure(".c-app-body__main", () => { const el = document.createElement("main"); el.className = "c-app-body__main"; return el; });
|
|
10497
10726
|
const title = this.getAttribute("title");
|
|
10498
10727
|
if (title) {
|
|
10499
|
-
const t = this.ensure(".c-app-body__title", () => { const el = document.createElement("div"); el.className = "c-app-body__title";
|
|
10728
|
+
const t = this.ensure(".c-app-body__title", () => { const el = document.createElement("div"); el.className = "c-app-body__title"; return el; });
|
|
10500
10729
|
t.textContent = title;
|
|
10501
10730
|
if (t.parentNode !== main) main.appendChild(t);
|
|
10502
10731
|
}
|
|
@@ -11818,6 +12047,27 @@ class ContourScaleBar extends ContourBase {
|
|
|
11818
12047
|
}
|
|
11819
12048
|
define("contour-scale-bar", ContourScaleBar);
|
|
11820
12049
|
|
|
12050
|
+
class ContourSplitMap extends ContourBase {
|
|
12051
|
+
static get observed() { return ["left", "right"]; }
|
|
12052
|
+
static get properties() { return { left: { attribute: "left" }, right: { attribute: "right" } }; }
|
|
12053
|
+
render() {
|
|
12054
|
+
this.classList.add("c-split-map");
|
|
12055
|
+
const left = this.ensure(".c-split-map__pane--left", () => {
|
|
12056
|
+
const e = document.createElement("div");
|
|
12057
|
+
e.className = "c-split-map__pane c-split-map__pane--left";
|
|
12058
|
+
return e;
|
|
12059
|
+
});
|
|
12060
|
+
const right = this.ensure(".c-split-map__pane--right", () => {
|
|
12061
|
+
const e = document.createElement("div");
|
|
12062
|
+
e.className = "c-split-map__pane c-split-map__pane--right";
|
|
12063
|
+
return e;
|
|
12064
|
+
});
|
|
12065
|
+
if (left.parentNode !== this) this.appendChild(left);
|
|
12066
|
+
if (right.parentNode !== this) this.appendChild(right);
|
|
12067
|
+
}
|
|
12068
|
+
}
|
|
12069
|
+
define("contour-split-map", ContourSplitMap);
|
|
12070
|
+
|
|
11821
12071
|
class ContourResizeObserver extends ContourBase {
|
|
11822
12072
|
static get observed() { return ["debounce"]; }
|
|
11823
12073
|
static get properties() { return { debounce: { attribute: "debounce" } }; }
|
|
@@ -12961,6 +13211,7 @@ class ContourTocFull extends ContourBase {
|
|
|
12961
13211
|
static get properties() { return { title: { attribute: "title" }, items: { attribute: "items" }, src: { attribute: "src" } }; }
|
|
12962
13212
|
render() {
|
|
12963
13213
|
this.classList.add("c-toc");
|
|
13214
|
+
this.setAttribute("role", "list");
|
|
12964
13215
|
wireStates(this);
|
|
12965
13216
|
loadRemote(this, "items");
|
|
12966
13217
|
if (renderStates(this, "toc")) return;
|
|
@@ -13080,7 +13331,7 @@ class ContourFilterBar extends ContourBase {
|
|
|
13080
13331
|
if (modesAttr) { try { modes = JSON.parse(modesAttr); } catch (e) { modes = modesAttr.split(",").map((s) => s.trim()); } }
|
|
13081
13332
|
if (modes || this.hasAttribute("mode")) {
|
|
13082
13333
|
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); }
|
|
13334
|
+
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
13335
|
bar.innerHTML = "";
|
|
13085
13336
|
const current = this.getAttribute("mode");
|
|
13086
13337
|
const list = Array.isArray(modes) ? modes : ["draw", "erase", "select"];
|
|
@@ -13714,6 +13965,8 @@ class ContourAvatar extends ContourBase {
|
|
|
13714
13965
|
img.className = "c-avatar__img";
|
|
13715
13966
|
img.src = src;
|
|
13716
13967
|
img.alt = name || "";
|
|
13968
|
+
img.loading = "lazy";
|
|
13969
|
+
img.decoding = "async";
|
|
13717
13970
|
this.appendChild(img);
|
|
13718
13971
|
} else if (name) {
|
|
13719
13972
|
const initials = name.split(" ").map((w) => w[0]).join("").toUpperCase().slice(0, 2);
|
|
@@ -14778,7 +15031,9 @@ class ContourStylePanel extends ContourBase {
|
|
|
14778
15031
|
const breaksWrap = document.createElement("div"); breaksWrap.className = "c-style-panel__breaks";
|
|
14779
15032
|
breaksArr.forEach((b, i) => {
|
|
14780
15033
|
const br = document.createElement("div"); br.className = "break";
|
|
14781
|
-
|
|
15034
|
+
const span = document.createElement("span"); span.textContent = String(b); br.appendChild(span);
|
|
15035
|
+
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);
|
|
15036
|
+
br.appendChild(inp);
|
|
14782
15037
|
breaksWrap.appendChild(br);
|
|
14783
15038
|
});
|
|
14784
15039
|
body.appendChild(breaksWrap);
|
|
@@ -14798,7 +15053,7 @@ class ContourStylePanel extends ContourBase {
|
|
|
14798
15053
|
body.appendChild(list);
|
|
14799
15054
|
}
|
|
14800
15055
|
// Apply/Revert buttons
|
|
14801
|
-
const actions = document.createElement("div"); actions.className = "c-style-panel__actions";
|
|
15056
|
+
const actions = document.createElement("div"); actions.className = "c-style-panel__actions c-btn-group";
|
|
14802
15057
|
const applyBtn = document.createElement("button"); applyBtn.type = "button"; applyBtn.className = "c-btn c-btn--primary"; applyBtn.textContent = "Apply";
|
|
14803
15058
|
const revertBtn = document.createElement("button"); revertBtn.type = "button"; revertBtn.className = "c-btn"; revertBtn.textContent = "Revert";
|
|
14804
15059
|
actions.appendChild(applyBtn); actions.appendChild(revertBtn);
|
|
@@ -14953,7 +15208,7 @@ class ContourAvatarGroup extends ContourBase {
|
|
|
14953
15208
|
av.className = "c-avatar";
|
|
14954
15209
|
const name = typeof it === "string" ? it : (it.name || it.label || "");
|
|
14955
15210
|
av.textContent = name.slice(0, 2).toUpperCase();
|
|
14956
|
-
if (typeof it === "object" && it.color) av.style.background = it.color;
|
|
15211
|
+
if (typeof it === "object" && it.color) { av.style.background = it.color; av.dataset.color = it.color; }
|
|
14957
15212
|
this.appendChild(av);
|
|
14958
15213
|
});
|
|
14959
15214
|
if (parsed.length > max) {
|
|
@@ -15098,6 +15353,7 @@ class ContourPaletteEditor extends ContourBase {
|
|
|
15098
15353
|
sw.className = "c-palette-editor__swatch c-swatch";
|
|
15099
15354
|
sw.type = "button";
|
|
15100
15355
|
sw.style.background = typeof c === "string" ? c : (c.color || c.value || "");
|
|
15356
|
+
sw.dataset.color = typeof c === "string" ? c : (c.color || c.value || "");
|
|
15101
15357
|
sw.setAttribute("aria-label", typeof c === "string" ? c : (c.name || c.label || "color"));
|
|
15102
15358
|
this.appendChild(sw);
|
|
15103
15359
|
});
|
|
@@ -15110,7 +15366,7 @@ class ContourPaletteEditor extends ContourBase {
|
|
|
15110
15366
|
this.addEventListener("click", (e) => {
|
|
15111
15367
|
const sw = e.target && e.target.closest ? e.target.closest(".c-palette-editor__swatch") : null;
|
|
15112
15368
|
if (sw && this.contains(sw)) {
|
|
15113
|
-
this.dispatchEvent(new CustomEvent("contour:change", { bubbles: true, composed: true, detail: { color: sw.style.background } }));
|
|
15369
|
+
this.dispatchEvent(new CustomEvent("contour:change", { bubbles: true, composed: true, detail: { color: (sw.dataset && sw.dataset.color) || sw.style.background } }));
|
|
15114
15370
|
}
|
|
15115
15371
|
});
|
|
15116
15372
|
this.addEventListener("keydown", (e) => {
|
|
@@ -15546,8 +15802,8 @@ class ContourColorPicker extends ContourBase {
|
|
|
15546
15802
|
btn.type = "button";
|
|
15547
15803
|
btn.className = "c-color-picker__preset";
|
|
15548
15804
|
btn.style.background = c;
|
|
15549
|
-
btn.setAttribute("aria-label", "Preset " + c);
|
|
15550
15805
|
btn.dataset.color = c;
|
|
15806
|
+
btn.setAttribute("aria-label", "Preset " + c);
|
|
15551
15807
|
wrap.appendChild(btn);
|
|
15552
15808
|
});
|
|
15553
15809
|
this.appendChild(wrap);
|
|
@@ -15872,6 +16128,8 @@ class ContourFileUpload extends ContourBase {
|
|
|
15872
16128
|
const img = document.createElement("img");
|
|
15873
16129
|
img.className = "c-file-upload__preview-thumb";
|
|
15874
16130
|
img.alt = f.name;
|
|
16131
|
+
img.loading = "lazy";
|
|
16132
|
+
img.decoding = "async";
|
|
15875
16133
|
try { img.src = URL.createObjectURL(f); } catch (e) {}
|
|
15876
16134
|
item.appendChild(img);
|
|
15877
16135
|
} else {
|
|
@@ -15901,10 +16159,11 @@ class ContourNotificationCenter extends ContourBase {
|
|
|
15901
16159
|
static get properties() { return { count: { attribute: "count" }, items: { attribute: "items" }, color: { attribute: "color" } }; }
|
|
15902
16160
|
render() {
|
|
15903
16161
|
this.classList.add("c-notification-center");
|
|
16162
|
+
this.setAttribute("role", "list");
|
|
15904
16163
|
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
16164
|
const color = this.getAttribute("color");
|
|
15906
16165
|
const bullet = btn.querySelector(".c-notification-center__bullet");
|
|
15907
|
-
if (bullet && color) bullet.style.background = color;
|
|
16166
|
+
if (bullet && color) { bullet.style.background = color; bullet.dataset.color = color; }
|
|
15908
16167
|
const count = this.getAttribute("count");
|
|
15909
16168
|
let badge = btn.querySelector(".c-notification-center__badge");
|
|
15910
16169
|
if (count && Number(count) > 0) {
|
|
@@ -16004,7 +16263,7 @@ class ContourStepper extends ContourBase {
|
|
|
16004
16263
|
li.textContent = typeof s === "string" ? s : (s.title || s.label || "");
|
|
16005
16264
|
list.appendChild(li);
|
|
16006
16265
|
});
|
|
16007
|
-
const nav = this.ensure(".c-stepper__nav", () => { const el = document.createElement("div"); el.className = "c-stepper__nav"; return el; });
|
|
16266
|
+
const nav = this.ensure(".c-stepper__nav", () => { const el = document.createElement("div"); el.className = "c-stepper__nav c-btn-group"; return el; });
|
|
16008
16267
|
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; });
|
|
16009
16268
|
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; });
|
|
16010
16269
|
if (!nav.contains(prev)) nav.appendChild(prev);
|
|
@@ -16402,7 +16661,7 @@ class ContourTour extends ContourBase {
|
|
|
16402
16661
|
const step = parsed[current] || {};
|
|
16403
16662
|
const tip = this.ensure(".c-tour__tip", () => { const el = document.createElement("div"); el.className = "c-tour__tip"; return el; });
|
|
16404
16663
|
tip.textContent = typeof step === "string" ? step : (step.text || step.title || "");
|
|
16405
|
-
const nav = this.ensure(".c-tour__nav", () => { const el = document.createElement("div"); el.className = "c-tour__nav"; return el; });
|
|
16664
|
+
const nav = this.ensure(".c-tour__nav", () => { const el = document.createElement("div"); el.className = "c-tour__nav c-btn-group"; return el; });
|
|
16406
16665
|
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; });
|
|
16407
16666
|
if (!nav.contains(next)) nav.appendChild(next);
|
|
16408
16667
|
}
|
|
@@ -16919,6 +17178,7 @@ class ContourDataGrid extends ContourBase {
|
|
|
16919
17178
|
td.setAttribute("role", "gridcell");
|
|
16920
17179
|
td.setAttribute("tabindex", "0");
|
|
16921
17180
|
td.textContent = r && r[key] != null ? r[key] : "";
|
|
17181
|
+
if (!String(td.textContent).trim()) td.setAttribute("aria-label", "Empty");
|
|
16922
17182
|
tr.appendChild(td);
|
|
16923
17183
|
});
|
|
16924
17184
|
tbody.appendChild(tr);
|
|
@@ -16968,6 +17228,7 @@ class ContourDataGrid extends ContourBase {
|
|
|
16968
17228
|
td.setAttribute("role", "gridcell");
|
|
16969
17229
|
td.setAttribute("tabindex", "0");
|
|
16970
17230
|
td.textContent = r && r[key] != null ? r[key] : "";
|
|
17231
|
+
if (!String(td.textContent).trim()) td.setAttribute("aria-label", "Empty");
|
|
16971
17232
|
tr.appendChild(td);
|
|
16972
17233
|
});
|
|
16973
17234
|
tbody.appendChild(tr);
|
|
@@ -17186,6 +17447,55 @@ class ContourTreeGrid extends ContourBase {
|
|
|
17186
17447
|
}
|
|
17187
17448
|
define("contour-tree-grid", ContourTreeGrid);
|
|
17188
17449
|
|
|
17450
|
+
class ContourPullToRefresh extends ContourBase {
|
|
17451
|
+
static get observed() { return ["threshold"]; }
|
|
17452
|
+
static get properties() { return { threshold: { attribute: "threshold" } }; }
|
|
17453
|
+
render() {
|
|
17454
|
+
this.classList.add("c-pull-to-refresh");
|
|
17455
|
+
const ind = this.ensure(".c-pull-to-refresh__indicator", () => {
|
|
17456
|
+
const e = document.createElement("div");
|
|
17457
|
+
e.className = "c-pull-to-refresh__indicator";
|
|
17458
|
+
e.textContent = "Pull to refresh";
|
|
17459
|
+
return e;
|
|
17460
|
+
});
|
|
17461
|
+
if (ind.parentNode !== this) this.prepend(ind);
|
|
17462
|
+
}
|
|
17463
|
+
enhance() {
|
|
17464
|
+
if (this._wiredPullToRefresh) return;
|
|
17465
|
+
this._wiredPullToRefresh = true;
|
|
17466
|
+
let startY = 0;
|
|
17467
|
+
let pulling = false;
|
|
17468
|
+
this.addEventListener("touchstart", (e) => {
|
|
17469
|
+
if (this.scrollTop > 0) return;
|
|
17470
|
+
const t = e.touches && e.touches[0];
|
|
17471
|
+
if (t) { startY = t.clientY; pulling = true; }
|
|
17472
|
+
}, { passive: true });
|
|
17473
|
+
this.addEventListener("touchmove", (e) => {
|
|
17474
|
+
if (!pulling) return;
|
|
17475
|
+
const t = e.touches && e.touches[0];
|
|
17476
|
+
if (!t) return;
|
|
17477
|
+
const dy = t.clientY - startY;
|
|
17478
|
+
if (dy > 0 && dy < 120) {
|
|
17479
|
+
this.style.setProperty("--ptr-offset", dy + "px");
|
|
17480
|
+
}
|
|
17481
|
+
}, { passive: true });
|
|
17482
|
+
this.addEventListener("touchend", (e) => {
|
|
17483
|
+
if (!pulling) return;
|
|
17484
|
+
pulling = false;
|
|
17485
|
+
const t = e.changedTouches && e.changedTouches[0];
|
|
17486
|
+
const dy = t ? t.clientY - startY : 0;
|
|
17487
|
+
const thr = Number(this.getAttribute("threshold")) || 60;
|
|
17488
|
+
if (dy >= thr) {
|
|
17489
|
+
this.classList.add("is-refreshing");
|
|
17490
|
+
this.dispatchEvent(new CustomEvent("contour:refresh", { bubbles: true, composed: true }));
|
|
17491
|
+
setTimeout(() => this.classList.remove("is-refreshing"), 800);
|
|
17492
|
+
}
|
|
17493
|
+
this.style.removeProperty("--ptr-offset");
|
|
17494
|
+
}, { passive: true });
|
|
17495
|
+
}
|
|
17496
|
+
}
|
|
17497
|
+
define("contour-pull-to-refresh", ContourPullToRefresh);
|
|
17498
|
+
|
|
17189
17499
|
|
|
17190
17500
|
// ---- Registration: the class-only wrappers run last ------------------
|
|
17191
17501
|
//
|