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.
Files changed (64) hide show
  1. package/README.md +25 -3
  2. package/dist/build-manifest.json +79 -79
  3. package/dist/contour-wc.esm.js +348 -38
  4. package/dist/contour-wc.esm.min.js +1 -1
  5. package/dist/contour-wc.js +348 -38
  6. package/dist/contour-wc.min.js +1 -1
  7. package/dist/contour.components.json +2280 -204
  8. package/dist/contour.css +1658 -857
  9. package/dist/contour.d.ts +10 -1
  10. package/dist/contour.esm.js +7 -0
  11. package/dist/contour.esm.min.js +1 -1
  12. package/dist/contour.js +7 -0
  13. package/dist/contour.min.css +1 -1
  14. package/dist/contour.min.js +1 -1
  15. package/dist/contour.tokens.json +10 -2
  16. package/dist/docs/actions.md +2 -2
  17. package/dist/docs/affordances.md +4 -2
  18. package/dist/docs/apireference.md +30 -0
  19. package/dist/docs/colour.md +2 -2
  20. package/dist/docs/componentindex.md +2 -2
  21. package/dist/docs/data.md +2 -2
  22. package/dist/docs/docs.md +2 -2
  23. package/dist/docs/feedback.md +2 -2
  24. package/dist/docs/field.md +2 -2
  25. package/dist/docs/forms.md +2 -2
  26. package/dist/docs/index.json +24 -11
  27. package/dist/docs/install.md +2 -2
  28. package/dist/docs/landing.md +2 -2
  29. package/dist/docs/mapengine.md +2 -2
  30. package/dist/docs/motion.md +2 -2
  31. package/dist/docs/navigation.md +2 -2
  32. package/dist/docs/overlays.md +2 -2
  33. package/dist/docs/overview.md +2 -2
  34. package/dist/docs/patterns.md +2 -2
  35. package/dist/docs/playground.md +2 -2
  36. package/dist/docs/principles.md +2 -2
  37. package/dist/docs/recipes.md +2 -2
  38. package/dist/docs/space.md +2 -2
  39. package/dist/docs/status.md +2 -2
  40. package/dist/docs/surfaces.md +2 -2
  41. package/dist/docs/theming.md +2 -2
  42. package/dist/docs/type.md +2 -2
  43. package/dist/docs/webcomponents.md +3 -7
  44. package/dist/registry/items/contour-core.json +2 -2
  45. package/dist/registry/items/contour-data.json +2 -2
  46. package/dist/registry/items/contour-docs.json +2 -2
  47. package/dist/registry/items/contour-landing.json +2 -2
  48. package/dist/registry/registry.json +8 -8
  49. package/dist/surfaces/contour-core.min.css +1 -1
  50. package/dist/surfaces/contour-data.min.css +1 -1
  51. package/dist/surfaces/contour-docs.min.css +1 -1
  52. package/dist/surfaces/contour-landing.min.css +1 -1
  53. package/dist/wc/content.mjs +1 -0
  54. package/dist/wc/core.mjs +33 -3
  55. package/dist/wc/data.mjs +96 -21
  56. package/dist/wc/docs.mjs +117 -0
  57. package/dist/wc/forms.mjs +6 -2
  58. package/dist/wc/index.mjs +25 -1
  59. package/dist/wc/interaction.mjs +3 -1
  60. package/dist/wc/layout.mjs +2 -2
  61. package/dist/wc/map.mjs +21 -0
  62. package/dist/wc/navigation.mjs +2 -1
  63. package/dist/wc/ui.mjs +67 -8
  64. package/package.json +1 -1
@@ -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;
@@ -1032,7 +1033,7 @@ class ContourFilterBar extends ContourBase {
1032
1033
  if (modesAttr) { try { modes = JSON.parse(modesAttr); } catch (e) { modes = modesAttr.split(",").map((s) => s.trim()); } }
1033
1034
  if (modes || this.hasAttribute("mode")) {
1034
1035
  let bar = this.querySelector(".c-filter-bar__modes");
1035
- if (!bar) { bar = document.createElement("div"); bar.className = "c-filter-bar__modes"; bar.setAttribute("role", "toolbar"); this.appendChild(bar); }
1036
+ 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); }
1036
1037
  bar.innerHTML = "";
1037
1038
  const current = this.getAttribute("mode");
1038
1039
  const list = Array.isArray(modes) ? modes : ["draw", "erase", "select"];
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);
@@ -1092,7 +1094,9 @@ class ContourStylePanel extends ContourBase {
1092
1094
  const breaksWrap = document.createElement("div"); breaksWrap.className = "c-style-panel__breaks";
1093
1095
  breaksArr.forEach((b, i) => {
1094
1096
  const br = document.createElement("div"); br.className = "break";
1095
- br.textContent = String(b);
1097
+ const span = document.createElement("span"); span.textContent = String(b); br.appendChild(span);
1098
+ 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);
1099
+ br.appendChild(inp);
1096
1100
  breaksWrap.appendChild(br);
1097
1101
  });
