@ember-joinery/chart 0.0.0-stage → 1.0.1

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 (121) hide show
  1. package/CHANGELOG.md +167 -0
  2. package/LICENSE.md +9 -0
  3. package/NOTICE +532 -0
  4. package/README.md +69 -2
  5. package/addon-main.cjs +4 -0
  6. package/declarations/-private/cartesian-chart.d.ts +413 -0
  7. package/declarations/-private/cartesian-chart.d.ts.map +1 -0
  8. package/declarations/-private/cartesian.d.ts +236 -0
  9. package/declarations/-private/cartesian.d.ts.map +1 -0
  10. package/declarations/-private/config.d.ts +13 -0
  11. package/declarations/-private/config.d.ts.map +1 -0
  12. package/declarations/-private/dots.d.ts +27 -0
  13. package/declarations/-private/dots.d.ts.map +1 -0
  14. package/declarations/-private/nice-ticks.d.ts +17 -0
  15. package/declarations/-private/nice-ticks.d.ts.map +1 -0
  16. package/declarations/-private/parts.d.ts +596 -0
  17. package/declarations/-private/parts.d.ts.map +1 -0
  18. package/declarations/-private/paths.d.ts +26 -0
  19. package/declarations/-private/paths.d.ts.map +1 -0
  20. package/declarations/-private/pie-chart.d.ts +244 -0
  21. package/declarations/-private/pie-chart.d.ts.map +1 -0
  22. package/declarations/-private/polar-chart.d.ts +423 -0
  23. package/declarations/-private/polar-chart.d.ts.map +1 -0
  24. package/declarations/-private/polar-geometry.d.ts +230 -0
  25. package/declarations/-private/polar-geometry.d.ts.map +1 -0
  26. package/declarations/-private/polar-parts.d.ts +315 -0
  27. package/declarations/-private/polar-parts.d.ts.map +1 -0
  28. package/declarations/-private/polar.d.ts +156 -0
  29. package/declarations/-private/polar.d.ts.map +1 -0
  30. package/declarations/-private/registry.d.ts +9 -0
  31. package/declarations/-private/registry.d.ts.map +1 -0
  32. package/declarations/-private/text-size.d.ts +13 -0
  33. package/declarations/-private/text-size.d.ts.map +1 -0
  34. package/declarations/-private/tick-interval.d.ts +35 -0
  35. package/declarations/-private/tick-interval.d.ts.map +1 -0
  36. package/declarations/components/area-chart.d.ts +16 -0
  37. package/declarations/components/area-chart.d.ts.map +1 -0
  38. package/declarations/components/bar-chart.d.ts +16 -0
  39. package/declarations/components/bar-chart.d.ts.map +1 -0
  40. package/declarations/components/chart-container.d.ts +66 -0
  41. package/declarations/components/chart-container.d.ts.map +1 -0
  42. package/declarations/components/chart-legend-content.d.ts +42 -0
  43. package/declarations/components/chart-legend-content.d.ts.map +1 -0
  44. package/declarations/components/chart-style.d.ts +19 -0
  45. package/declarations/components/chart-style.d.ts.map +1 -0
  46. package/declarations/components/chart-tooltip-content.d.ts +94 -0
  47. package/declarations/components/chart-tooltip-content.d.ts.map +1 -0
  48. package/declarations/components/dot.d.ts +22 -0
  49. package/declarations/components/dot.d.ts.map +1 -0
  50. package/declarations/components/line-chart.d.ts +16 -0
  51. package/declarations/components/line-chart.d.ts.map +1 -0
  52. package/declarations/components/pie-chart.d.ts +13 -0
  53. package/declarations/components/pie-chart.d.ts.map +1 -0
  54. package/declarations/components/radar-chart.d.ts +21 -0
  55. package/declarations/components/radar-chart.d.ts.map +1 -0
  56. package/declarations/components/radial-bar-chart.d.ts +17 -0
  57. package/declarations/components/radial-bar-chart.d.ts.map +1 -0
  58. package/declarations/components/rectangle.d.ts +32 -0
  59. package/declarations/components/rectangle.d.ts.map +1 -0
  60. package/declarations/components/sector.d.ts +47 -0
  61. package/declarations/components/sector.d.ts.map +1 -0
  62. package/declarations/index.d.ts +24 -0
  63. package/declarations/index.d.ts.map +1 -0
  64. package/declarations/test-support/chart.d.ts +162 -0
  65. package/declarations/test-support/chart.d.ts.map +1 -0
  66. package/declarations/test-support/index.d.ts +3 -0
  67. package/declarations/test-support/index.d.ts.map +1 -0
  68. package/declarations/test-support/polar-chart.d.ts +62 -0
  69. package/declarations/test-support/polar-chart.d.ts.map +1 -0
  70. package/declarations/test-support.d.ts +2 -0
  71. package/declarations/types.d.ts +138 -0
  72. package/declarations/types.d.ts.map +1 -0
  73. package/dist/cartesian-D9hWDamz.js +1217 -0
  74. package/dist/cartesian-D9hWDamz.js.map +1 -0
  75. package/dist/cartesian-chart-BLj6Q_OB.js +1123 -0
  76. package/dist/cartesian-chart-BLj6Q_OB.js.map +1 -0
  77. package/dist/components/area-chart.js +20 -0
  78. package/dist/components/area-chart.js.map +1 -0
  79. package/dist/components/bar-chart.js +20 -0
  80. package/dist/components/bar-chart.js.map +1 -0
  81. package/dist/components/chart-container.js +54 -0
  82. package/dist/components/chart-container.js.map +1 -0
  83. package/dist/components/chart-legend-content.js +48 -0
  84. package/dist/components/chart-legend-content.js.map +1 -0
  85. package/dist/components/chart-style.js +35 -0
  86. package/dist/components/chart-style.js.map +1 -0
  87. package/dist/components/chart-tooltip-content.js +131 -0
  88. package/dist/components/chart-tooltip-content.js.map +1 -0
  89. package/dist/components/dot.js +18 -0
  90. package/dist/components/dot.js.map +1 -0
  91. package/dist/components/line-chart.js +20 -0
  92. package/dist/components/line-chart.js.map +1 -0
  93. package/dist/components/pie-chart.js +6 -0
  94. package/dist/components/pie-chart.js.map +1 -0
  95. package/dist/components/radar-chart.js +22 -0
  96. package/dist/components/radar-chart.js.map +1 -0
  97. package/dist/components/radial-bar-chart.js +20 -0
  98. package/dist/components/radial-bar-chart.js.map +1 -0
  99. package/dist/components/rectangle.js +5 -0
  100. package/dist/components/rectangle.js.map +1 -0
  101. package/dist/components/sector.js +5 -0
  102. package/dist/components/sector.js.map +1 -0
  103. package/dist/config-DnsUmxOT.js +35 -0
  104. package/dist/config-DnsUmxOT.js.map +1 -0
  105. package/dist/index.js +15 -0
  106. package/dist/index.js.map +1 -0
  107. package/dist/parts-BWLhFFjB.js +355 -0
  108. package/dist/parts-BWLhFFjB.js.map +1 -0
  109. package/dist/pie-chart-CmDtW_Ge.js +646 -0
  110. package/dist/pie-chart-CmDtW_Ge.js.map +1 -0
  111. package/dist/polar-chart-GhgOSsH9.js +2242 -0
  112. package/dist/polar-chart-GhgOSsH9.js.map +1 -0
  113. package/dist/rectangle-Cl7tbXuZ.js +166 -0
  114. package/dist/rectangle-Cl7tbXuZ.js.map +1 -0
  115. package/dist/sector-7shQPJuQ.js +565 -0
  116. package/dist/sector-7shQPJuQ.js.map +1 -0
  117. package/dist/test-support.js +470 -0
  118. package/dist/test-support.js.map +1 -0
  119. package/dist/types.js +56 -0
  120. package/dist/types.js.map +1 -0
  121. package/package.json +117 -3
