@tabler/charts 0.0.1-alpha.0 → 0.1.0
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/README.md +14 -4
- package/dist/{sweep-WSgn2etB.js → arc-BXpLrt9b.cjs} +25 -58
- package/dist/arc-BXpLrt9b.cjs.map +1 -0
- package/dist/{sweep-Duowaput.cjs → arc-a1tRTEw7.js} +2 -93
- package/dist/arc-a1tRTEw7.js.map +1 -0
- package/dist/{area-DaO4MQl4.d.ts → area-CF__HOwL.d.ts} +3 -3
- package/dist/{area-BFvkc-ZM.d.cts → area-DIxaAbYZ.d.cts} +3 -3
- package/dist/area.d.cts +1 -1
- package/dist/area.d.ts +1 -1
- package/dist/{bar-DdsDxk3W.d.ts → bar-BBM8RhoL.d.ts} +2 -2
- package/dist/{bar-a0h9KC8A.d.cts → bar-CRKLDg98.d.cts} +2 -2
- package/dist/bar.d.cts +1 -1
- package/dist/bar.d.ts +1 -1
- package/dist/{candlestick-BnUG1SGi.d.ts → candlestick-D_vV0_XZ.d.ts} +2 -2
- package/dist/{candlestick-BKdPyorY.d.cts → candlestick-__pXl_pV.d.cts} +2 -2
- package/dist/candlestick.d.cts +1 -1
- package/dist/candlestick.d.ts +1 -1
- package/dist/{chart-Qa417fJo.d.cts → chart-D7ooEFnk.d.cts} +7 -1
- package/dist/{chart-iJGxMz9z.d.ts → chart-DyN7bcx8.d.ts} +7 -1
- package/dist/{core-plobgBC7.js → core-CegR_j55.js} +16 -7
- package/dist/core-CegR_j55.js.map +1 -0
- package/dist/{core-CnGFKojH.d.cts → core-D1vO1LrC.d.cts} +4 -3
- package/dist/{core-CjgbhS_v.d.ts → core-DcbemzGf.d.ts} +4 -3
- package/dist/{core-C7fPm6t7.cjs → core-RzS9IQO5.cjs} +16 -7
- package/dist/core-RzS9IQO5.cjs.map +1 -0
- package/dist/core.cjs +9 -7
- package/dist/core.d.cts +15 -14
- package/dist/core.d.ts +15 -14
- package/dist/core.js +6 -5
- package/dist/export.d.cts +1 -1
- package/dist/export.d.ts +1 -1
- package/dist/{gauge-CEfkWXSu.cjs → gauge-D-FYhuds.cjs} +7 -6
- package/dist/{gauge-CEfkWXSu.cjs.map → gauge-D-FYhuds.cjs.map} +1 -1
- package/dist/{gauge-Cu_OFxBd.d.cts → gauge-DP_EB2z3.d.cts} +2 -2
- package/dist/{gauge-_ljQHrMN.js → gauge-Dh423FHh.js} +3 -2
- package/dist/{gauge-_ljQHrMN.js.map → gauge-Dh423FHh.js.map} +1 -1
- package/dist/{gauge-Cu9jttC0.d.ts → gauge-zpia05t2.d.ts} +2 -2
- package/dist/gauge.cjs +1 -1
- package/dist/gauge.d.cts +1 -1
- package/dist/gauge.d.ts +1 -1
- package/dist/gauge.js +1 -1
- package/dist/{heatmap-PhLPXIg1.d.ts → heatmap-BectCEeE.d.ts} +2 -2
- package/dist/{heatmap-BwS-y0c6.d.cts → heatmap-CCso6m61.d.cts} +2 -2
- package/dist/heatmap.d.cts +1 -1
- package/dist/heatmap.d.ts +1 -1
- package/dist/index.cjs +11 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -14
- package/dist/index.d.ts +15 -14
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/{line-D5kb8e6w.d.ts → line-CN4uZ9ZX.d.ts} +2 -2
- package/dist/{line-CMDGH6q5.d.cts → line-W7VD_qs1.d.cts} +2 -2
- package/dist/line.d.cts +1 -1
- package/dist/line.d.ts +1 -1
- package/dist/parliament-1Zv2Xh0D.d.ts +69 -0
- package/dist/parliament-CpWnoEvG.cjs +308 -0
- package/dist/parliament-CpWnoEvG.cjs.map +1 -0
- package/dist/parliament-DdrLVZwt.d.cts +69 -0
- package/dist/parliament-Dw0sOERi.js +303 -0
- package/dist/parliament-Dw0sOERi.js.map +1 -0
- package/dist/parliament.cjs +3 -0
- package/dist/parliament.d.cts +2 -0
- package/dist/parliament.d.ts +2 -0
- package/dist/parliament.js +2 -0
- package/dist/patterns.d.cts +1 -1
- package/dist/patterns.d.ts +1 -1
- package/dist/{pie-B8UlOZiq.d.ts → pie-5z1fDdKO.d.ts} +2 -2
- package/dist/{pie-DnQQmxkk.d.cts → pie-BF9yI5mE.d.cts} +2 -2
- package/dist/{pie-C1Pa6W_l.cjs → pie-BxTZt6Go.cjs} +9 -8
- package/dist/{pie-C1Pa6W_l.cjs.map → pie-BxTZt6Go.cjs.map} +1 -1
- package/dist/{pie-RnMTQWMS.js → pie-DzUXDTcn.js} +3 -2
- package/dist/{pie-RnMTQWMS.js.map → pie-DzUXDTcn.js.map} +1 -1
- package/dist/pie.cjs +1 -1
- package/dist/pie.d.cts +1 -1
- package/dist/pie.d.ts +1 -1
- package/dist/pie.js +1 -1
- package/dist/point-shapes.d.cts +1 -1
- package/dist/point-shapes.d.ts +1 -1
- package/dist/{radar-pFI6fvOq.d.ts → radar-1-EryihA.d.ts} +2 -2
- package/dist/{radar-BB13CGmq.d.cts → radar-DBW4O0Vt.d.cts} +2 -2
- package/dist/radar.d.cts +1 -1
- package/dist/radar.d.ts +1 -1
- package/dist/{sankey-B9JYnx7e.d.cts → sankey-DuGI3Qc5.d.cts} +2 -2
- package/dist/{sankey-Bm518bqL.d.ts → sankey-OV_WoPrl.d.ts} +2 -2
- package/dist/sankey.d.cts +1 -1
- package/dist/sankey.d.ts +1 -1
- package/dist/{scatter-Bl7nasE6.d.ts → scatter-BqzgJqdX.d.ts} +2 -2
- package/dist/{scatter-DrJ8xYz4.d.cts → scatter-DbxLyZX0.d.cts} +2 -2
- package/dist/scatter.d.cts +1 -1
- package/dist/scatter.d.ts +1 -1
- package/dist/{sparkline-iWuXbKpd.d.ts → sparkline-BfyO_oNM.d.ts} +2 -2
- package/dist/{sparkline-BG13V4Pz.d.cts → sparkline-CWlJDKyh.d.cts} +2 -2
- package/dist/sparkline.d.cts +1 -1
- package/dist/sparkline.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/sweep-CbfR7--d.js +60 -0
- package/dist/sweep-CbfR7--d.js.map +1 -0
- package/dist/sweep-DaTEDDuC.cjs +71 -0
- package/dist/sweep-DaTEDDuC.cjs.map +1 -0
- package/dist/value-labels.d.cts +1 -1
- package/dist/value-labels.d.ts +1 -1
- package/package.json +11 -1
- package/dist/core-C7fPm6t7.cjs.map +0 -1
- package/dist/core-plobgBC7.js.map +0 -1
- package/dist/sweep-Duowaput.cjs.map +0 -1
- package/dist/sweep-WSgn2etB.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="
|
|
4
|
-
<img src="
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tabler/tabler-charts/main/docs/images/logo-white.svg">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/tabler/tabler-charts/main/docs/images/logo.svg" alt="Tabler Charts" width="280">
|
|
5
5
|
</picture>
|
|
6
6
|
</p>
|
|
7
7
|
|
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
|
|
10
10
|
Zero-dependency SVG charts styled with CSS: the engine, every chart type, the plugins and the stylesheet.
|
|
11
11
|
|
|
12
|
+
<p align="center">
|
|
13
|
+
<picture>
|
|
14
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tabler/tabler-charts/main/docs/images/og-image-dark.png">
|
|
15
|
+
<img src="https://raw.githubusercontent.com/tabler/tabler-charts/main/docs/images/og-image.png" alt="Tabler Charts: charts styled entirely with CSS" width="800">
|
|
16
|
+
</picture>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
12
19
|
> 🚧 **Pre-release.** Not on npm yet; the API may still change.
|
|
13
20
|
|
|
14
21
|
```bash
|
|
@@ -78,6 +85,7 @@ A feature you use but did not import throws an error that names the import.
|
|
|
78
85
|
| `gauge` | a number, a ring or rings | `max`, `startAngle`, `angle` (`270` for a dial), `thickness`, `center` |
|
|
79
86
|
| `radar` | `{ labels, series }` | `grid: 'polygon' \| 'circle'`, `fill`, `points`, `r` (radial axis), `labelWidth` (long spoke labels wrap at their spaces, by default past a quarter of the width) |
|
|
80
87
|
| `sankey` | `{ nodes?, links: [{ from, to, value }] }` | `nodeWidth`, `nodePadding`, `align: 'justify' \| 'left'`, `format`; nodes with a `color` make the legend |
|
|
88
|
+
| `parliament` | `[{ name, seats }]` | `total` (vacant seats), `rows`, `angle` (`180` for a hemicycle), `innerRadius`, `gap`, `center` |
|
|
81
89
|
| `scatter` | `{ series: [{ name, points: [{ x, y, size? }] }] }` | `radius`, `size` (bubble radii); points with `size` are bubbles |
|
|
82
90
|
| `heatmap` | `{ labels, series }` (rows) | `min`, `max`, `ranges`, `colors` + `mid` (scales), `colorBy: 'series'` |
|
|
83
91
|
| `candlestick` | `[{ x, open, high, low, close }]` | time axes, `maxCandleWidth` |
|
|
@@ -144,7 +152,7 @@ An option that is `NaN` or infinite (a `radius`, a `startAngle`, a `width`, a si
|
|
|
144
152
|
| `fontSize` | `--tc-font-size` | Used to lay out labels; set it for SSR |
|
|
145
153
|
| `id` | generated | Prefix of ids inside the SVG; set it for SSR |
|
|
146
154
|
| `legend` | for 2+ entries | `false`, `true` or `{ position: 'bottom' }` |
|
|
147
|
-
| `tooltip` | `true` | `false
|
|
155
|
+
| `tooltip` | `true` | `false`, or `{ theme, format, footer }`: `theme: 'light'` for a white tooltip instead of the dark one, `format` and `footer` for custom content |
|
|
148
156
|
| `crosshair` | `true` | |
|
|
149
157
|
| `table` | `true` | Hidden data table for screen readers; `'visible'` shows it |
|
|
150
158
|
| `keyboard` | `true` | Arrow keys walk the data; sparklines opt out |
|
|
@@ -190,7 +198,9 @@ Everything visual is CSS. The stylesheet defines tokens on `:root` (light and da
|
|
|
190
198
|
.revenue-chart .tc-series-2 .tc-line { stroke-dasharray: 4 4; }
|
|
191
199
|
```
|
|
192
200
|
|
|
193
|
-
Tokens include `--tc-color-1` … `--tc-color-8`, `--tc-surface`, `--tc-text-color`, `--tc-text-muted`, `--tc-grid-color`, `--tc-baseline-color`, `--tc-font-family`, `--tc-font-size`, `--tc-stroke-width`, `--tc-area-opacity`, `--tc-duration`, `--tc-easing` and the `--tc-tooltip-*` set.
|
|
201
|
+
Tokens include `--tc-color-1` … `--tc-color-8`, `--tc-surface`, `--tc-text-color`, `--tc-text-muted`, `--tc-grid-color`, `--tc-baseline-color`, `--tc-font-family`, `--tc-font-size`, `--tc-stroke-width`, `--tc-area-opacity`, `--tc-duration`, `--tc-easing` and the `--tc-tooltip-*` set (`-bg`, `-color`, `-muted`, `-border`, `-shadow`, `-radius`, and `--tc-tooltip-light-*` for the white variant).
|
|
202
|
+
|
|
203
|
+
On a [Tabler](https://tabler.io) page the colors come from the theme: each color token reads the matching `--tblr-*` variable first (`--tc-color-1` is `--tblr-primary`, series 2–8 are Tabler's orange, teal, yellow, pink, green, indigo and red, the surface is `--tblr-bg-surface`, text and borders, radius, shadow and font follow too) and falls back to the chart's own palette when the variable is not defined. Tabler switches its variables for dark mode itself; without Tabler the fallbacks have their own dark values.
|
|
194
204
|
|
|
195
205
|
Colors given in data (`series.color`, slice, ring, heatmap and annotation colors, `series.dash`) may come from users: any CSS color works, `var(--…)` and `color-mix()` included, but a value that could inject CSS (a `;`, quotes, `url()` and the like) is ignored and the palette color stays.
|
|
196
206
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { t as h } from "./vnode-tCWItoUH.js";
|
|
2
|
-
import { n as tween, t as stop } from "./tween-BCYd0RTY.js";
|
|
3
1
|
//#region src/shapes/arc.ts
|
|
4
2
|
/**
|
|
5
3
|
* Annular sector paths with padding and rounded corners, ported from
|
|
@@ -275,60 +273,29 @@ function arcPathStable(options) {
|
|
|
275
273
|
return `${d}Z`;
|
|
276
274
|
}
|
|
277
275
|
//#endregion
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
arc.cornerRadius ?? 0
|
|
303
|
-
];
|
|
304
|
-
return node;
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Take `el` from the arc of its last render, `prev`, to the arc of `next`.
|
|
308
|
-
* Returns the attributes left for the caller to patch (all but `d`, set
|
|
309
|
-
* here frame by frame), or nothing when there is no sweep: not an arc, the
|
|
310
|
-
* same path, no arc to come from, or a chart without transitions.
|
|
311
|
-
*/
|
|
312
|
-
function sweep(el, prev, next) {
|
|
313
|
-
const { arc, attrs } = next;
|
|
314
|
-
if (!arc || prev.attrs.d === attrs.d) return;
|
|
315
|
-
const origin = stop(el) ?? prev.arc;
|
|
316
|
-
const duration = Number.parseFloat(getComputedStyle(el).transitionDuration) * 1e3;
|
|
317
|
-
if (!origin || !(duration > 0)) return;
|
|
318
|
-
tween(el, origin, arc, duration, ([innerRadius, outerRadius, startAngle, endAngle, padAngle, cornerRadius]) => arcPathStable({
|
|
319
|
-
innerRadius,
|
|
320
|
-
outerRadius,
|
|
321
|
-
startAngle,
|
|
322
|
-
endAngle,
|
|
323
|
-
padAngle,
|
|
324
|
-
cornerRadius
|
|
325
|
-
}), String(attrs.d));
|
|
326
|
-
return {
|
|
327
|
-
...attrs,
|
|
328
|
-
d: prev.attrs.d
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
//#endregion
|
|
332
|
-
export { arcPathStable as a, arcCentroid as i, sweep as n, padAngleForGap as o, DEG as r, arcNode as t };
|
|
276
|
+
Object.defineProperty(exports, "DEG", {
|
|
277
|
+
enumerable: true,
|
|
278
|
+
get: function() {
|
|
279
|
+
return DEG;
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
Object.defineProperty(exports, "arcCentroid", {
|
|
283
|
+
enumerable: true,
|
|
284
|
+
get: function() {
|
|
285
|
+
return arcCentroid;
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
Object.defineProperty(exports, "arcPathStable", {
|
|
289
|
+
enumerable: true,
|
|
290
|
+
get: function() {
|
|
291
|
+
return arcPathStable;
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
Object.defineProperty(exports, "padAngleForGap", {
|
|
295
|
+
enumerable: true,
|
|
296
|
+
get: function() {
|
|
297
|
+
return padAngleForGap;
|
|
298
|
+
}
|
|
299
|
+
});
|
|
333
300
|
|
|
334
|
-
//# sourceMappingURL=
|
|
301
|
+
//# sourceMappingURL=arc-BXpLrt9b.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arc-BXpLrt9b.cjs","names":[],"sources":["../src/shapes/arc.ts"],"sourcesContent":["/**\n * Annular sector paths with padding and rounded corners, ported from\n * d3-shape's `arc()` (ISC license, Mike Bostock) so geometry matches d3.\n *\n * Angles are in radians, clockwise from 12 o'clock; paths are centered on\n * the origin (translate the group to place them).\n */\n\nconst EPSILON = 1e-12\nconst PI = Math.PI\nconst HALF_PI = PI / 2\nconst TAU = 2 * PI\n\n/** Degrees to radians. */\nexport const DEG: number = Math.PI / 180\n\n/** Room kept around pies and gauges for the halo of the hovered arc, in pixels. */\nexport const HALO = 8\n\n// Clamped like d3-shape's math helpers, so out-of-range inputs saturate instead of NaN.\nconst asin = (x: number): number => (x >= 1 ? HALF_PI : x <= -1 ? -HALF_PI : Math.asin(x))\nconst acos = (x: number): number => (x > 1 ? 0 : x < -1 ? PI : Math.acos(x))\n\nexport interface ArcOptions {\n innerRadius: number\n outerRadius: number\n startAngle: number\n endAngle: number\n /** Angle removed between adjacent arcs, split between both ends. Defaults to `0`. */\n padAngle?: number\n /** Radius the pad angle is measured at. Defaults to `sqrt(inner² + outer²)` like d3. */\n padRadius?: number\n /** Radius of the rounded corners, clamped to half the ring thickness. Defaults to `0`. */\n cornerRadius?: number\n /** Decimal places kept in the path data. Defaults to `2`. */\n precision?: number\n}\n\n/** Canvas-like path builder emitting SVG path data (after d3-path). */\nclass ArcPath {\n d = ''\n #x0: number | null = null\n #y0: number | null = null\n #x1: number | null = null\n #y1: number | null = null\n readonly #k: number\n\n constructor(precision: number) {\n this.#k = 10 ** Math.max(0, Math.min(12, Math.floor(precision)))\n }\n\n #n(value: number): string {\n const rounded = Math.round(value * this.#k) / this.#k\n return String(rounded === 0 ? 0 : rounded)\n }\n\n moveTo(x: number, y: number): void {\n this.#x0 = this.#x1 = x\n this.#y0 = this.#y1 = y\n this.d += `M${this.#n(x)},${this.#n(y)}`\n }\n\n lineTo(x: number, y: number): void {\n this.#x1 = x\n this.#y1 = y\n this.d += `L${this.#n(x)},${this.#n(y)}`\n }\n\n closePath(): void {\n if (this.#x1 !== null) {\n this.#x1 = this.#x0\n this.#y1 = this.#y0\n this.d += 'Z'\n }\n }\n\n arc(x: number, y: number, r: number, a0: number, a1: number, ccw: boolean): void {\n const dx = r * Math.cos(a0)\n const dy = r * Math.sin(a0)\n const x0 = x + dx\n const y0 = y + dy\n const cw = ccw ? 0 : 1\n let da = ccw ? a0 - a1 : a1 - a0\n\n if (this.#x1 === null || this.#y1 === null) {\n this.d += `M${this.#n(x0)},${this.#n(y0)}`\n this.#x0 = x0\n this.#y0 = y0\n } else if (Math.abs(this.#x1 - x0) > EPSILON || Math.abs(this.#y1 - y0) > EPSILON) {\n this.d += `L${this.#n(x0)},${this.#n(y0)}`\n }\n this.#x1 = x0\n this.#y1 = y0\n if (!r) return\n\n if (da < 0) da = (da % TAU) + TAU\n const rr = this.#n(r)\n if (da > TAU - EPSILON) {\n // A complete circle: two half arcs.\n this.d += `A${rr},${rr},0,1,${cw},${this.#n(x - dx)},${this.#n(y - dy)}`\n this.d += `A${rr},${rr},0,1,${cw},${this.#n(x0)},${this.#n(y0)}`\n } else if (da > EPSILON) {\n this.#x1 = x + r * Math.cos(a1)\n this.#y1 = y + r * Math.sin(a1)\n this.d += `A${rr},${rr},0,${da >= PI ? 1 : 0},${cw},${this.#n(this.#x1)},${this.#n(this.#y1)}`\n }\n }\n}\n\nfunction intersect(\n x0: number,\n y0: number,\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n x3: number,\n y3: number,\n): [number, number] | undefined {\n const x10 = x1 - x0\n const y10 = y1 - y0\n const x32 = x3 - x2\n const y32 = y3 - y2\n let t = y32 * x10 - x32 * y10\n if (t * t < EPSILON) return undefined\n t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t\n return [x0 + t * x10, y0 + t * y10]\n}\n\n/** Center and tangent points of a rounded corner between a radial edge and an arc. */\nfunction cornerTangents(\n x0: number,\n y0: number,\n x1: number,\n y1: number,\n r1: number,\n rc: number,\n cw: boolean,\n) {\n const x01 = x0 - x1\n const y01 = y0 - y1\n const lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01)\n const ox = lo * y01\n const oy = -lo * x01\n const x11 = x0 + ox\n const y11 = y0 + oy\n const x10 = x1 + ox\n const y10 = y1 + oy\n const x00 = (x11 + x10) / 2\n const y00 = (y11 + y10) / 2\n const dx = x10 - x11\n const dy = y10 - y11\n const d2 = dx * dx + dy * dy\n const r = r1 - rc\n const D = x11 * y10 - x10 * y11\n const d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D * D))\n let cx0 = (D * dy - dx * d) / d2\n let cy0 = (-D * dx - dy * d) / d2\n const cx1 = (D * dy + dx * d) / d2\n const cy1 = (-D * dx + dy * d) / d2\n const dx0 = cx0 - x00\n const dy0 = cy0 - y00\n const dx1 = cx1 - x00\n const dy1 = cy1 - y00\n // Pick the intersection closest to the edge midpoint.\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) {\n cx0 = cx1\n cy0 = cy1\n }\n return {\n cx: cx0,\n cy: cy0,\n x01: -ox,\n y01: -oy,\n x11: cx0 * (r1 / r - 1),\n y11: cy0 * (r1 / r - 1),\n }\n}\n\n/**\n * Padded angles, clamped corner radii and edge points of a partial sector,\n * shared by both path generators so they agree exactly.\n */\nfunction sector(\n options: ArcOptions,\n r0: number,\n r1: number,\n a0: number,\n a1: number,\n da: number,\n cw: boolean,\n) {\n let a01 = a0\n let a11 = a1\n let a00 = a0\n let a10 = a1\n let da0 = da\n let da1 = da\n const ap = (options.padAngle ?? 0) / 2\n const rp = ap > EPSILON ? (options.padRadius ?? Math.sqrt(r0 * r0 + r1 * r1)) : 0\n const rc = Math.min(Math.abs(r1 - r0) / 2, options.cornerRadius ?? 0)\n let rc0 = rc\n let rc1 = rc\n\n // Apply padding: equal linear offsets at both radii keep the gap parallel.\n if (rp > EPSILON) {\n let p0 = asin((rp / r0) * Math.sin(ap))\n let p1 = asin((rp / r1) * Math.sin(ap))\n da0 -= p0 * 2\n if (da0 > EPSILON) {\n p0 *= cw ? 1 : -1\n a00 += p0\n a10 -= p0\n } else {\n da0 = 0\n a00 = a10 = (a0 + a1) / 2\n }\n da1 -= p1 * 2\n if (da1 > EPSILON) {\n p1 *= cw ? 1 : -1\n a01 += p1\n a11 -= p1\n } else {\n da1 = 0\n a01 = a11 = (a0 + a1) / 2\n }\n }\n\n const x01 = r1 * Math.cos(a01)\n const y01 = r1 * Math.sin(a01)\n const x10 = r0 * Math.cos(a10)\n const y10 = r0 * Math.sin(a10)\n const x11 = r1 * Math.cos(a11)\n const y11 = r1 * Math.sin(a11)\n const x00 = r0 * Math.cos(a00)\n const y00 = r0 * Math.sin(a00)\n\n // Restrict the corner radius for narrow sectors, where corners would overlap.\n if (rc > EPSILON && da < PI) {\n const oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)\n if (oc) {\n const ax = x01 - oc[0]\n const ay = y01 - oc[1]\n const bx = x11 - oc[0]\n const by = y11 - oc[1]\n const cos =\n (ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))\n const kc = 1 / Math.sin(acos(cos) / 2)\n const lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1])\n rc0 = Math.min(rc, (r0 - lc) / (kc - 1))\n rc1 = Math.min(rc, (r1 - lc) / (kc + 1))\n } else {\n rc0 = rc1 = 0\n }\n }\n return { a00, a01, a10, a11, da0, da1, rc, rc0, rc1, x01, y01, x10, y10, x11, y11, x00, y00 }\n}\n\n/** SVG path data of an annular sector (a pie slice when `innerRadius` is 0). */\nexport function arcPath(options: ArcOptions): string {\n const path = new ArcPath(options.precision ?? 2)\n let r0 = Math.max(0, options.innerRadius)\n let r1 = Math.max(0, options.outerRadius)\n if (r1 < r0) [r0, r1] = [r1, r0]\n const a0 = options.startAngle - HALF_PI\n const a1 = options.endAngle - HALF_PI\n const da = Math.abs(a1 - a0)\n const cw = a1 > a0\n\n if (!(r1 > EPSILON)) {\n path.moveTo(0, 0)\n } else if (da > TAU - EPSILON) {\n // A full ring (or disc).\n path.moveTo(r1 * Math.cos(a0), r1 * Math.sin(a0))\n path.arc(0, 0, r1, a0, a1, !cw)\n if (r0 > EPSILON) {\n path.moveTo(r0 * Math.cos(a1), r0 * Math.sin(a1))\n path.arc(0, 0, r0, a1, a0, cw)\n }\n } else {\n const g = sector(options, r0, r1, a0, a1, da, cw)\n const { a00, a01, a10, a11, da0, da1, rc, rc0, rc1, x01, y01, x10, y10 } = g\n\n // Outer ring.\n if (!(da1 > EPSILON)) {\n path.moveTo(x01, y01)\n } else if (rc1 > EPSILON) {\n const { x00, y00, x11, y11 } = g\n const t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw)\n const t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw)\n path.moveTo(t0.cx + t0.x01, t0.cy + t0.y01)\n if (rc1 < rc) {\n path.arc(t0.cx, t0.cy, rc1, Math.atan2(t0.y01, t0.x01), Math.atan2(t1.y01, t1.x01), !cw)\n } else {\n path.arc(t0.cx, t0.cy, rc1, Math.atan2(t0.y01, t0.x01), Math.atan2(t0.y11, t0.x11), !cw)\n path.arc(\n 0,\n 0,\n r1,\n Math.atan2(t0.cy + t0.y11, t0.cx + t0.x11),\n Math.atan2(t1.cy + t1.y11, t1.cx + t1.x11),\n !cw,\n )\n path.arc(t1.cx, t1.cy, rc1, Math.atan2(t1.y11, t1.x11), Math.atan2(t1.y01, t1.x01), !cw)\n }\n } else {\n path.moveTo(x01, y01)\n path.arc(0, 0, r1, a01, a11, !cw)\n }\n\n // Inner ring (or the center of a pie slice).\n if (!(r0 > EPSILON) || !(da0 > EPSILON)) {\n path.lineTo(x10, y10)\n } else if (rc0 > EPSILON) {\n const { x00, y00, x11, y11 } = g\n const t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw)\n const t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw)\n path.lineTo(t0.cx + t0.x01, t0.cy + t0.y01)\n if (rc0 < rc) {\n path.arc(t0.cx, t0.cy, rc0, Math.atan2(t0.y01, t0.x01), Math.atan2(t1.y01, t1.x01), !cw)\n } else {\n path.arc(t0.cx, t0.cy, rc0, Math.atan2(t0.y01, t0.x01), Math.atan2(t0.y11, t0.x11), !cw)\n path.arc(\n 0,\n 0,\n r0,\n Math.atan2(t0.cy + t0.y11, t0.cx + t0.x11),\n Math.atan2(t1.cy + t1.y11, t1.cx + t1.x11),\n cw,\n )\n path.arc(t1.cx, t1.cy, rc0, Math.atan2(t1.y11, t1.x11), Math.atan2(t1.y01, t1.x01), !cw)\n }\n } else {\n path.arc(0, 0, r0, a10, a00, cw)\n }\n }\n\n path.closePath()\n return path.d\n}\n\n/** Midpoint of an arc, e.g. to anchor a tooltip or label (like d3's `arc.centroid`). */\nexport function arcCentroid(options: ArcOptions): [number, number] {\n const r = (options.innerRadius + options.outerRadius) / 2\n const a = (options.startAngle + options.endAngle) / 2 - HALF_PI\n return [Math.cos(a) * r, Math.sin(a) * r]\n}\n\n/** Pad angle giving a constant `gap` (in pixels) between arcs of a ring. */\nexport function padAngleForGap(gap: number, innerRadius: number, outerRadius: number): number {\n const rp = Math.sqrt(innerRadius * innerRadius + outerRadius * outerRadius)\n return rp > 0 ? 2 * Math.asin(Math.min(1, gap / 2 / rp)) : 0\n}\n\n/** Angle of a point around the origin. */\nconst angleOf = (x: number, y: number): number => Math.atan2(y, x)\n\n/**\n * The same sector as {@link arcPath}, drawn with a fixed command structure:\n * every corner is always present (zero length when there is none) and each\n * ring is split into two half arcs, so the large-arc flag never flips.\n * Paths of different angles therefore keep their commands while an arc is\n * redrawn frame by frame, turning to its new angles (see `sweep`).\n */\nexport function arcPathStable(options: ArcOptions): string {\n const k = 10 ** Math.max(0, Math.min(12, Math.floor(options.precision ?? 2)))\n const n = (v: number): string => {\n const r = Math.round(v * k) / k\n return String(r === 0 ? 0 : r)\n }\n let d = ''\n const move = (x: number, y: number) => {\n d += `M${n(x)},${n(y)}`\n }\n const line = (x: number, y: number) => {\n d += `L${n(x)},${n(y)}`\n }\n const arc = (r: number, sweep: 0 | 1, x: number, y: number) => {\n d += `A${n(r)},${n(r)},0,0,${sweep},${n(x)},${n(y)}`\n }\n /** Two half arcs of radius `r` around the origin from angle `a0` to `a1`. */\n const ring = (r: number, a0: number, a1: number, ccw: boolean) => {\n let delta = ccw ? a0 - a1 : a1 - a0\n delta = ((delta % TAU) + TAU) % TAU\n if (delta < EPSILON && Math.abs(a1 - a0) > EPSILON) delta = TAU\n const mid = ccw ? a0 - delta / 2 : a0 + delta / 2\n const sweep: 0 | 1 = ccw ? 0 : 1\n arc(r, sweep, r * Math.cos(mid), r * Math.sin(mid))\n arc(r, sweep, r * Math.cos(a1), r * Math.sin(a1))\n }\n\n let r0 = Math.max(0, options.innerRadius)\n let r1 = Math.max(0, options.outerRadius)\n if (r1 < r0) [r0, r1] = [r1, r0]\n const a0 = options.startAngle - HALF_PI\n const a1 = options.endAngle - HALF_PI\n const da = Math.abs(a1 - a0)\n const cw = a1 > a0\n const outerSweep: 0 | 1 = cw ? 1 : 0\n\n if (!(r1 > EPSILON)) {\n // A point: eleven no-op commands at the origin.\n move(0, 0)\n for (let i = 0; i < 4; i++) arc(0, outerSweep, 0, 0)\n line(0, 0)\n for (let i = 0; i < 4; i++) arc(0, outerSweep, 0, 0)\n return `${d}Z`\n }\n\n if (da > TAU - EPSILON) {\n // A full ring (or disc): the seam between the two rings closes the path.\n const ox = r1 * Math.cos(a0)\n const oy = r1 * Math.sin(a0)\n move(ox, oy)\n arc(r1, outerSweep, ox, oy)\n ring(r1, a0, a0 + (cw ? TAU : -TAU) * (1 - 1e-9), !cw)\n arc(r1, outerSweep, ox, oy)\n const ix = r0 * Math.cos(a0)\n const iy = r0 * Math.sin(a0)\n line(ix, iy)\n arc(r0, outerSweep, ix, iy)\n if (r0 > EPSILON) ring(r0, a0, a0 + (cw ? -TAU : TAU) * (1 - 1e-9), cw)\n else for (let i = 0; i < 2; i++) arc(0, outerSweep, 0, 0)\n arc(r0, outerSweep, ix, iy)\n return `${d}Z`\n }\n\n const { a00, a01, a10, a11, da0, da1, rc, rc0, rc1, x01, y01, x10, y10, x11, y11, x00, y00 } =\n sector(options, r0, r1, a0, a1, da, cw)\n\n // Outer edge: corner, two ring halves, corner.\n if (da1 > EPSILON && rc1 > EPSILON) {\n const t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw)\n const t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw)\n move(t0.cx + t0.x01, t0.cy + t0.y01)\n if (rc1 < rc) {\n // Corners merged: one corner arc covers the edge, the rest is empty.\n const ex = t1.cx + t1.x01\n const ey = t1.cy + t1.y01\n arc(rc1, outerSweep, ex, ey)\n arc(r1, outerSweep, ex, ey)\n arc(r1, outerSweep, ex, ey)\n arc(rc1, outerSweep, ex, ey)\n } else {\n arc(rc1, outerSweep, t0.cx + t0.x11, t0.cy + t0.y11)\n ring(\n r1,\n angleOf(t0.cx + t0.x11, t0.cy + t0.y11),\n angleOf(t1.cx + t1.x11, t1.cy + t1.y11),\n !cw,\n )\n arc(rc1, outerSweep, t1.cx + t1.x01, t1.cy + t1.y01)\n }\n } else {\n move(x01, y01)\n arc(r1, outerSweep, x01, y01)\n if (da1 > EPSILON) ring(r1, a01, a11, !cw)\n else for (let i = 0; i < 2; i++) arc(r1, outerSweep, x01, y01)\n arc(r1, outerSweep, x11, y11)\n }\n\n // Inner edge (or the center of a pie slice): corner, two ring halves, corner.\n if (!(r0 > EPSILON) || !(da0 > EPSILON)) {\n line(x10, y10)\n for (let i = 0; i < 4; i++) arc(r0, outerSweep, x10, y10)\n } else if (rc0 > EPSILON) {\n const t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw)\n const t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw)\n line(t0.cx + t0.x01, t0.cy + t0.y01)\n if (rc0 < rc) {\n const ex = t1.cx + t1.x01\n const ey = t1.cy + t1.y01\n arc(rc0, outerSweep, ex, ey)\n arc(r0, outerSweep, ex, ey)\n arc(r0, outerSweep, ex, ey)\n arc(rc0, outerSweep, ex, ey)\n } else {\n arc(rc0, outerSweep, t0.cx + t0.x11, t0.cy + t0.y11)\n ring(r0, angleOf(t0.cx + t0.x11, t0.cy + t0.y11), angleOf(t1.cx + t1.x11, t1.cy + t1.y11), cw)\n arc(rc0, outerSweep, t1.cx + t1.x01, t1.cy + t1.y01)\n }\n } else {\n line(x10, y10)\n arc(r0, outerSweep, x10, y10)\n ring(r0, a10, a00, cw)\n arc(r0, outerSweep, x00, y00)\n }\n return `${d}Z`\n}\n"],"mappings":";;;;;;;;AAQA,MAAM,UAAU;AAChB,MAAM,KAAK,KAAK;AAChB,MAAM,UAAU,KAAK;AACrB,MAAM,MAAM,IAAI;;AAGhB,MAAa,MAAc,KAAK,KAAK;AAMrC,MAAM,QAAQ,MAAuB,KAAK,IAAI,UAAU,KAAK,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC;AACxF,MAAM,QAAQ,MAAuB,IAAI,IAAI,IAAI,IAAI,KAAK,KAAK,KAAK,KAAK,CAAC;AAwF1E,SAAS,UACP,IACA,IACA,IACA,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
|
2
|
-
const require_tween = require("./tween-CIGBlryn.cjs");
|
|
3
1
|
//#region src/shapes/arc.ts
|
|
4
2
|
/**
|
|
5
3
|
* Annular sector paths with padding and rounded corners, ported from
|
|
@@ -275,95 +273,6 @@ function arcPathStable(options) {
|
|
|
275
273
|
return `${d}Z`;
|
|
276
274
|
}
|
|
277
275
|
//#endregion
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Arcs that turn to their new angles: a transition of `d` moves each point
|
|
281
|
-
* of a path along a straight line, which bends a slice out of its ring on
|
|
282
|
-
* the way. A path that knows which arc it draws (the `arc` of its node, see
|
|
283
|
-
* `arcNode`) is redrawn frame by frame instead, with the angles and radii
|
|
284
|
-
* in between, so slices grow and shrink around the center. Timed by the
|
|
285
|
-
* path's `transition-duration` (`--tc-duration`), with an ease-out curve.
|
|
286
|
-
*/
|
|
287
|
-
/**
|
|
288
|
-
* A path drawing this arc, which keeps the arc with it (radii, angles, pad
|
|
289
|
-
* angle, corner radius): out of the markup, for the next render to sweep from.
|
|
290
|
-
*/
|
|
291
|
-
function arcNode(name, arc) {
|
|
292
|
-
const node = require_vnode.h("path", {
|
|
293
|
-
class: name,
|
|
294
|
-
d: arcPathStable(arc)
|
|
295
|
-
});
|
|
296
|
-
node.arc = [
|
|
297
|
-
arc.innerRadius,
|
|
298
|
-
arc.outerRadius,
|
|
299
|
-
arc.startAngle,
|
|
300
|
-
arc.endAngle,
|
|
301
|
-
arc.padAngle ?? 0,
|
|
302
|
-
arc.cornerRadius ?? 0
|
|
303
|
-
];
|
|
304
|
-
return node;
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Take `el` from the arc of its last render, `prev`, to the arc of `next`.
|
|
308
|
-
* Returns the attributes left for the caller to patch (all but `d`, set
|
|
309
|
-
* here frame by frame), or nothing when there is no sweep: not an arc, the
|
|
310
|
-
* same path, no arc to come from, or a chart without transitions.
|
|
311
|
-
*/
|
|
312
|
-
function sweep(el, prev, next) {
|
|
313
|
-
const { arc, attrs } = next;
|
|
314
|
-
if (!arc || prev.attrs.d === attrs.d) return;
|
|
315
|
-
const origin = require_tween.stop(el) ?? prev.arc;
|
|
316
|
-
const duration = Number.parseFloat(getComputedStyle(el).transitionDuration) * 1e3;
|
|
317
|
-
if (!origin || !(duration > 0)) return;
|
|
318
|
-
require_tween.tween(el, origin, arc, duration, ([innerRadius, outerRadius, startAngle, endAngle, padAngle, cornerRadius]) => arcPathStable({
|
|
319
|
-
innerRadius,
|
|
320
|
-
outerRadius,
|
|
321
|
-
startAngle,
|
|
322
|
-
endAngle,
|
|
323
|
-
padAngle,
|
|
324
|
-
cornerRadius
|
|
325
|
-
}), String(attrs.d));
|
|
326
|
-
return {
|
|
327
|
-
...attrs,
|
|
328
|
-
d: prev.attrs.d
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
//#endregion
|
|
332
|
-
Object.defineProperty(exports, "DEG", {
|
|
333
|
-
enumerable: true,
|
|
334
|
-
get: function() {
|
|
335
|
-
return DEG;
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
Object.defineProperty(exports, "arcCentroid", {
|
|
339
|
-
enumerable: true,
|
|
340
|
-
get: function() {
|
|
341
|
-
return arcCentroid;
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
Object.defineProperty(exports, "arcNode", {
|
|
345
|
-
enumerable: true,
|
|
346
|
-
get: function() {
|
|
347
|
-
return arcNode;
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
Object.defineProperty(exports, "arcPathStable", {
|
|
351
|
-
enumerable: true,
|
|
352
|
-
get: function() {
|
|
353
|
-
return arcPathStable;
|
|
354
|
-
}
|
|
355
|
-
});
|
|
356
|
-
Object.defineProperty(exports, "padAngleForGap", {
|
|
357
|
-
enumerable: true,
|
|
358
|
-
get: function() {
|
|
359
|
-
return padAngleForGap;
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
Object.defineProperty(exports, "sweep", {
|
|
363
|
-
enumerable: true,
|
|
364
|
-
get: function() {
|
|
365
|
-
return sweep;
|
|
366
|
-
}
|
|
367
|
-
});
|
|
276
|
+
export { padAngleForGap as i, arcCentroid as n, arcPathStable as r, DEG as t };
|
|
368
277
|
|
|
369
|
-
//# sourceMappingURL=
|
|
278
|
+
//# sourceMappingURL=arc-a1tRTEw7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arc-a1tRTEw7.js","names":[],"sources":["../src/shapes/arc.ts"],"sourcesContent":["/**\n * Annular sector paths with padding and rounded corners, ported from\n * d3-shape's `arc()` (ISC license, Mike Bostock) so geometry matches d3.\n *\n * Angles are in radians, clockwise from 12 o'clock; paths are centered on\n * the origin (translate the group to place them).\n */\n\nconst EPSILON = 1e-12\nconst PI = Math.PI\nconst HALF_PI = PI / 2\nconst TAU = 2 * PI\n\n/** Degrees to radians. */\nexport const DEG: number = Math.PI / 180\n\n/** Room kept around pies and gauges for the halo of the hovered arc, in pixels. */\nexport const HALO = 8\n\n// Clamped like d3-shape's math helpers, so out-of-range inputs saturate instead of NaN.\nconst asin = (x: number): number => (x >= 1 ? HALF_PI : x <= -1 ? -HALF_PI : Math.asin(x))\nconst acos = (x: number): number => (x > 1 ? 0 : x < -1 ? PI : Math.acos(x))\n\nexport interface ArcOptions {\n innerRadius: number\n outerRadius: number\n startAngle: number\n endAngle: number\n /** Angle removed between adjacent arcs, split between both ends. Defaults to `0`. */\n padAngle?: number\n /** Radius the pad angle is measured at. Defaults to `sqrt(inner² + outer²)` like d3. */\n padRadius?: number\n /** Radius of the rounded corners, clamped to half the ring thickness. Defaults to `0`. */\n cornerRadius?: number\n /** Decimal places kept in the path data. Defaults to `2`. */\n precision?: number\n}\n\n/** Canvas-like path builder emitting SVG path data (after d3-path). */\nclass ArcPath {\n d = ''\n #x0: number | null = null\n #y0: number | null = null\n #x1: number | null = null\n #y1: number | null = null\n readonly #k: number\n\n constructor(precision: number) {\n this.#k = 10 ** Math.max(0, Math.min(12, Math.floor(precision)))\n }\n\n #n(value: number): string {\n const rounded = Math.round(value * this.#k) / this.#k\n return String(rounded === 0 ? 0 : rounded)\n }\n\n moveTo(x: number, y: number): void {\n this.#x0 = this.#x1 = x\n this.#y0 = this.#y1 = y\n this.d += `M${this.#n(x)},${this.#n(y)}`\n }\n\n lineTo(x: number, y: number): void {\n this.#x1 = x\n this.#y1 = y\n this.d += `L${this.#n(x)},${this.#n(y)}`\n }\n\n closePath(): void {\n if (this.#x1 !== null) {\n this.#x1 = this.#x0\n this.#y1 = this.#y0\n this.d += 'Z'\n }\n }\n\n arc(x: number, y: number, r: number, a0: number, a1: number, ccw: boolean): void {\n const dx = r * Math.cos(a0)\n const dy = r * Math.sin(a0)\n const x0 = x + dx\n const y0 = y + dy\n const cw = ccw ? 0 : 1\n let da = ccw ? a0 - a1 : a1 - a0\n\n if (this.#x1 === null || this.#y1 === null) {\n this.d += `M${this.#n(x0)},${this.#n(y0)}`\n this.#x0 = x0\n this.#y0 = y0\n } else if (Math.abs(this.#x1 - x0) > EPSILON || Math.abs(this.#y1 - y0) > EPSILON) {\n this.d += `L${this.#n(x0)},${this.#n(y0)}`\n }\n this.#x1 = x0\n this.#y1 = y0\n if (!r) return\n\n if (da < 0) da = (da % TAU) + TAU\n const rr = this.#n(r)\n if (da > TAU - EPSILON) {\n // A complete circle: two half arcs.\n this.d += `A${rr},${rr},0,1,${cw},${this.#n(x - dx)},${this.#n(y - dy)}`\n this.d += `A${rr},${rr},0,1,${cw},${this.#n(x0)},${this.#n(y0)}`\n } else if (da > EPSILON) {\n this.#x1 = x + r * Math.cos(a1)\n this.#y1 = y + r * Math.sin(a1)\n this.d += `A${rr},${rr},0,${da >= PI ? 1 : 0},${cw},${this.#n(this.#x1)},${this.#n(this.#y1)}`\n }\n }\n}\n\nfunction intersect(\n x0: number,\n y0: number,\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n x3: number,\n y3: number,\n): [number, number] | undefined {\n const x10 = x1 - x0\n const y10 = y1 - y0\n const x32 = x3 - x2\n const y32 = y3 - y2\n let t = y32 * x10 - x32 * y10\n if (t * t < EPSILON) return undefined\n t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t\n return [x0 + t * x10, y0 + t * y10]\n}\n\n/** Center and tangent points of a rounded corner between a radial edge and an arc. */\nfunction cornerTangents(\n x0: number,\n y0: number,\n x1: number,\n y1: number,\n r1: number,\n rc: number,\n cw: boolean,\n) {\n const x01 = x0 - x1\n const y01 = y0 - y1\n const lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01)\n const ox = lo * y01\n const oy = -lo * x01\n const x11 = x0 + ox\n const y11 = y0 + oy\n const x10 = x1 + ox\n const y10 = y1 + oy\n const x00 = (x11 + x10) / 2\n const y00 = (y11 + y10) / 2\n const dx = x10 - x11\n const dy = y10 - y11\n const d2 = dx * dx + dy * dy\n const r = r1 - rc\n const D = x11 * y10 - x10 * y11\n const d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D * D))\n let cx0 = (D * dy - dx * d) / d2\n let cy0 = (-D * dx - dy * d) / d2\n const cx1 = (D * dy + dx * d) / d2\n const cy1 = (-D * dx + dy * d) / d2\n const dx0 = cx0 - x00\n const dy0 = cy0 - y00\n const dx1 = cx1 - x00\n const dy1 = cy1 - y00\n // Pick the intersection closest to the edge midpoint.\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) {\n cx0 = cx1\n cy0 = cy1\n }\n return {\n cx: cx0,\n cy: cy0,\n x01: -ox,\n y01: -oy,\n x11: cx0 * (r1 / r - 1),\n y11: cy0 * (r1 / r - 1),\n }\n}\n\n/**\n * Padded angles, clamped corner radii and edge points of a partial sector,\n * shared by both path generators so they agree exactly.\n */\nfunction sector(\n options: ArcOptions,\n r0: number,\n r1: number,\n a0: number,\n a1: number,\n da: number,\n cw: boolean,\n) {\n let a01 = a0\n let a11 = a1\n let a00 = a0\n let a10 = a1\n let da0 = da\n let da1 = da\n const ap = (options.padAngle ?? 0) / 2\n const rp = ap > EPSILON ? (options.padRadius ?? Math.sqrt(r0 * r0 + r1 * r1)) : 0\n const rc = Math.min(Math.abs(r1 - r0) / 2, options.cornerRadius ?? 0)\n let rc0 = rc\n let rc1 = rc\n\n // Apply padding: equal linear offsets at both radii keep the gap parallel.\n if (rp > EPSILON) {\n let p0 = asin((rp / r0) * Math.sin(ap))\n let p1 = asin((rp / r1) * Math.sin(ap))\n da0 -= p0 * 2\n if (da0 > EPSILON) {\n p0 *= cw ? 1 : -1\n a00 += p0\n a10 -= p0\n } else {\n da0 = 0\n a00 = a10 = (a0 + a1) / 2\n }\n da1 -= p1 * 2\n if (da1 > EPSILON) {\n p1 *= cw ? 1 : -1\n a01 += p1\n a11 -= p1\n } else {\n da1 = 0\n a01 = a11 = (a0 + a1) / 2\n }\n }\n\n const x01 = r1 * Math.cos(a01)\n const y01 = r1 * Math.sin(a01)\n const x10 = r0 * Math.cos(a10)\n const y10 = r0 * Math.sin(a10)\n const x11 = r1 * Math.cos(a11)\n const y11 = r1 * Math.sin(a11)\n const x00 = r0 * Math.cos(a00)\n const y00 = r0 * Math.sin(a00)\n\n // Restrict the corner radius for narrow sectors, where corners would overlap.\n if (rc > EPSILON && da < PI) {\n const oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)\n if (oc) {\n const ax = x01 - oc[0]\n const ay = y01 - oc[1]\n const bx = x11 - oc[0]\n const by = y11 - oc[1]\n const cos =\n (ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))\n const kc = 1 / Math.sin(acos(cos) / 2)\n const lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1])\n rc0 = Math.min(rc, (r0 - lc) / (kc - 1))\n rc1 = Math.min(rc, (r1 - lc) / (kc + 1))\n } else {\n rc0 = rc1 = 0\n }\n }\n return { a00, a01, a10, a11, da0, da1, rc, rc0, rc1, x01, y01, x10, y10, x11, y11, x00, y00 }\n}\n\n/** SVG path data of an annular sector (a pie slice when `innerRadius` is 0). */\nexport function arcPath(options: ArcOptions): string {\n const path = new ArcPath(options.precision ?? 2)\n let r0 = Math.max(0, options.innerRadius)\n let r1 = Math.max(0, options.outerRadius)\n if (r1 < r0) [r0, r1] = [r1, r0]\n const a0 = options.startAngle - HALF_PI\n const a1 = options.endAngle - HALF_PI\n const da = Math.abs(a1 - a0)\n const cw = a1 > a0\n\n if (!(r1 > EPSILON)) {\n path.moveTo(0, 0)\n } else if (da > TAU - EPSILON) {\n // A full ring (or disc).\n path.moveTo(r1 * Math.cos(a0), r1 * Math.sin(a0))\n path.arc(0, 0, r1, a0, a1, !cw)\n if (r0 > EPSILON) {\n path.moveTo(r0 * Math.cos(a1), r0 * Math.sin(a1))\n path.arc(0, 0, r0, a1, a0, cw)\n }\n } else {\n const g = sector(options, r0, r1, a0, a1, da, cw)\n const { a00, a01, a10, a11, da0, da1, rc, rc0, rc1, x01, y01, x10, y10 } = g\n\n // Outer ring.\n if (!(da1 > EPSILON)) {\n path.moveTo(x01, y01)\n } else if (rc1 > EPSILON) {\n const { x00, y00, x11, y11 } = g\n const t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw)\n const t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw)\n path.moveTo(t0.cx + t0.x01, t0.cy + t0.y01)\n if (rc1 < rc) {\n path.arc(t0.cx, t0.cy, rc1, Math.atan2(t0.y01, t0.x01), Math.atan2(t1.y01, t1.x01), !cw)\n } else {\n path.arc(t0.cx, t0.cy, rc1, Math.atan2(t0.y01, t0.x01), Math.atan2(t0.y11, t0.x11), !cw)\n path.arc(\n 0,\n 0,\n r1,\n Math.atan2(t0.cy + t0.y11, t0.cx + t0.x11),\n Math.atan2(t1.cy + t1.y11, t1.cx + t1.x11),\n !cw,\n )\n path.arc(t1.cx, t1.cy, rc1, Math.atan2(t1.y11, t1.x11), Math.atan2(t1.y01, t1.x01), !cw)\n }\n } else {\n path.moveTo(x01, y01)\n path.arc(0, 0, r1, a01, a11, !cw)\n }\n\n // Inner ring (or the center of a pie slice).\n if (!(r0 > EPSILON) || !(da0 > EPSILON)) {\n path.lineTo(x10, y10)\n } else if (rc0 > EPSILON) {\n const { x00, y00, x11, y11 } = g\n const t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw)\n const t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw)\n path.lineTo(t0.cx + t0.x01, t0.cy + t0.y01)\n if (rc0 < rc) {\n path.arc(t0.cx, t0.cy, rc0, Math.atan2(t0.y01, t0.x01), Math.atan2(t1.y01, t1.x01), !cw)\n } else {\n path.arc(t0.cx, t0.cy, rc0, Math.atan2(t0.y01, t0.x01), Math.atan2(t0.y11, t0.x11), !cw)\n path.arc(\n 0,\n 0,\n r0,\n Math.atan2(t0.cy + t0.y11, t0.cx + t0.x11),\n Math.atan2(t1.cy + t1.y11, t1.cx + t1.x11),\n cw,\n )\n path.arc(t1.cx, t1.cy, rc0, Math.atan2(t1.y11, t1.x11), Math.atan2(t1.y01, t1.x01), !cw)\n }\n } else {\n path.arc(0, 0, r0, a10, a00, cw)\n }\n }\n\n path.closePath()\n return path.d\n}\n\n/** Midpoint of an arc, e.g. to anchor a tooltip or label (like d3's `arc.centroid`). */\nexport function arcCentroid(options: ArcOptions): [number, number] {\n const r = (options.innerRadius + options.outerRadius) / 2\n const a = (options.startAngle + options.endAngle) / 2 - HALF_PI\n return [Math.cos(a) * r, Math.sin(a) * r]\n}\n\n/** Pad angle giving a constant `gap` (in pixels) between arcs of a ring. */\nexport function padAngleForGap(gap: number, innerRadius: number, outerRadius: number): number {\n const rp = Math.sqrt(innerRadius * innerRadius + outerRadius * outerRadius)\n return rp > 0 ? 2 * Math.asin(Math.min(1, gap / 2 / rp)) : 0\n}\n\n/** Angle of a point around the origin. */\nconst angleOf = (x: number, y: number): number => Math.atan2(y, x)\n\n/**\n * The same sector as {@link arcPath}, drawn with a fixed command structure:\n * every corner is always present (zero length when there is none) and each\n * ring is split into two half arcs, so the large-arc flag never flips.\n * Paths of different angles therefore keep their commands while an arc is\n * redrawn frame by frame, turning to its new angles (see `sweep`).\n */\nexport function arcPathStable(options: ArcOptions): string {\n const k = 10 ** Math.max(0, Math.min(12, Math.floor(options.precision ?? 2)))\n const n = (v: number): string => {\n const r = Math.round(v * k) / k\n return String(r === 0 ? 0 : r)\n }\n let d = ''\n const move = (x: number, y: number) => {\n d += `M${n(x)},${n(y)}`\n }\n const line = (x: number, y: number) => {\n d += `L${n(x)},${n(y)}`\n }\n const arc = (r: number, sweep: 0 | 1, x: number, y: number) => {\n d += `A${n(r)},${n(r)},0,0,${sweep},${n(x)},${n(y)}`\n }\n /** Two half arcs of radius `r` around the origin from angle `a0` to `a1`. */\n const ring = (r: number, a0: number, a1: number, ccw: boolean) => {\n let delta = ccw ? a0 - a1 : a1 - a0\n delta = ((delta % TAU) + TAU) % TAU\n if (delta < EPSILON && Math.abs(a1 - a0) > EPSILON) delta = TAU\n const mid = ccw ? a0 - delta / 2 : a0 + delta / 2\n const sweep: 0 | 1 = ccw ? 0 : 1\n arc(r, sweep, r * Math.cos(mid), r * Math.sin(mid))\n arc(r, sweep, r * Math.cos(a1), r * Math.sin(a1))\n }\n\n let r0 = Math.max(0, options.innerRadius)\n let r1 = Math.max(0, options.outerRadius)\n if (r1 < r0) [r0, r1] = [r1, r0]\n const a0 = options.startAngle - HALF_PI\n const a1 = options.endAngle - HALF_PI\n const da = Math.abs(a1 - a0)\n const cw = a1 > a0\n const outerSweep: 0 | 1 = cw ? 1 : 0\n\n if (!(r1 > EPSILON)) {\n // A point: eleven no-op commands at the origin.\n move(0, 0)\n for (let i = 0; i < 4; i++) arc(0, outerSweep, 0, 0)\n line(0, 0)\n for (let i = 0; i < 4; i++) arc(0, outerSweep, 0, 0)\n return `${d}Z`\n }\n\n if (da > TAU - EPSILON) {\n // A full ring (or disc): the seam between the two rings closes the path.\n const ox = r1 * Math.cos(a0)\n const oy = r1 * Math.sin(a0)\n move(ox, oy)\n arc(r1, outerSweep, ox, oy)\n ring(r1, a0, a0 + (cw ? TAU : -TAU) * (1 - 1e-9), !cw)\n arc(r1, outerSweep, ox, oy)\n const ix = r0 * Math.cos(a0)\n const iy = r0 * Math.sin(a0)\n line(ix, iy)\n arc(r0, outerSweep, ix, iy)\n if (r0 > EPSILON) ring(r0, a0, a0 + (cw ? -TAU : TAU) * (1 - 1e-9), cw)\n else for (let i = 0; i < 2; i++) arc(0, outerSweep, 0, 0)\n arc(r0, outerSweep, ix, iy)\n return `${d}Z`\n }\n\n const { a00, a01, a10, a11, da0, da1, rc, rc0, rc1, x01, y01, x10, y10, x11, y11, x00, y00 } =\n sector(options, r0, r1, a0, a1, da, cw)\n\n // Outer edge: corner, two ring halves, corner.\n if (da1 > EPSILON && rc1 > EPSILON) {\n const t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw)\n const t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw)\n move(t0.cx + t0.x01, t0.cy + t0.y01)\n if (rc1 < rc) {\n // Corners merged: one corner arc covers the edge, the rest is empty.\n const ex = t1.cx + t1.x01\n const ey = t1.cy + t1.y01\n arc(rc1, outerSweep, ex, ey)\n arc(r1, outerSweep, ex, ey)\n arc(r1, outerSweep, ex, ey)\n arc(rc1, outerSweep, ex, ey)\n } else {\n arc(rc1, outerSweep, t0.cx + t0.x11, t0.cy + t0.y11)\n ring(\n r1,\n angleOf(t0.cx + t0.x11, t0.cy + t0.y11),\n angleOf(t1.cx + t1.x11, t1.cy + t1.y11),\n !cw,\n )\n arc(rc1, outerSweep, t1.cx + t1.x01, t1.cy + t1.y01)\n }\n } else {\n move(x01, y01)\n arc(r1, outerSweep, x01, y01)\n if (da1 > EPSILON) ring(r1, a01, a11, !cw)\n else for (let i = 0; i < 2; i++) arc(r1, outerSweep, x01, y01)\n arc(r1, outerSweep, x11, y11)\n }\n\n // Inner edge (or the center of a pie slice): corner, two ring halves, corner.\n if (!(r0 > EPSILON) || !(da0 > EPSILON)) {\n line(x10, y10)\n for (let i = 0; i < 4; i++) arc(r0, outerSweep, x10, y10)\n } else if (rc0 > EPSILON) {\n const t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw)\n const t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw)\n line(t0.cx + t0.x01, t0.cy + t0.y01)\n if (rc0 < rc) {\n const ex = t1.cx + t1.x01\n const ey = t1.cy + t1.y01\n arc(rc0, outerSweep, ex, ey)\n arc(r0, outerSweep, ex, ey)\n arc(r0, outerSweep, ex, ey)\n arc(rc0, outerSweep, ex, ey)\n } else {\n arc(rc0, outerSweep, t0.cx + t0.x11, t0.cy + t0.y11)\n ring(r0, angleOf(t0.cx + t0.x11, t0.cy + t0.y11), angleOf(t1.cx + t1.x11, t1.cy + t1.y11), cw)\n arc(rc0, outerSweep, t1.cx + t1.x01, t1.cy + t1.y01)\n }\n } else {\n line(x10, y10)\n arc(r0, outerSweep, x10, y10)\n ring(r0, a10, a00, cw)\n arc(r0, outerSweep, x00, y00)\n }\n return `${d}Z`\n}\n"],"mappings":";;;;;;;;AAQA,MAAM,UAAU;AAChB,MAAM,KAAK,KAAK;AAChB,MAAM,UAAU,KAAK;AACrB,MAAM,MAAM,IAAI;;AAGhB,MAAa,MAAc,KAAK,KAAK;AAMrC,MAAM,QAAQ,MAAuB,KAAK,IAAI,UAAU,KAAK,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC;AACxF,MAAM,QAAQ,MAAuB,IAAI,IAAI,IAAI,IAAI,KAAK,KAAK,KAAK,KAAK,CAAC;AAwF1E,SAAS,UACP,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IAC8B;CAC9B,MAAM,MAAM,KAAK;CACjB,MAAM,MAAM,KAAK;CACjB,MAAM,MAAM,KAAK;CACjB,MAAM,MAAM,KAAK;CACjB,IAAI,IAAI,MAAM,MAAM,MAAM;CAC1B,IAAI,IAAI,IAAI,SAAS,OAAO,KAAA;CAC5B,KAAK,OAAO,KAAK,MAAM,OAAO,KAAK,OAAO;CAC1C,OAA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,IAAI,CAAC,KAAK,EAAE;EAC1D,MAAM,KAAK,eAAe,KAAK,KAAK,KAAK,KAAK,IAAI,CAAC,KAAK,EAAE;EAC1D,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,GAAG;EACnC,IAAI,MAAM,IAAI;GACZ,MAAM,KAAK,GAAG,KAAK,GAAG;GACtB,MAAM,KAAK,GAAG,KAAK,GAAG;GACtB,IAAI,KAAK,YAAY,IAAI,EAAE;GAC3B,IAAI,IAAI,YAAY,IAAI,EAAE;GAC1B,IAAI,IAAI,YAAY,IAAI,EAAE;GAC1B,IAAI,KAAK,YAAY,IAAI,EAAE;EAC7B,OAAO;GACL,IAAI,KAAK,YAAY,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,GAAG;GACnD,KAAK,IAAI,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,GAAG,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,GAAG,GAAG,EAAE;GAC7F,IAAI,KAAK,YAAY,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,GAAG;EACrD;CACF,OAAO;EACL,KAAK,KAAK,GAAG;EACb,IAAI,IAAI,YAAY,KAAK,GAAG;EAC5B,KAAK,IAAI,KAAK,KAAK,EAAE;EACrB,IAAI,IAAI,YAAY,KAAK,GAAG;CAC9B;CACA,OAAO,GAAG,EAAE;AACd"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as ChartType } from "./chart-
|
|
2
|
-
import { t as LineOptions } from "./line-
|
|
1
|
+
import { a as ChartType } from "./chart-DyN7bcx8.js";
|
|
2
|
+
import { t as LineOptions } from "./line-CN4uZ9ZX.js";
|
|
3
3
|
//#region src/charts/area.d.ts
|
|
4
4
|
/** Options of the area chart: line options with the fill always on. */
|
|
5
5
|
type AreaOptions = Omit<LineOptions, "area">;
|
|
@@ -17,4 +17,4 @@ type AreaOptions = Omit<LineOptions, "area">;
|
|
|
17
17
|
declare const area: ChartType<AreaOptions>;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { area as n, AreaOptions as t };
|
|
20
|
-
//# sourceMappingURL=area-
|
|
20
|
+
//# sourceMappingURL=area-CF__HOwL.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as ChartType } from "./chart-
|
|
2
|
-
import { t as LineOptions } from "./line-
|
|
1
|
+
import { a as ChartType } from "./chart-D7ooEFnk.cjs";
|
|
2
|
+
import { t as LineOptions } from "./line-W7VD_qs1.cjs";
|
|
3
3
|
//#region src/charts/area.d.ts
|
|
4
4
|
/** Options of the area chart: line options with the fill always on. */
|
|
5
5
|
type AreaOptions = Omit<LineOptions, "area">;
|
|
@@ -17,4 +17,4 @@ type AreaOptions = Omit<LineOptions, "area">;
|
|
|
17
17
|
declare const area: ChartType<AreaOptions>;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { area as n, AreaOptions as t };
|
|
20
|
-
//# sourceMappingURL=area-
|
|
20
|
+
//# sourceMappingURL=area-DIxaAbYZ.d.cts.map
|
package/dist/area.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as area, t as AreaOptions } from "./area-
|
|
1
|
+
import { n as area, t as AreaOptions } from "./area-DIxaAbYZ.cjs";
|
|
2
2
|
export { type AreaOptions, area };
|
package/dist/area.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as area, t as AreaOptions } from "./area-
|
|
1
|
+
import { n as area, t as AreaOptions } from "./area-CF__HOwL.js";
|
|
2
2
|
export { type AreaOptions, area };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as CartesianOptions, a as ChartType } from "./chart-
|
|
1
|
+
import { $ as CartesianOptions, a as ChartType } from "./chart-DyN7bcx8.js";
|
|
2
2
|
import { t as Curve } from "./path-CwB28da0.js";
|
|
3
3
|
import { t as StackMode } from "./stack-CpR6RGKd.js";
|
|
4
4
|
//#region src/charts/bar.d.ts
|
|
@@ -40,4 +40,4 @@ interface BarOptions extends CartesianOptions {
|
|
|
40
40
|
declare const bar: ChartType<BarOptions>;
|
|
41
41
|
//#endregion
|
|
42
42
|
export { bar as n, BarOptions as t };
|
|
43
|
-
//# sourceMappingURL=bar-
|
|
43
|
+
//# sourceMappingURL=bar-BBM8RhoL.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as CartesianOptions, a as ChartType } from "./chart-
|
|
1
|
+
import { $ as CartesianOptions, a as ChartType } from "./chart-D7ooEFnk.cjs";
|
|
2
2
|
import { t as Curve } from "./path-CwB28da0.cjs";
|
|
3
3
|
import { t as StackMode } from "./stack-CpR6RGKd.cjs";
|
|
4
4
|
//#region src/charts/bar.d.ts
|
|
@@ -40,4 +40,4 @@ interface BarOptions extends CartesianOptions {
|
|
|
40
40
|
declare const bar: ChartType<BarOptions>;
|
|
41
41
|
//#endregion
|
|
42
42
|
export { bar as n, BarOptions as t };
|
|
43
|
-
//# sourceMappingURL=bar-
|
|
43
|
+
//# sourceMappingURL=bar-CRKLDg98.d.cts.map
|
package/dist/bar.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as bar, t as BarOptions } from "./bar-
|
|
1
|
+
import { n as bar, t as BarOptions } from "./bar-CRKLDg98.cjs";
|
|
2
2
|
export { type BarOptions, bar };
|
package/dist/bar.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as bar, t as BarOptions } from "./bar-
|
|
1
|
+
import { n as bar, t as BarOptions } from "./bar-BBM8RhoL.js";
|
|
2
2
|
export { type BarOptions, bar };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as InsetsInput, t as Annotation } from "./annotations-Bp7HwtF5.js";
|
|
2
|
-
import { a as ChartType, et as CategoryAxisOptions, rt as ValueAxisOptions, tt as Label } from "./chart-
|
|
2
|
+
import { a as ChartType, et as CategoryAxisOptions, rt as ValueAxisOptions, tt as Label } from "./chart-DyN7bcx8.js";
|
|
3
3
|
//#region src/charts/candlestick.d.ts
|
|
4
4
|
/** One period: where the price opened, its range and where it closed. */
|
|
5
5
|
interface Candle {
|
|
@@ -41,4 +41,4 @@ interface CandlestickOptions {
|
|
|
41
41
|
declare const candlestick: ChartType<CandlestickOptions>;
|
|
42
42
|
//#endregion
|
|
43
43
|
export { CandlestickOptions as n, candlestick as r, Candle as t };
|
|
44
|
-
//# sourceMappingURL=candlestick-
|
|
44
|
+
//# sourceMappingURL=candlestick-D_vV0_XZ.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as InsetsInput, t as Annotation } from "./annotations-lyt0I3HU.cjs";
|
|
2
|
-
import { a as ChartType, et as CategoryAxisOptions, rt as ValueAxisOptions, tt as Label } from "./chart-
|
|
2
|
+
import { a as ChartType, et as CategoryAxisOptions, rt as ValueAxisOptions, tt as Label } from "./chart-D7ooEFnk.cjs";
|
|
3
3
|
//#region src/charts/candlestick.d.ts
|
|
4
4
|
/** One period: where the price opened, its range and where it closed. */
|
|
5
5
|
interface Candle {
|
|
@@ -41,4 +41,4 @@ interface CandlestickOptions {
|
|
|
41
41
|
declare const candlestick: ChartType<CandlestickOptions>;
|
|
42
42
|
//#endregion
|
|
43
43
|
export { CandlestickOptions as n, candlestick as r, Candle as t };
|
|
44
|
-
//# sourceMappingURL=candlestick-
|
|
44
|
+
//# sourceMappingURL=candlestick-__pXl_pV.d.cts.map
|
package/dist/candlestick.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as CandlestickOptions, r as candlestick, t as Candle } from "./candlestick-
|
|
1
|
+
import { n as CandlestickOptions, r as candlestick, t as Candle } from "./candlestick-__pXl_pV.cjs";
|
|
2
2
|
export { type Candle, type CandlestickOptions, candlestick };
|
package/dist/candlestick.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as CandlestickOptions, r as candlestick, t as Candle } from "./candlestick-
|
|
1
|
+
import { n as CandlestickOptions, r as candlestick, t as Candle } from "./candlestick-D_vV0_XZ.js";
|
|
2
2
|
export { type Candle, type CandlestickOptions, candlestick };
|
|
@@ -584,6 +584,12 @@ declare function hitAnchor(hit: Hit, pointer?: {
|
|
|
584
584
|
y: number;
|
|
585
585
|
};
|
|
586
586
|
interface TooltipOptions {
|
|
587
|
+
/**
|
|
588
|
+
* Colors of the tooltip: `'dark'` (the default) is a dark box with light
|
|
589
|
+
* text, `'light'` a white one with dark text. Both keep their colors in
|
|
590
|
+
* dark mode; the `--tc-tooltip-*` tokens tune them.
|
|
591
|
+
*/
|
|
592
|
+
theme?: "dark" | "light";
|
|
587
593
|
/**
|
|
588
594
|
* Custom content for a hit: VNodes built with `h()` or plain text.
|
|
589
595
|
* Rendered safely (no HTML parsing), inside `.tc-tooltip`.
|
|
@@ -924,4 +930,4 @@ declare class Chart<O extends object = object> {
|
|
|
924
930
|
}
|
|
925
931
|
//#endregion
|
|
926
932
|
export { CartesianOptions as $, labelsStep as A, downloadChart as B, DownloadOption as C, HitTester as Ct, ChartPlugin as D, BeforeRenderState as E, register as F, patternDefs as G, exportSVG as H, DownloadOptions as I, LegendItem as J, patternFills as K, ExportOptions as L, Features as M, feature as N, PluginInstance as O, features as P, CartesianData as Q, ExportTarget as R, DownloadMenuOptions as S, HitItem as St, AfterRenderState as T, markerPath as U, exportImage as V, shapesStep as W, defaultHidden as X, LegendOptions as Y, legendContent as Z, TooltipPlacement as _, thinTicks as _t, ChartType as a, domainOf as at, tooltipContent as b, tableContent as bt, Size as c, seriesTable as ct, chartLabel as d, LinearTicksOptions as dt, CategoryAxisOptions as et, chartToString as f, Tick as ft, TooltipOptions as g, linearTicks as gt, resolveSize as h, bandTicks as ht, ChartEvents as i, categoryInteraction as it, valueLabels as j, ValueLabelOptions as k, buildChart as l, AxisOptions as lt, resolveLegend as m, axisSize as mt, Chart as n, Series as nt, RenderContext as o, seriesKey as ot, renderContext as p, axis as pt, patternVars as q, ChartConfig as r, ValueAxisOptions as rt, ResolvedLegend as s, seriesLegend as st, BaseOptions as t, Label as tt, chartEvents as u, AxisPosition as ut, hitAnchor as v, DataTable as vt, download as w, Interaction as wt, DownloadFormat as x, Hit as xt, placeTooltip as y, describeHit as yt, ImageOptions as z };
|
|
927
|
-
//# sourceMappingURL=chart-
|
|
933
|
+
//# sourceMappingURL=chart-D7ooEFnk.d.cts.map
|
|
@@ -584,6 +584,12 @@ declare function hitAnchor(hit: Hit, pointer?: {
|
|
|
584
584
|
y: number;
|
|
585
585
|
};
|
|
586
586
|
interface TooltipOptions {
|
|
587
|
+
/**
|
|
588
|
+
* Colors of the tooltip: `'dark'` (the default) is a dark box with light
|
|
589
|
+
* text, `'light'` a white one with dark text. Both keep their colors in
|
|
590
|
+
* dark mode; the `--tc-tooltip-*` tokens tune them.
|
|
591
|
+
*/
|
|
592
|
+
theme?: "dark" | "light";
|
|
587
593
|
/**
|
|
588
594
|
* Custom content for a hit: VNodes built with `h()` or plain text.
|
|
589
595
|
* Rendered safely (no HTML parsing), inside `.tc-tooltip`.
|
|
@@ -924,4 +930,4 @@ declare class Chart<O extends object = object> {
|
|
|
924
930
|
}
|
|
925
931
|
//#endregion
|
|
926
932
|
export { CartesianOptions as $, labelsStep as A, downloadChart as B, DownloadOption as C, HitTester as Ct, ChartPlugin as D, BeforeRenderState as E, register as F, patternDefs as G, exportSVG as H, DownloadOptions as I, LegendItem as J, patternFills as K, ExportOptions as L, Features as M, feature as N, PluginInstance as O, features as P, CartesianData as Q, ExportTarget as R, DownloadMenuOptions as S, HitItem as St, AfterRenderState as T, markerPath as U, exportImage as V, shapesStep as W, defaultHidden as X, LegendOptions as Y, legendContent as Z, TooltipPlacement as _, thinTicks as _t, ChartType as a, domainOf as at, tooltipContent as b, tableContent as bt, Size as c, seriesTable as ct, chartLabel as d, LinearTicksOptions as dt, CategoryAxisOptions as et, chartToString as f, Tick as ft, TooltipOptions as g, linearTicks as gt, resolveSize as h, bandTicks as ht, ChartEvents as i, categoryInteraction as it, valueLabels as j, ValueLabelOptions as k, buildChart as l, AxisOptions as lt, resolveLegend as m, axisSize as mt, Chart as n, Series as nt, RenderContext as o, seriesKey as ot, renderContext as p, axis as pt, patternVars as q, ChartConfig as r, ValueAxisOptions as rt, ResolvedLegend as s, seriesLegend as st, BaseOptions as t, Label as tt, chartEvents as u, AxisPosition as ut, hitAnchor as v, DataTable as vt, download as w, Interaction as wt, DownloadFormat as x, Hit as xt, placeTooltip as y, describeHit as yt, ImageOptions as z };
|
|
927
|
-
//# sourceMappingURL=chart-
|
|
933
|
+
//# sourceMappingURL=chart-DyN7bcx8.d.ts.map
|
|
@@ -228,14 +228,20 @@ function listenPointer(chart) {
|
|
|
228
228
|
const { width, height } = chart.size;
|
|
229
229
|
return toChartPoint(svg, event.clientX, event.clientY, width, height);
|
|
230
230
|
};
|
|
231
|
+
const overControl = (event) => !!event.target?.closest?.(".tc-download");
|
|
232
|
+
const onLeave = (event) => {
|
|
233
|
+
if (event.pointerType !== "touch" && chart.highlightSource === "pointer") chart.clearHighlight(event);
|
|
234
|
+
};
|
|
231
235
|
const onMove = (event) => {
|
|
236
|
+
if (overControl(event)) {
|
|
237
|
+
onLeave(event);
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
232
240
|
const point = local(event);
|
|
233
241
|
if (point) chart.highlightAt(point.x, point.y, event);
|
|
234
242
|
};
|
|
235
|
-
const onLeave = (event) => {
|
|
236
|
-
if (event.pointerType !== "touch" && chart.highlightSource === "pointer") chart.clearHighlight(event);
|
|
237
|
-
};
|
|
238
243
|
const onClick = (event) => {
|
|
244
|
+
if (overControl(event)) return;
|
|
239
245
|
const point = local(event);
|
|
240
246
|
const hit = point ? chart.hitTest(point.x, point.y) : null;
|
|
241
247
|
if (hit) chart.emit("click", {
|
|
@@ -767,7 +773,8 @@ function placeAll() {
|
|
|
767
773
|
}
|
|
768
774
|
/**
|
|
769
775
|
* An HTML tooltip (`.tc-tooltip`) for the highlighted category, placed next
|
|
770
|
-
* to it inside the chart element. Configure it with the `tooltip` option
|
|
776
|
+
* to it inside the chart element. Configure it with the `tooltip` option;
|
|
777
|
+
* `theme: 'light'` adds `.tc-tooltip-light` for the white variant.
|
|
771
778
|
*/
|
|
772
779
|
function tooltip() {
|
|
773
780
|
return {
|
|
@@ -796,7 +803,9 @@ function tooltip() {
|
|
|
796
803
|
tip.setAttribute("aria-hidden", "true");
|
|
797
804
|
el.appendChild(tip);
|
|
798
805
|
}
|
|
799
|
-
|
|
806
|
+
const options = typeof option === "object" ? option : void 0;
|
|
807
|
+
tip.classList.toggle("tc-tooltip-light", options?.theme === "light");
|
|
808
|
+
render(tip, tooltipContent(hit, options));
|
|
800
809
|
const shown = tip;
|
|
801
810
|
const turn = ++turns;
|
|
802
811
|
waiting.push(() => {
|
|
@@ -868,8 +877,8 @@ function defaultPlugins() {
|
|
|
868
877
|
//#endregion
|
|
869
878
|
//#region src/core.ts
|
|
870
879
|
/** Version of the `@tabler/charts` package. */
|
|
871
|
-
const VERSION = "0.
|
|
880
|
+
const VERSION = "0.1.0";
|
|
872
881
|
//#endregion
|
|
873
882
|
export { download as _, placeTooltip as a, sync as c, describeHit as d, tableContent as f, hoverUnderlay as g, hoverOverlay as h, hitAnchor as i, legend as l, pointer as m, defaultPlugins as n, tooltipContent as o, highlight as p, tooltip as r, dataTable as s, VERSION as t, keyboard as u };
|
|
874
883
|
|
|
875
|
-
//# sourceMappingURL=core-
|
|
884
|
+
//# sourceMappingURL=core-CegR_j55.js.map
|