@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.
- package/CHANGELOG.md +167 -0
- package/LICENSE.md +9 -0
- package/NOTICE +532 -0
- package/README.md +69 -2
- package/addon-main.cjs +4 -0
- package/declarations/-private/cartesian-chart.d.ts +413 -0
- package/declarations/-private/cartesian-chart.d.ts.map +1 -0
- package/declarations/-private/cartesian.d.ts +236 -0
- package/declarations/-private/cartesian.d.ts.map +1 -0
- package/declarations/-private/config.d.ts +13 -0
- package/declarations/-private/config.d.ts.map +1 -0
- package/declarations/-private/dots.d.ts +27 -0
- package/declarations/-private/dots.d.ts.map +1 -0
- package/declarations/-private/nice-ticks.d.ts +17 -0
- package/declarations/-private/nice-ticks.d.ts.map +1 -0
- package/declarations/-private/parts.d.ts +596 -0
- package/declarations/-private/parts.d.ts.map +1 -0
- package/declarations/-private/paths.d.ts +26 -0
- package/declarations/-private/paths.d.ts.map +1 -0
- package/declarations/-private/pie-chart.d.ts +244 -0
- package/declarations/-private/pie-chart.d.ts.map +1 -0
- package/declarations/-private/polar-chart.d.ts +423 -0
- package/declarations/-private/polar-chart.d.ts.map +1 -0
- package/declarations/-private/polar-geometry.d.ts +230 -0
- package/declarations/-private/polar-geometry.d.ts.map +1 -0
- package/declarations/-private/polar-parts.d.ts +315 -0
- package/declarations/-private/polar-parts.d.ts.map +1 -0
- package/declarations/-private/polar.d.ts +156 -0
- package/declarations/-private/polar.d.ts.map +1 -0
- package/declarations/-private/registry.d.ts +9 -0
- package/declarations/-private/registry.d.ts.map +1 -0
- package/declarations/-private/text-size.d.ts +13 -0
- package/declarations/-private/text-size.d.ts.map +1 -0
- package/declarations/-private/tick-interval.d.ts +35 -0
- package/declarations/-private/tick-interval.d.ts.map +1 -0
- package/declarations/components/area-chart.d.ts +16 -0
- package/declarations/components/area-chart.d.ts.map +1 -0
- package/declarations/components/bar-chart.d.ts +16 -0
- package/declarations/components/bar-chart.d.ts.map +1 -0
- package/declarations/components/chart-container.d.ts +66 -0
- package/declarations/components/chart-container.d.ts.map +1 -0
- package/declarations/components/chart-legend-content.d.ts +42 -0
- package/declarations/components/chart-legend-content.d.ts.map +1 -0
- package/declarations/components/chart-style.d.ts +19 -0
- package/declarations/components/chart-style.d.ts.map +1 -0
- package/declarations/components/chart-tooltip-content.d.ts +94 -0
- package/declarations/components/chart-tooltip-content.d.ts.map +1 -0
- package/declarations/components/dot.d.ts +22 -0
- package/declarations/components/dot.d.ts.map +1 -0
- package/declarations/components/line-chart.d.ts +16 -0
- package/declarations/components/line-chart.d.ts.map +1 -0
- package/declarations/components/pie-chart.d.ts +13 -0
- package/declarations/components/pie-chart.d.ts.map +1 -0
- package/declarations/components/radar-chart.d.ts +21 -0
- package/declarations/components/radar-chart.d.ts.map +1 -0
- package/declarations/components/radial-bar-chart.d.ts +17 -0
- package/declarations/components/radial-bar-chart.d.ts.map +1 -0
- package/declarations/components/rectangle.d.ts +32 -0
- package/declarations/components/rectangle.d.ts.map +1 -0
- package/declarations/components/sector.d.ts +47 -0
- package/declarations/components/sector.d.ts.map +1 -0
- package/declarations/index.d.ts +24 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/test-support/chart.d.ts +162 -0
- package/declarations/test-support/chart.d.ts.map +1 -0
- package/declarations/test-support/index.d.ts +3 -0
- package/declarations/test-support/index.d.ts.map +1 -0
- package/declarations/test-support/polar-chart.d.ts +62 -0
- package/declarations/test-support/polar-chart.d.ts.map +1 -0
- package/declarations/test-support.d.ts +2 -0
- package/declarations/types.d.ts +138 -0
- package/declarations/types.d.ts.map +1 -0
- package/dist/cartesian-D9hWDamz.js +1217 -0
- package/dist/cartesian-D9hWDamz.js.map +1 -0
- package/dist/cartesian-chart-BLj6Q_OB.js +1123 -0
- package/dist/cartesian-chart-BLj6Q_OB.js.map +1 -0
- package/dist/components/area-chart.js +20 -0
- package/dist/components/area-chart.js.map +1 -0
- package/dist/components/bar-chart.js +20 -0
- package/dist/components/bar-chart.js.map +1 -0
- package/dist/components/chart-container.js +54 -0
- package/dist/components/chart-container.js.map +1 -0
- package/dist/components/chart-legend-content.js +48 -0
- package/dist/components/chart-legend-content.js.map +1 -0
- package/dist/components/chart-style.js +35 -0
- package/dist/components/chart-style.js.map +1 -0
- package/dist/components/chart-tooltip-content.js +131 -0
- package/dist/components/chart-tooltip-content.js.map +1 -0
- package/dist/components/dot.js +18 -0
- package/dist/components/dot.js.map +1 -0
- package/dist/components/line-chart.js +20 -0
- package/dist/components/line-chart.js.map +1 -0
- package/dist/components/pie-chart.js +6 -0
- package/dist/components/pie-chart.js.map +1 -0
- package/dist/components/radar-chart.js +22 -0
- package/dist/components/radar-chart.js.map +1 -0
- package/dist/components/radial-bar-chart.js +20 -0
- package/dist/components/radial-bar-chart.js.map +1 -0
- package/dist/components/rectangle.js +5 -0
- package/dist/components/rectangle.js.map +1 -0
- package/dist/components/sector.js +5 -0
- package/dist/components/sector.js.map +1 -0
- package/dist/config-DnsUmxOT.js +35 -0
- package/dist/config-DnsUmxOT.js.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/parts-BWLhFFjB.js +355 -0
- package/dist/parts-BWLhFFjB.js.map +1 -0
- package/dist/pie-chart-CmDtW_Ge.js +646 -0
- package/dist/pie-chart-CmDtW_Ge.js.map +1 -0
- package/dist/polar-chart-GhgOSsH9.js +2242 -0
- package/dist/polar-chart-GhgOSsH9.js.map +1 -0
- package/dist/rectangle-Cl7tbXuZ.js +166 -0
- package/dist/rectangle-Cl7tbXuZ.js.map +1 -0
- package/dist/sector-7shQPJuQ.js +565 -0
- package/dist/sector-7shQPJuQ.js.map +1 -0
- package/dist/test-support.js +470 -0
- package/dist/test-support.js.map +1 -0
- package/dist/types.js +56 -0
- package/dist/types.js.map +1 -0
- package/package.json +117 -3
|
@@ -0,0 +1,166 @@
|
|
|
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 } from '@sindresorhus/is';
|
|
25
|
+
import { line, area, curveStepBefore, curveStepAfter, curveStep, curveNatural, curveMonotoneY, curveMonotoneX, curveLinearClosed, curveLinear, curveBumpY, curveBumpX, curveBasisOpen, curveBasisClosed, curveBasis } from 'd3-shape';
|
|
26
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
27
|
+
import { setComponentTemplate } from '@ember/component';
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
* The SVG paths a chart draws: curves (d3-shape, as recharts' Curve draws them) and bars with
|
|
31
|
+
* rounded corners (recharts' Rectangle).
|
|
32
|
+
*
|
|
33
|
+
* recharts is MIT licensed; its notice is in NOTICE, and the build keeps it in the module that
|
|
34
|
+
* ships this (see rollup.config.mjs).
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* How a line or area joins its points, as recharts' `type`: `natural`, `monotone`, `linear`,
|
|
39
|
+
* `step` and the rest of d3-shape's curves.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
const CURVES = {
|
|
43
|
+
basis: curveBasis,
|
|
44
|
+
basisClosed: curveBasisClosed,
|
|
45
|
+
basisOpen: curveBasisOpen,
|
|
46
|
+
bumpX: curveBumpX,
|
|
47
|
+
bumpY: curveBumpY,
|
|
48
|
+
linear: curveLinear,
|
|
49
|
+
linearClosed: curveLinearClosed,
|
|
50
|
+
monotoneX: curveMonotoneX,
|
|
51
|
+
monotoneY: curveMonotoneY,
|
|
52
|
+
natural: curveNatural,
|
|
53
|
+
step: curveStep,
|
|
54
|
+
stepAfter: curveStepAfter,
|
|
55
|
+
stepBefore: curveStepBefore
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** The d3 curve for a type; `monotone` and `bump` follow the layout, as recharts' do. */
|
|
59
|
+
function curveFactory(type, layout) {
|
|
60
|
+
if (type === 'monotone' || type === 'bump') {
|
|
61
|
+
return CURVES[`${type}${layout === 'vertical' ? 'Y' : 'X'}`];
|
|
62
|
+
}
|
|
63
|
+
return CURVES[type ?? 'linear'] ?? curveLinear;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** A point of a series; `null` coordinates leave a gap. */
|
|
67
|
+
|
|
68
|
+
const defined = p => p.x !== null && p.y !== null && Number.isFinite(p.x) && Number.isFinite(p.y);
|
|
69
|
+
|
|
70
|
+
/** The path through `points`, skipping the gaps (or joining over them, with `connectNulls`). */
|
|
71
|
+
function linePath(points, type, layout, connectNulls = false) {
|
|
72
|
+
const finalPoints = connectNulls ? points.filter(defined) : points;
|
|
73
|
+
return line().x(p => p.x).y(p => p.y).defined(defined).curve(curveFactory(type, layout))(finalPoints);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The area between `points` and a base: a number (a flat base, the axis's) or a point per
|
|
78
|
+
* point (a stacked area's lower edge).
|
|
79
|
+
*/
|
|
80
|
+
function areaPath(points, base, type, layout, connectNulls = false) {
|
|
81
|
+
const curve = curveFactory(type, layout);
|
|
82
|
+
if (Array.isArray(base)) {
|
|
83
|
+
const paired = points.map((point, index) => ({
|
|
84
|
+
...point,
|
|
85
|
+
base: base[index]
|
|
86
|
+
}));
|
|
87
|
+
const areaDefined = d => d.base != null && defined(d.base) && defined(d);
|
|
88
|
+
const generator = layout === 'vertical' ? area().y(d => d.y).x1(d => d.x).x0(d => d.base.x) : area().x(d => d.x).y1(d => d.y).y0(d => d.base.y);
|
|
89
|
+
return generator.defined(areaDefined).curve(curve)(connectNulls ? paired.filter(areaDefined) : paired);
|
|
90
|
+
}
|
|
91
|
+
const flat = base;
|
|
92
|
+
const generator = layout === 'vertical' ? area().y(d => d.y).x1(d => d.x).x0(flat) : area().x(d => d.x).y1(d => d.y).y0(flat);
|
|
93
|
+
return generator.defined(defined).curve(curve)(connectNulls ? points.filter(defined) : points);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** A number with at most four decimals, as recharts writes a rectangle's path. */
|
|
97
|
+
function round(value) {
|
|
98
|
+
return Math.round(value * 10000) / 10000;
|
|
99
|
+
}
|
|
100
|
+
function path(strings, ...values) {
|
|
101
|
+
return strings.reduce((out, string, i) => out + string + (i < values.length ? round(values[i]) : ''), '');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* A rectangle's path, its corners rounded by `radius`: one number for all four, or
|
|
106
|
+
* `[topLeft, topRight, bottomRight, bottomLeft]`. recharts' `getRectanglePath`.
|
|
107
|
+
*/
|
|
108
|
+
function rectanglePath(x, y, width, height, radius = 0) {
|
|
109
|
+
const maxRadius = Math.min(Math.abs(round(width)) / 2, Math.abs(round(height)) / 2);
|
|
110
|
+
const ySign = round(height) >= 0 ? 1 : -1;
|
|
111
|
+
const xSign = round(width) >= 0 ? 1 : -1;
|
|
112
|
+
const clockWise = round(height) >= 0 && round(width) >= 0 || round(height) < 0 && round(width) < 0 ? 1 : 0;
|
|
113
|
+
if (maxRadius > 0 && Array.isArray(radius)) {
|
|
114
|
+
const r = [0, 1, 2, 3].map(i => Math.min(radius[i] ?? 0, maxRadius));
|
|
115
|
+
let d = path`M${x},${y + ySign * r[0]}`;
|
|
116
|
+
if (r[0] > 0) d += path`A ${r[0]},${r[0]},0,0,${clockWise},${x + xSign * r[0]},${y}`;
|
|
117
|
+
d += path`L ${x + width - xSign * r[1]},${y}`;
|
|
118
|
+
if (r[1] > 0) d += path`A ${r[1]},${r[1]},0,0,${clockWise},\n ${x + width},${y + ySign * r[1]}`;
|
|
119
|
+
d += path`L ${x + width},${y + height - ySign * r[2]}`;
|
|
120
|
+
if (r[2] > 0) d += path`A ${r[2]},${r[2]},0,0,${clockWise},\n ${x + width - xSign * r[2]},${y + height}`;
|
|
121
|
+
d += path`L ${x + xSign * r[3]},${y + height}`;
|
|
122
|
+
if (r[3] > 0) d += path`A ${r[3]},${r[3]},0,0,${clockWise},\n ${x},${y + height - ySign * r[3]}`;
|
|
123
|
+
return `${d}Z`;
|
|
124
|
+
}
|
|
125
|
+
const uniform = isNumber(radius) ? radius : 0;
|
|
126
|
+
if (maxRadius > 0 && uniform > 0) {
|
|
127
|
+
const r = Math.min(maxRadius, uniform);
|
|
128
|
+
return path`M ${x},${y + ySign * r}
|
|
129
|
+
A ${r},${r},0,0,${clockWise},${x + xSign * r},${y}
|
|
130
|
+
L ${x + width - xSign * r},${y}
|
|
131
|
+
A ${r},${r},0,0,${clockWise},${x + width},${y + ySign * r}
|
|
132
|
+
L ${x + width},${y + height - ySign * r}
|
|
133
|
+
A ${r},${r},0,0,${clockWise},${x + width - xSign * r},${y + height}
|
|
134
|
+
L ${x + xSign * r},${y + height}
|
|
135
|
+
A ${r},${r},0,0,${clockWise},${x},${y + height - ySign * r} Z`;
|
|
136
|
+
}
|
|
137
|
+
return path`M ${x},${y} h ${width} v ${height} h ${-width} Z`;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* A rectangle with rounded corners: recharts' `Rectangle`. A bar draws each of its bars with
|
|
142
|
+
* one; draw one yourself in a bar's `@shape`, given the props it is handed, with attributes of
|
|
143
|
+
* your own (they win over the bar's):
|
|
144
|
+
*
|
|
145
|
+
* const DashedBar = <template>
|
|
146
|
+
* <Rectangle @props={{@props}} stroke={{@props.payload.fill}} stroke-dasharray="4" />
|
|
147
|
+
* </template>
|
|
148
|
+
*/
|
|
149
|
+
class Rectangle extends Component {
|
|
150
|
+
get d() {
|
|
151
|
+
const props = this.args.props ?? {};
|
|
152
|
+
return rectanglePath(this.args.x ?? props.x ?? 0, this.args.y ?? props.y ?? 0, this.args.width ?? props.width ?? 0, this.args.height ?? props.height ?? 0, this.args.radius ?? props.radius ?? 0);
|
|
153
|
+
}
|
|
154
|
+
get value() {
|
|
155
|
+
const value = this.args.props?.value;
|
|
156
|
+
return value === undefined || value === null ? undefined : String(value);
|
|
157
|
+
}
|
|
158
|
+
static {
|
|
159
|
+
setComponentTemplate(precompileTemplate("<path class=\"recharts-rectangle\" fill={{@props.fill}} fill-opacity={{@props.fillOpacity}} stroke={{@props.stroke}} stroke-width={{@props.strokeWidth}} d={{this.d}} data-test-jn-part=\"bar\" data-test-jn-value={{this.value}} ...attributes></path>", {
|
|
160
|
+
strictMode: true
|
|
161
|
+
}), this);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export { Rectangle as R, areaPath as a, linePath as l, rectanglePath as r };
|
|
166
|
+
//# sourceMappingURL=rectangle-Cl7tbXuZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangle-Cl7tbXuZ.js","sources":["../src/-private/paths.ts","../src/components/rectangle.gts"],"sourcesContent":["/*\n * The SVG paths a chart draws: curves (d3-shape, as recharts' Curve draws them) and bars with\n * rounded corners (recharts' Rectangle).\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 { isNumber } from '@sindresorhus/is'\nimport {\n area as d3Area,\n curveBasis,\n curveBasisClosed,\n curveBasisOpen,\n curveBumpX,\n curveBumpY,\n curveLinear,\n curveLinearClosed,\n curveMonotoneX,\n curveMonotoneY,\n curveNatural,\n curveStep,\n curveStepAfter,\n curveStepBefore,\n line as d3Line,\n type CurveFactory,\n} from 'd3-shape'\n\n/**\n * How a line or area joins its points, as recharts' `type`: `natural`, `monotone`, `linear`,\n * `step` and the rest of d3-shape's curves.\n */\nexport type CurveType =\n | 'basis'\n | 'basisClosed'\n | 'basisOpen'\n | 'bump'\n | 'bumpX'\n | 'bumpY'\n | 'linear'\n | 'linearClosed'\n | 'monotone'\n | 'monotoneX'\n | 'monotoneY'\n | 'natural'\n | 'step'\n | 'stepAfter'\n | 'stepBefore'\n\nconst CURVES: Record<string, CurveFactory> = {\n basis: curveBasis,\n basisClosed: curveBasisClosed,\n basisOpen: curveBasisOpen,\n bumpX: curveBumpX,\n bumpY: curveBumpY,\n linear: curveLinear,\n linearClosed: curveLinearClosed,\n monotoneX: curveMonotoneX,\n monotoneY: curveMonotoneY,\n natural: curveNatural,\n step: curveStep,\n stepAfter: curveStepAfter,\n stepBefore: curveStepBefore,\n}\n\n/** The d3 curve for a type; `monotone` and `bump` follow the layout, as recharts' do. */\nexport function curveFactory(\n type: CurveType | undefined,\n layout: 'horizontal' | 'vertical',\n): CurveFactory {\n if (type === 'monotone' || type === 'bump') {\n return CURVES[`${type}${layout === 'vertical' ? 'Y' : 'X'}`]!\n }\n return CURVES[type ?? 'linear'] ?? curveLinear\n}\n\n/** A point of a series; `null` coordinates leave a gap. */\nexport interface Point {\n x: number | null\n y: number | null\n}\n\nconst defined = (p: Point) =>\n p.x !== null && p.y !== null && Number.isFinite(p.x) && Number.isFinite(p.y)\n\n/** The path through `points`, skipping the gaps (or joining over them, with `connectNulls`). */\nexport function linePath(\n points: readonly Point[],\n type: CurveType | undefined,\n layout: 'horizontal' | 'vertical',\n connectNulls = false,\n): string | null {\n const finalPoints = connectNulls ? points.filter(defined) : points\n return d3Line<Point>()\n .x(p => p.x!)\n .y(p => p.y!)\n .defined(defined)\n .curve(curveFactory(type, layout))(finalPoints)\n}\n\n/**\n * The area between `points` and a base: a number (a flat base, the axis's) or a point per\n * point (a stacked area's lower edge).\n */\nexport function areaPath(\n points: readonly Point[],\n base: number | readonly Point[],\n type: CurveType | undefined,\n layout: 'horizontal' | 'vertical',\n connectNulls = false,\n): string | null {\n const curve = curveFactory(type, layout)\n if (Array.isArray(base)) {\n const paired = points.map((point, index) => ({ ...point, base: base[index] as Point }))\n const areaDefined = (d: (typeof paired)[number]) =>\n d.base != null && defined(d.base) && defined(d)\n const generator =\n layout === 'vertical'\n ? d3Area<(typeof paired)[number]>()\n .y(d => d.y!)\n .x1(d => d.x!)\n .x0(d => d.base.x!)\n : d3Area<(typeof paired)[number]>()\n .x(d => d.x!)\n .y1(d => d.y!)\n .y0(d => d.base.y!)\n return generator.defined(areaDefined).curve(curve)(\n connectNulls ? paired.filter(areaDefined) : paired,\n )\n }\n const flat = base as number\n const generator =\n layout === 'vertical'\n ? d3Area<Point>()\n .y(d => d.y!)\n .x1(d => d.x!)\n .x0(flat)\n : d3Area<Point>()\n .x(d => d.x!)\n .y1(d => d.y!)\n .y0(flat)\n return generator.defined(defined).curve(curve)(connectNulls ? points.filter(defined) : points)\n}\n\n/** A number with at most four decimals, as recharts writes a rectangle's path. */\nfunction round(value: number): number {\n return Math.round(value * 10000) / 10000\n}\n\nfunction path(strings: TemplateStringsArray, ...values: number[]): string {\n return strings.reduce(\n (out, string, i) => out + string + (i < values.length ? round(values[i]!) : ''),\n '',\n )\n}\n\n/**\n * A rectangle's path, its corners rounded by `radius`: one number for all four, or\n * `[topLeft, topRight, bottomRight, bottomLeft]`. recharts' `getRectanglePath`.\n */\nexport function rectanglePath(\n x: number,\n y: number,\n width: number,\n height: number,\n radius: number | readonly number[] = 0,\n): string {\n const maxRadius = Math.min(Math.abs(round(width)) / 2, Math.abs(round(height)) / 2)\n const ySign = round(height) >= 0 ? 1 : -1\n const xSign = round(width) >= 0 ? 1 : -1\n const clockWise =\n (round(height) >= 0 && round(width) >= 0) || (round(height) < 0 && round(width) < 0) ? 1 : 0\n if (maxRadius > 0 && Array.isArray(radius)) {\n const r = [0, 1, 2, 3].map(i => Math.min(radius[i] ?? 0, maxRadius)) as [\n number,\n number,\n number,\n number,\n ]\n let d = path`M${x},${y + ySign * r[0]}`\n if (r[0] > 0) d += path`A ${r[0]},${r[0]},0,0,${clockWise},${x + xSign * r[0]},${y}`\n d += path`L ${x + width - xSign * r[1]},${y}`\n if (r[1] > 0)\n d += path`A ${r[1]},${r[1]},0,0,${clockWise},\\n ${x + width},${y + ySign * r[1]}`\n d += path`L ${x + width},${y + height - ySign * r[2]}`\n if (r[2] > 0)\n d += path`A ${r[2]},${r[2]},0,0,${clockWise},\\n ${x + width - xSign * r[2]},${y + height}`\n d += path`L ${x + xSign * r[3]},${y + height}`\n if (r[3] > 0)\n d += path`A ${r[3]},${r[3]},0,0,${clockWise},\\n ${x},${y + height - ySign * r[3]}`\n return `${d}Z`\n }\n const uniform = isNumber(radius) ? radius : 0\n if (maxRadius > 0 && uniform > 0) {\n const r = Math.min(maxRadius, uniform)\n return path`M ${x},${y + ySign * r}\n A ${r},${r},0,0,${clockWise},${x + xSign * r},${y}\n L ${x + width - xSign * r},${y}\n A ${r},${r},0,0,${clockWise},${x + width},${y + ySign * r}\n L ${x + width},${y + height - ySign * r}\n A ${r},${r},0,0,${clockWise},${x + width - xSign * r},${y + height}\n L ${x + xSign * r},${y + height}\n A ${r},${r},0,0,${clockWise},${x},${y + height - ySign * r} Z`\n }\n return path`M ${x},${y} h ${width} v ${height} h ${-width} Z`\n}\n","import Component from '@glimmer/component'\nimport { rectanglePath } from '../-private/paths.ts'\nimport type { RectangleProps } from '../-private/parts.gts'\n\nexport interface RectangleSignature {\n Args: {\n /**\n * A bar's `@shape` props, as recharts' `{...props}`: the bar's rectangle and attributes.\n * The arguments below override them.\n */\n props?: Partial<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 }\n Element: Element\n}\n\n/**\n * A rectangle with rounded corners: recharts' `Rectangle`. A bar draws each of its bars with\n * one; draw one yourself in a bar's `@shape`, given the props it is handed, with attributes of\n * your own (they win over the bar's):\n *\n * const DashedBar = <template>\n * <Rectangle @props={{@props}} stroke={{@props.payload.fill}} stroke-dasharray=\"4\" />\n * </template>\n */\nexport default class Rectangle extends Component<RectangleSignature> {\n get d(): string {\n const props = this.args.props ?? {}\n return rectanglePath(\n this.args.x ?? props.x ?? 0,\n this.args.y ?? props.y ?? 0,\n this.args.width ?? props.width ?? 0,\n this.args.height ?? props.height ?? 0,\n this.args.radius ?? props.radius ?? 0,\n )\n }\n\n get value(): string | undefined {\n const value = this.args.props?.value\n return value === undefined || value === null ? undefined : String(value)\n }\n\n <template>\n <path\n class=\"recharts-rectangle\"\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=\"bar\"\n data-test-jn-value={{this.value}}\n ...attributes\n ></path>\n </template>\n}\n"],"names":["CURVES","basis","curveBasis","basisClosed","curveBasisClosed","basisOpen","curveBasisOpen","bumpX","curveBumpX","bumpY","curveBumpY","linear","curveLinear","linearClosed","curveLinearClosed","monotoneX","curveMonotoneX","monotoneY","curveMonotoneY","natural","curveNatural","step","curveStep","stepAfter","curveStepAfter","stepBefore","curveStepBefore","curveFactory","type","layout","defined","p","x","y","Number","isFinite","linePath","points","connectNulls","finalPoints","filter","d3Line","curve","areaPath","base","Array","isArray","paired","map","point","index","areaDefined","d","generator","d3Area","x1","x0","y1","y0","flat","round","value","Math","path","strings","values","reduce","out","string","i","length","rectanglePath","width","height","radius","maxRadius","min","abs","ySign","xSign","clockWise","r","uniform","isNumber","Rectangle","Component","props","args","undefined","String","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqBA;AACA;AACA;AACA;;AAkBA,MAAMA,MAAoC,GAAG;AAC3CC,EAAAA,KAAK,EAAEC,UAAU;AACjBC,EAAAA,WAAW,EAAEC,gBAAgB;AAC7BC,EAAAA,SAAS,EAAEC,cAAc;AACzBC,EAAAA,KAAK,EAAEC,UAAU;AACjBC,EAAAA,KAAK,EAAEC,UAAU;AACjBC,EAAAA,MAAM,EAAEC,WAAW;AACnBC,EAAAA,YAAY,EAAEC,iBAAiB;AAC/BC,EAAAA,SAAS,EAAEC,cAAc;AACzBC,EAAAA,SAAS,EAAEC,cAAc;AACzBC,EAAAA,OAAO,EAAEC,YAAY;AACrBC,EAAAA,IAAI,EAAEC,SAAS;AACfC,EAAAA,SAAS,EAAEC,cAAc;AACzBC,EAAAA,UAAU,EAAEC;AACd,CAAC;;AAED;AACO,SAASC,YAAYA,CAC1BC,IAA2B,EAC3BC,MAAiC,EACnB;AACd,EAAA,IAAID,IAAI,KAAK,UAAU,IAAIA,IAAI,KAAK,MAAM,EAAE;AAC1C,IAAA,OAAO5B,MAAM,CAAC,CAAA,EAAG4B,IAAI,CAAA,EAAGC,MAAM,KAAK,UAAU,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;AAC9D,EAAA;AACA,EAAA,OAAO7B,MAAM,CA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