@copilotkit/shared 1.85.0 → 1.86.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 (116) hide show
  1. package/dist/event-transforms/recorded-events.cjs +7 -1
  2. package/dist/event-transforms/recorded-events.cjs.map +1 -1
  3. package/dist/event-transforms/recorded-events.mjs +8 -2
  4. package/dist/event-transforms/recorded-events.mjs.map +1 -1
  5. package/dist/generative-ui/clone-value.cjs +364 -0
  6. package/dist/generative-ui/clone-value.cjs.map +1 -0
  7. package/dist/generative-ui/clone-value.d.cts +51 -0
  8. package/dist/generative-ui/clone-value.d.cts.map +1 -0
  9. package/dist/generative-ui/clone-value.d.mts +51 -0
  10. package/dist/generative-ui/clone-value.d.mts.map +1 -0
  11. package/dist/generative-ui/clone-value.mjs +363 -0
  12. package/dist/generative-ui/clone-value.mjs.map +1 -0
  13. package/dist/generative-ui/index.cjs +39 -0
  14. package/dist/generative-ui/index.d.cts +8 -2
  15. package/dist/generative-ui/index.d.mts +8 -2
  16. package/dist/generative-ui/index.mjs +8 -2
  17. package/dist/generative-ui/is-record.d.cts +3 -1
  18. package/dist/generative-ui/is-record.d.cts.map +1 -1
  19. package/dist/generative-ui/is-record.d.mts +3 -1
  20. package/dist/generative-ui/is-record.d.mts.map +1 -1
  21. package/dist/generative-ui/schema-render.cjs +2 -1
  22. package/dist/generative-ui/schema-render.cjs.map +1 -1
  23. package/dist/generative-ui/schema-render.d.cts.map +1 -1
  24. package/dist/generative-ui/schema-render.d.mts.map +1 -1
  25. package/dist/generative-ui/schema-render.mjs +2 -1
  26. package/dist/generative-ui/schema-render.mjs.map +1 -1
  27. package/dist/generative-ui/standard/chart-config.cjs +347 -0
  28. package/dist/generative-ui/standard/chart-config.cjs.map +1 -0
  29. package/dist/generative-ui/standard/chart-config.d.cts +97 -0
  30. package/dist/generative-ui/standard/chart-config.d.cts.map +1 -0
  31. package/dist/generative-ui/standard/chart-config.d.mts +97 -0
  32. package/dist/generative-ui/standard/chart-config.d.mts.map +1 -0
  33. package/dist/generative-ui/standard/chart-config.mjs +342 -0
  34. package/dist/generative-ui/standard/chart-config.mjs.map +1 -0
  35. package/dist/generative-ui/standard/chart.d.cts +10 -10
  36. package/dist/generative-ui/standard/chart.d.mts +10 -10
  37. package/dist/generative-ui/standard/composites.d.cts +46 -46
  38. package/dist/generative-ui/standard/composites.d.mts +46 -46
  39. package/dist/generative-ui/standard/data.d.cts +42 -42
  40. package/dist/generative-ui/standard/data.d.mts +42 -42
  41. package/dist/generative-ui/standard/declarations.d.cts +226 -226
  42. package/dist/generative-ui/standard/declarations.d.mts +226 -226
  43. package/dist/generative-ui/standard/feedback.d.cts +4 -4
  44. package/dist/generative-ui/standard/feedback.d.mts +4 -4
  45. package/dist/generative-ui/standard/index.d.mts +5 -1
  46. package/dist/generative-ui/standard/inputs.d.cts +72 -72
  47. package/dist/generative-ui/standard/inputs.d.mts +72 -72
  48. package/dist/generative-ui/standard/layout.d.cts +156 -156
  49. package/dist/generative-ui/standard/layout.d.mts +156 -156
  50. package/dist/generative-ui/standard/map-helpers.cjs +104 -0
  51. package/dist/generative-ui/standard/map-helpers.cjs.map +1 -0
  52. package/dist/generative-ui/standard/map-helpers.d.cts +88 -0
  53. package/dist/generative-ui/standard/map-helpers.d.cts.map +1 -0
  54. package/dist/generative-ui/standard/map-helpers.d.mts +88 -0
  55. package/dist/generative-ui/standard/map-helpers.d.mts.map +1 -0
  56. package/dist/generative-ui/standard/map-helpers.mjs +95 -0
  57. package/dist/generative-ui/standard/map-helpers.mjs.map +1 -0
  58. package/dist/generative-ui/standard/map.d.cts +10 -10
  59. package/dist/generative-ui/standard/map.d.mts +10 -10
  60. package/dist/generative-ui/standard/media.d.cts +76 -76
  61. package/dist/generative-ui/standard/media.d.mts +76 -76
  62. package/dist/generative-ui/standard/style-helpers.cjs +151 -0
  63. package/dist/generative-ui/standard/style-helpers.cjs.map +1 -0
  64. package/dist/generative-ui/standard/style-helpers.d.cts +56 -0
  65. package/dist/generative-ui/standard/style-helpers.d.cts.map +1 -0
  66. package/dist/generative-ui/standard/style-helpers.d.mts +56 -0
  67. package/dist/generative-ui/standard/style-helpers.d.mts.map +1 -0
  68. package/dist/generative-ui/standard/style-helpers.mjs +142 -0
  69. package/dist/generative-ui/standard/style-helpers.mjs.map +1 -0
  70. package/dist/generative-ui/standard/text.d.cts +28 -28
  71. package/dist/generative-ui/standard/text.d.mts +28 -28
  72. package/dist/generative-ui/standard/url.cjs +54 -0
  73. package/dist/generative-ui/standard/url.cjs.map +1 -0
  74. package/dist/generative-ui/standard/url.d.cts +32 -0
  75. package/dist/generative-ui/standard/url.d.cts.map +1 -0
  76. package/dist/generative-ui/standard/url.d.mts +32 -0
  77. package/dist/generative-ui/standard/url.d.mts.map +1 -0
  78. package/dist/generative-ui/standard/url.mjs +50 -0
  79. package/dist/generative-ui/standard/url.mjs.map +1 -0
  80. package/dist/generative-ui/thrown.cjs +69 -0
  81. package/dist/generative-ui/thrown.cjs.map +1 -0
  82. package/dist/generative-ui/thrown.d.cts +21 -0
  83. package/dist/generative-ui/thrown.d.cts.map +1 -0
  84. package/dist/generative-ui/thrown.d.mts +21 -0
  85. package/dist/generative-ui/thrown.d.mts.map +1 -0
  86. package/dist/generative-ui/thrown.mjs +67 -0
  87. package/dist/generative-ui/thrown.mjs.map +1 -0
  88. package/dist/index.cjs +2 -0
  89. package/dist/index.cjs.map +1 -1
  90. package/dist/index.d.cts +2 -1
  91. package/dist/index.d.cts.map +1 -1
  92. package/dist/index.d.mts +2 -1
  93. package/dist/index.d.mts.map +1 -1
  94. package/dist/index.mjs +2 -1
  95. package/dist/index.mjs.map +1 -1
  96. package/dist/index.umd.js +368 -2
  97. package/dist/index.umd.js.map +1 -1
  98. package/dist/package.cjs +1 -1
  99. package/dist/package.mjs +1 -1
  100. package/package.json +2 -2
  101. package/src/__tests__/schema-render.test.ts +78 -0
  102. package/src/event-transforms/recorded-events.test.ts +35 -3
  103. package/src/event-transforms/recorded-events.ts +15 -2
  104. package/src/generative-ui/__tests__/clone-value-differential.test.ts +480 -0
  105. package/src/generative-ui/__tests__/clone-value.test.ts +226 -0
  106. package/src/generative-ui/clone-value.ts +511 -0
  107. package/src/generative-ui/index.ts +6 -2
  108. package/src/generative-ui/schema-render.ts +2 -1
  109. package/src/generative-ui/standard/__tests__/standard-helpers.test.ts +407 -0
  110. package/src/generative-ui/standard/chart-config.ts +434 -0
  111. package/src/generative-ui/standard/index.ts +36 -0
  112. package/src/generative-ui/standard/map-helpers.ts +155 -0
  113. package/src/generative-ui/standard/style-helpers.ts +170 -0
  114. package/src/generative-ui/standard/url.ts +51 -0
  115. package/src/generative-ui/thrown.ts +90 -0
  116. package/src/index.ts +5 -0
