@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.
Files changed (123) hide show
  1. package/dist/components/layout/orbit-layout/orbit-layout.d.ts +5 -1
  2. package/dist/components/layout/orbit-layout/orbit-layout.d.ts.map +1 -1
  3. package/dist/components/layout/orbit-layout/orbit-layout.js.map +1 -1
  4. package/dist/components/layout/side-rail/side-rail.d.ts +4 -1
  5. package/dist/components/layout/side-rail/side-rail.d.ts.map +1 -1
  6. package/dist/components/layout/side-rail/side-rail.js +58 -64
  7. package/dist/components/layout/side-rail/side-rail.js.map +1 -1
  8. package/dist/components/layout/sidebar-nav/sidebar-nav.js +2 -2
  9. package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
  10. package/dist/components/motion/presence.d.ts +17 -7
  11. package/dist/components/motion/presence.d.ts.map +1 -1
  12. package/dist/components/motion/presence.js.map +1 -1
  13. package/dist/components/theme/theme-picker.d.ts.map +1 -1
  14. package/dist/components/theme/theme-picker.js +1 -1
  15. package/dist/components/theme/theme-picker.js.map +1 -1
  16. package/dist/components/theme/theme-provider.d.ts.map +1 -1
  17. package/dist/components/theme/theme-provider.js +15 -4
  18. package/dist/components/theme/theme-provider.js.map +1 -1
  19. package/dist/components/ui/aspect-ratio/aspect-ratio.d.ts +2 -2
  20. package/dist/components/ui/aspect-ratio/aspect-ratio.d.ts.map +1 -1
  21. package/dist/components/ui/aspect-ratio/aspect-ratio.js +15 -1
  22. package/dist/components/ui/aspect-ratio/aspect-ratio.js.map +1 -1
  23. package/dist/components/ui/badge/badge.d.ts +1 -1
  24. package/dist/components/ui/button/button.d.ts +1 -1
  25. package/dist/components/ui/calendar/calendar.d.ts.map +1 -1
  26. package/dist/components/ui/calendar/calendar.js +1 -1
  27. package/dist/components/ui/calendar/calendar.js.map +1 -1
  28. package/dist/components/ui/card/card.d.ts +2 -2
  29. package/dist/components/ui/card/card.js +2 -2
  30. package/dist/components/ui/card/card.js.map +1 -1
  31. package/dist/components/ui/chart/chart-options.d.ts +50 -0
  32. package/dist/components/ui/chart/chart-options.d.ts.map +1 -0
  33. package/dist/components/ui/chart/chart-options.js +178 -0
  34. package/dist/components/ui/chart/chart-options.js.map +1 -0
  35. package/dist/components/ui/chart/chart.d.ts +21 -18
  36. package/dist/components/ui/chart/chart.d.ts.map +1 -1
  37. package/dist/components/ui/chart/chart.js +175 -155
  38. package/dist/components/ui/chart/chart.js.map +1 -1
  39. package/dist/components/ui/chart/index.js +2 -1
  40. package/dist/components/ui/context-menu/context-menu.d.ts +8 -0
  41. package/dist/components/ui/context-menu/context-menu.d.ts.map +1 -1
  42. package/dist/components/ui/context-menu/context-menu.js +8 -0
  43. package/dist/components/ui/context-menu/context-menu.js.map +1 -1
  44. package/dist/components/ui/drawer/drawer.d.ts +8 -1
  45. package/dist/components/ui/drawer/drawer.d.ts.map +1 -1
  46. package/dist/components/ui/drawer/drawer.js.map +1 -1
  47. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +8 -0
  48. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +1 -1
  49. package/dist/components/ui/dropdown-menu/dropdown-menu.js +8 -0
  50. package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
  51. package/dist/components/ui/input-otp/input-otp.d.ts.map +1 -1
  52. package/dist/components/ui/input-otp/input-otp.js +2 -2
  53. package/dist/components/ui/input-otp/input-otp.js.map +1 -1
  54. package/dist/components/ui/menubar/menubar.d.ts +8 -0
  55. package/dist/components/ui/menubar/menubar.d.ts.map +1 -1
  56. package/dist/components/ui/menubar/menubar.js +8 -0
  57. package/dist/components/ui/menubar/menubar.js.map +1 -1
  58. package/dist/components/ui/navigation-menu/navigation-menu.d.ts +14 -2
  59. package/dist/components/ui/navigation-menu/navigation-menu.d.ts.map +1 -1
  60. package/dist/components/ui/navigation-menu/navigation-menu.js +28 -23
  61. package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
  62. package/dist/components/ui/pagination/pagination.d.ts.map +1 -1
  63. package/dist/components/ui/pagination/pagination.js +1 -1
  64. package/dist/components/ui/pagination/pagination.js.map +1 -1
  65. package/dist/components/ui/resizable/resizable.d.ts +0 -12
  66. package/dist/components/ui/resizable/resizable.d.ts.map +1 -1
  67. package/dist/components/ui/resizable/resizable.js +43 -9
  68. package/dist/components/ui/resizable/resizable.js.map +1 -1
  69. package/dist/components/ui/toast/toast.d.ts.map +1 -1
  70. package/dist/components/ui/toast/toast.js +19 -6
  71. package/dist/components/ui/toast/toast.js.map +1 -1
  72. package/dist/lib/cn-tables.generated.js +10 -10
  73. package/dist/lib/cn-tables.generated.js.map +1 -1
  74. package/dist/r/chart.json +5 -0
  75. package/dist/r/registry.json +5 -0
  76. package/dist/r/src/components/layout/orbit-layout/orbit-layout.tsx +5 -1
  77. package/dist/r/src/components/layout/side-rail/side-rail.tsx +29 -16
  78. package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +2 -2
  79. package/dist/r/src/components/motion/presence.tsx +17 -7
  80. package/dist/r/src/components/theme/theme-picker.tsx +5 -1
  81. package/dist/r/src/components/theme/theme-provider.tsx +19 -9
  82. package/dist/r/src/components/ui/aspect-ratio/aspect-ratio.tsx +14 -3
  83. package/dist/r/src/components/ui/calendar/calendar.tsx +6 -1
  84. package/dist/r/src/components/ui/card/card.tsx +2 -2
  85. package/dist/r/src/components/ui/chart/chart-options.ts +196 -0
  86. package/dist/r/src/components/ui/chart/chart.tsx +149 -101
  87. package/dist/r/src/components/ui/context-menu/context-menu.tsx +8 -0
  88. package/dist/r/src/components/ui/drawer/drawer.tsx +8 -1
  89. package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +8 -0
  90. package/dist/r/src/components/ui/input-otp/input-otp.tsx +14 -2
  91. package/dist/r/src/components/ui/menubar/menubar.tsx +8 -0
  92. package/dist/r/src/components/ui/navigation-menu/navigation-menu.tsx +42 -28
  93. package/dist/r/src/components/ui/pagination/pagination.tsx +8 -1
  94. package/dist/r/src/components/ui/resizable/resizable.tsx +46 -8
  95. package/dist/r/src/components/ui/toast/toast.tsx +21 -6
  96. package/dist/r/src/lib/cn-tables.generated.ts +10 -10
  97. package/dist/r/src/styles/base.css +4 -1
  98. package/dist/r/src/styles/theme.css +23 -43
  99. package/package.json +1 -1
  100. package/registry.json +5 -0
  101. package/src/components/layout/orbit-layout/orbit-layout.tsx +5 -1
  102. package/src/components/layout/side-rail/side-rail.tsx +29 -16
  103. package/src/components/layout/sidebar-nav/sidebar-nav.tsx +2 -2
  104. package/src/components/motion/presence.tsx +17 -7
  105. package/src/components/theme/theme-picker.tsx +5 -1
  106. package/src/components/theme/theme-provider.tsx +19 -9
  107. package/src/components/ui/aspect-ratio/aspect-ratio.tsx +14 -3
  108. package/src/components/ui/calendar/calendar.tsx +6 -1
  109. package/src/components/ui/card/card.tsx +2 -2
  110. package/src/components/ui/chart/chart-options.ts +196 -0
  111. package/src/components/ui/chart/chart.tsx +149 -101
  112. package/src/components/ui/context-menu/context-menu.tsx +8 -0
  113. package/src/components/ui/drawer/drawer.tsx +8 -1
  114. package/src/components/ui/dropdown-menu/dropdown-menu.tsx +8 -0
  115. package/src/components/ui/input-otp/input-otp.tsx +14 -2
  116. package/src/components/ui/menubar/menubar.tsx +8 -0
  117. package/src/components/ui/navigation-menu/navigation-menu.tsx +42 -28
  118. package/src/components/ui/pagination/pagination.tsx +8 -1
  119. package/src/components/ui/resizable/resizable.tsx +46 -8
  120. package/src/components/ui/toast/toast.tsx +21 -6
  121. package/src/lib/cn-tables.generated.ts +10 -10
  122. package/src/styles/base.css +4 -1
  123. package/src/styles/theme.css +23 -43