1098
1102
  body.appendChild(breaksWrap);
@@ -1112,7 +1116,7 @@ class ContourStylePanel extends ContourBase {
1112
1116
  body.appendChild(list);
1113
1117
  }
1114
1118
  // Apply/Revert buttons
1115
- 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";
1116
1120
  const applyBtn = document.createElement("button"); applyBtn.type = "button"; applyBtn.className = "c-btn c-btn--primary"; applyBtn.textContent = "Apply";
1117
1121
  const revertBtn = document.createElement("button"); revertBtn.type = "button"; revertBtn.className = "c-btn"; revertBtn.textContent = "Revert";
1118
1122
  actions.appendChild(applyBtn); actions.appendChild(revertBtn);
@@ -1267,7 +1271,7 @@ class ContourAvatarGroup extends ContourBase {
1267
1271
  av.className = "c-avatar";
1268
1272
  const name = typeof it === "string" ? it : (it.name || it.label || "");
1269
1273
  av.textContent = name.slice(0, 2).toUpperCase();
1270
- if (typeof it === "object" && it.color) av.style.background = it.color;
1274
+ if (typeof it === "object" && it.color) { av.style.background = it.color; av.dataset.color = it.color; }
1271
1275
  this.appendChild(av);
1272
1276
  });
1273
1277
  if (parsed.length > max) {
@@ -1412,6 +1416,7 @@ class ContourPaletteEditor extends ContourBase {
1412
1416
  sw.className = "c-palette-editor__swatch c-swatch";
1413
1417
  sw.type = "button";
1414
1418
  sw.style.background = typeof c === "string" ? c : (c.color || c.value || "");
1419
+ sw.dataset.color = typeof c === "string" ? c : (c.color || c.value || "");
1415
1420
  sw.setAttribute("aria-label", typeof c === "string" ? c : (c.name || c.label || "color"));
1416
1421
  this.appendChild(sw);
1417
1422
  });
@@ -1424,7 +1429,7 @@ class ContourPaletteEditor extends ContourBase {
1424
1429
  this.addEventListener("click", (e) => {
1425
1430
  const sw = e.target && e.target.closest ? e.target.closest(".c-palette-editor__swatch") : null;
1426
1431
  if (sw && this.contains(sw)) {
1427
- this.dispatchEvent(new CustomEvent("contour:change", { bubbles: true, composed: true, detail: { color: sw.style.background } }));
1432
+ this.dispatchEvent(new CustomEvent("contour:change", { bubbles: true, composed: true, detail: { color: (sw.dataset && sw.dataset.color) || sw.style.background } }));
1428
1433
  }
1429
1434
  });
1430
1435
  this.addEventListener("keydown", (e) => {
@@ -1860,8 +1865,8 @@ class ContourColorPicker extends ContourBase {
1860
1865
  btn.type = "button";
1861
1866
  btn.className = "c-color-picker__preset";
1862
1867
  btn.style.background = c;
1863
- btn.setAttribute("aria-label", "Preset " + c);
1864
1868
  btn.dataset.color = c;
1869
+ btn.setAttribute("aria-label", "Preset " + c);
1865
1870
  wrap.appendChild(btn);
1866
1871
  });
1867
1872
  this.appendChild(wrap);
@@ -2186,6 +2191,8 @@ class ContourFileUpload extends ContourBase {
2186
2191
  const img = document.createElement("img");
2187
2192
  img.className = "c-file-upload__preview-thumb";
2188
2193
  img.alt = f.name;
2194
+ img.loading = "lazy";
2195
+ img.decoding = "async";
2189
2196
  try { img.src = URL.createObjectURL(f); } catch (e) {}
2190
2197
  item.appendChild(img);
2191
2198
  } else {
@@ -2215,10 +2222,11 @@ class ContourNotificationCenter extends ContourBase {
2215
2222
  static get properties() { return { count: { attribute: "count" }, items: { attribute: "items" }, color: { attribute: "color" } }; }
2216
2223
  render() {
2217
2224
  this.classList.add("c-notification-center");
2225
+ this.setAttribute("role", "list");
2218
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; });
2219
2227
  const color = this.getAttribute("color");
2220
2228
  const bullet = btn.querySelector(".c-notification-center__bullet");
2221
- if (bullet && color) bullet.style.background = color;
2229
+ if (bullet && color) { bullet.style.background = color; bullet.dataset.color = color; }
2222
2230
  const count = this.getAttribute("count");
2223
2231
  let badge = btn.querySelector(".c-notification-center__badge");
2224
2232
  if (count && Number(count) > 0) {
@@ -2318,7 +2326,7 @@ class ContourStepper extends ContourBase {
2318
2326
  li.textContent = typeof s === "string" ? s : (s.title || s.label || "");
2319
2327
  list.appendChild(li);
2320
2328
  });
2321
- 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; });
2322
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; });
2323
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; });
2324
2332
  if (!nav.contains(prev)) nav.appendChild(prev);
