@adea-ai/ui 0.99.1 → 0.99.3
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.
- package/dist/components/layout/orbit-layout/orbit-layout.d.ts +5 -1
- package/dist/components/layout/orbit-layout/orbit-layout.d.ts.map +1 -1
- package/dist/components/layout/orbit-layout/orbit-layout.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.d.ts +4 -1
- package/dist/components/layout/side-rail/side-rail.d.ts.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +58 -64
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +2 -2
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/motion/presence.d.ts +17 -7
- package/dist/components/motion/presence.d.ts.map +1 -1
- package/dist/components/motion/presence.js.map +1 -1
- package/dist/components/theme/theme-picker.d.ts.map +1 -1
- package/dist/components/theme/theme-picker.js +1 -1
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/theme/theme-provider.d.ts.map +1 -1
- package/dist/components/theme/theme-provider.js +15 -4
- package/dist/components/theme/theme-provider.js.map +1 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.d.ts +2 -2
- package/dist/components/ui/aspect-ratio/aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.js +15 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.js.map +1 -1
- package/dist/components/ui/badge/badge.d.ts +1 -1
- package/dist/components/ui/button/button.d.ts +1 -1
- package/dist/components/ui/calendar/calendar.d.ts.map +1 -1
- package/dist/components/ui/calendar/calendar.js +1 -1
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/card/card.d.ts +2 -2
- package/dist/components/ui/card/card.js +2 -2
- package/dist/components/ui/card/card.js.map +1 -1
- package/dist/components/ui/chart/chart-options.d.ts +50 -0
- package/dist/components/ui/chart/chart-options.d.ts.map +1 -0
- package/dist/components/ui/chart/chart-options.js +178 -0
- package/dist/components/ui/chart/chart-options.js.map +1 -0
- package/dist/components/ui/chart/chart.d.ts +21 -18
- package/dist/components/ui/chart/chart.d.ts.map +1 -1
- package/dist/components/ui/chart/chart.js +175 -155
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/chart/index.js +2 -1
- package/dist/components/ui/context-menu/context-menu.d.ts +8 -0
- package/dist/components/ui/context-menu/context-menu.d.ts.map +1 -1
- package/dist/components/ui/context-menu/context-menu.js +8 -0
- package/dist/components/ui/context-menu/context-menu.js.map +1 -1
- package/dist/components/ui/drawer/drawer.d.ts +8 -1
- package/dist/components/ui/drawer/drawer.d.ts.map +1 -1
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +8 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +8 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/input-otp/input-otp.d.ts.map +1 -1
- package/dist/components/ui/input-otp/input-otp.js +2 -2
- package/dist/components/ui/input-otp/input-otp.js.map +1 -1
- package/dist/components/ui/menubar/menubar.d.ts +8 -0
- package/dist/components/ui/menubar/menubar.d.ts.map +1 -1
- package/dist/components/ui/menubar/menubar.js +8 -0
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts +14 -2
- package/dist/components/ui/navigation-menu/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js +28 -23
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination/pagination.d.ts.map +1 -1
- package/dist/components/ui/pagination/pagination.js +1 -1
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/resizable/resizable.d.ts +0 -12
- package/dist/components/ui/resizable/resizable.d.ts.map +1 -1
- package/dist/components/ui/resizable/resizable.js +43 -9
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/toast/toast.d.ts.map +1 -1
- package/dist/components/ui/toast/toast.js +19 -6
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/lib/cn-tables.generated.js +10 -10
- package/dist/lib/cn-tables.generated.js.map +1 -1
- package/dist/r/chart.json +5 -0
- package/dist/r/registry.json +5 -0
- package/dist/r/src/components/layout/orbit-layout/orbit-layout.tsx +5 -1
- package/dist/r/src/components/layout/side-rail/side-rail.tsx +29 -16
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +2 -2
- package/dist/r/src/components/motion/presence.tsx +17 -7
- package/dist/r/src/components/theme/theme-picker.tsx +5 -1
- package/dist/r/src/components/theme/theme-provider.tsx +19 -9
- package/dist/r/src/components/ui/aspect-ratio/aspect-ratio.tsx +14 -3
- package/dist/r/src/components/ui/calendar/calendar.tsx +6 -1
- package/dist/r/src/components/ui/card/card.tsx +2 -2
- package/dist/r/src/components/ui/chart/chart-options.ts +196 -0
- package/dist/r/src/components/ui/chart/chart.tsx +149 -101
- package/dist/r/src/components/ui/context-menu/context-menu.tsx +8 -0
- package/dist/r/src/components/ui/drawer/drawer.tsx +8 -1
- package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +8 -0
- package/dist/r/src/components/ui/input-otp/input-otp.tsx +14 -2
- package/dist/r/src/components/ui/menubar/menubar.tsx +8 -0
- package/dist/r/src/components/ui/navigation-menu/navigation-menu.tsx +42 -28
- package/dist/r/src/components/ui/pagination/pagination.tsx +8 -1
- package/dist/r/src/components/ui/resizable/resizable.tsx +46 -8
- package/dist/r/src/components/ui/toast/toast.tsx +21 -6
- package/dist/r/src/lib/cn-tables.generated.ts +10 -10
- package/dist/r/src/styles/base.css +4 -1
- package/dist/r/src/styles/theme.css +23 -43
- package/package.json +1 -1
- package/registry.json +5 -0
- package/src/components/layout/orbit-layout/orbit-layout.tsx +5 -1
- package/src/components/layout/side-rail/side-rail.tsx +29 -16
- package/src/components/layout/sidebar-nav/sidebar-nav.tsx +2 -2
- package/src/components/motion/presence.tsx +17 -7
- package/src/components/theme/theme-picker.tsx +5 -1
- package/src/components/theme/theme-provider.tsx +19 -9
- package/src/components/ui/aspect-ratio/aspect-ratio.tsx +14 -3
- package/src/components/ui/calendar/calendar.tsx +6 -1
- package/src/components/ui/card/card.tsx +2 -2
- package/src/components/ui/chart/chart-options.ts +196 -0
- package/src/components/ui/chart/chart.tsx +149 -101
- package/src/components/ui/context-menu/context-menu.tsx +8 -0
- package/src/components/ui/drawer/drawer.tsx +8 -1
- package/src/components/ui/dropdown-menu/dropdown-menu.tsx +8 -0
- package/src/components/ui/input-otp/input-otp.tsx +14 -2
- package/src/components/ui/menubar/menubar.tsx +8 -0
- package/src/components/ui/navigation-menu/navigation-menu.tsx +42 -28
- package/src/components/ui/pagination/pagination.tsx +8 -1
- package/src/components/ui/resizable/resizable.tsx +46 -8
- package/src/components/ui/toast/toast.tsx +21 -6
- package/src/lib/cn-tables.generated.ts +10 -10
- package/src/styles/base.css +4 -1
- package/src/styles/theme.css +23 -43
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { cn } from "../../../lib/utils.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { chartOptions, chartSeriesColors, mergeChartOptions, resolveCssVariables } from "./chart-options.js";
|
|
3
|
+
import { Dynamic, className, createComponent, effect, insert, setStyleProperty, template, use } from "solid-js/web";
|
|
4
|
+
import { For, Show, createSignal, onCleanup, onMount, splitProps } from "solid-js";
|
|
4
5
|
import { Bar, Bubble, Doughnut, Line, Pie, PolarArea, Radar, Scatter } from "solid-chartjs";
|
|
5
6
|
import { ArcElement, BarElement, CategoryScale, Chart, Filler, Legend, LineElement, LinearScale, LogarithmicScale, PointElement, RadialLinearScale, Tooltip } from "chart.js";
|
|
6
7
|
//#region src/components/ui/chart/chart.tsx
|
|
7
|
-
var _tmpl$ = /*#__PURE__*/ template(`<
|
|
8
|
-
var _tmpl$2 = /*#__PURE__*/ template(`<div>`);
|
|
9
|
-
var _tmpl$3 = /*#__PURE__*/ template(`<
|
|
10
|
-
var _tmpl$4 = /*#__PURE__*/ template(`<
|
|
8
|
+
var _tmpl$ = /*#__PURE__*/ template(`<p class="text-xs text-muted-foreground">`);
|
|
9
|
+
var _tmpl$2 = /*#__PURE__*/ template(`<figure><figcaption class="flex items-start justify-between gap-3"><div><h3 class="text-sm font-semibold text-foreground">`);
|
|
10
|
+
var _tmpl$3 = /*#__PURE__*/ template(`<div>`);
|
|
11
|
+
var _tmpl$4 = /*#__PURE__*/ template(`<ul>`);
|
|
12
|
+
var _tmpl$5 = /*#__PURE__*/ template(`<li class="flex items-center gap-1.5 text-2xs text-muted-foreground"><span class="size-2 shrink-0 rounded-full"aria-hidden=true>`);
|
|
11
13
|
/**
|
|
12
14
|
* Chart.
|
|
13
15
|
*
|
|
@@ -36,11 +38,16 @@ var _tmpl$4 = /*#__PURE__*/ template(`<li class="flex items-center gap-1.5 text-
|
|
|
36
38
|
*
|
|
37
39
|
* ## Theming
|
|
38
40
|
*
|
|
39
|
-
* Colours
|
|
40
|
-
* defines,
|
|
41
|
-
* chart follows the accent axis
|
|
42
|
-
* per-chart configuration — and a caller that wants a
|
|
43
|
-
* passes it explicitly
|
|
41
|
+
* Colours come from `--chart-1` through `--chart-5`, which every theme
|
|
42
|
+
* defines, and the grid, ticks and labels from `--border` and
|
|
43
|
+
* `--muted-foreground`. That means a chart follows the accent axis and the
|
|
44
|
+
* appearance with no per-chart configuration — and a caller that wants a
|
|
45
|
+
* specific series colour passes it explicitly, as a colour or as `var(--token)`.
|
|
46
|
+
*
|
|
47
|
+
* A canvas cannot read a custom property, so the options and datasets carry
|
|
48
|
+
* `var(--token)` strings and each chart resolves them against its own element
|
|
49
|
+
* when it renders, and again whenever the root's attributes change — the
|
|
50
|
+
* `.dark` class, `data-accent`, an inline override. See `createThemeResolver`.
|
|
44
51
|
*/
|
|
45
52
|
/**
|
|
46
53
|
* Register a piece with Chart.js. The escape hatch for a caller's own chart type.
|
|
@@ -53,83 +60,66 @@ function registerChartPiece(piece) {
|
|
|
53
60
|
Chart.register(piece);
|
|
54
61
|
}
|
|
55
62
|
Chart.register(CategoryScale, LinearScale, LogarithmicScale, RadialLinearScale, PointElement, LineElement, BarElement, ArcElement, Filler, Tooltip, Legend);
|
|
56
|
-
/** The five series colours, in the order a multi-series chart should use them. */
|
|
57
|
-
var chartSeriesColors = [
|
|
58
|
-
"var(--chart-1)",
|
|
59
|
-
"var(--chart-2)",
|
|
60
|
-
"var(--chart-3)",
|
|
61
|
-
"var(--chart-4)",
|
|
62
|
-
"var(--chart-5)"
|
|
63
|
-
];
|
|
64
63
|
/**
|
|
65
|
-
*
|
|
64
|
+
* One pixel to paint a colour on, shared by every chart.
|
|
66
65
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
66
|
+
* The canvas *paints* `oklch()`, but Chart.js also *parses* colours — to derive a
|
|
67
|
+
* hover shade and to animate between two colours — and its parser reads only
|
|
68
|
+
* rgb, hsl, hex and names. Painting the computed value and reading the pixel
|
|
69
|
+
* back gives the sRGB colour the canvas would have drawn anyway, in a form both
|
|
70
|
+
* understand, whatever syntax a theme uses (`oklch()`, `color-mix()`, …).
|
|
71
71
|
*/
|
|
72
|
-
|
|
72
|
+
var swatch;
|
|
73
|
+
function toCanvasColor(value) {
|
|
74
|
+
if (typeof CSS === "undefined" || !CSS.supports("color", value)) return value;
|
|
75
|
+
if (swatch === void 0) {
|
|
76
|
+
const canvas = document.createElement("canvas");
|
|
77
|
+
canvas.width = 1;
|
|
78
|
+
canvas.height = 1;
|
|
79
|
+
swatch = canvas.getContext("2d", { willReadFrequently: true });
|
|
80
|
+
}
|
|
81
|
+
if (!swatch) return value;
|
|
82
|
+
swatch.globalCompositeOperation = "copy";
|
|
83
|
+
swatch.fillStyle = value;
|
|
84
|
+
swatch.fillRect(0, 0, 1, 1);
|
|
85
|
+
const [r, g, b, a] = swatch.getImageData(0, 0, 1, 1).data;
|
|
86
|
+
return `rgba(${r}, ${g}, ${b}, ${Math.round((a ?? 255) / 255 * 1e3) / 1e3})`;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Resolves `var(--token)` strings against a chart's element, and re-resolves
|
|
90
|
+
* them when the theme changes.
|
|
91
|
+
*
|
|
92
|
+
* The element rather than the root, so a chart inside a subtree with its own
|
|
93
|
+
* inline tokens takes those. The observer watches every attribute on `<html>`,
|
|
94
|
+
* because that is where both applications switch appearance, accent and theme
|
|
95
|
+
* (`.dark`, `data-accent`, `data-theme`, inline variables); a theme axis added
|
|
96
|
+
* later is covered without touching this. It is released with the chart.
|
|
97
|
+
*/
|
|
98
|
+
function createThemeResolver() {
|
|
99
|
+
let element;
|
|
100
|
+
const [revision, invalidate] = createSignal(void 0, { equals: false });
|
|
101
|
+
onMount(() => {
|
|
102
|
+
const observer = new MutationObserver(() => invalidate());
|
|
103
|
+
observer.observe(document.documentElement, { attributes: true });
|
|
104
|
+
onCleanup(() => observer.disconnect());
|
|
105
|
+
});
|
|
73
106
|
return {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
interaction: {
|
|
77
|
-
mode: "nearest",
|
|
78
|
-
intersect: false
|
|
107
|
+
ref: (el) => {
|
|
108
|
+
element = el;
|
|
79
109
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
tooltip: {
|
|
90
|
-
backgroundColor: "var(--popover)",
|
|
91
|
-
titleColor: "var(--popover-foreground)",
|
|
92
|
-
bodyColor: "var(--popover-foreground)",
|
|
93
|
-
borderColor: "var(--border)",
|
|
94
|
-
borderWidth: 1,
|
|
95
|
-
padding: 8,
|
|
96
|
-
cornerRadius: 6,
|
|
97
|
-
displayColors: true,
|
|
98
|
-
boxWidth: 8,
|
|
99
|
-
boxHeight: 8,
|
|
100
|
-
usePointStyle: true,
|
|
101
|
-
titleFont: {
|
|
102
|
-
size: 11,
|
|
103
|
-
weight: 600
|
|
104
|
-
},
|
|
105
|
-
bodyFont: { size: 11 }
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
scales: {
|
|
109
|
-
x: {
|
|
110
|
-
border: { color: "var(--chart-grid)" },
|
|
111
|
-
grid: {
|
|
112
|
-
color: "var(--chart-grid)",
|
|
113
|
-
drawTicks: false
|
|
114
|
-
},
|
|
115
|
-
ticks: {
|
|
116
|
-
color: "var(--chart-axis)",
|
|
117
|
-
font: { size: 10 }
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
y: {
|
|
121
|
-
border: { display: false },
|
|
122
|
-
grid: {
|
|
123
|
-
color: "var(--chart-grid)",
|
|
124
|
-
drawTicks: false
|
|
125
|
-
},
|
|
126
|
-
ticks: {
|
|
127
|
-
color: "var(--chart-axis)",
|
|
128
|
-
font: { size: 10 }
|
|
110
|
+
resolve(value) {
|
|
111
|
+
revision();
|
|
112
|
+
if (!element || typeof getComputedStyle === "undefined") return value;
|
|
113
|
+
const style = getComputedStyle(element);
|
|
114
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
115
|
+
return resolveCssVariables(value, (name) => {
|
|
116
|
+
if (!resolved.has(name)) {
|
|
117
|
+
const raw = style.getPropertyValue(name).trim();
|
|
118
|
+
resolved.set(name, raw ? toCanvasColor(raw) : void 0);
|
|
129
119
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
120
|
+
return resolved.get(name);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
133
123
|
};
|
|
134
124
|
}
|
|
135
125
|
function ChartFrame(props) {
|
|
@@ -141,9 +131,18 @@ function ChartFrame(props) {
|
|
|
141
131
|
"class"
|
|
142
132
|
]);
|
|
143
133
|
return (() => {
|
|
144
|
-
var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild;
|
|
134
|
+
var _el$ = _tmpl$2(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild;
|
|
145
135
|
insert(_el$4, () => local.title);
|
|
146
|
-
insert(_el$3, (
|
|
136
|
+
insert(_el$3, createComponent(Show, {
|
|
137
|
+
get when() {
|
|
138
|
+
return local.description;
|
|
139
|
+
},
|
|
140
|
+
get children() {
|
|
141
|
+
var _el$5 = _tmpl$();
|
|
142
|
+
insert(_el$5, () => local.description);
|
|
143
|
+
return _el$5;
|
|
144
|
+
}
|
|
145
|
+
}), null);
|
|
147
146
|
insert(_el$2, () => local.actions, null);
|
|
148
147
|
insert(_el$, () => local.children, null);
|
|
149
148
|
effect(() => className(_el$, cn("grid gap-3 rounded-lg border border-border bg-card p-4", local.class)));
|
|
@@ -171,127 +170,148 @@ function datasetsFor(series, filled) {
|
|
|
171
170
|
fill: filled
|
|
172
171
|
}));
|
|
173
172
|
}
|
|
174
|
-
function seriesOptions(props, extra) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
y: { stacked: true }
|
|
181
|
-
} } : {},
|
|
182
|
-
...props.options
|
|
183
|
-
});
|
|
173
|
+
function seriesOptions(props, extra, shape = "cartesian") {
|
|
174
|
+
const stacked = props.stacked && shape === "cartesian" ? { scales: {
|
|
175
|
+
x: { stacked: true },
|
|
176
|
+
y: { stacked: true }
|
|
177
|
+
} } : void 0;
|
|
178
|
+
return chartOptions(mergeChartOptions(extra, stacked, props.options), shape);
|
|
184
179
|
}
|
|
185
180
|
/** A line chart. The default for a series over time. */
|
|
186
181
|
function LineChart(props) {
|
|
182
|
+
const theme = createThemeResolver();
|
|
187
183
|
return (() => {
|
|
188
|
-
var _el$
|
|
189
|
-
|
|
184
|
+
var _el$6 = _tmpl$3();
|
|
185
|
+
var _ref$ = theme.ref;
|
|
186
|
+
typeof _ref$ === "function" ? use(_ref$, _el$6) : theme.ref = _el$6;
|
|
187
|
+
insert(_el$6, createComponent(Line, {
|
|
190
188
|
get data() {
|
|
191
|
-
return {
|
|
189
|
+
return theme.resolve({
|
|
192
190
|
labels: [...props.labels],
|
|
193
191
|
datasets: datasetsFor(props.series, props.area ?? false)
|
|
194
|
-
};
|
|
192
|
+
});
|
|
195
193
|
},
|
|
196
194
|
get options() {
|
|
197
|
-
return seriesOptions(props);
|
|
195
|
+
return theme.resolve(seriesOptions(props));
|
|
198
196
|
}
|
|
199
197
|
}));
|
|
200
|
-
effect(() => className(_el$
|
|
201
|
-
return _el$
|
|
198
|
+
effect(() => className(_el$6, cn("h-64", props.class)));
|
|
199
|
+
return _el$6;
|
|
202
200
|
})();
|
|
203
201
|
}
|
|
204
202
|
/** A bar chart. `stacked` for parts of a whole over categories. */
|
|
205
203
|
function BarChart(props) {
|
|
204
|
+
const theme = createThemeResolver();
|
|
206
205
|
return (() => {
|
|
207
|
-
var _el$
|
|
208
|
-
|
|
206
|
+
var _el$7 = _tmpl$3();
|
|
207
|
+
var _ref$2 = theme.ref;
|
|
208
|
+
typeof _ref$2 === "function" ? use(_ref$2, _el$7) : theme.ref = _el$7;
|
|
209
|
+
insert(_el$7, createComponent(Bar, {
|
|
209
210
|
get data() {
|
|
210
|
-
return {
|
|
211
|
+
return theme.resolve({
|
|
211
212
|
labels: [...props.labels],
|
|
212
213
|
datasets: datasetsFor(props.series, true).map((dataset) => ({
|
|
213
214
|
...dataset,
|
|
214
215
|
borderWidth: 0,
|
|
215
216
|
borderRadius: 3
|
|
216
217
|
}))
|
|
217
|
-
};
|
|
218
|
+
});
|
|
218
219
|
},
|
|
219
220
|
get options() {
|
|
220
|
-
return seriesOptions(props, { indexAxis: props.horizontal ? "y" : "x" });
|
|
221
|
+
return theme.resolve(seriesOptions(props, { indexAxis: props.horizontal ? "y" : "x" }));
|
|
221
222
|
}
|
|
222
223
|
}));
|
|
223
|
-
effect(() => className(_el$
|
|
224
|
-
return _el$
|
|
224
|
+
effect(() => className(_el$7, cn("h-64", props.class)));
|
|
225
|
+
return _el$7;
|
|
225
226
|
})();
|
|
226
227
|
}
|
|
227
228
|
/** A scatter plot, for a correlation rather than a series. */
|
|
228
229
|
function ScatterChart(props) {
|
|
230
|
+
const theme = createThemeResolver();
|
|
229
231
|
return (() => {
|
|
230
|
-
var _el$
|
|
231
|
-
|
|
232
|
+
var _el$8 = _tmpl$3();
|
|
233
|
+
var _ref$3 = theme.ref;
|
|
234
|
+
typeof _ref$3 === "function" ? use(_ref$3, _el$8) : theme.ref = _el$8;
|
|
235
|
+
insert(_el$8, createComponent(Scatter, {
|
|
232
236
|
get data() {
|
|
233
|
-
return { datasets: props.series.map((entry, index) => ({
|
|
237
|
+
return theme.resolve({ datasets: props.series.map((entry, index) => ({
|
|
234
238
|
label: entry.label,
|
|
235
239
|
data: entry.data.map((point) => ({ ...point })),
|
|
236
240
|
backgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],
|
|
237
241
|
pointRadius: 3,
|
|
238
242
|
pointHoverRadius: 5
|
|
239
|
-
})) };
|
|
243
|
+
})) });
|
|
240
244
|
},
|
|
241
245
|
get options() {
|
|
242
|
-
return chartOptions(props.options);
|
|
246
|
+
return theme.resolve(chartOptions(props.options));
|
|
243
247
|
}
|
|
244
248
|
}));
|
|
245
|
-
effect(() => className(_el$
|
|
246
|
-
return _el$
|
|
249
|
+
effect(() => className(_el$8, cn("h-64", props.class)));
|
|
250
|
+
return _el$8;
|
|
247
251
|
})();
|
|
248
252
|
}
|
|
249
253
|
/** A bubble chart: scatter with a third dimension carried by the radius. */
|
|
250
254
|
function BubbleChart(props) {
|
|
255
|
+
const theme = createThemeResolver();
|
|
251
256
|
return (() => {
|
|
252
|
-
var _el$
|
|
253
|
-
|
|
257
|
+
var _el$9 = _tmpl$3();
|
|
258
|
+
var _ref$4 = theme.ref;
|
|
259
|
+
typeof _ref$4 === "function" ? use(_ref$4, _el$9) : theme.ref = _el$9;
|
|
260
|
+
insert(_el$9, createComponent(Bubble, {
|
|
254
261
|
get data() {
|
|
255
|
-
return { datasets: props.series.map((entry, index) => ({
|
|
262
|
+
return theme.resolve({ datasets: props.series.map((entry, index) => ({
|
|
256
263
|
label: entry.label,
|
|
257
264
|
data: entry.data.map((point) => ({ ...point })),
|
|
258
265
|
backgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length]
|
|
259
|
-
})) };
|
|
266
|
+
})) });
|
|
260
267
|
},
|
|
261
268
|
get options() {
|
|
262
|
-
return chartOptions(props.options);
|
|
269
|
+
return theme.resolve(chartOptions(props.options));
|
|
263
270
|
}
|
|
264
271
|
}));
|
|
265
|
-
effect(() => className(_el$
|
|
266
|
-
return _el$
|
|
272
|
+
effect(() => className(_el$9, cn("h-64", props.class)));
|
|
273
|
+
return _el$9;
|
|
267
274
|
})();
|
|
268
275
|
}
|
|
269
276
|
/** A radar chart, for a profile across fixed axes. */
|
|
270
277
|
function RadarChart(props) {
|
|
278
|
+
const theme = createThemeResolver();
|
|
271
279
|
return (() => {
|
|
272
|
-
var _el$
|
|
273
|
-
|
|
280
|
+
var _el$0 = _tmpl$3();
|
|
281
|
+
var _ref$5 = theme.ref;
|
|
282
|
+
typeof _ref$5 === "function" ? use(_ref$5, _el$0) : theme.ref = _el$0;
|
|
283
|
+
insert(_el$0, createComponent(Radar, {
|
|
274
284
|
get data() {
|
|
275
|
-
return {
|
|
285
|
+
return theme.resolve({
|
|
276
286
|
labels: [...props.labels],
|
|
277
287
|
datasets: datasetsFor(props.series, true)
|
|
278
|
-
};
|
|
288
|
+
});
|
|
279
289
|
},
|
|
280
290
|
get options() {
|
|
281
|
-
return seriesOptions(props,
|
|
291
|
+
return theme.resolve(seriesOptions(props, void 0, "radial"));
|
|
282
292
|
}
|
|
283
293
|
}));
|
|
284
|
-
effect(() => className(_el$
|
|
285
|
-
return _el$
|
|
294
|
+
effect(() => className(_el$0, cn("h-64", props.class)));
|
|
295
|
+
return _el$0;
|
|
286
296
|
})();
|
|
287
297
|
}
|
|
288
|
-
/**
|
|
298
|
+
/**
|
|
299
|
+
* A polar area chart: radial bars, for a composition.
|
|
300
|
+
*
|
|
301
|
+
* Its scale is left to Chart.js's polar-area defaults (`'none'` rather than
|
|
302
|
+
* `'radial'`): `solid-chartjs` deletes `options.scales.r` for every chart type
|
|
303
|
+
* but radar when it first creates the chart, so radial styling here would apply
|
|
304
|
+
* only after the first theme change — a chart that restyles itself on a toggle.
|
|
305
|
+
*/
|
|
289
306
|
function PolarAreaChart(props) {
|
|
307
|
+
const theme = createThemeResolver();
|
|
290
308
|
return (() => {
|
|
291
|
-
var _el$
|
|
292
|
-
|
|
309
|
+
var _el$1 = _tmpl$3();
|
|
310
|
+
var _ref$6 = theme.ref;
|
|
311
|
+
typeof _ref$6 === "function" ? use(_ref$6, _el$1) : theme.ref = _el$1;
|
|
312
|
+
insert(_el$1, createComponent(PolarArea, {
|
|
293
313
|
get data() {
|
|
294
|
-
return {
|
|
314
|
+
return theme.resolve({
|
|
295
315
|
labels: [...props.labels],
|
|
296
316
|
datasets: [{
|
|
297
317
|
data: [...props.data],
|
|
@@ -299,14 +319,14 @@ function PolarAreaChart(props) {
|
|
|
299
319
|
borderColor: "var(--card)",
|
|
300
320
|
borderWidth: 2
|
|
301
321
|
}]
|
|
302
|
-
};
|
|
322
|
+
});
|
|
303
323
|
},
|
|
304
324
|
get options() {
|
|
305
|
-
return chartOptions(props.options);
|
|
325
|
+
return theme.resolve(chartOptions(props.options, "none"));
|
|
306
326
|
}
|
|
307
327
|
}));
|
|
308
|
-
effect(() => className(_el$
|
|
309
|
-
return _el$
|
|
328
|
+
effect(() => className(_el$1, cn("h-64", props.class)));
|
|
329
|
+
return _el$1;
|
|
310
330
|
})();
|
|
311
331
|
}
|
|
312
332
|
/**
|
|
@@ -319,15 +339,18 @@ function PolarAreaChart(props) {
|
|
|
319
339
|
* past that, the smallest slices become unreadable and their labels collide.
|
|
320
340
|
*/
|
|
321
341
|
function DonutChart(props) {
|
|
342
|
+
const theme = createThemeResolver();
|
|
322
343
|
const component = () => props.cutout === 0 ? Pie : Doughnut;
|
|
323
344
|
return (() => {
|
|
324
|
-
var _el$
|
|
325
|
-
|
|
345
|
+
var _el$10 = _tmpl$3();
|
|
346
|
+
var _ref$7 = theme.ref;
|
|
347
|
+
typeof _ref$7 === "function" ? use(_ref$7, _el$10) : theme.ref = _el$10;
|
|
348
|
+
insert(_el$10, createComponent(Dynamic, {
|
|
326
349
|
get component() {
|
|
327
350
|
return component();
|
|
328
351
|
},
|
|
329
352
|
get data() {
|
|
330
|
-
return {
|
|
353
|
+
return theme.resolve({
|
|
331
354
|
labels: [...props.labels],
|
|
332
355
|
datasets: [{
|
|
333
356
|
data: [...props.data],
|
|
@@ -335,36 +358,33 @@ function DonutChart(props) {
|
|
|
335
358
|
borderColor: "var(--card)",
|
|
336
359
|
borderWidth: 2
|
|
337
360
|
}]
|
|
338
|
-
};
|
|
361
|
+
});
|
|
339
362
|
},
|
|
340
363
|
get options() {
|
|
341
|
-
return chartOptions({
|
|
342
|
-
...props.options,
|
|
343
|
-
...props.cutout === 0 ? {} : { cutout: `${props.cutout ?? 60}%` }
|
|
344
|
-
});
|
|
364
|
+
return theme.resolve(chartOptions(mergeChartOptions(props.cutout === 0 ? void 0 : { cutout: `${props.cutout ?? 60}%` }, props.options), "none"));
|
|
345
365
|
}
|
|
346
366
|
}));
|
|
347
|
-
effect(() => className(_el$
|
|
348
|
-
return _el$
|
|
367
|
+
effect(() => className(_el$10, cn("h-64", props.class)));
|
|
368
|
+
return _el$10;
|
|
349
369
|
})();
|
|
350
370
|
}
|
|
351
371
|
/** A legend built from the same five colours, for a chart whose legend is elsewhere. */
|
|
352
372
|
function ChartLegend(props) {
|
|
353
373
|
return (() => {
|
|
354
|
-
var _el$
|
|
355
|
-
insert(_el$
|
|
374
|
+
var _el$11 = _tmpl$4();
|
|
375
|
+
insert(_el$11, createComponent(For, {
|
|
356
376
|
get each() {
|
|
357
377
|
return props.series;
|
|
358
378
|
},
|
|
359
379
|
children: (entry, index) => (() => {
|
|
360
|
-
var _el$
|
|
361
|
-
insert(_el$
|
|
362
|
-
effect((_$p) => setStyleProperty(_el$
|
|
363
|
-
return _el$
|
|
380
|
+
var _el$12 = _tmpl$5(), _el$13 = _el$12.firstChild;
|
|
381
|
+
insert(_el$12, () => entry.label, null);
|
|
382
|
+
effect((_$p) => setStyleProperty(_el$13, "background", entry.color ?? chartSeriesColors[index() % chartSeriesColors.length]));
|
|
383
|
+
return _el$12;
|
|
364
384
|
})()
|
|
365
385
|
}));
|
|
366
|
-
effect(() => className(_el$
|
|
367
|
-
return _el$
|
|
386
|
+
effect(() => className(_el$11, cn("flex flex-wrap items-center gap-x-3 gap-y-1", props.class)));
|
|
387
|
+
return _el$11;
|
|
368
388
|
})();
|
|
369
389
|
}
|
|
370
390
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.js","names":["For","splitProps","JSX","Dynamic","Bar","Bubble","Doughnut","Line","Pie","PolarArea","Radar","Scatter","Chart","ChartJs","ArcElement","BarElement","CategoryScale","Filler","Legend","LineElement","LinearScale","LogarithmicScale","PointElement","RadialLinearScale","Tooltip","ChartTooltip","ChartOptions","ChartType","cn","registerChartPiece","piece","Parameters","register","chartSeriesColors","const","chartOptions","overrides","responsive","maintainAspectRatio","interaction","mode","intersect","plugins","legend","labels","color","boxWidth","boxHeight","usePointStyle","pointStyle","font","size","tooltip","backgroundColor","titleColor","bodyColor","borderColor","borderWidth","padding","cornerRadius","displayColors","titleFont","weight","bodyFont","scales","x","border","grid","drawTicks","ticks","y","display","ChartFrameProps","title","description","actions","Element","children","class","ChartFrame","props","local","_el$","_tmpl$","_el$2","firstChild","_el$3","_el$4","_$insert","_$effect","_$className","SeriesChartProps","series","label","data","options","stacked","datasetsFor","filled","map","entry","index","length","pointBackgroundColor","pointRadius","pointHoverRadius","tension","fill","seriesOptions","extra","LineChart","area","_el$5","_tmpl$2","_$createComponent","datasets","BarChart","horizontal","_el$6","dataset","borderRadius","indexAxis","ScatterChart","_el$7","point","BubbleChart","r","_el$8","RadarChart","_el$9","PolarAreaChart","_el$0","DonutChart","cutout","component","_el$1","_","ChartLegend","_el$10","_tmpl$3","each","_el$11","_tmpl$4","_el$12","_$p","_$setStyleProperty","ChartJs","ChartTooltip","_$className","_$createComponent","_$setStyleProperty"],"sources":["../../../../src/components/ui/chart/chart.tsx"],"sourcesContent":["import { For, splitProps, type JSX } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { Bar, Bubble, Doughnut, Line, Pie, PolarArea, Radar, Scatter } from 'solid-chartjs'\nimport {\n Chart as ChartJs,\n ArcElement,\n BarElement,\n CategoryScale,\n Filler,\n Legend,\n LineElement,\n LinearScale,\n LogarithmicScale,\n PointElement,\n RadialLinearScale,\n Tooltip as ChartTooltip,\n} from 'chart.js'\nimport type { ChartOptions, ChartType } from 'chart.js'\nimport { cn } from '#lib/utils'\n\n/**\n * Chart.\n *\n * A thin wrapper over Chart.js, themed through the same CSS custom properties as\n * everything else. The wrapper is thin on purpose: a design system's job here is\n * to make a chart *look like the rest of the application* — the palette, the\n * type scale, the tooltip surface, the grid lines — and not to re-implement\n * scales and axes, which is where a hand-rolled chart goes wrong.\n *\n * ## Registration, and why it is here rather than left to the caller\n *\n * Chart.js is tree-shakeable through explicit registration: nothing is bundled\n * until a controller, a scale or a plugin is registered. That is the whole reason\n * it was chosen over a batteries-included charting library, and it only pays off\n * if the registrations are scoped to what a component actually uses.\n *\n * This module registers the **shared** pieces once — scales, elements, tooltip,\n * legend, filler — and nothing else. The controllers are imported per component\n * so a `LineChart` does not carry the radar controller, and a consumer that\n * imports only `LineChart` gets only that. Measured: see the story for the\n * per-component figures the tree-shaking gate publishes.\n *\n * A caller with a chart type this file does not export registers its own\n * controller with `registerChartPiece`, which is the escape hatch rather than a\n * reason to widen the registration above.\n *\n * ## Theming\n *\n * Colours resolve from `--chart-1` through `--chart-5`, which every theme\n * defines, plus `--chart-grid`, `--chart-axis` and `--chart-label`. That means a\n * chart follows the accent axis, the appearance, and the font axis with no\n * per-chart configuration — and a caller that wants a specific series colour\n * passes it explicitly rather than reaching into the theme.\n */\n\n/**\n * Register a piece with Chart.js. The escape hatch for a caller's own chart type.\n *\n * `solid-chartjs` re-exports the typed components but not the registry, so\n * registration comes from `chart.js` itself — which is also the honest place for\n * it, since the registry is Chart.js's global.\n */\nexport function registerChartPiece(piece: Parameters<typeof ChartJs.register>[number]): void {\n ChartJs.register(piece)\n}\n\nChartJs.register(\n CategoryScale,\n LinearScale,\n LogarithmicScale,\n RadialLinearScale,\n PointElement,\n LineElement,\n BarElement,\n ArcElement,\n Filler,\n ChartTooltip,\n Legend\n)\n\n/** The five series colours, in the order a multi-series chart should use them. */\nexport const chartSeriesColors = [\n 'var(--chart-1)',\n 'var(--chart-2)',\n 'var(--chart-3)',\n 'var(--chart-4)',\n 'var(--chart-5)',\n] as const\n\n/**\n * The theme's defaults as Chart.js options.\n *\n * Exported so a caller can spread it and change one thing, rather than\n * restating every colour. Everything a chart draws that is not data — grid,\n * ticks, legend, tooltip — is decided here once, which is what makes two charts\n * in one application look like they came from the same place.\n */\nexport function chartOptions(overrides?: ChartOptions): ChartOptions {\n return {\n responsive: true,\n maintainAspectRatio: false,\n interaction: { mode: 'nearest', intersect: false },\n plugins: {\n legend: {\n labels: {\n color: 'var(--chart-label)',\n boxWidth: 8,\n boxHeight: 8,\n usePointStyle: true,\n pointStyle: 'circle',\n font: { size: 11 },\n },\n },\n tooltip: {\n backgroundColor: 'var(--popover)',\n titleColor: 'var(--popover-foreground)',\n bodyColor: 'var(--popover-foreground)',\n borderColor: 'var(--border)',\n borderWidth: 1,\n padding: 8,\n cornerRadius: 6,\n displayColors: true,\n boxWidth: 8,\n boxHeight: 8,\n usePointStyle: true,\n titleFont: { size: 11, weight: 600 },\n bodyFont: { size: 11 },\n },\n },\n scales: {\n x: {\n border: { color: 'var(--chart-grid)' },\n grid: { color: 'var(--chart-grid)', drawTicks: false },\n ticks: { color: 'var(--chart-axis)', font: { size: 10 } },\n },\n y: {\n border: { display: false },\n grid: { color: 'var(--chart-grid)', drawTicks: false },\n ticks: { color: 'var(--chart-axis)', font: { size: 10 } },\n },\n },\n ...overrides,\n }\n}\n\n/** A chart's frame: a bordered surface with a title and an optional description. */\nexport type ChartFrameProps = {\n /** The chart's title. Required — a chart with no name is not readable. */\n title: string\n /** What the chart shows. Announced to assistive technology, and drawn. */\n description?: string\n /** Trailing controls. */\n actions?: JSX.Element\n children: JSX.Element\n class?: string\n}\n\nexport function ChartFrame(props: ChartFrameProps) {\n const [local] = splitProps(props, ['title', 'description', 'actions', 'children', 'class'])\n\n return (\n <figure class={cn('grid gap-3 rounded-lg border border-border bg-card p-4', local.class)}>\n <figcaption class=\"flex items-start justify-between gap-3\">\n <div>\n <h3 class=\"text-sm font-semibold text-foreground\">{local.title}</h3>\n {local.description}\n </div>\n {local.actions}\n </figcaption>\n {local.children}\n </figure>\n )\n}\n\ntype SeriesChartProps = {\n /** The category labels along the axis. */\n labels: readonly string[]\n /** One entry per series. `data` is aligned to `labels`. */\n series: readonly { label: string; data: readonly number[]; color?: string }[]\n /** Chart.js options, merged over the theme's defaults. */\n options?: ChartOptions\n /** Stack the series. */\n stacked?: boolean\n class?: string\n}\n\n/**\n * The data as Chart.js datasets, with the theme's colours applied in order and\n * the series' own colour winning when it has one.\n *\n * `fill: false` and a 2px border are deliberate: a filled line chart is a\n * different chart, and a 1px line at a 12px label size reads as a grid line.\n */\nfunction datasetsFor(series: SeriesChartProps['series'], filled: boolean) {\n return series.map((entry, index) => ({\n label: entry.label,\n data: [...entry.data],\n borderColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n backgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n pointBackgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n borderWidth: 2,\n pointRadius: 0,\n pointHoverRadius: 4,\n tension: 0.3,\n fill: filled,\n }))\n}\n\nfunction seriesOptions(props: SeriesChartProps, extra?: ChartOptions): ChartOptions {\n return chartOptions({\n ...extra,\n ...(props.stacked\n ? { scales: { ...extra?.scales, x: { stacked: true }, y: { stacked: true } } }\n : {}),\n ...props.options,\n })\n}\n\n/** A line chart. The default for a series over time. */\nexport function LineChart(props: SeriesChartProps & { area?: boolean }) {\n return (\n <div class={cn('h-64', props.class)}>\n <Line\n data={{\n labels: [...props.labels],\n datasets: datasetsFor(props.series, props.area ?? false),\n }}\n options={seriesOptions(props)}\n />\n </div>\n )\n}\n\n/** A bar chart. `stacked` for parts of a whole over categories. */\nexport function BarChart(props: SeriesChartProps & { horizontal?: boolean }) {\n return (\n <div class={cn('h-64', props.class)}>\n <Bar\n data={{\n labels: [...props.labels],\n datasets: datasetsFor(props.series, true).map((dataset) => ({\n ...dataset,\n borderWidth: 0,\n borderRadius: 3,\n })),\n }}\n options={seriesOptions(props, { indexAxis: props.horizontal ? 'y' : 'x' })}\n />\n </div>\n )\n}\n\n/** A scatter plot, for a correlation rather than a series. */\nexport function ScatterChart(props: {\n series: readonly { label: string; data: readonly { x: number; y: number }[]; color?: string }[]\n options?: ChartOptions\n class?: string\n}) {\n return (\n <div class={cn('h-64', props.class)}>\n <Scatter\n data={{\n datasets: props.series.map((entry, index) => ({\n label: entry.label,\n data: entry.data.map((point) => ({ ...point })),\n backgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n pointRadius: 3,\n pointHoverRadius: 5,\n })),\n }}\n options={chartOptions(props.options)}\n />\n </div>\n )\n}\n\n/** A bubble chart: scatter with a third dimension carried by the radius. */\nexport function BubbleChart(props: {\n series: readonly {\n label: string\n data: readonly { x: number; y: number; r: number }[]\n color?: string\n }[]\n options?: ChartOptions\n class?: string\n}) {\n return (\n <div class={cn('h-64', props.class)}>\n <Bubble\n data={{\n datasets: props.series.map((entry, index) => ({\n label: entry.label,\n data: entry.data.map((point) => ({ ...point })),\n backgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n })),\n }}\n options={chartOptions(props.options)}\n />\n </div>\n )\n}\n\n/** A radar chart, for a profile across fixed axes. */\nexport function RadarChart(props: SeriesChartProps) {\n return (\n <div class={cn('h-64', props.class)}>\n <Radar\n data={{ labels: [...props.labels], datasets: datasetsFor(props.series, true) }}\n options={seriesOptions(props, { scales: { r: { grid: { color: 'var(--chart-grid)' } } } })}\n />\n </div>\n )\n}\n\n/** A polar area chart: radial bars, for a composition. */\nexport function PolarAreaChart(props: {\n labels: readonly string[]\n data: readonly number[]\n options?: ChartOptions\n class?: string\n}) {\n return (\n <div class={cn('h-64', props.class)}>\n <PolarArea\n data={{\n labels: [...props.labels],\n datasets: [\n {\n data: [...props.data],\n backgroundColor: [...chartSeriesColors],\n borderColor: 'var(--card)',\n borderWidth: 2,\n },\n ],\n }}\n options={chartOptions(props.options)}\n />\n </div>\n )\n}\n\n/**\n * A doughnut or a pie, for a composition with few enough slices to name.\n *\n * Both are one component because the only difference is the hole, and a caller\n * choosing between them is choosing a ratio rather than a chart. `cutout` is the\n * hole's share of the radius: 0 is a pie, 60% is the doughnut most dashboards\n * mean. A composition with more than about six slices should be a bar chart —\n * past that, the smallest slices become unreadable and their labels collide.\n */\nexport function DonutChart(props: {\n labels: readonly string[]\n data: readonly number[]\n /** The hole, as a percentage of the radius. 0 for a pie. */\n cutout?: number\n options?: ChartOptions\n class?: string\n}) {\n // `Dynamic` rather than a local component accessor: Solid's JSX types require\n // a component reference, and an accessor returning one is a call in disguise.\n const component = () => (props.cutout === 0 ? Pie : Doughnut)\n return (\n <div class={cn('h-64', props.class)}>\n <Dynamic\n component={component()}\n data={{\n labels: [...props.labels],\n datasets: [\n {\n data: [...props.data],\n backgroundColor: props.labels.map(\n (_, index) => chartSeriesColors[index % chartSeriesColors.length]\n ),\n borderColor: 'var(--card)',\n borderWidth: 2,\n },\n ],\n }}\n options={chartOptions({\n ...props.options,\n ...(props.cutout === 0 ? {} : { cutout: `${props.cutout ?? 60}%` }),\n })}\n />\n </div>\n )\n}\n\n/** A legend built from the same five colours, for a chart whose legend is elsewhere. */\nexport function ChartLegend(props: {\n series: readonly { label: string; color?: string }[]\n class?: string\n}) {\n return (\n <ul class={cn('flex flex-wrap items-center gap-x-3 gap-y-1', props.class)}>\n <For each={props.series}>\n {(entry, index) => (\n <li class=\"flex items-center gap-1.5 text-2xs text-muted-foreground\">\n <span\n class=\"size-2 shrink-0 rounded-full\"\n style={{\n background: entry.color ?? chartSeriesColors[index() % chartSeriesColors.length],\n }}\n aria-hidden=\"true\"\n />\n {entry.label}\n </li>\n )}\n </For>\n </ul>\n )\n}\n\nexport type { ChartType, ChartOptions }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB6B,mBAAmBC,OAA0D;CAC3FjB,MAAQmB,SAASF,KAAK;AACxB;AAEAjB,MAAQmB,SACNhB,eACAI,aACAC,kBACAE,mBACAD,cACAH,aACAJ,YACAD,YACAG,QACAQ,SACAP,MACF;;AAGA,IAAae,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;AAAgB;;;;;;;;;AAWlB,SAAgBE,aAAaC,WAAwC;CACnE,OAAO;EACLC,YAAY;EACZC,qBAAqB;EACrBC,aAAa;GAAEC,MAAM;GAAWC,WAAW;EAAM;EACjDC,SAAS;GACPC,QAAQ,EACNC,QAAQ;IACNC,OAAO;IACPC,UAAU;IACVC,WAAW;IACXC,eAAe;IACfC,YAAY;IACZC,MAAM,EAAEC,MAAM,GAAG;GACnB,EACF;GACAC,SAAS;IACPC,iBAAiB;IACjBC,YAAY;IACZC,WAAW;IACXC,aAAa;IACbC,aAAa;IACbC,SAAS;IACTC,cAAc;IACdC,eAAe;IACfd,UAAU;IACVC,WAAW;IACXC,eAAe;IACfa,WAAW;KAAEV,MAAM;KAAIW,QAAQ;IAAI;IACnCC,UAAU,EAAEZ,MAAM,GAAG;GACvB;EACF;EACAa,QAAQ;GACNC,GAAG;IACDC,QAAQ,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ic","Bar","Bubble","Doughnut","Line","Pie","PolarArea","Radar","Scatter","Chart","ChartJs","ArcElement","BarElement","CategoryScale","Filler","Legend","LineElement","LinearScale","LogarithmicScale","PointElement","RadialLinearScale","Tooltip","ChartTooltip","ChartOptions","ChartType","cn","chartOptions","chartSeriesColors","mergeChartOptions","resolveCssVariables","ChartScaleShape","registerChartPiece","piece","Parameters","register","swatch","CanvasRenderingContext2D","toCanvasColor","value","CSS","supports","undefined","canvas","document","createElement","width","height","getContext","willReadFrequently","globalCompositeOperation","fillStyle","fillRect","r","g","b","a","getImageData","data","Math","round","createThemeResolver","element","HTMLElement","revision","invalidate","equals","observer","MutationObserver","observe","documentElement","attributes","disconnect","ref","el","resolve","T","getComputedStyle","style","resolved","Map","name","has","raw","getPropertyValue","trim","set","get","ChartFrameProps","title","description","actions","Element","children","class","ChartFrame","props","local","_el$","_tmpl$2","_el$2","firstChild","_el$3","_el$4","_$insert","_$createComponent","when","_el$5","_tmpl$","_$effect","_$className","SeriesChartProps","labels","series","label","color","options","stacked","datasetsFor","filled","map","entry","index","borderColor","length","backgroundColor","pointBackgroundColor","borderWidth","pointRadius","pointHoverRadius","tension","fill","seriesOptions","extra","shape","scales","x","y","LineChart","area","theme","_el$6","_tmpl$3","_ref$","_$use","datasets","BarChart","horizontal","_el$7","_ref$2","dataset","borderRadius","indexAxis","ScatterChart","_el$8","_ref$3","point","BubbleChart","_el$9","_ref$4","RadarChart","_el$0","_ref$5","PolarAreaChart","_el$1","_ref$6","DonutChart","cutout","component","_el$10","_ref$7","_","ChartLegend","_el$11","_tmpl$4","each","_el$12","_tmpl$5","_el$13","_$p","_$setStyleProperty","ChartJs","ChartTooltip","_$createComponent","_$className","_$use","_$setStyleProperty"],"sources":["../../../../src/components/ui/chart/chart.tsx"],"sourcesContent":["import { For, Show, createSignal, onCleanup, onMount, splitProps, type JSX } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { Bar, Bubble, Doughnut, Line, Pie, PolarArea, Radar, Scatter } from 'solid-chartjs'\nimport {\n Chart as ChartJs,\n ArcElement,\n BarElement,\n CategoryScale,\n Filler,\n Legend,\n LineElement,\n LinearScale,\n LogarithmicScale,\n PointElement,\n RadialLinearScale,\n Tooltip as ChartTooltip,\n} from 'chart.js'\nimport type { ChartOptions, ChartType } from 'chart.js'\nimport { cn } from '#lib/utils'\nimport {\n chartOptions,\n chartSeriesColors,\n mergeChartOptions,\n resolveCssVariables,\n type ChartScaleShape,\n} from './chart-options'\n\n/**\n * Chart.\n *\n * A thin wrapper over Chart.js, themed through the same CSS custom properties as\n * everything else. The wrapper is thin on purpose: a design system's job here is\n * to make a chart *look like the rest of the application* — the palette, the\n * type scale, the tooltip surface, the grid lines — and not to re-implement\n * scales and axes, which is where a hand-rolled chart goes wrong.\n *\n * ## Registration, and why it is here rather than left to the caller\n *\n * Chart.js is tree-shakeable through explicit registration: nothing is bundled\n * until a controller, a scale or a plugin is registered. That is the whole reason\n * it was chosen over a batteries-included charting library, and it only pays off\n * if the registrations are scoped to what a component actually uses.\n *\n * This module registers the **shared** pieces once — scales, elements, tooltip,\n * legend, filler — and nothing else. The controllers are imported per component\n * so a `LineChart` does not carry the radar controller, and a consumer that\n * imports only `LineChart` gets only that. Measured: see the story for the\n * per-component figures the tree-shaking gate publishes.\n *\n * A caller with a chart type this file does not export registers its own\n * controller with `registerChartPiece`, which is the escape hatch rather than a\n * reason to widen the registration above.\n *\n * ## Theming\n *\n * Colours come from `--chart-1` through `--chart-5`, which every theme\n * defines, and the grid, ticks and labels from `--border` and\n * `--muted-foreground`. That means a chart follows the accent axis and the\n * appearance with no per-chart configuration — and a caller that wants a\n * specific series colour passes it explicitly, as a colour or as `var(--token)`.\n *\n * A canvas cannot read a custom property, so the options and datasets carry\n * `var(--token)` strings and each chart resolves them against its own element\n * when it renders, and again whenever the root's attributes change — the\n * `.dark` class, `data-accent`, an inline override. See `createThemeResolver`.\n */\n\n/**\n * Register a piece with Chart.js. The escape hatch for a caller's own chart type.\n *\n * `solid-chartjs` re-exports the typed components but not the registry, so\n * registration comes from `chart.js` itself — which is also the honest place for\n * it, since the registry is Chart.js's global.\n */\nexport function registerChartPiece(piece: Parameters<typeof ChartJs.register>[number]): void {\n ChartJs.register(piece)\n}\n\nChartJs.register(\n CategoryScale,\n LinearScale,\n LogarithmicScale,\n RadialLinearScale,\n PointElement,\n LineElement,\n BarElement,\n ArcElement,\n Filler,\n ChartTooltip,\n Legend\n)\n\nexport { chartOptions, chartSeriesColors }\n\n/**\n * One pixel to paint a colour on, shared by every chart.\n *\n * The canvas *paints* `oklch()`, but Chart.js also *parses* colours — to derive a\n * hover shade and to animate between two colours — and its parser reads only\n * rgb, hsl, hex and names. Painting the computed value and reading the pixel\n * back gives the sRGB colour the canvas would have drawn anyway, in a form both\n * understand, whatever syntax a theme uses (`oklch()`, `color-mix()`, …).\n */\nlet swatch: CanvasRenderingContext2D | null | undefined\n\nfunction toCanvasColor(value: string): string {\n if (typeof CSS === 'undefined' || !CSS.supports('color', value)) return value\n if (swatch === undefined) {\n const canvas = document.createElement('canvas')\n canvas.width = 1\n canvas.height = 1\n swatch = canvas.getContext('2d', { willReadFrequently: true })\n }\n if (!swatch) return value\n swatch.globalCompositeOperation = 'copy'\n swatch.fillStyle = value\n swatch.fillRect(0, 0, 1, 1)\n const [r, g, b, a] = swatch.getImageData(0, 0, 1, 1).data\n return `rgba(${r}, ${g}, ${b}, ${Math.round(((a ?? 255) / 255) * 1000) / 1000})`\n}\n\n/**\n * Resolves `var(--token)` strings against a chart's element, and re-resolves\n * them when the theme changes.\n *\n * The element rather than the root, so a chart inside a subtree with its own\n * inline tokens takes those. The observer watches every attribute on `<html>`,\n * because that is where both applications switch appearance, accent and theme\n * (`.dark`, `data-accent`, `data-theme`, inline variables); a theme axis added\n * later is covered without touching this. It is released with the chart.\n */\nfunction createThemeResolver() {\n let element: HTMLElement | undefined\n const [revision, invalidate] = createSignal(undefined, { equals: false })\n\n onMount(() => {\n const observer = new MutationObserver(() => invalidate())\n observer.observe(document.documentElement, { attributes: true })\n onCleanup(() => observer.disconnect())\n })\n\n return {\n ref: (el: HTMLElement) => {\n element = el\n },\n resolve<T>(value: T): T {\n revision()\n if (!element || typeof getComputedStyle === 'undefined') return value\n const style = getComputedStyle(element)\n const resolved = new Map<string, string | undefined>()\n return resolveCssVariables(value, (name) => {\n if (!resolved.has(name)) {\n const raw = style.getPropertyValue(name).trim()\n resolved.set(name, raw ? toCanvasColor(raw) : undefined)\n }\n return resolved.get(name)\n })\n },\n }\n}\n\n/** A chart's frame: a bordered surface with a title and an optional description. */\nexport type ChartFrameProps = {\n /** The chart's title. Required — a chart with no name is not readable. */\n title: string\n /** What the chart shows. Announced to assistive technology, and drawn. */\n description?: string\n /** Trailing controls. */\n actions?: JSX.Element\n children: JSX.Element\n class?: string\n}\n\nexport function ChartFrame(props: ChartFrameProps) {\n const [local] = splitProps(props, ['title', 'description', 'actions', 'children', 'class'])\n\n return (\n <figure class={cn('grid gap-3 rounded-lg border border-border bg-card p-4', local.class)}>\n <figcaption class=\"flex items-start justify-between gap-3\">\n <div>\n <h3 class=\"text-sm font-semibold text-foreground\">{local.title}</h3>\n <Show when={local.description}>\n <p class=\"text-xs text-muted-foreground\">{local.description}</p>\n </Show>\n </div>\n {local.actions}\n </figcaption>\n {local.children}\n </figure>\n )\n}\n\ntype SeriesChartProps = {\n /** The category labels along the axis. */\n labels: readonly string[]\n /** One entry per series. `data` is aligned to `labels`. */\n series: readonly { label: string; data: readonly number[]; color?: string }[]\n /** Chart.js options, merged deeply over the theme's defaults. */\n options?: ChartOptions\n /** Stack the series. */\n stacked?: boolean\n class?: string\n}\n\n/**\n * The data as Chart.js datasets, with the theme's colours applied in order and\n * the series' own colour winning when it has one.\n *\n * `fill: false` and a 2px border are deliberate: a filled line chart is a\n * different chart, and a 1px line at a 12px label size reads as a grid line.\n */\nfunction datasetsFor(series: SeriesChartProps['series'], filled: boolean) {\n return series.map((entry, index) => ({\n label: entry.label,\n data: [...entry.data],\n borderColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n backgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n pointBackgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n borderWidth: 2,\n pointRadius: 0,\n pointHoverRadius: 4,\n tension: 0.3,\n fill: filled,\n }))\n}\n\nfunction seriesOptions(\n props: SeriesChartProps,\n extra?: ChartOptions,\n shape: ChartScaleShape = 'cartesian'\n): ChartOptions {\n // Stacking is a cartesian idea; a radar has no x or y to stack, and naming\n // them would make Chart.js draw them.\n const stacked =\n props.stacked && shape === 'cartesian'\n ? { scales: { x: { stacked: true }, y: { stacked: true } } }\n : undefined\n return chartOptions(mergeChartOptions(extra, stacked, props.options), shape)\n}\n\n/** A line chart. The default for a series over time. */\nexport function LineChart(props: SeriesChartProps & { area?: boolean }) {\n const theme = createThemeResolver()\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Line\n data={theme.resolve({\n labels: [...props.labels],\n datasets: datasetsFor(props.series, props.area ?? false),\n })}\n options={theme.resolve(seriesOptions(props))}\n />\n </div>\n )\n}\n\n/** A bar chart. `stacked` for parts of a whole over categories. */\nexport function BarChart(props: SeriesChartProps & { horizontal?: boolean }) {\n const theme = createThemeResolver()\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Bar\n data={theme.resolve({\n labels: [...props.labels],\n datasets: datasetsFor(props.series, true).map((dataset) => ({\n ...dataset,\n borderWidth: 0,\n borderRadius: 3,\n })),\n })}\n options={theme.resolve(seriesOptions(props, { indexAxis: props.horizontal ? 'y' : 'x' }))}\n />\n </div>\n )\n}\n\n/** A scatter plot, for a correlation rather than a series. */\nexport function ScatterChart(props: {\n series: readonly { label: string; data: readonly { x: number; y: number }[]; color?: string }[]\n options?: ChartOptions\n class?: string\n}) {\n const theme = createThemeResolver()\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Scatter\n data={theme.resolve({\n datasets: props.series.map((entry, index) => ({\n label: entry.label,\n data: entry.data.map((point) => ({ ...point })),\n backgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n pointRadius: 3,\n pointHoverRadius: 5,\n })),\n })}\n options={theme.resolve(chartOptions(props.options))}\n />\n </div>\n )\n}\n\n/** A bubble chart: scatter with a third dimension carried by the radius. */\nexport function BubbleChart(props: {\n series: readonly {\n label: string\n data: readonly { x: number; y: number; r: number }[]\n color?: string\n }[]\n options?: ChartOptions\n class?: string\n}) {\n const theme = createThemeResolver()\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Bubble\n data={theme.resolve({\n datasets: props.series.map((entry, index) => ({\n label: entry.label,\n data: entry.data.map((point) => ({ ...point })),\n backgroundColor: entry.color ?? chartSeriesColors[index % chartSeriesColors.length],\n })),\n })}\n options={theme.resolve(chartOptions(props.options))}\n />\n </div>\n )\n}\n\n/** A radar chart, for a profile across fixed axes. */\nexport function RadarChart(props: SeriesChartProps) {\n const theme = createThemeResolver()\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Radar\n data={theme.resolve({\n labels: [...props.labels],\n datasets: datasetsFor(props.series, true),\n })}\n options={theme.resolve(seriesOptions(props, undefined, 'radial'))}\n />\n </div>\n )\n}\n\n/**\n * A polar area chart: radial bars, for a composition.\n *\n * Its scale is left to Chart.js's polar-area defaults (`'none'` rather than\n * `'radial'`): `solid-chartjs` deletes `options.scales.r` for every chart type\n * but radar when it first creates the chart, so radial styling here would apply\n * only after the first theme change — a chart that restyles itself on a toggle.\n */\nexport function PolarAreaChart(props: {\n labels: readonly string[]\n data: readonly number[]\n options?: ChartOptions\n class?: string\n}) {\n const theme = createThemeResolver()\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <PolarArea\n data={theme.resolve({\n labels: [...props.labels],\n datasets: [\n {\n data: [...props.data],\n backgroundColor: [...chartSeriesColors],\n borderColor: 'var(--card)',\n borderWidth: 2,\n },\n ],\n })}\n options={theme.resolve(chartOptions(props.options, 'none'))}\n />\n </div>\n )\n}\n\n/**\n * A doughnut or a pie, for a composition with few enough slices to name.\n *\n * Both are one component because the only difference is the hole, and a caller\n * choosing between them is choosing a ratio rather than a chart. `cutout` is the\n * hole's share of the radius: 0 is a pie, 60% is the doughnut most dashboards\n * mean. A composition with more than about six slices should be a bar chart —\n * past that, the smallest slices become unreadable and their labels collide.\n */\nexport function DonutChart(props: {\n labels: readonly string[]\n data: readonly number[]\n /** The hole, as a percentage of the radius. 0 for a pie. */\n cutout?: number\n options?: ChartOptions\n class?: string\n}) {\n const theme = createThemeResolver()\n // `Dynamic` rather than a local component accessor: Solid's JSX types require\n // a component reference, and an accessor returning one is a call in disguise.\n const component = () => (props.cutout === 0 ? Pie : Doughnut)\n return (\n <div ref={theme.ref} class={cn('h-64', props.class)}>\n <Dynamic\n component={component()}\n data={theme.resolve({\n labels: [...props.labels],\n datasets: [\n {\n data: [...props.data],\n backgroundColor: props.labels.map(\n (_, index) => chartSeriesColors[index % chartSeriesColors.length]\n ),\n borderColor: 'var(--card)',\n borderWidth: 2,\n },\n ],\n })}\n options={theme.resolve(\n chartOptions(\n mergeChartOptions(\n props.cutout === 0\n ? undefined\n : ({\n cutout: `${props.cutout ?? 60}%`,\n } satisfies ChartOptions<'doughnut'> as ChartOptions),\n props.options\n ),\n 'none'\n )\n )}\n />\n </div>\n )\n}\n\n/** A legend built from the same five colours, for a chart whose legend is elsewhere. */\nexport function ChartLegend(props: {\n series: readonly { label: string; color?: string }[]\n class?: string\n}) {\n return (\n <ul class={cn('flex flex-wrap items-center gap-x-3 gap-y-1', props.class)}>\n <For each={props.series}>\n {(entry, index) => (\n <li class=\"flex items-center gap-1.5 text-2xs text-muted-foreground\">\n <span\n class=\"size-2 shrink-0 rounded-full\"\n style={{\n background: entry.color ?? chartSeriesColors[index() % chartSeriesColors.length],\n }}\n aria-hidden=\"true\"\n />\n {entry.label}\n </li>\n )}\n </For>\n </ul>\n )\n}\n\nexport type { ChartType, ChartOptions }\n"],"mappings":";;;;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IzD,MAAMN,SAASvF,kBAAkB8F,MAAM,IAAI9F,kBAAkBgG,OAAO,CAAA;IAAA,OAAAoD;GAAA,EAAA,CAAA;EAMvF,CAAA,CAAA;EAAAnE,aAAAC,UAAA+D,QAbMnJ,GAAG,+CAA+CsE,MAAMF,KAAK,CAAC,CAAA;EAAA,OAAA+E;CAAA,EAAA,CAAA;AAiB7E"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { chartOptions, chartSeriesColors } from "./chart-options.js";
|
|
2
|
+
import { BarChart, BubbleChart, ChartFrame, ChartLegend, DonutChart, LineChart, PolarAreaChart, RadarChart, ScatterChart, registerChartPiece } from "./chart.js";
|
|
2
3
|
export { BarChart, BubbleChart, ChartFrame, ChartLegend, DonutChart, LineChart, PolarAreaChart, RadarChart, ScatterChart, chartOptions, chartSeriesColors, registerChartPiece };
|
|
@@ -30,6 +30,14 @@ export declare function ContextMenuItem(props: ComponentProps<typeof KobalteCont
|
|
|
30
30
|
export declare function ContextMenuCheckboxItem(props: ComponentProps<typeof KobalteContextMenu.CheckboxItem>): import("solid-js").JSX.Element;
|
|
31
31
|
export declare function ContextMenuRadioGroup(props: ComponentProps<typeof KobalteContextMenu.RadioGroup>): import("solid-js").JSX.Element;
|
|
32
32
|
export declare function ContextMenuRadioItem(props: ComponentProps<typeof KobalteContextMenu.RadioItem>): import("solid-js").JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* The caption of a `ContextMenuGroup`, and that group's accessible name. It must be a
|
|
35
|
+
* child of the group it names: Kobalte reads the group from context, so a label
|
|
36
|
+
* placed directly in the content throws `useMenuGroupContext must be used within
|
|
37
|
+
* a Menu.Group` the moment the menu opens. For an ungrouped caption, wrap the
|
|
38
|
+
* label and its items in a group anyway — the grouping is what a screen reader
|
|
39
|
+
* announces.
|
|
40
|
+
*/
|
|
33
41
|
export declare function ContextMenuLabel(props: ComponentProps<typeof KobalteContextMenu.GroupLabel>): import("solid-js").JSX.Element;
|
|
34
42
|
export declare function ContextMenuGroup(props: ComponentProps<typeof KobalteContextMenu.Group>): import("solid-js").JSX.Element;
|
|
35
43
|
export declare function ContextMenuSeparator(props: ComponentProps<typeof KobalteContextMenu.Separator>): import("solid-js").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/context-menu/context-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAE9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAa9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,kCAE3E;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,OAAO,CAAC,kCAE1F;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,OAAO,CAAC,kCAiB1F;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,IAAI,CAAC,GAAG;IACtD,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAA;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,kCAiCF;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,YAAY,CAAC,kCAY9D;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,UAAU,CAAC,kCAEhG;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,SAAS,CAAC,kCAW9F;AAED,wBAAgB,gBAAgB,CAAC,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