velo-plot 2.0.0 → 3.0.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 (265) hide show
  1. package/README.md +15 -8
  2. package/dist/{ChartCore-BhQ4j7f5.js → ChartCore-BpzRvN4Y.js} +998 -855
  3. package/dist/ChartCore-BpzRvN4Y.js.map +1 -0
  4. package/dist/a11y-Bw6urYpr.js +105 -0
  5. package/dist/a11y-Bw6urYpr.js.map +1 -0
  6. package/dist/angular/hooks-entry.d.ts +1 -0
  7. package/dist/angular/hooks.d.ts +26 -0
  8. package/dist/angular/index.d.ts +8 -0
  9. package/dist/angular/velo-plot.component.d.ts +46 -0
  10. package/dist/angular-hooks.d.ts +1 -0
  11. package/dist/angular-hooks.js +9 -0
  12. package/dist/angular-hooks.js.map +1 -0
  13. package/dist/angular.d.ts +1 -0
  14. package/dist/angular.js +166 -0
  15. package/dist/angular.js.map +1 -0
  16. package/dist/assets/indicator.worker-bv0zC4EX.js.map +1 -1
  17. package/dist/astro/StackedPlot.astro +19 -0
  18. package/dist/astro/VeloPlot.astro +23 -0
  19. package/dist/{axisFormat-SPX-CD5s.js → axisFormat-CzumxpCL.js} +3 -3
  20. package/dist/axisFormat-CzumxpCL.js.map +1 -0
  21. package/dist/bindings/shared/a11y.d.ts +26 -0
  22. package/dist/bindings/shared/chartLifecycle.d.ts +16 -0
  23. package/dist/bindings/shared/chartSyncBridge.d.ts +8 -0
  24. package/dist/bindings/shared/dimensions.d.ts +1 -0
  25. package/dist/bindings/shared/index.d.ts +9 -0
  26. package/dist/bindings/shared/indicatorBridge.d.ts +11 -0
  27. package/dist/bindings/shared/optionsSync.d.ts +7 -0
  28. package/dist/bindings/shared/seriesDiff.d.ts +8 -0
  29. package/dist/bindings/shared/stackedSync.d.ts +9 -0
  30. package/dist/bindings/shared/types.d.ts +46 -0
  31. package/dist/bindings/test-utils/index.d.ts +35 -0
  32. package/dist/bindings/test-utils/mockLifecycle.d.ts +120 -0
  33. package/dist/bindings/test-utils/vitestSveltePlugin.d.ts +3 -0
  34. package/dist/chartSyncBridge-DbWrwtyP.js +57 -0
  35. package/dist/chartSyncBridge-DbWrwtyP.js.map +1 -0
  36. package/dist/core/Chart.d.ts +1 -1
  37. package/dist/core/InteractionManager.d.ts +7 -1
  38. package/dist/core/OverlayRenderer.d.ts +5 -0
  39. package/dist/core/annotations/types.d.ts +1 -1
  40. package/dist/core/chart/ChartAxisManager.d.ts +2 -0
  41. package/dist/core/chart/ChartCore.d.ts +17 -2
  42. package/dist/core/chart/ChartPluginBridge.d.ts +1 -0
  43. package/dist/core/chart/ChartRenderLoop.d.ts +2 -0
  44. package/dist/core/chart/ChartStateManager.d.ts +2 -0
  45. package/dist/core/chart/types.d.ts +6 -1
  46. package/dist/core/clipboard/index.d.ts +1 -1
  47. package/dist/core/debug/index.d.ts +1 -1
  48. package/dist/core/keybindings/index.d.ts +1 -1
  49. package/dist/core/loading/index.d.ts +1 -1
  50. package/dist/core/locale/index.d.ts +1 -1
  51. package/dist/core/stacked/paneResize.d.ts +3 -0
  52. package/dist/core/stacked/types.d.ts +10 -0
  53. package/dist/core/sync/index.d.ts +0 -1
  54. package/dist/core/theme-editor/index.d.ts +1 -1
  55. package/dist/createStackedChart-Dm-YqUT7.js +756 -0
  56. package/dist/createStackedChart-Dm-YqUT7.js.map +1 -0
  57. package/dist/examples/PluginDemonstration.d.ts +1 -1
  58. package/dist/gpuRenderer-BpaMYz-k.js.map +1 -1
  59. package/dist/hooks-CYPCxoZx.js +69 -0
  60. package/dist/hooks-CYPCxoZx.js.map +1 -0
  61. package/dist/{index-D7dTq6VB.js → index-0InEyj0q.js} +130 -134
  62. package/dist/index-0InEyj0q.js.map +1 -0
  63. package/dist/index-BMiZoKmm.js.map +1 -1
  64. package/dist/{index-DoYxf1cV.js → index-CWxIHdwX.js} +38 -98
  65. package/dist/index-CWxIHdwX.js.map +1 -0
  66. package/dist/{index-CUGS98p4.js → index-CaXWSOTk.js} +3 -6
  67. package/dist/index-CaXWSOTk.js.map +1 -0
  68. package/dist/index-Dag88bW4.js.map +1 -1
  69. package/dist/index-qhscKTDy.js.map +1 -1
  70. package/dist/{index-CWipqOLP.js → index-qunX30Xu.js} +2 -2
  71. package/dist/index-qunX30Xu.js.map +1 -0
  72. package/dist/index-x4stH3jD.js.map +1 -1
  73. package/dist/{index.core-fpZ1dYN0.js → index.core-BmZe2jRQ.js} +30 -29
  74. package/dist/index.core-BmZe2jRQ.js.map +1 -0
  75. package/dist/index.core.d.ts +1 -1
  76. package/dist/index.d.ts +3 -3
  77. package/dist/indicators--eJGmVox.js.map +1 -1
  78. package/dist/{mockDatafeed-Cdg5hKEo.js → mockDatafeed-DHIDPcpX.js} +150 -146
  79. package/dist/mockDatafeed-DHIDPcpX.js.map +1 -0
  80. package/dist/optionsSync-QUiN4Inw.js +119 -0
  81. package/dist/optionsSync-QUiN4Inw.js.map +1 -0
  82. package/dist/plugins/3d/index.d.ts +2 -2
  83. package/dist/plugins/3d.d.ts +2 -2
  84. package/dist/plugins/3d.js.map +1 -1
  85. package/dist/plugins/analysis/contours.d.ts +31 -0
  86. package/dist/plugins/analysis/index.d.ts +1 -1
  87. package/dist/plugins/analysis/indicators.d.ts +1 -1
  88. package/dist/plugins/analysis.d.ts +2 -2
  89. package/dist/plugins/analysis.js +495 -408
  90. package/dist/plugins/analysis.js.map +1 -1
  91. package/dist/plugins/annotations/index.d.ts +1 -1
  92. package/dist/plugins/annotations.d.ts +2 -2
  93. package/dist/plugins/annotations.js.map +1 -1
  94. package/dist/plugins/anomaly-detection.js +1 -1
  95. package/dist/plugins/anomaly-detection.js.map +1 -1
  96. package/dist/plugins/broken-axis.d.ts +2 -2
  97. package/dist/plugins/broken-axis.js +170 -181
  98. package/dist/plugins/broken-axis.js.map +1 -1
  99. package/dist/plugins/builtins/crosshair/CrosshairPlugin.d.ts +1 -1
  100. package/dist/plugins/builtins/index.d.ts +1 -1
  101. package/dist/plugins/caching.d.ts +2 -2
  102. package/dist/plugins/clipboard/index.d.ts +2 -2
  103. package/dist/plugins/clipboard.d.ts +2 -2
  104. package/dist/plugins/clipboard.js.map +1 -1
  105. package/dist/plugins/context-menu/index.d.ts +1 -1
  106. package/dist/plugins/context-menu.d.ts +2 -2
  107. package/dist/plugins/context-menu.js +1 -1
  108. package/dist/plugins/context-menu.js.map +1 -1
  109. package/dist/plugins/data-export/index.d.ts +1 -1
  110. package/dist/plugins/data-export.d.ts +2 -2
  111. package/dist/plugins/data-export.js +2 -2
  112. package/dist/plugins/data-export.js.map +1 -1
  113. package/dist/plugins/data-transform.d.ts +2 -2
  114. package/dist/plugins/data-transform.js +19 -19
  115. package/dist/plugins/data-transform.js.map +1 -1
  116. package/dist/plugins/debug/index.d.ts +2 -2
  117. package/dist/plugins/debug.d.ts +2 -2
  118. package/dist/plugins/debug.js +2 -2
  119. package/dist/plugins/debug.js.map +1 -1
  120. package/dist/plugins/forecasting/algorithms.d.ts +7 -2
  121. package/dist/plugins/forecasting/index.d.ts +1 -1
  122. package/dist/plugins/forecasting/types.d.ts +13 -3
  123. package/dist/plugins/forecasting.js +355 -175
  124. package/dist/plugins/forecasting.js.map +1 -1
  125. package/dist/plugins/gpu/index.d.ts +2 -2
  126. package/dist/plugins/gpu.d.ts +2 -2
  127. package/dist/plugins/gpu.js.map +1 -1
  128. package/dist/plugins/i18n/index.d.ts +2 -2
  129. package/dist/plugins/i18n.d.ts +2 -2
  130. package/dist/plugins/i18n.js.map +1 -1
  131. package/dist/plugins/index.d.ts +1 -1
  132. package/dist/plugins/keyboard.d.ts +2 -2
  133. package/dist/plugins/keyboard.js +65 -5
  134. package/dist/plugins/keyboard.js.map +1 -1
  135. package/dist/plugins/latex/symbols.d.ts +50 -0
  136. package/dist/plugins/latex/types.d.ts +13 -1
  137. package/dist/plugins/latex.js +351 -331
  138. package/dist/plugins/latex.js.map +1 -1
  139. package/dist/plugins/lazy-load.d.ts +2 -2
  140. package/dist/plugins/loading/index.d.ts +1 -1
  141. package/dist/plugins/loading.d.ts +2 -2
  142. package/dist/plugins/ml-integration/native-algorithms.d.ts +24 -4
  143. package/dist/plugins/ml-integration/types.d.ts +19 -0
  144. package/dist/plugins/ml-integration.d.ts +2 -2
  145. package/dist/plugins/ml-integration.js +190 -139
  146. package/dist/plugins/ml-integration.js.map +1 -1
  147. package/dist/plugins/offscreen.d.ts +2 -2
  148. package/dist/plugins/pattern-recognition/types.d.ts +28 -1
  149. package/dist/plugins/pattern-recognition.d.ts +2 -2
  150. package/dist/plugins/pattern-recognition.js +417 -344
  151. package/dist/plugins/pattern-recognition.js.map +1 -1
  152. package/dist/plugins/radar.d.ts +2 -2
  153. package/dist/plugins/regression.d.ts +2 -2
  154. package/dist/plugins/regression.js +1 -1
  155. package/dist/plugins/regression.js.map +1 -1
  156. package/dist/plugins/roi.js +9 -9
  157. package/dist/plugins/roi.js.map +1 -1
  158. package/dist/plugins/snapshot/index.d.ts +1 -1
  159. package/dist/plugins/snapshot/types.d.ts +1 -1
  160. package/dist/plugins/snapshot.d.ts +2 -2
  161. package/dist/plugins/snapshot.js +36 -36
  162. package/dist/plugins/snapshot.js.map +1 -1
  163. package/dist/plugins/streaming/index.d.ts +2 -2
  164. package/dist/plugins/streaming.d.ts +2 -2
  165. package/dist/plugins/sync/index.d.ts +3 -2
  166. package/dist/plugins/sync.d.ts +2 -2
  167. package/dist/plugins/sync.js +1 -1
  168. package/dist/plugins/sync.js.map +1 -1
  169. package/dist/plugins/theme-editor/index.d.ts +1 -1
  170. package/dist/plugins/theme-editor.d.ts +2 -2
  171. package/dist/plugins/tools/index.d.ts +1 -1
  172. package/dist/plugins/tools/tooltip/index.d.ts +1 -1
  173. package/dist/plugins/tools.d.ts +2 -2
  174. package/dist/plugins/tools.js +1 -1
  175. package/dist/plugins/types.d.ts +1 -1
  176. package/dist/plugins/video-recorder.d.ts +2 -2
  177. package/dist/plugins/virtualization.d.ts +2 -2
  178. package/dist/plugins/virtualization.js +1 -1
  179. package/dist/pool-DZ8shSqv.js +109 -0
  180. package/dist/pool-DZ8shSqv.js.map +1 -0
  181. package/dist/react/StackedPlot.d.ts +31 -0
  182. package/dist/react/VeloPlot.d.ts +29 -0
  183. package/dist/react/index.d.ts +25 -3
  184. package/dist/react/useChartSync.d.ts +8 -0
  185. package/dist/react/useIndicator.d.ts +12 -0
  186. package/dist/react/useVeloPlot.d.ts +19 -0
  187. package/dist/react.js +328 -24
  188. package/dist/react.js.map +1 -1
  189. package/dist/scientific/index.d.ts +48 -0
  190. package/dist/scientific.d.ts +1 -0
  191. package/dist/scientific.js +91 -0
  192. package/dist/scientific.js.map +1 -0
  193. package/dist/solid/VeloPlot.d.ts +16 -0
  194. package/dist/solid/index.d.ts +13 -0
  195. package/dist/solid/useChartSync.d.ts +6 -0
  196. package/dist/solid/useIndicator.d.ts +11 -0
  197. package/dist/solid/useStackedPlot.d.ts +14 -0
  198. package/dist/solid/useVeloPlot.d.ts +18 -0
  199. package/dist/solid.d.ts +1 -0
  200. package/dist/solid.js +172 -0
  201. package/dist/solid.js.map +1 -0
  202. package/dist/stackedSync-tnrunZMt.js +100 -0
  203. package/dist/stackedSync-tnrunZMt.js.map +1 -0
  204. package/dist/svelte/StackedPlot.svelte +29 -0
  205. package/dist/svelte/StackedPlot.test.ts +114 -0
  206. package/dist/svelte/VeloPlot.svelte +44 -0
  207. package/dist/svelte/VeloPlot.test.ts +105 -0
  208. package/dist/svelte/index.d.ts +11 -0
  209. package/dist/svelte/index.test.ts +20 -0
  210. package/dist/svelte/index.ts +15 -0
  211. package/dist/svelte/useChartSync.d.ts +8 -0
  212. package/dist/svelte/useChartSync.test.ts +49 -0
  213. package/dist/svelte/useChartSync.ts +29 -0
  214. package/dist/svelte/useIndicator.d.ts +13 -0
  215. package/dist/svelte/useIndicator.test.ts +67 -0
  216. package/dist/svelte/useIndicator.ts +43 -0
  217. package/dist/svelte/useStackedPlot.d.ts +16 -0
  218. package/dist/svelte/useStackedPlot.test.ts +76 -0
  219. package/dist/svelte/useStackedPlot.ts +54 -0
  220. package/dist/svelte/useVeloPlot.d.ts +21 -0
  221. package/dist/svelte/useVeloPlot.test.ts +100 -0
  222. package/dist/svelte/useVeloPlot.ts +81 -0
  223. package/dist/svelte.d.ts +1 -0
  224. package/dist/svelte.js +143 -0
  225. package/dist/svelte.js.map +1 -0
  226. package/dist/symbols-DT0eLlpW.js +568 -0
  227. package/dist/symbols-DT0eLlpW.js.map +1 -0
  228. package/dist/testing/index.d.ts +1 -1
  229. package/dist/theme/index.d.ts +2 -1
  230. package/dist/trading.js +7 -7
  231. package/dist/types.d.ts +1 -1
  232. package/dist/{utils-BK5UUXxj.js → utils-Dx0h0bgQ.js} +9 -9
  233. package/dist/{utils-BK5UUXxj.js.map → utils-Dx0h0bgQ.js.map} +1 -1
  234. package/dist/velo-plot.full.js +444 -433
  235. package/dist/velo-plot.full.js.map +1 -1
  236. package/dist/velo-plot.js +15 -15
  237. package/dist/vue/StackedPlot.vue.d.ts +48 -0
  238. package/dist/vue/VeloPlot.vue.d.ts +64 -0
  239. package/dist/vue/index.d.ts +250 -0
  240. package/dist/vue/useChartSync.d.ts +52 -0
  241. package/dist/vue/useIndicator.d.ts +23 -0
  242. package/dist/vue/useStackedPlot.d.ts +15 -0
  243. package/dist/vue/useVeloPlot.d.ts +20 -0
  244. package/dist/vue.d.ts +1 -0
  245. package/dist/vue.js +312 -0
  246. package/dist/vue.js.map +1 -0
  247. package/dist/workers/indicatorsAsync.d.ts +26 -0
  248. package/dist/workers/pool.d.ts +9 -0
  249. package/package.json +88 -10
  250. package/dist/ChartCore-BhQ4j7f5.js.map +0 -1
  251. package/dist/SciPlot-GJvw7GJo.js +0 -463
  252. package/dist/SciPlot-GJvw7GJo.js.map +0 -1
  253. package/dist/axisFormat-SPX-CD5s.js.map +0 -1
  254. package/dist/createStackedChart-DJSmqerD.js +0 -706
  255. package/dist/createStackedChart-DJSmqerD.js.map +0 -1
  256. package/dist/index-CUGS98p4.js.map +0 -1
  257. package/dist/index-CWipqOLP.js.map +0 -1
  258. package/dist/index-D7dTq6VB.js.map +0 -1
  259. package/dist/index-DoYxf1cV.js.map +0 -1
  260. package/dist/index.core-fpZ1dYN0.js.map +0 -1
  261. package/dist/mockDatafeed-Cdg5hKEo.js.map +0 -1
  262. package/dist/pool-15HMCNv8.js +0 -88
  263. package/dist/pool-15HMCNv8.js.map +0 -1
  264. package/dist/react/SciPlot.d.ts +0 -60
  265. package/dist/react/useSciPlot.d.ts +0 -56
