@nova-lab/charts 0.0.0-stage → 1.0.0-dev.32

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 (228) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +158 -2
  3. package/dist/GeometryIndex-DDQ34Jf4.js +104 -0
  4. package/dist/MarkSeries-CQCAnV4s.js +245 -0
  5. package/dist/aggregation.d.ts +6 -0
  6. package/dist/aggregation.js +124 -0
  7. package/dist/annotations.d.ts +34 -0
  8. package/dist/annotations.js +71 -0
  9. package/dist/api/camera.d.ts +8 -0
  10. package/dist/api/cartesian.d.ts +21 -0
  11. package/dist/api/events.d.ts +13 -0
  12. package/dist/api/font.d.ts +3 -0
  13. package/dist/api/handle.d.ts +5 -0
  14. package/dist/api/host.d.ts +23 -0
  15. package/dist/api/internal.d.ts +41 -0
  16. package/dist/api/map-background.d.ts +12 -0
  17. package/dist/api/mark-paint.d.ts +5 -0
  18. package/dist/api/mark-style.d.ts +4 -0
  19. package/dist/api/navigation.d.ts +4 -0
  20. package/dist/api/overlay.d.ts +7 -0
  21. package/dist/api/partition.d.ts +11 -0
  22. package/dist/api/scene.d.ts +42 -0
  23. package/dist/api/state.d.ts +34 -0
  24. package/dist/api/types.d.ts +743 -0
  25. package/dist/area.d.ts +9 -0
  26. package/dist/area.js +706 -0
  27. package/dist/bar.d.ts +9 -0
  28. package/dist/bar.js +554 -0
  29. package/dist/brush.d.ts +17 -0
  30. package/dist/brush.js +86 -0
  31. package/dist/bubble.d.ts +8 -0
  32. package/dist/bubble.js +434 -0
  33. package/dist/camera-CUJAMfpx.js +57 -0
  34. package/dist/candlestick.d.ts +8 -0
  35. package/dist/candlestick.js +42 -0
  36. package/dist/cartesian-k_WIYsGp.js +1139 -0
  37. package/dist/chart-runtime-resolver-DwwXp3X8.js +20 -0
  38. package/dist/chart-series-runtime-C0P7h8Tl.js +127 -0
  39. package/dist/charts.js +1 -0
  40. package/dist/composed.d.ts +2 -0
  41. package/dist/composed.js +4 -0
  42. package/dist/crosshair.d.ts +23 -0
  43. package/dist/crosshair.js +60 -0
  44. package/dist/donut.d.ts +5 -0
  45. package/dist/donut.js +7 -0
  46. package/dist/funnel.d.ts +5 -0
  47. package/dist/funnel.js +40 -0
  48. package/dist/graph.d.ts +6 -0
  49. package/dist/graph.js +260 -0
  50. package/dist/heatmap.d.ts +8 -0
  51. package/dist/heatmap.js +37 -0
  52. package/dist/host-DLDeDU5k.js +4373 -0
  53. package/dist/index.d.ts +1 -0
  54. package/dist/internal-I5BDhahD.js +4 -0
  55. package/dist/layout-donut-BG4ubBtU.js +39 -0
  56. package/dist/line.d.ts +9 -0
  57. package/dist/line.js +452 -0
  58. package/dist/mark-paint-CMHKGegE.js +14 -0
  59. package/dist/mark-style-Cpl-ARQM.js +10 -0
  60. package/dist/model/area/create-area-series-layout.d.ts +15 -0
  61. package/dist/model/area/hit-test-area-layout.d.ts +2 -0
  62. package/dist/model/axis/ChartAxisModel.d.ts +28 -0
  63. package/dist/model/bar/create-bar-series-layout.d.ts +19 -0
  64. package/dist/model/bar/hit-test-bar-layout.d.ts +2 -0
  65. package/dist/model/bubble/create-bubble-series-layout.d.ts +15 -0
  66. package/dist/model/bubble/hit-test-bubble-layout.d.ts +2 -0
  67. package/dist/model/cartesian/append-line-contours.d.ts +4 -0
  68. package/dist/model/cartesian/axis-line-batch.d.ts +3 -0
  69. package/dist/model/cartesian/numeric-window.d.ts +7 -0
  70. package/dist/model/cartesian/point-series.d.ts +54 -0
  71. package/dist/model/cartesian/sample-extrema.d.ts +7 -0
  72. package/dist/model/cartesian/smooth-y.d.ts +4 -0
  73. package/dist/model/cartesian/translation-window.d.ts +17 -0
  74. package/dist/model/context/nova-chart-runtime.d.ts +54 -0
  75. package/dist/model/customization/chart-customization.d.ts +47 -0
  76. package/dist/model/customization/chart-presets.d.ts +6 -0
  77. package/dist/model/customization/chart-style-sheet.d.ts +9 -0
  78. package/dist/model/data/ChartDataStore.d.ts +113 -0
  79. package/dist/model/exploration/create-graph-layout.d.ts +11 -0
  80. package/dist/model/exploration/exploration-chart.types.d.ts +150 -0
  81. package/dist/model/exploration/force-layout.d.ts +9 -0
  82. package/dist/model/exploration/presets/airplane.d.ts +2 -0
  83. package/dist/model/exploration/presets/apartment.d.ts +2 -0
  84. package/dist/model/exploration/presets/botanical-park.d.ts +2 -0
  85. package/dist/model/exploration/presets/ferry.d.ts +2 -0
  86. package/dist/model/exploration/presets/ice-arena.d.ts +2 -0
  87. package/dist/model/exploration/presets/planetarium.d.ts +2 -0
  88. package/dist/model/exploration/presets/science-museum.d.ts +2 -0
  89. package/dist/model/exploration/presets/train.d.ts +2 -0
  90. package/dist/model/exploration/route-geometry.d.ts +9 -0
  91. package/dist/model/exploration/seat-shape.d.ts +7 -0
  92. package/dist/model/interaction/GeometryIndex.d.ts +14 -0
  93. package/dist/model/line/create-line-series-layout.d.ts +15 -0
  94. package/dist/model/line/hit-test-line-layout.d.ts +2 -0
  95. package/dist/model/novel/create-novel-layout.d.ts +5 -0
  96. package/dist/model/novel/hit-test-novel-layout.d.ts +3 -0
  97. package/dist/model/novel/layout-candlestick.d.ts +3 -0
  98. package/dist/model/novel/layout-donut.d.ts +3 -0
  99. package/dist/model/novel/layout-funnel.d.ts +3 -0
  100. package/dist/model/novel/layout-heatmap.d.ts +3 -0
  101. package/dist/model/novel/layout-input.d.ts +12 -0
  102. package/dist/model/novel/layout-radar.d.ts +3 -0
  103. package/dist/model/novel/layout-tree.d.ts +3 -0
  104. package/dist/model/novel/layout-treemap.d.ts +3 -0
  105. package/dist/model/novel/layout-values.d.ts +10 -0
  106. package/dist/model/novel/novel-chart.types.d.ts +140 -0
  107. package/dist/model/novel/novel-domains.d.ts +5 -0
  108. package/dist/model/scale/BandScale.d.ts +86 -0
  109. package/dist/model/scale/ChartScaleRegistry.d.ts +45 -0
  110. package/dist/model/scale/LinearScale.d.ts +48 -0
  111. package/dist/model/scale/TimeScale.d.ts +48 -0
  112. package/dist/model/scale/create-chart-scale.d.ts +3 -0
  113. package/dist/model/scale/resolve-chart-scale.d.ts +5 -0
  114. package/dist/model/scatter/create-scatter-series-layout.d.ts +14 -0
  115. package/dist/model/scatter/hit-test-scatter-layout.d.ts +4 -0
  116. package/dist/model/time/calendar-time.d.ts +16 -0
  117. package/dist/model/types/chart-axis.types.d.ts +43 -0
  118. package/dist/model/types/chart-components.types.d.ts +1393 -0
  119. package/dist/model/types/chart-scale.types.d.ts +78 -0
  120. package/dist/model/viewport-controller/viewport-controller.d.ts +5 -0
  121. package/dist/novel-domains-DBpA_AOT.js +24 -0
  122. package/dist/partition-D-0LTCr3.js +221 -0
  123. package/dist/presets/route-map/apartment.d.ts +2 -0
  124. package/dist/presets/route-map/apartment.js +116 -0
  125. package/dist/presets/route-map/botanical-park.d.ts +2 -0
  126. package/dist/presets/route-map/botanical-park.js +116 -0
  127. package/dist/presets/route-map/science-museum.d.ts +2 -0
  128. package/dist/presets/route-map/science-museum.js +45 -0
  129. package/dist/presets/seat-map/airplane.d.ts +2 -0
  130. package/dist/presets/seat-map/airplane.js +95 -0
  131. package/dist/presets/seat-map/ferry.d.ts +2 -0
  132. package/dist/presets/seat-map/ferry.js +54 -0
  133. package/dist/presets/seat-map/ice-arena.d.ts +2 -0
  134. package/dist/presets/seat-map/ice-arena.js +67 -0
  135. package/dist/presets/seat-map/planetarium.d.ts +2 -0
  136. package/dist/presets/seat-map/planetarium.js +54 -0
  137. package/dist/presets/seat-map/train.d.ts +2 -0
  138. package/dist/presets/seat-map/train.js +66 -0
  139. package/dist/presets.d.ts +78 -0
  140. package/dist/presets.js +14 -0
  141. package/dist/public.d.ts +2 -0
  142. package/dist/radar.d.ts +5 -0
  143. package/dist/radar.js +47 -0
  144. package/dist/rose.d.ts +5 -0
  145. package/dist/rose.js +7 -0
  146. package/dist/route-map.d.ts +6 -0
  147. package/dist/route-map.js +200 -0
  148. package/dist/scatter.d.ts +8 -0
  149. package/dist/scatter.js +433 -0
  150. package/dist/scene-CPvPzTaB.js +137 -0
  151. package/dist/seat-map.d.ts +6 -0
  152. package/dist/seat-map.js +84 -0
  153. package/dist/seat-shape--kEFiUXX.js +66 -0
  154. package/dist/state-C5pICb11.js +134 -0
  155. package/dist/sync.d.ts +82 -0
  156. package/dist/sync.js +326 -0
  157. package/dist/translation-window-Ca_rCenJ.js +57 -0
  158. package/dist/tree.d.ts +6 -0
  159. package/dist/tree.js +114 -0
  160. package/dist/treemap.d.ts +5 -0
  161. package/dist/treemap.js +85 -0
  162. package/dist/ui/area-series/AreaSeries.d.ts +44 -0
  163. package/dist/ui/area-series/area-series.config.d.ts +10 -0
  164. package/dist/ui/area-series/area-series.registry.d.ts +4 -0
  165. package/dist/ui/axis/Axis.d.ts +55 -0
  166. package/dist/ui/axis/axis.config.d.ts +10 -0
  167. package/dist/ui/axis/axis.registry.d.ts +4 -0
  168. package/dist/ui/bar-chart/BarChart.d.ts +124 -0
  169. package/dist/ui/bar-chart/bar-chart.config.d.ts +10 -0
  170. package/dist/ui/bar-chart/bar-chart.registry.d.ts +2 -0
  171. package/dist/ui/bar-series/BarSeries.d.ts +102 -0
  172. package/dist/ui/bar-series/bar-series.config.d.ts +10 -0
  173. package/dist/ui/bar-series/bar-series.registry.d.ts +4 -0
  174. package/dist/ui/bubble-series/BubbleSeries.d.ts +33 -0
  175. package/dist/ui/bubble-series/bubble-series.config.d.ts +10 -0
  176. package/dist/ui/bubble-series/bubble-series.registry.d.ts +4 -0
  177. package/dist/ui/composed-chart/ComposedChart.d.ts +41 -0
  178. package/dist/ui/composed-chart/composed-chart.config.d.ts +10 -0
  179. package/dist/ui/composed-chart/composed-chart.registry.d.ts +4 -0
  180. package/dist/ui/exploration-chart/ExplorationChart.d.ts +83 -0
  181. package/dist/ui/exploration-chart/exploration-chart.config.d.ts +7 -0
  182. package/dist/ui/exploration-chart/exploration-chart.registry.d.ts +6 -0
  183. package/dist/ui/grid/Grid.d.ts +35 -0
  184. package/dist/ui/grid/grid.config.d.ts +10 -0
  185. package/dist/ui/grid/grid.registry.d.ts +4 -0
  186. package/dist/ui/interaction/Interaction.d.ts +53 -0
  187. package/dist/ui/interaction/interaction.config.d.ts +10 -0
  188. package/dist/ui/interaction/interaction.registry.d.ts +4 -0
  189. package/dist/ui/legend/Legend.d.ts +38 -0
  190. package/dist/ui/legend/legend.config.d.ts +10 -0
  191. package/dist/ui/legend/legend.registry.d.ts +2 -0
  192. package/dist/ui/line-series/LineSeries.d.ts +67 -0
  193. package/dist/ui/line-series/line-series.config.d.ts +10 -0
  194. package/dist/ui/line-series/line-series.registry.d.ts +4 -0
  195. package/dist/ui/mark-series/MarkSeries.d.ts +55 -0
  196. package/dist/ui/novel-series/NovelSeries.d.ts +34 -0
  197. package/dist/ui/novel-series/novel-series.config.d.ts +9 -0
  198. package/dist/ui/novel-series/novel-series.registry.d.ts +4 -0
  199. package/dist/ui/partition-chart/PartitionChart.d.ts +24 -0
  200. package/dist/ui/partition-chart/partition-chart.config.d.ts +7 -0
  201. package/dist/ui/partition-chart/partition-chart.registry.d.ts +9 -0
  202. package/dist/ui/plot/Plot.d.ts +64 -0
  203. package/dist/ui/plot/plot.config.d.ts +10 -0
  204. package/dist/ui/plot/plot.registry.d.ts +4 -0
  205. package/dist/ui/root/Root.d.ts +206 -0
  206. package/dist/ui/root/root.config.d.ts +10 -0
  207. package/dist/ui/root/root.registry.d.ts +5 -0
  208. package/dist/ui/scale/Scale.d.ts +55 -0
  209. package/dist/ui/scale/scale.config.d.ts +10 -0
  210. package/dist/ui/scale/scale.registry.d.ts +4 -0
  211. package/dist/ui/scatter-series/ScatterSeries.d.ts +33 -0
  212. package/dist/ui/scatter-series/scatter-series.config.d.ts +10 -0
  213. package/dist/ui/scatter-series/scatter-series.registry.d.ts +4 -0
  214. package/dist/ui/shared/chart-props.d.ts +150 -0
  215. package/dist/ui/shared/chart-runtime-resolver.d.ts +4 -0
  216. package/dist/ui/shared/chart-semantic-marks.d.ts +20 -0
  217. package/dist/ui/shared/chart-series-runtime.d.ts +48 -0
  218. package/dist/ui/shared/schema-types.d.ts +34 -0
  219. package/dist/ui/tooltip/Tooltip.d.ts +64 -0
  220. package/dist/ui/tooltip/tooltip.config.d.ts +10 -0
  221. package/dist/ui/tooltip/tooltip.registry.d.ts +4 -0
  222. package/dist/ui/viewport/Viewport.d.ts +81 -0
  223. package/dist/ui/viewport/viewport.config.d.ts +10 -0
  224. package/dist/ui/viewport/viewport.registry.d.ts +2 -0
  225. package/dist/ui/viewport-controller/ViewportController.d.ts +30 -0
  226. package/dist/ui/viewport-controller/viewport-controller.config.d.ts +10 -0
  227. package/dist/ui/viewport-controller/viewport-controller.registry.d.ts +2 -0
  228. package/package.json +179 -4