@@ -0,0 +1,342 @@
1
+ import { CHART_PALETTE, borderColor, textColor } from "./tokens.mjs";
2
+
3
+ //#region src/generative-ui/standard/chart-config.ts
4
+ /**
5
+ * The series of a chart, each with a key, a label and a color. Without
6
+ * series, the chart shows every number field of the first row, except the
7
+ * x key.
8
+ *
9
+ * @param series - The `series` prop of the chart.
10
+ * @param data - The rows of the chart.
11
+ * @param xKey - The field of the x axis (or of the slice names).
12
+ */
13
+ function normalizeSeries(series, data, xKey) {
14
+ const first = data[0];
15
+ return ((series === void 0 || series.length === 0) && first !== void 0 ? Object.keys(first).filter((key) => key !== xKey && typeof first[key] === "number") : series ?? []).map((item, index) => {
16
+ const entry = typeof item === "string" ? { key: item } : item;
17
+ const color = textColor("color" in entry ? entry.color : void 0) ?? CHART_PALETTE[index % CHART_PALETTE.length];
18
+ return {
19
+ key: entry.key,
20
+ label: "label" in entry && entry.label || entry.key,
21
+ color
22
+ };
23
+ });
24
+ }
25
+ function numberStyle(format) {
26
+ switch (format) {
27
+ case "currency": return "currency";
28
+ case "percent": return "percent";
29
+ case "number": return "decimal";
30
+ }
31
+ }
32
+ /**
33
+ * The value formatter of the axis, the tooltip, the value labels and the
34
+ * data table. `undefined` when no `format` is set. Axis ticks must stay
35
+ * short ("$1.6K", "25%"): en-US, no decimals, and compact from 10,000.
36
+ *
37
+ * @param format - The `format` prop of the chart.
38
+ * @param currency - The ISO currency code for `"currency"`. Defaults to USD.
39
+ */
40
+ function makeFormatter(format, currency) {
41
+ if (!format) return void 0;
42
+ const build = (isCompact) => {
43
+ try {
44
+ return new Intl.NumberFormat("en-US", {
45
+ style: numberStyle(format),
46
+ currency: format === "currency" ? currency ?? "USD" : void 0,
47
+ maximumFractionDigits: format === "percent" ? 1 : 0,
48
+ notation: isCompact ? "compact" : void 0
49
+ });
50
+ } catch {
51
+ return new Intl.NumberFormat("en-US");
52
+ }
53
+ };
54
+ const plain = build(false);
55
+ const compact = build(true);
56
+ return (value) => typeof value === "number" ? (Math.abs(value) >= 1e4 ? compact : plain).format(value) : String(value ?? "");
57
+ }
58
+ /**
59
+ * A CSS color that a canvas can paint. The color tokens are
60
+ * `var(--name, fallback)` strings: the custom property comes from the
61
+ * computed style of `element`, else the fallback.
62
+ *
63
+ * @param value - A CSS color or a `var(...)` token.
64
+ * @param element - The element whose computed style holds the custom properties.
65
+ */
66
+ function resolveCssColor(value, element) {
67
+ const match = /^var\((--[\w-]+)(?:,\s*(.*))?\)$/.exec(value.trim());
68
+ if (!match) return value;
69
+ const fallback = match[2]?.trim() ?? value;
70
+ if (typeof getComputedStyle !== "function") return fallback;
71
+ try {
72
+ return getComputedStyle(element).getPropertyValue(match[1]).trim() || fallback;
73
+ } catch {
74
+ return fallback;
75
+ }
76
+ }
77
+ /**
78
+ * A `#rrggbb` color with an alpha channel added. Any other color comes back
79
+ * as it is.
80
+ *
81
+ * @example withAlpha("#ff0000", 0.2) // "#ff000033"
82
+ */
83
+ function withAlpha(color, alpha) {
84
+ const match = /^#([0-9a-f]{6})$/i.exec(color);
85
+ if (!match) return color;
86
+ const hex = Math.round(alpha * 255).toString(16).padStart(2, "0");
87
+ return `#${match[1]}${hex}`;
88
+ }
89
+ /** The `key` of a chart.js point (`{ x, y }`), or the value itself when it is not a point. */
90
+ function pointValue(value, key) {
91
+ if (typeof value !== "object" || value === null) return value;
92
+ if (key === "x") return "x" in value ? value.x : value;
93
+ return "y" in value ? value.y : value;
94
+ }
95
+ /**
96
+ * A chart.js plugin that draws the value of each bar, point and slice, for
97
+ * `showValueLabels`: chart.js has no value labels of its own. Bar and point
98
+ * labels sit above the mark (next to it in a horizontal layout); slice
99
+ * labels sit outside the arc, with a line unless `showLabelLines` is false.
100
+ *
101
+ * @param props - The chart props.
102
+ * @param format - The value formatter, from `makeFormatter`.
103
+ * @param textFill - The canvas color of the label text.
104
+ * @param lineStroke - The canvas color of the slice label lines.
105
+ */
106
+ function valueLabelsPlugin(props, format, textFill, lineStroke) {
107
+ const showLines = props.showLabelLines ?? true;
108
+ return {
109
+ id: "a2uiValueLabels",
110
+ afterDatasetsDraw(chart) {
111
+ const ctx = chart.ctx;
112
+ ctx.save();
113
+ ctx.font = "12px system-ui, sans-serif";
114
+ if (textFill) ctx.fillStyle = textFill;
115
+ if (lineStroke) ctx.strokeStyle = lineStroke;
116
+ ctx.lineWidth = 1;
117
+ const horizontal = chart.options.indexAxis === "y";
118
+ chart.data.datasets.forEach((dataset, datasetIndex) => {
119
+ const meta = chart.getDatasetMeta(datasetIndex);
120
+ if (meta.hidden) return;
121
+ meta.data.forEach((element, index) => {
122
+ const value = pointValue(dataset.data[index], "y");
123
+ if (typeof value !== "number" || !Number.isFinite(value)) return;
124
+ const label = format ? format(value) : String(value);
125
+ if (meta.type === "pie" || meta.type === "doughnut") {
126
+ const arc = element.getProps?.([
127
+ "x",
128
+ "y",
129
+ "startAngle",
130
+ "endAngle",
131
+ "outerRadius"
132
+ ], true);
133
+ if (!arc) return;
134
+ const angle = (arc.startAngle + arc.endAngle) / 2;
135
+ const cos = Math.cos(angle);
136
+ const sin = Math.sin(angle);
137
+ const edge = arc.outerRadius;
138
+ const fromX = arc.x + cos * edge;
139
+ const fromY = arc.y + sin * edge;
140
+ const toX = arc.x + cos * (edge + 12);
141
+ const toY = arc.y + sin * (edge + 12);
142
+ if (showLines) {
143
+ ctx.beginPath();
144
+ ctx.moveTo(fromX, fromY);
145
+ ctx.lineTo(toX, toY);
146
+ ctx.stroke();
147
+ }
148
+ ctx.textAlign = cos >= 0 ? "left" : "right";
149
+ ctx.textBaseline = "middle";
150
+ ctx.fillText(label, toX + (cos >= 0 ? 3 : -3), toY);
151
+ } else if (horizontal) {
152
+ ctx.textAlign = "left";
153
+ ctx.textBaseline = "middle";
154
+ ctx.fillText(label, element.x + 4, element.y);
155
+ } else {
156
+ ctx.textAlign = "center";
157
+ ctx.textBaseline = "bottom";
158
+ ctx.fillText(label, element.x, element.y - 4);
159
+ }
160
+ });
161
+ });
162
+ ctx.restore();
163
+ }
164
+ };
165
+ }
166
+ /**
167
+ * The chart.js config of the chart props: the marks, colors, axes, legend,
168
+ * tooltip and value labels. Pass it to a chart.js `Chart` constructor.
169
+ *
170
+ * @param props - The chart props.
171
+ * @param element - The chart element. Its computed style resolves the color tokens.
172
+ */
173
+ function chartConfig(props, element) {
174
+ const color = (value) => value === void 0 ? void 0 : resolveCssColor(value, element);
175
+ const data = props.data ?? [];
176
+ const chartType = props.chartType ?? "bar";
177
+ const series = normalizeSeries(props.series, data, props.xKey);
178
+ const format = makeFormatter(props.format, props.currency);
179
+ const xKey = props.xKey;
180
+ const secondary = color(textColor("secondary"));
181
+ const plugins = props.showValueLabels ? [valueLabelsPlugin(props, format, color(textColor("default")), secondary)] : void 0;
182
+ const legend = {
183
+ display: (props.showLegend ?? true) && series.length > 0,
184
+ labels: {
185
+ usePointStyle: true,
186
+ pointStyle: "circle",
187
+ boxWidth: 8,
188
+ boxHeight: 8,
189
+ color: color(textColor("default")),
190
+ font: { size: 13 }
191
+ }
192
+ };
193
+ const tooltip = {
194
+ enabled: props.showTooltip ?? true,
195
+ callbacks: format ? { label: (context) => {
196
+ const parsed = context.parsed;
197
+ const value = pointValue(parsed, props.layout === "horizontal" && chartType !== "scatter" ? "x" : "y");
198
+ const label = context.dataset.label;
199
+ return `${label ? `${label}: ` : ""}${format(value)}`;
200
+ } } : void 0
201
+ };
202
+ const common = {
203
+ responsive: true,
204
+ maintainAspectRatio: false,
205
+ animation: false
206
+ };
207
+ if (chartType === "pie" || chartType === "donut") {
208
+ const first = series[0];
209
+ const labels = data.map((row) => String(row[xKey ?? "name"] ?? ""));
210
+ return {
211
+ type: chartType === "pie" ? "pie" : "doughnut",
212
+ plugins,
213
+ data: {
214
+ labels,
215
+ datasets: first ? [{
216
+ label: first.label,
217
+ data: data.map((row) => Number(row[first.key] ?? 0)),
218
+ backgroundColor: data.map((_, index) => color(CHART_PALETTE[index % CHART_PALETTE.length])),
219
+ borderWidth: 0,
220
+ borderRadius: props.cornerRadius ?? 0,
221
+ spacing: props.paddingAngle ?? 0
222
+ }] : []
223
+ },
224
+ options: {
225
+ ...common,
226
+ cutout: props.innerRadius ?? (chartType === "donut" ? "55%" : 0),
227
+ radius: props.outerRadius ?? "80%",
228
+ rotation: props.startAngle === void 0 ? 0 : 90 - props.startAngle,
229
+ circumference: props.startAngle !== void 0 && props.endAngle !== void 0 ? Math.abs(props.startAngle - props.endAngle) : 360,
230
+ plugins: {
231
+ legend,
232
+ tooltip
233
+ }
234
+ }
235
+ };
236
+ }
237
+ const isHorizontal = props.layout === "horizontal";
238
+ const stacked = props.stacked === true;
239
+ const isNumericScatter = chartType === "scatter" && xKey !== void 0 && data.length > 0 && data.every((row) => typeof row[xKey] === "number" && Number.isFinite(row[xKey]));
240
+ const labels = data.map((row) => String((xKey ? row[xKey] : "") ?? ""));
241
+ const pointRadius = props.showDots ? 3 : 0;
242
+ const datasets = series.map((item) => {
243
+ const paint = color(item.color);
244
+ const values = data.map((row) => row[item.key]);
245
+ switch (chartType) {
246
+ case "line": return {
247
+ label: item.label,
248
+ data: values,
249
+ borderColor: paint,
250
+ backgroundColor: paint,
251
+ borderWidth: 2,
252
+ tension: .4,
253
+ pointRadius,
254
+ fill: false
255
+ };
256
+ case "area": return {
257
+ label: item.label,
258
+ data: values,
259
+ borderColor: paint,
260
+ backgroundColor: withAlpha(paint ?? "", .2),
261
+ borderWidth: 2,
262
+ tension: .4,
263
+ pointRadius,
264
+ fill: stacked ? "stack" : "origin"
265
+ };
266
+ case "scatter": return {
267
+ label: item.label,
268
+ data: data.map((row, index) => ({
269
+ x: isNumericScatter ? row[xKey] : index,
270
+ y: row[item.key]
271
+ })),
272
+ backgroundColor: paint,
273
+ pointRadius: 4
274
+ };
275
+ default: return {
276
+ label: item.label,
277
+ data: values,
278
+ backgroundColor: paint,
279
+ borderRadius: stacked ? 0 : props.barRadius ?? 4,
280
+ borderSkipped: stacked ? false : void 0
281
+ };
282
+ }
283
+ });
284
+ const valueAxis = {
285
+ stacked,
286
+ min: props.yAxis?.min,
287
+ max: props.yAxis?.max,
288
+ grid: {
289
+ display: props.showGrid ?? true,
290
+ color: color(borderColor("subtle"))
291
+ },
292
+ border: { display: false },
293
+ ticks: {
294
+ color: secondary,
295
+ font: { size: 12 },
296
+ callback: format ? (value) => format(value) : void 0
297
+ },
298
+ title: props.yAxis?.label ? {
299
+ display: true,
300
+ text: props.yAxis.label,
301
+ color: secondary,
302
+ font: { size: 12 }
303
+ } : void 0
304
+ };
305
+ const categoryAxis = {
306
+ stacked,
307
+ type: isNumericScatter ? "linear" : "category",
308
+ grid: { display: false },
309
+ border: { color: color(borderColor("default")) },
310
+ ticks: {
311
+ color: secondary,
312
+ font: { size: 12 }
313
+ }
314
+ };
315
+ return {
316
+ type: chartType === "area" ? "line" : chartType,
317
+ plugins,
318
+ data: {
319
+ labels: isNumericScatter ? void 0 : labels,
320
+ datasets
321
+ },
322
+ options: {
323
+ ...common,
324
+ indexAxis: isHorizontal ? "y" : "x",
325
+ plugins: {
326
+ legend,
327
+ tooltip
328
+ },
329
+ scales: isHorizontal ? {
330
+ x: valueAxis,
331
+ y: categoryAxis
332
+ } : {
333
+ x: categoryAxis,
334
+ y: valueAxis
335
+ }
336
+ }
337
+ };
338
+ }
339
+
340
+ //#endregion
341
+ export { chartConfig, makeFormatter, normalizeSeries, resolveCssColor, valueLabelsPlugin, withAlpha };
342
+ //# sourceMappingURL=chart-config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-config.mjs","names":[],"sources":["../../../src/generative-ui/standard/chart-config.ts"],"sourcesContent":["// Framework-free chart helpers of the standard Chart component. They build a\n// chart.js config without importing chart.js: the chart.js parts are typed\n// structurally, so chart.js stays an optional peer of each framework package.\nimport { CHART_PALETTE, borderColor, textColor } from \"./tokens\";\nimport type { ChartProps, ChartSeries } from \"./chart\";\n\ntype ChartData = NonNullable<ChartProps[\"data\"]>;\n\n/**\n * The series of a chart, each with a key, a label and a color. Without\n * series, the chart shows every number field of the first row, except the\n * x key.\n *\n * @param series - The `series` prop of the chart.\n * @param data - The rows of the chart.\n * @param xKey - The field of the x axis (or of the slice names).\n */\nexport function normalizeSeries(\n series: ChartSeries[] | undefined,\n data: ChartData,\n xKey: string | undefined,\n) {\n const first = data[0];\n const isEmpty = series === undefined || series.length === 0;\n const list: ChartSeries[] =\n isEmpty && first !== undefined\n ? Object.keys(first).filter(\n (key) => key !== xKey && typeof first[key] === \"number\",\n )\n : (series ?? []);\n return list.map((item, index) => {\n const entry = typeof item === \"string\" ? { key: item } : item;\n const color: string =\n textColor(\"color\" in entry ? entry.color : undefined) ??\n CHART_PALETTE[index % CHART_PALETTE.length]!;\n return {\n key: entry.key,\n label: (\"label\" in entry && entry.label) || entry.key,\n color,\n };\n });\n}\n\nfunction numberStyle(format: NonNullable<ChartProps[\"format\"]>) {\n switch (format) {\n case \"currency\":\n return \"currency\";\n case \"percent\":\n return \"percent\";\n case \"number\":\n return \"decimal\";\n }\n}\n\n/**\n * The value formatter of the axis, the tooltip, the value labels and the\n * data table. `undefined` when no `format` is set. Axis ticks must stay\n * short (\"$1.6K\", \"25%\"): en-US, no decimals, and compact from 10,000.\n *\n * @param format - The `format` prop of the chart.\n * @param currency - The ISO currency code for `\"currency\"`. Defaults to USD.\n */\nexport function makeFormatter(\n format: ChartProps[\"format\"],\n currency: string | undefined,\n) {\n if (!format) return undefined;\n const build = (isCompact: boolean) => {\n try {\n return new Intl.NumberFormat(\"en-US\", {\n style: numberStyle(format),\n currency: format === \"currency\" ? (currency ?? \"USD\") : undefined,\n maximumFractionDigits: format === \"percent\" ? 1 : 0,\n notation: isCompact ? \"compact\" : undefined,\n });\n } catch {\n // An unknown currency code throws. Plain numbers are a safe fallback.\n return new Intl.NumberFormat(\"en-US\");\n }\n };\n const plain = build(false);\n const compact = build(true);\n return (value: unknown) =>\n typeof value === \"number\"\n ? (Math.abs(value) >= 10_000 ? compact : plain).format(value)\n : String(value ?? \"\");\n}\n\n/**\n * A CSS color that a canvas can paint. The color tokens are\n * `var(--name, fallback)` strings: the custom property comes from the\n * computed style of `element`, else the fallback.\n *\n * @param value - A CSS color or a `var(...)` token.\n * @param element - The element whose computed style holds the custom properties.\n */\nexport function resolveCssColor(value: string, element: Element) {\n const match = /^var\\((--[\\w-]+)(?:,\\s*(.*))?\\)$/.exec(value.trim());\n if (!match) return value;\n const fallback = match[2]?.trim() ?? value;\n if (typeof getComputedStyle !== \"function\") return fallback;\n try {\n const resolved = getComputedStyle(element)\n .getPropertyValue(match[1]!)\n .trim();\n return resolved || fallback;\n } catch {\n return fallback;\n }\n}\n\n/**\n * A `#rrggbb` color with an alpha channel added. Any other color comes back\n * as it is.\n *\n * @example withAlpha(\"#ff0000\", 0.2) // \"#ff000033\"\n */\nexport function withAlpha(color: string, alpha: number) {\n const match = /^#([0-9a-f]{6})$/i.exec(color);\n if (!match) return color;\n const hex = Math.round(alpha * 255)\n .toString(16)\n .padStart(2, \"0\");\n return `#${match[1]}${hex}`;\n}\n\n/** The `key` of a chart.js point (`{ x, y }`), or the value itself when it is not a point. */\nfunction pointValue(value: unknown, key: \"x\" | \"y\") {\n if (typeof value !== \"object\" || value === null) return value;\n if (key === \"x\") return \"x\" in value ? value.x : value;\n return \"y\" in value ? value.y : value;\n}\n\n/**\n * A chart.js `Chart` constructor, as `chart.js/auto` exports it. Use it to\n * type the module that a chart loader resolves.\n */\nexport type ChartConstructor = new (\n canvas: HTMLCanvasElement,\n config: Record<string, unknown>,\n) => { destroy(): void };\n\n/** The part of a chart.js chart that the value labels plugin reads and draws on. */\ninterface ChartForLabels {\n ctx: CanvasRenderingContext2D;\n data: { datasets: { data: unknown[] }[] };\n options: { indexAxis?: string };\n getDatasetMeta(index: number): {\n hidden: boolean | null;\n type: string;\n data: {\n x: number;\n y: number;\n getProps?: (keys: string[], final?: boolean) => Record<string, number>;\n }[];\n };\n}\n\n/**\n * A chart.js plugin that draws the value of each bar, point and slice, for\n * `showValueLabels`: chart.js has no value labels of its own. Bar and point\n * labels sit above the mark (next to it in a horizontal layout); slice\n * labels sit outside the arc, with a line unless `showLabelLines` is false.\n *\n * @param props - The chart props.\n * @param format - The value formatter, from `makeFormatter`.\n * @param textFill - The canvas color of the label text.\n * @param lineStroke - The canvas color of the slice label lines.\n */\nexport function valueLabelsPlugin(\n props: ChartProps,\n format: ((value: unknown) => string) | undefined,\n textFill: string | undefined,\n lineStroke: string | undefined,\n) {\n const showLines = props.showLabelLines ?? true;\n return {\n id: \"a2uiValueLabels\",\n afterDatasetsDraw(chart: ChartForLabels) {\n const ctx = chart.ctx;\n ctx.save();\n ctx.font = \"12px system-ui, sans-serif\";\n if (textFill) ctx.fillStyle = textFill;\n if (lineStroke) ctx.strokeStyle = lineStroke;\n ctx.lineWidth = 1;\n const horizontal = chart.options.indexAxis === \"y\";\n chart.data.datasets.forEach((dataset, datasetIndex) => {\n const meta = chart.getDatasetMeta(datasetIndex);\n if (meta.hidden) return;\n meta.data.forEach((element, index) => {\n const value = pointValue(dataset.data[index], \"y\");\n if (typeof value !== \"number\" || !Number.isFinite(value)) return;\n const label = format ? format(value) : String(value);\n if (meta.type === \"pie\" || meta.type === \"doughnut\") {\n const arc = element.getProps?.(\n [\"x\", \"y\", \"startAngle\", \"endAngle\", \"outerRadius\"],\n true,\n );\n if (!arc) return;\n const angle = (arc.startAngle! + arc.endAngle!) / 2;\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n const edge = arc.outerRadius!;\n const fromX = arc.x! + cos * edge;\n const fromY = arc.y! + sin * edge;\n const toX = arc.x! + cos * (edge + 12);\n const toY = arc.y! + sin * (edge + 12);\n if (showLines) {\n ctx.beginPath();\n ctx.moveTo(fromX, fromY);\n ctx.lineTo(toX, toY);\n ctx.stroke();\n }\n ctx.textAlign = cos >= 0 ? \"left\" : \"right\";\n ctx.textBaseline = \"middle\";\n ctx.fillText(label, toX + (cos >= 0 ? 3 : -3), toY);\n } else if (horizontal) {\n ctx.textAlign = \"left\";\n ctx.textBaseline = \"middle\";\n ctx.fillText(label, element.x + 4, element.y);\n } else {\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"bottom\";\n ctx.fillText(label, element.x, element.y - 4);\n }\n });\n });\n ctx.restore();\n },\n };\n}\n\n/**\n * The chart.js config of the chart props: the marks, colors, axes, legend,\n * tooltip and value labels. Pass it to a chart.js `Chart` constructor.\n *\n * @param props - The chart props.\n * @param element - The chart element. Its computed style resolves the color tokens.\n */\nexport function chartConfig(\n props: ChartProps,\n element: Element,\n): Record<string, unknown> {\n const color = (value: string | undefined) =>\n value === undefined ? undefined : resolveCssColor(value, element);\n const data = props.data ?? [];\n const chartType = props.chartType ?? \"bar\";\n const series = normalizeSeries(props.series, data, props.xKey);\n const format = makeFormatter(props.format, props.currency);\n const xKey = props.xKey;\n const secondary = color(textColor(\"secondary\"));\n const plugins = props.showValueLabels\n ? [valueLabelsPlugin(props, format, color(textColor(\"default\")), secondary)]\n : undefined;\n const legend = {\n display: (props.showLegend ?? true) && series.length > 0,\n labels: {\n usePointStyle: true,\n pointStyle: \"circle\",\n boxWidth: 8,\n boxHeight: 8,\n color: color(textColor(\"default\")),\n font: { size: 13 },\n },\n };\n const tooltip = {\n enabled: props.showTooltip ?? true,\n callbacks: format\n ? {\n label: (context: {\n dataset: { label?: string };\n parsed: unknown;\n raw: unknown;\n }) => {\n const parsed = context.parsed;\n // A horizontal layout puts the value on the x axis. A scatter\n // point keeps its value in y whatever the layout.\n const valueKey =\n props.layout === \"horizontal\" && chartType !== \"scatter\"\n ? \"x\"\n : \"y\";\n const value = pointValue(parsed, valueKey);\n const label = context.dataset.label;\n return `${label ? `${label}: ` : \"\"}${format(value)}`;\n },\n }\n : undefined,\n };\n const common = {\n responsive: true,\n maintainAspectRatio: false,\n animation: false,\n };\n\n if (chartType === \"pie\" || chartType === \"donut\") {\n const first = series[0];\n const labels = data.map((row) => String(row[xKey ?? \"name\"] ?? \"\"));\n return {\n type: chartType === \"pie\" ? \"pie\" : \"doughnut\",\n plugins,\n data: {\n labels,\n datasets: first\n ? [\n {\n label: first.label,\n data: data.map((row) => Number(row[first.key] ?? 0)),\n backgroundColor: data.map((_, index) =>\n color(CHART_PALETTE[index % CHART_PALETTE.length]!),\n ),\n borderWidth: 0,\n borderRadius: props.cornerRadius ?? 0,\n spacing: props.paddingAngle ?? 0,\n },\n ]\n : [],\n },\n options: {\n ...common,\n cutout: props.innerRadius ?? (chartType === \"donut\" ? \"55%\" : 0),\n radius: props.outerRadius ?? \"80%\",\n rotation: props.startAngle === undefined ? 0 : 90 - props.startAngle,\n circumference:\n props.startAngle !== undefined && props.endAngle !== undefined\n ? Math.abs(props.startAngle - props.endAngle)\n : 360,\n plugins: { legend, tooltip },\n },\n };\n }\n\n const isHorizontal = props.layout === \"horizontal\";\n const stacked = props.stacked === true;\n // Scatter uses numeric distances when all x values are numbers. Preserve\n // category spacing for string/mixed data and for the other chart types.\n const isNumericScatter =\n chartType === \"scatter\" &&\n xKey !== undefined &&\n data.length > 0 &&\n data.every(\n (row) => typeof row[xKey] === \"number\" && Number.isFinite(row[xKey]),\n );\n const labels = data.map((row) => String((xKey ? row[xKey] : \"\") ?? \"\"));\n const pointRadius = props.showDots ? 3 : 0;\n const datasets = series.map((item) => {\n const paint = color(item.color);\n const values = data.map((row) => row[item.key]);\n switch (chartType) {\n case \"line\":\n return {\n label: item.label,\n data: values,\n borderColor: paint,\n backgroundColor: paint,\n borderWidth: 2,\n tension: 0.4,\n pointRadius,\n fill: false,\n };\n case \"area\":\n return {\n label: item.label,\n data: values,\n borderColor: paint,\n backgroundColor: withAlpha(paint ?? \"\", 0.2),\n borderWidth: 2,\n tension: 0.4,\n pointRadius,\n fill: stacked ? \"stack\" : \"origin\",\n };\n case \"scatter\":\n return {\n label: item.label,\n data: data.map((row, index) => ({\n x: isNumericScatter ? row[xKey!] : index,\n y: row[item.key],\n })),\n backgroundColor: paint,\n pointRadius: 4,\n };\n default:\n return {\n label: item.label,\n data: values,\n backgroundColor: paint,\n borderRadius: stacked ? 0 : (props.barRadius ?? 4),\n borderSkipped: stacked ? false : undefined,\n };\n }\n });\n const valueAxis = {\n stacked,\n min: props.yAxis?.min,\n max: props.yAxis?.max,\n grid: {\n display: props.showGrid ?? true,\n color: color(borderColor(\"subtle\")),\n },\n border: { display: false },\n ticks: {\n color: secondary,\n font: { size: 12 },\n callback: format ? (value: unknown) => format(value) : undefined,\n },\n title: props.yAxis?.label\n ? {\n display: true,\n text: props.yAxis.label,\n color: secondary,\n font: { size: 12 },\n }\n : undefined,\n };\n const categoryAxis = {\n stacked,\n type: isNumericScatter ? \"linear\" : \"category\",\n grid: { display: false },\n border: { color: color(borderColor(\"default\")) },\n ticks: { color: secondary, font: { size: 12 } },\n };\n return {\n type: chartType === \"area\" ? \"line\" : chartType,\n plugins,\n data: { labels: isNumericScatter ? undefined : labels, datasets },\n options: {\n ...common,\n indexAxis: isHorizontal ? \"y\" : \"x\",\n plugins: { legend, tooltip },\n scales: isHorizontal\n ? { x: valueAxis, y: categoryAxis }\n : { x: categoryAxis, y: valueAxis },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,SAAgB,gBACd,QACA,MACA,MACA;CACA,MAAM,QAAQ,KAAK;AAQnB,UAPgB,WAAW,UAAa,OAAO,WAAW,MAE7C,UAAU,SACjB,OAAO,KAAK,MAAM,C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AO;EAC1B,OAAO;GACL,OAAO;GACP,MAAM,EAAE,MAAM,IAAI;GAClB,UAAU,UAAU,UAAmB,OAAO,MAAM,GAAG;GACxD;EACD,OAAO,MAAM,OAAO,QAChB;GACE,SAAS;GACT,MAAM,MAAM,MAAM;GAClB,OAAO;GACP,MAAM,EAAE,MAAM,IAAI;GACnB,GACD;EACL;CACD,MAAM,eAAe;EACnB;EACA,MAAM,mBAAmB,WAAW;EACpC,MAAM,EAAE,SAAS,OAAO;EACxB,QAAQ,EAAE,OAAO,MAAM,YAAY,UAAU,CAAC,EAAE;EAChD,OAAO;GAAE,OAAO;GAAW,MAAM,EAAE,MAAM,IAAI;GAAE;EAChD;AACD,QAAO;EACL,MAAM,cAAc,SAAS,SAAS;EACtC;EACA,MAAM;GAAE,QAAQ,mBAAmB,SAAY;GAAQ;GAAU;EACjE,SAAS;GACP,GAAG;GACH,WAAW,eAAe,MAAM;GAChC,SAAS;IAAE;IAAQ;IAAS;GAC5B,QAAQ,eACJ;IAAE,GAAG;IAAW,GAAG;IAAc,GACjC;IAAE,GAAG;IAAc,GAAG;IAAW;GACtC;EACF"}
@@ -41,14 +41,14 @@ declare const chartSchema: z.ZodObject<{
41
41
  width: z.ZodOptional<z.ZodNumber>;
42
42
  }, "strip", z.ZodTypeAny, {
43
43
  label?: string | undefined;
44
- width?: number | undefined;
45
44
  min?: number | undefined;
46
45
  max?: number | undefined;
46
+ width?: number | undefined;
47
47
  }, {
48
48
  label?: string | undefined;
49
- width?: number | undefined;
50
49
  min?: number | undefined;
51
50
  max?: number | undefined;
51
+ width?: number | undefined;
52
52
  }>>;
