contour-ds 1.7.1 → 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.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/dist/build-manifest.json +57 -57
  3. package/dist/contour-wc.esm.js +53 -19
  4. package/dist/contour-wc.esm.min.js +1 -1
  5. package/dist/contour-wc.js +53 -19
  6. package/dist/contour-wc.min.js +1 -1
  7. package/dist/contour.components.json +832 -177
  8. package/dist/contour.css +988 -349
  9. package/dist/contour.min.css +1 -1
  10. package/dist/docs/actions.md +1 -1
  11. package/dist/docs/affordances.md +3 -1
  12. package/dist/docs/apireference.md +1 -1
  13. package/dist/docs/colour.md +1 -1
  14. package/dist/docs/componentindex.md +1 -1
  15. package/dist/docs/data.md +1 -1
  16. package/dist/docs/docs.md +1 -1
  17. package/dist/docs/feedback.md +1 -1
  18. package/dist/docs/field.md +1 -1
  19. package/dist/docs/forms.md +1 -1
  20. package/dist/docs/index.json +2 -2
  21. package/dist/docs/install.md +1 -1
  22. package/dist/docs/landing.md +1 -1
  23. package/dist/docs/mapengine.md +1 -1
  24. package/dist/docs/motion.md +1 -1
  25. package/dist/docs/navigation.md +1 -1
  26. package/dist/docs/overlays.md +1 -1
  27. package/dist/docs/overview.md +1 -1
  28. package/dist/docs/patterns.md +1 -1
  29. package/dist/docs/playground.md +1 -1
  30. package/dist/docs/principles.md +1 -1
  31. package/dist/docs/recipes.md +1 -1
  32. package/dist/docs/space.md +1 -1
  33. package/dist/docs/status.md +1 -1
  34. package/dist/docs/surfaces.md +1 -1
  35. package/dist/docs/theming.md +1 -1
  36. package/dist/docs/type.md +1 -1
  37. package/dist/docs/webcomponents.md +1 -1
  38. package/dist/registry/items/contour-core.json +2 -2
  39. package/dist/registry/items/contour-data.json +2 -2
  40. package/dist/registry/items/contour-docs.json +2 -2
  41. package/dist/registry/items/contour-landing.json +2 -2
  42. package/dist/registry/registry.json +8 -8
  43. package/dist/surfaces/contour-core.min.css +1 -1
  44. package/dist/surfaces/contour-data.min.css +1 -1
  45. package/dist/surfaces/contour-docs.min.css +1 -1
  46. package/dist/surfaces/contour-landing.min.css +1 -1
  47. package/dist/wc/content.mjs +1 -0
  48. package/dist/wc/data.mjs +32 -11
  49. package/dist/wc/forms.mjs +6 -2
  50. package/dist/wc/interaction.mjs +3 -1
  51. package/dist/wc/layout.mjs +2 -2
  52. package/dist/wc/navigation.mjs +1 -0
  53. package/dist/wc/ui.mjs +8 -3
  54. package/package.json +1 -1
