@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/bubble.js ADDED
@@ -0,0 +1,434 @@
1
+ var w = Object.defineProperty;
2
+ var v = (s, a, e) => a in s ? w(s, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[a] = e;
3
+ var d = (s, a, e) => v(s, typeof a != "symbol" ? a + "" : a, e);
4
+ import { c as V } from "./cartesian-k_WIYsGp.js";
5
+ import { commonMeasureBounds as R, NovaUiComponentNode as D } from "@nova-lab/ui-kit";
6
+ import { a as M, b as N, v as b, m as F, x as E, p as L, s as z, w as T, o as O, r as $, f as W } from "./host-DLDeDU5k.js";
7
+ import { C as A, p as K } from "./chart-series-runtime-C0P7h8Tl.js";
8
+ const H = "NovaCharts.BubbleSeries";
9
+ function x(s) {
10
+ const a = {
11
+ type: H,
12
+ name: "NovaCharts.BubbleSeries",
13
+ title: "NovaCharts.BubbleSeries",
14
+ version: "0.1.0",
15
+ kind: "node-component",
16
+ dirtyPolicy: N,
17
+ fields: {
18
+ ...M,
19
+ chartRef: { type: "string" },
20
+ xScaleId: { type: "string" },
21
+ yScaleId: { type: "string" },
22
+ xField: { type: "field" },
23
+ yField: { type: "field" },
24
+ sizeField: { type: "field" },
25
+ seriesField: { type: "field" },
26
+ labelField: { type: "field" },
27
+ radiusRange: { type: "record" },
28
+ sizeScale: { type: "string" },
29
+ minRadius: { type: "number" },
30
+ maxRadius: { type: "number" },
31
+ fill: { type: "record" },
32
+ strokeColor: { type: "record" },
33
+ strokeWidth: { type: "number" },
34
+ opacity: { type: "number" },
35
+ colors: { type: "record" },
36
+ highlight: { type: "record" },
37
+ hitRadiusPx: { type: "number" },
38
+ virtualization: { type: "record" }
39
+ },
40
+ normalize: (e) => b(e.props),
41
+ measureBounds: (e, i) => R(i, b)
42
+ };
43
+ return s && (a.createNode = s), a;
44
+ }
45
+ const Y = x();
46
+ function U(s) {
47
+ const a = c(), e = c(), i = s.dataStore.getData(), r = g(s), t = L(r, i), l = G(s), o = c() - e, n = c(), h = z(r, i), { visibleCandidates: u, renderedCandidates: p, mode: C } = T(r, h), f = p.map((y) => {
48
+ const m = Number(s.dataStore.readField(y.row, y.rowIndex, s.props.sizeField)), P = j(s, m, l);
49
+ return {
50
+ ...y,
51
+ sizeValue: Number.isFinite(m) ? m : l[0],
52
+ radius: P,
53
+ strokeColor: Q(s.props.strokeColor, J(y)),
54
+ strokeWidth: s.props.strokeWidth,
55
+ opacity: s.props.opacity
56
+ };
57
+ }).filter(Z), k = c() - n, B = {
58
+ kind: "bubble",
59
+ inputRows: i.length,
60
+ visibleRows: u.length,
61
+ renderedBubbles: f.length,
62
+ skippedRows: i.length - h.length,
63
+ seriesCount: t.length,
64
+ mode: C,
65
+ domainMs: o,
66
+ layoutMs: k,
67
+ schemaMs: 0,
68
+ totalMs: c() - a
69
+ };
70
+ return {
71
+ points: f,
72
+ series: t,
73
+ sizeDomain: l,
74
+ diagnostics: B
75
+ };
76
+ }
77
+ function q(s) {
78
+ return F(g(s));
79
+ }
80
+ function X(s) {
81
+ return E(g(s));
82
+ }
83
+ function G(s) {
84
+ const a = O(s.dataStore.getData().map((r, t) => Number(s.dataStore.readField(
85
+ r,
86
+ t,
87
+ s.props.sizeField
88
+ )))), e = Number(a[0]), i = Number(a[a.length - 1]);
89
+ return Number.isFinite(e) && Number.isFinite(i) ? [e, i] : [0, 1];
90
+ }
91
+ function g(s) {
92
+ return {
93
+ dataStore: s.dataStore,
94
+ xScale: s.xScale,
95
+ yScale: s.yScale,
96
+ width: s.width,
97
+ height: s.height,
98
+ xScaleId: s.props.xScaleId,
99
+ yScaleId: s.props.yScaleId,
100
+ xField: s.props.xField,
101
+ yField: s.props.yField,
102
+ seriesField: s.props.seriesField,
103
+ labelField: s.props.labelField,
104
+ kind: "bubble",
105
+ fallbackLabel: "Bubble",
106
+ palette: s.props.colors.palette,
107
+ defaultColor: typeof s.props.fill == "string" ? s.props.fill : "#0ea5e9",
108
+ colorField: s.props.colors.colorField,
109
+ virtualization: s.props.virtualization,
110
+ resolveColor: (a, e) => typeof s.props.fill == "function" ? s.props.fill(a) : typeof s.props.colors.fill == "function" ? s.props.colors.fill(a) : typeof s.props.colors.fill == "string" ? s.props.colors.fill : typeof s.props.fill == "string" ? s.props.fill : e == null ? void 0 : e.color
111
+ };
112
+ }
113
+ function j(s, a, e) {
114
+ if (!Number.isFinite(a))
115
+ return s.props.minRadius;
116
+ const [i, r] = e, t = r - i, l = t <= 0 ? 0.5 : Math.max(0, Math.min(1, (a - i) / t)), o = s.props.sizeScale === "sqrt" ? Math.sqrt(l) : l;
117
+ return s.props.minRadius + (s.props.maxRadius - s.props.minRadius) * o;
118
+ }
119
+ function J(s) {
120
+ return {
121
+ row: s.row,
122
+ rowIndex: s.rowIndex,
123
+ key: s.key,
124
+ xValue: s.xValue,
125
+ yValue: s.yValue,
126
+ seriesKey: s.seriesKey,
127
+ seriesLabel: s.seriesLabel
128
+ };
129
+ }
130
+ function Q(s, a) {
131
+ return typeof s == "function" ? s(a) : s;
132
+ }
133
+ function Z(s) {
134
+ return Number.isFinite(s.x) && Number.isFinite(s.y) && Number.isFinite(s.radius) && s.radius >= 0;
135
+ }
136
+ function c() {
137
+ return typeof performance < "u" ? performance.now() : Date.now();
138
+ }
139
+ function ee(s, a, e) {
140
+ if (a.points.length === 0)
141
+ return null;
142
+ const i = e.maxDistancePx ?? 8;
143
+ let r = null;
144
+ for (const l of a.points) {
145
+ const o = Math.hypot(l.x - e.x, l.y - e.y), n = Math.max(0, o - l.radius);
146
+ n > i || (!r || n < r.distance) && (r = { point: l, distance: n });
147
+ }
148
+ if (!r)
149
+ return null;
150
+ const t = r.point;
151
+ return {
152
+ seriesId: s,
153
+ seriesKind: "bubble",
154
+ key: t.key,
155
+ mode: "datum",
156
+ row: t.row,
157
+ value: t.yValue,
158
+ rawValue: t.rawValue,
159
+ xValue: t.xValue,
160
+ yValue: t.yValue,
161
+ label: t.seriesLabel === "__default" ? String(t.xValue) : t.seriesLabel,
162
+ category: typeof t.xValue == "string" ? t.xValue : void 0,
163
+ seriesKey: t.seriesKey,
164
+ seriesLabel: t.seriesLabel,
165
+ color: t.color,
166
+ point: {
167
+ x: t.x,
168
+ y: t.y
169
+ },
170
+ bounds: {
171
+ x: t.x - t.radius,
172
+ y: t.y - t.radius,
173
+ width: t.radius * 2,
174
+ height: t.radius * 2
175
+ },
176
+ distancePx: r.distance
177
+ };
178
+ }
179
+ const se = {
180
+ kind: "bubble",
181
+ inputRows: 0,
182
+ visibleRows: 0,
183
+ renderedBubbles: 0,
184
+ skippedRows: 0,
185
+ seriesCount: 0,
186
+ mode: "direct",
187
+ domainMs: 0,
188
+ layoutMs: 0,
189
+ schemaMs: 0,
190
+ totalMs: 0
191
+ }, _ = {
192
+ points: [],
193
+ series: [],
194
+ sizeDomain: [0, 1],
195
+ diagnostics: se
196
+ };
197
+ class te extends D {
198
+ constructor(e, i, r, t = {}, l = Y) {
199
+ super(e, i, l, r, { componentId: t.componentId });
200
+ d(this, "_layoutPlan", _);
201
+ d(this, "_layoutEpoch", 0);
202
+ d(this, "_computedEpoch", "");
203
+ d(this, "_api");
204
+ d(this, "_runtimeBinding");
205
+ this.options({ zIndex: 15 }), this._api = {
206
+ getLayoutPlan: () => (this._computeLayout(), this._layoutPlan),
207
+ getDiagnostics: () => this._layoutPlan.diagnostics,
208
+ hitTest: (o) => this._hitTestSeries(o),
209
+ refresh: () => this._refresh(),
210
+ setVirtualization: (o) => this.setVirtualization(o)
211
+ }, this._runtimeBinding = new A(this, {
212
+ hitTest: (o) => this._hitTestSeries(o)
213
+ });
214
+ }
215
+ setProps(e) {
216
+ return super.setProps(b({
217
+ ...this.props,
218
+ ...e
219
+ }));
220
+ }
221
+ getApi() {
222
+ return this._api;
223
+ }
224
+ update() {
225
+ this._computeLayout();
226
+ }
227
+ render() {
228
+ var t;
229
+ const e = S(), i = this._runtimeBinding.runtime(), r = [];
230
+ for (const l of this._layoutPlan.points) {
231
+ const o = this._createPointStyleContext(l, i), n = this._resolveBubbleStyle(l, o, i);
232
+ $(
233
+ r,
234
+ (t = this.props.renderers) == null ? void 0 : t.bubble,
235
+ { ...o, style: n },
236
+ {
237
+ type: "circle",
238
+ x: l.x,
239
+ y: l.y,
240
+ radius: Math.max(0, n.radius ?? l.radius),
241
+ styles: {
242
+ background: n.background ?? n.fill ?? l.color,
243
+ border: {
244
+ color: n.strokeColor ?? n.stroke ?? l.strokeColor,
245
+ width: n.strokeWidth ?? l.strokeWidth
246
+ },
247
+ opacity: n.opacity ?? l.opacity
248
+ }
249
+ }
250
+ );
251
+ }
252
+ this._publishSchemaDiagnostics(e), r.length > 0 && this.renderer.schema(r);
253
+ }
254
+ setVirtualization(e) {
255
+ this.props.virtualization = {
256
+ ...this.props.virtualization,
257
+ ...e
258
+ }, this._refresh();
259
+ }
260
+ onMount() {
261
+ super.onMount(), this._runtimeBinding.syncInteractive();
262
+ }
263
+ onUnmount() {
264
+ this._runtimeBinding.cleanup(), super.onUnmount();
265
+ }
266
+ onPropsChanged(e) {
267
+ this.applyCommonPropsChanged(e), e.includes("chartRef") && this._runtimeBinding.syncInteractive(), this._refresh();
268
+ }
269
+ _hitTestSeries(e) {
270
+ return ee(this.componentId, this._layoutPlan, {
271
+ ...e,
272
+ maxDistancePx: e.maxDistancePx ?? this.props.hitRadiusPx
273
+ });
274
+ }
275
+ _refresh() {
276
+ this._layoutEpoch++, this._computeLayout(), this.runtime.batch(() => {
277
+ this.invalidate({ update: !0, render: !0 });
278
+ });
279
+ }
280
+ _computeLayout() {
281
+ const e = this._runtimeBinding.runtime(), i = e == null ? void 0 : e.getScale(this.props.xScaleId), r = e == null ? void 0 : e.getScale(this.props.yScaleId);
282
+ if (!e || !i || !r) {
283
+ this._layoutPlan = _;
284
+ return;
285
+ }
286
+ if (`${e.dataStore.revision}:${e.scales.revision}:${this._layoutEpoch}:${this.width}:${this.height}` === this._computedEpoch)
287
+ return;
288
+ const l = {
289
+ props: this.props,
290
+ dataStore: e.dataStore,
291
+ xScale: i,
292
+ yScale: r,
293
+ width: this.width,
294
+ height: this.height
295
+ };
296
+ this._runtimeBinding.publishContributions(e, [
297
+ {
298
+ id: `${this.componentId}:x-domain`,
299
+ scaleId: this.props.xScaleId,
300
+ domain: q(l)
301
+ },
302
+ {
303
+ id: `${this.componentId}:y-domain`,
304
+ scaleId: this.props.yScaleId,
305
+ domain: X(l)
306
+ }
307
+ ]), this._layoutPlan = U(l), this._runtimeBinding.publishDiagnostics(e, this._layoutPlan.diagnostics), this._runtimeBinding.publishMetadata(e, this._layoutPlan.series.map((o) => ({
308
+ ...o,
309
+ id: o.id === "__default" ? this.componentId : o.id,
310
+ label: o.id === "__default" ? "Bubble" : o.label,
311
+ kind: "bubble",
312
+ sourceSeriesId: this.componentId,
313
+ scaleIds: {
314
+ x: this.props.xScaleId,
315
+ y: this.props.yScaleId
316
+ }
317
+ }))), K(e, `${this.componentId}:marks`, this.componentId, "bubble", this._layoutPlan.points.map((o) => ({
318
+ key: o.key,
319
+ x: o.x,
320
+ y: o.y,
321
+ radius: o.radius,
322
+ value: o.yValue,
323
+ rawValue: o.rawValue,
324
+ xValue: o.xValue,
325
+ yValue: o.yValue,
326
+ seriesKey: o.seriesKey,
327
+ seriesLabel: o.seriesLabel,
328
+ color: o.color
329
+ }))), this._computedEpoch = `${e.dataStore.revision}:${e.scales.revision}:${this._layoutEpoch}:${this.width}:${this.height}`;
330
+ }
331
+ _publishSchemaDiagnostics(e) {
332
+ const i = S() - e;
333
+ this._layoutPlan = {
334
+ ...this._layoutPlan,
335
+ diagnostics: {
336
+ ...this._layoutPlan.diagnostics,
337
+ schemaMs: i,
338
+ totalMs: this._layoutPlan.diagnostics.domainMs + this._layoutPlan.diagnostics.layoutMs + i
339
+ }
340
+ };
341
+ const r = this._runtimeBinding.runtime();
342
+ r && this._runtimeBinding.publishDiagnostics(r, this._layoutPlan.diagnostics);
343
+ }
344
+ _isPointHighlighted(e, i) {
345
+ return this.props.highlight.enabled && (i == null ? void 0 : i.seriesId) === this.componentId && i.key === e;
346
+ }
347
+ _createPointStyleContext(e, i) {
348
+ return {
349
+ componentId: this.componentId,
350
+ componentName: "BubbleSeries",
351
+ part: "bubble",
352
+ datum: {
353
+ seriesId: this.componentId,
354
+ seriesKind: "bubble",
355
+ key: e.key,
356
+ mode: "datum",
357
+ row: e.row,
358
+ value: e.yValue,
359
+ rawValue: e.rawValue,
360
+ xValue: e.xValue,
361
+ yValue: e.yValue,
362
+ seriesKey: e.seriesKey,
363
+ seriesLabel: e.seriesLabel,
364
+ color: e.color,
365
+ point: { x: e.x, y: e.y },
366
+ distancePx: 0
367
+ },
368
+ row: e.row,
369
+ rowIndex: e.rowIndex,
370
+ seriesKind: "bubble",
371
+ state: W(this.componentId, e.key, {
372
+ hovered: i == null ? void 0 : i.getInteractionState().hovered,
373
+ attrs: this.props.attrs,
374
+ disabled: this.props.disabled
375
+ }),
376
+ geometry: e,
377
+ tokens: (i == null ? void 0 : i.customization.tokens) ?? {},
378
+ scaleIds: { x: this.props.xScaleId, y: this.props.yScaleId },
379
+ className: this.props.className,
380
+ attrs: this.props.attrs
381
+ };
382
+ }
383
+ _resolveBubbleStyle(e, i, r) {
384
+ var n, h, u, p;
385
+ const t = this._isPointHighlighted(e.key, r == null ? void 0 : r.getInteractionState().hovered), l = {
386
+ ...((n = this.props.states) == null ? void 0 : n[i.state]) ?? {},
387
+ ...t ? {
388
+ background: this.props.highlight.fill,
389
+ fill: this.props.highlight.fill,
390
+ opacity: this.props.highlight.opacity,
391
+ radius: e.radius + this.props.highlight.radiusDelta,
392
+ strokeColor: this.props.highlight.strokeColor,
393
+ strokeWidth: this.props.highlight.strokeWidth
394
+ } : {}
395
+ }, o = (u = (h = this.props.style) == null ? void 0 : h.datum) == null ? void 0 : u.call(h, i);
396
+ return (r == null ? void 0 : r.customization.resolveMarkStyle(i, {
397
+ legacy: {
398
+ background: e.color,
399
+ fill: e.color,
400
+ strokeColor: e.strokeColor,
401
+ strokeWidth: e.strokeWidth,
402
+ opacity: e.opacity,
403
+ radius: e.radius
404
+ },
405
+ series: this.props.style,
406
+ part: (p = this.props.parts) == null ? void 0 : p.bubble,
407
+ state: l,
408
+ datum: o
409
+ })) ?? {
410
+ background: t ? this.props.highlight.fill : e.color,
411
+ strokeColor: t ? this.props.highlight.strokeColor : e.strokeColor,
412
+ strokeWidth: t ? this.props.highlight.strokeWidth : e.strokeWidth,
413
+ opacity: t ? this.props.highlight.opacity : e.opacity,
414
+ radius: t ? e.radius + this.props.highlight.radiusDelta : e.radius
415
+ };
416
+ }
417
+ }
418
+ function S() {
419
+ return typeof performance < "u" ? performance.now() : Date.now();
420
+ }
421
+ const I = x((s, a) => new te(
422
+ s.app,
423
+ s.surface,
424
+ b(a.props),
425
+ { componentId: a.id },
426
+ I
427
+ ));
428
+ function ie(s) {
429
+ s.register(I, { override: !0 });
430
+ }
431
+ const he = V({ kind: "bubble", schemaType: "NovaCharts.BubbleSeries", register: ie });
432
+ export {
433
+ he as BubbleChart
434
+ };
@@ -0,0 +1,57 @@
1
+ function p(r, x, a, y, z) {
2
+ const d = () => r.readState().camera, g = (n, i) => {
3
+ r.request("camera", n, i);
4
+ }, M = (n, i) => {
5
+ const o = n.flatMap((t) => t.bounds ? [t.bounds] : t.point ? [{ ...t.point, width: 1, height: 1 }] : []);
6
+ if (!o.length)
7
+ return;
8
+ const e = x(), s = d();
9
+ let c = 1 / 0, h = 1 / 0, f = -1 / 0, u = -1 / 0;
10
+ for (const t of o)
11
+ c = Math.min(c, t.x), h = Math.min(h, t.y), f = Math.max(f, t.x + t.width), u = Math.max(u, t.y + t.height);
12
+ const w = { x: s.center.x + ((c + f) / 2 - e.width / 2) / s.zoom, y: s.center.y + ((h + u) / 2 - e.height / 2) / s.zoom };
13
+ g({ center: w, zoom: Math.min(1e6, s.zoom * Math.min(e.width / Math.max(1, f - c), e.height / Math.max(1, u - h)) * 0.9) }, i);
14
+ };
15
+ return {
16
+ getCamera: () => {
17
+ const n = d();
18
+ return { ...n, center: { ...n.center } };
19
+ },
20
+ setCamera: (n, i) => g(n, i == null ? void 0 : i.origin),
21
+ panBy(n, i) {
22
+ const o = d();
23
+ g({ ...o, center: { x: o.center.x - n.x / o.zoom, y: o.center.y - n.y / o.zoom } }, i == null ? void 0 : i.origin);
24
+ },
25
+ zoomAt(n, i, o) {
26
+ if (!Number.isFinite(n) || n <= 0)
27
+ throw new RangeError("[NovaCharts] Zoom factor must be finite and positive");
28
+ const e = d(), s = Math.max(1e-6, Math.min(1e6, e.zoom * n)), c = x(), h = i ?? { x: c.width / 2, y: c.height / 2 };
29
+ g({ zoom: s, center: { x: e.center.x + (h.x - c.width / 2) * (1 / e.zoom - 1 / s), y: e.center.y + (h.y - c.height / 2) * (1 / e.zoom - 1 / s) } }, o == null ? void 0 : o.origin);
30
+ },
31
+ fitContent(n) {
32
+ const i = z == null ? void 0 : z();
33
+ if (i != null && i.length) {
34
+ M(i, n == null ? void 0 : n.origin);
35
+ return;
36
+ }
37
+ const o = x();
38
+ g((y == null ? void 0 : y()) ?? { center: { x: o.width / 2, y: o.height / 2 }, zoom: 1 }, n == null ? void 0 : n.origin);
39
+ },
40
+ resetCamera(n) {
41
+ const i = x();
42
+ g((y == null ? void 0 : y()) ?? { center: { x: i.width / 2, y: i.height / 2 }, zoom: 1 }, n == null ? void 0 : n.origin);
43
+ },
44
+ fitSelection(n) {
45
+ M(a(r.readState().selection), n == null ? void 0 : n.origin);
46
+ }
47
+ };
48
+ }
49
+ function l(r) {
50
+ if (![r.zoom, r.center.x, r.center.y].every(Number.isFinite) || r.zoom <= 0)
51
+ throw new Error("[NovaCharts] Camera requires a finite center and positive zoom");
52
+ return { center: { ...r.center }, zoom: Math.max(1e-6, Math.min(1e6, r.zoom)) };
53
+ }
54
+ export {
55
+ p as c,
56
+ l as n
57
+ };
@@ -0,0 +1,8 @@
1
+ export declare const CandlestickChart: {
2
+ series: <T = never, const S extends import('./public').SeriesOptions<never> = import('./public').SeriesOptions<T>>(options: S) => Omit<S, "type"> & {
3
+ readonly type: import('./public').CartesianKind;
4
+ };
5
+ mount<T>(target: string | HTMLElement, options: import('./public').CartesianOptions<T>): import('./public').CartesianHandle<T>;
6
+ attach<T>(target: import('./public').ChartAttachTarget, options: import('./public').CartesianOptions<T>): import('./public').CartesianHandle<T>;
7
+ };
8
+ export type { CartesianHandle as CandlestickChartHandle, CartesianOptions as CandlestickChartOptions } from './api/types';
@@ -0,0 +1,42 @@
1
+ import { c as k } from "./cartesian-k_WIYsGp.js";
2
+ import { r as w } from "./mark-paint-CMHKGegE.js";
3
+ import { B as M } from "./host-DLDeDU5k.js";
4
+ import { t as N, r as C } from "./MarkSeries-CQCAnV4s.js";
5
+ import { r as S } from "./novel-domains-DBpA_AOT.js";
6
+ function v(e) {
7
+ const { props: t, dataStore: i, xScale: o, yScale: s, width: f } = e;
8
+ if (!t.xField || !t.openField || !t.highField || !t.lowField || !t.closeField || !o || !s)
9
+ return [];
10
+ const y = i.getData(), F = o instanceof M ? Math.max(2, o.bandwidth() * 0.62) : Math.max(3, Math.min(24, f / Math.max(1, y.length * 1.8)));
11
+ return y.flatMap((a, r) => {
12
+ const l = i.readField(a, r, t.xField), d = o.type === "band" ? String(l ?? "") : N(l), c = Number(i.readField(a, r, t.openField)), h = Number(i.readField(a, r, t.highField)), m = Number(i.readField(a, r, t.lowField)), n = Number(i.readField(a, r, t.closeField));
13
+ if (![c, h, m, n].every(Number.isFinite) || m > Math.min(c, n) || h < Math.max(c, n))
14
+ return [];
15
+ const x = o instanceof M ? o.center(d) : o.toPx(d), p = s.toPx(c), u = s.toPx(n), b = s.toPx(h), g = s.toPx(m);
16
+ return [x, p, u, b, g].every(Number.isFinite) ? [{
17
+ kind: "candlestick",
18
+ key: String(i.getRowKey(a, r)),
19
+ row: a,
20
+ label: String(l ?? ""),
21
+ value: n,
22
+ color: n >= c ? t.upColor : t.downColor,
23
+ x: x - F / 2,
24
+ y: Math.min(p, u),
25
+ width: F,
26
+ height: Math.max(2, Math.abs(p - u)),
27
+ xValue: d,
28
+ yValue: n,
29
+ wickTop: b,
30
+ wickBottom: g
31
+ }] : [];
32
+ });
33
+ }
34
+ const P = { kind: "candlestick", layout: v, domains: S, mark: (e, t) => [
35
+ { type: "line", x1: e.x + e.width / 2, x2: e.x + e.width / 2, y1: e.wickTop ?? e.y, y2: e.wickBottom ?? e.y + e.height, styles: { color: t, width: 1 } },
36
+ ...w(e, t)
37
+ ] }, K = k({ kind: "candlestick", schemaType: "NovaCharts.candlestick.Marks", register: (e) => {
38
+ C(e, P);
39
+ }, props: () => ({ kind: "candlestick" }) });
40
+ export {
41
+ K as CandlestickChart
42
+ };