package/dist/area.js ADDED
@@ -0,0 +1,706 @@
1
+ var $ = Object.defineProperty;
2
+ var D = (t, n, e) => n in t ? $(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
+ var _ = (t, n, e) => D(t, typeof n != "symbol" ? n + "" : n, e);
4
+ import { c as z } from "./cartesian-k_WIYsGp.js";
5
+ import { commonMeasureBounds as K, NovaUiComponentNode as W } from "@nova-lab/ui-kit";
6
+ import { a as B, b as Y, l as k, m as H, o as w, p as X, q as j, s as U, w as G, t as q, u as M, r as I, f as C } from "./host-DLDeDU5k.js";
7
+ import { T as J, a as Q } from "./translation-window-Ca_rCenJ.js";
8
+ import { C as Z, p as ee } from "./chart-series-runtime-C0P7h8Tl.js";
9
+ import { c as te, t as se } from "./GeometryIndex-DDQ34Jf4.js";
10
+ const oe = "NovaCharts.AreaSeries";
11
+ function N(t) {
12
+ const n = {
13
+ type: oe,
14
+ name: "NovaCharts.AreaSeries",
15
+ title: "NovaCharts.AreaSeries",
16
+ version: "0.1.0",
17
+ kind: "node-component",
18
+ dirtyPolicy: Y,
19
+ fields: {
20
+ ...B,
21
+ chartRef: { type: "string" },
22
+ xScaleId: { type: "string" },
23
+ yScaleId: { type: "string" },
24
+ xField: { type: "field" },
25
+ yField: { type: "field" },
26
+ seriesField: { type: "field" },
27
+ labelField: { type: "field" },
28
+ curve: { type: "string" },
29
+ baselineValue: { type: "number" },
30
+ baselineField: { type: "field" },
31
+ mode: { type: "string" },
32
+ fill: { type: "string" },
33
+ stroke: { type: "string" },
34
+ strokeWidth: { type: "number" },
35
+ opacity: { type: "number" },
36
+ gradientTo: { type: "record" },
37
+ gradientSteps: { type: "number" },
38
+ focusOnHover: { type: "boolean" },
39
+ colors: { type: "record" },
40
+ markers: { type: "record" },
41
+ defined: { type: "record" },
42
+ connectNulls: { type: "boolean" },
43
+ hitRadiusPx: { type: "number" },
44
+ virtualization: { type: "record" }
45
+ },
46
+ normalize: (e) => k(e.props),
47
+ measureBounds: (e, s) => K(s, k)
48
+ };
49
+ return t && (n.createNode = t), n;
50
+ }
51
+ const re = N();
52
+ function ie(t) {
53
+ const n = g(), e = g(), s = t.dataStore.getData(), o = R(t), r = X(o, s), i = g() - e, a = g(), l = t.props.mode === "stacked" || typeof t.props.colors.stroke == "function" ? null : j(o, typeof t.props.colors.stroke == "string" ? t.props.colors.stroke : r[0].color), p = (l == null ? void 0 : l.points) ?? U(o, s), { visibleCandidates: y, renderedCandidates: u, mode: c } = l ? { visibleCandidates: p, renderedCandidates: p, mode: l.points.length < l.visibleCount ? "sampled" : l.visibleCount < s.length ? "windowed" : "direct" } : G(o, p), h = le(t, u), d = pe(h, t.props.curve), m = t.props.curve === "smooth" ? d.flatMap((f) => f.top.slice(1).map((P, v) => ({
54
+ key: `${f.key}:smooth:${v}`,
55
+ seriesKey: f.seriesKey,
56
+ color: f.strokeColor,
57
+ x1: f.top[v].x,
58
+ y1: f.top[v].y,
59
+ x2: P.x,
60
+ y2: P.y
61
+ }))) : q(h, t.props.curve), x = g() - a, S = {
62
+ kind: "area",
63
+ inputRows: s.length,
64
+ visibleRows: (l == null ? void 0 : l.visibleCount) ?? y.length,
65
+ renderedPoints: h.length,
66
+ renderedSegments: m.length,
67
+ renderedAreas: d.length,
68
+ skippedRows: (l == null ? void 0 : l.skippedCount) ?? s.length - p.length,
69
+ seriesCount: r.length,
70
+ mode: c,
71
+ areaMode: t.props.mode,
72
+ domainMs: i,
73
+ layoutMs: x,
74
+ schemaMs: 0,
75
+ totalMs: g() - n
76
+ };
77
+ return {
78
+ points: h,
79
+ segments: m,
80
+ areas: d,
81
+ series: r,
82
+ diagnostics: S
83
+ };
84
+ }
85
+ function ae(t) {
86
+ return H(R(t));
87
+ }
88
+ function ne(t) {
89
+ if (t.props.mode !== "stacked" && !t.props.baselineField) {
90
+ const [s, o] = t.dataStore.numericExtent(t.props.yField);
91
+ return [Math.min(s, t.props.baselineValue), Math.max(o, t.props.baselineValue)];
92
+ }
93
+ const n = t.dataStore.getData(), e = [t.props.baselineValue];
94
+ if (t.props.mode === "stacked") {
95
+ const s = /* @__PURE__ */ new Map();
96
+ n.forEach((o, r) => {
97
+ const i = t.dataStore.readField(o, r, t.props.xField), a = String(i ?? ""), l = Number(t.dataStore.readField(o, r, t.props.yField));
98
+ if (!Number.isFinite(l))
99
+ return;
100
+ let p = s.get(a);
101
+ p || (p = { positive: t.props.baselineValue, negative: t.props.baselineValue }, s.set(a, p)), l >= 0 ? p.positive += l : p.negative += l;
102
+ });
103
+ for (const o of s.values())
104
+ e.push(o.negative, o.positive);
105
+ return w(e);
106
+ }
107
+ return n.forEach((s, o) => {
108
+ const r = Number(t.dataStore.readField(s, o, t.props.yField)), i = E(t, s, o);
109
+ Number.isFinite(r) && e.push(r), Number.isFinite(i) && e.push(i);
110
+ }), w(e);
111
+ }
112
+ function R(t) {
113
+ return {
114
+ dataStore: t.dataStore,
115
+ xScale: t.xScale,
116
+ yScale: t.yScale,
117
+ width: t.width,
118
+ height: t.height,
119
+ xScaleId: t.props.xScaleId,
120
+ yScaleId: t.props.yScaleId,
121
+ xField: t.props.xField,
122
+ yField: t.props.yField,
123
+ seriesField: t.props.seriesField,
124
+ labelField: t.props.labelField,
125
+ kind: "area",
126
+ fallbackLabel: "Area",
127
+ palette: t.props.colors.palette,
128
+ defaultColor: t.props.stroke,
129
+ colorField: t.props.colors.colorField,
130
+ virtualization: t.props.virtualization,
131
+ connectNulls: t.props.connectNulls,
132
+ defined: t.props.defined,
133
+ resolveColor: (n, e) => typeof t.props.colors.stroke == "function" ? t.props.colors.stroke(n) : typeof t.props.colors.stroke == "string" ? t.props.colors.stroke : (e == null ? void 0 : e.color) ?? t.props.stroke
134
+ };
135
+ }
136
+ function le(t, n) {
137
+ return t.props.mode === "stacked" ? ce(t, n) : n.map((e) => {
138
+ const s = E(t, e.row, e.rowIndex), o = Number(t.yScale.toPx(s));
139
+ return Object.assign(e, { baselineValue: s, baselineY: o });
140
+ }).filter(O);
141
+ }
142
+ function ce(t, n) {
143
+ const e = /* @__PURE__ */ new Map(), s = [];
144
+ for (const o of n) {
145
+ const r = String(o.xValue);
146
+ let i = e.get(r);
147
+ i || (i = { positive: t.props.baselineValue, negative: t.props.baselineValue }, e.set(r, i));
148
+ const a = o.yValue, l = a >= 0 ? i.positive : i.negative, p = l + a;
149
+ a >= 0 ? i.positive = p : i.negative = p, s.push({
150
+ ...o,
151
+ y: Number(t.yScale.toPx(p)),
152
+ baselineValue: l,
153
+ baselineY: Number(t.yScale.toPx(l)),
154
+ stackedBaseValue: l,
155
+ stackedEndValue: p
156
+ });
157
+ }
158
+ return s.filter(O);
159
+ }
160
+ function pe(t, n) {
161
+ const e = /* @__PURE__ */ new Map();
162
+ for (const o of t) {
163
+ const r = `${o.seriesKey}:${o.segmentGroup}`, i = e.get(r) ?? [];
164
+ i.push(o), e.set(r, i);
165
+ }
166
+ const s = [];
167
+ for (const [o, r] of e) {
168
+ if (r.length < 2)
169
+ continue;
170
+ const i = r[0];
171
+ if (!i)
172
+ continue;
173
+ const a = [], l = [];
174
+ for (let u = 0; u < r.length; u += 1) {
175
+ const c = r[u], h = r[u - 1];
176
+ c && (n === "step" && h && a.push({ x: c.x, y: h.y }), a.push({ x: c.x, y: c.y }));
177
+ }
178
+ for (let u = r.length - 1; u >= 0; u -= 1) {
179
+ const c = r[u], h = r[u + 1];
180
+ c && (n === "step" && h && l.push({ x: h.x, y: c.baselineY }), l.push({ x: c.x, y: c.baselineY }));
181
+ }
182
+ const p = l.reverse(), y = n === "smooth" ? de(a, p) : { top: a, baseline: p };
183
+ s.push({
184
+ key: o,
185
+ seriesKey: i.seriesKey,
186
+ color: i.color,
187
+ strokeColor: i.color,
188
+ points: [...y.top, ...[...y.baseline].reverse()],
189
+ top: y.top,
190
+ baseline: y.baseline
191
+ });
192
+ }
193
+ return s;
194
+ }
195
+ function de(t, n) {
196
+ const e = [t[0]], s = [n[0]];
197
+ for (let o = 0; o < t.length - 1; o++) {
198
+ const r = t[o], i = t[o + 1];
199
+ for (let a = 1; a <= 5; a++) {
200
+ const l = a / 5, p = r.x + (i.x - r.x) * l, y = M(t, o, l), u = M(n, o, l);
201
+ e.push({ x: p, y: r.y <= n[o].y ? Math.min(y, u) : Math.max(y, u) }), s.push({ x: p, y: u });
202
+ }
203
+ }
204
+ return { top: e, baseline: s };
205
+ }
206
+ function E(t, n, e) {
207
+ if (t.props.baselineField && n) {
208
+ const s = Number(t.dataStore.readField(n, e, t.props.baselineField));
209
+ if (Number.isFinite(s))
210
+ return s;
211
+ }
212
+ return t.props.baselineValue;
213
+ }
214
+ function O(t) {
215
+ return Number.isFinite(t.x) && Number.isFinite(t.y) && Number.isFinite(t.baselineY);
216
+ }
217
+ function g() {
218
+ return typeof performance < "u" ? performance.now() : Date.now();
219
+ }
220
+ function he(t, n, e) {
221
+ if (n.points.length === 0)
222
+ return null;
223
+ const s = e.maxDistancePx ?? 12;
224
+ let o = null;
225
+ for (const i of n.points) {
226
+ const a = Math.hypot(i.x - e.x, i.y - e.y);
227
+ a > s || (!o || a < o.distance) && (o = { point: i, distance: a });
228
+ }
229
+ if (!o)
230
+ return null;
231
+ const r = o.point;
232
+ return {
233
+ seriesId: t,
234
+ seriesKind: "area",
235
+ key: r.key,
236
+ mode: "datum",
237
+ row: r.row,
238
+ value: r.yValue,
239
+ rawValue: r.rawValue,
240
+ xValue: r.xValue,
241
+ yValue: r.yValue,
242
+ label: r.seriesLabel === "__default" ? String(r.xValue) : r.seriesLabel,
243
+ category: typeof r.xValue == "string" ? r.xValue : void 0,
244
+ seriesKey: r.seriesKey,
245
+ seriesLabel: r.seriesLabel,
246
+ color: r.color,
247
+ point: {
248
+ x: r.x,
249
+ y: r.y
250
+ },
251
+ bounds: {
252
+ x: r.x,
253
+ y: r.y,
254
+ width: 1,
255
+ height: 1
256
+ },
257
+ distancePx: o.distance
258
+ };
259
+ }
260
+ const T = {
261
+ kind: "area",
262
+ inputRows: 0,
263
+ visibleRows: 0,
264
+ renderedPoints: 0,
265
+ renderedSegments: 0,
266
+ renderedAreas: 0,
267
+ skippedRows: 0,
268
+ seriesCount: 0,
269
+ mode: "direct",
270
+ areaMode: "single",
271
+ domainMs: 0,
272
+ layoutMs: 0,
273
+ schemaMs: 0,
274
+ totalMs: 0
275
+ }, A = {
276
+ points: [],
277
+ segments: [],
278
+ areas: [],
279
+ series: [],
280
+ diagnostics: T
281
+ };
282
+ class ue extends W {
283
+ constructor(e, s, o, r = {}, i = re) {
284
+ super(e, s, i, o, { componentId: r.componentId });
285
+ _(this, "_layoutPlan", A);
286
+ _(this, "_api");
287
+ _(this, "_runtimeBinding");
288
+ _(this, "_layoutEpoch", 0);
289
+ _(this, "_computedEpoch", "");
290
+ _(this, "_translationWindow", new J());
291
+ _(this, "_translationMatrix", te());
292
+ _(this, "_translationX", 0);
293
+ _(this, "_projectedPlan", null);
294
+ _(this, "_schema", null);
295
+ this.options({ zIndex: 8 }), this._api = {
296
+ getLayoutPlan: () => (this._computeLayout(), this._readLayoutPlan()),
297
+ getDiagnostics: () => this._layoutPlan.diagnostics,
298
+ hitTest: (a) => this._hitTestSeries(a),
299
+ refresh: () => this._refresh(),
300
+ setVirtualization: (a) => this.setVirtualization(a)
301
+ }, this._runtimeBinding = new Z(this, {
302
+ hitTest: (a) => this._hitTestSeries(a)
303
+ });
304
+ }
305
+ setProps(e) {
306
+ return super.setProps(k({
307
+ ...this.props,
308
+ ...e
309
+ }));
310
+ }
311
+ getApi() {
312
+ return this._api;
313
+ }
314
+ update() {
315
+ this._computeLayout();
316
+ }
317
+ render() {
318
+ var i, a, l, p, y, u;
319
+ const e = V(), s = this._runtimeBinding.runtime();
320
+ if (this._translationX && this.renderer.setTransform(se(this._translationMatrix, this.matrix, [this._translationX, 0])), this._schema) {
321
+ this.renderer.schema(this._schema);
322
+ return;
323
+ }
324
+ const o = [], r = s == null ? void 0 : s.getInteractionState().hovered;
325
+ for (const c of this._layoutPlan.areas) {
326
+ const h = this._createAreaStyleContext(c, s), d = this._resolveAreaStyle(c, h, s), m = (d.opacity ?? this.props.opacity) * (this.props.focusOnHover && (r == null ? void 0 : r.seriesId) === this.componentId && r.seriesKey !== c.seriesKey ? 0.14 : 1), x = typeof this.props.gradientTo == "string" ? this.props.gradientTo : (i = this.props.gradientTo) == null ? void 0 : i[c.seriesKey];
327
+ if (x && !((a = this.props.renderers) != null && a.areaFill)) {
328
+ fe(o, c, d.background ?? d.fill ?? c.color, x, m, this.props.gradientSteps);
329
+ continue;
330
+ }
331
+ I(
332
+ o,
333
+ (l = this.props.renderers) == null ? void 0 : l.areaFill,
334
+ { ...h, style: d },
335
+ {
336
+ type: "polygon",
337
+ points: c.points,
338
+ styles: {
339
+ background: d.background ?? d.fill ?? this._resolveAreaFill(c.color),
340
+ stroke: d.stroke ?? d.strokeColor ?? c.strokeColor,
341
+ lineWidth: d.lineWidth ?? 0,
342
+ opacity: m
343
+ }
344
+ }
345
+ );
346
+ }
347
+ if (!((p = this.props.renderers) != null && p.areaOutline) && !this.props.focusOnHover) {
348
+ const c = /* @__PURE__ */ new Map(), h = !(s != null && s.customization.contextualStyles) && !this.props.style && !this.props.parts && !this.props.states;
349
+ Q(o, this._layoutPlan.segments, (d) => {
350
+ const m = h ? c.get(d.color) : void 0;
351
+ if (m)
352
+ return m;
353
+ const x = this._resolveOutlineStyle(d, this._createOutlineStyleContext(d, s), s);
354
+ return h && c.set(d.color, x), x;
355
+ });
356
+ } else
357
+ for (const c of this._layoutPlan.segments) {
358
+ const h = this._createOutlineStyleContext(c, s), d = this._resolveOutlineStyle(c, h, s), m = (d.opacity ?? 1) * (this.props.focusOnHover && (r == null ? void 0 : r.seriesId) === this.componentId && r.seriesKey !== c.seriesKey ? 0.14 : 1);
359
+ I(
360
+ o,
361
+ (y = this.props.renderers) == null ? void 0 : y.areaOutline,
362
+ { ...h, style: d },
363
+ {
364
+ type: "line",
365
+ x1: c.x1,
366
+ y1: c.y1,
367
+ x2: c.x2,
368
+ y2: c.y2,
369
+ styles: {
370
+ color: d.color ?? d.stroke ?? c.color,
371
+ width: d.width ?? d.strokeWidth ?? this.props.strokeWidth,
372
+ opacity: m
373
+ }
374
+ }
375
+ );
376
+ }
377
+ if (this.props.markers.visible)
378
+ for (const c of this._layoutPlan.points) {
379
+ const h = ye(c), d = this._createMarkerStyleContext(c, s), m = Math.max(0, _e(this.props.markers.radius, h, 3)), x = F(this.props.markers.fill, h) ?? c.color, S = F(this.props.markers.strokeColor, h) ?? "#ffffff", f = this._resolveMarkerStyle(d, s, {
380
+ radius: m,
381
+ fill: x,
382
+ strokeColor: S
383
+ });
384
+ I(
385
+ o,
386
+ (u = this.props.renderers) == null ? void 0 : u.areaMarker,
387
+ { ...d, style: f },
388
+ {
389
+ type: "circle",
390
+ x: c.x,
391
+ y: c.y,
392
+ radius: Math.max(0, f.radius ?? m),
393
+ styles: {
394
+ background: f.background ?? f.fill ?? x,
395
+ border: {
396
+ color: f.strokeColor ?? f.stroke ?? S,
397
+ width: f.strokeWidth ?? this.props.markers.strokeWidth
398
+ },
399
+ opacity: f.opacity
400
+ }
401
+ }
402
+ );
403
+ }
404
+ this._publishSchemaDiagnostics(e), this._canRetainSchema(s) && (o.contentVersion = 0, o.snapshotVersion = 0, this._schema = o), o.length > 0 && this.renderer.schema(o);
405
+ }
406
+ setVirtualization(e) {
407
+ this.props.virtualization = {
408
+ ...this.props.virtualization,
409
+ ...e
410
+ }, this._refresh();
411
+ }
412
+ onMount() {
413
+ super.onMount(), this._runtimeBinding.syncInteractive();
414
+ }
415
+ onUnmount() {
416
+ this._runtimeBinding.cleanup(), super.onUnmount();
417
+ }
418
+ onPropsChanged(e) {
419
+ this.applyCommonPropsChanged(e), e.includes("chartRef") && this._runtimeBinding.syncInteractive(), this._refresh();
420
+ }
421
+ _canRetainSchema(e) {
422
+ return !!(e && !e.customization.contextualStyles && (!e.props.accessibility || !e.props.accessibility.includeVisibleMarks) && !this.props.style && !this.props.parts && !this.props.states && !this.props.renderers && !this.props.markers.visible && !this.props.focusOnHover);
423
+ }
424
+ _readLayoutPlan() {
425
+ const e = this._translationX;
426
+ return e ? (this._projectedPlan ?? (this._projectedPlan = {
427
+ ...this._layoutPlan,
428
+ points: this._layoutPlan.points.map((s) => ({ ...s, x: s.x + e })),
429
+ segments: this._layoutPlan.segments.map((s) => ({ ...s, x1: s.x1 + e, x2: s.x2 + e })),
430
+ areas: this._layoutPlan.areas.map((s) => ({ ...s, points: s.points.map((o) => ({ ...o, x: o.x + e })), top: s.top.map((o) => ({ ...o, x: o.x + e })), baseline: s.baseline.map((o) => ({ ...o, x: o.x + e })) }))
431
+ }), this._projectedPlan) : this._layoutPlan;
432
+ }
433
+ _hitTestSeries(e) {
434
+ return this._computeLayout(), he(this.componentId, this._readLayoutPlan(), {
435
+ ...e,
436
+ maxDistancePx: e.maxDistancePx ?? this.props.hitRadiusPx
437
+ });
438
+ }
439
+ _refresh() {
440
+ this._layoutEpoch++, this._computeLayout(), this.runtime.batch(() => {
441
+ this.invalidate({ update: !0, render: !0 });
442
+ });
443
+ }
444
+ _computeLayout() {
445
+ const e = this._runtimeBinding.runtime(), s = e == null ? void 0 : e.getScale(this.props.xScaleId), o = e == null ? void 0 : e.getScale(this.props.yScaleId);
446
+ if (!e || !s || !o) {
447
+ this._layoutPlan = {
448
+ ...A,
449
+ diagnostics: {
450
+ ...T,
451
+ areaMode: this.props.mode
452
+ }
453
+ };
454
+ return;
455
+ }
456
+ const r = {
457
+ props: this.props,
458
+ dataStore: e.dataStore,
459
+ xScale: s,
460
+ yScale: o,
461
+ width: this.width,
462
+ height: this.height
463
+ }, i = `${e.customization.revision}:${e.dataStore.revision}:${e.scales.revision}:${this._layoutEpoch}:${this.width}:${this.height}`;
464
+ if (i === this._computedEpoch)
465
+ return;
466
+ const a = `${e.customization.revision}:${e.dataStore.revision}:${this._layoutEpoch}:${this.width}:${this.height}`, l = this._canRetainSchema(e) ? this._translationWindow.offset(a, s, o) : null;
467
+ if (l !== null) {
468
+ this._translationX = l, this._projectedPlan = null, this._computedEpoch = i;
469
+ return;
470
+ }
471
+ this._translationX = 0, this._projectedPlan = null, this._schema = null, this._translationWindow.clear(), this._runtimeBinding.publishContributions(e, [
472
+ {
473
+ id: `${this.componentId}:x-domain`,
474
+ scaleId: this.props.xScaleId,
475
+ domain: ae(r)
476
+ },
477
+ {
478
+ id: `${this.componentId}:y-domain`,
479
+ scaleId: this.props.yScaleId,
480
+ domain: ne(r)
481
+ }
482
+ ]), this._layoutPlan = ie(r), this._canRetainSchema(e) && this._translationWindow.capture({ key: a, xScale: s, yScale: o, width: this.width, overscanPx: this.props.virtualization.enabled ? this.props.virtualization.overscanPx : 1 / 0, extent: e.dataStore.numericExtent(this.props.xField) }), this._computedEpoch = `${e.customization.revision}:${e.dataStore.revision}:${e.scales.revision}:${this._layoutEpoch}:${this.width}:${this.height}`, this._runtimeBinding.publishDiagnostics(e, this._layoutPlan.diagnostics), this._runtimeBinding.publishMetadata(e, this._layoutPlan.series.map((p) => ({
483
+ ...p,
484
+ id: p.id === "__default" ? this.componentId : p.id,
485
+ label: p.id === "__default" ? "Area" : p.label,
486
+ kind: "area",
487
+ sourceSeriesId: this.componentId,
488
+ scaleIds: {
489
+ x: this.props.xScaleId,
490
+ y: this.props.yScaleId
491
+ }
492
+ }))), ee(e, `${this.componentId}:marks`, this.componentId, "area", this._layoutPlan.points);
493
+ }
494
+ _resolveAreaFill(e) {
495
+ return typeof this.props.colors.fill == "string" ? this.props.colors.fill : this.props.fill === "#bfdbfe" ? e : this.props.fill;
496
+ }
497
+ _publishSchemaDiagnostics(e) {
498
+ const s = V() - e;
499
+ this._layoutPlan = {
500
+ ...this._layoutPlan,
501
+ diagnostics: {
502
+ ...this._layoutPlan.diagnostics,
503
+ schemaMs: s,
504
+ totalMs: this._layoutPlan.diagnostics.domainMs + this._layoutPlan.diagnostics.layoutMs + s
505
+ }
506
+ };
507
+ const o = this._runtimeBinding.runtime();
508
+ o && this._runtimeBinding.publishDiagnostics(o, this._layoutPlan.diagnostics);
509
+ }
510
+ _createAreaStyleContext(e, s) {
511
+ return {
512
+ componentId: this.componentId,
513
+ componentName: "AreaSeries",
514
+ part: "areaFill",
515
+ seriesKind: "area",
516
+ state: C(this.componentId, e.key, {
517
+ hovered: s == null ? void 0 : s.getInteractionState().hovered,
518
+ attrs: this.props.attrs,
519
+ disabled: this.props.disabled
520
+ }),
521
+ geometry: e,
522
+ tokens: (s == null ? void 0 : s.customization.tokens) ?? {},
523
+ scaleIds: { x: this.props.xScaleId, y: this.props.yScaleId },
524
+ className: this.props.className,
525
+ attrs: this.props.attrs
526
+ };
527
+ }
528
+ _createOutlineStyleContext(e, s) {
529
+ return {
530
+ componentId: this.componentId,
531
+ componentName: "AreaSeries",
532
+ part: "areaOutline",
533
+ seriesKind: "area",
534
+ state: C(this.componentId, e.key, {
535
+ hovered: s == null ? void 0 : s.getInteractionState().hovered,
536
+ attrs: this.props.attrs,
537
+ disabled: this.props.disabled
538
+ }),
539
+ geometry: e,
540
+ tokens: (s == null ? void 0 : s.customization.tokens) ?? {},
541
+ scaleIds: { x: this.props.xScaleId, y: this.props.yScaleId },
542
+ className: this.props.className,
543
+ attrs: this.props.attrs
544
+ };
545
+ }
546
+ _createMarkerStyleContext(e, s) {
547
+ return {
548
+ componentId: this.componentId,
549
+ componentName: "AreaSeries",
550
+ part: "areaMarker",
551
+ datum: {
552
+ seriesId: this.componentId,
553
+ seriesKind: "area",
554
+ key: e.key,
555
+ mode: "datum",
556
+ row: e.row,
557
+ value: e.yValue,
558
+ rawValue: e.rawValue,
559
+ xValue: e.xValue,
560
+ yValue: e.yValue,
561
+ seriesKey: e.seriesKey,
562
+ seriesLabel: e.seriesLabel,
563
+ color: e.color,
564
+ point: { x: e.x, y: e.y },
565
+ distancePx: 0
566
+ },
567
+ row: e.row,
568
+ rowIndex: e.rowIndex,
569
+ seriesKind: "area",
570
+ state: C(this.componentId, e.key, {
571
+ hovered: s == null ? void 0 : s.getInteractionState().hovered,
572
+ attrs: this.props.attrs,
573
+ disabled: this.props.disabled
574
+ }),
575
+ geometry: e,
576
+ tokens: (s == null ? void 0 : s.customization.tokens) ?? {},
577
+ scaleIds: { x: this.props.xScaleId, y: this.props.yScaleId },
578
+ className: this.props.className,
579
+ attrs: this.props.attrs
580
+ };
581
+ }
582
+ _resolveAreaStyle(e, s, o) {
583
+ var r, i, a, l;
584
+ return (o == null ? void 0 : o.customization.resolveMarkStyle(s, {
585
+ legacy: {
586
+ background: this._resolveAreaFill(e.color),
587
+ fill: this._resolveAreaFill(e.color),
588
+ stroke: e.strokeColor,
589
+ strokeColor: e.strokeColor,
590
+ lineWidth: 0,
591
+ opacity: this.props.opacity
592
+ },
593
+ series: this.props.style,
594
+ part: (r = this.props.parts) == null ? void 0 : r.areaFill,
595
+ state: (i = this.props.states) == null ? void 0 : i[s.state],
596
+ datum: (l = (a = this.props.style) == null ? void 0 : a.datum) == null ? void 0 : l.call(a, s)
597
+ })) ?? {
598
+ background: this._resolveAreaFill(e.color),
599
+ stroke: e.strokeColor,
600
+ opacity: this.props.opacity
601
+ };
602
+ }
603
+ _resolveOutlineStyle(e, s, o) {
604
+ var r, i, a, l;
605
+ return (o == null ? void 0 : o.customization.resolveMarkStyle(s, {
606
+ legacy: {
607
+ color: e.color,
608
+ stroke: e.color,
609
+ strokeWidth: this.props.strokeWidth,
610
+ width: this.props.strokeWidth,
611
+ opacity: 1
612
+ },
613
+ series: this.props.style,
614
+ part: (r = this.props.parts) == null ? void 0 : r.areaOutline,
615
+ state: (i = this.props.states) == null ? void 0 : i[s.state],
616
+ datum: (l = (a = this.props.style) == null ? void 0 : a.datum) == null ? void 0 : l.call(a, s)
617
+ })) ?? {
618
+ color: e.color,
619
+ strokeWidth: this.props.strokeWidth,
620
+ opacity: 1
621
+ };
622
+ }
623
+ _resolveMarkerStyle(e, s, o) {
624
+ var r, i, a, l;
625
+ return (s == null ? void 0 : s.customization.resolveMarkStyle(e, {
626
+ legacy: {
627
+ background: o.fill,
628
+ fill: o.fill,
629
+ strokeColor: o.strokeColor,
630
+ strokeWidth: this.props.markers.strokeWidth,
631
+ radius: o.radius
632
+ },
633
+ series: this.props.style,
634
+ part: (r = this.props.parts) == null ? void 0 : r.areaMarker,
635
+ state: (i = this.props.states) == null ? void 0 : i[e.state],
636
+ datum: (l = (a = this.props.style) == null ? void 0 : a.datum) == null ? void 0 : l.call(a, e)
637
+ })) ?? o;
638
+ }
639
+ }
640
+ function ye(t) {
641
+ return {
642
+ row: t.row,
643
+ rowIndex: t.rowIndex,
644
+ key: t.key,
645
+ xValue: t.xValue,
646
+ yValue: t.yValue,
647
+ seriesKey: t.seriesKey,
648
+ seriesLabel: t.seriesLabel
649
+ };
650
+ }
651
+ function fe(t, n, e, s, o, r) {
652
+ for (let i = 1; i < n.top.length; i++) {
653
+ const a = n.top[i - 1], l = n.top[i], p = n.baseline[i - 1], y = n.baseline[i];
654
+ if (a.x !== l.x)
655
+ for (let u = 0; u < r; u++) {
656
+ const c = u / r, h = (u + 1) / r;
657
+ t.push({
658
+ type: "polygon",
659
+ points: [
660
+ b(a, p, c),
661
+ b(l, y, c),
662
+ b(l, y, h),
663
+ b(a, p, h)
664
+ ],
665
+ styles: { background: me(e, s, (c + h) / 2), opacity: o }
666
+ });
667
+ }
668
+ }
669
+ }
670
+ function b(t, n, e) {
671
+ return { x: t.x + (n.x - t.x) * e, y: t.y + (n.y - t.y) * e };
672
+ }
673
+ function me(t, n, e) {
674
+ const s = (i) => {
675
+ const a = i.replace("#", "");
676
+ return /^[0-9a-f]{6}$/i.test(a) ? [0, 2, 4].map((l) => Number.parseInt(a.slice(l, l + 2), 16)) : null;
677
+ }, o = s(t), r = s(n);
678
+ return !o || !r ? t : `#${o.map((i, a) => Math.round(i + (r[a] - i) * e).toString(16).padStart(2, "0")).join("")}`;
679
+ }
680
+ function F(t, n) {
681
+ return typeof t == "function" ? t(n) : t;
682
+ }
683
+ function _e(t, n, e) {
684
+ if (typeof t == "function") {
685
+ const s = Number(t(n));
686
+ return Number.isFinite(s) ? s : e;
687
+ }
688
+ return Number.isFinite(t) ? Number(t) : e;
689
+ }
690
+ function V() {
691
+ return typeof performance < "u" ? performance.now() : Date.now();
692
+ }
693
+ const L = N((t, n) => new ue(
694
+ t.app,
695
+ t.surface,
696
+ k(n.props),
697
+ { componentId: n.id },
698
+ L
699
+ ));
700
+ function xe(t) {
701
+ t.register(L, { override: !0 });
702
+ }
703
+ const Pe = z({ kind: "area", schemaType: "NovaCharts.AreaSeries", register: xe });
704
+ export {
705
+ Pe as AreaChart
706
+ };