@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.
Files changed (107) hide show
  1. package/README.md +14 -4
  2. package/dist/{sweep-WSgn2etB.js → arc-BXpLrt9b.cjs} +25 -58
  3. package/dist/arc-BXpLrt9b.cjs.map +1 -0
  4. package/dist/{sweep-Duowaput.cjs → arc-a1tRTEw7.js} +2 -93
  5. package/dist/arc-a1tRTEw7.js.map +1 -0
  6. package/dist/{area-DaO4MQl4.d.ts → area-CF__HOwL.d.ts} +3 -3
  7. package/dist/{area-BFvkc-ZM.d.cts → area-DIxaAbYZ.d.cts} +3 -3
  8. package/dist/area.d.cts +1 -1
  9. package/dist/area.d.ts +1 -1
  10. package/dist/{bar-DdsDxk3W.d.ts → bar-BBM8RhoL.d.ts} +2 -2
  11. package/dist/{bar-a0h9KC8A.d.cts → bar-CRKLDg98.d.cts} +2 -2
  12. package/dist/bar.d.cts +1 -1
  13. package/dist/bar.d.ts +1 -1
  14. package/dist/{candlestick-BnUG1SGi.d.ts → candlestick-D_vV0_XZ.d.ts} +2 -2
  15. package/dist/{candlestick-BKdPyorY.d.cts → candlestick-__pXl_pV.d.cts} +2 -2
  16. package/dist/candlestick.d.cts +1 -1
  17. package/dist/candlestick.d.ts +1 -1
  18. package/dist/{chart-Qa417fJo.d.cts → chart-D7ooEFnk.d.cts} +7 -1
  19. package/dist/{chart-iJGxMz9z.d.ts → chart-DyN7bcx8.d.ts} +7 -1
  20. package/dist/{core-plobgBC7.js → core-CegR_j55.js} +16 -7
  21. package/dist/core-CegR_j55.js.map +1 -0
  22. package/dist/{core-CnGFKojH.d.cts → core-D1vO1LrC.d.cts} +4 -3
  23. package/dist/{core-CjgbhS_v.d.ts → core-DcbemzGf.d.ts} +4 -3
  24. package/dist/{core-C7fPm6t7.cjs → core-RzS9IQO5.cjs} +16 -7
  25. package/dist/core-RzS9IQO5.cjs.map +1 -0
  26. package/dist/core.cjs +9 -7
  27. package/dist/core.d.cts +15 -14
  28. package/dist/core.d.ts +15 -14
  29. package/dist/core.js +6 -5
  30. package/dist/export.d.cts +1 -1
  31. package/dist/export.d.ts +1 -1
  32. package/dist/{gauge-CEfkWXSu.cjs → gauge-D-FYhuds.cjs} +7 -6
  33. package/dist/{gauge-CEfkWXSu.cjs.map → gauge-D-FYhuds.cjs.map} +1 -1
  34. package/dist/{gauge-Cu_OFxBd.d.cts → gauge-DP_EB2z3.d.cts} +2 -2
  35. package/dist/{gauge-_ljQHrMN.js → gauge-Dh423FHh.js} +3 -2
  36. package/dist/{gauge-_ljQHrMN.js.map → gauge-Dh423FHh.js.map} +1 -1
  37. package/dist/{gauge-Cu9jttC0.d.ts → gauge-zpia05t2.d.ts} +2 -2
  38. package/dist/gauge.cjs +1 -1
  39. package/dist/gauge.d.cts +1 -1
  40. package/dist/gauge.d.ts +1 -1
  41. package/dist/gauge.js +1 -1
  42. package/dist/{heatmap-PhLPXIg1.d.ts → heatmap-BectCEeE.d.ts} +2 -2
  43. package/dist/{heatmap-BwS-y0c6.d.cts → heatmap-CCso6m61.d.cts} +2 -2
  44. package/dist/heatmap.d.cts +1 -1
  45. package/dist/heatmap.d.ts +1 -1
  46. package/dist/index.cjs +11 -8
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.d.cts +15 -14
  49. package/dist/index.d.ts +15 -14
  50. package/dist/index.js +8 -6
  51. package/dist/index.js.map +1 -1
  52. package/dist/{line-D5kb8e6w.d.ts → line-CN4uZ9ZX.d.ts} +2 -2
  53. package/dist/{line-CMDGH6q5.d.cts → line-W7VD_qs1.d.cts} +2 -2
  54. package/dist/line.d.cts +1 -1
  55. package/dist/line.d.ts +1 -1
  56. package/dist/parliament-1Zv2Xh0D.d.ts +69 -0
  57. package/dist/parliament-CpWnoEvG.cjs +308 -0
  58. package/dist/parliament-CpWnoEvG.cjs.map +1 -0
  59. package/dist/parliament-DdrLVZwt.d.cts +69 -0
  60. package/dist/parliament-Dw0sOERi.js +303 -0
  61. package/dist/parliament-Dw0sOERi.js.map +1 -0
  62. package/dist/parliament.cjs +3 -0
  63. package/dist/parliament.d.cts +2 -0
  64. package/dist/parliament.d.ts +2 -0
  65. package/dist/parliament.js +2 -0
  66. package/dist/patterns.d.cts +1 -1
  67. package/dist/patterns.d.ts +1 -1
  68. package/dist/{pie-B8UlOZiq.d.ts → pie-5z1fDdKO.d.ts} +2 -2
  69. package/dist/{pie-DnQQmxkk.d.cts → pie-BF9yI5mE.d.cts} +2 -2
  70. package/dist/{pie-C1Pa6W_l.cjs → pie-BxTZt6Go.cjs} +9 -8
  71. package/dist/{pie-C1Pa6W_l.cjs.map → pie-BxTZt6Go.cjs.map} +1 -1
  72. package/dist/{pie-RnMTQWMS.js → pie-DzUXDTcn.js} +3 -2
  73. package/dist/{pie-RnMTQWMS.js.map → pie-DzUXDTcn.js.map} +1 -1
  74. package/dist/pie.cjs +1 -1
  75. package/dist/pie.d.cts +1 -1
  76. package/dist/pie.d.ts +1 -1
  77. package/dist/pie.js +1 -1
  78. package/dist/point-shapes.d.cts +1 -1
  79. package/dist/point-shapes.d.ts +1 -1
  80. package/dist/{radar-pFI6fvOq.d.ts → radar-1-EryihA.d.ts} +2 -2
  81. package/dist/{radar-BB13CGmq.d.cts → radar-DBW4O0Vt.d.cts} +2 -2
  82. package/dist/radar.d.cts +1 -1
  83. package/dist/radar.d.ts +1 -1
  84. package/dist/{sankey-B9JYnx7e.d.cts → sankey-DuGI3Qc5.d.cts} +2 -2
  85. package/dist/{sankey-Bm518bqL.d.ts → sankey-OV_WoPrl.d.ts} +2 -2
  86. package/dist/sankey.d.cts +1 -1
  87. package/dist/sankey.d.ts +1 -1
  88. package/dist/{scatter-Bl7nasE6.d.ts → scatter-BqzgJqdX.d.ts} +2 -2
  89. package/dist/{scatter-DrJ8xYz4.d.cts → scatter-DbxLyZX0.d.cts} +2 -2
  90. package/dist/scatter.d.cts +1 -1
  91. package/dist/scatter.d.ts +1 -1
  92. package/dist/{sparkline-iWuXbKpd.d.ts → sparkline-BfyO_oNM.d.ts} +2 -2
  93. package/dist/{sparkline-BG13V4Pz.d.cts → sparkline-CWlJDKyh.d.cts} +2 -2
  94. package/dist/sparkline.d.cts +1 -1
  95. package/dist/sparkline.d.ts +1 -1
  96. package/dist/style.css +1 -1
  97. package/dist/sweep-CbfR7--d.js +60 -0
  98. package/dist/sweep-CbfR7--d.js.map +1 -0
  99. package/dist/sweep-DaTEDDuC.cjs +71 -0
  100. package/dist/sweep-DaTEDDuC.cjs.map +1 -0
  101. package/dist/value-labels.d.cts +1 -1
  102. package/dist/value-labels.d.ts +1 -1
  103. package/package.json +11 -1
  104. package/dist/core-C7fPm6t7.cjs.map +0 -1
  105. package/dist/core-plobgBC7.js.map +0 -1
  106. package/dist/sweep-Duowaput.cjs.map +0 -1
  107. package/dist/sweep-WSgn2etB.js.map +0 -1
package/dist/core.js CHANGED
@@ -7,18 +7,19 @@ import { t as extent } from "./extent-BAMZo0Nq.js";
7
7
  import { _ as defaultHidden, a as chartToString, c as resolveSize, g as renderToString, h as escapeText, i as chartLabel, l as cancel, m as escapeAttr, n as buildChart, o as renderContext, p as schedule, r as chartEvents, s as resolveLegend, t as Chart, u as flush, v as legendContent } from "./chart-BF2CK9I_.js";
8
8
  import { a as render } from "./dom-vP3IcMak.js";
9
9
  import { n as areaPath, r as linePath } from "./fade-D3NxH5Qg.js";
10
- import { _ as download, a as placeTooltip, c as sync, d as describeHit, f as tableContent, g as hoverUnderlay, h as hoverOverlay, i as hitAnchor, l as legend, m as pointer, n as defaultPlugins, o as tooltipContent, p as highlight, r as tooltip, s as dataTable, t as VERSION, u as keyboard } from "./core-plobgBC7.js";
10
+ import { _ as download, a as placeTooltip, c as sync, d as describeHit, f as tableContent, g as hoverUnderlay, h as hoverOverlay, i as hitAnchor, l as legend, m as pointer, n as defaultPlugins, o as tooltipContent, p as highlight, r as tooltip, s as dataTable, t as VERSION, u as keyboard } from "./core-CegR_j55.js";
11
11
  import { t as line } from "./line-B3Ed6u7j.js";
12
12
  import { t as area } from "./area-DQsLERhx.js";
13
13
  import { n as hbarPath, t as barPath } from "./bar-DM16NUvV.js";
14
14
  import { t as bar } from "./bar-jZEoao74.js";
15
15
  import { t as candlestick } from "./candlestick-DuXwAFID.js";
16
- import { a as arcPathStable, i as arcCentroid, o as padAngleForGap } from "./sweep-WSgn2etB.js";
17
- import { t as gauge } from "./gauge-_ljQHrMN.js";
16
+ import { i as padAngleForGap, n as arcCentroid, r as arcPathStable } from "./arc-a1tRTEw7.js";
17
+ import { t as gauge } from "./gauge-Dh423FHh.js";
18
18
  import { t as heatmap } from "./heatmap-DSZ2bVIa.js";
19
- import { n as pie, t as donut } from "./pie-RnMTQWMS.js";
19
+ import { t as parliament } from "./parliament-Dw0sOERi.js";
20
+ import { n as pie, t as donut } from "./pie-DzUXDTcn.js";
20
21
  import { t as radar } from "./radar-CYPab_I4.js";
21
22
  import { t as sankey } from "./sankey-B4PNKusJ.js";
22
23
  import { t as scatter } from "./scatter-kgtgR318.js";
23
24
  import { t as sparkline } from "./sparkline-BQzt27Fr.js";
24
- export { Chart, LINE_HEIGHT, VERSION, arcCentroid, arcPathStable, area, areaPath, axis, axisSize, band, bandTicks, bar, barPath, buildChart, cancel, candlestick, categoryInteraction, chartEvents, chartLabel, chartToString, dataTable, defaultHidden, defaultPlugins, describeHit, domainOf, donut, download, escapeAttr, escapeText, estimateTextWidth, extent, feature, features, flush, formatDate, formatDetail, formatNumber, formatTicks, gauge, getDateFormat, getNumberFormat, grid, h, hbarPath, heatmap, highlight, hitAnchor, hoverOverlay, hoverUnderlay, innerRect, insets, keyboard, legend, legendContent, line, linePath, linear, linearTicks, niceDomain, normalizeClass, normalizeStyle, padAngleForGap, pie, placeTooltip, point, pointer, radar, register, render, renderContext, renderToString, resolveLegend, resolveSize, sankey, scatter, schedule, seriesKey, seriesLegend, seriesTable, sparkline, stepPrecision, sync, tableContent, thinTicks, tickIncrement, tickStep, ticks, tooltip, tooltipContent };
25
+ export { Chart, LINE_HEIGHT, VERSION, arcCentroid, arcPathStable, area, areaPath, axis, axisSize, band, bandTicks, bar, barPath, buildChart, cancel, candlestick, categoryInteraction, chartEvents, chartLabel, chartToString, dataTable, defaultHidden, defaultPlugins, describeHit, domainOf, donut, download, escapeAttr, escapeText, estimateTextWidth, extent, feature, features, flush, formatDate, formatDetail, formatNumber, formatTicks, gauge, getDateFormat, getNumberFormat, grid, h, hbarPath, heatmap, highlight, hitAnchor, hoverOverlay, hoverUnderlay, innerRect, insets, keyboard, legend, legendContent, line, linePath, linear, linearTicks, niceDomain, normalizeClass, normalizeStyle, padAngleForGap, parliament, pie, placeTooltip, point, pointer, radar, register, render, renderContext, renderToString, resolveLegend, resolveSize, sankey, scatter, schedule, seriesKey, seriesLegend, seriesTable, sparkline, stepPrecision, sync, tableContent, thinTicks, tickIncrement, tickStep, ticks, tooltip, tooltipContent };
package/dist/export.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { B as downloadChart, H as exportSVG, I as DownloadOptions, L as ExportOptions, R as ExportTarget, V as exportImage, z as ImageOptions } from "./chart-Qa417fJo.cjs";
1
+ import { B as downloadChart, H as exportSVG, I as DownloadOptions, L as ExportOptions, R as ExportTarget, V as exportImage, z as ImageOptions } from "./chart-D7ooEFnk.cjs";
2
2
  export { type DownloadOptions, type ExportOptions, type ExportTarget, type ImageOptions, downloadChart, exportImage, exportSVG };
package/dist/export.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { B as downloadChart, H as exportSVG, I as DownloadOptions, L as ExportOptions, R as ExportTarget, V as exportImage, z as ImageOptions } from "./chart-iJGxMz9z.js";
1
+ import { B as downloadChart, H as exportSVG, I as DownloadOptions, L as ExportOptions, R as ExportTarget, V as exportImage, z as ImageOptions } from "./chart-DyN7bcx8.js";
2
2
  export { type DownloadOptions, type ExportOptions, type ExportTarget, type ImageOptions, downloadChart, exportImage, exportSVG };
@@ -4,7 +4,8 @@ const require_format = require("./format-B0yKXBTH.cjs");
4
4
  const require_features = require("./features-BclHgg2W.cjs");
5
5
  const require_clean = require("./clean-Byl6kzf0.cjs");
6
6
  const require_named = require("./named-BWWb5LQJ.cjs");
7
- const require_sweep = require("./sweep-Duowaput.cjs");
7
+ const require_arc = require("./arc-BXpLrt9b.cjs");
8
+ const require_sweep = require("./sweep-DaTEDDuC.cjs");
8
9
  //#region src/charts/gauge.ts
9
10
  /** Space kept around the gauge for the hover halo. */
10
11
  const HALF_PI = Math.PI / 2;
@@ -84,8 +85,8 @@ function renderGauge(options, ctx) {
84
85
  bottom: pad.bottom + 8,
85
86
  left: pad.left + 8
86
87
  });
87
- const start = (options.startAngle ?? 0) * require_sweep.DEG;
88
- const sweep = Math.min(360, Math.max(0, options.angle ?? 360)) * require_sweep.DEG;
88
+ const start = (options.startAngle ?? 0) * require_arc.DEG;
89
+ const sweep = Math.min(360, Math.max(0, options.angle ?? 360)) * require_arc.DEG;
89
90
  const rings = layoutRings(options, ctx.hidden);
