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
@@ -1,8 +1,8 @@
1
- function j(r, e) {
1
+ function j(r, t) {
2
2
  if (r.length === 0) return -1;
3
- let s = 0, n = Math.abs(r[0] - e);
3
+ let s = 0, n = Math.abs(r[0] - t);
4
4
  for (let i = 1; i < r.length; i++) {
5
- const f = Math.abs(r[i] - e);
5
+ const f = Math.abs(r[i] - t);
6
6
  f < n && (n = f, s = i);
7
7
  }
8
8
  return s;
@@ -10,13 +10,13 @@ function j(r, e) {
10
10
  function J(r) {
11
11
  if (r.barX.length === 0)
12
12
  return { x: r.x, y: r.y };
13
- const e = j(r.barX, r.x);
14
- if (e < 0) return { x: r.x, y: r.y };
15
- const s = r.barX[e], n = [
16
- r.open[e],
17
- r.high[e],
18
- r.low[e],
19
- r.close[e]
13
+ const t = j(r.barX, r.x);
14
+ if (t < 0) return { x: r.x, y: r.y };
15
+ const s = r.barX[t], n = [
16
+ r.open[t],
17
+ r.high[t],
18
+ r.low[t],
19
+ r.close[t]
20
20
  ], i = r.dataToPixelY(r.y), f = r.pixelThreshold ?? 12;
21
21
  let m = r.y, d = 1 / 0;
22
22
  for (const c of n) {
@@ -25,24 +25,24 @@ function J(r) {
25
25
  }
26
26
  return { x: s, y: m };
27
27
  }
28
- function $(r, e) {
29
- const s = e.y - r.y, n = Math.abs(r.y), i = n > 0 ? s / n * 100 : 0, f = Math.round(Math.abs(e.x - r.x));
28
+ function $(r, t) {
29
+ const s = t.y - r.y, n = Math.abs(r.y), i = n > 0 ? s / n * 100 : 0, f = Math.round(Math.abs(t.x - r.x));
30
30
  return { change: s, percent: i, bars: f, up: s >= 0 };
31
31
  }
32
32
  function L(r) {
33
- const e = r.change >= 0 ? "+" : "";
34
- return `${e}${r.change.toFixed(2)} (${e}${r.percent.toFixed(2)}%) · ${r.bars} bars`;
33
+ const t = r.change >= 0 ? "+" : "";
34
+ return `${t}${r.change.toFixed(2)} (${t}${r.percent.toFixed(2)}%) · ${r.bars} bars`;
35
35
  }
36
36
  function U(r) {
37
- const e = Math.abs(r), s = e >= 1e3 ? 0 : e >= 1 ? 2 : 4;
37
+ const t = Math.abs(r), s = t >= 1e3 ? 0 : t >= 1 ? 2 : 4;
38
38
  return r.toLocaleString("en-US", {
39
39
  minimumFractionDigits: s,
40
40
  maximumFractionDigits: s
41
41
  });
42
42
  }
43
43
  const Y = [0, 0.236, 0.382, 0.5, 0.618, 0.786, 1], K = 4, Q = "#26a69a", Z = "#ef5350";
44
- function E(r, e) {
45
- return r.startsWith("#") && r.length === 7 ? r + e : r;
44
+ function E(r, t) {
45
+ return r.startsWith("#") && r.length === 7 ? r + t : r;
46
46
  }
47
47
  const C = {
48
48
  name: "velo-plot-drawing-tools",
@@ -54,12 +54,12 @@ const C = {
54
54
  function B(r) {
55
55
  return r !== "none" && r !== "pan";
56
56
  }
57
- function tt(r) {
58
- for (const e of r.data.getAllSeries())
59
- if (e.getType() === "candlestick") return e;
57
+ function ee(r) {
58
+ for (const t of r.data.getAllSeries())
59
+ if (t.getType() === "candlestick") return t;
60
60
  }
61
- function it(r = {}) {
62
- let e = null;
61
+ function ie(r = {}) {
62
+ let t = null;
63
63
  const s = r.autoDeselect !== !1;
64
64
  let n = {
65
65
  mode: "none",
@@ -75,8 +75,8 @@ function it(r = {}) {
75
75
  };
76
76
  const i = r.color ?? "#38bdf8", f = r.measureUpColor ?? Q, m = r.measureDownColor ?? Z;
77
77
  function d() {
78
- var t, o;
79
- return ((o = e == null ? void 0 : (t = e.chart).getAnnotations) == null ? void 0 : o.call(t)) ?? [];
78
+ var e, o;
79
+ return ((o = t == null ? void 0 : (e = t.chart).getAnnotations) == null ? void 0 : o.call(e)) ?? [];
80
80
  }
81
81
  function c() {
82
82
  n.undoStack.push(d()), n.redoStack = [];
@@ -84,77 +84,77 @@ function it(r = {}) {
84
84
  function h() {
85
85
  n.pending = null, n.start = null, n.dragging = !1, n.dragMoved = !1, n.dragStartPixel = null;
86
86
  }
87
- function x(t) {
87
+ function x(e) {
88
88
  var o, a;
89
- n.mode = t, h(), (o = r.onModeChange) == null || o.call(r, t), (a = e == null ? void 0 : e.requestRender) == null || a.call(e);
89
+ n.mode = e, h(), (o = r.onModeChange) == null || o.call(r, e), (a = t == null ? void 0 : t.requestRender) == null || a.call(t);
90
90
  }
91
91
  function u() {
92
- var t;
93
- h(), s ? x("none") : (t = e == null ? void 0 : e.requestRender) == null || t.call(e);
92
+ var e;
93
+ h(), s ? x("none") : (e = t == null ? void 0 : t.requestRender) == null || e.call(t);
94
94
  }
95
- function T(t, o) {
96
- if (!e || !n.magnet) return { x: t, y: o };
97
- const a = tt(e);
98
- if (!a) return { x: t, y: o };
95
+ function T(e, o) {
96
+ if (!t || !n.magnet) return { x: e, y: o };
97
+ const a = ee(t);
98
+ if (!a) return { x: e, y: o };
99
99
  const l = a.getData();
100
- return !l.open || !l.high || !l.low || !l.close ? { x: t, y: o } : J({
101
- x: t,
100
+ return !l.open || !l.high || !l.low || !l.close ? { x: e, y: o } : J({
101
+ x: e,
102
102
  y: o,
103
103
  barX: l.x,
104
104
  open: l.open,
105
105
  high: l.high,
106
106
  low: l.low,
107
107
  close: l.close,
108
- dataToPixelX: (y) => e.coords.dataToPixelX(y),
109
- dataToPixelY: (y) => e.coords.dataToPixelY(y),
108
+ dataToPixelX: t.coords.dataToPixelX,
109
+ dataToPixelY: (y) => t.coords.dataToPixelY(y),
110
110
  enabled: !0
111
111
  });
112
112
  }
113
- function k(t, o) {
113
+ function k(e, o) {
114
114
  return T(
115
- t.coords.pixelToDataX(o.pixelX),
116
- t.coords.pixelToDataY(o.pixelY)
115
+ e.coords.pixelToDataX(o.pixelX),
116
+ e.coords.pixelToDataY(o.pixelY)
117
117
  );
118
118
  }
119
- function W(t) {
120
- e && (c(), e.chart.addAnnotation({
119
+ function W(e) {
120
+ t && (c(), t.chart.addAnnotation({
121
121
  type: "horizontal-line",
122
- y: t,
122
+ y: e,
123
123
  color: i,
124
124
  interactive: !0
125
125
  }));
126
126
  }
127
- function z(t) {
128
- e && (c(), e.chart.addAnnotation({
127
+ function z(e) {
128
+ t && (c(), t.chart.addAnnotation({
129
129
  type: "vertical-line",
130
- x: t,
130
+ x: e,
131
131
  color: i,
132
132
  interactive: !0
133
133
  }));
134
134
  }
135
- function _(t, o) {
136
- if (!e) return;
135
+ function _(e, o) {
136
+ if (!t) return;
137
137
  c();
138
- const a = $(t, o), l = a.up ? f : m, y = (t.x + o.x) / 2;
139
- e.chart.addAnnotation({
138
+ const a = $(e, o), l = a.up ? f : m, y = (e.x + o.x) / 2;
139
+ t.chart.addAnnotation({
140
140
  type: "rectangle",
141
- xMin: Math.min(t.x, o.x),
142
- xMax: Math.max(t.x, o.x),
143
- yMin: Math.min(t.y, o.y),
144
- yMax: Math.max(t.y, o.y),
141
+ xMin: Math.min(e.x, o.x),
142
+ xMax: Math.max(e.x, o.x),
143
+ yMin: Math.min(e.y, o.y),
144
+ yMax: Math.max(e.y, o.y),
145
145
  strokeColor: l,
146
146
  fillColor: E(l, "33"),
147
147
  interactive: !0
148
- }), e.chart.addAnnotation({
148
+ }), t.chart.addAnnotation({
149
149
  type: "arrow",
150
150
  x1: y,
151
- y1: t.y,
151
+ y1: e.y,
152
152
  x2: y,
153
153
  y2: o.y,
154
154
  color: l,
155
155
  headStyle: "filled",
156
156
  interactive: !0
157
- }), e.chart.addAnnotation({
157
+ }), t.chart.addAnnotation({
158
158
  type: "text",
159
159
  x: y,
160
160
  y: o.y,
@@ -167,38 +167,38 @@ function it(r = {}) {
167
167
  interactive: !0
168
168
  });
169
169
  }
170
- function F(t, o) {
171
- if (e) {
170
+ function F(e, o) {
171
+ if (t) {
172
172
  if (n.mode === "measure") {
173
- _(t, o);
173
+ _(e, o);
174
174
  return;
175
175
  }
176
176
  if (c(), n.mode === "trendline")
177
- e.chart.addAnnotation({
177
+ t.chart.addAnnotation({
178
178
  type: "arrow",
179
- x1: t.x,
180
- y1: t.y,
179
+ x1: e.x,
180
+ y1: e.y,
181
181
  x2: o.x,
182
182
  y2: o.y,
183
183
  color: i,
184
184
  interactive: !0
185
185
  });
186
186
  else if (n.mode === "rectangle")
187
- e.chart.addAnnotation({
187
+ t.chart.addAnnotation({
188
188
  type: "rectangle",
189
- xMin: Math.min(t.x, o.x),
190
- xMax: Math.max(t.x, o.x),
191
- yMin: Math.min(t.y, o.y),
192
- yMax: Math.max(t.y, o.y),
189
+ xMin: Math.min(e.x, o.x),
190
+ xMax: Math.max(e.x, o.x),
191
+ yMin: Math.min(e.y, o.y),
192
+ yMax: Math.max(e.y, o.y),
193
193
  strokeColor: i,
194
194
  fillColor: i + "22",
195
195
  interactive: !0
196
196
  });
197
197
  else if (n.mode === "fibonacci") {
198
- const a = Math.min(t.y, o.y), l = Math.max(t.y, o.y);
198
+ const a = Math.min(e.y, o.y), l = Math.max(e.y, o.y);
199
199
  for (const y of Y) {
200
200
  const M = l - (l - a) * y;
201
- e.chart.addAnnotation({
201
+ t.chart.addAnnotation({
202
202
  type: "horizontal-line",
203
203
  y: M,
204
204
  color: i,
@@ -211,60 +211,60 @@ function it(r = {}) {
211
211
  }
212
212
  }
213
213
  }
214
- function H(t, o, a) {
214
+ function H(e, o, a) {
215
215
  const l = n.mode;
216
216
  if (!B(l) || !n.cursor) return;
217
217
  const y = n.cursor, M = n.pending ?? n.start;
218
- t.save(), t.strokeStyle = i, t.lineWidth = 1.5, t.setLineDash([6, 4]), t.globalAlpha = 0.85;
218
+ e.save(), e.strokeStyle = i, e.lineWidth = 1.5, e.setLineDash([6, 4]), e.globalAlpha = 0.85;
219
219
  const b = (g, v) => ({
220
220
  px: a.dataToPixelX(g),
221
221
  py: a.dataToPixelY(v)
222
222
  });
223
223
  if (l === "horizontal") {
224
224
  const { py: g } = b(0, y.y);
225
- t.beginPath(), t.moveTo(o.x, g), t.lineTo(o.x + o.width, g), t.stroke();
225
+ e.beginPath(), e.moveTo(o.x, g), e.lineTo(o.x + o.width, g), e.stroke();
226
226
  } else if (l === "vertical") {
227
227
  const { px: g } = b(y.x, 0);
228
- t.beginPath(), t.moveTo(g, o.y), t.lineTo(g, o.y + o.height), t.stroke();
228
+ e.beginPath(), e.moveTo(g, o.y), e.lineTo(g, o.y + o.height), e.stroke();
229
229
  } else if (M) {
230
230
  const g = b(M.x, M.y), v = b(y.x, y.y);
231
231
  if (l === "trendline")
232
- t.beginPath(), t.moveTo(g.px, g.py), t.lineTo(v.px, v.py), t.stroke();
232
+ e.beginPath(), e.moveTo(g.px, g.py), e.lineTo(v.px, v.py), e.stroke();
233
233
  else if (l === "rectangle") {
234
234
  const S = Math.min(g.px, v.px), w = Math.min(g.py, v.py), p = Math.abs(v.px - g.px), P = Math.abs(v.py - g.py);
235
- t.strokeRect(S, w, p, P), t.fillStyle = i + "22", t.fillRect(S, w, p, P);
235
+ e.strokeRect(S, w, p, P), e.fillStyle = i + "22", e.fillRect(S, w, p, P);
236
236
  } else if (l === "fibonacci") {
237
237
  const S = Math.min(M.y, y.y), w = Math.max(M.y, y.y);
238
- t.font = "11px sans-serif", t.textAlign = "left", t.textBaseline = "bottom";
238
+ e.font = "11px sans-serif", e.textAlign = "left", e.textBaseline = "bottom";
239
239
  for (const p of Y) {
240
240
  const P = w - (w - S) * p, { py: A } = b(0, P);
241
- t.beginPath(), t.moveTo(o.x, A), t.lineTo(o.x + o.width, A), t.stroke(), t.save(), t.setLineDash([]), t.globalAlpha = 1, t.fillStyle = i, t.fillText(
241
+ e.beginPath(), e.moveTo(o.x, A), e.lineTo(o.x + o.width, A), e.stroke(), e.save(), e.setLineDash([]), e.globalAlpha = 1, e.fillStyle = i, e.fillText(
242
242
  `${(p * 100).toFixed(1)}% ${U(P)}`,
243
243
  o.x + 4,
244
244
  A - 2
245
- ), t.restore();
245
+ ), e.restore();
246
246
  }
247
- } else l === "measure" && O(t, g, v, M, y);
247
+ } else l === "measure" && O(e, g, v, M, y);
248
248
  }
249
- t.restore();
249
+ e.restore();
250
250
  }
251
- function O(t, o, a, l, y) {
251
+ function O(e, o, a, l, y) {
252
252
  const M = $(l, y), b = M.up ? f : m, g = Math.min(o.px, a.px), v = Math.min(o.py, a.py), S = Math.abs(a.px - o.px), w = Math.abs(a.py - o.py);
253
- t.setLineDash([]), t.globalAlpha = 0.9, t.fillStyle = E(b, "33"), t.fillRect(g, v, S, w), t.strokeStyle = b, t.lineWidth = 1.5, t.strokeRect(g, v, S, w);
253
+ e.setLineDash([]), e.globalAlpha = 0.9, e.fillStyle = E(b, "33"), e.fillRect(g, v, S, w), e.strokeStyle = b, e.lineWidth = 1.5, e.strokeRect(g, v, S, w);
254
254
  const p = (o.px + a.px) / 2;
255
- t.beginPath(), t.moveTo(p, o.py), t.lineTo(p, a.py), t.stroke();
255
+ e.beginPath(), e.moveTo(p, o.py), e.lineTo(p, a.py), e.stroke();
256
256
  const P = 7, A = a.py >= o.py ? 1 : -1;
257
- t.beginPath(), t.moveTo(p, a.py), t.lineTo(p - 4, a.py - A * P), t.lineTo(p + 4, a.py - A * P), t.closePath(), t.fillStyle = b, t.fill();
257
+ e.beginPath(), e.moveTo(p, a.py), e.lineTo(p - 4, a.py - A * P), e.lineTo(p + 4, a.py - A * P), e.closePath(), e.fillStyle = b, e.fill();
258
258
  const I = L(M);
259
- t.font = "12px sans-serif";
260
- const R = t.measureText(I).width + 6 * 2, D = 20, G = p - R / 2, X = M.up ? a.py - D - 8 : a.py + 8;
261
- t.globalAlpha = 1, t.fillStyle = b, t.fillRect(G, X, R, D), t.fillStyle = "#ffffff", t.textAlign = "center", t.textBaseline = "middle", t.fillText(I, p, X + D / 2);
259
+ e.font = "12px sans-serif";
260
+ const R = e.measureText(I).width + 6 * 2, D = 20, G = p - R / 2, X = M.up ? a.py - D - 8 : a.py + 8;
261
+ e.globalAlpha = 1, e.fillStyle = b, e.fillRect(G, X, R, D), e.fillStyle = "#ffffff", e.textAlign = "center", e.textBaseline = "middle", e.fillText(I, p, X + D / 2);
262
262
  }
263
- function N(t, o) {
263
+ function N(e, o) {
264
264
  var l;
265
265
  if (!o.inPlotArea) return;
266
266
  o.preventDefault();
267
- const a = k(t, o);
267
+ const a = k(e, o);
268
268
  if (n.mode === "horizontal") {
269
269
  W(a.y), u();
270
270
  return;
@@ -277,104 +277,104 @@ function it(r = {}) {
277
277
  F(n.pending, a), u();
278
278
  return;
279
279
  }
280
- n.start = a, n.dragging = !0, n.dragMoved = !1, n.dragStartPixel = { x: o.pixelX, y: o.pixelY }, n.cursor = a, (l = t.requestRender) == null || l.call(t);
280
+ n.start = a, n.dragging = !0, n.dragMoved = !1, n.dragStartPixel = { x: o.pixelX, y: o.pixelY }, n.cursor = a, (l = e.requestRender) == null || l.call(e);
281
281
  }
282
- function V(t, o) {
282
+ function V(e, o) {
283
283
  var l;
284
- const a = k(t, o);
284
+ const a = k(e, o);
285
285
  if (n.cursor = a, n.dragging && n.dragStartPixel) {
286
286
  const y = o.pixelX - n.dragStartPixel.x, M = o.pixelY - n.dragStartPixel.y;
287
287
  Math.hypot(y, M) >= K && (n.dragMoved = !0);
288
288
  }
289
- o.preventDefault(), (l = t.requestRender) == null || l.call(t);
289
+ o.preventDefault(), (l = e.requestRender) == null || l.call(e);
290
290
  }
291
- function q(t, o) {
291
+ function q(e, o) {
292
292
  var y;
293
293
  if (!n.dragging || !n.start) return;
294
- const a = k(t, o), l = n.start;
294
+ const a = k(e, o), l = n.start;
295
295
  if (n.dragging = !1, n.dragStartPixel = null, n.dragMoved) {
296
296
  F(l, a), u();
297
297
  return;
298
298
  }
299
- n.pending = l, n.start = null, n.cursor = a, (y = t.requestRender) == null || y.call(t);
299
+ n.pending = l, n.start = null, n.cursor = a, (y = e.requestRender) == null || y.call(e);
300
300
  }
301
301
  return {
302
302
  manifest: C,
303
303
  api: {
304
- setMode(t) {
305
- x(t);
304
+ setMode(e) {
305
+ x(e);
306
306
  },
307
307
  getMode() {
308
308
  return n.mode;
309
309
  },
310
- setMagnet(t) {
311
- n.magnet = t;
310
+ setMagnet(e) {
311
+ n.magnet = e;
312
312
  },
313
313
  isMagnet() {
314
314
  return n.magnet;
315
315
  },
316
316
  undo() {
317
- if (!e || n.undoStack.length === 0) return !1;
317
+ if (!t || n.undoStack.length === 0) return !1;
318
318
  n.redoStack.push(d());
319
- const t = n.undoStack.pop(), o = d();
320
- for (const a of o) e.chart.removeAnnotation(a.id);
321
- for (const a of t) e.chart.addAnnotation(a);
319
+ const e = n.undoStack.pop(), o = d();
320
+ for (const a of o) t.chart.removeAnnotation(a.id);
321
+ for (const a of e) t.chart.addAnnotation(a);
322
322
  return !0;
323
323
  },
324
324
  redo() {
325
- if (!e || n.redoStack.length === 0) return !1;
325
+ if (!t || n.redoStack.length === 0) return !1;
326
326
  n.undoStack.push(d());
327
- const t = n.redoStack.pop(), o = d();
328
- for (const a of o) e.chart.removeAnnotation(a.id);
329
- for (const a of t) e.chart.addAnnotation(a);
327
+ const e = n.redoStack.pop(), o = d();
328
+ for (const a of o) t.chart.removeAnnotation(a.id);
329
+ for (const a of e) t.chart.addAnnotation(a);
330
330
  return !0;
331
331
  },
332
332
  clear() {
333
- if (e) {
333
+ if (t) {
334
334
  c();
335
- for (const t of d()) e.chart.removeAnnotation(t.id);
335
+ for (const e of d()) t.chart.removeAnnotation(e.id);
336
336
  }
337
337
  }
338
338
  },
339
- onInit(t) {
340
- e = t;
339
+ onInit(e) {
340
+ t = e;
341
341
  },
342
342
  onDestroy() {
343
- e = null;
343
+ t = null;
344
344
  },
345
- onInteraction(t, o) {
345
+ onInteraction(e, o) {
346
346
  if (B(n.mode)) {
347
347
  if (o.type === "mousedown") {
348
- N(t, o);
348
+ N(e, o);
349
349
  return;
350
350
  }
351
351
  if (o.type === "mousemove") {
352
- V(t, o);
352
+ V(e, o);
353
353
  return;
354
354
  }
355
- o.type === "mouseup" && q(t, o);
355
+ o.type === "mouseup" && q(e, o);
356
356
  }
357
357
  },
358
- onRenderOverlay(t) {
359
- const o = t.render.ctx2d;
360
- o && H(o, t.render.plotArea, t.coords);
358
+ onRenderOverlay(e) {
359
+ const o = e.render.ctx2d;
360
+ o && H(o, e.render.plotArea, e.coords);
361
361
  }
362
362
  };
363
363
  }
364
- const et = {
364
+ const te = {
365
365
  name: "velo-plot-replay",
366
366
  version: "1.0.0",
367
367
  description: "Bar-by-bar chart replay with speed control",
368
368
  provides: ["replay"],
369
369
  tags: ["replay", "trading"]
370
370
  };
371
- function lt(r) {
372
- let e = null, s = null, n = 0, i = null, f = 1;
371
+ function le(r) {
372
+ let t = null, s = null, n = 0, i = null, f = 1;
373
373
  const m = r.frameMs ?? 250;
374
374
  function d(h) {
375
- if (!e || !s) return;
375
+ if (!t || !s) return;
376
376
  const x = Math.min(h + 1, s.x.length), u = (T) => T ? T.subarray(0, x) : void 0;
377
- e.chart.updateSeries(r.seriesId, {
377
+ t.chart.updateSeries(r.seriesId, {
378
378
  x: u(s.x),
379
379
  y: u(s.y),
380
380
  open: u(s.open),
@@ -386,6 +386,10 @@ function lt(r) {
386
386
  const c = {
387
387
  play(h = 1) {
388
388
  s && (f = Math.max(0.1, h), i && clearInterval(i), i = setInterval(() => {
389
+ if (!t || !s) {
390
+ c.pause();
391
+ return;
392
+ }
389
393
  if (n >= s.x.length - 1) {
390
394
  c.pause();
391
395
  return;
@@ -413,11 +417,11 @@ function lt(r) {
413
417
  }
414
418
  };
415
419
  return {
416
- manifest: et,
420
+ manifest: te,
417
421
  api: c,
418
422
  onInit(h) {
419
- e = h;
420
- const x = e.chart.getSeries(r.seriesId);
423
+ t = h;
424
+ const x = t.chart.getSeries(r.seriesId);
421
425
  if (!x) {
422
426
  console.warn(`[PluginReplay] Series "${r.seriesId}" not found`);
423
427
  return;
@@ -433,26 +437,26 @@ function lt(r) {
433
437
  }, n = Math.max(0, s.x.length - 1);
434
438
  },
435
439
  onDestroy() {
436
- c.pause(), e = null, s = null;
440
+ c.pause(), t = null, s = null;
437
441
  }
438
442
  };
439
443
  }
440
- function ct(r) {
441
- const e = r.length, s = new Float64Array(e), n = new Float32Array(e), i = new Float32Array(e), f = new Float32Array(e), m = new Float32Array(e), d = new Float32Array(e);
442
- for (let c = 0; c < e; c++) {
444
+ function ce(r) {
445
+ const t = r.length, s = new Float64Array(t), n = new Float32Array(t), i = new Float32Array(t), f = new Float32Array(t), m = new Float32Array(t), d = new Float32Array(t);
446
+ for (let c = 0; c < t; c++) {
443
447
  const h = r[c];
444
448
  s[c] = h.time, n[c] = h.open, i[c] = h.high, f[c] = h.low, m[c] = h.close, d[c] = h.volume ?? 0;
445
449
  }
446
450
  return { x: s, open: n, high: i, low: f, close: m, volume: d };
447
451
  }
448
- function nt(r) {
449
- let e = r;
450
- return () => (e = e * 16807 % 2147483647, (e - 1) / 2147483646);
452
+ function ne(r) {
453
+ let t = r;
454
+ return () => (t = t * 16807 % 2147483647, (t - 1) / 2147483646);
451
455
  }
452
- function ot(r, e, s, n, i) {
456
+ function oe(r, t, s, n, i) {
453
457
  const f = [];
454
458
  let m = n;
455
- for (let d = r; d <= e; d += s) {
459
+ for (let d = r; d <= t; d += s) {
456
460
  const c = m, h = (i() - 0.48) * 2, x = Math.max(1, c + h), u = Math.max(c, x) + i() * 1.5, T = Math.min(c, x) - i() * 1.5;
457
461
  f.push({
458
462
  time: d,
@@ -465,8 +469,8 @@ function ot(r, e, s, n, i) {
465
469
  }
466
470
  return f;
467
471
  }
468
- function ft(r = {}) {
469
- const e = r.barMs ?? 6e4, s = r.basePrice ?? 100, n = nt(r.seed ?? 42), i = /* @__PURE__ */ new Map();
472
+ function fe(r = {}) {
473
+ const t = r.barMs ?? 6e4, s = r.basePrice ?? 100, n = ne(r.seed ?? 42), i = /* @__PURE__ */ new Map();
470
474
  return {
471
475
  async resolveSymbol(f) {
472
476
  return {
@@ -482,7 +486,7 @@ function ft(r = {}) {
482
486
  const m = `${f.symbol}:${f.from}:${f.to}`;
483
487
  return i.has(m) || i.set(
484
488
  m,
485
- ot(f.from, f.to, e, s, n)
489
+ oe(f.from, f.to, t, s, n)
486
490
  ), i.get(m);
487
491
  },
488
492
  subscribeBars(f) {
@@ -497,15 +501,15 @@ function ft(r = {}) {
497
501
  close: h,
498
502
  volume: 1e3 + n() * 3e3
499
503
  }), m = h;
500
- }, e);
504
+ }, t);
501
505
  return () => clearInterval(d);
502
506
  }
503
507
  };
504
508
  }
505
509
  export {
506
- it as P,
507
- lt as a,
508
- ct as b,
509
- ft as c
510
+ ie as P,
511
+ le as a,
512
+ ce as b,
513
+ fe as c
510
514
  };
511
- //# sourceMappingURL=mockDatafeed-Cdg5hKEo.js.map
515
+ //# sourceMappingURL=mockDatafeed-DHIDPcpX.js.map