@@ -0,0 +1,178 @@
1
+ //#region src/components/ui/chart/chart-options.ts
2
+ /**
3
+ * The chart's options, as data: no Chart.js runtime and no DOM, so the theme's
4
+ * defaults and the merge rules are testable on their own.
5
+ *
6
+ * Every colour here is written as `var(--token)`. A canvas cannot read a custom
7
+ * property — `fillStyle = 'var(--chart-1)'` is an invalid colour, which the
8
+ * canvas ignores and paints in its default black — so these strings are the
9
+ * *declaration* of which token a colour comes from. The components resolve them
10
+ * against their own element at render time (see `resolveCssVariables` and the
11
+ * resolver in `chart.tsx`).
12
+ */
13
+ /** The five series colours, in the order a multi-series chart should use them. */
14
+ var chartSeriesColors = [
15
+ "var(--chart-1)",
16
+ "var(--chart-2)",
17
+ "var(--chart-3)",
18
+ "var(--chart-4)",
19
+ "var(--chart-5)"
20
+ ];
21
+ /**
22
+ * The chart furniture, mapped onto existing semantic tokens rather than given
23
+ * tokens of its own. A grid line is a line, so it is `--border`; an axis tick and
24
+ * a legend label are secondary text, so they are `--muted-foreground`, whose
25
+ * contrast on `--card` (the frame's surface) is already measured in
26
+ * `tests/tokens.test.ts`. Dedicated `--chart-grid`/`--chart-axis`/`--chart-label`
27
+ * tokens would be three more values to keep in step with these in every theme
28
+ * for no difference anyone has asked for.
29
+ */
30
+ var furniture = {
31
+ grid: "var(--border)",
32
+ axis: "var(--muted-foreground)",
33
+ label: "var(--muted-foreground)",
34
+ surface: "var(--card)"
35
+ };
36
+ var tickFont = { size: 10 };
37
+ function scalesFor(shape) {
38
+ if (shape === "cartesian") return {
39
+ x: {
40
+ border: { color: furniture.grid },
41
+ grid: {
42
+ color: furniture.grid,
43
+ drawTicks: false
44
+ },
45
+ ticks: {
46
+ color: furniture.axis,
47
+ font: tickFont
48
+ }
49
+ },
50
+ y: {
51
+ border: { display: false },
52
+ grid: {
53
+ color: furniture.grid,
54
+ drawTicks: false
55
+ },
56
+ ticks: {
57
+ color: furniture.axis,
58
+ font: tickFont
59
+ }
60
+ }
61
+ };
62
+ if (shape === "radial") return { r: {
63
+ grid: { color: furniture.grid },
64
+ angleLines: { color: furniture.grid },
65
+ pointLabels: {
66
+ color: furniture.axis,
67
+ font: tickFont
68
+ },
69
+ ticks: {
70
+ color: furniture.axis,
71
+ backdropColor: furniture.surface,
72
+ font: tickFont
73
+ }
74
+ } };
75
+ }
76
+ function isPlainObject(value) {
77
+ if (typeof value !== "object" || value === null) return false;
78
+ const prototype = Object.getPrototypeOf(value);
79
+ return prototype === Object.prototype || prototype === null;
80
+ }
81
+ function mergeInto(target, source) {
82
+ for (const [key, value] of Object.entries(source)) {
83
+ if (value === void 0) continue;
84
+ const current = target[key];
85
+ target[key] = isPlainObject(value) && isPlainObject(current) ? mergeInto({ ...current }, value) : isPlainObject(value) ? mergeInto({}, value) : value;
86
+ }
87
+ return target;
88
+ }
89
+ /**
90
+ * Merge Chart.js options, later sources winning, object by object.
91
+ *
92
+ * Deep, because Chart.js options are deep: `{ scales: { x: { stacked: true } } }`
93
+ * means "also stack x", and a spread would replace the whole axis — its grid,
94
+ * its tick colour, its font — with that one flag. Arrays, functions (scriptable
95
+ * options) and class instances (gradients, patterns) are values and replace
96
+ * rather than merge. No source is mutated.
97
+ */
98
+ function mergeChartOptions(...sources) {
99
+ const merged = {};
100
+ for (const source of sources) if (source) mergeInto(merged, source);
101
+ return merged;
102
+ }
103
+ /**
104
+ * The theme's defaults as Chart.js options.
105
+ *
106
+ * Exported so a caller can spread it and change one thing, rather than
107
+ * restating every colour. Everything a chart draws that is not data — grid,
108
+ * ticks, legend, tooltip — is decided here once, which is what makes two charts
109
+ * in one application look like they came from the same place. `overrides` is
110
+ * merged deeply; `shape` selects the scales the chart type has.
111
+ */
112
+ function chartOptions(overrides, shape = "cartesian") {
113
+ return mergeChartOptions({
114
+ responsive: true,
115
+ maintainAspectRatio: false,
116
+ interaction: {
117
+ mode: "nearest",
118
+ intersect: false
119
+ },
120
+ plugins: {
121
+ legend: { labels: {
122
+ color: furniture.label,
123
+ boxWidth: 8,
124
+ boxHeight: 8,
125
+ usePointStyle: true,
126
+ pointStyle: "circle",
127
+ font: { size: 11 }
128
+ } },
129
+ tooltip: {
130
+ backgroundColor: "var(--popover)",
131
+ titleColor: "var(--popover-foreground)",
132
+ bodyColor: "var(--popover-foreground)",
133
+ borderColor: "var(--border)",
134
+ borderWidth: 1,
135
+ padding: 8,
136
+ cornerRadius: 6,
137
+ displayColors: true,
138
+ boxWidth: 8,
139
+ boxHeight: 8,
140
+ usePointStyle: true,
141
+ titleFont: {
142
+ size: 11,
143
+ weight: 600
144
+ },
145
+ bodyFont: { size: 11 }
146
+ }
147
+ },
148
+ scales: scalesFor(shape)
149
+ }, overrides);
150
+ }
151
+ var cssVariable = /^\s*var\(\s*(--[\w-]+)\s*(?:,\s*(.*?))?\s*\)\s*$/;
152
+ /**
153
+ * Replace every `var(--token)` string in `value` — options, datasets, nested
154
+ * arrays — with what `read` returns for the token. A token `read` cannot
155
+ * resolve falls back to the `var()`'s own fallback, then to the string as
156
+ * written. Functions and class instances pass through untouched, so scriptable
157
+ * options and gradients keep working.
158
+ */
159
+ function resolveCssVariables(value, read) {
160
+ if (typeof value === "string") {
161
+ const match = cssVariable.exec(value);
162
+ if (!match) return value;
163
+ const resolved = read(match[1]);
164
+ if (resolved) return resolved;
165
+ return match[2] ? resolveCssVariables(match[2], read) : value;
166
+ }
167
+ if (Array.isArray(value)) return value.map((entry) => resolveCssVariables(entry, read));
168
+ if (isPlainObject(value)) {
169
+ const resolved = {};
170
+ for (const [key, entry] of Object.entries(value)) resolved[key] = resolveCssVariables(entry, read);
171
+ return resolved;
172
+ }
173
+ return value;
174
+ }
175
+ //#endregion
176
+ export { chartOptions, chartSeriesColors, mergeChartOptions, resolveCssVariables };
177
+
178
+ //# sourceMappingURL=chart-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-options.js","names":[],"sources":["../../../../src/components/ui/chart/chart-options.ts"],"sourcesContent":["import type { ChartOptions } from 'chart.js'\n\n/**\n * The chart's options, as data: no Chart.js runtime and no DOM, so the theme's\n * defaults and the merge rules are testable on their own.\n *\n * Every colour here is written as `var(--token)`. A canvas cannot read a custom\n * property — `fillStyle = 'var(--chart-1)'` is an invalid colour, which the\n * canvas ignores and paints in its default black — so these strings are the\n * *declaration* of which token a colour comes from. The components resolve them\n * against their own element at render time (see `resolveCssVariables` and the\n * resolver in `chart.tsx`).\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 chart furniture, mapped onto existing semantic tokens rather than given\n * tokens of its own. A grid line is a line, so it is `--border`; an axis tick and\n * a legend label are secondary text, so they are `--muted-foreground`, whose\n * contrast on `--card` (the frame's surface) is already measured in\n * `tests/tokens.test.ts`. Dedicated `--chart-grid`/`--chart-axis`/`--chart-label`\n * tokens would be three more values to keep in step with these in every theme\n * for no difference anyone has asked for.\n */\nconst furniture = {\n grid: 'var(--border)',\n axis: 'var(--muted-foreground)',\n label: 'var(--muted-foreground)',\n surface: 'var(--card)',\n} as const\n\n/**\n * Which scales a chart type draws. Chart.js creates a scale for every key under\n * `options.scales` whatever the chart type, so cartesian defaults handed to a\n * doughnut draw an x and a y axis and a grid behind it. The shape keeps each\n * type's defaults to the scales it actually has.\n */\nexport type ChartScaleShape = 'cartesian' | 'radial' | 'none'\n\nconst tickFont = { size: 10 }\n\nfunction scalesFor(shape: ChartScaleShape): ChartOptions['scales'] {\n if (shape === 'cartesian') {\n return {\n x: {\n border: { color: furniture.grid },\n grid: { color: furniture.grid, drawTicks: false },\n ticks: { color: furniture.axis, font: tickFont },\n },\n y: {\n border: { display: false },\n grid: { color: furniture.grid, drawTicks: false },\n ticks: { color: furniture.axis, font: tickFont },\n },\n }\n }\n if (shape === 'radial') {\n return {\n r: {\n grid: { color: furniture.grid },\n angleLines: { color: furniture.grid },\n pointLabels: { color: furniture.axis, font: tickFont },\n // The default backdrop is a translucent white box, which is a white box\n // on a dark card. The frame's own surface makes it disappear in both.\n ticks: { color: furniture.axis, backdropColor: furniture.surface, font: tickFont },\n },\n }\n }\n return undefined\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== 'object' || value === null) return false\n const prototype = Object.getPrototypeOf(value)\n return prototype === Object.prototype || prototype === null\n}\n\nfunction mergeInto(target: Record<string, unknown>, source: Record<string, unknown>) {\n for (const [key, value] of Object.entries(source)) {\n if (value === undefined) continue\n const current = target[key]\n target[key] =\n isPlainObject(value) && isPlainObject(current)\n ? mergeInto({ ...current }, value)\n : isPlainObject(value)\n ? mergeInto({}, value)\n : value\n }\n return target\n}\n\n/**\n * Merge Chart.js options, later sources winning, object by object.\n *\n * Deep, because Chart.js options are deep: `{ scales: { x: { stacked: true } } }`\n * means \"also stack x\", and a spread would replace the whole axis — its grid,\n * its tick colour, its font — with that one flag. Arrays, functions (scriptable\n * options) and class instances (gradients, patterns) are values and replace\n * rather than merge. No source is mutated.\n */\nexport function mergeChartOptions(...sources: (ChartOptions | undefined)[]): ChartOptions {\n const merged: Record<string, unknown> = {}\n for (const source of sources) {\n if (source) mergeInto(merged, source as Record<string, unknown>)\n }\n return merged as ChartOptions\n}\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. `overrides` is\n * merged deeply; `shape` selects the scales the chart type has.\n */\nexport function chartOptions(\n overrides?: ChartOptions,\n shape: ChartScaleShape = 'cartesian'\n): ChartOptions {\n return mergeChartOptions(\n {\n responsive: true,\n maintainAspectRatio: false,\n interaction: { mode: 'nearest', intersect: false },\n plugins: {\n legend: {\n labels: {\n color: furniture.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: scalesFor(shape),\n },\n overrides\n )\n}\n\nconst cssVariable = /^\\s*var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*(.*?))?\\s*\\)\\s*$/\n\n/**\n * Replace every `var(--token)` string in `value` — options, datasets, nested\n * arrays — with what `read` returns for the token. A token `read` cannot\n * resolve falls back to the `var()`'s own fallback, then to the string as\n * written. Functions and class instances pass through untouched, so scriptable\n * options and gradients keep working.\n */\nexport function resolveCssVariables<T>(value: T, read: (name: string) => string | undefined): T {\n if (typeof value === 'string') {\n const match = cssVariable.exec(value)\n if (!match) return value\n const resolved = read(match[1]!)\n if (resolved) return resolved as T\n return (match[2] ? resolveCssVariables(match[2], read) : value) as T\n }\n if (Array.isArray(value)) {\n return value.map((entry: unknown) => resolveCssVariables(entry, read)) as T\n }\n if (isPlainObject(value)) {\n const resolved: Record<string, unknown> = {}\n for (const [key, entry] of Object.entries(value)) {\n resolved[key] = resolveCssVariables(entry, read)\n }\n return resolved as T\n }\n return value\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,IAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;AACF;;;;;;;;;;AAWA,IAAM,YAAY;CAChB,MAAM;CACN,MAAM;CACN,OAAO;CACP,SAAS;AACX;AAUA,IAAM,WAAW,EAAE,MAAM,GAAG;AAE5B,SAAS,UAAU,OAAgD;CACjE,IAAI,UAAU,aACZ,OAAO;EACL,GAAG;GACD,QAAQ,EAAE,OAAO,UAAU,KAAK;GAChC,MAAM;IAAE,OAAO,UAAU;IAAM,WAAW;GAAM;GAChD,OAAO;IAAE,OAAO,UAAU;IAAM,MAAM;GAAS;EACjD;EACA,GAAG;GACD,QAAQ,EAAE,SAAS,MAAM;GACzB,MAAM;IAAE,OAAO,UAAU;IAAM,WAAW;GAAM;GAChD,OAAO;IAAE,OAAO,UAAU;IAAM,MAAM;GAAS;EACjD;CACF;CAEF,IAAI,UAAU,UACZ,OAAO,EACL,GAAG;EACD,MAAM,EAAE,OAAO,UAAU,KAAK;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AI;IACnC,UAAU,EAAE,MAAM,GAAG;GACvB;EACF;EACA,QAAQ,UAAU,KAAK;CACzB,GACA,SACF;AACF;AAEA,IAAM,cAAc;;;;;;;;AASpB,SAAgB,oBAAuB,OAAU,MAA+C;CAC9F,IAAI,OAAO,UAAU,UAAU;EAC7B,MAAM,QAAQ,YAAY,KAAK,KAAK;EACpC,IAAI,CAAC,OAAO,OAAO;EACnB,MAAM,WAAW,KAAK,MAAM,EAAG;EAC/B,IAAI,UAAU,OAAO;EACrB,OAAQ,MAAM,KAAK,oBAAoB,MAAM,IAAI,IAAI,IAAI;CAC3D;CACA,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,KAAK,UAAmB,oBAAoB,OAAO,IAAI,CAAC;CAEvE,IAAI,cAAc,KAAK,GAAG;EACxB,MAAM,WAAoC,CAAC;EAC3C,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAC7C,SAAS,OAAO,oBAAoB,OAAO,IAAI;EAEjD,OAAO;CACT;CACA,OAAO;AACT"}
@@ -1,6 +1,7 @@
1
1
  import { type JSX } from 'solid-js';
