contour-ds 1.12.0 → 1.13.0

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 (93) hide show
  1. package/dist/build-manifest.json +80 -80
  2. package/dist/contour-wc-content.esm.js +8 -1
  3. package/dist/contour-wc-content.esm.min.js +1 -1
  4. package/dist/contour-wc-core.esm.js +15 -8
  5. package/dist/contour-wc-core.esm.min.js +1 -1
  6. package/dist/contour-wc-dashboard.esm.js +279 -20
  7. package/dist/contour-wc-dashboard.esm.min.js +1 -1
  8. package/dist/contour-wc-data.esm.js +279 -20
  9. package/dist/contour-wc-data.esm.min.js +1 -1
  10. package/dist/contour-wc-docs.esm.js +4 -0
  11. package/dist/contour-wc-feedback.esm.js +59 -7
  12. package/dist/contour-wc-feedback.esm.min.js +1 -1
  13. package/dist/contour-wc-forms.esm.js +20 -2
  14. package/dist/contour-wc-forms.esm.min.js +1 -1
  15. package/dist/contour-wc-interaction.esm.js +4 -0
  16. package/dist/contour-wc-layout.esm.js +4 -0
  17. package/dist/contour-wc-map.esm.js +4 -0
  18. package/dist/contour-wc-misc.esm.js +4 -0
  19. package/dist/contour-wc-navigation.esm.js +24 -14
  20. package/dist/contour-wc-navigation.esm.min.js +1 -1
  21. package/dist/contour-wc-ui.esm.js +290 -13
  22. package/dist/contour-wc-ui.esm.min.js +1 -1
  23. package/dist/contour-wc.esm.js +675 -65
  24. package/dist/contour-wc.esm.min.js +1 -1
  25. package/dist/contour-wc.js +675 -65
  26. package/dist/contour-wc.min.js +1 -1
  27. package/dist/contour.code-snippets +1 -1
  28. package/dist/contour.components.json +175 -16
  29. package/dist/contour.css +160 -1
  30. package/dist/contour.d.ts +6 -4
  31. package/dist/contour.html-data.json +68 -2
  32. package/dist/contour.min.css +1 -1
  33. package/dist/contour.react.d.ts +2 -2
  34. package/dist/contour.single.html +1 -1
  35. package/dist/contour.single.min.css +1 -1
  36. package/dist/contour.vue.d.ts +2 -2
  37. package/dist/contour.web-types.json +68 -3
  38. package/dist/custom-elements.json +265 -2
  39. package/dist/docs/actions.md +1 -1
  40. package/dist/docs/affordances.md +1 -1
  41. package/dist/docs/apireference.md +1 -1
  42. package/dist/docs/colour.md +1 -1
  43. package/dist/docs/componentindex.md +1 -1
  44. package/dist/docs/data.md +1 -1
  45. package/dist/docs/docs.md +1 -1
  46. package/dist/docs/feedback.md +1 -1
  47. package/dist/docs/field.md +1 -1
  48. package/dist/docs/forms.md +1 -1
  49. package/dist/docs/index.json +2 -2
  50. package/dist/docs/install.md +1 -1
  51. package/dist/docs/landing.md +1 -1
  52. package/dist/docs/mapengine.md +1 -1
  53. package/dist/docs/motion.md +1 -1
  54. package/dist/docs/navigation.md +1 -1
  55. package/dist/docs/overlays.md +1 -1
  56. package/dist/docs/overview.md +1 -1
  57. package/dist/docs/patterns.md +1 -1
  58. package/dist/docs/playground.md +1 -1
  59. package/dist/docs/principles.md +1 -1
  60. package/dist/docs/recipes.md +1 -1
  61. package/dist/docs/space.md +1 -1
  62. package/dist/docs/status.md +1 -1
  63. package/dist/docs/surfaces.md +1 -1
  64. package/dist/docs/theming.md +1 -1
  65. package/dist/docs/type.md +1 -1
  66. package/dist/docs/webcomponents.md +1 -1
  67. package/dist/registry/items/contour-core.json +2 -2
  68. package/dist/registry/items/contour-data.json +2 -2
  69. package/dist/registry/items/contour-docs.json +2 -2
  70. package/dist/registry/items/contour-landing.json +2 -2
  71. package/dist/registry/registry.json +8 -8
  72. package/dist/surfaces/contour-core.min.css +1 -1
  73. package/dist/surfaces/contour-data.min.css +1 -1
  74. package/dist/surfaces/contour-docs.min.css +1 -1
  75. package/dist/surfaces/contour-landing.min.css +1 -1
  76. package/dist/wc/behaviours.mjs +13 -7
  77. package/dist/wc/content.mjs +4 -1
  78. package/dist/wc/core.mjs +1 -0
  79. package/dist/wc/data-chart.mjs +147 -12
  80. package/dist/wc/data-export.mjs +43 -5
  81. package/dist/wc/data-series.mjs +74 -0
  82. package/dist/wc/data-table.mjs +13 -5
  83. package/dist/wc/feedback.mjs +55 -7
  84. package/dist/wc/forms-input.mjs +16 -2
  85. package/dist/wc/index.mjs +1 -1
  86. package/dist/wc/navigation-menu.mjs +20 -14
  87. package/dist/wc/shadow.mjs +4 -0
  88. package/dist/wc/ui-atoms.mjs +134 -3
  89. package/dist/wc/ui-data.mjs +67 -0
  90. package/dist/wc/ui-feedback.mjs +8 -1
  91. package/dist/wc/ui-overlays.mjs +77 -9
  92. package/integrations/libreship/contract.json +9 -2
  93. package/package.json +1 -1
