contour-ds 1.8.1 → 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 (147) hide show
  1. package/README.md +227 -378
  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/build-manifest.json +320 -179
  6. package/dist/contour-wc-content.esm.js +479 -3665
  7. package/dist/contour-wc-content.esm.min.js +1 -1
  8. package/dist/contour-wc-core.esm.js +3724 -0
  9. package/dist/contour-wc-core.esm.min.js +1 -0
  10. package/dist/contour-wc-dashboard.esm.js +2713 -4381
  11. package/dist/contour-wc-dashboard.esm.min.js +1 -1
  12. package/dist/contour-wc-data.esm.js +2658 -4346
  13. package/dist/contour-wc-data.esm.min.js +1 -1
  14. package/dist/contour-wc-docs.esm.js +218 -3547
  15. package/dist/contour-wc-docs.esm.min.js +1 -1
  16. package/dist/contour-wc-feedback.esm.js +483 -3658
  17. package/dist/contour-wc-feedback.esm.min.js +1 -1
  18. package/dist/contour-wc-forms.esm.js +503 -3754
  19. package/dist/contour-wc-forms.esm.min.js +1 -1
  20. package/dist/contour-wc-interaction.esm.js +379 -3616
  21. package/dist/contour-wc-interaction.esm.min.js +1 -1
  22. package/dist/contour-wc-layout.esm.js +234 -3563
  23. package/dist/contour-wc-layout.esm.min.js +1 -1
  24. package/dist/contour-wc-map.esm.js +949 -3743
  25. package/dist/contour-wc-map.esm.min.js +1 -1
  26. package/dist/contour-wc-misc.esm.js +237 -3556
  27. package/dist/contour-wc-misc.esm.min.js +1 -1
  28. package/dist/contour-wc-navigation.esm.js +2235 -5237
  29. package/dist/contour-wc-navigation.esm.min.js +1 -1
  30. package/dist/contour-wc-ui.esm.js +4638 -7128
  31. package/dist/contour-wc-ui.esm.min.js +1 -1
  32. package/dist/contour-wc.esm.js +11971 -7727
  33. package/dist/contour-wc.esm.min.js +1 -1
  34. package/dist/contour-wc.js +11971 -7727
  35. package/dist/contour-wc.min.js +1 -1
  36. package/dist/contour.a11y.json +402 -0
  37. package/dist/contour.code-snippets +96 -74
  38. package/dist/contour.components.json +2591 -741
  39. package/dist/contour.css +2624 -1888
  40. package/dist/contour.d.ts +421 -228
  41. package/dist/contour.esm.js +433 -18
  42. package/dist/contour.esm.min.js +1 -1
  43. package/dist/contour.html-data.json +1231 -199
  44. package/dist/contour.js +433 -18
  45. package/dist/contour.min.css +1 -1
  46. package/dist/contour.min.js +1 -1
  47. package/dist/contour.react.d.ts +100 -98
  48. package/dist/contour.single.html +2 -2
  49. package/dist/contour.single.min.css +1 -1
  50. package/dist/contour.themes.json +56 -12
  51. package/dist/contour.tokens.json +482 -255
  52. package/dist/contour.vue.d.ts +100 -98
  53. package/dist/contour.web-types.json +1226 -226
  54. package/dist/custom-elements.json +7649 -2237
  55. package/dist/docs/actions.md +15 -6
  56. package/dist/docs/affordances.md +18 -96
  57. package/dist/docs/apireference.md +9 -5
  58. package/dist/docs/colour.md +10 -4
  59. package/dist/docs/componentindex.md +9 -26
  60. package/dist/docs/data.md +36 -60
  61. package/dist/docs/docs.md +10 -12
  62. package/dist/docs/feedback.md +30 -12
  63. package/dist/docs/field.md +28 -13
  64. package/dist/docs/forms.md +35 -19
  65. package/dist/docs/index.json +63 -56
  66. package/dist/docs/install.md +12 -7
  67. package/dist/docs/landing.md +7 -4
  68. package/dist/docs/mapengine.md +18 -13
  69. package/dist/docs/motion.md +12 -6
  70. package/dist/docs/navigation.md +31 -7
  71. package/dist/docs/overlays.md +32 -25
  72. package/dist/docs/overview.md +3 -2
  73. package/dist/docs/patterns.md +19 -9
  74. package/dist/docs/playground.md +9 -22
  75. package/dist/docs/principles.md +8 -6
  76. package/dist/docs/recipes.md +113 -14
  77. package/dist/docs/space.md +10 -6
  78. package/dist/docs/status.md +12 -25
  79. package/dist/docs/surfaces.md +17 -22
  80. package/dist/docs/theming.md +18 -32
  81. package/dist/docs/type.md +12 -5
  82. package/dist/docs/webcomponents.md +66 -38
  83. package/dist/hljs.css +1 -20
  84. package/dist/map-chrome.mapbox.css +68 -92
  85. package/dist/map-chrome.maplibre.css +68 -92
  86. package/dist/registry/items/contour-core.json +2 -2
  87. package/dist/registry/items/contour-data.json +2 -2
  88. package/dist/registry/items/contour-docs.json +2 -2
  89. package/dist/registry/items/contour-landing.json +2 -2
  90. package/dist/registry/registry.json +8 -8
  91. package/dist/surfaces/contour-core.min.css +1 -1
  92. package/dist/surfaces/contour-data.min.css +1 -1
  93. package/dist/surfaces/contour-docs.min.css +1 -1
  94. package/dist/surfaces/contour-landing.min.css +1 -1
  95. package/dist/svg/icons.svg +367 -0
  96. package/dist/wc/behaviours.mjs +190 -148
  97. package/dist/wc/content.mjs +273 -129
  98. package/dist/wc/core.mjs +598 -395
  99. package/dist/wc/dashboard.mjs +64 -44
  100. package/dist/wc/data-chart.mjs +1333 -0
  101. package/dist/wc/data-export.mjs +391 -0
  102. package/dist/wc/data-gauge.mjs +779 -0
  103. package/dist/wc/data-geo.mjs +696 -0
  104. package/dist/wc/data-glyphs.mjs +133 -0
  105. package/dist/wc/data-legend.mjs +431 -0
  106. package/dist/wc/data-readout.mjs +227 -0
  107. package/dist/wc/data-series.mjs +1004 -0
  108. package/dist/wc/data-table.mjs +751 -0
  109. package/dist/wc/data.mjs +15 -4322
  110. package/dist/wc/docs.mjs +12 -11
  111. package/dist/wc/feedback.mjs +277 -122
  112. package/dist/wc/forms-controls.mjs +635 -0
  113. package/dist/wc/forms-field.mjs +547 -0
  114. package/dist/wc/forms-groups.mjs +347 -0
  115. package/dist/wc/forms-input.mjs +292 -0
  116. package/dist/wc/forms.mjs +10 -1751
  117. package/dist/wc/glyph.mjs +204 -0
  118. package/dist/wc/index.mjs +11 -9
  119. package/dist/wc/interaction.mjs +173 -80
  120. package/dist/wc/layout.mjs +28 -27
  121. package/dist/wc/map.mjs +743 -207
  122. package/dist/wc/misc.mjs +31 -20
  123. package/dist/wc/navigation-menu.mjs +735 -0
  124. package/dist/wc/navigation-shell.mjs +495 -0
  125. package/dist/wc/navigation-tree.mjs +995 -0
  126. package/dist/wc/navigation.mjs +9 -1905
  127. package/dist/wc/registration.mjs +1 -8
  128. package/dist/wc/shadow.mjs +206 -110
  129. package/dist/wc/states.mjs +54 -75
  130. package/dist/wc/svg.mjs +118 -47
  131. package/dist/wc/ui-atoms.mjs +608 -0
  132. package/dist/wc/ui-data.mjs +1404 -0
  133. package/dist/wc/ui-feedback.mjs +419 -0
  134. package/dist/wc/ui-inputs.mjs +1570 -0
  135. package/dist/wc/ui-menus.mjs +307 -0
  136. package/dist/wc/ui-overlays.mjs +1605 -0
  137. package/integrations/README.md +23 -5
  138. package/integrations/ai/CLAUDE.md +3 -0
  139. package/integrations/ai/COPILOT.md +14 -0
  140. package/integrations/ai/GEMINI.md +14 -0
  141. package/integrations/ai/WINDSURF.md +14 -0
  142. package/integrations/ai/v0-prompt.md +13 -1
  143. package/integrations/native/README.md +0 -3
  144. package/integrations/tailwind/contour-theme.css +66 -7
  145. package/integrations/validate-markup.mjs +172 -0
  146. package/package.json +77 -42
  147. package/dist/wc/ui.mjs +0 -5072