@@ -0,0 +1,18 @@
1
+ import { Chart } from '../core/Chart';
2
+ import { SeriesOptions, SeriesUpdateData, ZoomOptions, Bounds } from '../types';
3
+ import { ChartBindingOptions } from '../bindings/shared';
4
+
5
+ export interface UseVeloPlotOptions extends ChartBindingOptions {
6
+ }
7
+ export declare function useVeloPlot(options?: () => UseVeloPlotOptions): {
8
+ setContainerRef: (el: HTMLDivElement | null | undefined) => void;
9
+ chart: import('solid-js').Accessor<Chart | null>;
10
+ isReady: import('solid-js').Accessor<boolean>;
11
+ error: import('solid-js').Accessor<Error | null>;
12
+ bounds: import('solid-js').Accessor<Bounds | null>;
13
+ addSeries: (opts: SeriesOptions) => void;
14
+ updateSeries: (id: string, data: SeriesUpdateData) => void | undefined;
15
+ removeSeries: (id: string) => void | undefined;
16
+ zoom: (z: ZoomOptions) => void | undefined;
17
+ resetZoom: () => void;
18
+ };
@@ -0,0 +1 @@
1
+ export * from './solid/index'
package/dist/solid.js ADDED
@@ -0,0 +1,172 @@
1
+ import { template as E, use as b, effect as P, setStyleProperty as g } from "solid-js/web";
2
+ import { createSignal as f, onCleanup as C, createEffect as y } from "solid-js";
3
+ import { c as I, a as B, i as $, r as A, b as K } from "./chartSyncBridge-DbWrwtyP.js";
4
+ import { p as w, o as V, s as L, d as M } from "./optionsSync-QUiN4Inw.js";
5
+ import { c as z } from "./createStackedChart-Dm-YqUT7.js";
6
+ import "./ChartCore-BpzRvN4Y.js";
7
+ import "./index-x4stH3jD.js";
8
+ import "./symbols-DT0eLlpW.js";
9
+ import { s as R, a as G, b as x } from "./stackedSync-tnrunZMt.js";
10
+ function k(e = () => ({})) {
11
+ const [t, l] = f(null), [n, a] = f(!1), [o, u] = f(null), [d, h] = f(null);
12
+ let m, r = null, s = w(e());
13
+ const v = (i) => {
14
+ m = i, r == null || r();
15
+ const c = I(i, e(), {
16
+ onBoundsChange: h,
17
+ onError: u
18
+ });
19
+ l(c.chart), r = c.destroy, h(c.getBounds()), a(!0), s = w(e());
20
+ };
21
+ return C(() => {
22
+ r == null || r(), l(null), a(!1);
23
+ }), y(() => {
24
+ const i = t(), c = e();
25
+ if (!i) return;
26
+ const S = w(c);
27
+ V(s, S) && (L(i, s, S), s = S);
28
+ }), {
29
+ setContainerRef: (i) => {
30
+ i && i !== m && v(i);
31
+ },
32
+ chart: t,
33
+ isReady: n,
34
+ error: o,
35
+ bounds: d,
36
+ addSeries: (i) => {
37
+ var S;
38
+ (S = t()) == null || S.addSeries(i);
39
+ const c = t();
40
+ c && h(c.getViewBounds());
41
+ },
42
+ updateSeries: (i, c) => {
43
+ var S;
44
+ return (S = t()) == null ? void 0 : S.updateSeries(i, c);
45
+ },
46
+ removeSeries: (i) => {
47
+ var c;
48
+ return (c = t()) == null ? void 0 : c.removeSeries(i);
49
+ },
50
+ zoom: (i) => {
51
+ var c;
52
+ return (c = t()) == null ? void 0 : c.zoom(i);
53
+ },
54
+ resetZoom: () => {
55
+ var c;
56
+ (c = t()) == null || c.resetZoom();
57
+ const i = t();
58
+ i && h(i.getViewBounds());
59
+ }
60
+ };
61
+ }
62
+ function N(e) {
63
+ const [t, l] = f(null), [n, a] = f(!1);
64
+ let o = null, u = "", d = /* @__PURE__ */ new Map();
65
+ const h = (r) => {
66
+ o == null || o();
67
+ const s = e(), v = z({ ...s, container: r });
68
+ l(v), o = () => v.destroy(), u = R(s.panes), d = x(v, s.panes, /* @__PURE__ */ new Map()), v.whenReady().then(() => a(!0));
69
+ }, m = (r) => {
70
+ r && h(r);
71
+ };
72
+ return C(() => {
73
+ o == null || o(), l(null), a(!1);
74
+ }), {
75
+ setContainerRef: m,
76
+ stack: t,
77
+ isReady: n,
78
+ fitAll: (r) => {
79
+ var s;
80
+ return (s = t()) == null ? void 0 : s.fitAll(r);
81
+ },
82
+ resetAll: () => {
83
+ var r;
84
+ return (r = t()) == null ? void 0 : r.resetAll();
85
+ },
86
+ sync: () => {
87
+ const r = t(), s = e();
88
+ if (!r || !n()) return;
89
+ if (R(s.panes) !== u) {
90
+ h(r.container);
91
+ return;
92
+ }
93
+ G(r, s), d = x(r, s.panes, d);
94
+ }
95
+ };
96
+ }
97
+ var p = /* @__PURE__ */ E("<div role=img style=position:relative>");
98
+ function O(e) {
99
+ const t = k(() => e);
100
+ let l = /* @__PURE__ */ new Map();
101
+ return y(() => {
102
+ !t.isReady() || !t.chart() || (l = M({
103
+ addSeries: t.addSeries,
104
+ updateSeries: t.updateSeries,
105
+ removeSeries: t.removeSeries,
106
+ autoScale: () => t.chart().autoScale()
107
+ }, e.series ?? [], l));
108
+ }), (() => {
109
+ var n = p();
110
+ return b((a) => t.setContainerRef(a), n), P((a) => {
111
+ var o = `velo-plot-container${e.class ? ` ${e.class}` : ""}`, u = typeof e.width == "number" ? `${e.width}px` : e.width ?? "100%", d = typeof e.height == "number" ? `${e.height}px` : e.height ?? "400px";
112
+ return o !== a.e && (n.className = a.e = o), u !== a.t && g(n, "width", a.t = u), d !== a.a && g(n, "height", a.a = d), a;
113
+ }, {
114
+ e: void 0,
115
+ t: void 0,
116
+ a: void 0
117
+ }), n;
118
+ })();
119
+ }
120
+ function W(e) {
121
+ const t = N(() => e);
122
+ return y(() => t.sync()), (() => {
123
+ var l = p();
124
+ return b((n) => t.setContainerRef(n), l), P((n) => {
125
+ var a = `velo-plot-stacked${e.class ? ` ${e.class}` : ""}`, o = typeof e.width == "number" ? `${e.width}px` : e.width ?? "100%", u = typeof e.height == "number" ? `${e.height}px` : e.height ?? "480px";
126
+ return a !== n.e && (l.className = n.e = a), o !== n.t && g(l, "width", n.t = o), u !== n.a && g(l, "height", n.a = u), n;
127
+ }, {
128
+ e: void 0,
129
+ t: void 0,
130
+ a: void 0
131
+ }), l;
132
+ })();
133
+ }
134
+ function X(e, t, l = {}) {
135
+ const [n, a] = f(null), [o, u] = f(!1), [d, h] = f(null);
136
+ return y(() => {
137
+ const m = e();
138
+ if (!m) return;
139
+ let r = !1;
140
+ u(!0), B(m, t, l).then((s) => {
141
+ r || (a(s), u(!1));
142
+ }).catch((s) => {
143
+ r || (h(s instanceof Error ? s : new Error(String(s))), u(!1));
144
+ }), C(() => {
145
+ r = !0;
146
+ const s = n();
147
+ s && !$(m) && A(m, s.id);
148
+ });
149
+ }), { result: n, isLoading: o, error: d };
150
+ }
151
+ function Z(e, t) {
152
+ const [l, n] = f(null);
153
+ return y(() => {
154
+ const a = e();
155
+ let o = null;
156
+ a.length >= 2 ? (o = K(a, t), n(o.group)) : n(null), C(() => o == null ? void 0 : o.destroy());
157
+ }), { group: l };
158
+ }
159
+ const Y = Z, _ = O, ee = k, te = k;
160
+ export {
161
+ _ as SciPlot,
162
+ W as StackedPlot,
163
+ O as VeloPlot,
164
+ Y as useChartGroup,
165
+ Z as useChartSync,
166
+ X as useIndicator,
167
+ te as useSciChart,
168
+ ee as useSciPlot,
169
+ N as useStackedPlot,
170
+ k as useVeloPlot
171
+ };
172
+ //# sourceMappingURL=solid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solid.js","sources":["../src/solid/useVeloPlot.ts","../src/solid/useStackedPlot.ts","../src/solid/VeloPlot.tsx","../src/solid/useIndicator.ts","../src/solid/useChartSync.ts","../src/solid/index.ts"],"sourcesContent":["import { createSignal, onCleanup, createEffect } from \"solid-js\";\nimport type { Chart } from \"../core/Chart\";\nimport type { SeriesOptions, SeriesUpdateData, ZoomOptions, Bounds } from \"../types\";\nimport {\n createChartLifecycle,\n type ChartBindingOptions,\n optionsChanged,\n syncChartOptions,\n pickSyncableOptions,\n} from \"../bindings/shared\";\n\nexport interface UseVeloPlotOptions extends ChartBindingOptions {}\n\nexport function useVeloPlot(options: () => UseVeloPlotOptions = () => ({})) {\n const [chart, setChart] = createSignal<Chart | null>(null);\n const [isReady, setIsReady] = createSignal(false);\n const [error, setError] = createSignal<Error | null>(null);\n const [bounds, setBounds] = createSignal<Bounds | null>(null);\n let container: HTMLDivElement | undefined;\n let destroy: (() => void) | null = null;\n let prevSync = pickSyncableOptions(options());\n\n const mount = (el: HTMLDivElement) => {\n container = el;\n destroy?.();\n const handle = createChartLifecycle(el, options(), {\n onBoundsChange: setBounds,\n onError: setError,\n });\n setChart(handle.chart);\n destroy = handle.destroy;\n setBounds(handle.getBounds());\n setIsReady(true);\n prevSync = pickSyncableOptions(options());\n };\n\n onCleanup(() => {\n destroy?.();\n setChart(null);\n setIsReady(false);\n });\n\n createEffect(() => {\n const c = chart();\n const opts = options();\n if (!c) return;\n const next = pickSyncableOptions(opts);\n if (optionsChanged(prevSync, next)) {\n syncChartOptions(c, prevSync, next);\n prevSync = next;\n }\n });\n\n return {\n setContainerRef: (el: HTMLDivElement | null | undefined) => {\n if (el && el !== container) mount(el);\n },\n chart,\n isReady,\n error,\n bounds,\n addSeries: (opts: SeriesOptions) => {\n chart()?.addSeries(opts);\n const c = chart();\n if (c) setBounds(c.getViewBounds());\n },\n updateSeries: (id: string, data: SeriesUpdateData) => chart()?.updateSeries(id, data),\n removeSeries: (id: string) => chart()?.removeSeries(id),\n zoom: (z: ZoomOptions) => chart()?.zoom(z),\n resetZoom: () => {\n chart()?.resetZoom();\n const c = chart();\n if (c) setBounds(c.getViewBounds());\n },\n };\n}\n","import { createSignal, onCleanup } from \"solid-js\";\nimport { createStackedChart } from \"../core/stacked\";\nimport type { StackedChart, StackedChartOptions } from \"../core/stacked\";\nimport type { Range } from \"../types\";\nimport { stackedStructureKey, syncStackedOptions, syncStackedPaneSeries } from \"../bindings/shared\";\nimport type { VeloPlotSeries } from \"../bindings/shared\";\n\nexport function useStackedPlot(getOptions: () => Omit<StackedChartOptions, \"container\">) {\n const [stack, setStack] = createSignal<StackedChart | null>(null);\n const [isReady, setIsReady] = createSignal(false);\n let destroy: (() => void) | null = null;\n let structureKey = \"\";\n let paneSeries = new Map<string, Map<string, VeloPlotSeries>>();\n\n const mount = (el: HTMLDivElement) => {\n destroy?.();\n const opts = getOptions();\n const created = createStackedChart({ ...opts, container: el });\n setStack(created);\n destroy = () => created.destroy();\n structureKey = stackedStructureKey(opts.panes);\n paneSeries = syncStackedPaneSeries(created, opts.panes, new Map());\n created.whenReady().then(() => setIsReady(true));\n };\n\n const setContainerRef = (el: HTMLDivElement | null | undefined) => {\n if (el) mount(el);\n };\n\n onCleanup(() => {\n destroy?.();\n setStack(null);\n setIsReady(false);\n });\n\n return {\n setContainerRef,\n stack,\n isReady,\n fitAll: (opts?: { x?: Range; padding?: number }) => stack()?.fitAll(opts),\n resetAll: () => stack()?.resetAll(),\n sync: () => {\n const s = stack();\n const opts = getOptions();\n if (!s || !isReady()) return;\n const nextKey = stackedStructureKey(opts.panes);\n if (nextKey !== structureKey) {\n mount(s.container);\n return;\n }\n syncStackedOptions(s, opts);\n paneSeries = syncStackedPaneSeries(s, opts.panes, paneSeries);\n },\n };\n}\n","import { createEffect } from \"solid-js\";\nimport { useVeloPlot, type UseVeloPlotOptions } from \"./useVeloPlot\";\nimport { useStackedPlot } from \"./useStackedPlot\";\nimport { diffSeries, type VeloPlotSeries } from \"../bindings/shared\";\n\nexport interface VeloPlotProps extends UseVeloPlotOptions {\n series?: VeloPlotSeries[];\n width?: number | string;\n height?: number | string;\n class?: string;\n}\n\nexport function VeloPlot(props: VeloPlotProps) {\n const api = useVeloPlot(() => props);\n let previous = new Map<string, VeloPlotSeries>();\n\n createEffect(() => {\n if (!api.isReady() || !api.chart()) return;\n previous = diffSeries(\n {\n addSeries: api.addSeries,\n updateSeries: api.updateSeries,\n removeSeries: api.removeSeries,\n autoScale: () => api.chart()!.autoScale(),\n },\n props.series ?? [],\n previous,\n );\n });\n\n return (\n <div\n ref={(el) => api.setContainerRef(el)}\n className={`velo-plot-container${props.class ? ` ${props.class}` : \"\"}`}\n role=\"img\"\n style={{\n position: \"relative\",\n width: typeof props.width === \"number\" ? `${props.width}px` : props.width ?? \"100%\",\n height: typeof props.height === \"number\" ? `${props.height}px` : props.height ?? \"400px\",\n }}\n />\n );\n}\n\nexport function StackedPlot(\n props: {\n panes: import(\"../core/stacked\").StackedPaneConfig[];\n width?: number | string;\n height?: number | string;\n class?: string;\n } & Omit<import(\"../core/stacked\").StackedChartOptions, \"container\" | \"panes\">,\n) {\n const api = useStackedPlot(() => props);\n createEffect(() => api.sync());\n\n return (\n <div\n ref={(el) => api.setContainerRef(el)}\n className={`velo-plot-stacked${props.class ? ` ${props.class}` : \"\"}`}\n role=\"img\"\n style={{\n position: \"relative\",\n width: typeof props.width === \"number\" ? `${props.width}px` : props.width ?? \"100%\",\n height: typeof props.height === \"number\" ? `${props.height}px` : props.height ?? \"480px\",\n }}\n />\n );\n}\n","import { createSignal, createEffect, onCleanup } from \"solid-js\";\nimport type { AddIndicatorOptions, AddIndicatorResult } from \"../core/indicator/addIndicator\";\nimport type { IndicatorPresetName } from \"../core/indicator/indicatorPresets\";\nimport { addIndicatorToHost, isStackedChart, removeIndicatorFromChart, type IndicatorHost } from \"../bindings/shared\";\nimport type { Chart } from \"../core/chart/types\";\n\nexport function useIndicator(\n host: () => IndicatorHost,\n preset: IndicatorPresetName,\n options: AddIndicatorOptions = {},\n) {\n const [result, setResult] = createSignal<(AddIndicatorResult & { paneId?: string }) | null>(null);\n const [isLoading, setIsLoading] = createSignal(false);\n const [error, setError] = createSignal<Error | null>(null);\n\n createEffect(() => {\n const h = host();\n if (!h) return;\n let cancelled = false;\n setIsLoading(true);\n addIndicatorToHost(h, preset, options)\n .then((res) => {\n if (!cancelled) {\n setResult(res);\n setIsLoading(false);\n }\n })\n .catch((e) => {\n if (!cancelled) {\n setError(e instanceof Error ? e : new Error(String(e)));\n setIsLoading(false);\n }\n });\n onCleanup(() => {\n cancelled = true;\n const res = result();\n if (res && !isStackedChart(h)) removeIndicatorFromChart(h as Chart, res.id);\n });\n });\n\n return { result, isLoading, error };\n}\n","import { createSignal, createEffect, onCleanup } from \"solid-js\";\nimport type { ChartLike, SyncOptions } from \"../core/sync\";\nimport { ChartGroup } from \"../core/sync\";\nimport { createChartSync } from \"../bindings/shared\";\n\nexport function useChartSync(charts: () => ChartLike[], options?: SyncOptions) {\n const [group, setGroup] = createSignal<ChartGroup | null>(null);\n\n createEffect(() => {\n const list = charts();\n let handle: ReturnType<typeof createChartSync> | null = null;\n if (list.length >= 2) {\n handle = createChartSync(list, options);\n setGroup(handle.group);\n } else {\n setGroup(null);\n }\n onCleanup(() => handle?.destroy());\n });\n\n return { group };\n}\n\nexport const useChartGroup = useChartSync;\n","export { VeloPlot, StackedPlot } from \"./VeloPlot\";\nexport { useVeloPlot, type UseVeloPlotOptions } from \"./useVeloPlot\";\nexport { useStackedPlot } from \"./useStackedPlot\";\nexport { useIndicator } from \"./useIndicator\";\nexport { useChartSync, useChartGroup } from \"./useChartSync\";\n\nimport { VeloPlot as VeloPlotImpl } from \"./VeloPlot\";\nimport { useVeloPlot as useVeloPlotImpl } from \"./useVeloPlot\";\n\n/** @deprecated Use `VeloPlot` instead. **Removed in v4.0.** */\nexport const SciPlot = VeloPlotImpl;\n/** @deprecated Use `useVeloPlot` instead. **Removed in v4.0.** */\nexport const useSciPlot = useVeloPlotImpl;\n/** @deprecated Use `useVeloPlot` instead. **Removed in v4.0.** */\nexport const useSciChart = useVeloPlotImpl;\n"],"names":["useVeloPlot","options","chart","setChart","createSignal","isReady","setIsReady","error","setError","bounds","setBounds","container","destroy","prevSync","pickSyncableOptions","mount","el","handle","createChartLifecycle","onCleanup","createEffect","c","opts","next","optionsChanged","syncChartOptions","_a","id","data","z","useStackedPlot","getOptions","stack","setStack","structureKey","paneSeries","created","createStackedChart","stackedStructureKey","syncStackedPaneSeries","setContainerRef","s","syncStackedOptions","VeloPlot","props","api","previous","Map","diffSeries","addSeries","updateSeries","removeSeries","autoScale","series","_el$","_tmpl$","_$use","_$effect","_p$","_v$","class","_v$2","width","_v$3","height","e","className","t","_$setStyleProperty","a","undefined","StackedPlot","sync","_el$2","_v$4","_v$5","_v$6","useIndicator","host","preset","result","setResult","isLoading","setIsLoading","h","cancelled","addIndicatorToHost","res","isStackedChart","removeIndicatorFromChart","useChartSync","charts","group","setGroup","list","createChartSync","useChartGroup","SciPlot","VeloPlotImpl","useSciPlot","useVeloPlotImpl","useSciChart"],"mappings":";;;;;;;;;AAaO,SAASA,EAAYC,IAAoC,OAAO,CAAA,IAAK;AAC1E,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAA2B,IAAI,GACnD,CAACC,GAASC,CAAU,IAAIF,EAAa,EAAK,GAC1C,CAACG,GAAOC,CAAQ,IAAIJ,EAA2B,IAAI,GACnD,CAACK,GAAQC,CAAS,IAAIN,EAA4B,IAAI;AAC5D,MAAIO,GACAC,IAA+B,MAC/BC,IAAWC,EAAoBb,GAAS;AAE5C,QAAMc,IAAQ,CAACC,MAAuB;AACpC,IAAAL,IAAYK,GACZJ,KAAA,QAAAA;AACA,UAAMK,IAASC,EAAqBF,GAAIf,EAAA,GAAW;AAAA,MACjD,gBAAgBS;AAAA,MAChB,SAASF;AAAA,IAAA,CACV;AACD,IAAAL,EAASc,EAAO,KAAK,GACrBL,IAAUK,EAAO,SACjBP,EAAUO,EAAO,WAAW,GAC5BX,EAAW,EAAI,GACfO,IAAWC,EAAoBb,GAAS;AAAA,EAC1C;AAEA,SAAAkB,EAAU,MAAM;AACd,IAAAP,KAAA,QAAAA,KACAT,EAAS,IAAI,GACbG,EAAW,EAAK;AAAA,EAClB,CAAC,GAEDc,EAAa,MAAM;AACjB,UAAMC,IAAInB,EAAA,GACJoB,IAAOrB,EAAA;AACb,QAAI,CAACoB,EAAG;AACR,UAAME,IAAOT,EAAoBQ,CAAI;AACrC,IAAIE,EAAeX,GAAUU,CAAI,MAC/BE,EAAiBJ,GAAGR,GA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AE;AAAA,IAC5E,CAAC;AAAA,EACH,CAAC,GAEM,EAAE,QAAAP,GAAQ,WAAAE,GAAW,OAAA3E,EAAA;AAC9B;ACpCO,SAASmF,EAAaC,GAA2B1F,GAAuB;AAC7E,QAAM,CAAC2F,GAAOC,CAAQ,IAAIzF,EAAgC,IAAI;AAE9D,SAAAgB,EAAa,MAAM;AACjB,UAAM0E,IAAOH,EAAA;AACb,QAAI1E,IAAoD;AACxD,IAAI6E,EAAK,UAAU,KACjB7E,IAAS8E,EAAgBD,GAAM7F,CAAO,GACtC4F,EAAS5E,EAAO,KAAK,KAErB4E,EAAS,IAAI,GAEf1E,EAAU,MAAMF,KAAA,gBAAAA,EAAQ,SAAS;AAAA,EACnC,CAAC,GAEM,EAAE,OAAA2E,EAAA;AACX;AAEO,MAAMI,IAAgBN,GCbhBO,IAAUC,GAEVC,KAAaC,GAEbC,KAAcD;"}
@@ -0,0 +1,100 @@
1
+ import { d as w, v as x } from "./optionsSync-QUiN4Inw.js";
2
+ function P(i) {
3
+ return i.map(
4
+ (t) => `${t.id}:${t.height}:${t.showXAxis ?? ""}:${t.showYAxis ?? ""}`
5
+ ).join("|");
6
+ }
7
+ function b(i, t) {
8
+ if (t !== void 0)
9
+ for (const d of i.getPanes())
10
+ d.setTheme(t);
11
+ }
12
+ function g(i, t) {
13
+ if (t === !1) {
14
+ i.setSyncAxis("none");
15
+ return;
16
+ }
17
+ t === !0 || t === void 0 || i.setSyncOptions(t);
18
+ }
19
+ function k(i, t, d) {
20
+ var s;
21
+ const r = /* @__PURE__ */ new Map();
22
+ for (const a of t) {
23
+ const o = i.getPane(a.id);
24
+ if (!o || !((s = a.series) != null && s.length)) {
25
+ r.set(a.id, /* @__PURE__ */ new Map());
26
+ continue;
27
+ }
28
+ const c = a.series.map((e) => {
29
+ var n, f, y, p, h, S, m;
30
+ if (e.type === "candlestick" && e.data)
31
+ return {
32
+ id: e.id,
33
+ type: "candlestick",
34
+ x: e.data.x,
35
+ open: e.data.open,
36
+ high: e.data.high,
37
+ low: e.data.low,
38
+ close: e.data.close,
39
+ color: (n = e.style) == null ? void 0 : n.color,
40
+ width: (f = e.style) == null ? void 0 : f.width,
41
+ visible: e.visible,
42
+ name: e.name
43
+ };
44
+ if (e.type === "bar" && e.data)
45
+ return {
46
+ id: e.id,
47
+ type: "bar",
48
+ x: e.data.x,
49
+ y: e.data.y,
50
+ color: (y = e.style) == null ? void 0 : y.color,
51
+ width: (p = e.style) == null ? void 0 : p.width,
52
+ visible: e.visible,
53
+ name: e.name
54
+ };
55
+ if (e.type === "heatmap" && e.data) {
56
+ const l = e.data;
57
+ return {
58
+ id: e.id,
59
+ type: "heatmap",
60
+ data: {
61
+ xValues: l.xValues,
62
+ yValues: l.yValues,
63
+ zValues: l.zValues
64
+ },
65
+ color: (h = e.style) == null ? void 0 : h.color,
66
+ visible: e.visible,
67
+ name: e.name
68
+ };
69
+ }
70
+ return {
71
+ id: e.id,
72
+ type: "line",
73
+ x: e.data.x,
74
+ y: e.data.y,
75
+ color: (S = e.style) == null ? void 0 : S.color,
76
+ width: (m = e.style) == null ? void 0 : m.width,
77
+ visible: e.visible,
78
+ name: e.name
79
+ };
80
+ }), u = d.get(a.id) ?? /* @__PURE__ */ new Map(), v = {
81
+ addSeries: (e) => o.addSeries(e),
82
+ updateSeries: (e, n) => o.updateSeries(e, n),
83
+ removeSeries: (e) => o.removeSeries(e),
84
+ autoScale: () => o.autoScale()
85
+ };
86
+ if (r.set(a.id, w(v, c, u)), u.size === 0 && a.series.length > 0)
87
+ for (const e of a.series)
88
+ o.getAllSeries().some((n) => n.getId() === e.id) || o.addSeries(x(c.find((n) => n.id === e.id)));
89
+ }
90
+ return r;
91
+ }
92
+ function z(i, t) {
93
+ b(i, t.theme), g(i, t.sync), t.gap !== void 0 && i.resize();
94
+ }
95
+ export {
96
+ z as a,
97
+ k as b,
98
+ P as s
99
+ };
100
+ //# sourceMappingURL=stackedSync-tnrunZMt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stackedSync-tnrunZMt.js","sources":["../src/bindings/shared/stackedSync.ts"],"sourcesContent":["/**\n * Stacked chart option sync without full remount when possible.\n */\n\nimport type { StackedChart, StackedChartOptions } from \"../../core/stacked/types\";\nimport type { StackedPaneConfig } from \"../../core/stacked/types\";\nimport { diffSeries } from \"./seriesDiff\";\nimport type { VeloPlotSeries } from \"./types\";\nimport { veloPlotSeriesToOptions } from \"./seriesDiff\";\n\nexport type SyncableStackedOptions = Omit<StackedChartOptions, \"container\">;\n\nexport function stackedStructureKey(panes: StackedPaneConfig[]): string {\n return panes\n .map(\n (p) =>\n `${p.id}:${p.height}:${p.showXAxis ?? \"\"}:${p.showYAxis ?? \"\"}`,\n )\n .join(\"|\");\n}\n\nexport function syncStackedTheme(\n stack: StackedChart,\n theme: StackedChartOptions[\"theme\"],\n): void {\n if (theme === undefined) return;\n for (const pane of stack.getPanes()) {\n pane.setTheme(theme);\n }\n}\n\nexport function syncStackedSyncOptions(\n stack: StackedChart,\n sync: StackedChartOptions[\"sync\"],\n): void {\n if (sync === false) {\n stack.setSyncAxis(\"none\");\n return;\n }\n if (sync === true || sync === undefined) return;\n stack.setSyncOptions(sync);\n}\n\nexport function syncStackedPaneSeries(\n stack: StackedChart,\n panes: StackedPaneConfig[],\n previousSeries: Map<string, Map<string, VeloPlotSeries>>,\n): Map<string, Map<string, VeloPlotSeries>> {\n const next = new Map<string, Map<string, VeloPlotSeries>>();\n\n for (const pane of panes) {\n const chart = stack.getPane(pane.id);\n if (!chart || !pane.series?.length) {\n next.set(pane.id, new Map());\n continue;\n }\n\n const asVeloPlot: VeloPlotSeries[] = pane.series.map((s) => {\n if (s.type === \"candlestick\" && s.data) {\n return {\n id: s.id,\n type: \"candlestick\" as const,\n x: s.data.x,\n open: s.data.open!,\n high: s.data.high!,\n low: s.data.low!,\n close: s.data.close!,\n color: s.style?.color,\n width: s.style?.width,\n visible: s.visible,\n name: s.name,\n };\n }\n if (s.type === \"bar\" && s.data) {\n return {\n id: s.id,\n type: \"bar\" as const,\n x: s.data.x,\n y: s.data.y,\n color: s.style?.color,\n width: s.style?.width,\n visible: s.visible,\n name: s.name,\n };\n }\n if (s.type === \"heatmap\" && s.data) {\n const hd = s.data as unknown as import(\"../../types\").HeatmapData;\n return {\n id: s.id,\n type: \"heatmap\" as const,\n data: {\n xValues: hd.xValues,\n yValues: hd.yValues,\n zValues: hd.zValues,\n },\n color: s.style?.color,\n visible: s.visible,\n name: s.name,\n };\n }\n return {\n id: s.id,\n type: \"line\" as const,\n x: s.data.x,\n y: s.data.y,\n color: s.style?.color,\n width: s.style?.width,\n visible: s.visible,\n name: s.name,\n };\n });\n\n const prev = previousSeries.get(pane.id) ?? new Map();\n const actions = {\n addSeries: (opts: Parameters<typeof chart.addSeries>[0]) =>\n chart.addSeries(opts),\n updateSeries: (id: string, data: Parameters<typeof chart.updateSeries>[1]) =>\n chart.updateSeries(id, data),\n removeSeries: (id: string) => chart.removeSeries(id),\n autoScale: () => chart.autoScale(),\n };\n next.set(pane.id, diffSeries(actions, asVeloPlot, prev));\n\n // Also handle initial series from StackedPaneConfig on first mount\n if (prev.size === 0 && pane.series.length > 0) {\n for (const s of pane.series) {\n if (!chart.getAllSeries().some((existing) => existing.getId() === s.id)) {\n chart.addSeries(veloPlotSeriesToOptions(asVeloPlot.find((x) => x.id === s.id)!));\n }\n }\n }\n }\n\n return next;\n}\n\nexport function syncStackedOptions(\n stack: StackedChart,\n options: SyncableStackedOptions,\n): void {\n syncStackedTheme(stack, options.theme);\n syncStackedSyncOptions(stack, options.sync);\n if (options.gap !== undefined) {\n stack.resize();\n }\n}\n"],"names":["stackedStructureKey","panes","p","syncStackedTheme","stack","theme","pane","syncStackedSyncOptions","sync","syncStackedPaneSeries","previousSeries","next","chart","_a","asVeloPlot","s","_b","_c","_d","hd","_e","_f","_g","prev","actions","opts","id","data","diffSeries","existing","veloPlotSeriesToOptions","x","syncStackedOptions","options"],"mappings":";AAYO,SAASA,EAAoBC,GAAoC;AACtE,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IAAIsB,EAAWJ,GAASV,GAAYS,CAAI,CAAC,GAGnDA,EAAK,SAAS,KAAKjB,EAAK,OAAO,SAAS;AAC1C,iBAAWS,KAAKT,EAAK;AACnB,QAAKM,EAAM,aAAA,EAAe,KAAK,CAACiB,MAAaA,EAAS,MAAA,MAAYd,EAAE,EAAE,KACpEH,EAAM,UAAUkB,EAAwBhB,EAAW,KAAK,CAACiB,MAAMA,EAAE,OAAOhB,EAAE,EAAE,CAAE,CAAC;AAAA,EAIvF;AAEA,SAAOJ;AACT;AAEO,SAASqB,EACd5B,GACA6B,GACM;AACN,EAAA9B,EAAiBC,GAAO6B,EAAQ,KAAK,GACrC1B,EAAuBH,GAAO6B,EAAQ,IAAI,GACtCA,EAAQ,QAAQ,UAClB7B,EAAM,OAAA;AAEV;"}
@@ -0,0 +1,29 @@
1
+ <script lang="ts">
2
+ import { onMount, onDestroy } from "svelte";
3
+ import { createStackedPlot } from "./useStackedPlot";
4
+ import type { StackedChartOptions } from "../core/stacked";
5
+
6
+ export let panes: StackedChartOptions["panes"];
7
+ export let width: number | string = "100%";
8
+ export let height: number | string = 480;
9
+ export let stackOptions: Omit<StackedChartOptions, "container" | "panes"> = {};
10
+ let className = "";
11
+ export { className as class };
12
+
13
+ const api = createStackedPlot({ panes, ...stackOptions });
14
+ let container: HTMLDivElement;
15
+
16
+ onMount(() => api.mount(container));
17
+ onDestroy(() => api.unmount());
18
+
19
+ $: api.sync({ panes, ...stackOptions });
20
+ </script>
21
+
22
+ <div
23
+ bind:this={container}
24
+ class={`velo-plot-stacked${className ? ` ${className}` : ""}`}
25
+ role="img"
26
+ style:position="relative"
27
+ style:width={typeof width === "number" ? `${width}px` : width}
28
+ style:height={typeof height === "number" ? `${height}px` : height}
29
+ />
@@ -0,0 +1,114 @@
1
+ import { describe, it, expect, vi, afterEach } from "vitest";
2
+ import { mount, flushSync, unmount } from "svelte";
3
+ import StackedPlot from "./StackedPlot.svelte";
4
+
5
+ const mockStack = {
6
+ destroy: vi.fn(),
7
+ whenReady: () => Promise.resolve(),
8
+ fitAll: vi.fn(),
9
+ resetAll: vi.fn(),
10
+ };
11
+
12
+ let paneKey = "a";
13
+
14
+ vi.mock("../core/stacked", () => ({
15
+ createStackedChart: vi.fn(() => mockStack),
16
+ }));
17
+
18
+ vi.mock("../bindings/shared", async (importOriginal) => {
19
+ const actual = await importOriginal<typeof import("../bindings/shared")>();
20
+ return {
21
+ ...actual,
22
+ stackedStructureKey: () => paneKey,
23
+ syncStackedPaneSeries: () => new Map(),
24
+ syncStackedOptions: vi.fn(),
25
+ };
26
+ });
27
+
28
+ describe("StackedPlot.svelte", () => {
29
+ afterEach(() => {
30
+ document.body.replaceChildren();
31
+ vi.clearAllMocks();
32
+ });
33
+
34
+ it("renders with empty class by default", () => {
35
+ const target = document.createElement("div");
36
+ document.body.appendChild(target);
37
+ const component = mount(StackedPlot, {
38
+ target,
39
+ props: {
40
+ panes: [{ id: "p", height: 1, series: [] }],
41
+ },
42
+ });
43
+ flushSync();
44
+ const el = target.querySelector(".velo-plot-stacked") as HTMLElement;
45
+ expect(el.className).toBe("velo-plot-stacked");
46
+ unmount(component);
47
+ });
48
+
49
+ it("renders with custom class", () => {
50
+ const target = document.createElement("div");
51
+ document.body.appendChild(target);
52
+ const component = mount(StackedPlot, {
53
+ target,
54
+ props: {
55
+ panes: [{ id: "p", height: 1, series: [] }],
56
+ class: "stack-panel",
57
+ width: "100%",
58
+ height: 480,
59
+ },
60
+ });
61
+ flushSync();
62
+ expect(target.querySelector(".velo-plot-stacked.stack-panel")).toBeTruthy();
63
+ unmount(component);
64
+ });
65
+
66
+ it("renders with string height and numeric width", () => {
67
+ const target = document.createElement("div");
68
+ document.body.appendChild(target);
69
+ const component = mount(StackedPlot, {
70
+ target,
71
+ props: {
72
+ panes: [{ id: "p", height: 1, series: [] }],
73
+ width: 500,
74
+ height: "50%",
75
+ },
76
+ });
77
+ flushSync();
78
+ const el = target.querySelector(".velo-plot-stacked") as HTMLElement;
79
+ const style = el.getAttribute("style") ?? "";
80
+ expect(style.includes("500px") || el.style.width === "500px").toBe(true);
81
+ expect(style.includes("50%") || el.style.height === "50%").toBe(true);
82
+ unmount(component);
83
+ });
84
+
85
+ it("renders stacked container and syncs options", () => {
86
+ paneKey = "a";
87
+ const target = document.createElement("div");
88
+ document.body.appendChild(target);
89
+ const first = mount(StackedPlot, {
90
+ target,
91
+ props: {
92
+ panes: [{ id: "p", height: 1, series: [] }],
93
+ width: 500,
94
+ height: 300,
95
+ class: "stacked",
96
+ },
97
+ });
98
+ flushSync();
99
+ expect(target.querySelector(".velo-plot-stacked.stacked")).toBeTruthy();
100
+ unmount(first);
101
+ paneKey = "b";
102
+ mount(StackedPlot, {
103
+ target,
104
+ props: {
105
+ panes: [{ id: "q", height: 1, series: [] }],
106
+ stackOptions: { theme: "dark" },
107
+ width: "100%",
108
+ height: 480,
109
+ },
110
+ });
111
+ flushSync();
112
+ expect(mockStack.destroy).toHaveBeenCalled();
113
+ });
114
+ });
@@ -0,0 +1,44 @@
1
+ <script lang="ts">
2
+ import { onMount, onDestroy } from "svelte";
3
+ import { createVeloPlot, type UseVeloPlotOptions } from "./useVeloPlot";
4
+ import { diffSeries, type VeloPlotSeries } from "../bindings/shared";
5
+
6
+ export let series: VeloPlotSeries[] = [];
7
+ export let width: number | string = "100%";
8
+ export let height: number | string = 400;
9
+ export let chartOptions: UseVeloPlotOptions = {};
10
+ let className = "";
11
+ export { className as class };
12
+
13
+ const api = createVeloPlot(chartOptions);
14
+ const { isReady, chart, mount, unmount, updateOptions, addSeries, updateSeries, removeSeries } =
15
+ api;
16
+ let container: HTMLDivElement;
17
+ let previous = new Map<string, VeloPlotSeries>();
18
+
19
+ onMount(() => mount(container));
20
+ onDestroy(() => unmount());
21
+
22
+ $: if ($isReady && $chart) {
23
+ updateOptions(chartOptions);
24
+ previous = diffSeries(
25
+ {
26
+ addSeries,
27
+ updateSeries,
28
+ removeSeries,
29
+ autoScale: () => $chart.autoScale(),
30
+ },
31
+ series,
32
+ previous,
33
+ );
34
+ }
35
+ </script>
36
+
37
+ <div
38
+ bind:this={container}
39
+ class={`velo-plot-container${className ? ` ${className}` : ""}`}
40
+ role="img"
41
+ style:position="relative"
42
+ style:width={typeof width === "number" ? `${width}px` : width}
43
+ style:height={typeof height === "number" ? `${height}px` : height}
44
+ />
@@ -0,0 +1,105 @@
1
+ import { describe, it, expect, vi, afterEach } from "vitest";
2
+ import { mount, flushSync, unmount } from "svelte";
3
+ import VeloPlot from "./VeloPlot.svelte";
4
+ import { buildMockChart } from "../bindings/test-utils";
5
+
6
+ const mockChart = buildMockChart();
7
+
8
+ vi.mock("../bindings/shared/chartLifecycle", () => ({
9
+ createChartLifecycle: vi.fn(() => ({
10
+ chart: mockChart,
11
+ getBounds: () => mockChart.getViewBounds(),
12
+ destroy: mockChart.destroy,
13
+ })),
14
+ pickSyncableOptions: (o: object) => o,
15
+ optionsChanged: () => false,
16
+ syncChartOptions: vi.fn(),
17
+ }));
18
+
19
+ describe("VeloPlot.svelte", () => {
20
+ afterEach(() => {
21
+ document.body.replaceChildren();
22
+ vi.clearAllMocks();
23
+ });
24
+
25
+ it("renders with empty class by default", () => {
26
+ const target = document.createElement("div");
27
+ document.body.appendChild(target);
28
+ const component = mount(VeloPlot, {
29
+ target,
30
+ props: { series: [] },
31
+ });
32
+ flushSync();
33
+ const el = target.querySelector(".velo-plot-container") as HTMLElement;
34
+ expect(el.className).toBe("velo-plot-container");
35
+ unmount(component);
36
+ });
37
+
38
+ it("renders with custom class and string height", () => {
39
+ const target = document.createElement("div");
40
+ document.body.appendChild(target);
41
+ const component = mount(VeloPlot, {
42
+ target,
43
+ props: {
44
+ series: [],
45
+ class: "chart-panel",
46
+ width: 640,
47
+ height: "50vh",
48
+ },
49
+ });
50
+ flushSync();
51
+ const el = target.querySelector(".velo-plot-container.chart-panel") as HTMLElement;
52
+ expect(el).toBeTruthy();
53
+ const style = el.getAttribute("style") ?? "";
54
+ expect(style.includes("50vh") || el.style.height === "50vh").toBe(true);
55
+ unmount(component);
56
+ });
57
+
58
+ it("renders with string width and numeric height", () => {
59
+ const target = document.createElement("div");
60
+ document.body.appendChild(target);
61
+ const component = mount(VeloPlot, {
62
+ target,
63
+ props: {
64
+ series: [],
65
+ width: "100%",
66
+ height: 320,
67
+ },
68
+ });
69
+ flushSync();
70
+ const el = target.querySelector(".velo-plot-container") as HTMLElement;
71
+ expect(el.style.width || el.getAttribute("style")).toContain("100%");
72
+ expect(el.style.height || el.getAttribute("style")).toContain("320px");
73
+ unmount(component);
74
+ });
75
+
76
+ it("mounts chart container and syncs series", () => {
77
+ const target = document.createElement("div");
78
+ document.body.appendChild(target);
79
+ const component = mount(VeloPlot, {
80
+ target,
81
+ props: {
82
+ series: [{ id: "a", x: new Float32Array([0]), y: new Float32Array([0]) }],
83
+ width: 640,
84
+ height: 320,
85
+ class: "custom",
86
+ chartOptions: { animations: false },
87
+ },
88
+ });
89
+ flushSync();
90
+ expect(target.querySelector(".velo-plot-container.custom")).toBeTruthy();
91
+ unmount(component);
92
+ const updated = mount(VeloPlot, {
93
+ target,
94
+ props: {
95
+ series: [{ id: "b", x: new Float32Array([0, 1]), y: new Float32Array([0, 1]) }],
96
+ width: "100%",
97
+ height: 400,
98
+ chartOptions: { theme: "dark" },
99
+ },
100
+ });
101
+ flushSync();
102
+ expect(mockChart.addSeries).toHaveBeenCalled();
103
+ unmount(updated);
104
+ });
105
+ });
@@ -0,0 +1,11 @@
1
+ import { useVeloPlot as useVeloPlotImpl } from './useVeloPlot';
2
+ export { createVeloPlot, useVeloPlot, type UseVeloPlotOptions } from './useVeloPlot';
3
+ export { createStackedPlot, useStackedPlot } from './useStackedPlot';
4
+ export { useIndicator } from './useIndicator';
5
+ export { useChartSync, useChartGroup } from './useChartSync';
6
+ /** @deprecated Use `useVeloPlot` / `createVeloPlot` instead. **Removed in v4.0.** */
7
+ export declare const useSciPlot: typeof useVeloPlotImpl;
8
+ /** @deprecated Use `createVeloPlot` instead. **Removed in v4.0.** */
9
+ export declare const createSciPlot: typeof useVeloPlotImpl;
10
+ /** @deprecated Use `useVeloPlot` instead. **Removed in v4.0.** */
11
+ export declare const useSciChart: typeof useVeloPlotImpl;