90
91
  const center = options.center;
91
92
  const first = rings[0];
@@ -112,7 +113,7 @@ function renderGauge(options, ctx) {
112
113
  cornerRadius
113
114
  });
114
115
  const hitFor = (ring) => {
115
- const [x, y] = require_sweep.arcCentroid(geometry(ring));
116
+ const [x, y] = require_arc.arcCentroid(geometry(ring));
116
117
  const item = {
117
118
  name: ring.data.name,
118
119
  seriesIndex: ring.index,
@@ -136,7 +137,7 @@ function renderGauge(options, ctx) {
136
137
  items: [item],
137
138
  seriesIndex: ring.index,
138
139
  mark: {
139
- d: require_sweep.arcPathStable(geometry(ring, 2)),
140
+ d: require_arc.arcPathStable(geometry(ring, 2)),
140
141
  x: cx,
141
142
  y: cy
142
143
  }
@@ -232,4 +233,4 @@ Object.defineProperty(exports, "gauge", {
232
233
  }
233
234
  });
234
235
 
235
- //# sourceMappingURL=gauge-CEfkWXSu.cjs.map
236
+ //# sourceMappingURL=gauge-D-FYhuds.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"gauge-CEfkWXSu.cjs","names":["keyOf","insets","innerRect","DEG","formatNumber","getNumberFormat","arcCentroid","arcPathStable","h","groupAttrs","arcNode","cleanData","cleanItems","isRecord","sweepArcs","legendItems"],"sources":["../src/charts/gauge.ts"],"sourcesContent":["import type { DataTable } from '../a11y.ts'\nimport type { ChartType, RenderContext } from '../chart.ts'\nimport { features } from '../features.ts'\nimport { formatNumber, getNumberFormat, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { type InsetsInput, innerRect, insets } from '../layout.ts'\nimport { arcNode, sweep as sweepArcs } from '../render/sweep.ts'\nimport { arcCentroid, arcPathStable, DEG, HALO } from '../shapes/arc.ts'\nimport { type ChildInput, type ClassValue, h } from '../vnode.ts'\nimport { cleanData, cleanItems, isRecord } from './clean.ts'\nimport { groupAttrs, keyOf, legendItems } from './named.ts'\n\n/** One ring of a gauge. */\nexport interface GaugeRing {\n name: string\n /** Current value, clamped to `0…max`. */\n value: number\n /** Full-ring value of this ring; overrides `GaugeOptions.max`. */\n max?: number\n /** Stable identity for keyed updates and legend toggles. Defaults to `name`. */\n id?: string\n /**\n * Custom color; overrides the palette slot via `--tc-series-color`.\n * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.\n */\n color?: string\n /** Extra classes on the ring group. */\n class?: ClassValue\n /** Start hidden (toggle it back from the legend). */\n hidden?: boolean\n}\n\nexport interface GaugeOptions {\n /** A single value, one ring, or concentric rings (outermost first). */\n data: number | GaugeRing | readonly GaugeRing[]\n /** Full-ring value. Defaults to `100`. */\n max?: number\n /** Where the arc starts, in degrees clockwise from 12 o'clock. Defaults to `0`. */\n startAngle?: number\n /** Degrees the full ring spans, `0…360`. Defaults to `360`; use e.g. `270` for a dial. */\n angle?: number\n /** Ring thickness in pixels. Defaults to `12`. */\n thickness?: number\n /** Space between rings in pixels. Defaults to `4`. */\n gap?: number\n /** Corner radius of the arcs. Defaults to half the thickness (round caps). */\n cornerRadius?: number\n /** Format of the values (tooltip, table). */\n format?: NumberFormat\n /**\n * Text in the middle: the first ring's share of `max` and its name by\n * default; `false` hides it, or give your own `value` / `label`.\n */\n center?: false | { value?: string; label?: string }\n /** Extra space around the gauge, in pixels. */\n padding?: InsetsInput\n}\n\n/** Space kept around the gauge for the hover halo. */\nconst HALF_PI = Math.PI / 2\n\ninterface Ring {\n data: GaugeRing\n index: number\n value: number\n max: number\n /** Slot among the visible rings, from the outside in. */\n position: number\n}\n\nfunction ringsOf(options: GaugeOptions): GaugeRing[] {\n const { data } = options\n if (typeof data === 'number') return [{ name: '', value: data }]\n return Array.isArray(data) ? (data as GaugeRing[]) : [data as GaugeRing]\n}\n\n/** The visible rings with clamped values. */\nfunction layoutRings(options: GaugeOptions, hidden: ReadonlySet<string>): Ring[] {\n const max = options.max ?? 100\n return ringsOf(options)\n .map((data, index) => ({ data, index, max: data.max ?? max }))\n .filter((ring) => !hidden.has(keyOf(ring.data)))\n .map((ring, position) => ({\n ...ring,\n position,\n value: Math.min(ring.max, Math.max(0, ring.data.value || 0)),\n }))\n}\n\n/**\n * Radius and center that fit the swept ring (plus the text in the middle)\n * into `area`: a dial or half ring is centered by its own outline, not by\n * the full circle it is cut from.\n */\nfunction fitGauge(\n area: { x: number; y: number; width: number; height: number },\n start: number,\n sweep: number,\n textTop: number,\n textBottom: number,\n): { outer: number; cx: number; cy: number } {\n // Points of the outline, in units of the outer radius: both ends of the arc\n // and every axis extreme it passes; the origin covers the inner edge.\n const unit: [number, number][] = [[0, 0]]\n const end = start + sweep\n unit.push([Math.sin(start), -Math.cos(start)], [Math.sin(end), -Math.cos(end)])\n // (At most a full turn of them: a huge start angle is beyond what adding a quarter turn changes.)\n for (let a = Math.ceil(start / HALF_PI) * HALF_PI, n = 0; n < 5 && a <= end + 1e-9; n++) {\n unit.push([Math.sin(a), -Math.cos(a)])\n a += HALF_PI\n }\n let outer = Math.min(area.width, area.height) / 2\n let box = { x0: 0, y0: 0, x1: 0, y1: 0 }\n // The text does not scale with the radius, so converge in a few rounds.\n for (let i = 0; i < 4; i++) {\n box = { x0: 0, y0: textTop, x1: 0, y1: textBottom }\n for (const [x, y] of unit) {\n box.x0 = Math.min(box.x0, x * outer)\n box.x1 = Math.max(box.x1, x * outer)\n box.y0 = Math.min(box.y0, y * outer)\n box.y1 = Math.max(box.y1, y * outer)\n }\n const scale = Math.min(area.width / (box.x1 - box.x0), area.height / (box.y1 - box.y0))\n if (Math.abs(scale - 1) < 1e-3) break\n outer = Math.max(0, outer * scale)\n }\n return {\n outer,\n cx: area.x + (area.width - (box.x1 - box.x0)) / 2 - box.x0,\n cy: area.y + (area.height - (box.y1 - box.y0)) / 2 - box.y0,\n }\n}\n\nfunction renderGauge(options: GaugeOptions, ctx: RenderContext): ChildInput {\n const { width, height, locale } = ctx\n const thickness = Math.max(1, options.thickness ?? 12)\n const gap = Math.max(0, options.gap ?? 4)\n const cornerRadius = options.cornerRadius ?? thickness / 2\n const pad = insets(options.padding, 0)\n const area = innerRect(width, height, {\n top: pad.top + HALO,\n right: pad.right + HALO,\n bottom: pad.bottom + HALO,\n left: pad.left + HALO,\n })\n const start = (options.startAngle ?? 0) * DEG\n const sweep = Math.min(360, Math.max(0, options.angle ?? 360)) * DEG\n const rings = layoutRings(options, ctx.hidden)\n const center = options.center\n const first = rings[0]\n const showCenter = center !== false && first !== undefined\n const centerLabel = showCenter ? (center?.label ?? (first.data.name || undefined)) : undefined\n const { outer, cx, cy } = fitGauge(\n area,\n start,\n sweep,\n showCenter ? -1.4 * ctx.fontSize : 0,\n showCenter ? (centerLabel ? 2 : 0.7) * ctx.fontSize : 0,\n )\n const value = formatNumber(options.format, locale)\n const share = getNumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 })\n\n const radii = (ring: Ring, grow = 0) => {\n const r1 = Math.max(0, outer - ring.position * (thickness + gap))\n return { innerRadius: Math.max(0, r1 - thickness - grow), outerRadius: r1 + grow }\n }\n const fraction = (ring: Ring) => (ring.max > 0 ? ring.value / ring.max : 0)\n const geometry = (ring: Ring, grow = 0) => ({\n ...radii(ring, grow),\n startAngle: start,\n endAngle: start + sweep * fraction(ring),\n cornerRadius,\n })\n\n const hitFor = (ring: Ring): Hit => {\n const [x, y] = arcCentroid(geometry(ring))\n const item: HitItem = {\n name: ring.data.name,\n seriesIndex: ring.index,\n value: ring.value,\n text: `${value(ring.value)} (${share.format(fraction(ring))})`,\n x: cx + x,\n y: cy + y,\n }\n if (ring.data.color) item.color = ring.data.color\n return {\n index: ring.position,\n label: ring.data.name,\n title: '',\n x: cx + x,\n area: { x: cx - outer, y: cy - outer, width: outer * 2, height: outer * 2 },\n items: [item],\n seriesIndex: ring.index,\n // The value arc, slightly enlarged.\n mark: { d: arcPathStable(geometry(ring, 2)), x: cx, y: cy },\n }\n }\n\n const interaction: Interaction = {\n count: rings.length,\n hitIndex: (position) => {\n const ring = rings[position]\n return ring ? hitFor(ring) : null\n },\n hitTest(px, py) {\n const r = Math.hypot(px - cx, py - cy)\n const ring = rings.find((ring) => {\n const { innerRadius, outerRadius } = radii(ring, 2)\n return r >= innerRadius && r <= outerRadius\n })\n return ring ? hitFor(ring) : null\n },\n }\n ctx.onHitTest(interaction)\n\n const groups = rings.map((ring) =>\n h(\n 'g',\n groupAttrs(ring.data, ring.index),\n // Each path keeps its arc, so a new value (or a new shape of the gauge)\n // sweeps it around the center (see `sweep`).\n arcNode('tc-gauge-track', { ...geometry(ring), endAngle: start + sweep }),\n arcNode('tc-gauge-arc', geometry(ring)),\n ),\n )\n\n const centerValue = showCenter ? (center?.value ?? share.format(fraction(first))) : ''\n\n return [\n // Rings sit in their own group: the entrance animation transforms it, not the translated parent.\n h(\n 'g',\n { class: 'tc-gauge', style: `transform:translate(${cx}px,${cy}px)` },\n h('g', { class: 'tc-gauge-rings' }, groups),\n ),\n showCenter &&\n h(\n 'g',\n { class: 'tc-gauge-center', 'aria-hidden': 'true' },\n h(\n 'text',\n {\n class: 'tc-gauge-value',\n x: cx,\n y: cy,\n dy: centerLabel ? '0' : '0.35em',\n 'text-anchor': 'middle',\n },\n centerValue,\n ),\n centerLabel &&\n h(\n 'text',\n { class: 'tc-gauge-label', x: cx, y: cy, dy: '1.6em', 'text-anchor': 'middle' },\n centerLabel,\n ),\n ),\n ]\n}\n\nfunction gaugeTable(options: GaugeOptions, ctx: RenderContext): DataTable {\n const value = formatNumber(options.format, ctx.locale)\n const share = getNumberFormat(ctx.locale, { style: 'percent', maximumFractionDigits: 1 })\n return {\n columns: ['', 'Value', 'Share'],\n rows: layoutRings(options, ctx.hidden).map((ring) => [\n ring.data.name,\n value(ring.value),\n share.format(ring.max > 0 ? ring.value / ring.max : 0),\n ]),\n }\n}\n\n/**\n * Gauge (radial bar): progress towards a maximum as an arc on a track, with\n * the share in the middle. Several rings nest from the outside in.\n *\n * ```ts\n * new Chart('#el', { type: gauge, data: 58 })\n * new Chart('#el', { type: gauge, data: { name: 'completed', value: 1392, max: 2400 } })\n * ```\n */\nexport const gauge: ChartType<GaugeOptions> = {\n name: 'gauge',\n clean: cleanData((data) =>\n cleanItems(\n typeof data === 'number' ? [{ name: '', value: data }] : isRecord(data) ? [data] : data,\n ),\n ),\n render: (options, ctx): ChildInput => {\n // Set here, not as the module loads (see pie).\n features.sweep = sweepArcs\n return renderGauge(options, ctx)\n },\n legend: (options) => legendItems(ringsOf(options)),\n table: gaugeTable,\n}\n"],"mappings":";;;;;;;;;AA2DA,MAAM,UAAU,KAAK,KAAK;AAW1B,SAAS,QAAQ,SAAoC;CACnD,MAAM,EAAE,SAAS;CACjB,IAAI,OAAO,SAAS,UAAU,OAAO,CAAC;EAAE,MAAM;EAAI,OAAO;CAAK,CAAC;CAC/D,OAAO,MAAM,QAAQ,IAAI,IAAK,OAAuB,CAAC,IAAiB;AACzE;;AAGA,SAAS,YAAY,SAAuB,QAAqC;CAC/E,MAAM,MAAM,QAAQ,OAAO;CAC3B,OAAO,QAAQ,OAAO,CAAC,CACpB,KAAK,MAAM,WAAW;EAAE;EAAM;EAAO,KAAK,KAAK,OAAO;CAAI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AAAA,aAAa,QAAQ,QAAQ,IAAI,MAAM;CACrD,MAAM,QAAQC,eAAAA,gBAAgB,IAAI,QAAQ;EAAE,OAAO;EAAW,uBAAuB;CAAE,CAAC;CACxF,OAAO;EACL,SAAS;GAAC;GAAI;GAAS;EAAO;EAC9B,MAAM,YAAY,SAAS,IAAI,MAAM,CAAC,CAAC,KAAK,SAAS;GACnD,KAAK,KAAK;GACV,MAAM,KAAK,KAAK;GAChB,MAAM,OAAO,KAAK,MAAM,IAAI,KAAK,QAAQ,KAAK,MAAM,CAAC;EACvD,CAAC;CACH;AACF;;;;;;;;;;AAWA,MAAa,QAAiC;CAC5C,MAAM;CACN,OAAOM,cAAAA,WAAW,SAChBC,cAAAA,WACE,OAAO,SAAS,WAAW,CAAC;EAAE,MAAM;EAAI,OAAO;CAAK,CAAC,IAAIC,cAAAA,SAAS,IAAI,IAAI,CAAC,IAAI,IAAI,IACrF,CACF;CACA,SAAS,SAAS,QAAoB;EAEpC,iBAAA,SAAS,QAAQC,cAAAA;EACjB,OAAO,YAAY,SAAS,GAAG;CACjC;CACA,SAAS,YAAYC,cAAAA,YAAY,QAAQ,OAAO,CAAC;CACjD,OAAO;AACT"}
1
+ {"version":3,"file":"gauge-D-FYhuds.cjs","names":["keyOf","insets","innerRect","DEG","formatNumber","getNumberFormat","arcCentroid","arcPathStable","h","groupAttrs","arcNode","cleanData","cleanItems","isRecord","sweepArcs","legendItems"],"sources":["../src/charts/gauge.ts"],"sourcesContent":["import type { DataTable } from '../a11y.ts'\nimport type { ChartType, RenderContext } from '../chart.ts'\nimport { features } from '../features.ts'\nimport { formatNumber, getNumberFormat, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { type InsetsInput, innerRect, insets } from '../layout.ts'\nimport { arcNode, sweep as sweepArcs } from '../render/sweep.ts'\nimport { arcCentroid, arcPathStable, DEG, HALO } from '../shapes/arc.ts'\nimport { type ChildInput, type ClassValue, h } from '../vnode.ts'\nimport { cleanData, cleanItems, isRecord } from './clean.ts'\nimport { groupAttrs, keyOf, legendItems } from './named.ts'\n\n/** One ring of a gauge. */\nexport interface GaugeRing {\n name: string\n /** Current value, clamped to `0…max`. */\n value: number\n /** Full-ring value of this ring; overrides `GaugeOptions.max`. */\n max?: number\n /** Stable identity for keyed updates and legend toggles. Defaults to `name`. */\n id?: string\n /**\n * Custom color; overrides the palette slot via `--tc-series-color`.\n * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.\n */\n color?: string\n /** Extra classes on the ring group. */\n class?: ClassValue\n /** Start hidden (toggle it back from the legend). */\n hidden?: boolean\n}\n\nexport interface GaugeOptions {\n /** A single value, one ring, or concentric rings (outermost first). */\n data: number | GaugeRing | readonly GaugeRing[]\n /** Full-ring value. Defaults to `100`. */\n max?: number\n /** Where the arc starts, in degrees clockwise from 12 o'clock. Defaults to `0`. */\n startAngle?: number\n /** Degrees the full ring spans, `0…360`. Defaults to `360`; use e.g. `270` for a dial. */\n angle?: number\n /** Ring thickness in pixels. Defaults to `12`. */\n thickness?: number\n /** Space between rings in pixels. Defaults to `4`. */\n gap?: number\n /** Corner radius of the arcs. Defaults to half the thickness (round caps). */\n cornerRadius?: number\n /** Format of the values (tooltip, table). */\n format?: NumberFormat\n /**\n * Text in the middle: the first ring's share of `max` and its name by\n * default; `false` hides it, or give your own `value` / `label`.\n */\n center?: false | { value?: string; label?: string }\n /** Extra space around the gauge, in pixels. */\n padding?: InsetsInput\n}\n\n/** Space kept around the gauge for the hover halo. */\nconst HALF_PI = Math.PI / 2\n\ninterface Ring {\n data: GaugeRing\n index: number\n value: number\n max: number\n /** Slot among the visible rings, from the outside in. */\n position: number\n}\n\nfunction ringsOf(options: GaugeOptions): GaugeRing[] {\n const { data } = options\n if (typeof data === 'number') return [{ name: '', value: data }]\n return Array.isArray(data) ? (data as GaugeRing[]) : [data as GaugeRing]\n}\n\n/** The visible rings with clamped values. */\nfunction layoutRings(options: GaugeOptions, hidden: ReadonlySet<string>): Ring[] {\n const max = options.max ?? 100\n return ringsOf(options)\n .map((data, index) => ({ data, index, max: data.max ?? max }))\n .filter((ring) => !hidden.has(keyOf(ring.data)))\n .map((ring, position) => ({\n ...ring,\n position,\n value: Math.min(ring.max, Math.max(0, ring.data.value || 0)),\n }))\n}\n\n/**\n * Radius and center that fit the swept ring (plus the text in the middle)\n * into `area`: a dial or half ring is centered by its own outline, not by\n * the full circle it is cut from.\n */\nfunction fitGauge(\n area: { x: number; y: number; width: number; height: number },\n start: number,\n sweep: number,\n textTop: number,\n textBottom: number,\n): { outer: number; cx: number; cy: number } {\n // Points of the outline, in units of the outer radius: both ends of the arc\n // and every axis extreme it passes; the origin covers the inner edge.\n const unit: [number, number][] = [[0, 0]]\n const end = start + sweep\n unit.push([Math.sin(start), -Math.cos(start)], [Math.sin(end), -Math.cos(end)])\n // (At most a full turn of them: a huge start angle is beyond what adding a quarter turn changes.)\n for (let a = Math.ceil(start / HALF_PI) * HALF_PI, n = 0; n < 5 && a <= end + 1e-9; n++) {\n unit.push([Math.sin(a), -Math.cos(a)])\n a += HALF_PI\n }\n let outer = Math.min(area.width, area.height) / 2\n let box = { x0: 0, y0: 0, x1: 0, y1: 0 }\n // The text does not scale with the radius, so converge in a few rounds.\n for (let i = 0; i < 4; i++) {\n box = { x0: 0, y0: textTop, x1: 0, y1: textBottom }\n for (const [x, y] of unit) {\n box.x0 = Math.min(box.x0, x * outer)\n box.x1 = Math.max(box.x1, x * outer)\n box.y0 = Math.min(box.y0, y * outer)\n box.y1 = Math.max(box.y1, y * outer)\n }\n const scale = Math.min(area.width / (box.x1 - box.x0), area.height / (box.y1 - box.y0))\n if (Math.abs(scale - 1) < 1e-3) break\n outer = Math.max(0, outer * scale)\n }\n return {\n outer,\n cx: area.x + (area.width - (box.x1 - box.x0)) / 2 - box.x0,\n cy: area.y + (area.height - (box.y1 - box.y0)) / 2 - box.y0,\n }\n}\n\nfunction renderGauge(options: GaugeOptions, ctx: RenderContext): ChildInput {\n const { width, height, locale } = ctx\n const thickness = Math.max(1, options.thickness ?? 12)\n const gap = Math.max(0, options.gap ?? 4)\n const cornerRadius = options.cornerRadius ?? thickness / 2\n const pad = insets(options.padding, 0)\n const area = innerRect(width, height, {\n top: pad.top + HALO,\n right: pad.right + HALO,\n bottom: pad.bottom + HALO,\n left: pad.left + HALO,\n })\n const start = (options.startAngle ?? 0) * DEG\n const sweep = Math.min(360, Math.max(0, options.angle ?? 360)) * DEG\n const rings = layoutRings(options, ctx.hidden)\n const center = options.center\n const first = rings[0]\n const showCenter = center !== false && first !== undefined\n const centerLabel = showCenter ? (center?.label ?? (first.data.name || undefined)) : undefined\n const { outer, cx, cy } = fitGauge(\n area,\n start,\n sweep,\n showCenter ? -1.4 * ctx.fontSize : 0,\n showCenter ? (centerLabel ? 2 : 0.7) * ctx.fontSize : 0,\n )\n const value = formatNumber(options.format, locale)\n const share = getNumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 })\n\n const radii = (ring: Ring, grow = 0) => {\n const r1 = Math.max(0, outer - ring.position * (thickness + gap))\n return { innerRadius: Math.max(0, r1 - thickness - grow), outerRadius: r1 + grow }\n }\n const fraction = (ring: Ring) => (ring.max > 0 ? ring.value / ring.max : 0)\n const geometry = (ring: Ring, grow = 0) => ({\n ...radii(ring, grow),\n startAngle: start,\n endAngle: start + sweep * fraction(ring),\n cornerRadius,\n })\n\n const hitFor = (ring: Ring): Hit => {\n const [x, y] = arcCentroid(geometry(ring))\n const item: HitItem = {\n name: ring.data.name,\n seriesIndex: ring.index,\n value: ring.value,\n text: `${value(ring.value)} (${share.format(fraction(ring))})`,\n x: cx + x,\n y: cy + y,\n }\n if (ring.data.color) item.color = ring.data.color\n return {\n index: ring.position,\n label: ring.data.name,\n title: '',\n x: cx + x,\n area: { x: cx - outer, y: cy - outer, width: outer * 2, height: outer * 2 },\n items: [item],\n seriesIndex: ring.index,\n // The value arc, slightly enlarged.\n mark: { d: arcPathStable(geometry(ring, 2)), x: cx, y: cy },\n }\n }\n\n const interaction: Interaction = {\n count: rings.length,\n hitIndex: (position) => {\n const ring = rings[position]\n return ring ? hitFor(ring) : null\n },\n hitTest(px, py) {\n const r = Math.hypot(px - cx, py - cy)\n const ring = rings.find((ring) => {\n const { innerRadius, outerRadius } = radii(ring, 2)\n return r >= innerRadius && r <= outerRadius\n })\n return ring ? hitFor(ring) : null\n },\n }\n ctx.onHitTest(interaction)\n\n const groups = rings.map((ring) =>\n h(\n 'g',\n groupAttrs(ring.data, ring.index),\n // Each path keeps its arc, so a new value (or a new shape of the gauge)\n // sweeps it around the center (see `sweep`).\n arcNode('tc-gauge-track', { ...geometry(ring), endAngle: start + sweep }),\n arcNode('tc-gauge-arc', geometry(ring)),\n ),\n )\n\n const centerValue = showCenter ? (center?.value ?? share.format(fraction(first))) : ''\n\n return [\n // Rings sit in their own group: the entrance animation transforms it, not the translated parent.\n h(\n 'g',\n { class: 'tc-gauge', style: `transform:translate(${cx}px,${cy}px)` },\n h('g', { class: 'tc-gauge-rings' }, groups),\n ),\n showCenter &&\n h(\n 'g',\n { class: 'tc-gauge-center', 'aria-hidden': 'true' },\n h(\n 'text',\n {\n class: 'tc-gauge-value',\n x: cx,\n y: cy,\n dy: centerLabel ? '0' : '0.35em',\n 'text-anchor': 'middle',\n },\n centerValue,\n ),\n centerLabel &&\n h(\n 'text',\n { class: 'tc-gauge-label', x: cx, y: cy, dy: '1.6em', 'text-anchor': 'middle' },\n centerLabel,\n ),\n ),\n ]\n}\n\nfunction gaugeTable(options: GaugeOptions, ctx: RenderContext): DataTable {\n const value = formatNumber(options.format, ctx.locale)\n const share = getNumberFormat(ctx.locale, { style: 'percent', maximumFractionDigits: 1 })\n return {\n columns: ['', 'Value', 'Share'],\n rows: layoutRings(options, ctx.hidden).map((ring) => [\n ring.data.name,\n value(ring.value),\n share.format(ring.max > 0 ? ring.value / ring.max : 0),\n ]),\n }\n}\n\n/**\n * Gauge (radial bar): progress towards a maximum as an arc on a track, with\n * the share in the middle. Several rings nest from the outside in.\n *\n * ```ts\n * new Chart('#el', { type: gauge, data: 58 })\n * new Chart('#el', { type: gauge, data: { name: 'completed', value: 1392, max: 2400 } })\n * ```\n */\nexport const gauge: ChartType<GaugeOptions> = {\n name: 'gauge',\n clean: cleanData((data) =>\n cleanItems(\n typeof data === 'number' ? [{ name: '', value: data }] : isRecord(data) ? [data] : data,\n ),\n ),\n render: (options, ctx): ChildInput => {\n // Set here, not as the module loads (see pie).\n features.sweep = sweepArcs\n return renderGauge(options, ctx)\n },\n legend: (options) => legendItems(ringsOf(options)),\n table: gaugeTable,\n}\n"],"mappings":";;;;;;;;;;AA2DA,MAAM,UAAU,KAAK,KAAK;AAW1B,SAAS,QAAQ,SAAoC;CACnD,MAAM,EAAE,SAAS;CACjB,IAAI,OAAO,SAAS,UAAU,OAAO,CAAC;EAAE,MAAM;EAAI,OAAO;CAAK,CAAC;CAC/D,OAAO,MAAM,QAAQ,IAAI,IAAK,OAAuB,CAAC,IAAiB;AACzE;;AAGA,SAAS,YAAY,SAAuB,QAAqC;CAC/E,MAAM,MAAM,QAAQ,OAAO;CAC3B,OAAO,QAAQ,OAAO,CAAC,CACpB,KAAK,MAAM,WAAW;EAAE;EAAM;EAAO,KAAK,KAAK,OAAO;CAAI,EAAE,CAAC,CAC7D,QAAQ,SAAS,CAAC,OAAO,IAAIA,cAAAA,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,CAC/C,KAAK,MAAM,cAAc;EACxB,GAAG;EACH;EACA,OAAO,KAAK,IAAI,KAAK,KAAK,KAAK,IAAI,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC;CAC7D,EAAE;AACN;;;;;;AAOA,SAAS,SACP,MACA,OACA,OACA,SACA,YAC2C;CAG3C,MAAM,OAA2B,CAAC,CAAC,GAAG,CAAC,CAAC;CACxC,MAAM,MAAM,QAAQ;CACpB,KAAK,KAAK,CAAC,KAAK,IAAI,KAAK,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK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AS,WAAW,CAAC;EAAE,MAAM;EAAI,OAAO;CAAK,CAAC,IAAIC,cAAAA,SAAS,IAAI,IAAI,CAAC,IAAI,IAAI,IACrF,CACF;CACA,SAAS,SAAS,QAAoB;EAEpC,iBAAA,SAAS,QAAQC,cAAAA;EACjB,OAAO,YAAY,SAAS,GAAG;CACjC;CACA,SAAS,YAAYC,cAAAA,YAAY,QAAQ,OAAO,CAAC;CACjD,OAAO;AACT"}
@@ -1,6 +1,6 @@
1
1
  import { a as InsetsInput } from "./annotations-lyt0I3HU.cjs";
2
2
  import { a as ClassValue } from "./vnode-BUflsBsa.cjs";
3
- import { a as ChartType } from "./chart-Qa417fJo.cjs";
3
+ import { a as ChartType } from "./chart-D7ooEFnk.cjs";
4
4
  import { c as NumberFormat } from "./time-CNVnt-B2.cjs";
5
5
  //#region src/charts/gauge.d.ts
6
6
  /** One ring of a gauge. */
@@ -62,4 +62,4 @@ interface GaugeOptions {
62
62
  declare const gauge: ChartType<GaugeOptions>;
63
63
  //#endregion
64
64
  export { GaugeRing as n, gauge as r, GaugeOptions as t };
65
- //# sourceMappingURL=gauge-Cu_OFxBd.d.cts.map
65
+ //# sourceMappingURL=gauge-DP_EB2z3.d.cts.map
@@ -4,7 +4,8 @@ import { o as getNumberFormat, r as formatNumber } from "./format-lStwuc1L.js";
4
4
  import { r as features } from "./features-wASyHGic.js";
5
5
  import { a as isRecord, n as cleanItems, t as cleanData } from "./clean-o1vDEhFV.js";
6
6
  import { n as keyOf, r as legendItems, t as groupAttrs } from "./named-DE15TOgh.js";
7
- import { a as arcPathStable, i as arcCentroid, n as sweep, r as DEG, t as arcNode } from "./sweep-WSgn2etB.js";
7
+ import { n as arcCentroid, r as arcPathStable, t as DEG } from "./arc-a1tRTEw7.js";
8
+ import { n as sweep, t as arcNode } from "./sweep-CbfR7--d.js";
8
9
  //#region src/charts/gauge.ts
9
10
  /** Space kept around the gauge for the hover halo. */
10
11
  const HALF_PI = Math.PI / 2;
@@ -227,4 +228,4 @@ const gauge = {
227
228
  //#endregion
228
229
  export { gauge as t };
229
230
 
230
- //# sourceMappingURL=gauge-_ljQHrMN.js.map
231
+ //# sourceMappingURL=gauge-Dh423FHh.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gauge-_ljQHrMN.js","names":["sweepArcs"],"sources":["../src/charts/gauge.ts"],"sourcesContent":["import type { DataTable } from '../a11y.ts'\nimport type { ChartType, RenderContext } from '../chart.ts'\nimport { features } from '../features.ts'\nimport { formatNumber, getNumberFormat, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { type InsetsInput, innerRect, insets } from '../layout.ts'\nimport { arcNode, sweep as sweepArcs } from '../render/sweep.ts'\nimport { arcCentroid, arcPathStable, DEG, HALO } from '../shapes/arc.ts'\nimport { type ChildInput, type ClassValue, h } from '../vnode.ts'\nimport { cleanData, cleanItems, isRecord } from './clean.ts'\nimport { groupAttrs, keyOf, legendItems } from './named.ts'\n\n/** One ring of a gauge. */\nexport interface GaugeRing {\n name: string\n /** Current value, clamped to `0…max`. */\n value: number\n /** Full-ring value of this ring; overrides `GaugeOptions.max`. */\n max?: number\n /** Stable identity for keyed updates and legend toggles. Defaults to `name`. */\n id?: string\n /**\n * Custom color; overrides the palette slot via `--tc-series-color`.\n * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.\n */\n color?: string\n /** Extra classes on the ring group. */\n class?: ClassValue\n /** Start hidden (toggle it back from the legend). */\n hidden?: boolean\n}\n\nexport interface GaugeOptions {\n /** A single value, one ring, or concentric rings (outermost first). */\n data: number | GaugeRing | readonly GaugeRing[]\n /** Full-ring value. Defaults to `100`. */\n max?: number\n /** Where the arc starts, in degrees clockwise from 12 o'clock. Defaults to `0`. */\n startAngle?: number\n /** Degrees the full ring spans, `0…360`. Defaults to `360`; use e.g. `270` for a dial. */\n angle?: number\n /** Ring thickness in pixels. Defaults to `12`. */\n thickness?: number\n /** Space between rings in pixels. Defaults to `4`. */\n gap?: number\n /** Corner radius of the arcs. Defaults to half the thickness (round caps). */\n cornerRadius?: number\n /** Format of the values (tooltip, table). */\n format?: NumberFormat\n /**\n * Text in the middle: the first ring's share of `max` and its name by\n * default; `false` hides it, or give your own `value` / `label`.\n */\n center?: false | { value?: string; label?: string }\n /** Extra space around the gauge, in pixels. */\n padding?: InsetsInput\n}\n\n/** Space kept around the gauge for the hover halo. */\nconst HALF_PI = Math.PI / 2\n\ninterface Ring {\n data: GaugeRing\n index: number\n value: number\n max: number\n /** Slot among the visible rings, from the outside in. */\n position: number\n}\n\nfunction ringsOf(options: GaugeOptions): GaugeRing[] {\n const { data } = options\n if (typeof data === 'number') return [{ name: '', value: data }]\n return Array.isArray(data) ? (data as GaugeRing[]) : [data as GaugeRing]\n}\n\n/** The visible rings with clamped values. */\nfunction layoutRings(options: GaugeOptions, hidden: ReadonlySet<string>): Ring[] {\n const max = options.max ?? 100\n return ringsOf(options)\n .map((data, index) => ({ data, index, max: data.max ?? max }))\n .filter((ring) => !hidden.has(keyOf(ring.data)))\n .map((ring, position) => ({\n ...ring,\n position,\n value: Math.min(ring.max, Math.max(0, ring.data.value || 0)),\n }))\n}\n\n/**\n * Radius and center that fit the swept ring (plus the text in the middle)\n * into `area`: a dial or half ring is centered by its own outline, not by\n * the full circle it is cut from.\n */\nfunction fitGauge(\n area: { x: number; y: number; width: number; height: number },\n start: number,\n sweep: number,\n textTop: number,\n textBottom: number,\n): { outer: number; cx: number; cy: number } {\n // Points of the outline, in units of the outer radius: both ends of the arc\n // and every axis extreme it passes; the origin covers the inner edge.\n const unit: [number, number][] = [[0, 0]]\n const end = start + sweep\n unit.push([Math.sin(start), -Math.cos(start)], [Math.sin(end), -Math.cos(end)])\n // (At most a full turn of them: a huge start angle is beyond what adding a quarter turn changes.)\n for (let a = Math.ceil(start / HALF_PI) * HALF_PI, n = 0; n < 5 && a <= end + 1e-9; n++) {\n unit.push([Math.sin(a), -Math.cos(a)])\n a += HALF_PI\n }\n let outer = Math.min(area.width, area.height) / 2\n let box = { x0: 0, y0: 0, x1: 0, y1: 0 }\n // The text does not scale with the radius, so converge in a few rounds.\n for (let i = 0; i < 4; i++) {\n box = { x0: 0, y0: textTop, x1: 0, y1: textBottom }\n for (const [x, y] of unit) {\n box.x0 = Math.min(box.x0, x * outer)\n box.x1 = Math.max(box.x1, x * outer)\n box.y0 = Math.min(box.y0, y * outer)\n box.y1 = Math.max(box.y1, y * outer)\n }\n const scale = Math.min(area.width / (box.x1 - box.x0), area.height / (box.y1 - box.y0))\n if (Math.abs(scale - 1) < 1e-3) break\n outer = Math.max(0, outer * scale)\n }\n return {\n outer,\n cx: area.x + (area.width - (box.x1 - box.x0)) / 2 - box.x0,\n cy: area.y + (area.height - (box.y1 - box.y0)) / 2 - box.y0,\n }\n}\n\nfunction renderGauge(options: GaugeOptions, ctx: RenderContext): ChildInput {\n const { width, height, locale } = ctx\n const thickness = Math.max(1, options.thickness ?? 12)\n const gap = Math.max(0, options.gap ?? 4)\n const cornerRadius = options.cornerRadius ?? thickness / 2\n const pad = insets(options.padding, 0)\n const area = innerRect(width, height, {\n top: pad.top + HALO,\n right: pad.right + HALO,\n bottom: pad.bottom + HALO,\n left: pad.left + HALO,\n })\n const start = (options.startAngle ?? 0) * DEG\n const sweep = Math.min(360, Math.max(0, options.angle ?? 360)) * DEG\n const rings = layoutRings(options, ctx.hidden)\n const center = options.center\n const first = rings[0]\n const showCenter = center !== false && first !== undefined\n const centerLabel = showCenter ? (center?.label ?? (first.data.name || undefined)) : undefined\n const { outer, cx, cy } = fitGauge(\n area,\n start,\n sweep,\n showCenter ? -1.4 * ctx.fontSize : 0,\n showCenter ? (centerLabel ? 2 : 0.7) * ctx.fontSize : 0,\n )\n const value = formatNumber(options.format, locale)\n const share = getNumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 })\n\n const radii = (ring: Ring, grow = 0) => {\n const r1 = Math.max(0, outer - ring.position * (thickness + gap))\n return { innerRadius: Math.max(0, r1 - thickness - grow), outerRadius: r1 + grow }\n }\n const fraction = (ring: Ring) => (ring.max > 0 ? ring.value / ring.max : 0)\n const geometry = (ring: Ring, grow = 0) => ({\n ...radii(ring, grow),\n startAngle: start,\n endAngle: start + sweep * fraction(ring),\n cornerRadius,\n })\n\n const hitFor = (ring: Ring): Hit => {\n const [x, y] = arcCentroid(geometry(ring))\n const item: HitItem = {\n name: ring.data.name,\n seriesIndex: ring.index,\n value: ring.value,\n text: `${value(ring.value)} (${share.format(fraction(ring))})`,\n x: cx + x,\n y: cy + y,\n }\n if (ring.data.color) item.color = ring.data.color\n return {\n index: ring.position,\n label: ring.data.name,\n title: '',\n x: cx + x,\n area: { x: cx - outer, y: cy - outer, width: outer * 2, height: outer * 2 },\n items: [item],\n seriesIndex: ring.index,\n // The value arc, slightly enlarged.\n mark: { d: arcPathStable(geometry(ring, 2)), x: cx, y: cy },\n }\n }\n\n const interaction: Interaction = {\n count: rings.length,\n hitIndex: (position) => {\n const ring = rings[position]\n return ring ? hitFor(ring) : null\n },\n hitTest(px, py) {\n const r = Math.hypot(px - cx, py - cy)\n const ring = rings.find((ring) => {\n const { innerRadius, outerRadius } = radii(ring, 2)\n return r >= innerRadius && r <= outerRadius\n })\n return ring ? hitFor(ring) : null\n },\n }\n ctx.onHitTest(interaction)\n\n const groups = rings.map((ring) =>\n h(\n 'g',\n groupAttrs(ring.data, ring.index),\n // Each path keeps its arc, so a new value (or a new shape of the gauge)\n // sweeps it around the center (see `sweep`).\n arcNode('tc-gauge-track', { ...geometry(ring), endAngle: start + sweep }),\n arcNode('tc-gauge-arc', geometry(ring)),\n ),\n )\n\n const centerValue = showCenter ? (center?.value ?? share.format(fraction(first))) : ''\n\n return [\n // Rings sit in their own group: the entrance animation transforms it, not the translated parent.\n h(\n 'g',\n { class: 'tc-gauge', style: `transform:translate(${cx}px,${cy}px)` },\n h('g', { class: 'tc-gauge-rings' }, groups),\n ),\n showCenter &&\n h(\n 'g',\n { class: 'tc-gauge-center', 'aria-hidden': 'true' },\n h(\n 'text',\n {\n class: 'tc-gauge-value',\n x: cx,\n y: cy,\n dy: centerLabel ? '0' : '0.35em',\n 'text-anchor': 'middle',\n },\n centerValue,\n ),\n centerLabel &&\n h(\n 'text',\n { class: 'tc-gauge-label', x: cx, y: cy, dy: '1.6em', 'text-anchor': 'middle' },\n centerLabel,\n ),\n ),\n ]\n}\n\nfunction gaugeTable(options: GaugeOptions, ctx: RenderContext): DataTable {\n const value = formatNumber(options.format, ctx.locale)\n const share = getNumberFormat(ctx.locale, { style: 'percent', maximumFractionDigits: 1 })\n return {\n columns: ['', 'Value', 'Share'],\n rows: layoutRings(options, ctx.hidden).map((ring) => [\n ring.data.name,\n value(ring.value),\n share.format(ring.max > 0 ? ring.value / ring.max : 0),\n ]),\n }\n}\n\n/**\n * Gauge (radial bar): progress towards a maximum as an arc on a track, with\n * the share in the middle. Several rings nest from the outside in.\n *\n * ```ts\n * new Chart('#el', { type: gauge, data: 58 })\n * new Chart('#el', { type: gauge, data: { name: 'completed', value: 1392, max: 2400 } })\n * ```\n */\nexport const gauge: ChartType<GaugeOptions> = {\n name: 'gauge',\n clean: cleanData((data) =>\n cleanItems(\n typeof data === 'number' ? [{ name: '', value: data }] : isRecord(data) ? [data] : data,\n ),\n ),\n render: (options, ctx): ChildInput => {\n // Set here, not as the module loads (see pie).\n features.sweep = sweepArcs\n return renderGauge(options, ctx)\n },\n legend: (options) => legendItems(ringsOf(options)),\n table: gaugeTable,\n}\n"],"mappings":";;;;;;;;;AA2DA,MAAM,UAAU,KAAK,KAAK;AAW1B,SAAS,QAAQ,SAAoC;CACnD,MAAM,EAAE,SAAS;CACjB,IAAI,OAAO,SAAS,UAAU,OAAO,CAAC;EAAE,MAAM;EAAI,OAAO;CAAK,CAAC;CAC/D,OAAO,MAAM,QAAQ,IAAI,IAAK,OAAuB,CAAC,IAAiB;AACzE;;AAGA,SAAS,YAAY,SAAuB,QAAqC;CAC/E,MAAM,MAAM,QAAQ,OAAO;CAC3B,OAAO,QAAQ,OAAO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,OAAO;EAAW,uBAAuB;CAAE,CAAC;CACxF,OAAO;EACL,SAAS;GAAC;GAAI;GAAS;EAAO;EAC9B,MAAM,YAAY,SAAS,IAAI,MAAM,CAAC,CAAC,KAAK,SAAS;GACnD,KAAK,KAAK;GACV,MAAM,KAAK,KAAK;GAChB,MAAM,OAAO,KAAK,MAAM,IAAI,KAAK,QAAQ,KAAK,MAAM,CAAC;EACvD,CAAC;CACH;AACF;;;;;;;;;;AAWA,MAAa,QAAiC;CAC5C,MAAM;CACN,OAAO,WAAW,SAChB,WACE,OAAO,SAAS,WAAW,CAAC;EAAE,MAAM;EAAI,OAAO;CAAK,CAAC,IAAI,SAAS,IAAI,IAAI,CAAC,IAAI,IAAI,IACrF,CACF;CACA,SAAS,SAAS,QAAoB;EAEpC,SAAS,QAAQA;EACjB,OAAO,YAAY,SAAS,GAAG;CACjC;CACA,SAAS,YAAY,YAAY,QAAQ,OAAO,CAAC;CACjD,OAAO;AACT"}
1
+ {"version":3,"file":"gauge-Dh423FHh.js","names":["sweepArcs"],"sources":["../src/charts/gauge.ts"],"sourcesContent":["import type { DataTable } from '../a11y.ts'\nimport type { ChartType, RenderContext } from '../chart.ts'\nimport { features } from '../features.ts'\nimport { formatNumber, getNumberFormat, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { type InsetsInput, innerRect, insets } from '../layout.ts'\nimport { arcNode, sweep as sweepArcs } from '../render/sweep.ts'\nimport { arcCentroid, arcPathStable, DEG, HALO } from '../shapes/arc.ts'\nimport { type ChildInput, type ClassValue, h } from '../vnode.ts'\nimport { cleanData, cleanItems, isRecord } from './clean.ts'\nimport { groupAttrs, keyOf, legendItems } from './named.ts'\n\n/** One ring of a gauge. */\nexport interface GaugeRing {\n name: string\n /** Current value, clamped to `0…max`. */\n value: number\n /** Full-ring value of this ring; overrides `GaugeOptions.max`. */\n max?: number\n /** Stable identity for keyed updates and legend toggles. Defaults to `name`. */\n id?: string\n /**\n * Custom color; overrides the palette slot via `--tc-series-color`.\n * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.\n */\n color?: string\n /** Extra classes on the ring group. */\n class?: ClassValue\n /** Start hidden (toggle it back from the legend). */\n hidden?: boolean\n}\n\nexport interface GaugeOptions {\n /** A single value, one ring, or concentric rings (outermost first). */\n data: number | GaugeRing | readonly GaugeRing[]\n /** Full-ring value. Defaults to `100`. */\n max?: number\n /** Where the arc starts, in degrees clockwise from 12 o'clock. Defaults to `0`. */\n startAngle?: number\n /** Degrees the full ring spans, `0…360`. Defaults to `360`; use e.g. `270` for a dial. */\n angle?: number\n /** Ring thickness in pixels. Defaults to `12`. */\n thickness?: number\n /** Space between rings in pixels. Defaults to `4`. */\n gap?: number\n /** Corner radius of the arcs. Defaults to half the thickness (round caps). */\n cornerRadius?: number\n /** Format of the values (tooltip, table). */\n format?: NumberFormat\n /**\n * Text in the middle: the first ring's share of `max` and its name by\n * default; `false` hides it, or give your own `value` / `label`.\n */\n center?: false | { value?: string; label?: string }\n /** Extra space around the gauge, in pixels. */\n padding?: InsetsInput\n}\n\n/** Space kept around the gauge for the hover halo. */\nconst HALF_PI = Math.PI / 2\n\ninterface Ring {\n data: GaugeRing\n index: number\n value: number\n max: number\n /** Slot among the visible rings, from the outside in. */\n position: number\n}\n\nfunction ringsOf(options: GaugeOptions): GaugeRing[] {\n const { data } = options\n if (typeof data === 'number') return [{ name: '', value: data }]\n return Array.isArray(data) ? (data as GaugeRing[]) : [data as GaugeRing]\n}\n\n/** The visible rings with clamped values. */\nfunction layoutRings(options: GaugeOptions, hidden: ReadonlySet<string>): Ring[] {\n const max = options.max ?? 100\n return ringsOf(options)\n .map((data, index) => ({ data, index, max: data.max ?? max }))\n .filter((ring) => !hidden.has(keyOf(ring.data)))\n .map((ring, position) => ({\n ...ring,\n position,\n value: Math.min(ring.max, Math.max(0, ring.data.value || 0)),\n }))\n}\n\n/**\n * Radius and center that fit the swept ring (plus the text in the middle)\n * into `area`: a dial or half ring is centered by its own outline, not by\n * the full circle it is cut from.\n */\nfunction fitGauge(\n area: { x: number; y: number; width: number; height: number },\n start: number,\n sweep: number,\n textTop: number,\n textBottom: number,\n): { outer: number; cx: number; cy: number } {\n // Points of the outline, in units of the outer radius: both ends of the arc\n // and every axis extreme it passes; the origin covers the inner edge.\n const unit: [number, number][] = [[0, 0]]\n const end = start + sweep\n unit.push([Math.sin(start), -Math.cos(start)], [Math.sin(end), -Math.cos(end)])\n // (At most a full turn of them: a huge start angle is beyond what adding a quarter turn changes.)\n for (let a = Math.ceil(start / HALF_PI) * HALF_PI, n = 0; n < 5 && a <= end + 1e-9; n++) {\n unit.push([Math.sin(a), -Math.cos(a)])\n a += HALF_PI\n }\n let outer = Math.min(area.width, area.height) / 2\n let box = { x0: 0, y0: 0, x1: 0, y1: 0 }\n // The text does not scale with the radius, so converge in a few rounds.\n for (let i = 0; i < 4; i++) {\n box = { x0: 0, y0: textTop, x1: 0, y1: textBottom }\n for (const [x, y] of unit) {\n box.x0 = Math.min(box.x0, x * outer)\n box.x1 = Math.max(box.x1, x * outer)\n box.y0 = Math.min(box.y0, y * outer)\n box.y1 = Math.max(box.y1, y * outer)\n }\n const scale = Math.min(area.width / (box.x1 - box.x0), area.height / (box.y1 - box.y0))\n if (Math.abs(scale - 1) < 1e-3) break\n outer = Math.max(0, outer * scale)\n }\n return {\n outer,\n cx: area.x + (area.width - (box.x1 - box.x0)) / 2 - box.x0,\n cy: area.y + (area.height - (box.y1 - box.y0)) / 2 - box.y0,\n }\n}\n\nfunction renderGauge(options: GaugeOptions, ctx: RenderContext): ChildInput {\n const { width, height, locale } = ctx\n const thickness = Math.max(1, options.thickness ?? 12)\n const gap = Math.max(0, options.gap ?? 4)\n const cornerRadius = options.cornerRadius ?? thickness / 2\n const pad = insets(options.padding, 0)\n const area = innerRect(width, height, {\n top: pad.top + HALO,\n right: pad.right + HALO,\n bottom: pad.bottom + HALO,\n left: pad.left + HALO,\n })\n const start = (options.startAngle ?? 0) * DEG\n const sweep = Math.min(360, Math.max(0, options.angle ?? 360)) * DEG\n const rings = layoutRings(options, ctx.hidden)\n const center = options.center\n const first = rings[0]\n const showCenter = center !== false && first !== undefined\n const centerLabel = showCenter ? (center?.label ?? (first.data.name || undefined)) : undefined\n const { outer, cx, cy } = fitGauge(\n area,\n start,\n sweep,\n showCenter ? -1.4 * ctx.fontSize : 0,\n showCenter ? (centerLabel ? 2 : 0.7) * ctx.fontSize : 0,\n )\n const value = formatNumber(options.format, locale)\n const share = getNumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 })\n\n const radii = (ring: Ring, grow = 0) => {\n const r1 = Math.max(0, outer - ring.position * (thickness + gap))\n return { innerRadius: Math.max(0, r1 - thickness - grow), outerRadius: r1 + grow }\n }\n const fraction = (ring: Ring) => (ring.max > 0 ? ring.value / ring.max : 0)\n const geometry = (ring: Ring, grow = 0) => ({\n ...radii(ring, grow),\n startAngle: start,\n endAngle: start + sweep * fraction(ring),\n cornerRadius,\n })\n\n const hitFor = (ring: Ring): Hit => {\n const [x, y] = arcCentroid(geometry(ring))\n const item: HitItem = {\n name: ring.data.name,\n seriesIndex: ring.index,\n value: ring.value,\n text: `${value(ring.value)} (${share.format(fraction(ring))})`,\n x: cx + x,\n y: cy + y,\n }\n if (ring.data.color) item.color = ring.data.color\n return {\n index: ring.position,\n label: ring.data.name,\n title: '',\n x: cx + x,\n area: { x: cx - outer, y: cy - outer, width: outer * 2, height: outer * 2 },\n items: [item],\n seriesIndex: ring.index,\n // The value arc, slightly enlarged.\n mark: { d: arcPathStable(geometry(ring, 2)), x: cx, y: cy },\n }\n }\n\n const interaction: Interaction = {\n count: rings.length,\n hitIndex: (position) => {\n const ring = rings[position]\n return ring ? hitFor(ring) : null\n },\n hitTest(px, py) {\n const r = Math.hypot(px - cx, py - cy)\n const ring = rings.find((ring) => {\n const { innerRadius, outerRadius } = radii(ring, 2)\n return r >= innerRadius && r <= outerRadius\n })\n return ring ? hitFor(ring) : null\n },\n }\n ctx.onHitTest(interaction)\n\n const groups = rings.map((ring) =>\n h(\n 'g',\n groupAttrs(ring.data, ring.index),\n // Each path keeps its arc, so a new value (or a new shape of the gauge)\n // sweeps it around the center (see `sweep`).\n arcNode('tc-gauge-track', { ...geometry(ring), endAngle: start + sweep }),\n arcNode('tc-gauge-arc', geometry(ring)),\n ),\n )\n\n const centerValue = showCenter ? (center?.value ?? share.format(fraction(first))) : ''\n\n return [\n // Rings sit in their own group: the entrance animation transforms it, not the translated parent.\n h(\n 'g',\n { class: 'tc-gauge', style: `transform:translate(${cx}px,${cy}px)` },\n h('g', { class: 'tc-gauge-rings' }, groups),\n ),\n showCenter &&\n h(\n 'g',\n { class: 'tc-gauge-center', 'aria-hidden': 'true' },\n h(\n 'text',\n {\n class: 'tc-gauge-value',\n x: cx,\n y: cy,\n dy: centerLabel ? '0' : '0.35em',\n 'text-anchor': 'middle',\n },\n centerValue,\n ),\n centerLabel &&\n h(\n 'text',\n { class: 'tc-gauge-label', x: cx, y: cy, dy: '1.6em', 'text-anchor': 'middle' },\n centerLabel,\n ),\n ),\n ]\n}\n\nfunction gaugeTable(options: GaugeOptions, ctx: RenderContext): DataTable {\n const value = formatNumber(options.format, ctx.locale)\n const share = getNumberFormat(ctx.locale, { style: 'percent', maximumFractionDigits: 1 })\n return {\n columns: ['', 'Value', 'Share'],\n rows: layoutRings(options, ctx.hidden).map((ring) => [\n ring.data.name,\n value(ring.value),\n share.format(ring.max > 0 ? ring.value / ring.max : 0),\n ]),\n }\n}\n\n/**\n * Gauge (radial bar): progress towards a maximum as an arc on a track, with\n * the share in the middle. Several rings nest from the outside in.\n *\n * ```ts\n * new Chart('#el', { type: gauge, data: 58 })\n * new Chart('#el', { type: gauge, data: { name: 'completed', value: 1392, max: 2400 } })\n * ```\n */\nexport const gauge: ChartType<GaugeOptions> = {\n name: 'gauge',\n clean: cleanData((data) =>\n cleanItems(\n typeof data === 'number' ? [{ name: '', value: data }] : isRecord(data) ? [data] : data,\n ),\n ),\n render: (options, ctx): ChildInput => {\n // Set here, not as the module loads (see pie).\n features.sweep = sweepArcs\n return renderGauge(options, ctx)\n },\n legend: (options) => legendItems(ringsOf(options)),\n table: gaugeTable,\n}\n"],"mappings":";;;;;;;;;;AA2DA,MAAM,UAAU,KAAK,KAAK;AAW1B,SAAS,QAAQ,SAAoC;CACnD,MAAM,EAAE,SAAS;CACjB,IAAI,OAAO,SAAS,UAAU,OAAO,CAAC;EAAE,MAAM;EAAI,OAAO;CAAK,CAAC;CAC/D,OAAO,MAAM,QAAQ,IAAI,IAAK,OAAuB,CAAC,IAAiB;AACzE;;AAGA,SAAS,YAAY,SAAuB,QAAqC;CAC/E,MAAM,MAAM,QAAQ,OAAO;CAC3B,OAAO,QAAQ,OAAO,CAAC,CACpB,KAAK,MAAM,WAAW;EAAE;EAAM;EAAO,KAAK,KAAK,OAAO;CAAI,EAAE,CAAC,CAC7D,QAAQ,SAAS,CAAC,OAAO,IAAI,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,CAC/C,KAAK,MAAM,cAAc;EACxB,GAAG;EACH;EACA,OAAO,KAAK,IAAI,KAAK,KAAK,KAAK,IAAI,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC;CAC7D,EAAE;AACN;;;;;;AAOA,SAAS,SACP,MACA,OACA,OACA,SACA,YAC2C;CAG3C,MAAM,OAA2B,CAAC,CAAC,GAAG,CAAC,CAAC;CACxC,MAAM,MAAM,QAAQ;CACpB,KAAK,KAAK,CAAC,KAAK,IAAI,KAAK,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC;CAE9E,KAAK,IAAI,IAAI,KAAK,KAAK,QAAQ,OAAO,IAAI,SAAS,IAAI,GAAG,IAAI,KAAK,KAAK,MAAM,MAAM,KAAK;EACvF,KAAK,KAAK,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,CA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AG;CAAK,GACnE,EAAE,KAAK,EAAE,OAAO,iBAAiB,GAAG,MAAM,CAC5C,GACA,cACE,EACE,KACA;EAAE,OAAO;EAAmB,eAAe;CAAO,GAClD,EACE,QACA;EACE,OAAO;EACP,GAAG;EACH,GAAG;EACH,IAAI,cAAc,MAAM;EACxB,eAAe;CACjB,GACA,WACF,GACA,eACE,EACE,QACA;EAAE,OAAO;EAAkB,GAAG;EAAI,GAAG;EAAI,IAAI;EAAS,eAAe;CAAS,GAC9E,WACF,CACJ,CACJ;AACF;AAEA,SAAS,WAAW,SAAuB,KAA+B;CACxE,MAAM,QAAQ,aAAa,QAAQ,QAAQ,IAAI,MAAM;CACrD,MAAM,QAAQ,gBAAgB,IAAI,QAAQ;EAAE,OAAO;EAAW,uBAAuB;CAAE,CAAC;CACxF,OAAO;EACL,SAAS;GAAC;GAAI;GAAS;EAAO;EAC9B,MAAM,YAAY,SAAS,IAAI,MAAM,CAAC,CAAC,KAAK,SAAS;GACnD,KAAK,KAAK;GACV,MAAM,KAAK,KAAK;GAChB,MAAM,OAAO,KAAK,MAAM,IAAI,KAAK,QAAQ,KAAK,MAAM,CAAC;EACvD,CAAC;CACH;AACF;;;;;;;;;;AAWA,MAAa,QAAiC;CAC5C,MAAM;CACN,OAAO,WAAW,SAChB,WACE,OAAO,SAAS,WAAW,CAAC;EAAE,MAAM;EAAI,OAAO;CAAK,CAAC,IAAI,SAAS,IAAI,IAAI,CAAC,IAAI,IAAI,IACrF,CACF;CACA,SAAS,SAAS,QAAoB;EAEpC,SAAS,QAAQA;EACjB,OAAO,YAAY,SAAS,GAAG;CACjC;CACA,SAAS,YAAY,YAAY,QAAQ,OAAO,CAAC;CACjD,OAAO;AACT"}
@@ -1,6 +1,6 @@
1
1
  import { a as InsetsInput } from "./annotations-Bp7HwtF5.js";
2
2
  import { a as ClassValue } from "./vnode-BUflsBsa.js";
3
- import { a as ChartType } from "./chart-iJGxMz9z.js";
3
+ import { a as ChartType } from "./chart-DyN7bcx8.js";
4
4
  import { c as NumberFormat } from "./time-CHjiY9Q4.js";
5
5
  //#region src/charts/gauge.d.ts
6
6
  /** One ring of a gauge. */
@@ -62,4 +62,4 @@ interface GaugeOptions {
62
62
  declare const gauge: ChartType<GaugeOptions>;
63
63
  //#endregion
64
64
  export { GaugeRing as n, gauge as r, GaugeOptions as t };
65
- //# sourceMappingURL=gauge-Cu9jttC0.d.ts.map
65
+ //# sourceMappingURL=gauge-zpia05t2.d.ts.map
package/dist/gauge.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_gauge = require("./gauge-CEfkWXSu.cjs");
2
+ const require_gauge = require("./gauge-D-FYhuds.cjs");
3
3
  exports.gauge = require_gauge.gauge;
package/dist/gauge.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as GaugeRing, r as gauge, t as GaugeOptions } from "./gauge-Cu_OFxBd.cjs";
1
+ import { n as GaugeRing, r as gauge, t as GaugeOptions } from "./gauge-DP_EB2z3.cjs";
2
2
  export { type GaugeOptions, type GaugeRing, gauge };
package/dist/gauge.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as GaugeRing, r as gauge, t as GaugeOptions } from "./gauge-Cu9jttC0.js";
1
+ import { n as GaugeRing, r as gauge, t as GaugeOptions } from "./gauge-zpia05t2.js";
2
2
  export { type GaugeOptions, type GaugeRing, gauge };
package/dist/gauge.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as gauge } from "./gauge-_ljQHrMN.js";
1
+ import { t as gauge } from "./gauge-Dh423FHh.js";
2
2
  export { gauge };
@@ -1,5 +1,5 @@
1
1
  import { a as InsetsInput } from "./annotations-Bp7HwtF5.js";
2
- import { Q as CartesianData, a as ChartType, tt as Label } from "./chart-iJGxMz9z.js";
2
+ import { Q as CartesianData, a as ChartType, tt as Label } from "./chart-DyN7bcx8.js";
3
3
  import { c as NumberFormat } from "./time-CHjiY9Q4.js";
4
4
  //#region src/charts/heatmap.d.ts
5
5
  /** A band of values drawn in one color, with its own legend entry. */
@@ -78,4 +78,4 @@ interface HeatmapOptions {
78
78
  declare const heatmap: ChartType<HeatmapOptions>;
79
79
  //#endregion
80
80
  export { HeatmapRange as n, heatmap as r, HeatmapOptions as t };
81
- //# sourceMappingURL=heatmap-PhLPXIg1.d.ts.map
81
+ //# sourceMappingURL=heatmap-BectCEeE.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { a as InsetsInput } from "./annotations-lyt0I3HU.cjs";
2
- import { Q as CartesianData, a as ChartType, tt as Label } from "./chart-Qa417fJo.cjs";
2
+ import { Q as CartesianData, a as ChartType, tt as Label } from "./chart-D7ooEFnk.cjs";
3
3
  import { c as NumberFormat } from "./time-CNVnt-B2.cjs";
4
4
  //#region src/charts/heatmap.d.ts
5
5
  /** A band of values drawn in one color, with its own legend entry. */
@@ -78,4 +78,4 @@ interface HeatmapOptions {
78
78
  declare const heatmap: ChartType<HeatmapOptions>;
79
79
  //#endregion
80
80
  export { HeatmapRange as n, heatmap as r, HeatmapOptions as t };
81
- //# sourceMappingURL=heatmap-BwS-y0c6.d.cts.map
81
+ //# sourceMappingURL=heatmap-CCso6m61.d.cts.map
@@ -1,2 +1,2 @@
1
- import { n as HeatmapRange, r as heatmap, t as HeatmapOptions } from "./heatmap-BwS-y0c6.cjs";
1
+ import { n as HeatmapRange, r as heatmap, t as HeatmapOptions } from "./heatmap-CCso6m61.cjs";
2
2
  export { type HeatmapOptions, type HeatmapRange, heatmap };
package/dist/heatmap.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as HeatmapRange, r as heatmap, t as HeatmapOptions } from "./heatmap-PhLPXIg1.js";
1
+ import { n as HeatmapRange, r as heatmap, t as HeatmapOptions } from "./heatmap-BectCEeE.js";
2
2
  export { type HeatmapOptions, type HeatmapRange, heatmap };
package/dist/index.cjs CHANGED
@@ -18,16 +18,17 @@ const require_hydrate = require("./hydrate-CxwTXDqO.cjs");
18
18
  const require_morph = require("./morph-CqYDu1bY.cjs");
19
19
  const require_decimate = require("./decimate-tLhDk1ys.cjs");
20
20
  const require_fade = require("./fade-Cs74puQS.cjs");
21
- const require_core = require("./core-C7fPm6t7.cjs");
21
+ const require_core = require("./core-RzS9IQO5.cjs");
22
22
  const require_line = require("./line-fQbtP_jL.cjs");
23
23
  const require_area = require("./area-sHCE3pg5.cjs");
24
24
  const require_bar = require("./bar-DGuUN3nc.cjs");
25
25
  const require_bar$1 = require("./bar-C-7zR2qp.cjs");
26
26
  const require_candlestick = require("./candlestick-B5r1w3kc.cjs");
27
- const require_sweep = require("./sweep-Duowaput.cjs");
28
- const require_gauge = require("./gauge-CEfkWXSu.cjs");
27
+ const require_arc = require("./arc-BXpLrt9b.cjs");
28
+ const require_gauge = require("./gauge-D-FYhuds.cjs");
29
29
  const require_heatmap = require("./heatmap-BK18EBgJ.cjs");
30
- const require_pie = require("./pie-C1Pa6W_l.cjs");
30
+ const require_parliament = require("./parliament-CpWnoEvG.cjs");
31
+ const require_pie = require("./pie-BxTZt6Go.cjs");
31
32
  const require_radar = require("./radar-CoGUNNSb.cjs");
32
33
  const require_sankey = require("./sankey-Bacx4fVe.cjs");
33
34
  const require_scatter = require("./scatter-DgMN9zRy.cjs");
@@ -68,7 +69,8 @@ const types = {
68
69
  heatmap: require_heatmap.heatmap,
69
70
  candlestick: require_candlestick.candlestick,
70
71
  radar: require_radar.radar,
71
- sankey: require_sankey.sankey
72
+ sankey: require_sankey.sankey,
73
+ parliament: require_parliament.parliament
72
74
  };
73
75
  //#endregion
74
76
  //#region src/index.ts
@@ -112,8 +114,8 @@ require_features.addPost(require_value_labels.labelsStep);
112
114
  exports.Chart = Chart;
113
115
  exports.LINE_HEIGHT = require_layout.LINE_HEIGHT;
114
116
  exports.VERSION = require_core.VERSION;
115
- exports.arcCentroid = require_sweep.arcCentroid;
116
- exports.arcPathStable = require_sweep.arcPathStable;
117
+ exports.arcCentroid = require_arc.arcCentroid;
118
+ exports.arcPathStable = require_arc.arcPathStable;
117
119
  exports.area = require_area.area;
118
120
  exports.areaPath = require_fade.areaPath;
119
121
  exports.axis = require_cartesian.axis;
@@ -176,7 +178,8 @@ exports.lttbIndices = require_decimate.lttbIndices;
176
178
  exports.niceDomain = require_cartesian.niceDomain;
177
179
  exports.normalizeClass = require_vnode.normalizeClass;
178
180
  exports.normalizeStyle = require_vnode.normalizeStyle;
179
- exports.padAngleForGap = require_sweep.padAngleForGap;
181
+ exports.padAngleForGap = require_arc.padAngleForGap;
182
+ exports.parliament = require_parliament.parliament;
180
183
  exports.pie = require_pie.pie;
181
184
  exports.placeTooltip = require_core.placeTooltip;
182
185
  exports.point = require_cartesian.point;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["CoreChart","defaultPlugins","register","time","timePointScale","timeAxis","dateLabels","log","logDomain","logTicks","lttbIndices","annotationLayers","annotationValues","patternFills","markerPath","addPost","shapesStep","labelsStep"],"sources":["../src/chart-default.ts","../src/chart-types.ts","../src/index.ts"],"sourcesContent":["import { type ChartConfig, Chart as CoreChart } from './chart.ts'\nimport { defaultPlugins } from './plugins/index.ts'\n\n/**\n * A chart with every built-in plugin installed: hover highlight, legend,\n * tooltip, data table and keyboard navigation. Each can be switched off in\n * the config (`tooltip: false`, …). For the smallest bundle, use the bare\n * `Chart` from `@tabler/charts/core` and pick plugins explicitly.\n *\n * ```ts\n * const chart = new Chart('#sales', { type: line, data })\n * ```\n */\nexport class Chart<O extends object = object> extends CoreChart<O> {\n constructor(target: Element | string, config: ChartConfig<O>) {\n super(target, config, defaultPlugins())\n }\n}\n","import type { ChartType } from './chart.ts'\nimport { area } from './charts/area.ts'\nimport { bar } from './charts/bar.ts'\nimport { candlestick } from './charts/candlestick.ts'\nimport { gauge } from './charts/gauge.ts'\nimport { heatmap } from './charts/heatmap.ts'\nimport { line } from './charts/line.ts'\nimport { donut, pie } from './charts/pie.ts'\nimport { radar } from './charts/radar.ts'\nimport { sankey } from './charts/sankey.ts'\nimport { scatter } from './charts/scatter.ts'\nimport { sparkline } from './charts/sparkline.ts'\n\n/**\n * Every built-in chart type by its name, for charts declared in markup\n * (`<tabler-chart type=\"line\">`, `data-tc-chart=\"line\"`). Importing it\n * brings every type along: code that knows its types imports them directly.\n */\nexport const types: Readonly<Record<string, ChartType<never>>> = {\n line,\n area,\n bar,\n pie,\n donut,\n scatter,\n sparkline,\n gauge,\n heatmap,\n candlestick,\n radar,\n sankey,\n} as Record<string, ChartType<never>>\n","/**\n * `@tabler/charts`: everything from `@tabler/charts/core`, with a `Chart`\n * that installs the built-in plugins (tooltip, legend, keyboard, …) and\n * every optional feature registered (time and log axes, decimation,\n * annotations, pattern fills, value labels, point shapes). The one exception\n * is the `download` menu's saver: `import '@tabler/charts/export'` adds it,\n * so charts that never offer a download do not carry the export code.\n */\n\nimport { annotationLayers, annotationValues } from './charts/annotations.ts'\nimport { dateLabels } from './charts/dates.ts'\nimport { logDomain, logTicks } from './charts/log-axis.ts'\nimport { patternFills } from './charts/patterns.ts'\nimport { markerPath, shapesStep } from './charts/point-shapes.ts'\nimport { timeAxis } from './charts/time-axis.ts'\nimport { labelsStep } from './charts/value-labels.ts'\nimport { addPost, register } from './features.ts'\nimport { hydrate } from './render/hydrate.ts'\nimport { morph } from './render/morph.ts'\nimport { log } from './scales/log.ts'\nimport { time, timePointScale } from './scales/time.ts'\nimport { lttb, lttbIndices } from './shapes/decimate.ts'\nimport { areaPath, linePath } from './shapes/path.ts'\n\n// Registered here, in the entry itself, so no bundler can shake it away.\nregister({\n time: { scale: time, points: timePointScale, axis: timeAxis },\n dates: dateLabels,\n log: { scale: log, domain: logDomain, ticks: logTicks },\n decimate: lttbIndices,\n line: { linePath, areaPath },\n annotations: { layers: annotationLayers, values: annotationValues },\n patterns: patternFills,\n 'point-shapes': markerPath,\n hydrate,\n morph,\n})\n\n// Steps that finish the content: shapes first, then the labels over them.\naddPost(shapesStep)\naddPost(labelsStep)\n\nexport { Chart } from './chart-default.ts'\nexport { types } from './chart-types.ts'\nexport * from './core.ts'\nexport type { DownloadOptions, ExportOptions, ExportTarget, ImageOptions } from './export-chart.ts'\nexport { downloadChart, exportImage, exportSVG } from './export-chart.ts'\nexport type { LogScaleOptions } from './scales/log.ts'\nexport type { TimeScale, TimeScaleOptions, TimeValue } from './scales/time.ts'\nexport { log, lttb, lttbIndices, time, timePointScale }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAa,QAAb,cAAsDA,cAAAA,MAAa;CACjE,YAAY,QAA0B,QAAwB;EAC5D,MAAM,QAAQ,QAAQC,aAAAA,eAAe,CAAC;CACxC;AACF;;;;;;;;ACCA,MAAa,QAAoD;CAC/D,MAAA,aAAA;CACA,MAAA,aAAA;CACA,KAAA,cAAA;CACA,KAAA,YAAA;CACA,OAAA,YAAA;CACA,SAAA,gBAAA;CACA,WAAA,kBAAA;CACA,OAAA,cAAA;CACA,SAAA,gBAAA;CACA,aAAA,oBAAA;CACA,OAAA,cAAA;CACA,QAAA,eAAA;AACF;;;;;;;;;;;ACNAC,iBAAAA,SAAS;CACP,MAAM;EAAE,OAAOC,kBAAAA;EAAM,QAAQC,kBAAAA;EAAgB,MAAMC,kBAAAA;CAAS;CAC5D,OAAOC,cAAAA;CACP,KAAK;EAAE,OAAOC,iBAAAA;EAAK,QAAQC,iBAAAA;EAAW,OAAOC,iBAAAA;CAAS;CACtD,UAAUC,iBAAAA;CACV,MAAM;EAAE,UAAA,aAAA;EAAU,UAAA,aAAA;CAAS;CAC3B,aAAa;EAAE,QAAQC,oBAAAA;EAAkB,QAAQC,oBAAAA;CAAiB;CAClE,UAAUC,iBAAAA;CACV,gBAAgBC,qBAAAA;CAChB,SAAA,gBAAA;CACA,OAAA,cAAA;AACF,CAAC;AAGDC,iBAAAA,QAAQC,qBAAAA,UAAU;AAClBD,iBAAAA,QAAQE,qBAAAA,UAAU"}
1
+ {"version":3,"file":"index.cjs","names":["CoreChart","defaultPlugins","register","time","timePointScale","timeAxis","dateLabels","log","logDomain","logTicks","lttbIndices","annotationLayers","annotationValues","patternFills","markerPath","addPost","shapesStep","labelsStep"],"sources":["../src/chart-default.ts","../src/chart-types.ts","../src/index.ts"],"sourcesContent":["import { type ChartConfig, Chart as CoreChart } from './chart.ts'\nimport { defaultPlugins } from './plugins/index.ts'\n\n/**\n * A chart with every built-in plugin installed: hover highlight, legend,\n * tooltip, data table and keyboard navigation. Each can be switched off in\n * the config (`tooltip: false`, …). For the smallest bundle, use the bare\n * `Chart` from `@tabler/charts/core` and pick plugins explicitly.\n *\n * ```ts\n * const chart = new Chart('#sales', { type: line, data })\n * ```\n */\nexport class Chart<O extends object = object> extends CoreChart<O> {\n constructor(target: Element | string, config: ChartConfig<O>) {\n super(target, config, defaultPlugins())\n }\n}\n","import type { ChartType } from './chart.ts'\nimport { area } from './charts/area.ts'\nimport { bar } from './charts/bar.ts'\nimport { candlestick } from './charts/candlestick.ts'\nimport { gauge } from './charts/gauge.ts'\nimport { heatmap } from './charts/heatmap.ts'\nimport { line } from './charts/line.ts'\nimport { parliament } from './charts/parliament.ts'\nimport { donut, pie } from './charts/pie.ts'\nimport { radar } from './charts/radar.ts'\nimport { sankey } from './charts/sankey.ts'\nimport { scatter } from './charts/scatter.ts'\nimport { sparkline } from './charts/sparkline.ts'\n\n/**\n * Every built-in chart type by its name, for charts declared in markup\n * (`<tabler-chart type=\"line\">`, `data-tc-chart=\"line\"`). Importing it\n * brings every type along: code that knows its types imports them directly.\n */\nexport const types: Readonly<Record<string, ChartType<never>>> = {\n line,\n area,\n bar,\n pie,\n donut,\n scatter,\n sparkline,\n gauge,\n heatmap,\n candlestick,\n radar,\n sankey,\n parliament,\n} as Record<string, ChartType<never>>\n","/**\n * `@tabler/charts`: everything from `@tabler/charts/core`, with a `Chart`\n * that installs the built-in plugins (tooltip, legend, keyboard, …) and\n * every optional feature registered (time and log axes, decimation,\n * annotations, pattern fills, value labels, point shapes). The one exception\n * is the `download` menu's saver: `import '@tabler/charts/export'` adds it,\n * so charts that never offer a download do not carry the export code.\n */\n\nimport { annotationLayers, annotationValues } from './charts/annotations.ts'\nimport { dateLabels } from './charts/dates.ts'\nimport { logDomain, logTicks } from './charts/log-axis.ts'\nimport { patternFills } from './charts/patterns.ts'\nimport { markerPath, shapesStep } from './charts/point-shapes.ts'\nimport { timeAxis } from './charts/time-axis.ts'\nimport { labelsStep } from './charts/value-labels.ts'\nimport { addPost, register } from './features.ts'\nimport { hydrate } from './render/hydrate.ts'\nimport { morph } from './render/morph.ts'\nimport { log } from './scales/log.ts'\nimport { time, timePointScale } from './scales/time.ts'\nimport { lttb, lttbIndices } from './shapes/decimate.ts'\nimport { areaPath, linePath } from './shapes/path.ts'\n\n// Registered here, in the entry itself, so no bundler can shake it away.\nregister({\n time: { scale: time, points: timePointScale, axis: timeAxis },\n dates: dateLabels,\n log: { scale: log, domain: logDomain, ticks: logTicks },\n decimate: lttbIndices,\n line: { linePath, areaPath },\n annotations: { layers: annotationLayers, values: annotationValues },\n patterns: patternFills,\n 'point-shapes': markerPath,\n hydrate,\n morph,\n})\n\n// Steps that finish the content: shapes first, then the labels over them.\naddPost(shapesStep)\naddPost(labelsStep)\n\nexport { Chart } from './chart-default.ts'\nexport { types } from './chart-types.ts'\nexport * from './core.ts'\nexport type { DownloadOptions, ExportOptions, ExportTarget, ImageOptions } from './export-chart.ts'\nexport { downloadChart, exportImage, exportSVG } from './export-chart.ts'\nexport type { LogScaleOptions } from './scales/log.ts'\nexport type { TimeScale, TimeScaleOptions, TimeValue } from './scales/time.ts'\nexport { log, lttb, lttbIndices, time, timePointScale }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAa,QAAb,cAAsDA,cAAAA,MAAa;CACjE,YAAY,QAA0B,QAAwB;EAC5D,MAAM,QAAQ,QAAQC,aAAAA,eAAe,CAAC;CACxC;AACF;;;;;;;;ACEA,MAAa,QAAoD;CAC/D,MAAA,aAAA;CACA,MAAA,aAAA;CACA,KAAA,cAAA;CACA,KAAA,YAAA;CACA,OAAA,YAAA;CACA,SAAA,gBAAA;CACA,WAAA,kBAAA;CACA,OAAA,cAAA;CACA,SAAA,gBAAA;CACA,aAAA,oBAAA;CACA,OAAA,cAAA;CACA,QAAA,eAAA;CACA,YAAA,mBAAA;AACF;;;;;;;;;;;ACRAC,iBAAAA,SAAS;CACP,MAAM;EAAE,OAAOC,kBAAAA;EAAM,QAAQC,kBAAAA;EAAgB,MAAMC,kBAAAA;CAAS;CAC5D,OAAOC,cAAAA;CACP,KAAK;EAAE,OAAOC,iBAAAA;EAAK,QAAQC,iBAAAA;EAAW,OAAOC,iBAAAA;CAAS;CACtD,UAAUC,iBAAAA;CACV,MAAM;EAAE,UAAA,aAAA;EAAU,UAAA,aAAA;CAAS;CAC3B,aAAa;EAAE,QAAQC,oBAAAA;EAAkB,QAAQC,oBAAAA;CAAiB;CAClE,UAAUC,iBAAAA;CACV,gBAAgBC,qBAAAA;CAChB,SAAA,gBAAA;CACA,OAAA,cAAA;AACF,CAAC;AAGDC,iBAAAA,QAAQC,qBAAAA,UAAU;AAClBD,iBAAAA,QAAQE,qBAAAA,UAAU"}
package/dist/index.d.cts CHANGED
@@ -1,22 +1,23 @@
1
1
  import { a as InsetsInput, c as estimateTextWidth, i as Insets, l as innerRect, o as LINE_HEIGHT, s as Rect, t as Annotation, u as insets } from "./annotations-lyt0I3HU.cjs";
2
2
  import { a as point, i as band, n as BandScale, r as BandScaleOptions, t as BandKey } from "./band-DTcNDAFO.cjs";
3
3
  import { a as ClassValue, c as StyleValue, d as normalizeClass, f as normalizeStyle, i as ChildInput, l as VNode, n as Attrs, o as Key, r as Child, s as Props, t as AttrValue, u as h } from "./vnode-BUflsBsa.cjs";
4
- import { $ as CartesianOptions, B as downloadChart, C as DownloadOption, Ct as HitTester, D as ChartPlugin, E as BeforeRenderState, F as register, H as exportSVG, I as DownloadOptions, J as LegendItem, L as ExportOptions, M as Features, N as feature, O as PluginInstance, P as features, Q as CartesianData, R as ExportTarget, S as DownloadMenuOptions, St as HitItem, T as AfterRenderState, V as exportImage, X as defaultHidden, Y as LegendOptions, Z as legendContent, _ as TooltipPlacement, _t as thinTicks, a as ChartType, at as domainOf, b as tooltipContent, bt as tableContent, c as Size, ct as seriesTable, d as chartLabel, dt as LinearTicksOptions, et as CategoryAxisOptions, f as chartToString, ft as Tick, g as TooltipOptions, gt as linearTicks, h as resolveSize, ht as bandTicks, i as ChartEvents, it as categoryInteraction, l as buildChart, lt as AxisOptions, m as resolveLegend, mt as axisSize, n as Chart$1, nt as Series, o as RenderContext, ot as seriesKey, p as renderContext, pt as axis, r as ChartConfig, rt as ValueAxisOptions, s as ResolvedLegend, st as seriesLegend, t as BaseOptions, tt as Label, u as chartEvents, ut as AxisPosition, v as hitAnchor, vt as DataTable, w as download, wt as Interaction, x as DownloadFormat, xt as Hit, y as placeTooltip, yt as describeHit, z as ImageOptions } from "./chart-Qa417fJo.cjs";
4
+ import { $ as CartesianOptions, B as downloadChart, C as DownloadOption, Ct as HitTester, D as ChartPlugin, E as BeforeRenderState, F as register, H as exportSVG, I as DownloadOptions, J as LegendItem, L as ExportOptions, M as Features, N as feature, O as PluginInstance, P as features, Q as CartesianData, R as ExportTarget, S as DownloadMenuOptions, St as HitItem, T as AfterRenderState, V as exportImage, X as defaultHidden, Y as LegendOptions, Z as legendContent, _ as TooltipPlacement, _t as thinTicks, a as ChartType, at as domainOf, b as tooltipContent, bt as tableContent, c as Size, ct as seriesTable, d as chartLabel, dt as LinearTicksOptions, et as CategoryAxisOptions, f as chartToString, ft as Tick, g as TooltipOptions, gt as linearTicks, h as resolveSize, ht as bandTicks, i as ChartEvents, it as categoryInteraction, l as buildChart, lt as AxisOptions, m as resolveLegend, mt as axisSize, n as Chart$1, nt as Series, o as RenderContext, ot as seriesKey, p as renderContext, pt as axis, r as ChartConfig, rt as ValueAxisOptions, s as ResolvedLegend, st as seriesLegend, t as BaseOptions, tt as Label, u as chartEvents, ut as AxisPosition, v as hitAnchor, vt as DataTable, w as download, wt as Interaction, x as DownloadFormat, xt as Hit, y as placeTooltip, yt as describeHit, z as ImageOptions } from "./chart-D7ooEFnk.cjs";
5
5
  import { a as timePointScale, c as NumberFormat, d as formatDetail, f as formatNumber, g as stepPrecision, h as getNumberFormat, i as time, l as NumberFormatOptions, m as getDateFormat, n as TimeScaleOptions, o as DateFormat, p as formatTicks, r as TimeValue, s as Locale, t as TimeScale, u as formatDate } from "./time-CNVnt-B2.cjs";
6
6
  import { a as linear, i as LinearScaleOptions, n as log, r as LinearScale, t as LogScaleOptions } from "./log-CaofN3-n.cjs";
7
- import { A as arcCentroid, C as keyboard, D as GridOptions, E as hoverUnderlay, M as padAngleForGap, O as grid, S as legend, T as hoverOverlay, _ as defaultPlugins, a as flush, b as sync, c as tickIncrement, d as extent, f as RenderToStringOptions, g as render, h as renderToString, i as cancel, j as arcPathStable, k as ArcOptions, l as tickStep, m as escapeText, n as barPath, o as schedule, p as escapeAttr, r as hbarPath, s as niceDomain, t as VERSION, u as ticks, v as tooltip, w as highlight, x as pointer, y as dataTable } from "./core-CnGFKojH.cjs";
7
+ import { A as arcCentroid, C as keyboard, D as GridOptions, E as hoverUnderlay, M as padAngleForGap, O as grid, S as legend, T as hoverOverlay, _ as defaultPlugins, a as flush, b as sync, c as tickIncrement, d as extent, f as RenderToStringOptions, g as render, h as renderToString, i as cancel, j as arcPathStable, k as ArcOptions, l as tickStep, m as escapeText, n as barPath, o as schedule, p as escapeAttr, r as hbarPath, s as niceDomain, t as VERSION, u as ticks, v as tooltip, w as highlight, x as pointer, y as dataTable } from "./core-D1vO1LrC.cjs";
8
8
  import { a as linePath, i as areaPath, n as PathOptions, r as Point, t as Curve } from "./path-CwB28da0.cjs";
9
- import { n as line, t as LineOptions } from "./line-CMDGH6q5.cjs";
10
- import { n as area, t as AreaOptions } from "./area-BFvkc-ZM.cjs";
11
- import { n as bar, t as BarOptions } from "./bar-a0h9KC8A.cjs";
12
- import { n as CandlestickOptions, r as candlestick, t as Candle } from "./candlestick-BKdPyorY.cjs";
13
- import { n as GaugeRing, r as gauge, t as GaugeOptions } from "./gauge-Cu_OFxBd.cjs";
14
- import { n as HeatmapRange, r as heatmap, t as HeatmapOptions } from "./heatmap-BwS-y0c6.cjs";
15
- import { i as pie, n as PieSlice, r as donut, t as PieOptions } from "./pie-DnQQmxkk.cjs";
16
- import { n as RadialAxisOptions, r as radar, t as RadarOptions } from "./radar-BB13CGmq.cjs";
17
- import { a as sankey, i as SankeyOptions, n as SankeyLink, r as SankeyNode, t as SankeyData } from "./sankey-B9JYnx7e.cjs";
18
- import { i as scatter, n as ScatterPoint, r as ScatterSeries, t as ScatterOptions } from "./scatter-DrJ8xYz4.cjs";
19
- import { n as sparkline, t as SparklineOptions } from "./sparkline-BG13V4Pz.cjs";
9
+ import { n as line, t as LineOptions } from "./line-W7VD_qs1.cjs";
10
+ import { n as area, t as AreaOptions } from "./area-DIxaAbYZ.cjs";
11
+ import { n as bar, t as BarOptions } from "./bar-CRKLDg98.cjs";
12
+ import { n as CandlestickOptions, r as candlestick, t as Candle } from "./candlestick-__pXl_pV.cjs";
13
+ import { n as GaugeRing, r as gauge, t as GaugeOptions } from "./gauge-DP_EB2z3.cjs";
14
+ import { n as HeatmapRange, r as heatmap, t as HeatmapOptions } from "./heatmap-CCso6m61.cjs";
15
+ import { n as ParliamentParty, r as parliament, t as ParliamentOptions } from "./parliament-DdrLVZwt.cjs";
16
+ import { i as pie, n as PieSlice, r as donut, t as PieOptions } from "./pie-BF9yI5mE.cjs";
17
+ import { n as RadialAxisOptions, r as radar, t as RadarOptions } from "./radar-DBW4O0Vt.cjs";
18
+ import { a as sankey, i as SankeyOptions, n as SankeyLink, r as SankeyNode, t as SankeyData } from "./sankey-DuGI3Qc5.cjs";
19
+ import { i as scatter, n as ScatterPoint, r as ScatterSeries, t as ScatterOptions } from "./scatter-DbxLyZX0.cjs";
20
+ import { n as sparkline, t as SparklineOptions } from "./sparkline-CWlJDKyh.cjs";
20
21
  import { n as lttbIndices, t as lttb } from "./decimate-CNSpgGa5.cjs";
21
22
  //#region src/chart-default.d.ts
22
23
  /**
@@ -41,5 +42,5 @@ export declare class Chart<O extends object = object> extends Chart$1<O> {
41
42
  */
42
43
  export declare const types: Readonly<Record<string, ChartType<never>>>;
43
44
  //#endregion
44
- export { type AfterRenderState, type Annotation, type ArcOptions, type AreaOptions, type AttrValue, type Attrs, type AxisOptions, type AxisPosition, type BandKey, type BandScale, type BandScaleOptions, type BarOptions, type BaseOptions, type BeforeRenderState, type Candle, type CandlestickOptions, type CartesianData, type CartesianOptions, type CategoryAxisOptions, type ChartConfig, type ChartEvents, type ChartPlugin, type ChartType, type Child, type ChildInput, type ClassValue, type Curve, type DataTable, type DateFormat, type DownloadFormat, type DownloadMenuOptions, type DownloadOption, type DownloadOptions, type ExportOptions, type ExportTarget, type Features, type GaugeOptions, type GaugeRing, type GridOptions, type HeatmapOptions, type HeatmapRange, type Hit, type HitItem, type HitTester, type ImageOptions, type Insets, type InsetsInput, type Interaction, type Key, LINE_HEIGHT, type Label, type LegendItem, type LegendOptions, type LineOptions, type LinearScale, type LinearScaleOptions, type LinearTicksOptions, type Locale, type LogScaleOptions, type NumberFormat, type NumberFormatOptions, type PathOptions, type PieOptions, type PieSlice, type PluginInstance, type Point, type Props, type RadarOptions, type RadialAxisOptions, type Rect, type RenderContext, type RenderToStringOptions, type ResolvedLegend, type SankeyData, type SankeyLink, type SankeyNode, type SankeyOptions, type ScatterOptions, type ScatterPoint, type ScatterSeries, type Series, type Size, type SparklineOptions, type StyleValue, type Tick, type TimeScale, type TimeScaleOptions, type TimeValue, type TooltipOptions, type TooltipPlacement, VERSION, type VNode, type ValueAxisOptions, arcCentroid, arcPathStable, area, areaPath, axis, axisSize, band, bandTicks, bar, barPath, buildChart, cancel, candlestick, categoryInteraction, chartEvents, chartLabel, chartToString, dataTable, defaultHidden, defaultPlugins, describeHit, domainOf, donut, download, downloadChart, escapeAttr, escapeText, estimateTextWidth, exportImage, exportSVG, extent, feature, features, flush, formatDate, formatDetail, formatNumber, formatTicks, gauge, getDateFormat, getNumberFormat, grid, h, hbarPath, heatmap, highlight, hitAnchor, hoverOverlay, hoverUnderlay, innerRect, insets, keyboard, legend, legendContent, line, linePath, linear, linearTicks, log, lttb, lttbIndices, niceDomain, normalizeClass, normalizeStyle, padAngleForGap, pie, placeTooltip, point, pointer, radar, register, render, renderContext, renderToString, resolveLegend, resolveSize, sankey, scatter, schedule, seriesKey, seriesLegend, seriesTable, sparkline, stepPrecision, sync, tableContent, thinTicks, tickIncrement, tickStep, ticks, time, timePointScale, tooltip, tooltipContent };
45
+ export { type AfterRenderState, type Annotation, type ArcOptions, type AreaOptions, type AttrValue, type Attrs, type AxisOptions, type AxisPosition, type BandKey, type BandScale, type BandScaleOptions, type BarOptions, type BaseOptions, type BeforeRenderState, type Candle, type CandlestickOptions, type CartesianData, type CartesianOptions, type CategoryAxisOptions, type ChartConfig, type ChartEvents, type ChartPlugin, type ChartType, type Child, type ChildInput, type ClassValue, type Curve, type DataTable, type DateFormat, type DownloadFormat, type DownloadMenuOptions, type DownloadOption, type DownloadOptions, type ExportOptions, type ExportTarget, type Features, type GaugeOptions, type GaugeRing, type GridOptions, type HeatmapOptions, type HeatmapRange, type Hit, type HitItem, type HitTester, type ImageOptions, type Insets, type InsetsInput, type Interaction, type Key, LINE_HEIGHT, type Label, type LegendItem, type LegendOptions, type LineOptions, type LinearScale, type LinearScaleOptions, type LinearTicksOptions, type Locale, type LogScaleOptions, type NumberFormat, type NumberFormatOptions, type ParliamentOptions, type ParliamentParty, type PathOptions, type PieOptions, type PieSlice, type PluginInstance, type Point, type Props, type RadarOptions, type RadialAxisOptions, type Rect, type RenderContext, type RenderToStringOptions, type ResolvedLegend, type SankeyData, type SankeyLink, type SankeyNode, type SankeyOptions, type ScatterOptions, type ScatterPoint, type ScatterSeries, type Series, type Size, type SparklineOptions, type StyleValue, type Tick, type TimeScale, type TimeScaleOptions, type TimeValue, type TooltipOptions, type TooltipPlacement, VERSION, type VNode, type ValueAxisOptions, arcCentroid, arcPathStable, area, areaPath, axis, axisSize, band, bandTicks, bar, barPath, buildChart, cancel, candlestick, categoryInteraction, chartEvents, chartLabel, chartToString, dataTable, defaultHidden, defaultPlugins, describeHit, domainOf, donut, download, downloadChart, escapeAttr, escapeText, estimateTextWidth, exportImage, exportSVG, extent, feature, features, flush, formatDate, formatDetail, formatNumber, formatTicks, gauge, getDateFormat, getNumberFormat, grid, h, hbarPath, heatmap, highlight, hitAnchor, hoverOverlay, hoverUnderlay, innerRect, insets, keyboard, legend, legendContent, line, linePath, linear, linearTicks, log, lttb, lttbIndices, niceDomain, normalizeClass, normalizeStyle, padAngleForGap, parliament, pie, placeTooltip, point, pointer, radar, register, render, renderContext, renderToString, resolveLegend, resolveSize, sankey, scatter, schedule, seriesKey, seriesLegend, seriesTable, sparkline, stepPrecision, sync, tableContent, thinTicks, tickIncrement, tickStep, ticks, time, timePointScale, tooltip, tooltipContent };
45
46
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,22 +1,23 @@
1
1
  import { a as InsetsInput, c as estimateTextWidth, i as Insets, l as innerRect, o as LINE_HEIGHT, s as Rect, t as Annotation, u as insets } from "./annotations-Bp7HwtF5.js";
2
2
  import { a as point, i as band, n as BandScale, r as BandScaleOptions, t as BandKey } from "./band-DTcNDAFO.js";
3
3
  import { a as ClassValue, c as StyleValue, d as normalizeClass, f as normalizeStyle, i as ChildInput, l as VNode, n as Attrs, o as Key, r as Child, s as Props, t as AttrValue, u as h } from "./vnode-BUflsBsa.js";
4
- import { $ as CartesianOptions, B as downloadChart, C as DownloadOption, Ct as HitTester, D as ChartPlugin, E as BeforeRenderState, F as register, H as exportSVG, I as DownloadOptions, J as LegendItem, L as ExportOptions, M as Features, N as feature, O as PluginInstance, P as features, Q as CartesianData, R as ExportTarget, S as DownloadMenuOptions, St as HitItem, T as AfterRenderState, V as exportImage, X as defaultHidden, Y as LegendOptions, Z as legendContent, _ as TooltipPlacement, _t as thinTicks, a as ChartType, at as domainOf, b as tooltipContent, bt as tableContent, c as Size, ct as seriesTable, d as chartLabel, dt as LinearTicksOptions, et as CategoryAxisOptions, f as chartToString, ft as Tick, g as TooltipOptions, gt as linearTicks, h as resolveSize, ht as bandTicks, i as ChartEvents, it as categoryInteraction, l as buildChart, lt as AxisOptions, m as resolveLegend, mt as axisSize, n as Chart$1, nt as Series, o as RenderContext, ot as seriesKey, p as renderContext, pt as axis, r as ChartConfig, rt as ValueAxisOptions, s as ResolvedLegend, st as seriesLegend, t as BaseOptions, tt as Label, u as chartEvents, ut as AxisPosition, v as hitAnchor, vt as DataTable, w as download, wt as Interaction, x as DownloadFormat, xt as Hit, y as placeTooltip, yt as describeHit, z as ImageOptions } from "./chart-iJGxMz9z.js";
4
+ import { $ as CartesianOptions, B as downloadChart, C as DownloadOption, Ct as HitTester, D as ChartPlugin, E as BeforeRenderState, F as register, H as exportSVG, I as DownloadOptions, J as LegendItem, L as ExportOptions, M as Features, N as feature, O as PluginInstance, P as features, Q as CartesianData, R as ExportTarget, S as DownloadMenuOptions, St as HitItem, T as AfterRenderState, V as exportImage, X as defaultHidden, Y as LegendOptions, Z as legendContent, _ as TooltipPlacement, _t as thinTicks, a as ChartType, at as domainOf, b as tooltipContent, bt as tableContent, c as Size, ct as seriesTable, d as chartLabel, dt as LinearTicksOptions, et as CategoryAxisOptions, f as chartToString, ft as Tick, g as TooltipOptions, gt as linearTicks, h as resolveSize, ht as bandTicks, i as ChartEvents, it as categoryInteraction, l as buildChart, lt as AxisOptions, m as resolveLegend, mt as axisSize, n as Chart$1, nt as Series, o as RenderContext, ot as seriesKey, p as renderContext, pt as axis, r as ChartConfig, rt as ValueAxisOptions, s as ResolvedLegend, st as seriesLegend, t as BaseOptions, tt as Label, u as chartEvents, ut as AxisPosition, v as hitAnchor, vt as DataTable, w as download, wt as Interaction, x as DownloadFormat, xt as Hit, y as placeTooltip, yt as describeHit, z as ImageOptions } from "./chart-DyN7bcx8.js";
5
5
  import { a as timePointScale, c as NumberFormat, d as formatDetail, f as formatNumber, g as stepPrecision, h as getNumberFormat, i as time, l as NumberFormatOptions, m as getDateFormat, n as TimeScaleOptions, o as DateFormat, p as formatTicks, r as TimeValue, s as Locale, t as TimeScale, u as formatDate } from "./time-CHjiY9Q4.js";
6
6
  import { a as linear, i as LinearScaleOptions, n as log, r as LinearScale, t as LogScaleOptions } from "./log-CaofN3-n.js";
7
- import { A as arcCentroid, C as keyboard, D as GridOptions, E as hoverUnderlay, M as padAngleForGap, O as grid, S as legend, T as hoverOverlay, _ as defaultPlugins, a as flush, b as sync, c as tickIncrement, d as extent, f as RenderToStringOptions, g as render, h as renderToString, i as cancel, j as arcPathStable, k as ArcOptions, l as tickStep, m as escapeText, n as barPath, o as schedule, p as escapeAttr, r as hbarPath, s as niceDomain, t as VERSION, u as ticks, v as tooltip, w as highlight, x as pointer, y as dataTable } from "./core-CjgbhS_v.js";
7
+ import { A as arcCentroid, C as keyboard, D as GridOptions, E as hoverUnderlay, M as padAngleForGap, O as grid, S as legend, T as hoverOverlay, _ as defaultPlugins, a as flush, b as sync, c as tickIncrement, d as extent, f as RenderToStringOptions, g as render, h as renderToString, i as cancel, j as arcPathStable, k as ArcOptions, l as tickStep, m as escapeText, n as barPath, o as schedule, p as escapeAttr, r as hbarPath, s as niceDomain, t as VERSION, u as ticks, v as tooltip, w as highlight, x as pointer, y as dataTable } from "./core-DcbemzGf.js";
8
8
  import { a as linePath, i as areaPath, n as PathOptions, r as Point, t as Curve } from "./path-CwB28da0.js";
9
- import { n as line, t as LineOptions } from "./line-D5kb8e6w.js";
10
- import { n as area, t as AreaOptions } from "./area-DaO4MQl4.js";
11
- import { n as bar, t as BarOptions } from "./bar-DdsDxk3W.js";
12
- import { n as CandlestickOptions, r as candlestick, t as Candle } from "./candlestick-BnUG1SGi.js";
13
- import { n as GaugeRing, r as gauge, t as GaugeOptions } from "./gauge-Cu9jttC0.js";
14
- import { n as HeatmapRange, r as heatmap, t as HeatmapOptions } from "./heatmap-PhLPXIg1.js";
15
- import { i as pie, n as PieSlice, r as donut, t as PieOptions } from "./pie-B8UlOZiq.js";
16
- import { n as RadialAxisOptions, r as radar, t as RadarOptions } from "./radar-pFI6fvOq.js";
17
- import { a as sankey, i as SankeyOptions, n as SankeyLink, r as SankeyNode, t as SankeyData } from "./sankey-Bm518bqL.js";
18
- import { i as scatter, n as ScatterPoint, r as ScatterSeries, t as ScatterOptions } from "./scatter-Bl7nasE6.js";
19
- import { n as sparkline, t as SparklineOptions } from "./sparkline-iWuXbKpd.js";
9
+ import { n as line, t as LineOptions } from "./line-CN4uZ9ZX.js";
10
+ import { n as area, t as AreaOptions } from "./area-CF__HOwL.js";
11
+ import { n as bar, t as BarOptions } from "./bar-BBM8RhoL.js";
12
+ import { n as CandlestickOptions, r as candlestick, t as Candle } from "./candlestick-D_vV0_XZ.js";
13
+ import { n as GaugeRing, r as gauge, t as GaugeOptions } from "./gauge-zpia05t2.js";
14
+ import { n as HeatmapRange, r as heatmap, t as HeatmapOptions } from "./heatmap-BectCEeE.js";
15
+ import { n as ParliamentParty, r as parliament, t as ParliamentOptions } from "./parliament-1Zv2Xh0D.js";
16
+ import { i as pie, n as PieSlice, r as donut, t as PieOptions } from "./pie-5z1fDdKO.js";
17
+ import { n as RadialAxisOptions, r as radar, t as RadarOptions } from "./radar-1-EryihA.js";
18
+ import { a as sankey, i as SankeyOptions, n as SankeyLink, r as SankeyNode, t as SankeyData } from "./sankey-OV_WoPrl.js";
19
+ import { i as scatter, n as ScatterPoint, r as ScatterSeries, t as ScatterOptions } from "./scatter-BqzgJqdX.js";
20
+ import { n as sparkline, t as SparklineOptions } from "./sparkline-BfyO_oNM.js";
20
21
  import { n as lttbIndices, t as lttb } from "./decimate-BGg9XgF0.js";
21
22
  //#region src/chart-default.d.ts
22
23
  /**
@@ -41,5 +42,5 @@ export declare class Chart<O extends object = object> extends Chart$1<O> {
41
42
  */
42
43
  export declare const types: Readonly<Record<string, ChartType<never>>>;
43
44
  //#endregion
44
- export { type AfterRenderState, type Annotation, type ArcOptions, type AreaOptions, type AttrValue, type Attrs, type AxisOptions, type AxisPosition, type BandKey, type BandScale, type BandScaleOptions, type BarOptions, type BaseOptions, type BeforeRenderState, type Candle, type CandlestickOptions, type CartesianData, type CartesianOptions, type CategoryAxisOptions, type ChartConfig, type ChartEvents, type ChartPlugin, type ChartType, type Child, type ChildInput, type ClassValue, type Curve, type DataTable, type DateFormat, type DownloadFormat, type DownloadMenuOptions, type DownloadOption, type DownloadOptions, type ExportOptions, type ExportTarget, type Features, type GaugeOptions, type GaugeRing, type GridOptions, type HeatmapOptions, type HeatmapRange, type Hit, type HitItem, type HitTester, type ImageOptions, type Insets, type InsetsInput, type Interaction, type Key, LINE_HEIGHT, type Label, type LegendItem, type LegendOptions, type LineOptions, type LinearScale, type LinearScaleOptions, type LinearTicksOptions, type Locale, type LogScaleOptions, type NumberFormat, type NumberFormatOptions, type PathOptions, type PieOptions, type PieSlice, type PluginInstance, type Point, type Props, type RadarOptions, type RadialAxisOptions, type Rect, type RenderContext, type RenderToStringOptions, type ResolvedLegend, type SankeyData, type SankeyLink, type SankeyNode, type SankeyOptions, type ScatterOptions, type ScatterPoint, type ScatterSeries, type Series, type Size, type SparklineOptions, type StyleValue, type Tick, type TimeScale, type TimeScaleOptions, type TimeValue, type TooltipOptions, type TooltipPlacement, VERSION, type VNode, type ValueAxisOptions, arcCentroid, arcPathStable, area, areaPath, axis, axisSize, band, bandTicks, bar, barPath, buildChart, cancel, candlestick, categoryInteraction, chartEvents, chartLabel, chartToString, dataTable, defaultHidden, defaultPlugins, describeHit, domainOf, donut, download, downloadChart, escapeAttr, escapeText, estimateTextWidth, exportImage, exportSVG, extent, feature, features, flush, formatDate, formatDetail, formatNumber, formatTicks, gauge, getDateFormat, getNumberFormat, grid, h, hbarPath, heatmap, highlight, hitAnchor, hoverOverlay, hoverUnderlay, innerRect, insets, keyboard, legend, legendContent, line, linePath, linear, linearTicks, log, lttb, lttbIndices, niceDomain, normalizeClass, normalizeStyle, padAngleForGap, pie, placeTooltip, point, pointer, radar, register, render, renderContext, renderToString, resolveLegend, resolveSize, sankey, scatter, schedule, seriesKey, seriesLegend, seriesTable, sparkline, stepPrecision, sync, tableContent, thinTicks, tickIncrement, tickStep, ticks, time, timePointScale, tooltip, tooltipContent };
45
+ export { type AfterRenderState, type Annotation, type ArcOptions, type AreaOptions, type AttrValue, type Attrs, type AxisOptions, type AxisPosition, type BandKey, type BandScale, type BandScaleOptions, type BarOptions, type BaseOptions, type BeforeRenderState, type Candle, type CandlestickOptions, type CartesianData, type CartesianOptions, type CategoryAxisOptions, type ChartConfig, type ChartEvents, type ChartPlugin, type ChartType, type Child, type ChildInput, type ClassValue, type Curve, type DataTable, type DateFormat, type DownloadFormat, type DownloadMenuOptions, type DownloadOption, type DownloadOptions, type ExportOptions, type ExportTarget, type Features, type GaugeOptions, type GaugeRing, type GridOptions, type HeatmapOptions, type HeatmapRange, type Hit, type HitItem, type HitTester, type ImageOptions, type Insets, type InsetsInput, type Interaction, type Key, LINE_HEIGHT, type Label, type LegendItem, type LegendOptions, type LineOptions, type LinearScale, type LinearScaleOptions, type LinearTicksOptions, type Locale, type LogScaleOptions, type NumberFormat, type NumberFormatOptions, type ParliamentOptions, type ParliamentParty, type PathOptions, type PieOptions, type PieSlice, type PluginInstance, type Point, type Props, type RadarOptions, type RadialAxisOptions, type Rect, type RenderContext, type RenderToStringOptions, type ResolvedLegend, type SankeyData, type SankeyLink, type SankeyNode, type SankeyOptions, type ScatterOptions, type ScatterPoint, type ScatterSeries, type Series, type Size, type SparklineOptions, type StyleValue, type Tick, type TimeScale, type TimeScaleOptions, type TimeValue, type TooltipOptions, type TooltipPlacement, VERSION, type VNode, type ValueAxisOptions, arcCentroid, arcPathStable, area, areaPath, axis, axisSize, band, bandTicks, bar, barPath, buildChart, cancel, candlestick, categoryInteraction, chartEvents, chartLabel, chartToString, dataTable, defaultHidden, defaultPlugins, describeHit, domainOf, donut, download, downloadChart, escapeAttr, escapeText, estimateTextWidth, exportImage, exportSVG, extent, feature, features, flush, formatDate, formatDetail, formatNumber, formatTicks, gauge, getDateFormat, getNumberFormat, grid, h, hbarPath, heatmap, highlight, hitAnchor, hoverOverlay, hoverUnderlay, innerRect, insets, keyboard, legend, legendContent, line, linePath, linear, linearTicks, log, lttb, lttbIndices, niceDomain, normalizeClass, normalizeStyle, padAngleForGap, parliament, pie, placeTooltip, point, pointer, radar, register, render, renderContext, renderToString, resolveLegend, resolveSize, sankey, scatter, schedule, seriesKey, seriesLegend, seriesTable, sparkline, stepPrecision, sync, tableContent, thinTicks, tickIncrement, tickStep, ticks, time, timePointScale, tooltip, tooltipContent };
45
46
  //# sourceMappingURL=index.d.ts.map