contour-ds 1.7.2 → 1.9.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 (150) hide show
  1. package/README.md +244 -326
  2. package/dist/agent-cookbook.json +960 -0
  3. package/dist/agent-examples.json +65 -0
  4. package/dist/agent-map-wiring.json +152 -0
  5. package/dist/agent-rules.json +16 -0
  6. package/dist/build-manifest.json +344 -126
  7. package/dist/contour-wc-content.esm.js +1939 -0
  8. package/dist/contour-wc-content.esm.min.js +1 -0
  9. package/dist/contour-wc-core.esm.js +3724 -0
  10. package/dist/contour-wc-core.esm.min.js +1 -0
  11. package/dist/contour-wc-dashboard.esm.js +6986 -0
  12. package/dist/contour-wc-dashboard.esm.min.js +1 -0
  13. package/dist/contour-wc-data.esm.js +6572 -0
  14. package/dist/contour-wc-data.esm.min.js +1 -0
  15. package/dist/contour-wc-docs.esm.js +976 -0
  16. package/dist/contour-wc-docs.esm.min.js +1 -0
  17. package/dist/contour-wc-feedback.esm.js +1742 -0
  18. package/dist/contour-wc-feedback.esm.min.js +1 -0
  19. package/dist/contour-wc-forms.esm.js +2437 -0
  20. package/dist/contour-wc-forms.esm.min.js +1 -0
  21. package/dist/contour-wc-interaction.esm.js +1343 -0
  22. package/dist/contour-wc-interaction.esm.min.js +1 -0
  23. package/dist/contour-wc-layout.esm.js +845 -0
  24. package/dist/contour-wc-layout.esm.min.js +1 -0
  25. package/dist/contour-wc-map.esm.js +2411 -0
  26. package/dist/contour-wc-map.esm.min.js +1 -0
  27. package/dist/contour-wc-misc.esm.js +945 -0
  28. package/dist/contour-wc-misc.esm.min.js +1 -0
  29. package/dist/contour-wc-navigation.esm.js +2842 -0
  30. package/dist/contour-wc-navigation.esm.min.js +1 -0
  31. package/dist/contour-wc-ui.esm.js +6519 -0
  32. package/dist/contour-wc-ui.esm.min.js +1 -0
  33. package/dist/contour-wc.esm.js +14435 -5723
  34. package/dist/contour-wc.esm.min.js +1 -1
  35. package/dist/contour-wc.js +14436 -5725
  36. package/dist/contour-wc.min.js +1 -1
  37. package/dist/contour.a11y.json +402 -0
  38. package/dist/contour.code-snippets +4534 -0
  39. package/dist/contour.components.json +4870 -1222
  40. package/dist/contour.css +6672 -4711
  41. package/dist/contour.d.ts +753 -1085
  42. package/dist/contour.esm.js +440 -18
  43. package/dist/contour.esm.min.js +1 -1
  44. package/dist/contour.html-data.json +11343 -0
  45. package/dist/contour.js +440 -18
  46. package/dist/contour.min.css +1 -1
  47. package/dist/contour.min.js +1 -1
  48. package/dist/contour.react.d.ts +422 -0
  49. package/dist/contour.single.html +17 -0
  50. package/dist/contour.single.min.css +1 -0
  51. package/dist/contour.themes.json +56 -12
  52. package/dist/contour.tokens.json +1318 -1053
  53. package/dist/contour.vue.d.ts +420 -0
  54. package/dist/contour.web-types.json +11703 -0
  55. package/dist/custom-elements.json +36120 -0
  56. package/dist/docs/actions.md +16 -6
  57. package/dist/docs/affordances.md +21 -85
  58. package/dist/docs/apireference.md +9 -5
  59. package/dist/docs/colour.md +10 -4
  60. package/dist/docs/componentindex.md +9 -22
  61. package/dist/docs/data.md +39 -58
  62. package/dist/docs/docs.md +12 -7
  63. package/dist/docs/feedback.md +30 -12
  64. package/dist/docs/field.md +28 -13
  65. package/dist/docs/forms.md +35 -19
  66. package/dist/docs/index.json +70 -61
  67. package/dist/docs/install.md +12 -7
  68. package/dist/docs/landing.md +7 -4
  69. package/dist/docs/mapengine.md +30 -8
  70. package/dist/docs/motion.md +12 -6
  71. package/dist/docs/navigation.md +31 -7
  72. package/dist/docs/overlays.md +32 -25
  73. package/dist/docs/overview.md +3 -2
  74. package/dist/docs/patterns.md +20 -10
  75. package/dist/docs/playground.md +11 -4
  76. package/dist/docs/principles.md +8 -6
  77. package/dist/docs/recipes.md +117 -13
  78. package/dist/docs/space.md +10 -6
  79. package/dist/docs/status.md +13 -14
  80. package/dist/docs/surfaces.md +17 -22
  81. package/dist/docs/theming.md +18 -32
  82. package/dist/docs/type.md +12 -5
  83. package/dist/docs/webcomponents.md +75 -33
  84. package/dist/hljs.css +1 -20
  85. package/dist/map-chrome.mapbox.css +68 -92
  86. package/dist/map-chrome.maplibre.css +68 -92
  87. package/dist/registry/items/contour-core.json +2 -2
  88. package/dist/registry/items/contour-data.json +2 -2
  89. package/dist/registry/items/contour-docs.json +2 -2
  90. package/dist/registry/items/contour-landing.json +2 -2
  91. package/dist/registry/registry.json +8 -8
  92. package/dist/surfaces/contour-core.min.css +1 -1
  93. package/dist/surfaces/contour-data.min.css +1 -1
  94. package/dist/surfaces/contour-docs.min.css +1 -1
  95. package/dist/surfaces/contour-landing.min.css +1 -1
  96. package/dist/svg/icons.svg +367 -0
  97. package/dist/wc/behaviours.mjs +222 -192
  98. package/dist/wc/content.mjs +486 -142
  99. package/dist/wc/core.mjs +917 -395
  100. package/dist/wc/dashboard.mjs +252 -25
  101. package/dist/wc/data-chart.mjs +1333 -0
  102. package/dist/wc/data-export.mjs +391 -0
  103. package/dist/wc/data-gauge.mjs +779 -0
  104. package/dist/wc/data-geo.mjs +696 -0
  105. package/dist/wc/data-glyphs.mjs +133 -0
  106. package/dist/wc/data-legend.mjs +431 -0
  107. package/dist/wc/data-readout.mjs +227 -0
  108. package/dist/wc/data-series.mjs +1004 -0
  109. package/dist/wc/data-table.mjs +751 -0
  110. package/dist/wc/data.mjs +15 -3707
  111. package/dist/wc/docs.mjs +113 -19
  112. package/dist/wc/feedback.mjs +320 -116
  113. package/dist/wc/forms-controls.mjs +635 -0
  114. package/dist/wc/forms-field.mjs +547 -0
  115. package/dist/wc/forms-groups.mjs +347 -0
  116. package/dist/wc/forms-input.mjs +292 -0
  117. package/dist/wc/forms.mjs +10 -1122
  118. package/dist/wc/glyph.mjs +204 -0
  119. package/dist/wc/index.mjs +16 -7
  120. package/dist/wc/interaction.mjs +322 -75
  121. package/dist/wc/layout.mjs +100 -29
  122. package/dist/wc/map.mjs +888 -285
  123. package/dist/wc/misc.mjs +137 -26
  124. package/dist/wc/navigation-menu.mjs +735 -0
  125. package/dist/wc/navigation-shell.mjs +495 -0
  126. package/dist/wc/navigation-tree.mjs +995 -0
  127. package/dist/wc/navigation.mjs +9 -1636
  128. package/dist/wc/registration.mjs +1 -8
  129. package/dist/wc/shadow.mjs +285 -113
  130. package/dist/wc/states.mjs +75 -78
  131. package/dist/wc/svg.mjs +209 -34
  132. package/dist/wc/ui-atoms.mjs +608 -0
  133. package/dist/wc/ui-data.mjs +1404 -0
  134. package/dist/wc/ui-feedback.mjs +419 -0
  135. package/dist/wc/ui-inputs.mjs +1570 -0
  136. package/dist/wc/ui-menus.mjs +307 -0
  137. package/dist/wc/ui-overlays.mjs +1605 -0
  138. package/integrations/README.md +25 -5
  139. package/integrations/ai/CLAUDE.md +6 -3
  140. package/integrations/ai/COPILOT.md +14 -0
  141. package/integrations/ai/GEMINI.md +14 -0
  142. package/integrations/ai/WINDSURF.md +14 -0
  143. package/integrations/ai/v0-prompt.md +13 -1
  144. package/integrations/frameworks/README.md +235 -0
  145. package/integrations/native/README.md +0 -3
  146. package/integrations/native/style-dictionary.config.json +1 -1
  147. package/integrations/tailwind/contour-theme.css +71 -13
  148. package/integrations/validate-markup.mjs +172 -0
  149. package/package.json +103 -39
  150. package/dist/wc/ui.mjs +0 -3560