2
2
  import { Chart as ChartJs } from 'chart.js';
3
3
  import type { ChartOptions, ChartType } from 'chart.js';
4
+ import { chartOptions, chartSeriesColors } from './chart-options';
4
5
  /**
5
6
  * Chart.
6
7
  *
@@ -29,11 +30,16 @@ import type { ChartOptions, ChartType } from 'chart.js';
29
30
  *
30
31
  * ## Theming
31
32
  *
32
- * Colours resolve from `--chart-1` through `--chart-5`, which every theme
33
- * defines, plus `--chart-grid`, `--chart-axis` and `--chart-label`. That means a
34
- * chart follows the accent axis, the appearance, and the font axis with no
35
- * per-chart configuration — and a caller that wants a specific series colour
36
- * passes it explicitly rather than reaching into the theme.
33
+ * Colours come from `--chart-1` through `--chart-5`, which every theme
34
+ * defines, and the grid, ticks and labels from `--border` and
35
+ * `--muted-foreground`. That means a chart follows the accent axis and the
36
+ * appearance with no per-chart configuration — and a caller that wants a
37
+ * specific series colour passes it explicitly, as a colour or as `var(--token)`.
38
+ *
39
+ * A canvas cannot read a custom property, so the options and datasets carry
40
+ * `var(--token)` strings and each chart resolves them against its own element
41
+ * when it renders, and again whenever the root's attributes change — the
42
+ * `.dark` class, `data-accent`, an inline override. See `createThemeResolver`.
37
43
  */