@@ -0,0 +1,355 @@
1
+ import { isObject } from '@sindresorhus/is';
2
+ import Component from '@glimmer/component';
3
+ import { hash } from '@ember/helper';
4
+ import { tracked } from '@glimmer/tracking';
5
+ import { g, i } from 'decorator-transforms/runtime';
6
+ import { precompileTemplate } from '@ember/template-compilation';
7
+ import { setComponentTemplate } from '@ember/component';
8
+
9
+ /*
10
+ * How a chart's parts reach the chart. Glimmer has no context, so a chart yields its parts
11
+ * (`<c.XAxis>`, `<c.Area>`) curried with itself, and each part registers on construction. The
12
+ * chart's block renders before the marks inside its `<svg>`, so every part has registered by
13
+ * the time the chart lays them out in the same render.
14
+ *
15
+ * Glimmer's debug build forbids changing tracked state that the same render has already read
16
+ * ("You attempted to update `revision`… but it had already been used previously in the same
17
+ * computation"). A registration sets `revision`, so nothing may read `items` earlier in a render
18
+ * than the block that registers: not in the first render, and not in a later one, where a part
19
+ * the block adds inside an `{{#if}}` registers while the render revalidates the template in
20
+ * order. The chart reads its parts only after its `{{yield}}` (an attribute on the wrapper, which
21
+ * is evaluated before the block, would trip it). And a registration never reads what it writes:
22
+ * the list is a plain array, and `add()` and `remove()` only set the revision.
23
+ */
24
+ class Registry {
25
+ #items = [];
26
+ #counter = 0;
27
+ static {
28
+ g(this.prototype, "revision", [tracked], function () {
29
+ return 0;
30
+ });
31
+ }
32
+ #revision = (i(this, "revision"), void 0);
33
+ /** Every registered item, in the order the parts were constructed. */
34
+ get items() {
35
+ void this.revision;
36
+ return this.#items;
37
+ }
38
+ add(item) {
39
+ this.#items = [...this.#items, item];
40
+ this.revision = ++this.#counter;
41
+ }
42
+ remove(item) {
43
+ if (!this.#items.includes(item)) return;
44
+ this.#items = this.#items.filter(other => other !== item);
45
+ this.revision = ++this.#counter;
46
+ }
47
+ }
48
+
49
+ /*
50
+ * How a series' `dot`/`activeDot` option becomes what the chart draws: nothing, a circle with
51
+ * attributes, or the caller's component.
52
+ */
53
+ /** A plain object of attributes, as opposed to a component (a class, or a curried definition). */
54
+ function isPlainObject(value) {
55
+ if (!isObject(value)) return false;
56
+ const proto = Object.getPrototypeOf(value);
57
+ return proto === Object.prototype || proto === null;
58
+ }
59
+
60
+ /**
61
+ * The dot to draw for `option`, or null for none. `defaults` are the series' own: a line's dot
62
+ * is a white circle in its stroke, an active dot a filled one with a white ring.
63
+ */
64
+ function dotFor(option, fallback, defaults, args) {
65
+ const value = option ?? fallback;
66
+ if (value === false) return null;
67
+ if (value === true) return {
68
+ kind: 'circle',
69
+ attrs: defaults,
70
+ args: {
71
+ ...args,
72
+ r: defaults.r
73
+ }
74
+ };
75
+ if (isPlainObject(value)) {
76
+ const attrs = {
77
+ ...defaults,
78
+ ...(value.r !== undefined ? {
79
+ r: Number(value.r)
80
+ } : {}),
81
+ ...(value.fill !== undefined ? {
82
+ fill: String(value.fill)
83
+ } : {}),
84
+ ...(value.stroke !== undefined ? {
85
+ stroke: String(value.stroke)
86
+ } : {}),
87
+ ...(value.strokeWidth !== undefined ? {
88
+ strokeWidth: String(value.strokeWidth)
89
+ } : {}),
90
+ ...(value.class !== undefined ? {
91
+ class: String(value.class)
92
+ } : {})
93
+ };
94
+ return {
95
+ kind: 'circle',
96
+ attrs,
97
+ args: {
98
+ ...args,
99
+ r: attrs.r
100
+ }
101
+ };
102
+ }
103
+ return {
104
+ kind: 'component',
105
+ component: value,
106
+ args
107
+ };
108
+ }
109
+
110
+ /** Every part a chart reads. */
111
+ /** A part that registers with its chart while it is rendered. */class Part extends Component {
112
+ constructor(owner, args) {
113
+ super(owner, args);
114
+ args.chart.register(this);
115
+ }
116
+ willDestroy() {
117
+ super.willDestroy();
118
+ this.args.chart.unregister(this);
119
+ }
120
+ }
121
+ // ---------------------------------------------------------------------------------------------
122
+ // Axes
123
+ /** The arguments an axis shares with recharts' `XAxis` and `YAxis`. */
124
+
125
+ /** The chart's x-axis: recharts' `XAxis`. */class XAxis extends Part {
126
+ kind = 'xAxis';
127
+ static {
128
+ setComponentTemplate(precompileTemplate("", {
129
+ strictMode: true
130
+ }), this);
131
+ }
132
+ }
133
+ /** The chart's y-axis: recharts' `YAxis`. */class YAxis extends Part {
134
+ kind = 'yAxis';
135
+ static {
136
+ setComponentTemplate(precompileTemplate("", {
137
+ strictMode: true
138
+ }), this);
139
+ }
140
+ }
141
+ // ---------------------------------------------------------------------------------------------
142
+ // Grid
143
+
144
+ /** Grid lines behind the chart: recharts' `CartesianGrid`. */class CartesianGrid extends Part {
145
+ kind = 'grid';
146
+ static {
147
+ setComponentTemplate(precompileTemplate("", {
148
+ strictMode: true
149
+ }), this);
150
+ }
151
+ }
152
+ // ---------------------------------------------------------------------------------------------
153
+ // Series
154
+ /** What a series' dot (or active dot) component is handed. */
155
+
156
+ /** A dot's look: false for none, true for the default, its attributes, or a component. */
157
+
158
+ /** The arguments every series shares. */
159
+
160
+ /** What a series yields: its label list. */
161
+
162
+ /** What a bar series yields: its label list, and a `Cell` per bar. */
163
+
164
+ class Series extends Part {
165
+ labels = new Registry();
166
+ cells = new Registry();
167
+ registerLabel = label => this.labels.add(label);
168
+ unregisterLabel = label => this.labels.remove(label);
169
+ registerCell = cell => this.cells.add(cell);
170
+ unregisterCell = cell => this.cells.remove(cell);
171
+ }
172
+ /** A filled area under a line: recharts' `Area`. */class Area extends Series {
173
+ kind = 'area';
174
+ static {
175
+ setComponentTemplate(precompileTemplate("{{yield (hash LabelList=(component LabelList series=this))}}", {
176
+ strictMode: true,
177
+ scope: () => ({
178
+ hash,
179
+ LabelList
180
+ })
181
+ }), this);
182
+ }
183
+ }
184
+ /** A line through the points: recharts' `Line`. */class Line extends Series {
185
+ kind = 'line';
186
+ static {
187
+ setComponentTemplate(precompileTemplate("{{yield (hash LabelList=(component LabelList series=this))}}", {
188
+ strictMode: true,
189
+ scope: () => ({
190
+ hash,
191
+ LabelList
192
+ })
193
+ }), this);
194
+ }
195
+ }
196
+ /**
197
+ * What a bar's `@shape` is handed as `@props`, as recharts hands its `shape` function: the
198
+ * bar's rectangle, its attributes, and the row it came from. Pass it on to `Rectangle`.
199
+ */
200
+
201
+ /** A bar's `@shape`: a component that draws each bar, handed its `@props` and `@index`. */
202
+
203
+ /** A bar for each row: recharts' `Bar`. */class Bar extends Series {
204
+ kind = 'bar';
205
+ static {
206
+ setComponentTemplate(precompileTemplate("{{yield (hash LabelList=(component LabelList series=this) Cell=(component Cell series=this))}}", {
207
+ strictMode: true,
208
+ scope: () => ({
209
+ hash,
210
+ LabelList,
211
+ Cell
212
+ })
213
+ }), this);
214
+ }
215
+ }
216
+ // ---------------------------------------------------------------------------------------------
217
+ // Labels
218
+ /**
219
+ * Where a label sits against its point or bar, or (in a pie) its sector: `outside`, `center`,
220
+ * `centerTop`, `centerBottom`, or `middle` (the default), in the middle of the sector's ring.
221
+ */
222
+
223
+ /** A label at each point of a series: recharts' `LabelList`. */class LabelList extends Component {
224
+ constructor(owner, args) {
225
+ super(owner, args);
226
+ args.series.registerLabel(this);
227
+ }
228
+ willDestroy() {
229
+ super.willDestroy();
230
+ this.args.series.unregisterLabel(this);
231
+ }
232
+ static {
233
+ setComponentTemplate(precompileTemplate("", {
234
+ strictMode: true
235
+ }), this);
236
+ }
237
+ }
238
+ // ---------------------------------------------------------------------------------------------
239
+ // Cells
240
+
241
+ /**
242
+ * One bar's or sector's attributes, over its series': recharts' `Cell`. Write one per row, in
243
+ * the rows' order:
244
+ *
245
+ * {{#each chartData as |row|}}
246
+ * <bar.Cell @fill={{if (isPositive row.visitors) "var(--chart-1)" "var(--chart-2)"}} />
247
+ * {{/each}}
248
+ */
249
+ class Cell extends Component {
250
+ constructor(owner, args) {
251
+ super(owner, args);
252
+ args.series.registerCell(this);
253
+ }
254
+ willDestroy() {
255
+ super.willDestroy();
256
+ this.args.series.unregisterCell(this);
257
+ }
258
+ /** The attributes it lays over its bar or sector's row. */
259
+ get attributes() {
260
+ const {
261
+ fill,
262
+ fillOpacity,
263
+ stroke,
264
+ strokeWidth
265
+ } = this.args;
266
+ const attributes = {};
267
+ if (fill !== undefined) attributes['fill'] = fill;
268
+ if (fillOpacity !== undefined) attributes['fillOpacity'] = fillOpacity;
269
+ if (stroke !== undefined) attributes['stroke'] = stroke;
270
+ if (strokeWidth !== undefined) attributes['strokeWidth'] = strokeWidth;
271
+ return attributes;
272
+ }
273
+ static {
274
+ setComponentTemplate(precompileTemplate("", {
275
+ strictMode: true
276
+ }), this);
277
+ }
278
+ }
279
+ // ---------------------------------------------------------------------------------------------
280
+ // Pies
281
+ /**
282
+ * What a pie's `@shape` is handed as `@props`, as recharts hands its `shape` function: the
283
+ * sector's geometry, its attributes and its row. Pass it on to `Sector`.
284
+ */
285
+
286
+ /** A pie's `@shape`: a component that draws each sector, handed its `@props` and `@index`. */
287
+
288
+ /** What a pie's `@label` component is handed as `@props`: where the label goes, and its sector. */
289
+
290
+ /** A pie's `@label` component: draws a sector's label, handed its `@props` and `@index`. */
291
+
292
+ /** What a pie yields: labels for its sectors, a label for the pie, and a `Cell` per sector. */
293
+
294
+ /** A pie, a sector for each row: recharts' `Pie`. */class Pie extends Part {
295
+ kind = 'pie';
296
+ labels = new Registry();
297
+ cells = new Registry();
298
+ textLabels = new Registry();
299
+ registerLabel = label => this.labels.add(label);
300
+ unregisterLabel = label => this.labels.remove(label);
301
+ registerCell = cell => this.cells.add(cell);
302
+ unregisterCell = cell => this.cells.remove(cell);
303
+ registerTextLabel = label => this.textLabels.add(label);
304
+ unregisterTextLabel = label => this.textLabels.remove(label);
305
+ static {
306
+ setComponentTemplate(precompileTemplate("{{yield (hash LabelList=(component LabelList series=this) Label=(component Label pie=this) Cell=(component Cell series=this))}}", {
307
+ strictMode: true,
308
+ scope: () => ({
309
+ hash,
310
+ LabelList,
311
+ Label,
312
+ Cell
313
+ })
314
+ }), this);
315
+ }
316
+ }
317
+ /** What a `Label`'s `@content` is handed. */
318
+
319
+ /** A label for a pie, such as the total in a donut's hole: recharts' `Label`. */class Label extends Component {
320
+ constructor(owner, args) {
321
+ super(owner, args);
322
+ args.pie.registerTextLabel(this);
323
+ }
324
+ willDestroy() {
325
+ super.willDestroy();
326
+ this.args.pie.unregisterTextLabel(this);
327
+ }
328
+ static {
329
+ setComponentTemplate(precompileTemplate("", {
330
+ strictMode: true
331
+ }), this);
332
+ }
333
+ }
334
+ // ---------------------------------------------------------------------------------------------
335
+ // Tooltip and legend
336
+
337
+ /** The chart's tooltip: shadcn's `ChartTooltip` (recharts' `Tooltip`). */class ChartTooltip extends Part {
338
+ kind = 'tooltip';
339
+ static {
340
+ setComponentTemplate(precompileTemplate("", {
341
+ strictMode: true
342
+ }), this);
343
+ }
344
+ }
345
+ /** The chart's legend: shadcn's `ChartLegend` (recharts' `Legend`). */class ChartLegend extends Part {
346
+ kind = 'legend';
347
+ static {
348
+ setComponentTemplate(precompileTemplate("", {
349
+ strictMode: true
350
+ }), this);
351
+ }
352
+ }
353
+
354
+ export { Area as A, Bar as B, ChartTooltip as C, Line as L, Pie as P, Registry as R, XAxis as X, YAxis as Y, ChartLegend as a, CartesianGrid as b, dotFor as d, isPlainObject as i };
355
+ //# sourceMappingURL=parts-BWLhFFjB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parts-BWLhFFjB.js","sources":["../src/-private/registry.ts","../src/-private/dots.ts","../src/-private/parts.gts"],"sourcesContent":["/*\n * How a chart's parts reach the chart. Glimmer has no context, so a chart yields its parts\n * (`<c.XAxis>`, `<c.Area>`) curried with itself, and each part registers on construction. The\n * chart's block renders before the marks inside its `<svg>`, so every part has registered by\n * the time the chart lays them out in the same render.\n *\n * Glimmer's debug build forbids changing tracked state that the same render has already read\n * (\"You attempted to update `revision`… but it had already been used previously in the same\n * computation\"). A registration sets `revision`, so nothing may read `items` earlier in a render\n * than the block that registers: not in the first render, and not in a later one, where a part\n * the block adds inside an `{{#if}}` registers while the render revalidates the template in\n * order. The chart reads its parts only after its `{{yield}}` (an attribute on the wrapper, which\n * is evaluated before the block, would trip it). And a registration never reads what it writes:\n * the list is a plain array, and `add()` and `remove()` only set the revision.\n */\nimport { tracked } from '@glimmer/tracking'\n\nexport class Registry<T> {\n #items: T[] = []\n #counter = 0\n @tracked private revision = 0\n\n /** Every registered item, in the order the parts were constructed. */\n get items(): readonly T[] {\n void this.revision\n return this.#items\n }\n\n add(item: T): void {\n this.#items = [...this.#items, item]\n this.revision = ++this.#counter\n }\n\n remove(item: T): void {\n if (!this.#items.includes(item)) return\n this.#items = this.#items.filter(other => other !== item)\n this.revision = ++this.#counter\n }\n}\n","/*\n * How a series' `dot`/`activeDot` option becomes what the chart draws: nothing, a circle with\n * attributes, or the caller's component.\n */\nimport { isObject } from '@sindresorhus/is'\nimport type { DotArgs, DotOption } from './parts.gts'\n\nexport interface CircleDot {\n kind: 'circle'\n component?: undefined\n attrs: { r: number; fill: string; stroke: string; strokeWidth: string; class?: string }\n args: DotArgs\n}\n\nexport interface ComponentDot {\n kind: 'component'\n component: Exclude<DotOption, boolean | Record<string, unknown>>\n args: DotArgs\n}\n\nexport type DotRender = CircleDot | ComponentDot\n\n/** A plain object of attributes, as opposed to a component (a class, or a curried definition). */\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n if (!isObject(value)) return false\n const proto = Object.getPrototypeOf(value) as unknown\n return proto === Object.prototype || proto === null\n}\n\n/**\n * The dot to draw for `option`, or null for none. `defaults` are the series' own: a line's dot\n * is a white circle in its stroke, an active dot a filled one with a white ring.\n */\nexport function dotFor(\n option: DotOption | undefined,\n fallback: boolean,\n defaults: CircleDot['attrs'],\n args: DotArgs,\n): DotRender | null {\n const value = option ?? fallback\n if (value === false) return null\n if (value === true) return { kind: 'circle', attrs: defaults, args: { ...args, r: defaults.r } }\n if (isPlainObject(value)) {\n const attrs = {\n ...defaults,\n ...(value.r !== undefined ? { r: Number(value.r) } : {}),\n ...(value.fill !== undefined ? { fill: String(value.fill) } : {}),\n ...(value.stroke !== undefined ? { stroke: String(value.stroke) } : {}),\n ...(value.strokeWidth !== undefined ? { strokeWidth: String(value.strokeWidth) } : {}),\n ...(value.class !== undefined ? { class: String(value.class) } : {}),\n }\n return { kind: 'circle', attrs, args: { ...args, r: attrs.r } }\n }\n return { kind: 'component', component: value as ComponentDot['component'], args }\n}\n","/*\n * The parts a chart yields: a cartesian chart's axes, grid and series, a pie chart's pies, and\n * every chart's tooltip and legend. Each renders nothing where it is written; it registers with\n * the chart, which reads its arguments and draws it in recharts' layer order (grid, areas, bars,\n * lines, axes, dots, labels; pies, then their labels).\n */\nimport Component from '@glimmer/component'\nimport { hash } from '@ember/helper'\nimport type Owner from '@ember/owner'\nimport type { ComponentLike, WithBoundArgs } from '@glint/template'\nimport { Registry } from './registry.ts'\nimport type { CurveType } from './paths.ts'\nimport type { DataKey, DomainBound } from './cartesian.ts'\nimport type { PolarLabelPosition, PolarViewBox } from './polar.ts'\nimport type { TickInterval } from './tick-interval.ts'\nimport type {\n ChartLegendContentArgs,\n ChartTooltipContentArgs,\n LabelFormatter,\n TooltipFormatter,\n} from '../types.ts'\n\n/** What a part needs of its chart: somewhere to register. */\nexport interface ChartRegistrar {\n register(part: ChartPart): void\n unregister(part: ChartPart): void\n}\n\n/** Every part a chart reads. */\nexport type ChartPart =\n XAxis | YAxis | CartesianGrid | Area | Line | Bar | Pie | ChartTooltip | ChartLegend\n\ninterface PartArgs {\n /** The chart it belongs to; the chart's yield passes it. */\n chart: ChartRegistrar\n}\n\n/** A part that registers with its chart while it is rendered. */\nabstract class Part<S extends { Args: PartArgs }> extends Component<S> {\n abstract readonly kind: string\n\n constructor(owner: Owner, args: S['Args']) {\n super(owner, args)\n args.chart.register(this as unknown as ChartPart)\n }\n\n override willDestroy(): void {\n super.willDestroy()\n this.args.chart.unregister(this as unknown as ChartPart)\n }\n}\n\n// ---------------------------------------------------------------------------------------------\n// Axes\n\n/** The arguments an axis shares with recharts' `XAxis` and `YAxis`. */\nexport interface AxisArgs extends PartArgs {\n /** The key (or function) of each row's value on this axis. A category axis without one numbers the rows. */\n dataKey?: DataKey\n /** `category` (the x-axis's default) or `number` (the y-axis's). */\n type?: 'category' | 'number'\n /** Lays the axis out but doesn't draw it. */\n hide?: boolean\n /** Draws the axis inside the plot area instead of beside it. */\n mirror?: boolean\n /** Runs the axis the other way: right to left, or top to bottom. */\n reversed?: boolean\n /** The value range, as `[min, max]`: numbers, `auto`, `dataMin`, `dataMax` or functions. */\n domain?: readonly [DomainBound, DomainBound]\n /** Lets the domain cut the data off instead of growing to fit it. */\n allowDataOverflow?: boolean\n /** Whether nice ticks may be fractions. Default true. */\n allowDecimals?: boolean\n /** How many ticks a number axis aims for. Default 5. */\n tickCount?: number\n /** The ticks to draw, instead of computed ones. */\n ticks?: readonly unknown[]\n /** Whether to draw tick labels. Default true. */\n tick?: boolean\n /** Whether to draw the tick marks. Default true. */\n tickLine?: boolean\n /** Whether to draw the axis line. Default true. */\n axisLine?: boolean\n /** The tick marks' length. Default 6. */\n tickSize?: number\n /** The space between a tick mark and its label. Default 2. */\n tickMargin?: number\n /** The least space between two labels before one is dropped. Default 5. */\n minTickGap?: number\n /** Which ticks to keep when labels would overlap: recharts' `interval`. Default `preserveEnd`. */\n interval?: TickInterval\n /** Formats each tick's label. */\n tickFormatter?: (value: never, index: number) => unknown\n /** A unit appended to each label. */\n unit?: string\n /** The labels' rotation, in degrees. */\n angle?: number\n /** The axis line's and labels' colour. Default `#666` (the chart's CSS greys the labels). */\n stroke?: string\n /** `auto` (by chart and type), or a scale: `linear`, `band` or `point`. */\n scale?: 'auto' | 'linear' | 'band' | 'point'\n}\n\nexport interface XAxisSignature {\n Args: AxisArgs & {\n /** The axis's height. Default 30. */\n height?: number\n /** `bottom` (default) or `top`. */\n orientation?: 'bottom' | 'top'\n /** Space before the first and after the last category, in pixels. */\n padding?: { left?: number; right?: number }\n }\n}\n\n/** The chart's x-axis: recharts' `XAxis`. */\nexport class XAxis extends Part<XAxisSignature> {\n readonly kind = 'xAxis'\n\n <template></template>\n}\n\nexport interface YAxisSignature {\n Args: AxisArgs & {\n /** The axis's width. Default 60. */\n width?: number\n /** `left` (default) or `right`. */\n orientation?: 'left' | 'right'\n /** Space above the top and below the bottom value, in pixels. */\n padding?: { top?: number; bottom?: number }\n }\n}\n\n/** The chart's y-axis: recharts' `YAxis`. */\nexport class YAxis extends Part<YAxisSignature> {\n readonly kind = 'yAxis'\n\n <template></template>\n}\n\n// ---------------------------------------------------------------------------------------------\n// Grid\n\nexport interface CartesianGridSignature {\n Args: PartArgs & {\n /** Whether to draw lines across, at the y-axis's ticks. Default true. */\n horizontal?: boolean\n /** Whether to draw lines down, at the x-axis's ticks. Default true. */\n vertical?: boolean\n /** The lines' colour. Default `#ccc`, which the chart's CSS turns into `--border`. */\n stroke?: string\n strokeDasharray?: string\n /** Recharts' `orientation`, taken as upstream's examples pass it; it doesn't change the grid. */\n orientation?: string\n }\n}\n\n/** Grid lines behind the chart: recharts' `CartesianGrid`. */\nexport class CartesianGrid extends Part<CartesianGridSignature> {\n readonly kind = 'grid'\n\n <template></template>\n}\n\n// ---------------------------------------------------------------------------------------------\n// Series\n\n/** What a series' dot (or active dot) component is handed. */\nexport interface DotArgs {\n cx: number\n cy: number\n r: number\n index: number\n value: unknown\n /** The row the point came from. */\n payload: Record<string, string | number | null | undefined>\n dataKey: DataKey\n stroke?: string\n strokeWidth?: number | string\n fill?: string\n}\n\n/** A dot's look: false for none, true for the default, its attributes, or a component. */\nexport type DotOption =\n | boolean\n | { r?: number; fill?: string; stroke?: string; strokeWidth?: number | string; class?: string }\n | ComponentLike<{ Args: DotArgs; Element: Element }>\n\n/** The arguments every series shares. */\nexport interface SeriesArgs extends PartArgs {\n /** The key (or function) of each row's value. */\n dataKey: DataKey\n /** The series' name in the tooltip and legend. Default: its data key. */\n name?: string\n /** Series with the same stack id stack on each other. */\n stackId?: string | number\n /** Lays the series out but doesn't draw it. */\n hide?: boolean\n /** The legend's icon type; `none` leaves the series out of the legend. */\n legendType?: string\n /** `none` leaves the series out of the tooltip. */\n tooltipType?: string\n /** A unit for its tooltip values. */\n unit?: string\n}\n\n/** What a series yields: its label list. */\nexport interface SeriesParts {\n /** Labels at each point (or bar): recharts' `LabelList`. */\n LabelList: WithBoundArgs<typeof LabelList, 'series'>\n}\n\n/** What a bar series yields: its label list, and a `Cell` per bar. */\nexport interface BarParts extends SeriesParts {\n /** One bar's attributes (its `@fill`), in the order of the rows: recharts' `Cell`. */\n Cell: WithBoundArgs<typeof Cell, 'series'>\n}\n\nabstract class Series<S extends { Args: SeriesArgs }> extends Part<S> {\n readonly labels = new Registry<LabelList>()\n readonly cells = new Registry<Cell>()\n\n registerLabel = (label: LabelList): void => this.labels.add(label)\n unregisterLabel = (label: LabelList): void => this.labels.remove(label)\n registerCell = (cell: Cell): void => this.cells.add(cell)\n unregisterCell = (cell: Cell): void => this.cells.remove(cell)\n}\n\nexport interface AreaSignature {\n Args: SeriesArgs & {\n /** How the line joins the points: `linear` (default), `natural`, `monotone`, `step`… */\n type?: CurveType\n fill?: string\n fillOpacity?: number | string\n stroke?: string\n strokeWidth?: number | string\n strokeDasharray?: string\n /** The dot at each point. Default none. */\n dot?: DotOption\n /** The dot at the active row, while the tooltip shows. Default true. */\n activeDot?: DotOption\n /** Joins the line over missing values. */\n connectNulls?: boolean\n /** Where the area starts: a number, `dataMin` or `dataMax`. Default the axis's 0. */\n baseValue?: number | 'dataMin' | 'dataMax'\n }\n Blocks: { default: [SeriesParts] }\n}\n\n/** A filled area under a line: recharts' `Area`. */\nexport class Area extends Series<AreaSignature> {\n readonly kind = 'area'\n\n <template>{{yield (hash LabelList=(component LabelList series=this))}}</template>\n}\n\nexport interface LineSignature {\n Args: SeriesArgs & {\n /** How the line joins the points: `linear` (default), `natural`, `monotone`, `step`… */\n type?: CurveType\n stroke?: string\n strokeWidth?: number | string\n strokeDasharray?: string\n /** The default dot's fill. Default `#fff`. */\n fill?: string\n /** The dot at each point. Default true. */\n dot?: DotOption\n /** The dot at the active row, while the tooltip shows. Default true. */\n activeDot?: DotOption\n /** Joins the line over missing values. */\n connectNulls?: boolean\n }\n Blocks: { default: [SeriesParts] }\n}\n\n/** A line through the points: recharts' `Line`. */\nexport class Line extends Series<LineSignature> {\n readonly kind = 'line'\n\n <template>{{yield (hash LabelList=(component LabelList series=this))}}</template>\n}\n\n/**\n * What a bar's `@shape` is handed as `@props`, as recharts hands its `shape` function: the\n * bar's rectangle, its attributes, and the row it came from. Pass it on to `Rectangle`.\n */\nexport interface RectangleProps {\n x: number\n y: number\n width: number\n height: number\n /** The corners' radius: one for all four, or `[topLeft, topRight, bottomRight, bottomLeft]`. */\n radius?: number | readonly number[]\n fill?: string\n fillOpacity?: number | string\n stroke?: string\n strokeWidth?: number | string\n /** The bar's row. */\n index: number\n /** Its value. */\n value: unknown\n /** The row it came from (with its `Cell`'s attributes over it). */\n payload: Record<string, string | number | null | undefined>\n dataKey: DataKey\n /** Whether the tooltip shows its row. */\n isActive: boolean\n}\n\n/** A bar's `@shape`: a component that draws each bar, handed its `@props` and `@index`. */\nexport interface BarShapeSignature {\n Args: { props: RectangleProps; index: number }\n Element: Element\n}\n\nexport interface BarSignature {\n Args: SeriesArgs & {\n fill?: string\n fillOpacity?: number | string\n stroke?: string\n strokeWidth?: number | string\n /** The corners' radius: one for all four, or `[topLeft, topRight, bottomRight, bottomLeft]`. */\n radius?: number | readonly number[]\n /** The bar's width, instead of an equal share of the band. */\n barSize?: number\n maxBarSize?: number\n /**\n * Draws each bar: a component handed `@props` (its rectangle, attributes and row) and\n * `@index`, as recharts' `shape` function is. `Rectangle` draws one. Default a `Rectangle`.\n */\n shape?: ComponentLike<BarShapeSignature>\n }\n Blocks: { default: [BarParts] }\n}\n\n/** A bar for each row: recharts' `Bar`. */\nexport class Bar extends Series<BarSignature> {\n readonly kind = 'bar'\n\n <template>\n {{yield (hash LabelList=(component LabelList series=this) Cell=(component Cell series=this))}}\n </template>\n}\n\n// ---------------------------------------------------------------------------------------------\n// Labels\n\n/**\n * Where a label sits against its point or bar, or (in a pie) its sector: `outside`, `center`,\n * `centerTop`, `centerBottom`, or `middle` (the default), in the middle of the sector's ring.\n */\nexport type LabelPosition =\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'center'\n | 'inside'\n | 'insideLeft'\n | 'insideRight'\n | 'insideTop'\n | 'insideBottom'\n | PolarLabelPosition\n\nexport interface LabelListSignature {\n Args: {\n /** The series it labels; the series' yield passes it. */\n series: { registerLabel(label: LabelList): void; unregisterLabel(label: LabelList): void }\n /** The key of each label's value in the row. Default: the series' own value. */\n dataKey?: DataKey\n /**\n * Where each label sits. Default `top` for a line or area, `center` for a bar, `middle`\n * for a pie's sector.\n */\n position?: LabelPosition\n /** The space between a label and its point. Default 5. */\n offset?: number\n /** Formats each label's value. */\n formatter?: (value: never) => unknown\n /** The labels' fill. Default the bar's or sector's own fill (its row's or `Cell`'s), else grey. */\n fill?: string\n fillOpacity?: number | string\n stroke?: string\n fontSize?: number | string\n /** Classes for each label's `<text>`, such as `fill-foreground`. */\n class?: string\n }\n}\n\n/** A label at each point of a series: recharts' `LabelList`. */\nexport class LabelList extends Component<LabelListSignature> {\n constructor(owner: Owner, args: LabelListSignature['Args']) {\n super(owner, args)\n args.series.registerLabel(this)\n }\n\n override willDestroy(): void {\n super.willDestroy()\n this.args.series.unregisterLabel(this)\n }\n\n <template></template>\n}\n\n// ---------------------------------------------------------------------------------------------\n// Cells\n\nexport interface CellSignature {\n Args: {\n /** The bar or pie it belongs to; the series' yield passes it. */\n series: { registerCell(cell: Cell): void; unregisterCell(cell: Cell): void }\n fill?: string\n fillOpacity?: number | string\n stroke?: string\n strokeWidth?: number | string\n }\n}\n\n/**\n * One bar's or sector's attributes, over its series': recharts' `Cell`. Write one per row, in\n * the rows' order:\n *\n * {{#each chartData as |row|}}\n * <bar.Cell @fill={{if (isPositive row.visitors) \"var(--chart-1)\" \"var(--chart-2)\"}} />\n * {{/each}}\n */\nexport class Cell extends Component<CellSignature> {\n constructor(owner: Owner, args: CellSignature['Args']) {\n super(owner, args)\n args.series.registerCell(this)\n }\n\n override willDestroy(): void {\n super.willDestroy()\n this.args.series.unregisterCell(this)\n }\n\n /** The attributes it lays over its bar or sector's row. */\n get attributes(): Record<string, unknown> {\n const { fill, fillOpacity, stroke, strokeWidth } = this.args\n const attributes: Record<string, unknown> = {}\n if (fill !== undefined) attributes['fill'] = fill\n if (fillOpacity !== undefined) attributes['fillOpacity'] = fillOpacity\n if (stroke !== undefined) attributes['stroke'] = stroke\n if (strokeWidth !== undefined) attributes['strokeWidth'] = strokeWidth\n return attributes\n }\n\n <template></template>\n}\n\n// ---------------------------------------------------------------------------------------------\n// Pies\n\n/**\n * What a pie's `@shape` is handed as `@props`, as recharts hands its `shape` function: the\n * sector's geometry, its attributes and its row. Pass it on to `Sector`.\n */\nexport interface SectorProps {\n cx: number\n cy: number\n innerRadius: number\n outerRadius: number\n startAngle: number\n endAngle: number\n midAngle: number\n cornerRadius?: number | string\n fill?: string\n fillOpacity?: number | string\n stroke?: string\n strokeWidth?: number | string\n /** The sector's row. */\n index: number\n value: number\n /** The row's name (the pie's `@nameKey`), or its index. */\n name: unknown\n /** Its share of the pie, from 0 to 1. */\n percent: number\n /** The row it came from (with its `Cell`'s attributes over it). */\n payload: Record<string, string | number | null | undefined>\n dataKey: DataKey\n /** Whether the tooltip shows it. */\n isActive: boolean\n}\n\n/** A pie's `@shape`: a component that draws each sector, handed its `@props` and `@index`. */\nexport interface PieShapeSignature {\n Args: { props: SectorProps; index: number }\n Element: Element\n}\n\n/** What a pie's `@label` component is handed as `@props`: where the label goes, and its sector. */\nexport interface PieLabelProps extends Omit<SectorProps, 'isActive'> {\n /** Where the text goes, past the sector's edge. */\n x: number\n y: number\n /** `start` on the right of the pie, `end` on its left. */\n textAnchor: 'start' | 'middle' | 'end'\n /** recharts' label props have none; here for upstream's examples, which pass it on. */\n dominantBaseline?: string\n}\n\n/** A pie's `@label` component: draws a sector's label, handed its `@props` and `@index`. */\nexport interface PieLabelSignature {\n Args: { props: PieLabelProps; index: number }\n Element: Element\n}\n\n/** What a pie yields: labels for its sectors, a label for the pie, and a `Cell` per sector. */\nexport interface PieParts {\n /** Labels on each sector: recharts' `LabelList`. */\n LabelList: WithBoundArgs<typeof LabelList, 'series'>\n /** A label for the pie, such as the total in a donut's hole: recharts' `Label`. */\n Label: WithBoundArgs<typeof Label, 'pie'>\n /** One sector's attributes (its `@fill`), in the order of the rows: recharts' `Cell`. */\n Cell: WithBoundArgs<typeof Cell, 'series'>\n}\n\nexport interface PieSignature {\n Args: PartArgs & {\n /** The rows, one sector each. Default the chart's `@data`. */\n data?: readonly unknown[]\n /** The key (or function) of each row's value. Default `value`. */\n dataKey?: DataKey\n /** The key (or function) of each row's name, for the tooltip and legend. Default `name`. */\n nameKey?: DataKey\n /** The pie's name, where a row has none. */\n name?: string\n /** The centre, in pixels or a percentage of the plot area. Default `50%`. */\n cx?: number | string\n cy?: number | string\n /** The hole's radius (a donut), in pixels or a percentage of the largest. Default 0. */\n innerRadius?: number | string\n /** The pie's radius, in pixels or a percentage of the largest. Default `80%`. */\n outerRadius?: number | string\n /** The angles it starts and ends at, in degrees counter-clockwise from 3 o'clock. Default 0 and 360. */\n startAngle?: number\n endAngle?: number\n /** The gap between sectors, in degrees. Default 0. */\n paddingAngle?: number\n /** The smallest angle a sector with a value gets. Default 0. */\n minAngle?: number\n /** Rounds the sectors' corners. */\n cornerRadius?: number | string\n /** The sectors' fill where the row and its `Cell` give none. Default `#808080`. */\n fill?: string\n fillOpacity?: number | string\n /** The line between sectors. Default `#fff` (the chart's CSS makes it transparent). */\n stroke?: string\n strokeWidth?: number | string\n /**\n * A label past each sector's edge, with a line to it: true for its value, or a component\n * handed `@props` (where the label goes, and the sector) and `@index`. Default none.\n */\n label?: boolean | ComponentLike<PieLabelSignature>\n /** Whether each label has a line to its sector. Default true. */\n labelLine?: boolean\n /** Draws each sector: a component handed `@props` and `@index`. `Sector` draws one. */\n shape?: ComponentLike<PieShapeSignature>\n /** The legend's icon type; `none` leaves the pie out of the legend. Default `rect`. */\n legendType?: string\n /** `none` leaves the pie out of the tooltip. */\n tooltipType?: string\n /** Lays the pie out but doesn't draw it. */\n hide?: boolean\n }\n Blocks: { default: [PieParts] }\n}\n\n/** A pie, a sector for each row: recharts' `Pie`. */\nexport class Pie extends Part<PieSignature> {\n readonly kind = 'pie'\n readonly labels = new Registry<LabelList>()\n readonly cells = new Registry<Cell>()\n readonly textLabels = new Registry<Label>()\n\n registerLabel = (label: LabelList): void => this.labels.add(label)\n unregisterLabel = (label: LabelList): void => this.labels.remove(label)\n registerCell = (cell: Cell): void => this.cells.add(cell)\n unregisterCell = (cell: Cell): void => this.cells.remove(cell)\n registerTextLabel = (label: Label): void => this.textLabels.add(label)\n unregisterTextLabel = (label: Label): void => this.textLabels.remove(label)\n\n <template>\n {{yield\n (hash\n LabelList=(component LabelList series=this)\n Label=(component Label pie=this)\n Cell=(component Cell series=this)\n )\n }}\n </template>\n}\n\n/** What a `Label`'s `@content` is handed. */\nexport interface LabelContentSignature {\n Args: {\n /** The chart's ring: its centre (`cx`, `cy`), radii and angles. */\n viewBox: PolarViewBox\n /** The label's `@value`. */\n value?: unknown\n /** The label's `@offset`. */\n offset: number\n /** The label's `@position`. */\n position: PolarLabelPosition\n }\n Element: Element\n}\n\nexport interface LabelSignature {\n Args: {\n /** The pie it belongs to; the pie's yield passes it. */\n pie: { registerTextLabel(label: Label): void; unregisterTextLabel(label: Label): void }\n /** The text to show. */\n value?: string | number\n /**\n * Draws the label instead: a component handed `@viewBox` (the chart's ring, its centre at\n * `cx`, `cy`), as recharts' `content` function is handed it. It draws inside the pie.\n */\n content?: ComponentLike<LabelContentSignature>\n /** Where `@value` sits against the chart's ring. Default `middle`, as recharts'. */\n position?: PolarLabelPosition\n /** The space between the label and the ring's edge, for `outside`. Default 5. */\n offset?: number\n /** Classes for the text. */\n class?: string\n /** The text's fill. Default grey (`#808080`). */\n fill?: string\n fontSize?: number | string\n }\n}\n\n/** A label for a pie, such as the total in a donut's hole: recharts' `Label`. */\nexport class Label extends Component<LabelSignature> {\n constructor(owner: Owner, args: LabelSignature['Args']) {\n super(owner, args)\n args.pie.registerTextLabel(this)\n }\n\n override willDestroy(): void {\n super.willDestroy()\n this.args.pie.unregisterTextLabel(this)\n }\n\n <template></template>\n}\n\n// ---------------------------------------------------------------------------------------------\n// Tooltip and legend\n\nexport interface ChartTooltipSignature {\n Args: PartArgs & {\n /**\n * What the tooltip shows: a component, handed `@active`, `@payload`, `@label` and the\n * chart's `@config`. Default `ChartTooltipContent`. Curry its own arguments:\n * `@content={{component ChartTooltipContent indicator=\"line\"}}`.\n */\n content?: ComponentLike<{ Args: ChartTooltipContentArgs }>\n /** The line (or band) under the pointer. Default true; false draws none. */\n cursor?: boolean | { stroke?: string; strokeWidth?: number | string; fill?: string }\n /** Shows the tooltip whatever the pointer does (true), or never (false). */\n active?: boolean\n /** The row the tooltip shows before the pointer moves. */\n defaultIndex?: number\n /** The space between the pointer and the tooltip. Default 10. */\n offset?: number\n /** Passed to the content, for its label. */\n labelClassName?: string\n labelFormatter?: LabelFormatter\n /** Formats each entry: a function returning its text, or a component that draws it. */\n formatter?: TooltipFormatter\n /** Leaves out entries whose value is null. Default true. */\n filterNull?: boolean\n /**\n * Moves the tooltip box smoothly: `'auto'` (the default) unless the user prefers reduced\n * motion, `true` always, `false` never.\n */\n isAnimationActive?: boolean | 'auto'\n }\n}\n\n/** The chart's tooltip: shadcn's `ChartTooltip` (recharts' `Tooltip`). */\nexport class ChartTooltip extends Part<ChartTooltipSignature> {\n readonly kind = 'tooltip'\n\n <template></template>\n}\n\nexport interface ChartLegendSignature {\n Args: PartArgs & {\n /** What the legend shows: a component, handed `@payload` and the chart's `@config`. Default `ChartLegendContent`. */\n content?: ComponentLike<{ Args: ChartLegendContentArgs }>\n /** `bottom` (default), `top` or `middle`. */\n verticalAlign?: 'top' | 'middle' | 'bottom'\n /** `center` (default), `left` or `right`. */\n align?: 'left' | 'center' | 'right'\n /** `horizontal` (default) or `vertical`. */\n layout?: 'horizontal' | 'vertical'\n /** Classes for the legend, handed to its content as `@class`, as recharts' `className`. */\n class?: string\n }\n}\n\n/** The chart's legend: shadcn's `ChartLegend` (recharts' `Legend`). */\nexport class ChartLegend extends Part<ChartLegendSignature> {\n readonly kind = 'legend'\n\n <template></template>\n}\n"],"names":["Registry","g","prototype","tracked","i","items","revision","add","item","remove","includes","filter","other","isPlainObject","value","isObject","proto","Object","getPrototypeOf","dotFor","option","fallback","defaults","args","kind","attrs","r","undefined","Number","fill","String","stroke","strokeWidth","class","component","Part","Component","constructor","owner","chart","register","willDestroy","unregister","XAxis","setComponentTemplate","precompileTemplate","strictMode","YAxis","CartesianGrid","Series","labels","cells","registerLabel","label","unregisterLabel","registerCell","cell","unregisterCell","Area","scope","hash","LabelList","Line","Bar","Cell","series","attributes","fillOpacity","Pie","textLabels","registerTextLabel","unregisterTextLabel","Label","pie","ChartTooltip","ChartLegend"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGO,MAAMA,QAAQ,CAAI;EACvB,MAAM,GAAQ,EAAE;EAChB,QAAQ,GAAG,CAAC;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,UAAA,EAAA,CACXC,OAAO,CAAA,EAAA,YAAA;AAAA,MAAA,OAAoB,CAAC;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,SAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,UAAA,CAAA,EAAA,MAAA;AAE7B;EACA,IAAIC,KAAKA,GAAiB;IACxB,KAAK,IAAI,CAACC,QAAQ;IAClB,OAAO,IAAI,CAAC,MAAM;AACpB,EAAA;EAEAC,GAAGA,CAACC,IAAO,EAAQ;AACjB,IAAA,IA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