@@ -446,6 +446,7 @@ class ContourShowcaseFull extends ContourBase {
446
446
  static get properties() { return { title: { attribute: "title" }, text: { attribute: "text" }, media: { attribute: "media" }, reverse: { attribute: "reverse" }, items: { attribute: "items" }, src: { attribute: "src" } }; }
447
447
  render() {
448
448
  this.classList.add("c-showcase");
449
+ this.setAttribute("role", "list");
449
450
  if (this.hasAttribute("reverse")) this.classList.add("c-showcase--reverse"); else this.classList.remove("c-showcase--reverse");
450
451
  const title = this.getAttribute("title");
451
452
  if (title) this.setAttribute("aria-label", title);
package/dist/wc/data.mjs CHANGED
@@ -258,7 +258,7 @@ class ContourTable extends ContourBase {
258
258
  btn.className = "c-btn c-btn--ghost c-btn--sm";
259
259
  btn.type = "button";
260
260
  btn.textContent = this.getAttribute("retry") || "Retry";
261
- btn.style.marginInlineStart = "var(--space-sm)";
261
+ btn.classList.add("u-ms-sm");
262
262
  btn.dataset.action = "retry";
263
263
  td.appendChild(btn);
264
264
  }
@@ -734,7 +734,7 @@ class ContourChart extends ContourBase {
734
734
  btn.type = "button";
735
735
  btn.textContent = this.getAttribute("retry") || "Retry";
736
736
  btn.dataset.action = "retry";
737
- btn.style.marginBlockStart = "var(--space-sm)";
737
+ btn.classList.add("u-mbs-sm");
738
738
  err.appendChild(btn);
739
739
  }
740
740
  plot.appendChild(err);
@@ -755,7 +755,7 @@ class ContourChart extends ContourBase {
755
755
  sk.style.display = "block";
756
756
  sk.style.inlineSize = "100%";
757
757
  sk.style.blockSize = "0.6rem";
758
- sk.style.marginBlockEnd = "var(--space-2xs)";
758
+ sk.classList.add("u-mbe-2xs");
759
759
  plot.appendChild(sk);
760
760
  }
761
761
  const axis = this.getAttribute("axis");
@@ -2076,9 +2076,11 @@ class ContourDonut extends ContourBase {
2076
2076
  // text list
2077
2077
  const list = document.createElement("div");
2078
2078
  list.className = "c-donut__list";
2079
+ list.setAttribute("role", "list");
2079
2080
  items.forEach((it, i) => {
2080
2081
  const row = document.createElement("div");
2081
2082
  row.className = "c-donut__item";
2083
+ row.setAttribute("role", "listitem");
2082
2084
  const sw = document.createElement("span");
2083
2085
  sw.className = "c-donut__swatch";
2084
2086
  sw.style.background = (typeof it === "object" && it.color) ? it.color : "var(--chart-" + ((i % 8) + 1) + ")";
@@ -2263,8 +2265,6 @@ class ContourPivot extends ContourBase {
2263
2265
  const toolbar = document.createElement("div");
2264
2266
  toolbar.className = "c-pivot__toolbar";
2265
2267
  toolbar.style.display = "flex";
2266
- toolbar.style.gap = "0.5rem";
2267
- toolbar.style.marginBlockEnd = "0.5rem";
2268
2268
  const filterInput = document.createElement("input");
2269
2269
  filterInput.type = "search";
2270
2270
  filterInput.className = "c-input c-pivot__filter";
@@ -2702,6 +2702,7 @@ class ContourMetricsFull extends ContourBase {
2702
2702
  static get properties() { return { items: { attribute: "items" }, src: { attribute: "src" } }; }
2703
2703
  render() {
2704
2704
  this.classList.add("c-metrics");
2705
+ this.setAttribute("role", "list");
2705
2706
  wireStates(this);
2706
2707
  loadRemote(this, "items");
2707
2708
  if (renderStates(this, "metrics")) return;
@@ -2714,6 +2715,7 @@ class ContourMetricsFull extends ContourBase {
2714
2715
  parsed.forEach((it) => {
2715
2716
  const item = document.createElement("div");
2716
2717
  item.className = "c-metrics__item";
2718
+ item.setAttribute("role", "listitem");
2717
2719
  const v = document.createElement("div");
2718
2720
  v.className = "c-metrics__value";
2719
2721
  v.textContent = (typeof it === "object" && it !== null) ? (it.value ?? it.v ?? "") : String(it);
@@ -2740,6 +2742,12 @@ class ContourLegend extends ContourBase {
2740
2742
  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" } }; }
2741
2743
  render() {
2742
2744
  this.classList.add("c-legend");
2745
+ const continuous = this.hasAttribute("continuous");
2746
+ if (continuous || this.hasAttribute("selectable")) {
2747
+ this.setAttribute("role", "group");
2748
+ } else {
2749
+ this.setAttribute("role", "list");
2750
+ }
2743
2751
  wireStates(this);
2744
2752
  loadRemote(this, "items");
2745
2753
  if (renderStates(this, "legend")) return;
@@ -2771,7 +2779,11 @@ class ContourLegend extends ContourBase {
2771
2779
  try {
2772
2780
  const parsed = JSON.parse(items);
2773
2781
  const list = this.ensure(".c-legend__items", () => { const el = document.createElement("div"); el.className = "c-legend__items"; return el; });
2774
- list.setAttribute("role", "listbox");
2782
+ if (this.hasAttribute("selectable")) {
2783
+ list.setAttribute("role", "group");
2784
+ } else {
2785
+ list.setAttribute("role", "listbox");
2786
+ }
2775
2787
  if (title) list.setAttribute("aria-label", title);
2776
2788
  list.innerHTML = "";
2777
2789
  parsed.forEach((it) => {
@@ -2781,8 +2793,8 @@ class ContourLegend extends ContourBase {
2781
2793
  item.className = "c-legend__item";
2782
2794
  item.setAttribute("tabindex", "-1");
2783
2795
  if (selectable) {
2784
- item.setAttribute("role", "option");
2785
- item.setAttribute("aria-selected", "true");
2796
+ item.setAttribute("role", "button");
2797
+ item.setAttribute("aria-pressed", "true");
2786
2798
  item.dataset.key = key;
2787
2799
  } else {
2788
2800
  item.setAttribute("role", "option");
@@ -3000,8 +3012,17 @@ class ContourLegend extends ContourBase {
3000
3012
  this.addEventListener("click", (e) => {
3001
3013
  const btn = e.target && e.target.closest ? e.target.closest(".c-legend__item") : null;
3002
3014
  if (!btn || !this.contains(btn)) return;
3003
- const selected = btn.getAttribute("aria-selected") !== "true";
3004
- btn.setAttribute("aria-selected", String(selected));
3015
+ let selected;
3016
+ const isPressed = btn.getAttribute("aria-pressed");
3017
+ if (btn.getAttribute("aria-pressed") !== null) {
3018
+ const pressed = btn.getAttribute("aria-pressed") !== "true";
3019
+ btn.setAttribute("aria-pressed", String(pressed));
3020
+ selected = pressed;
3021
+ } else {
3022
+ const selected2 = btn.getAttribute("aria-selected") !== "true";
3023
+ btn.setAttribute("aria-selected", String(selected2));
3024
+ selected = selected2;
3025
+ }
3005
3026
  this.dispatchEvent(new CustomEvent("contour:legend-toggle", {
3006
3027
  detail: { label: btn.textContent.trim(), key: btn.dataset.key || btn.textContent.trim(), pressed: selected },
3007
3028
  bubbles: true,
@@ -3374,7 +3395,7 @@ class ContourCompare extends ContourBase {
3374
3395
  this.classList.add("c-compare");
3375
3396
  this.setAttribute("role", "group");
3376
3397
  this.setAttribute("aria-label", "Comparison");
3377
- this.style.padding = "var(--space-md)";
3398
+
3378
3399
  wireStates(this);
3379
3400
  loadRemote(this, ["no", "text", "yes"]);
3380
3401
  if (renderStates(this, "compare")) return;
package/dist/wc/forms.mjs CHANGED
@@ -925,9 +925,13 @@ class ContourInputFull extends ContourBase {
925
925
  input.className = "c-input";
926
926
  input.type = this.getAttribute("type") || "text";
927
927
  input.placeholder = this.getAttribute("placeholder") || "";
928
- const label = this.getAttribute("label");
928
+ let label = this.getAttribute("label");
929
+ if (!label) {
930
+ const field = this.closest("contour-field");
931
+ if (field) label = field.getAttribute("label");
932
+ }
929
933
  if (label) input.setAttribute("aria-label", label);
930
- // else: keep any aria-label set by an ancestor (e.g. contour-field).
934
+ else if (!input.getAttribute("aria-label")) input.setAttribute("aria-label", "Input");
931
935
  if (this.hasAttribute("value")) input.value = this.getAttribute("value");
932
936
  if (this.hasAttribute("required")) input.setAttribute("required", "");
933
937
  else input.removeAttribute("required");
@@ -54,6 +54,7 @@ class ContourShortcutListFull extends ContourBase {
54
54
  static get properties() { return { title: { attribute: "title" } }; }
55
55
  render() {
56
56
  this.classList.add("c-shortcut-list");
57
+ this.setAttribute("role", "list");
57
58
  const title = this.getAttribute("title");
58
59
  if (title) {
59
60
  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; });
@@ -67,6 +68,7 @@ class ContourShortcutRowFull extends ContourBase {
67
68
  static get properties() { return { desc: { attribute: "desc" }, key: { attribute: "key" } }; }
68
69
  render() {
69
70
  this.classList.add("c-shortcut-row");
71
+ this.setAttribute("role", "listitem");
70
72
  const key = this.getAttribute("key");
71
73
  const desc = this.getAttribute("desc");
72
74
  if (key) {
@@ -111,7 +113,7 @@ class ContourShortcutPanelFull extends ContourBase {
111
113
  this.classList.add("c-shortcut-overlay");
112
114
  const title = this.getAttribute("title");
113
115
  if (title) {
114
- const t = this.ensure(".c-shortcut-overlay__title", () => { const el = document.createElement("div"); el.className = "c-shortcut-overlay__title"; el.style.padding = "var(--space-sm)"; return el; });
116
+ const t = this.ensure(".c-shortcut-overlay__title", () => { const el = document.createElement("div"); el.className = "c-shortcut-overlay__title"; return el; });
115
117
  t.textContent = title;
116
118
  }
117
119
  if (this.hasAttribute("open")) this.removeAttribute("hidden");
@@ -7,7 +7,7 @@ import { ContourBase, define } from './core.mjs';
7
7
  const header = this.ensure(".c-app__header", () => { const el = document.createElement("header"); el.className = "c-app__header"; return el; });
8
8
  const title = this.getAttribute("title");
9
9
  if (title) {
10
- const t = this.ensure(".c-app__title", () => { const el = document.createElement("div"); el.className = "c-app__title"; el.style.padding = "var(--space-md)"; el.style.fontWeight = "var(--weight-semibold)"; return el; });
10
+ const t = this.ensure(".c-app__title", () => { const el = document.createElement("div"); el.className = "c-app__title"; return el; });
11
11
  t.textContent = title;
12
12
  if (t.parentNode !== header) header.appendChild(t);
13
13
  }
@@ -25,7 +25,7 @@ import { ContourBase, define } from './core.mjs';
25
25
  const main = this.ensure(".c-app-body__main", () => { const el = document.createElement("main"); el.className = "c-app-body__main"; return el; });
26
26
  const title = this.getAttribute("title");
27
27
  if (title) {
28
- const t = this.ensure(".c-app-body__title", () => { const el = document.createElement("div"); el.className = "c-app-body__title"; el.style.padding = "var(--space-md)"; return el; });
28
+ const t = this.ensure(".c-app-body__title", () => { const el = document.createElement("div"); el.className = "c-app-body__title"; return el; });
29
29
  t.textContent = title;
30
30
  if (t.parentNode !== main) main.appendChild(t);
31
31
  }
@@ -913,6 +913,7 @@ class ContourTocFull extends ContourBase {
913
913
  static get properties() { return { title: { attribute: "title" }, items: { attribute: "items" }, src: { attribute: "src" } }; }
914
914
  render() {
915
915
  this.classList.add("c-toc");
916
+ this.setAttribute("role", "list");
916
917
  wireStates(this);
917
918
  loadRemote(this, "items");
918
919
  if (renderStates(this, "toc")) return;
package/dist/wc/ui.mjs CHANGED
@@ -28,6 +28,8 @@ class ContourAvatar extends ContourBase {
28
28
  img.className = "c-avatar__img";
29
29
  img.src = src;
30
30
  img.alt = name || "";
31
+ img.loading = "lazy";
32
+ img.decoding = "async";
31
33
  this.appendChild(img);
32
34
  } else if (name) {
33
35
  const initials = name.split(" ").map((w) => w[0]).join("").toUpperCase().slice(0, 2);
@@ -1114,7 +1116,7 @@ class ContourStylePanel extends ContourBase {
1114
1116
  body.appendChild(list);
1115
1117
  }
1116
1118
  // Apply/Revert buttons
1117
- const actions = document.createElement("div"); actions.className = "c-style-panel__actions";
1119
+ const actions = document.createElement("div"); actions.className = "c-style-panel__actions c-btn-group";
1118
1120
  const applyBtn = document.createElement("button"); applyBtn.type = "button"; applyBtn.className = "c-btn c-btn--primary"; applyBtn.textContent = "Apply";
1119
1121
  const revertBtn = document.createElement("button"); revertBtn.type = "button"; revertBtn.className = "c-btn"; revertBtn.textContent = "Revert";
1120
1122
  actions.appendChild(applyBtn); actions.appendChild(revertBtn);
@@ -2189,6 +2191,8 @@ class ContourFileUpload extends ContourBase {
2189
2191
  const img = document.createElement("img");
2190
2192
  img.className = "c-file-upload__preview-thumb";
2191
2193
  img.alt = f.name;
2194
+ img.loading = "lazy";
2195
+ img.decoding = "async";
2192
2196
  try { img.src = URL.createObjectURL(f); } catch (e) {}
2193
2197
  item.appendChild(img);
2194
2198
  } else {
@@ -2218,6 +2222,7 @@ class ContourNotificationCenter extends ContourBase {
2218
2222
  static get properties() { return { count: { attribute: "count" }, items: { attribute: "items" }, color: { attribute: "color" } }; }
2219
2223
  render() {
2220
2224
  this.classList.add("c-notification-center");
2225
+ this.setAttribute("role", "list");
2221
2226
  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; });
2222
2227
  const color = this.getAttribute("color");
2223
2228
  const bullet = btn.querySelector(".c-notification-center__bullet");
@@ -2321,7 +2326,7 @@ class ContourStepper extends ContourBase {
2321
2326
  li.textContent = typeof s === "string" ? s : (s.title || s.label || "");
2322
2327
  list.appendChild(li);
2323
2328
  });
2324
- const nav = this.ensure(".c-stepper__nav", () => { const el = document.createElement("div"); el.className = "c-stepper__nav"; return el; });
2329
+ const nav = this.ensure(".c-stepper__nav", () => { const el = document.createElement("div"); el.className = "c-stepper__nav c-btn-group"; return el; });
2325
2330
  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; });
2326
2331
  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; });
2327
2332
  if (!nav.contains(prev)) nav.appendChild(prev);
@@ -2719,7 +2724,7 @@ class ContourTour extends ContourBase {
2719
2724
  const step = parsed[current] || {};
2720
2725
  const tip = this.ensure(".c-tour__tip", () => { const el = document.createElement("div"); el.className = "c-tour__tip"; return el; });
2721
2726
  tip.textContent = typeof step === "string" ? step : (step.text || step.title || "");
2722
- const nav = this.ensure(".c-tour__nav", () => { const el = document.createElement("div"); el.className = "c-tour__nav"; return el; });
2727
+ const nav = this.ensure(".c-tour__nav", () => { const el = document.createElement("div"); el.className = "c-tour__nav c-btn-group"; return el; });
2723
2728
  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; });
2724
2729
  if (!nav.contains(next)) nav.appendChild(next);
2725
2730
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contour-ds",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "A token-driven design system for spatial interfaces",
5
5
  "license": "MIT",
6
6
  "type": "module",