38
44
  /**
39
45
  * Register a piece with Chart.js. The escape hatch for a caller's own chart type.
@@ -43,17 +49,7 @@ import type { ChartOptions, ChartType } from 'chart.js';
43
49
  * it, since the registry is Chart.js's global.
44
50
  */
45
51
  export declare function registerChartPiece(piece: Parameters<typeof ChartJs.register>[number]): void;
46
- /** The five series colours, in the order a multi-series chart should use them. */
47
- export declare const chartSeriesColors: readonly ["var(--chart-1)", "var(--chart-2)", "var(--chart-3)", "var(--chart-4)", "var(--chart-5)"];
48
- /**
49
- * The theme's defaults as Chart.js options.
50
- *
51
- * Exported so a caller can spread it and change one thing, rather than
52
- * restating every colour. Everything a chart draws that is not data — grid,
53
- * ticks, legend, tooltip — is decided here once, which is what makes two charts
54
- * in one application look like they came from the same place.
55
- */
56
- export declare function chartOptions(overrides?: ChartOptions): ChartOptions;
52
+ export { chartOptions, chartSeriesColors };
57
53
  /** A chart's frame: a bordered surface with a title and an optional description. */
58
54
  export type ChartFrameProps = {
59
55
  /** The chart's title. Required — a chart with no name is not readable. */
@@ -75,7 +71,7 @@ type SeriesChartProps = {
75
71
  data: readonly number[];
76
72
  color?: string;
77
73
  }[];
78
- /** Chart.js options, merged over the theme's defaults. */
74
+ /** Chart.js options, merged deeply over the theme's defaults. */
79
75
  options?: ChartOptions;
80
76
  /** Stack the series. */
81
77
  stacked?: boolean;
@@ -118,7 +114,14 @@ export declare function BubbleChart(props: {
118
114
  }): JSX.Element;
119
115
  /** A radar chart, for a profile across fixed axes. */
120
116
  export declare function RadarChart(props: SeriesChartProps): JSX.Element;
121
- /** A polar area chart: radial bars, for a composition. */
117
+ /**
118
+ * A polar area chart: radial bars, for a composition.
119
+ *
120
+ * Its scale is left to Chart.js's polar-area defaults (`'none'` rather than
121
+ * `'radial'`): `solid-chartjs` deletes `options.scales.r` for every chart type
122
+ * but radar when it first creates the chart, so radial styling here would apply
123
+ * only after the first theme change — a chart that restyles itself on a toggle.
124
+ */
122
125
  export declare function PolarAreaChart(props: {
123
126
  labels: readonly string[];
124
127
  data: readonly number[];
@@ -1 +1 @@
1
- {"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/chart/chart.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,GAAG,EAAE,MAAM,UAAU,CAAA;AAGpD,OAAO,EACL,KAAK,IAAI,OAAO,EAYjB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,CAE3F;AAgBD,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,qGAMpB,CAAA;AAEV;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,SAAS,CAAC,EAAE,YAAY,GAAG,YAAY,CA8CnE;AAED,oFAAoF;AACpF,MAAM,MAAM,eAAe,GAAG;IAC5B,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAA;IACb,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,yBAAyB;IACzB,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACrB,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAehD;AAED,KAAK,gBAAgB,GAAG;IACtB,0CAA0C;IAC1C,MAAM,EAAE,SAAS,MAAM,E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