@@ -2716,7 +2724,7 @@ class ContourTour extends ContourBase {
2716
2724
  const step = parsed[current] || {};
2717
2725
  const tip = this.ensure(".c-tour__tip", () => { const el = document.createElement("div"); el.className = "c-tour__tip"; return el; });
2718
2726
  tip.textContent = typeof step === "string" ? step : (step.text || step.title || "");
2719
- 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; });
2720
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; });
2721
2729
  if (!nav.contains(next)) nav.appendChild(next);
2722
2730
  }
@@ -3233,6 +3241,7 @@ class ContourDataGrid extends ContourBase {
3233
3241
  td.setAttribute("role", "gridcell");
3234
3242
  td.setAttribute("tabindex", "0");
3235
3243
  td.textContent = r && r[key] != null ? r[key] : "";
3244
+ if (!String(td.textContent).trim()) td.setAttribute("aria-label", "Empty");
3236
3245
  tr.appendChild(td);
3237
3246
  });
3238
3247
  tbody.appendChild(tr);
@@ -3282,6 +3291,7 @@ class ContourDataGrid extends ContourBase {
3282
3291
  td.setAttribute("role", "gridcell");
3283
3292
  td.setAttribute("tabindex", "0");
3284
3293
  td.textContent = r && r[key] != null ? r[key] : "";
3294
+ if (!String(td.textContent).trim()) td.setAttribute("aria-label", "Empty");
3285
3295
  tr.appendChild(td);
3286
3296
  });
3287
3297
  tbody.appendChild(tr);
@@ -3499,3 +3509,52 @@ class ContourTreeGrid extends ContourBase {
3499
3509
  }
3500
3510
  }
3501
3511
  define("contour-tree-grid", ContourTreeGrid);
3512
+
3513
+ class ContourPullToRefresh extends ContourBase {
3514
+ static get observed() { return ["threshold"]; }
3515
+ static get properties() { return { threshold: { attribute: "threshold" } }; }
3516
+ render() {
3517
+ this.classList.add("c-pull-to-refresh");
3518
+ const ind = this.ensure(".c-pull-to-refresh__indicator", () => {
3519
+ const e = document.createElement("div");
3520
+ e.className = "c-pull-to-refresh__indicator";
3521
+ e.textContent = "Pull to refresh";
3522
+ return e;
3523
+ });
3524
+ if (ind.parentNode !== this) this.prepend(ind);
3525
+ }
3526
+ enhance() {
3527
+ if (this._wiredPullToRefresh) return;
3528
+ this._wiredPullToRefresh = true;
3529
+ let startY = 0;
3530
+ let pulling = false;
3531
+ this.addEventListener("touchstart", (e) => {
3532
+ if (this.scrollTop > 0) return;
3533
+ const t = e.touches && e.touches[0];
3534
+ if (t) { startY = t.clientY; pulling = true; }
3535
+ }, { passive: true });
3536
+ this.addEventListener("touchmove", (e) => {
3537
+ if (!pulling) return;
3538
+ const t = e.touches && e.touches[0];
3539
+ if (!t) return;
3540
+ const dy = t.clientY - startY;
3541
+ if (dy > 0 && dy < 120) {
3542
+ this.style.setProperty("--ptr-offset", dy + "px");
3543
+ }
3544
+ }, { passive: true });
3545
+ this.addEventListener("touchend", (e) => {
3546
+ if (!pulling) return;
3547
+ pulling = false;
3548
+ const t = e.changedTouches && e.changedTouches[0];
3549
+ const dy = t ? t.clientY - startY : 0;
3550
+ const thr = Number(this.getAttribute("threshold")) || 60;
3551
+ if (dy >= thr) {
3552
+ this.classList.add("is-refreshing");
3553
+ this.dispatchEvent(new CustomEvent("contour:refresh", { bubbles: true, composed: true }));
3554
+ setTimeout(() => this.classList.remove("is-refreshing"), 800);
3555
+ }
3556
+ this.style.removeProperty("--ptr-offset");
3557
+ }, { passive: true });
3558
+ }
3559
+ }
3560
+ define("contour-pull-to-refresh", ContourPullToRefresh);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contour-ds",
3
- "version": "1.5.0",
3
+ "version": "1.7.2",
4
4
  "description": "A token-driven design system for spatial interfaces",
5
5
  "license": "MIT",
6
6
  "type": "module",