53
53
  showDots: z.ZodOptional<z.ZodBoolean>;
54
54
  barRadius: z.ZodOptional<z.ZodNumber>;
@@ -69,9 +69,6 @@ declare const chartSchema: z.ZodObject<{
69
69
  title: z.ZodOptional<z.ZodString>;
70
70
  }, "strip", z.ZodTypeAny, {
71
71
  title?: string | undefined;
72
- height?: number | undefined;
73
- layout?: "horizontal" | "vertical" | undefined;
74
- chartType?: "bar" | "line" | "area" | "scatter" | "pie" | "donut" | undefined;
75
72
  data?: Record<string, unknown>[] | undefined;
76
73
  xKey?: string | undefined;
77
74
  series?: (string | {
@@ -79,12 +76,15 @@ declare const chartSchema: z.ZodObject<{
79
76
  label?: string | undefined;
80
77
  color?: string | undefined;
81
78
  })[] | undefined;
79
+ chartType?: "bar" | "line" | "area" | "scatter" | "pie" | "donut" | undefined;
80
+ height?: number | undefined;
81
+ layout?: "horizontal" | "vertical" | undefined;
82
82
  stacked?: boolean | undefined;
83
83
  yAxis?: {
84
84
  label?: string | undefined;
85
- width?: number | undefined;
86
85
  min?: number | undefined;
87
86
  max?: number | undefined;
87
+ width?: number | undefined;
88
88
  } | undefined;
89
89
  showDots?: boolean | undefined;
90
90
  barRadius?: number | undefined;
@@ -103,9 +103,6 @@ declare const chartSchema: z.ZodObject<{
103
103
  format?: "number" | "currency" | "percent" | undefined;
104
104
  }, {
105
105
  title?: string | undefined;
106
- height?: number | undefined;
107
- layout?: "horizontal" | "vertical" | undefined;
108
- chartType?: "bar" | "line" | "area" | "scatter" | "pie" | "donut" | undefined;
109
106
  data?: Record<string, unknown>[] | undefined;
110
107
  xKey?: string | undefined;
111
108
  series?: (string | {
@@ -113,12 +110,15 @@ declare const chartSchema: z.ZodObject<{
113
110
  label?: string | undefined;
114
111
  color?: string | undefined;
115
112
  })[] | undefined;
113
+ chartType?: "bar" | "line" | "area" | "scatter" | "pie" | "donut" | undefined;
114
+ height?: number | undefined;
115
+ layout?: "horizontal" | "vertical" | undefined;
116
116
  stacked?: boolean | undefined;
117
117
  yAxis?: {
118
118
  label?: string | undefined;
119
- width?: number | undefined;
120
119
  min?: number | undefined;
121
120
  max?: number | undefined;
121
+ width?: number | undefined;
122
122
  } | undefined;
123
123
  showDots?: boolean | undefined;
124
124
  barRadius?: number | undefined;
@@ -41,14 +41,14 @@ declare const chartSchema: z.ZodObject<{
41
41
  width: z.ZodOptional<z.ZodNumber>;
42
42
  }, "strip", z.ZodTypeAny, {
43
43
  label?: string | undefined;
44
- width?: number | undefined;
45
44
  min?: number | undefined;
46
45
  max?: number | undefined;
46
+ width?: number | undefined;
47
47
  }, {
48
48
  label?: string | undefined;
49
- width?: number | undefined;
50
49
  min?: number | undefined;
51
50
  max?: number | undefined;
51
+ width?: number | undefined;
52
52
  }>>;
53
53
  showDots: z.ZodOptional<z.ZodBoolean>;
54
54
  barRadius: z.ZodOptional<z.ZodNumber>;
@@ -69,9 +69,6 @@ declare const chartSchema: z.ZodObject<{
69
69
  title: z.ZodOptional<z.ZodString>;
70
70
  }, "strip", z.ZodTypeAny, {
71
71
  title?: string | undefined;
72
- height?: number | undefined;
73
- layout?: "horizontal" | "vertical" | undefined;
74
- chartType?: "bar" | "line" | "area" | "scatter" | "pie" | "donut" | undefined;
75
72
  data?: Record<string, unknown>[] | undefined;
76
73
  xKey?: string | undefined;
77
74
  series?: (string | {
@@ -79,12 +76,15 @@ declare const chartSchema: z.ZodObject<{
79
76
  label?: string | undefined;
80
77
  color?: string | undefined;
81
78
  })[] | undefined;
79
+ chartType?: "bar" | "line" | "area" | "scatter" | "pie" | "donut" | undefined;
80
+ height?: number | undefined;
81
+ layout?: "horizontal" | "vertical" | undefined;
82
82
  stacked?: boolean | undefined;
83
83
  yAxis?: {
84
84
  label?: string | undefined;
85
- width?: number | undefined;
86
85
  min?: number | undefined;
87
86
  max?: number | undefined;
87
+ width?: number | undefined;
88
88
  } | undefined;
89
89
  showDots?: boolean | undefined;
90
90
  barRadius?: number | undefined;
@@ -103,9 +103,6 @@ declare const chartSchema: z.ZodObject<{
103
103
  format?: "number" | "currency" | "percent" | undefined;
104
104
  }, {
105
105
  title?: string | undefined;
106
- height?: number | undefined;
107
- layout?: "horizontal" | "vertical" | undefined;
108
- chartType?: "bar" | "line" | "area" | "scatter" | "pie" | "donut" | undefined;
109
106
  data?: Record<string, unknown>[] | undefined;
110
107
  xKey?: string | undefined;
111
108
  series?: (string | {
@@ -113,12 +110,15 @@ declare const chartSchema: z.ZodObject<{
113
110
  label?: string | undefined;
114
111
  color?: string | undefined;
115
112
  })[] | undefined;
113
+ chartType?: "bar" | "line" | "area" | "scatter" | "pie" | "donut" | undefined;
114
+ height?: number | undefined;
115
+ layout?: "horizontal" | "vertical" | undefined;
116
116
  stacked?: boolean | undefined;
117
117
  yAxis?: {
118
118
  label?: string | undefined;
119
- width?: number | undefined;
120
119
  min?: number | undefined;
121
120
  max?: number | undefined;
121
+ width?: number | undefined;
122
122
  } | undefined;
123
123
  showDots?: boolean | undefined;
124
124
  barRadius?: number | undefined;