contour-ds 1.1.2 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -2
- package/dist/agent-rules.json +5 -1
- package/dist/build-manifest.json +94 -93
- package/dist/contour-wc.esm.js +4443 -534
- package/dist/contour-wc.esm.min.js +1 -1
- package/dist/contour-wc.js +4441 -528
- package/dist/contour-wc.min.js +1 -1
- package/dist/contour.components.json +4054 -171
- package/dist/contour.css +1325 -565
- package/dist/contour.d.ts +119 -62
- package/dist/contour.esm.js +23 -0
- package/dist/contour.esm.min.js +1 -1
- package/dist/contour.js +23 -0
- package/dist/contour.min.css +1 -1
- package/dist/contour.min.js +1 -1
- package/dist/contour.tokens.json +47 -2
- package/dist/docs/actions.md +6 -2
- package/dist/docs/affordances.md +19 -3
- package/dist/docs/apireference.md +30 -0
- package/dist/docs/colour.md +2 -2
- package/dist/docs/componentindex.md +39 -0
- package/dist/docs/data.md +38 -3
- package/dist/docs/docs.md +6 -2
- package/dist/docs/feedback.md +13 -3
- package/dist/docs/field.md +7 -2
- package/dist/docs/forms.md +35 -3
- package/dist/docs/index.json +44 -75
- package/dist/docs/install.md +4 -2
- package/dist/docs/landing.md +3 -2
- package/dist/docs/mapengine.md +9 -3
- package/dist/docs/motion.md +5 -2
- package/dist/docs/navigation.md +10 -3
- package/dist/docs/overlays.md +26 -3
- package/dist/docs/overview.md +2 -2
- package/dist/docs/patterns.md +38 -3
- package/dist/docs/playground.md +5 -2
- package/dist/docs/principles.md +2 -2
- package/dist/docs/recipes.md +7 -3
- package/dist/docs/space.md +2 -2
- package/dist/docs/status.md +19 -3
- package/dist/docs/surfaces.md +7 -3
- package/dist/docs/theming.md +5 -2
- package/dist/docs/type.md +2 -2
- package/dist/docs/webcomponents.md +26 -7
- package/dist/map-chrome.mapbox.css +4 -4
- package/dist/map-chrome.maplibre.css +4 -4
- 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/behaviours.mjs +69 -11
- package/dist/wc/content.mjs +163 -8
- package/dist/wc/core.mjs +177 -36
- package/dist/wc/dashboard.mjs +69 -4
- package/dist/wc/data.mjs +933 -128
- package/dist/wc/docs.mjs +118 -0
- package/dist/wc/feedback.mjs +75 -13
- package/dist/wc/forms.mjs +371 -34
- package/dist/wc/index.mjs +31 -3
- package/dist/wc/interaction.mjs +11 -6
- package/dist/wc/map.mjs +142 -38
- package/dist/wc/misc.mjs +29 -1
- package/dist/wc/navigation.mjs +424 -75
- package/dist/wc/registration.mjs +8 -4
- package/dist/wc/shadow.mjs +29 -12
- package/dist/wc/states.mjs +15 -0
- package/dist/wc/svg.mjs +10 -0
- package/dist/wc/ui.mjs +1767 -129
- package/package.json +39 -6
package/dist/wc/docs.mjs
CHANGED
|
@@ -128,6 +128,7 @@ class ContourDocsShell extends ContourBase {
|
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
class ContourFileTree extends ContourBase {
|
|
131
|
+
static get updateMode() { return "keyed"; }
|
|
131
132
|
static get observed() { return ["items"]; }
|
|
132
133
|
static get properties() { return { items: { attribute: "items" } }; }
|
|
133
134
|
render() {
|
|
@@ -156,3 +157,120 @@ class ContourFileTree extends ContourBase {
|
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
define("contour-file-tree", ContourFileTree);
|
|
160
|
+
|
|
161
|
+
class ContourChangelog extends ContourBase {
|
|
162
|
+
static get observed() { return ["src", "max", "loading", "error"]; }
|
|
163
|
+
static get properties() { return { src: { attribute: "src" }, max: { attribute: "max", type: Number } }; }
|
|
164
|
+
render() {
|
|
165
|
+
this.classList.add("c-changelog");
|
|
166
|
+
const src = this.getAttribute("src");
|
|
167
|
+
if (src) {
|
|
168
|
+
if (this.dataset.loaded === src) return;
|
|
169
|
+
this.dataset.loaded = "";
|
|
170
|
+
const loading = this.ensure(".c-changelog__loading", () => { const el = document.createElement("div"); el.className = "c-changelog__loading"; el.textContent = "Loading…"; return el; });
|
|
171
|
+
// clear
|
|
172
|
+
Array.from(this.querySelectorAll(".c-changelog__entry, .c-changelog__error")).forEach((n) => n.remove());
|
|
173
|
+
if (!this.querySelector(".c-changelog__loading")) this.appendChild(loading);
|
|
174
|
+
fetch(src).then((r) => {
|
|
175
|
+
if (!r.ok) throw new Error("HTTP " + r.status);
|
|
176
|
+
return r.text();
|
|
177
|
+
}).then((text) => {
|
|
178
|
+
const ld = this.querySelector(".c-changelog__loading");
|
|
179
|
+
if (ld) ld.remove();
|
|
180
|
+
this.dataset.loaded = src;
|
|
181
|
+
const entries = parseChangelog(text);
|
|
182
|
+
const max = parseInt(this.getAttribute("max") || "0", 10);
|
|
183
|
+
const list = (max > 0) ? entries.slice(0, max) : entries;
|
|
184
|
+
if (!list.length) {
|
|
185
|
+
const empty = document.createElement("div");
|
|
186
|
+
empty.className = "c-changelog__empty";
|
|
187
|
+
empty.textContent = "No releases found.";
|
|
188
|
+
this.appendChild(empty);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
list.forEach((e) => {
|
|
192
|
+
const det = document.createElement("details");
|
|
193
|
+
det.className = "c-changelog__entry";
|
|
194
|
+
const sum = document.createElement("summary");
|
|
195
|
+
sum.className = "c-changelog__summary";
|
|
196
|
+
const ver = document.createElement("span");
|
|
197
|
+
ver.className = "c-changelog__version";
|
|
198
|
+
ver.textContent = e.version;
|
|
199
|
+
sum.appendChild(ver);
|
|
200
|
+
if (e.date) {
|
|
201
|
+
const d = document.createElement("span");
|
|
202
|
+
d.className = "c-changelog__date";
|
|
203
|
+
d.textContent = e.date;
|
|
204
|
+
sum.appendChild(d);
|
|
205
|
+
}
|
|
206
|
+
det.appendChild(sum);
|
|
207
|
+
const body = document.createElement("div");
|
|
208
|
+
body.className = "c-changelog__body";
|
|
209
|
+
body.innerHTML = renderChangelogBody(e.body);
|
|
210
|
+
det.appendChild(body);
|
|
211
|
+
this.appendChild(det);
|
|
212
|
+
});
|
|
213
|
+
}).catch((err) => {
|
|
214
|
+
const ld = this.querySelector(".c-changelog__loading");
|
|
215
|
+
if (ld) ld.remove();
|
|
216
|
+
const er = document.createElement("div");
|
|
217
|
+
er.className = "c-changelog__error";
|
|
218
|
+
er.textContent = "Failed to load changelog: " + (err && err.message ? err.message : err);
|
|
219
|
+
this.appendChild(er);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
define("contour-changelog", ContourChangelog);
|
|
225
|
+
|
|
226
|
+
function parseChangelog(text) {
|
|
227
|
+
const lines = String(text).split(/\r?\n/);
|
|
228
|
+
const entries = [];
|
|
229
|
+
let cur = null;
|
|
230
|
+
for (const line of lines) {
|
|
231
|
+
const m = line.match(/^##\s+\[?([^\]\n]+)\]?\s*[-–—]?\s*(.*)$/);
|
|
232
|
+
if (m && (line.startsWith("## ") )) {
|
|
233
|
+
// only treat as version header if it looks like a version or "Unreleased"
|
|
234
|
+
const ver = m[1].trim();
|
|
235
|
+
const rest = m[2].trim();
|
|
236
|
+
if (/^\d|unreleased/i.test(ver)) {
|
|
237
|
+
if (cur) entries.push(cur);
|
|
238
|
+
cur = { version: ver, date: rest.replace(/^[-–—]\s*/, "").trim(), body: "" };
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (cur) cur.body += line + "\n";
|
|
243
|
+
}
|
|
244
|
+
if (cur) entries.push(cur);
|
|
245
|
+
return entries;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function escapeHtml(s) {
|
|
249
|
+
return String(s).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function renderChangelogBody(body) {
|
|
253
|
+
const lines = String(body).trim().split(/\r?\n/);
|
|
254
|
+
const out = [];
|
|
255
|
+
let inList = false;
|
|
256
|
+
for (const raw of lines) {
|
|
257
|
+
const line = raw.trimEnd();
|
|
258
|
+
if (/^###\s+/.test(line)) {
|
|
259
|
+
if (inList) { out.push("</ul>"); inList = false; }
|
|
260
|
+
out.push("<h4>" + escapeHtml(line.replace(/^###\s+/, "")) + "</h4>");
|
|
261
|
+
} else if (/^##\s+/.test(line)) {
|
|
262
|
+
if (inList) { out.push("</ul>"); inList = false; }
|
|
263
|
+
out.push("<h3>" + escapeHtml(line.replace(/^##\s+/, "")) + "</h3>");
|
|
264
|
+
} else if (/^[-*]\s+/.test(line)) {
|
|
265
|
+
if (!inList) { out.push("<ul>"); inList = true; }
|
|
266
|
+
out.push("<li>" + escapeHtml(line.replace(/^[-*]\s+/, "")) + "</li>");
|
|
267
|
+
} else if (line.trim() === "") {
|
|
268
|
+
if (inList) { out.push("</ul>"); inList = false; }
|
|
269
|
+
} else {
|
|
270
|
+
if (inList) { out.push("</ul>"); inList = false; }
|
|
271
|
+
out.push("<p>" + escapeHtml(line) + "</p>");
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (inList) out.push("</ul>");
|
|
275
|
+
return out.join("");
|
|
276
|
+
}
|
package/dist/wc/feedback.mjs
CHANGED
|
@@ -75,7 +75,9 @@ class ContourDialog extends ContourBase {
|
|
|
75
75
|
modalContain(this, false);
|
|
76
76
|
this.dispatchEvent(new CustomEvent("contour:close", { bubbles: true, composed: true }));
|
|
77
77
|
const last = this._dialogLastFocus;
|
|
78
|
-
if (last && typeof last.focus === "function") {
|
|
78
|
+
if (last && typeof last.focus === "function") {
|
|
79
|
+
try { last.focus(); } catch (e) {}
|
|
80
|
+
}
|
|
79
81
|
}
|
|
80
82
|
};
|
|
81
83
|
this.focus = () => {
|
|
@@ -339,6 +341,7 @@ class ContourEmpty extends ContourBase {
|
|
|
339
341
|
static get properties() { return { state: { attribute: "state" }, title: { attribute: "title" }, body: { attribute: "body" }, action: { attribute: "action" }, icon: { attribute: "icon" }, illustration: { attribute: "illustration" } }; }
|
|
340
342
|
render() {
|
|
341
343
|
this.classList.add("c-empty");
|
|
344
|
+
if (!this.hasAttribute("role")) this.setAttribute("role", "status");
|
|
342
345
|
const state = this.getAttribute("state") || "empty";
|
|
343
346
|
const title = this.getAttribute("title") || (state === "filtered" ? "Nothing matches" : state === "error" ? "Could not load" : "No data yet");
|
|
344
347
|
const body = this.getAttribute("body") || (state === "filtered" ? "Try clearing some filters." : state === "error" ? "Check your connection and try again." : "There is nothing to show here yet.");
|
|
@@ -578,7 +581,7 @@ class ContourDrawer extends ContourBase {
|
|
|
578
581
|
// cannot re-enter the render — see the dialog); the `.is-open` class the
|
|
579
582
|
// CSS keys off is re-derived here because the base restores the authored
|
|
580
583
|
// class on every render and would otherwise drop it mid-lock.
|
|
581
|
-
if (this.hasAttribute("open")) this.classList.add("is-open");
|
|
584
|
+
if (this.hasAttribute("open")) this.classList.add("is-open"); else this.classList.remove("is-open");
|
|
582
585
|
const body = this.getAttribute("body");
|
|
583
586
|
const b = this.querySelector(".c-drawer__body");
|
|
584
587
|
const authored = b ? Array.from(b.children) : [];
|
|
@@ -675,7 +678,7 @@ class ContourSheet extends ContourBase {
|
|
|
675
678
|
// Open state is the `open` attribute (written, never observed, so it
|
|
676
679
|
// cannot re-enter the render); the `.is-open` class is re-derived because
|
|
677
680
|
// the base restores the authored class on every render (see the drawer).
|
|
678
|
-
if (this.hasAttribute("open")) this.classList.add("is-open");
|
|
681
|
+
if (this.hasAttribute("open")) this.classList.add("is-open"); else this.classList.remove("is-open");
|
|
679
682
|
const body = this.getAttribute("body");
|
|
680
683
|
const b = this.querySelector(".c-sheet__body");
|
|
681
684
|
const authored = b ? Array.from(b.children) : [];
|
|
@@ -839,7 +842,8 @@ class ContourToastHost extends ContourBase {
|
|
|
839
842
|
if (this._wiredToastHost) return;
|
|
840
843
|
this._wiredToastHost = true;
|
|
841
844
|
this._toastQueue = [];
|
|
842
|
-
|
|
845
|
+
this._toastActive = null;
|
|
846
|
+
const buildToast = (message, opts) => {
|
|
843
847
|
opts = opts || {};
|
|
844
848
|
const toast = document.createElement("div");
|
|
845
849
|
toast.className = "c-toast";
|
|
@@ -847,22 +851,80 @@ class ContourToastHost extends ContourBase {
|
|
|
847
851
|
toast.setAttribute("aria-live", "polite");
|
|
848
852
|
toast.setAttribute("aria-atomic", "true");
|
|
849
853
|
if (opts.variant) toast.classList.add("c-toast--" + opts.variant);
|
|
850
|
-
toast.
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
854
|
+
toast.dataset.message = message == null ? "" : String(message);
|
|
855
|
+
const text = document.createElement("span");
|
|
856
|
+
text.className = "c-toast__text";
|
|
857
|
+
text.textContent = message == null ? "" : String(message);
|
|
858
|
+
toast.appendChild(text);
|
|
859
|
+
if (opts.action && (typeof opts.action === "string" || (opts.action.label))) {
|
|
860
|
+
const label = (typeof opts.action === "string") ? opts.action : opts.action.label;
|
|
861
|
+
const btn = document.createElement("button");
|
|
862
|
+
btn.type = "button";
|
|
863
|
+
btn.className = "c-btn c-btn--ghost c-toast__action";
|
|
864
|
+
btn.textContent = label;
|
|
865
|
+
btn.addEventListener("click", (e) => {
|
|
866
|
+
e.stopPropagation();
|
|
867
|
+
if (typeof opts.action === "object" && typeof opts.action.onClick === "function") {
|
|
868
|
+
try { opts.action.onClick(); } catch (err) {}
|
|
869
|
+
}
|
|
870
|
+
dismiss(toast);
|
|
871
|
+
});
|
|
872
|
+
toast.appendChild(btn);
|
|
873
|
+
}
|
|
858
874
|
return toast;
|
|
859
875
|
};
|
|
860
|
-
|
|
876
|
+
const dismiss = (toast) => {
|
|
877
|
+
if (!toast || !toast.parentNode) return;
|
|
878
|
+
if (toast._timer) { clearTimeout(toast._timer); toast._timer = null; }
|
|
879
|
+
toast.parentNode.removeChild(toast);
|
|
880
|
+
if (this._toastActive === toast) this._toastActive = null;
|
|
881
|
+
this.dispatchEvent(new CustomEvent("contour:close", { bubbles: true, composed: true, detail: { message: toast.textContent } }));
|
|
882
|
+
pump();
|
|
883
|
+
};
|
|
884
|
+
const pump = () => {
|
|
885
|
+
if (this._toastActive && this._toastActive.parentNode) return;
|
|
886
|
+
// dedup: skip queued items whose message matches the one just shown
|
|
887
|
+
while (this._toastQueue.length) {
|
|
888
|
+
const next = this._toastQueue.shift();
|
|
889
|
+
if (next._deduped) continue;
|
|
890
|
+
const toast = buildToast(next.message, next.opts);
|
|
891
|
+
this._toastActive = toast;
|
|
892
|
+
this.appendChild(toast);
|
|
893
|
+
const ms = (next.opts && next.opts.duration && next.opts.duration > 0) ? next.opts.duration : 3000;
|
|
894
|
+
toast._timer = setTimeout(() => dismiss(toast), ms);
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
this._toastActive = null;
|
|
898
|
+
};
|
|
899
|
+
this.show = (message, opts) => {
|
|
900
|
+
opts = opts || {};
|
|
901
|
+
const key = String(message == null ? "" : message);
|
|
902
|
+
// dedup: if an identical message is already queued or active, reset its timer instead of stacking
|
|
903
|
+
const active = this._toastActive;
|
|
904
|
+
if (active && active.dataset && active.dataset.message === key && key !== "") {
|
|
905
|
+
if (active._timer) { clearTimeout(active._timer); }
|
|
906
|
+
const ms = (opts.duration && opts.duration > 0) ? opts.duration : 3000;
|
|
907
|
+
active._timer = setTimeout(() => dismiss(active), ms);
|
|
908
|
+
return active;
|
|
909
|
+
}
|
|
910
|
+
const queuedDup = this._toastQueue.find((q) => String(q.message) === key && key !== "");
|
|
911
|
+
if (queuedDup) {
|
|
912
|
+
queuedDup.opts = Object.assign({}, queuedDup.opts, opts);
|
|
913
|
+
return null;
|
|
914
|
+
}
|
|
915
|
+
const entry = { message, opts, _deduped: false };
|
|
916
|
+
this._toastQueue.push(entry);
|
|
917
|
+
pump();
|
|
918
|
+
return this._toastActive;
|
|
919
|
+
};
|
|
861
920
|
this.hide = () => {
|
|
921
|
+
if (this._toastActive) dismiss(this._toastActive);
|
|
922
|
+
this._toastQueue.length = 0;
|
|
862
923
|
Array.from(this.querySelectorAll(".c-toast")).forEach((t) => {
|
|
863
924
|
if (t._timer) clearTimeout(t._timer);
|
|
864
925
|
if (t.parentNode) t.parentNode.removeChild(t);
|
|
865
926
|
});
|
|
927
|
+
this._toastActive = null;
|
|
866
928
|
};
|
|
867
929
|
}
|
|
868
930
|
}
|