@@ -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
@@ -24,18 +24,20 @@ import "./layout.mjs";
24
24
  import "./map.mjs";
25
25
  import "./misc.mjs";
26
26
  import "./navigation.mjs";
27
- 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";
28
33
  import "./registration.mjs";
29
34
  import { SHADOW_MARKUP, renderShadowDSD } from "./shadow.mjs";
30
35
  export { SHADOW_MARKUP, renderShadowDSD };
31
36
 
32
- // Published version + readiness signal. Fires after every fragment has run, so
33
- // a consumer listening for `contour:ready` can assume the full registry exists.
34
- // The version is stamped from package.json at build time (tools/build.mjs
35
- // `stampVersion`); the literal here is the source-time fallback and is never
36
- // shipped — the build replaces it with the package.json version.
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.
37
39
  /** Published component runtime version. */
38
- export const CONTOUR_VERSION = "1.8.1";
40
+ export const CONTOUR_VERSION = "1.9.0";
39
41
  if (typeof window !== "undefined") {
40
42
  window.ContourVersion = CONTOUR_VERSION;
41
43
  if (!window.Contour) {
@@ -55,8 +57,8 @@ if (typeof window !== "undefined") {
55
57
  },
56
58
  };
57
59
  } else {
58
- // ds.js may have already published window.Contour (frozen); top up
59
- // 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.
60
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) {}
61
63
  try { if (!window.Contour.markers) window.Contour.markers = { shapes: MARKER_SHAPES, styles: markerStyles, assign: assignMarkers }; } catch (e) {}
62
64
  }