@@ -16,8 +16,8 @@ import { parseArrayAttr, renderEmpty } from './states.mjs';
16
16
  * re-render (see core.mjs), so authored children survive an attribute change.
17
17
  */
18
18
  class ContourMapPopup extends ContourBase {
19
- static get observed() { return ["title", "content", "cluster-count", "cluster-expanded", "cluster-items", "anchor"]; }
20
- static get properties() { return { title: { attribute: "title" }, content: { attribute: "content" }, "cluster-count": { attribute: "cluster-count", type: Number }, "cluster-expanded": { attribute: "cluster-expanded", type: Boolean }, "cluster-items": { attribute: "cluster-items" } }; }
19
+ static get observed() { return ["title", "content", "cluster-count", "cluster-expanded", "cluster-items", "anchor", "closable", "anchor-x", "anchor-y"]; }
20
+ static get properties() { return { title: { attribute: "title" }, content: { attribute: "content" }, "cluster-count": { attribute: "cluster-count", type: Number }, "cluster-expanded": { attribute: "cluster-expanded", type: Boolean }, "cluster-items": { attribute: "cluster-items" }, closable: { attribute: "closable", type: Boolean } }; }
21
21
  render() {
22
22
  this.classList.add("c-map-popup");
23
23
  this.setAttribute("role", "dialog");
@@ -30,7 +30,7 @@ class ContourMapPopup extends ContourBase {
30
30
  }
31
31
  // Default content area: authored children moved to .c-map-popup__body; content attr fills when no children.
32
32
  const authored = Array.from(this.childNodes).filter((n) => {
33
- if (n.nodeType === 1 && n.classList && (n.classList.contains("c-map-popup__title") || n.classList.contains("c-map-popup__body"))) return false;
33
+ if (n.nodeType === 1 && n.classList && (n.classList.contains("c-map-popup__title") || n.classList.contains("c-map-popup__body") || n.classList.contains("c-map-popup__close"))) return false;
34
34
  if (n.nodeType === 3 && !n.textContent.trim()) return false;
35
35
  return true;
36
36
  });
@@ -72,23 +72,68 @@ class ContourMapPopup extends ContourBase {
72
72
  list.remove();
73
73
  }
74
74
  if (!this.hasAttribute("aria-label")) this.setAttribute("aria-label", title || "Map popup");
75
- // Re-resolve anchor on every render so anchor attr changes re-point popup.
75
+ // U-7: opt-in close button. The click/escape handler already exists; this
76
+ // renders the control it looks for. Excluded from authored children above so
77
+ // it is never folded into the body.
78
+ if (flagOn(this, "closable")) {
79
+ const closeBtn = this.ensure(".c-map-popup__close", () => {
80
+ const b = document.createElement("button");
81
+ b.className = "c-btn c-btn--icon c-btn--ghost c-map-popup__close";
82
+ b.type = "button";
83
+ b.setAttribute("aria-label", labelText(this, "close", "Close"));
84
+ setHTML(b, '<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-x" /></svg>');
85
+ return b;
86
+ });
87
+ if (this.firstChild !== closeBtn) this.prepend(closeBtn);
88
+ } else {
89
+ const closeBtn = this.querySelector(".c-map-popup__close");
90
+ if (closeBtn) closeBtn.remove();
91
+ }
92
+ // U-7: two anchor modes. A CSS-anchor (`anchor` → a target element) is the
93
+ // default; a pixel/XY mode (`anchor-x`/`anchor-y`) pins the popup with
94
+ // `position: fixed` at viewport coordinates, for a map click that has a
95
+ // screen point but no anchor element. XY wins when both are supplied.
76
96
  const anchorSel = this.getAttribute("anchor");
97
+ const axRaw = this.getAttribute("anchor-x");
98
+ const ayRaw = this.getAttribute("anchor-y");
99
+ const ax = axRaw != null && axRaw !== "" ? Number(axRaw) : NaN;
100
+ const ay = ayRaw != null && ayRaw !== "" ? Number(ayRaw) : NaN;
101
+ const xyMode = Number.isFinite(ax) && Number.isFinite(ay);
77
102
  let anchorEl = null;
78
- if (anchorSel) {
103
+ if (!xyMode && anchorSel) {
79
104
  anchorEl = anchorSel.startsWith("#") ? document.getElementById(anchorSel.slice(1)) : document.querySelector(anchorSel);
80
105
  }
81
106
  this._mapPopupAnchorEl = anchorEl;
107
+ this._mapPopupXY = xyMode ? { x: ax, y: ay } : null;
82
108
  const anchorName = "--map-popup-" + this.id;
83
- if (anchorEl) {
84
- anchorEl.style.setProperty("anchor-name", anchorName);
85
- this.style.setProperty("position-anchor", anchorName);
109
+ if (xyMode) {
110
+ // Pixel anchor: fixed positioning at the viewport point, no CSS anchor.
111
+ this.style.removeProperty("position-anchor");
112
+ this.style.setProperty("position", "fixed");
113
+ this.style.setProperty("left", ax + "px");
114
+ this.style.setProperty("top", ay + "px");
115
+ } else {
116
+ this.style.removeProperty("left");
117
+ this.style.removeProperty("top");
118
+ if (anchorEl) {
119
+ anchorEl.style.setProperty("anchor-name", anchorName);
120
+ this.style.setProperty("position-anchor", anchorName);
121
+ } else {
122
+ this.style.removeProperty("position-anchor");
123
+ }
86
124
  }
87
125
  }
88
126
  enhance() {
89
127
  if (this._wiredMapPopup) return;
90
128
  this._wiredMapPopup = true;
91
- const close = () => { try { this.hidePopover(); } catch (e) {} this.classList.remove("is-open"); this.dispatchEvent(new CustomEvent("contour:close", { bubbles: true, composed: true })); };
129
+ const close = () => {
130
+ try { this.hidePopover(); } catch (e) {}
131
+ this.classList.remove("is-open");
132
+ this.dispatchEvent(new CustomEvent("contour:close", { bubbles: true, composed: true }));
133
+ // U-7: restore focus to whatever opened the popup (the map, a marker).
134
+ const last = this._mapPopupLastFocus;
135
+ if (last && typeof last.focus === "function") { try { last.focus(); } catch (e) {} }
136
+ };
92
137
  const keyHandler = (e) => { if (e.key === "Escape" && (this.classList.contains("is-open") || this.matches(":popover-open"))) { e.preventDefault(); close(); } };
93
138
  document.addEventListener("keydown", keyHandler);
94
139
  onDispose(this, () => document.removeEventListener("keydown", keyHandler));
@@ -105,6 +150,7 @@ class ContourMapPopup extends ContourBase {
105
150
  // Anchor + collision handling.
106
151
  const anchorName = "--map-popup-" + this.id;
107
152
  const applyAnchor = () => {
153
+ if (this._mapPopupXY) return; // U-7: pixel anchor mode, no CSS anchor.
108
154
  const anchorEl = this._mapPopupAnchorEl;
109
155
  if (anchorEl) {
110
156
  anchorEl.style.setProperty("anchor-name", anchorName);
@@ -130,6 +176,7 @@ class ContourMapPopup extends ContourBase {
130
176
  };
131
177
  this.addEventListener("toggle", (e) => {
132
178
  if (e.newState === "open") {
179
+ this._mapPopupLastFocus = document.activeElement; // U-7: remember opener.
133
180
  requestAnimationFrame(() => { applyAnchor(); flipIfNeeded(); });
134
181
  }
135
182
  });
@@ -901,6 +948,15 @@ class ContourPopover extends ContourBase {
901
948
  * unwraps `.c-hover-card__body` before dropping generated nodes on re-render (see
902
949
  * core.mjs), so authored children survive an attribute change.
903
950
  */
951
+ /**
952
+ * Hover card: a popover card shown while its anchor is hovered or focused.
953
+ *
954
+ * Contract (U-17): `title` is the heading, `content` the body (authored children
955
+ * win over `content`), `anchor` a selector for the trigger element. Open state:
956
+ * the host gains `is-open` / `:popover-open` on pointer-enter or focus and
957
+ * closes on pointer-leave, blur, or Escape. Focus moves into the card only when
958
+ * it holds focusable content, and returns to the anchor on close.
959
+ */
904
960
  class ContourHoverCard extends ContourBase {
905
961
  static get observed() { return ["title", "content", "anchor"]; }
906
962
  static get properties() { return { title: { attribute: "title" }, content: { attribute: "content" }, anchor: { attribute: "anchor" } }; }
@@ -1035,6 +1091,18 @@ class ContourHoverCard extends ContourBase {
1035
1091
  * Context Menu: web component wrapper.
1036
1092
  * Attributes: `items`.
1037
1093
  */
1094
+ /**
1095
+ * Context menu: a native popover menu opened at a pointer position.
1096
+ *
1097
+ * Contract (U-17): `items` is a JSON array of labels or `{ label }` objects;
1098
+ * `trigger` is a selector for the element whose right-click (the `contextmenu`
1099
+ * event) opens the menu — a right-click anywhere else is left to the platform.
1100
+ * Open state: the host gains `is-open` / `:popover-open`, is positioned
1101
+ * `fixed` at the pointer (clamped to the viewport), and focuses the first
1102
+ * enabled item. `contour:select` fires with `{ label }` on item activation;
1103
+ * Escape closes and returns focus to the opener (`document.activeElement` at
1104
+ * open time). Without `trigger`, right-click the host element itself to open.
1105
+ */
1038
1106
  class ContourContextMenu extends ContourBase {
1039
1107
  static get observed() { return ["items", "trigger"]; }
1040
1108
  static get properties() { return { items: { attribute: "items" }, trigger: { attribute: "trigger" } }; }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
3
  "generatedFrom": "contour-ds",
4
- "version": "1.12.0",
5
- "compatibility": ">=1.12.0 <2.0.0",
4
+ "version": "1.13.0",
5
+ "compatibility": ">=1.13.0 <2.0.0",
6
6
  "components": [
7
7
  "contour-accordion",
8
8
  "contour-activity",
@@ -690,6 +690,13 @@
690
690
  "value",
691
691
  "label"
692
692
  ],
693
+ "contour:elevation-select": [
694
+ "index",
695
+ "distance",
696
+ "elevation",
697
+ "series",
698
+ "unit"
699
+ ],
693
700
  "contour:empty-action": [
694
701
  "state"
695
702
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contour-ds",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "A token-driven design system for spatial interfaces",
5
5
  "license": "MIT",
6
6
  "type": "module",