@@ -0,0 +1,204 @@
1
+ /* CONTOUR — Glyph-scale canvas painting (zero DOM, zero dependencies) */
2
+ "use strict";
3
+
4
+ /** Clamp a value to [0, 1]. */
5
+ const unit = (v) => Math.max(0, Math.min(1, Number(v) || 0));
6
+
7
+ /** Quantise a 0–1 value to n buckets. */
8
+ const quantise = (v, n) => Math.round(unit(v) * n) / n;
9
+
10
+ /** Map a dominant-category index (0–4) to a resolved hex color. */
11
+ const categoryColor = (hue, fallback) => {
12
+ const ramp = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd"];
13
+ return ramp[Math.max(0, Math.min(4, Math.floor(Number(hue) || 0)))] || fallback;
14
+ };
15
+
16
+ /** Stroke width scaled to sprite size: 1 px at 24 px, 2 px at 32 px. */
17
+ const spriteStroke = (size) => Math.max(1, Math.round((Number(size) || 24) / 16));
18
+
19
+ /**
20
+ * Paint a glyph-scale donut onto a 2D canvas context.
21
+ *
22
+ * @param {CanvasRenderingContext2D} ctx
23
+ * @param {object} opts
24
+ * @param {number} [opts.size=24] fixed sprite size in px
25
+ * @param {number} [opts.value=0] fill fraction, 0–1
26
+ * @param {string} [opts.color='#1f77b4'] resolved hex (canvas cannot take var())
27
+ * @param {number} [opts.strokeWidth=1] scaled to sprite
28
+ * @param {string} [opts.bgColor='transparent']
29
+ * @returns {void}
30
+ */
31
+ export function paintDonutGlyph(ctx, {
32
+ size = 24,
33
+ value = 0,
34
+ color = "#1f77b4",
35
+ strokeWidth,
36
+ bgColor = "transparent",
37
+ } = {}) {
38
+ const s = Number(size) || 24;
39
+ const sw = strokeWidth != null ? Number(strokeWidth) : spriteStroke(s);
40
+ const v = unit(value);
41
+ const cx = s / 2;
42
+ const cy = s / 2;
43
+ const r = (s - sw) / 2;
44
+
45
+ if (bgColor && bgColor !== "transparent") {
46
+ ctx.fillStyle = bgColor;
47
+ ctx.fillRect(0, 0, s, s);
48
+ } else {
49
+ ctx.clearRect(0, 0, s, s);
50
+ }
51
+
52
+ // Donut track: full circle as a subtle background ring.
53
+ ctx.beginPath();
54
+ ctx.arc(cx, cy, r, 0, 2 * Math.PI);
55
+ ctx.lineWidth = sw;
56
+ ctx.strokeStyle = "rgba(0,0,0,0.12)";
57
+ ctx.stroke();
58
+
59
+ // Filled arc: value fraction of the ring, starting at 12 o'clock.
60
+ if (v > 0) {
61
+ ctx.beginPath();
62
+ ctx.arc(cx, cy, r, -Math.PI / 2, -Math.PI / 2 + v * 2 * Math.PI);
63
+ ctx.lineWidth = sw;
64
+ ctx.strokeStyle = color;
65
+ ctx.lineCap = "round";
66
+ ctx.stroke();
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Paint a glyph-scale sparkline onto a 2D canvas context.
72
+ *
73
+ * @param {CanvasRenderingContext2D} ctx
74
+ * @param {object} opts
75
+ * @param {number} [opts.size=24] fixed sprite size in px
76
+ * @param {number[]} [opts.values=[]] normalized 0–1 values
77
+ * @param {string} [opts.color='#1f77b4'] resolved hex
78
+ * @param {number} [opts.strokeWidth=1] scaled to sprite
79
+ * @param {string} [opts.bgColor='transparent']
80
+ * @returns {void}
81
+ */
82
+ export function paintSparklineGlyph(ctx, {
83
+ size = 24,
84
+ values = [],
85
+ color = "#1f77b4",
86
+ strokeWidth,
87
+ bgColor = "transparent",
88
+ } = {}) {
89
+ const s = Number(size) || 24;
90
+ const sw = strokeWidth != null ? Number(strokeWidth) : spriteStroke(s);
91
+ const pts = Array.isArray(values) ? values.filter((v) => Number.isFinite(v)) : [];
92
+ const n = pts.length;
93
+
94
+ if (bgColor && bgColor !== "transparent") {
95
+ ctx.fillStyle = bgColor;
96
+ ctx.fillRect(0, 0, s, s);
97
+ } else {
98
+ ctx.clearRect(0, 0, s, s);
99
+ }
100
+
101
+ if (n < 2) return;
102
+
103
+ const pad = sw + 1;
104
+ const w = s - pad * 2;
105
+ const h = s - pad * 2;
106
+
107
+ // Auto-scale: normalise values to 0–1 within the sprite.
108
+ const min = Math.min(...pts);
109
+ const max = Math.max(...pts);
110
+ const range = max - min || 1;
111
+ const scaleY = (v) => pad + h - ((v - min) / range) * h;
112
+
113
+ ctx.beginPath();
114
+ pts.forEach((v, i) => {
115
+ const x = pad + (i / (n - 1)) * w;
116
+ const y = scaleY(v);
117
+ if (i === 0) ctx.moveTo(x, y);
118
+ else ctx.lineTo(x, y);
119
+ });
120
+ ctx.lineWidth = sw;
121
+ ctx.strokeStyle = color;
122
+ ctx.lineCap = "round";
123
+ ctx.lineJoin = "round";
124
+ ctx.stroke();
125
+ }
126
+
127
+ /**
128
+ * Paint a purity ring (concentration/dominance encoding) onto a 2D canvas
129
+ * context. The filled arc represents dominance (max / total, quantised to
130
+ * 8 buckets) and the hue represents the dominant category.
131
+ *
132
+ * @param {CanvasRenderingContext2D} ctx
133
+ * @param {object} opts
134
+ * @param {number} [opts.size=32] sprite size in px
135
+ * @param {number} [opts.hue=0] dominant category index, 0–4
136
+ * @param {number} [opts.concentration=0] max / total, 0–1, quantised to 8 buckets
137
+ * @param {string} [opts.color] resolved hex for the hue (overrides ramp)
138
+ * @param {number} [opts.uncertainty=0] 0 = none, 1 = thin dash, 2 = thick dash
139
+ * @param {number} [opts.timeStep=0] temporal animation frame, 0–3
140
+ * @param {number} [opts.timeSteps=4] total frames
141
+ * @returns {void}
142
+ */
143
+ export function paintPurityRing(ctx, {
144
+ size = 32,
145
+ hue = 0,
146
+ concentration = 0,
147
+ color,
148
+ uncertainty = 0,
149
+ timeStep = 0,
150
+ timeSteps = 4,
151
+ } = {}) {
152
+ const s = Number(size) || 32;
153
+ const sw = spriteStroke(s);
154
+ const cx = s / 2;
155
+ const cy = s / 2;
156
+ const r = (s - sw * 2) / 2;
157
+ const cat = Math.max(0, Math.min(4, Math.floor(Number(hue) || 0)));
158
+ const ringColor = color || categoryColor(cat, "#1f77b4");
159
+ const conc = quantise(concentration, 8);
160
+
161
+ ctx.clearRect(0, 0, s, s);
162
+
163
+ // Track ring (full circle, subtle).
164
+ ctx.beginPath();
165
+ ctx.arc(cx, cy, r, 0, 2 * Math.PI);
166
+ ctx.lineWidth = sw;
167
+ ctx.strokeStyle = "rgba(0,0,0,0.12)";
168
+ ctx.stroke();
169
+
170
+ // Filled arc: concentration quantised to 8 buckets, starting at 12 o'clock.
171
+ if (conc > 0) {
172
+ ctx.beginPath();
173
+ ctx.arc(cx, cy, r, -Math.PI / 2, -Math.PI / 2 + conc * 2 * Math.PI);
174
+ ctx.lineWidth = sw;
175
+ ctx.strokeStyle = ringColor;
176
+ ctx.lineCap = "round";
177
+ ctx.stroke();
178
+ }
179
+
180
+ // Uncertainty ring: dashed outer ring, 0–2 levels.
181
+ if (uncertainty > 0) {
182
+ const ur = r + sw;
183
+ const dash = uncertainty === 1 ? [sw, sw * 2] : [sw * 2, sw];
184
+ ctx.beginPath();
185
+ ctx.arc(cx, cy, ur, 0, 2 * Math.PI);
186
+ ctx.lineWidth = sw;
187
+ ctx.strokeStyle = ringColor;
188
+ ctx.setLineDash(dash);
189
+ ctx.stroke();
190
+ ctx.setLineDash([]);
191
+ }
192
+
193
+ // Time-step segment: a small marker on the ring at the current frame.
194
+ if (timeSteps > 0 && timeStep >= 0) {
195
+ const step = Math.max(0, Math.min(timeSteps - 1, Math.floor(Number(timeStep) || 0)));
196
+ const angle = -Math.PI / 2 + (step / timeSteps) * 2 * Math.PI;
197
+ const mx = cx + r * Math.cos(angle);
198
+ const my = cy + r * Math.sin(angle);
199
+ ctx.beginPath();
200
+ ctx.arc(mx, my, sw * 0.75, 0, 2 * Math.PI);
201
+ ctx.fillStyle = ringColor;
202
+ ctx.fill();
203
+ }
204
+ }
package/dist/wc/index.mjs CHANGED
@@ -1,6 +1,9 @@
1
1
  /**
2
2
  * Contour web-component entry point.
3
3
  * Importing this module registers every light-DOM and shadow-DOM element.
4
+ * NOTE: This is the all-in convenience bundle (~740 kB minified).
5
+ * For production, prefer importing individual family bundles:
6
+ * `contour-ds/wc/<family>.mjs` (e.g. `contour-ds/wc/forms.mjs`, `contour-ds/wc/data.mjs`).
4
7
  * @module contour-wc
5
8
  */
6
9
 
@@ -21,14 +24,20 @@ import "./layout.mjs";
21
24
  import "./map.mjs";
22
25
  import "./misc.mjs";
23
26
  import "./navigation.mjs";
24
- import "./ui.mjs";
27
+ import "./ui-atoms.mjs";
28
+ import "./ui-feedback.mjs";
29
+ import "./ui-menus.mjs";
30
+ import "./ui-overlays.mjs";
31
+ import "./ui-inputs.mjs";
32
+ import "./ui-data.mjs";
25
33
  import "./registration.mjs";
26
- import "./shadow.mjs";
34
+ import { SHADOW_MARKUP, renderShadowDSD } from "./shadow.mjs";
35
+ export { SHADOW_MARKUP, renderShadowDSD };
27
36
 
28
- // Published version + readiness signal. Fires after every fragment has run, so
29
- // a consumer listening for `contour:ready` can assume the full registry exists.
37
+ // Published version + readiness signal, fired after every fragment runs. The
38
+ // literal is a source-time fallback; the build stamps the package.json version.
30
39
  /** Published component runtime version. */
31
- export const CONTOUR_VERSION = "1.7.0";
40
+ export const CONTOUR_VERSION = "1.9.0";
32
41
  if (typeof window !== "undefined") {
33
42
  window.ContourVersion = CONTOUR_VERSION;
34
43
  if (!window.Contour) {
@@ -48,8 +57,8 @@ if (typeof window !== "undefined") {
48
57
  },
49
58
  };
50
59
  } else {
51
- // ds.js may have already published window.Contour (frozen); top up
52
- // non-frozen namespaces only when writable.
60
+ // ds.js may have already published a frozen window.Contour; top up only
61
+ // non-frozen namespaces when writable.
53
62
  try { if (!window.Contour.format) window.Contour.format = { value: formatValue, number: (v, f, l) => formatValue(v, f, l), time: (v, l) => { try { return new Intl.DateTimeFormat(l || undefined).format(new Date(v)); } catch (e) { return String(v); } }, locale: (l) => l || (typeof navigator !== "undefined" ? navigator.language : "en") }; } catch (e) {}
54
63
  try { if (!window.Contour.markers) window.Contour.markers = { shapes: MARKER_SHAPES, styles: markerStyles, assign: assignMarkers }; } catch (e) {}
55
64
  }