@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,565 @@
1
+ /*!
2
+ * @ember-joinery/chart ports recharts 3.8.0 (https://github.com/recharts/recharts): its tick
3
+ * selection, nice tick values, text measurement, cartesian, pie and polar layout, tooltip
4
+ * placement, and rectangle, sector and polygon paths.
5
+ *
6
+ * The MIT License (MIT). Copyright (c) 2015-present recharts
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
9
+ * and associated documentation files (the "Software"), to deal in the Software without
10
+ * restriction, including without limitation the rights to use, copy, modify, merge, publish,
11
+ * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
12
+ * Software is furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all copies or
15
+ * substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
18
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+ import Component from '@glimmer/component';
24
+ import { isNumber, isString, isFunction } from '@sindresorhus/is';
25
+ import { v as valueOf } from './cartesian-D9hWDamz.js';
26
+ import { precompileTemplate } from '@ember/template-compilation';
27
+ import { setComponentTemplate } from '@ember/component';
28
+
29
+ /*
30
+ * The geometry of a pie chart, computed the way recharts 3 computes it, so a Joinery pie draws
31
+ * the same sectors, labels and label lines in the same places: each sector's angles and radii
32
+ * (recharts' `computePieSectors`), a sector's path (its `Sector`, with or without rounded
33
+ * corners), where a pie's labels go (its `PieLabels` and polar `Label`), and which sector a
34
+ * point falls in (`inRangeOfSector`).
35
+ *
36
+ * recharts is MIT licensed; its notice is in NOTICE, and the build keeps it in the module that
37
+ * ships this (see rollup.config.mjs).
38
+ */
39
+ const RADIAN = Math.PI / 180;
40
+ /** A point at `radius` and `angle` (degrees, counter-clockwise from 3 o'clock) from the centre. */
41
+ function polarToCartesian(cx, cy, radius, angle) {
42
+ return {
43
+ x: cx + Math.cos(-RADIAN * angle) * radius,
44
+ y: cy + Math.sin(-RADIAN * angle) * radius
45
+ };
46
+ }
47
+ function mathSign(value) {
48
+ if (value === 0) return 0;
49
+ return value > 0 ? 1 : -1;
50
+ }
51
+
52
+ /**
53
+ * recharts' `getPercentValue`: a percentage of `total` (`'80%'`), or a number as is. With
54
+ * `validate`, a value over the total is the total.
55
+ */
56
+ function percentOf(value, total, fallback = 0, validate = false) {
57
+ if (!isNumber(value) && !isString(value)) return fallback;
58
+ let result;
59
+ if (isString(value) && value.includes('%')) {
60
+ result = total * parseFloat(value.slice(0, value.indexOf('%'))) / 100;
61
+ } else {
62
+ result = +value;
63
+ }
64
+ if (Number.isNaN(result)) result = fallback;
65
+ if (validate && result > total) result = total;
66
+ return result;
67
+ }
68
+
69
+ /** recharts' `round`: four decimals, and never `-0`. */
70
+ function round(value, precision = 4) {
71
+ const factor = 10 ** precision;
72
+ const rounded = Math.round(value * factor) / factor;
73
+ return Object.is(rounded, -0) ? 0 : rounded;
74
+ }
75
+
76
+ /** A path from a template, each number rounded as recharts' `roundTemplateLiteral` rounds it. */
77
+ function path(strings, ...values) {
78
+ return strings.reduce((result, string, i) => {
79
+ const value = values[i - 1];
80
+ if (isString(value)) return result + value + string;
81
+ if (value !== undefined) return result + round(value) + string;
82
+ return result + string;
83
+ }, '');
84
+ }
85
+
86
+ // ---------------------------------------------------------------------------------------------
87
+ // Sectors
88
+
89
+ function sectorDeltaAngle(startAngle, endAngle) {
90
+ const sign = mathSign(endAngle - startAngle);
91
+ const deltaAngle = Math.min(Math.abs(endAngle - startAngle), 359.999);
92
+ return sign * deltaAngle;
93
+ }
94
+
95
+ /** The geometry a sector is drawn from. */
96
+
97
+ function sectorPath({
98
+ cx,
99
+ cy,
100
+ innerRadius,
101
+ outerRadius,
102
+ startAngle,
103
+ endAngle
104
+ }) {
105
+ const angle = sectorDeltaAngle(startAngle, endAngle);
106
+ // When the angle is 360, the start and end points coincide.
107
+ const tempEndAngle = startAngle + angle;
108
+ const outerStart = polarToCartesian(cx, cy, outerRadius, startAngle);
109
+ const outerEnd = polarToCartesian(cx, cy, outerRadius, tempEndAngle);
110
+ let d = path`M ${outerStart.x},${outerStart.y}
111
+ A ${outerRadius},${outerRadius},0,
112
+ ${+(Math.abs(angle) > 180)},${+(startAngle > tempEndAngle)},
113
+ ${outerEnd.x},${outerEnd.y}
114
+ `;
115
+ if (innerRadius > 0) {
116
+ const innerStart = polarToCartesian(cx, cy, innerRadius, startAngle);
117
+ const innerEnd = polarToCartesian(cx, cy, innerRadius, tempEndAngle);
118
+ d += path`L ${innerEnd.x},${innerEnd.y}
119
+ A ${innerRadius},${innerRadius},0,
120
+ ${+(Math.abs(angle) > 180)},${+(startAngle <= tempEndAngle)},
121
+ ${innerStart.x},${innerStart.y} Z`;
122
+ } else {
123
+ d += path`L ${cx},${cy} Z`;
124
+ }
125
+ return d;
126
+ }
127
+ function tangentCircle(options) {
128
+ const {
129
+ cx,
130
+ cy,
131
+ radius,
132
+ angle,
133
+ sign,
134
+ isExternal,
135
+ cornerRadius,
136
+ cornerIsExternal
137
+ } = options;
138
+ const centerRadius = cornerRadius * (isExternal ? 1 : -1) + radius;
139
+ const theta = Math.asin(cornerRadius / centerRadius) / RADIAN;
140
+ const centerAngle = cornerIsExternal ? angle : angle + sign * theta;
141
+ // The point where the corner's circle touches the arc, and where it touches the radius line.
142
+ const circleTangency = polarToCartesian(cx, cy, radius, centerAngle);
143
+ const lineTangencyAngle = cornerIsExternal ? angle - sign * theta : angle;
144
+ const lineTangency = polarToCartesian(cx, cy, centerRadius * Math.cos(theta * RADIAN), lineTangencyAngle);
145
+ return {
146
+ circleTangency,
147
+ lineTangency,
148
+ theta
149
+ };
150
+ }
151
+ function sectorWithCorner(options) {
152
+ const {
153
+ cx,
154
+ cy,
155
+ innerRadius,
156
+ outerRadius,
157
+ cornerRadius,
158
+ forceCornerRadius,
159
+ cornerIsExternal,
160
+ startAngle,
161
+ endAngle
162
+ } = options;
163
+ const sign = mathSign(endAngle - startAngle);
164
+ const start = tangentCircle({
165
+ cx,
166
+ cy,
167
+ radius: outerRadius,
168
+ angle: startAngle,
169
+ sign,
170
+ cornerRadius,
171
+ cornerIsExternal
172
+ });
173
+ const end = tangentCircle({
174
+ cx,
175
+ cy,
176
+ radius: outerRadius,
177
+ angle: endAngle,
178
+ sign: -sign,
179
+ cornerRadius,
180
+ cornerIsExternal
181
+ });
182
+ const outerArcAngle = cornerIsExternal ? Math.abs(startAngle - endAngle) : Math.abs(startAngle - endAngle) - start.theta - end.theta;
183
+ if (outerArcAngle < 0) {
184
+ if (forceCornerRadius) {
185
+ return path`M ${start.lineTangency.x},${start.lineTangency.y}
186
+ a${cornerRadius},${cornerRadius},0,0,1,${cornerRadius * 2},0
187
+ a${cornerRadius},${cornerRadius},0,0,1,${-cornerRadius * 2},0
188
+ `;
189
+ }
190
+ return sectorPath({
191
+ cx,
192
+ cy,
193
+ innerRadius,
194
+ outerRadius,
195
+ startAngle,
196
+ endAngle
197
+ });
198
+ }
199
+ let d = path`M ${start.lineTangency.x},${start.lineTangency.y}
200
+ A${cornerRadius},${cornerRadius},0,0,${+(sign < 0)},${start.circleTangency.x},${start.circleTangency.y}
201
+ A${outerRadius},${outerRadius},0,${+(outerArcAngle > 180)},${+(sign < 0)},${end.circleTangency.x},${end.circleTangency.y}
202
+ A${cornerRadius},${cornerRadius},0,0,${+(sign < 0)},${end.lineTangency.x},${end.lineTangency.y}
203
+ `;
204
+ if (innerRadius > 0) {
205
+ const innerStart = tangentCircle({
206
+ cx,
207
+ cy,
208
+ radius: innerRadius,
209
+ angle: startAngle,
210
+ sign,
211
+ isExternal: true,
212
+ cornerRadius,
213
+ cornerIsExternal
214
+ });
215
+ const innerEnd = tangentCircle({
216
+ cx,
217
+ cy,
218
+ radius: innerRadius,
219
+ angle: endAngle,
220
+ sign: -sign,
221
+ isExternal: true,
222
+ cornerRadius,
223
+ cornerIsExternal
224
+ });
225
+ const innerArcAngle = cornerIsExternal ? Math.abs(startAngle - endAngle) : Math.abs(startAngle - endAngle) - innerStart.theta - innerEnd.theta;
226
+ if (innerArcAngle < 0 && cornerRadius === 0) return `${d}L${cx},${cy}Z`;
227
+ d += path`L${innerEnd.lineTangency.x},${innerEnd.lineTangency.y}
228
+ A${cornerRadius},${cornerRadius},0,0,${+(sign < 0)},${innerEnd.circleTangency.x},${innerEnd.circleTangency.y}
229
+ A${innerRadius},${innerRadius},0,${+(innerArcAngle > 180)},${+(sign > 0)},${innerStart.circleTangency.x},${innerStart.circleTangency.y}
230
+ A${cornerRadius},${cornerRadius},0,0,${+(sign < 0)},${innerStart.lineTangency.x},${innerStart.lineTangency.y}Z`;
231
+ } else {
232
+ d += path`L${cx},${cy}Z`;
233
+ }
234
+ return d;
235
+ }
236
+
237
+ /**
238
+ * A sector's path, as recharts' `Sector` draws it, or null where it draws nothing (an outer
239
+ * radius inside the inner one, or no angle).
240
+ */
241
+ function sectorD(sector) {
242
+ const {
243
+ innerRadius,
244
+ outerRadius,
245
+ startAngle,
246
+ endAngle
247
+ } = sector;
248
+ if (outerRadius < innerRadius || startAngle === endAngle) return null;
249
+ const deltaRadius = outerRadius - innerRadius;
250
+ const cornerRadius = percentOf(sector.cornerRadius ?? 0, deltaRadius, 0, true);
251
+ if (cornerRadius > 0 && Math.abs(startAngle - endAngle) < 360) {
252
+ return sectorWithCorner({
253
+ cx: sector.cx,
254
+ cy: sector.cy,
255
+ innerRadius,
256
+ outerRadius,
257
+ cornerRadius: Math.min(cornerRadius, deltaRadius / 2),
258
+ forceCornerRadius: sector.forceCornerRadius ?? false,
259
+ cornerIsExternal: sector.cornerIsExternal ?? false,
260
+ startAngle,
261
+ endAngle
262
+ });
263
+ }
264
+ return sectorPath(sector);
265
+ }
266
+
267
+ // ---------------------------------------------------------------------------------------------
268
+ // Pies
269
+
270
+ /** What a pie does, with recharts' defaults filled in. */
271
+
272
+ /** recharts' defaults for a `Pie`. */
273
+ const PIE_DEFAULTS = {
274
+ cx: '50%',
275
+ cy: '50%',
276
+ dataKey: 'value',
277
+ nameKey: 'name',
278
+ startAngle: 0,
279
+ endAngle: 360,
280
+ innerRadius: 0,
281
+ outerRadius: '80%',
282
+ paddingAngle: 0,
283
+ minAngle: 0,
284
+ fill: '#808080',
285
+ stroke: '#fff'
286
+ };
287
+
288
+ /** A sector of a pie, as recharts computes it. */
289
+
290
+ /** The plot area: the chart less its margins and its legend. */
291
+
292
+ function deltaAngle(startAngle, endAngle) {
293
+ const sign = mathSign(endAngle - startAngle);
294
+ return sign * Math.min(Math.abs(endAngle - startAngle), 360);
295
+ }
296
+
297
+ /** A row's value at `dataKey`, or `fallback` where it has none. */
298
+ function valueAt(datum, dataKey, fallback) {
299
+ const value = valueOf(datum, dataKey);
300
+ return value === null || value === undefined ? fallback : value;
301
+ }
302
+
303
+ /** recharts' `parseCoordinateOfPie`: a pie's centre and radii in the plot area. */
304
+ function pieCoordinate(settings, offset, datum) {
305
+ const {
306
+ top,
307
+ left,
308
+ width,
309
+ height
310
+ } = offset;
311
+ const maxPieRadius = Math.min(Math.abs(width), Math.abs(height)) / 2;
312
+ const outer = isFunction(settings.outerRadius) ? settings.outerRadius(datum) : settings.outerRadius;
313
+ return {
314
+ cx: left + percentOf(settings.cx, width, width / 2),
315
+ cy: top + percentOf(settings.cy, height, height / 2),
316
+ innerRadius: percentOf(settings.innerRadius, maxPieRadius, 0),
317
+ outerRadius: percentOf(outer, maxPieRadius, maxPieRadius * 0.8),
318
+ maxRadius: settings.maxRadius || Math.sqrt(width * width + height * height) / 2
319
+ };
320
+ }
321
+
322
+ /**
323
+ * recharts' `computePieSectors`: each row's sector, its angle its share of the total. A `Cell`
324
+ * at a row's index lays its attributes (its `fill`) over the row. Undefined when the rows sum
325
+ * to nothing.
326
+ */
327
+ function pieSectors(settings, data, cells, offset) {
328
+ const {
329
+ startAngle,
330
+ endAngle,
331
+ dataKey,
332
+ nameKey,
333
+ cornerRadius
334
+ } = settings;
335
+ const minAngle = Math.abs(settings.minAngle);
336
+ const delta = deltaAngle(startAngle, endAngle);
337
+ const absDeltaAngle = Math.abs(delta);
338
+ const paddingAngle = data.length <= 1 ? 0 : settings.paddingAngle ?? 0;
339
+ const notZeroItemCount = data.filter(entry => valueAt(entry, dataKey, 0) !== 0).length;
340
+ const totalPaddingAngle = (absDeltaAngle >= 360 ? notZeroItemCount : notZeroItemCount - 1) * paddingAngle;
341
+ const realTotalAngle = absDeltaAngle - notZeroItemCount * minAngle - totalPaddingAngle;
342
+ const sum = data.reduce((result, entry) => {
343
+ const value = valueAt(entry, dataKey, 0);
344
+ return result + (isNumber(value) ? value : 0);
345
+ }, 0);
346
+ if (!(sum > 0)) return undefined;
347
+ let previous;
348
+ return data.map((entry, i) => {
349
+ const raw = valueAt(entry, dataKey, 0);
350
+ const value = isNumber(raw) ? raw : 0;
351
+ const name = valueAt(entry, nameKey, i);
352
+ const coordinate = pieCoordinate(settings, offset, entry);
353
+ const percent = value / sum;
354
+ const payload = {
355
+ ...entry,
356
+ ...cells[i]
357
+ };
358
+ const fill = isString(payload['fill']) ? payload['fill'] : settings.fill;
359
+ const sectorStart = i ? previous.endAngle + mathSign(delta) * paddingAngle * (raw !== 0 ? 1 : 0) : startAngle;
360
+ const sectorEnd = sectorStart + mathSign(delta) * ((raw !== 0 ? minAngle : 0) + percent * realTotalAngle);
361
+ const midAngle = (sectorStart + sectorEnd) / 2;
362
+ const middleRadius = (coordinate.innerRadius + coordinate.outerRadius) / 2;
363
+ previous = {
364
+ index: i,
365
+ ...coordinate,
366
+ startAngle: sectorStart,
367
+ endAngle: sectorEnd,
368
+ midAngle,
369
+ middleRadius,
370
+ paddingAngle: mathSign(delta) * paddingAngle,
371
+ percent,
372
+ cornerRadius,
373
+ value: isNumber(raw) ? raw : 0,
374
+ name,
375
+ payload,
376
+ fill,
377
+ tooltipPosition: polarToCartesian(coordinate.cx, coordinate.cy, middleRadius, midAngle)
378
+ };
379
+ return previous;
380
+ });
381
+ }
382
+
383
+ /**
384
+ * The angles recharts draws a pie's sectors at. Its animation (which ends there even when it
385
+ * doesn't run) lays each sector after the last by its angle, rounded to four decimals, so the
386
+ * drawn sectors carry that rounding: the last can end a hair past 360°. Labels and the tooltip
387
+ * keep the angles `pieSectors()` computed, as recharts' do.
388
+ */
389
+ function drawnSectorAngles(sectors) {
390
+ let current = sectors[0]?.startAngle ?? 0;
391
+ return sectors.map((sector, index) => {
392
+ const padding = index > 0 ? sector.paddingAngle : 0;
393
+ const angle = round(0 + 1 * (sector.endAngle - sector.startAngle));
394
+ const startAngle = current + padding;
395
+ const endAngle = current + angle + padding;
396
+ current = endAngle;
397
+ return {
398
+ startAngle,
399
+ endAngle
400
+ };
401
+ });
402
+ }
403
+
404
+ // ---------------------------------------------------------------------------------------------
405
+ // Labels
406
+
407
+ /** A text's `dy` for its vertical anchor, on one line, as recharts' `Text` works it out. */
408
+ const TEXT_DY = {
409
+ start: '0.71em',
410
+ middle: '0.355em',
411
+ end: '0em'
412
+ };
413
+ /**
414
+ * recharts' `PieLabels`: a label out past a sector's edge (by `offsetRadius`, 20 by default), at
415
+ * its middle angle, with a line to it, its text anchored away from the centre.
416
+ */
417
+ function pieLabelPlacement(sector, offsetRadius = 20) {
418
+ const midAngle = (sector.startAngle + sector.endAngle) / 2;
419
+ const end = polarToCartesian(sector.cx, sector.cy, sector.outerRadius + offsetRadius, midAngle);
420
+ const textAnchor = end.x > sector.cx ? 'start' : end.x < sector.cx ? 'end' : 'middle';
421
+ return {
422
+ x: end.x,
423
+ y: end.y,
424
+ textAnchor,
425
+ line: [polarToCartesian(sector.cx, sector.cy, sector.outerRadius, midAngle), end]
426
+ };
427
+ }
428
+
429
+ /** Where a polar label sits against a sector (or the chart's ring). */
430
+
431
+ /** A sector, or the chart's whole ring, as a polar label reads it: recharts' polar view box. */
432
+
433
+ /** recharts' `getAttrsOfPolarLabel`: where a label sits against a sector, and how it is anchored. */
434
+ function polarLabelPlacement(viewBox, offset, position) {
435
+ const {
436
+ cx,
437
+ cy,
438
+ innerRadius,
439
+ outerRadius,
440
+ startAngle,
441
+ endAngle
442
+ } = viewBox;
443
+ const midAngle = (startAngle + endAngle) / 2;
444
+ if (position === 'outside') {
445
+ const {
446
+ x,
447
+ y
448
+ } = polarToCartesian(cx, cy, outerRadius + offset, midAngle);
449
+ return {
450
+ x,
451
+ y,
452
+ textAnchor: x >= cx ? 'start' : 'end',
453
+ dy: TEXT_DY.middle
454
+ };
455
+ }
456
+ if (position === 'center') return {
457
+ x: cx,
458
+ y: cy,
459
+ textAnchor: 'middle',
460
+ dy: TEXT_DY.middle
461
+ };
462
+ if (position === 'centerTop') return {
463
+ x: cx,
464
+ y: cy,
465
+ textAnchor: 'middle',
466
+ dy: TEXT_DY.start
467
+ };
468
+ if (position === 'centerBottom') return {
469
+ x: cx,
470
+ y: cy,
471
+ textAnchor: 'middle',
472
+ dy: TEXT_DY.end
473
+ };
474
+ const r = (innerRadius + outerRadius) / 2;
475
+ const {
476
+ x,
477
+ y
478
+ } = polarToCartesian(cx, cy, r, midAngle);
479
+ return {
480
+ x,
481
+ y,
482
+ textAnchor: 'middle',
483
+ dy: TEXT_DY.middle
484
+ };
485
+ }
486
+
487
+ // ---------------------------------------------------------------------------------------------
488
+ // Hit testing
489
+
490
+ function angleOfPoint(point, center) {
491
+ const radius = Math.sqrt((point.x - center.cx) ** 2 + (point.y - center.cy) ** 2);
492
+ if (radius <= 0) return {
493
+ radius,
494
+ angle: 0
495
+ };
496
+ let angleInRadian = Math.acos((point.x - center.cx) / radius);
497
+ if (point.y > center.cy) angleInRadian = 2 * Math.PI - angleInRadian;
498
+ return {
499
+ radius,
500
+ angle: angleInRadian / RADIAN
501
+ };
502
+ }
503
+
504
+ /** recharts' `inRangeOfSector`: whether a point is inside a sector's ring and angles. */
505
+ function inSector(point, sector) {
506
+ const {
507
+ radius,
508
+ angle
509
+ } = angleOfPoint(point, sector);
510
+ if (radius === 0 || radius < sector.innerRadius || radius > sector.outerRadius) return false;
511
+ const startCount = Math.floor(sector.startAngle / 360);
512
+ const endCount = Math.floor(sector.endAngle / 360);
513
+ const min = Math.min(startCount, endCount);
514
+ const startAngle = sector.startAngle - min * 360;
515
+ const endAngle = sector.endAngle - min * 360;
516
+ let formatted = angle;
517
+ if (startAngle <= endAngle) {
518
+ while (formatted > endAngle) formatted -= 360;
519
+ while (formatted < startAngle) formatted += 360;
520
+ return formatted >= startAngle && formatted <= endAngle;
521
+ }
522
+ while (formatted > startAngle) formatted -= 360;
523
+ while (formatted < endAngle) formatted += 360;
524
+ return formatted >= endAngle && formatted <= startAngle;
525
+ }
526
+
527
+ /**
528
+ * A pie's sector: recharts' `Sector`. A pie draws each of its sectors with one; draw one
529
+ * yourself in a pie's `@shape`, given the props it is handed, and override any of them:
530
+ *
531
+ * const ActiveShape = <template>
532
+ * <Sector @props={{@props}} @outerRadius={{add @props.outerRadius 10}} />
533
+ * </template>
534
+ *
535
+ * It takes the sector's `fill`, `stroke` and `stroke-width` from `@props`; attributes on it win.
536
+ */
537
+ class Sector extends Component {
538
+ get geometry() {
539
+ const props = this.args.props ?? {};
540
+ return {
541
+ cx: this.args.cx ?? props.cx ?? 0,
542
+ cy: this.args.cy ?? props.cy ?? 0,
543
+ innerRadius: this.args.innerRadius ?? props.innerRadius ?? 0,
544
+ outerRadius: this.args.outerRadius ?? props.outerRadius ?? 0,
545
+ startAngle: this.args.startAngle ?? props.startAngle ?? 0,
546
+ endAngle: this.args.endAngle ?? props.endAngle ?? 0,
547
+ cornerRadius: this.args.cornerRadius ?? props.cornerRadius ?? 0
548
+ };
549
+ }
550
+ get d() {
551
+ return sectorD(this.geometry);
552
+ }
553
+ get name() {
554
+ const name = this.args.props?.name;
555
+ return name === undefined || name === null ? undefined : String(name);
556
+ }
557
+ static {
558
+ setComponentTemplate(precompileTemplate("{{#if this.d}}\n <path class=\"recharts-sector\" fill={{@props.fill}} fill-opacity={{@props.fillOpacity}} stroke={{@props.stroke}} stroke-width={{@props.strokeWidth}} d={{this.d}} data-test-jn-part=\"sector\" data-test-jn-value={{this.name}} ...attributes></path>\n{{/if}}", {
559
+ strictMode: true
560
+ }), this);
561
+ }
562
+ }
563
+
564
+ export { PIE_DEFAULTS as P, Sector as S, percentOf as a, pieLabelPlacement as b, polarLabelPlacement as c, drawnSectorAngles as d, inSector as i, pieSectors as p };
565
+ //# sourceMappingURL=sector-7shQPJuQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sector-7shQPJuQ.js","sources":["../src/-private/polar.ts","../src/components/sector.gts"],"sourcesContent":["/*\n * The geometry of a pie chart, computed the way recharts 3 computes it, so a Joinery pie draws\n * the same sectors, labels and label lines in the same places: each sector's angles and radii\n * (recharts' `computePieSectors`), a sector's path (its `Sector`, with or without rounded\n * corners), where a pie's labels go (its `PieLabels` and polar `Label`), and which sector a\n * point falls in (`inRangeOfSector`).\n *\n * recharts is MIT licensed; its notice is in NOTICE, and the build keeps it in the module that\n * ships this (see rollup.config.mjs).\n */\nimport { isFunction, isNumber, isString } from '@sindresorhus/is'\nimport { valueOf, type DataKey } from './cartesian.ts'\n\nexport const RADIAN = Math.PI / 180\n\nexport interface Point {\n x: number\n y: number\n}\n\n/** A point at `radius` and `angle` (degrees, counter-clockwise from 3 o'clock) from the centre. */\nexport function polarToCartesian(cx: number, cy: number, radius: number, angle: number): Point {\n return {\n x: cx + Math.cos(-RADIAN * angle) * radius,\n y: cy + Math.sin(-RADIAN * angle) * radius,\n }\n}\n\nexport function mathSign(value: number): number {\n if (value === 0) return 0\n return value > 0 ? 1 : -1\n}\n\n/**\n * recharts' `getPercentValue`: a percentage of `total` (`'80%'`), or a number as is. With\n * `validate`, a value over the total is the total.\n */\nexport function percentOf(\n value: number | string | undefined | null,\n total: number,\n fallback = 0,\n validate = false,\n): number {\n if (!isNumber(value) && !isString(value)) return fallback\n let result: number\n if (isString(value) && value.includes('%')) {\n result = (total * parseFloat(value.slice(0, value.indexOf('%')))) / 100\n } else {\n result = +value\n }\n if (Number.isNaN(result)) result = fallback\n if (validate && result > total) result = total\n return result\n}\n\n/** recharts' `round`: four decimals, and never `-0`. */\nexport function round(value: number, precision = 4): number {\n const factor = 10 ** precision\n const rounded = Math.round(value * factor) / factor\n return Object.is(rounded, -0) ? 0 : rounded\n}\n\n/** A path from a template, each number rounded as recharts' `roundTemplateLiteral` rounds it. */\nfunction path(strings: TemplateStringsArray, ...values: (number | string)[]): string {\n return strings.reduce((result, string, i) => {\n const value = values[i - 1]\n if (isString(value)) return result + value + string\n if (value !== undefined) return result + round(value) + string\n return result + string\n }, '')\n}\n\n// ---------------------------------------------------------------------------------------------\n// Sectors\n\nfunction sectorDeltaAngle(startAngle: number, endAngle: number): number {\n const sign = mathSign(endAngle - startAngle)\n const deltaAngle = Math.min(Math.abs(endAngle - startAngle), 359.999)\n return sign * deltaAngle\n}\n\n/** The geometry a sector is drawn from. */\nexport interface SectorGeometry {\n cx: number\n cy: number\n innerRadius: number\n outerRadius: number\n startAngle: number\n endAngle: number\n /** Rounds the corners: a number, or a percentage of the ring's width. */\n cornerRadius?: number | string\n forceCornerRadius?: boolean\n cornerIsExternal?: boolean\n}\n\nfunction sectorPath({\n cx,\n cy,\n innerRadius,\n outerRadius,\n startAngle,\n endAngle,\n}: Omit<SectorGeometry, 'cornerRadius'>): string {\n const angle = sectorDeltaAngle(startAngle, endAngle)\n // When the angle is 360, the start and end points coincide.\n const tempEndAngle = startAngle + angle\n const outerStart = polarToCartesian(cx, cy, outerRadius, startAngle)\n const outerEnd = polarToCartesian(cx, cy, outerRadius, tempEndAngle)\n let d = path`M ${outerStart.x},${outerStart.y}\n A ${outerRadius},${outerRadius},0,\n ${+(Math.abs(angle) > 180)},${+(startAngle > tempEndAngle)},\n ${outerEnd.x},${outerEnd.y}\n `\n if (innerRadius > 0) {\n const innerStart = polarToCartesian(cx, cy, innerRadius, startAngle)\n const innerEnd = polarToCartesian(cx, cy, innerRadius, tempEndAngle)\n d += path`L ${innerEnd.x},${innerEnd.y}\n A ${innerRadius},${innerRadius},0,\n ${+(Math.abs(angle) > 180)},${+(startAngle <= tempEndAngle)},\n ${innerStart.x},${innerStart.y} Z`\n } else {\n d += path`L ${cx},${cy} Z`\n }\n return d\n}\n\nfunction tangentCircle(options: {\n cx: number\n cy: number\n radius: number\n angle: number\n sign: number\n isExternal?: boolean\n cornerRadius: number\n cornerIsExternal?: boolean\n}) {\n const { cx, cy, radius, angle, sign, isExternal, cornerRadius, cornerIsExternal } = options\n const centerRadius = cornerRadius * (isExternal ? 1 : -1) + radius\n const theta = Math.asin(cornerRadius / centerRadius) / RADIAN\n const centerAngle = cornerIsExternal ? angle : angle + sign * theta\n // The point where the corner's circle touches the arc, and where it touches the radius line.\n const circleTangency = polarToCartesian(cx, cy, radius, centerAngle)\n const lineTangencyAngle = cornerIsExternal ? angle - sign * theta : angle\n const lineTangency = polarToCartesian(\n cx,\n cy,\n centerRadius * Math.cos(theta * RADIAN),\n lineTangencyAngle,\n )\n return { circleTangency, lineTangency, theta }\n}\n\nfunction sectorWithCorner(\n options: Required<Omit<SectorGeometry, 'cornerRadius'>> & { cornerRadius: number },\n): string {\n const {\n cx,\n cy,\n innerRadius,\n outerRadius,\n cornerRadius,\n forceCornerRadius,\n cornerIsExternal,\n startAngle,\n endAngle,\n } = options\n const sign = mathSign(endAngle - startAngle)\n const start = tangentCircle({\n cx,\n cy,\n radius: outerRadius,\n angle: startAngle,\n sign,\n cornerRadius,\n cornerIsExternal,\n })\n const end = tangentCircle({\n cx,\n cy,\n radius: outerRadius,\n angle: endAngle,\n sign: -sign,\n cornerRadius,\n cornerIsExternal,\n })\n const outerArcAngle = cornerIsExternal\n ? Math.abs(startAngle - endAngle)\n : Math.abs(startAngle - endAngle) - start.theta - end.theta\n if (outerArcAngle < 0) {\n if (forceCornerRadius) {\n return path`M ${start.lineTangency.x},${start.lineTangency.y}\n a${cornerRadius},${cornerRadius},0,0,1,${cornerRadius * 2},0\n a${cornerRadius},${cornerRadius},0,0,1,${-cornerRadius * 2},0\n `\n }\n return sectorPath({ cx, cy, innerRadius, outerRadius, startAngle, endAngle })\n }\n let d = path`M ${start.lineTangency.x},${start.lineTangency.y}\n A${cornerRadius},${cornerRadius},0,0,${+(sign < 0)},${start.circleTangency.x},${start.circleTangency.y}\n A${outerRadius},${outerRadius},0,${+(outerArcAngle > 180)},${+(sign < 0)},${end.circleTangency.x},${end.circleTangency.y}\n A${cornerRadius},${cornerRadius},0,0,${+(sign < 0)},${end.lineTangency.x},${end.lineTangency.y}\n `\n if (innerRadius > 0) {\n const innerStart = tangentCircle({\n cx,\n cy,\n radius: innerRadius,\n angle: startAngle,\n sign,\n isExternal: true,\n cornerRadius,\n cornerIsExternal,\n })\n const innerEnd = tangentCircle({\n cx,\n cy,\n radius: innerRadius,\n angle: endAngle,\n sign: -sign,\n isExternal: true,\n cornerRadius,\n cornerIsExternal,\n })\n const innerArcAngle = cornerIsExternal\n ? Math.abs(startAngle - endAngle)\n : Math.abs(startAngle - endAngle) - innerStart.theta - innerEnd.theta\n if (innerArcAngle < 0 && cornerRadius === 0) return `${d}L${cx},${cy}Z`\n d += path`L${innerEnd.lineTangency.x},${innerEnd.lineTangency.y}\n A${cornerRadius},${cornerRadius},0,0,${+(sign < 0)},${innerEnd.circleTangency.x},${innerEnd.circleTangency.y}\n A${innerRadius},${innerRadius},0,${+(innerArcAngle > 180)},${+(sign > 0)},${innerStart.circleTangency.x},${innerStart.circleTangency.y}\n A${cornerRadius},${cornerRadius},0,0,${+(sign < 0)},${innerStart.lineTangency.x},${innerStart.lineTangency.y}Z`\n } else {\n d += path`L${cx},${cy}Z`\n }\n return d\n}\n\n/**\n * A sector's path, as recharts' `Sector` draws it, or null where it draws nothing (an outer\n * radius inside the inner one, or no angle).\n */\nexport function sectorD(sector: SectorGeometry): string | null {\n const { innerRadius, outerRadius, startAngle, endAngle } = sector\n if (outerRadius < innerRadius || startAngle === endAngle) return null\n const deltaRadius = outerRadius - innerRadius\n const cornerRadius = percentOf(sector.cornerRadius ?? 0, deltaRadius, 0, true)\n if (cornerRadius > 0 && Math.abs(startAngle - endAngle) < 360) {\n return sectorWithCorner({\n cx: sector.cx,\n cy: sector.cy,\n innerRadius,\n outerRadius,\n cornerRadius: Math.min(cornerRadius, deltaRadius / 2),\n forceCornerRadius: sector.forceCornerRadius ?? false,\n cornerIsExternal: sector.cornerIsExternal ?? false,\n startAngle,\n endAngle,\n })\n }\n return sectorPath(sector)\n}\n\n// ---------------------------------------------------------------------------------------------\n// Pies\n\n/** What a pie does, with recharts' defaults filled in. */\nexport interface PieSettings {\n dataKey: DataKey\n nameKey: DataKey\n name?: string\n cx: number | string\n cy: number | string\n innerRadius: number | string\n outerRadius: number | string | ((datum: unknown) => number | string)\n startAngle: number\n endAngle: number\n paddingAngle: number\n minAngle: number\n cornerRadius?: number | string\n maxRadius?: number\n /** The sectors' fill where neither the row nor a `Cell` gives one. */\n fill: string\n}\n\n/** recharts' defaults for a `Pie`. */\nexport const PIE_DEFAULTS = {\n cx: '50%',\n cy: '50%',\n dataKey: 'value',\n nameKey: 'name',\n startAngle: 0,\n endAngle: 360,\n innerRadius: 0,\n outerRadius: '80%',\n paddingAngle: 0,\n minAngle: 0,\n fill: '#808080',\n stroke: '#fff',\n} as const\n\n/** A sector of a pie, as recharts computes it. */\nexport interface PieSector {\n index: number\n cx: number\n cy: number\n innerRadius: number\n outerRadius: number\n maxRadius: number\n startAngle: number\n endAngle: number\n midAngle: number\n middleRadius: number\n paddingAngle: number\n percent: number\n cornerRadius?: number | string\n value: number\n /** The row's name (its `nameKey`), or its index. */\n name: unknown\n /** The row, with its `Cell`'s attributes over it. */\n payload: Record<string, unknown>\n /** The row's (or its `Cell`'s) fill, else the pie's. */\n fill: string\n /** Where the tooltip points for this sector: the middle of its ring, at its middle angle. */\n tooltipPosition: Point\n}\n\n/** The plot area: the chart less its margins and its legend. */\nexport interface Offset {\n top: number\n left: number\n width: number\n height: number\n}\n\nfunction deltaAngle(startAngle: number, endAngle: number): number {\n const sign = mathSign(endAngle - startAngle)\n return sign * Math.min(Math.abs(endAngle - startAngle), 360)\n}\n\n/** A row's value at `dataKey`, or `fallback` where it has none. */\nfunction valueAt(datum: unknown, dataKey: DataKey, fallback: unknown): unknown {\n const value = valueOf(datum, dataKey)\n return value === null || value === undefined ? fallback : value\n}\n\n/** recharts' `parseCoordinateOfPie`: a pie's centre and radii in the plot area. */\nfunction pieCoordinate(settings: PieSettings, offset: Offset, datum: unknown) {\n const { top, left, width, height } = offset\n const maxPieRadius = Math.min(Math.abs(width), Math.abs(height)) / 2\n const outer = isFunction(settings.outerRadius)\n ? settings.outerRadius(datum)\n : settings.outerRadius\n return {\n cx: left + percentOf(settings.cx, width, width / 2),\n cy: top + percentOf(settings.cy, height, height / 2),\n innerRadius: percentOf(settings.innerRadius, maxPieRadius, 0),\n outerRadius: percentOf(outer, maxPieRadius, maxPieRadius * 0.8),\n maxRadius: settings.maxRadius || Math.sqrt(width * width + height * height) / 2,\n }\n}\n\n/**\n * recharts' `computePieSectors`: each row's sector, its angle its share of the total. A `Cell`\n * at a row's index lays its attributes (its `fill`) over the row. Undefined when the rows sum\n * to nothing.\n */\nexport function pieSectors(\n settings: PieSettings,\n data: readonly unknown[],\n cells: readonly Record<string, unknown>[],\n offset: Offset,\n): PieSector[] | undefined {\n const { startAngle, endAngle, dataKey, nameKey, cornerRadius } = settings\n const minAngle = Math.abs(settings.minAngle)\n const delta = deltaAngle(startAngle, endAngle)\n const absDeltaAngle = Math.abs(delta)\n const paddingAngle = data.length <= 1 ? 0 : (settings.paddingAngle ?? 0)\n const notZeroItemCount = data.filter(entry => valueAt(entry, dataKey, 0) !== 0).length\n const totalPaddingAngle =\n (absDeltaAngle >= 360 ? notZeroItemCount : notZeroItemCount - 1) * paddingAngle\n const realTotalAngle = absDeltaAngle - notZeroItemCount * minAngle - totalPaddingAngle\n const sum = data.reduce<number>((result, entry) => {\n const value = valueAt(entry, dataKey, 0)\n return result + (isNumber(value) ? value : 0)\n }, 0)\n if (!(sum > 0)) return undefined\n let previous: PieSector | undefined\n return data.map((entry, i) => {\n const raw = valueAt(entry, dataKey, 0)\n const value = isNumber(raw) ? raw : 0\n const name = valueAt(entry, nameKey, i)\n const coordinate = pieCoordinate(settings, offset, entry)\n const percent = value / sum\n const payload = { ...(entry as Record<string, unknown>), ...cells[i] }\n const fill = isString(payload['fill']) ? payload['fill'] : settings.fill\n const sectorStart = i\n ? previous!.endAngle + mathSign(delta) * paddingAngle * (raw !== 0 ? 1 : 0)\n : startAngle\n const sectorEnd =\n sectorStart + mathSign(delta) * ((raw !== 0 ? minAngle : 0) + percent * realTotalAngle)\n const midAngle = (sectorStart + sectorEnd) / 2\n const middleRadius = (coordinate.innerRadius + coordinate.outerRadius) / 2\n previous = {\n index: i,\n ...coordinate,\n startAngle: sectorStart,\n endAngle: sectorEnd,\n midAngle,\n middleRadius,\n paddingAngle: mathSign(delta) * paddingAngle,\n percent,\n cornerRadius,\n value: (isNumber(raw) ? raw : 0) as number,\n name,\n payload,\n fill,\n tooltipPosition: polarToCartesian(coordinate.cx, coordinate.cy, middleRadius, midAngle),\n }\n return previous\n })\n}\n\n/**\n * The angles recharts draws a pie's sectors at. Its animation (which ends there even when it\n * doesn't run) lays each sector after the last by its angle, rounded to four decimals, so the\n * drawn sectors carry that rounding: the last can end a hair past 360°. Labels and the tooltip\n * keep the angles `pieSectors()` computed, as recharts' do.\n */\nexport function drawnSectorAngles(\n sectors: readonly PieSector[],\n): { startAngle: number; endAngle: number }[] {\n let current = sectors[0]?.startAngle ?? 0\n return sectors.map((sector, index) => {\n const padding = index > 0 ? sector.paddingAngle : 0\n const angle = round(0 + 1 * (sector.endAngle - sector.startAngle))\n const startAngle = current + padding\n const endAngle = current + angle + padding\n current = endAngle\n return { startAngle, endAngle }\n })\n}\n\n// ---------------------------------------------------------------------------------------------\n// Labels\n\n/** A text's `dy` for its vertical anchor, on one line, as recharts' `Text` works it out. */\nexport const TEXT_DY = { start: '0.71em', middle: '0.355em', end: '0em' } as const\n\nexport interface PieLabelPlacement {\n /** Where the text goes, and which end of it is there. */\n x: number\n y: number\n textAnchor: 'start' | 'middle' | 'end'\n /** The label line, from the sector's edge out to the text. */\n line: [Point, Point]\n}\n\n/**\n * recharts' `PieLabels`: a label out past a sector's edge (by `offsetRadius`, 20 by default), at\n * its middle angle, with a line to it, its text anchored away from the centre.\n */\nexport function pieLabelPlacement(sector: PieSector, offsetRadius = 20): PieLabelPlacement {\n const midAngle = (sector.startAngle + sector.endAngle) / 2\n const end = polarToCartesian(sector.cx, sector.cy, sector.outerRadius + offsetRadius, midAngle)\n const textAnchor = end.x > sector.cx ? 'start' : end.x < sector.cx ? 'end' : 'middle'\n return {\n x: end.x,\n y: end.y,\n textAnchor,\n line: [polarToCartesian(sector.cx, sector.cy, sector.outerRadius, midAngle), end],\n }\n}\n\n/** Where a polar label sits against a sector (or the chart's ring). */\nexport type PolarLabelPosition = 'outside' | 'center' | 'centerTop' | 'centerBottom' | 'middle'\n\n/** A sector, or the chart's whole ring, as a polar label reads it: recharts' polar view box. */\nexport interface PolarViewBox {\n cx: number\n cy: number\n innerRadius: number\n outerRadius: number\n startAngle: number\n endAngle: number\n clockWise: boolean\n}\n\n/** recharts' `getAttrsOfPolarLabel`: where a label sits against a sector, and how it is anchored. */\nexport function polarLabelPlacement(\n viewBox: Omit<PolarViewBox, 'clockWise'>,\n offset: number,\n position: PolarLabelPosition | undefined,\n): { x: number; y: number; textAnchor: 'start' | 'middle' | 'end'; dy: string } {\n const { cx, cy, innerRadius, outerRadius, startAngle, endAngle } = viewBox\n const midAngle = (startAngle + endAngle) / 2\n if (position === 'outside') {\n const { x, y } = polarToCartesian(cx, cy, outerRadius + offset, midAngle)\n return { x, y, textAnchor: x >= cx ? 'start' : 'end', dy: TEXT_DY.middle }\n }\n if (position === 'center') return { x: cx, y: cy, textAnchor: 'middle', dy: TEXT_DY.middle }\n if (position === 'centerTop') return { x: cx, y: cy, textAnchor: 'middle', dy: TEXT_DY.start }\n if (position === 'centerBottom') return { x: cx, y: cy, textAnchor: 'middle', dy: TEXT_DY.end }\n const r = (innerRadius + outerRadius) / 2\n const { x, y } = polarToCartesian(cx, cy, r, midAngle)\n return { x, y, textAnchor: 'middle', dy: TEXT_DY.middle }\n}\n\n// ---------------------------------------------------------------------------------------------\n// Hit testing\n\nfunction angleOfPoint(point: Point, center: { cx: number; cy: number }) {\n const radius = Math.sqrt((point.x - center.cx) ** 2 + (point.y - center.cy) ** 2)\n if (radius <= 0) return { radius, angle: 0 }\n let angleInRadian = Math.acos((point.x - center.cx) / radius)\n if (point.y > center.cy) angleInRadian = 2 * Math.PI - angleInRadian\n return { radius, angle: angleInRadian / RADIAN }\n}\n\n/** recharts' `inRangeOfSector`: whether a point is inside a sector's ring and angles. */\nexport function inSector(point: Point, sector: Omit<SectorGeometry, 'cornerRadius'>): boolean {\n const { radius, angle } = angleOfPoint(point, sector)\n if (radius === 0 || radius < sector.innerRadius || radius > sector.outerRadius) return false\n const startCount = Math.floor(sector.startAngle / 360)\n const endCount = Math.floor(sector.endAngle / 360)\n const min = Math.min(startCount, endCount)\n const startAngle = sector.startAngle - min * 360\n const endAngle = sector.endAngle - min * 360\n let formatted = angle\n if (startAngle <= endAngle) {\n while (formatted > endAngle) formatted -= 360\n while (formatted < startAngle) formatted += 360\n return formatted >= startAngle && formatted <= endAngle\n }\n while (formatted > startAngle) formatted -= 360\n while (formatted < endAngle) formatted += 360\n return formatted >= endAngle && formatted <= startAngle\n}\n","import Component from '@glimmer/component'\nimport { sectorD } from '../-private/polar.ts'\nimport type { SectorProps } from '../-private/parts.gts'\n\nexport interface SectorSignature {\n Args: {\n /**\n * A pie's `@shape` props, as recharts' `{...props}`: the sector's geometry and attributes.\n * The arguments below override them.\n */\n props?: Partial<SectorProps>\n /** The centre. */\n cx?: number\n cy?: number\n /** The ring: 0 inside for a slice of pie, more for a donut's. */\n innerRadius?: number\n outerRadius?: number\n /** The angles, in degrees counter-clockwise from 3 o'clock. */\n startAngle?: number\n endAngle?: number\n /** Rounds the corners: pixels, or a percentage of the ring's width. */\n cornerRadius?: number | string\n }\n Element: Element\n}\n\n/**\n * A pie's sector: recharts' `Sector`. A pie draws each of its sectors with one; draw one\n * yourself in a pie's `@shape`, given the props it is handed, and override any of them:\n *\n * const ActiveShape = <template>\n * <Sector @props={{@props}} @outerRadius={{add @props.outerRadius 10}} />\n * </template>\n *\n * It takes the sector's `fill`, `stroke` and `stroke-width` from `@props`; attributes on it win.\n */\nexport default class Sector extends Component<SectorSignature> {\n get geometry() {\n const props = this.args.props ?? {}\n return {\n cx: this.args.cx ?? props.cx ?? 0,\n cy: this.args.cy ?? props.cy ?? 0,\n innerRadius: this.args.innerRadius ?? props.innerRadius ?? 0,\n outerRadius: this.args.outerRadius ?? props.outerRadius ?? 0,\n startAngle: this.args.startAngle ?? props.startAngle ?? 0,\n endAngle: this.args.endAngle ?? props.endAngle ?? 0,\n cornerRadius: this.args.cornerRadius ?? props.cornerRadius ?? 0,\n }\n }\n\n get d(): string | null {\n return sectorD(this.geometry)\n }\n\n get name(): string | undefined {\n const name = this.args.props?.name\n return name === undefined || name === null ? undefined : String(name)\n }\n\n <template>\n {{#if this.d}}\n <path\n class=\"recharts-sector\"\n fill={{@props.fill}}\n fill-opacity={{@props.fillOpacity}}\n stroke={{@props.stroke}}\n stroke-width={{@props.strokeWidth}}\n d={{this.d}}\n data-test-jn-part=\"sector\"\n data-test-jn-value={{this.name}}\n ...attributes\n ></path>\n {{/if}}\n </template>\n}\n"],"names":["RADIAN","Math","PI","polarToCartesian","cx","cy","radius","angle","x","cos","y","sin","mathSign","value","percentOf","total","fallback","validate","isNumber","isString","result","includes","parseFloat","slice","indexOf","Number","isNaN","round","precision","factor","rounded","Object","is","path","strings","values","reduce","string","i","undefined","sectorDeltaAngle","startAngle","endAngle","sign","deltaAngle","min","abs","sectorPath","innerRadius","outerRadius","tempEndAngle","outerStart","outerEnd","d","innerStart","innerEnd","tangentCircle","options","isExternal","cornerRadius","cornerIsExternal","centerRadius","theta","asin","centerAngle","circleTangency","lineTangencyAngle","lineTangency","sectorWithCorner","forceCornerRadius","start","end","outerArcAngle","innerArcAngle","sectorD","sector","deltaRadius","PIE_DEFAULTS","dataKey","nameKey","paddingAngle","minAngle","fill","stroke","valueAt","datum","valueOf","pieCoordinate","settings","offset","top","left","width","height","maxPieRadius","outer","isFunction","maxRadius","sqrt","pieSectors","data","cells","delta","absDeltaAngle","length","notZeroItemCount","filter","entry","totalPaddingAngle","realTotalAngle","sum","previous","map","raw","name","coordinate","percent","payload","sectorStart","sectorEnd","midAngle","middleRadius","index","tooltipPosition","drawnSectorAngles","sectors","current","padding","TEXT_DY","middle","pieLabelPlacement","offsetRadius","textAnchor","line","polarLabelPlacement","viewBox","position","dy","r","angleOfPoint","point","center","angleInRadian","acos","inSector","startCount","floor","endCount","formatted","Sector","Component","geometry","props","args","String","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIO,MAAMA,MAAM,GAAGC,IAAI,CAACC,EAAE,GAAG,GAAG;AAOnC;AACO,SAASC,gBAAgBA,CAACC,EAAU,EAAEC,EAAU,EAAEC,MAAc,EAAEC,KAAa,EAAS;EAC7F,OAAO;AACL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