velo-plot 2.20.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -12
- package/dist/ChartCore-AnR_3Xkb.js +7338 -0
- package/dist/ChartCore-AnR_3Xkb.js.map +1 -0
- package/dist/GpuChartRenderer-Dxc0hrQA.js +75 -0
- package/dist/GpuChartRenderer-Dxc0hrQA.js.map +1 -0
- package/dist/{index.core-COREBDNq.js → PluginRegistry-CzMHebYP.js} +24 -38
- package/dist/PluginRegistry-CzMHebYP.js.map +1 -0
- package/dist/a11y-Bw6urYpr.js +105 -0
- package/dist/a11y-Bw6urYpr.js.map +1 -0
- package/dist/angular/hooks-entry.d.ts +1 -0
- package/dist/angular/hooks.d.ts +26 -0
- package/dist/angular/index.d.ts +8 -0
- package/dist/angular/velo-plot.component.d.ts +46 -0
- package/dist/angular-hooks.d.ts +1 -0
- package/dist/angular-hooks.js +9 -0
- package/dist/angular-hooks.js.map +1 -0
- package/dist/angular.d.ts +1 -0
- package/dist/angular.js +166 -0
- package/dist/angular.js.map +1 -0
- package/dist/assets/indicator.worker-bv0zC4EX.js.map +1 -1
- package/dist/astro/StackedPlot.astro +19 -0
- package/dist/astro/VeloPlot.astro +23 -0
- package/dist/{axisFormat-CzumxpCL.js → axisFormat-Sz4WIJfQ.js} +2 -2
- package/dist/{axisFormat-CzumxpCL.js.map → axisFormat-Sz4WIJfQ.js.map} +1 -1
- package/dist/bindings/shared/a11y.d.ts +26 -0
- package/dist/bindings/shared/chartLifecycle.d.ts +16 -0
- package/dist/bindings/shared/chartSyncBridge.d.ts +8 -0
- package/dist/bindings/shared/dimensions.d.ts +1 -0
- package/dist/bindings/shared/index.d.ts +9 -0
- package/dist/bindings/shared/indicatorBridge.d.ts +11 -0
- package/dist/bindings/shared/optionsSync.d.ts +7 -0
- package/dist/bindings/shared/seriesDiff.d.ts +8 -0
- package/dist/bindings/shared/stackedSync.d.ts +9 -0
- package/dist/bindings/shared/types.d.ts +46 -0
- package/dist/bindings/test-utils/index.d.ts +35 -0
- package/dist/bindings/test-utils/mockLifecycle.d.ts +120 -0
- package/dist/bindings/test-utils/vitestSveltePlugin.d.ts +3 -0
- package/dist/chartSyncBridge-D_rCtbFq.js +58 -0
- package/dist/chartSyncBridge-D_rCtbFq.js.map +1 -0
- package/dist/core/Chart.d.ts +1 -1
- package/dist/core/ChartStatistics.d.ts +1 -1
- package/dist/core/InteractionManager.d.ts +7 -1
- package/dist/core/OverlayRenderer.d.ts +5 -0
- package/dist/core/annotations/types.d.ts +1 -1
- package/dist/core/chart/ChartCore.d.ts +14 -19
- package/dist/core/chart/ChartFeatureHooks.d.ts +7 -0
- package/dist/core/chart/chartExportPatch.d.ts +2 -0
- package/dist/core/chart/overlaySeriesRegistry.d.ts +7 -0
- package/dist/core/chart/series/SeriesActions.d.ts +1 -0
- package/dist/core/chart/series/SeriesBufferLite.d.ts +13 -0
- package/dist/core/chart/series/seriesOptionsRegistry.d.ts +8 -0
- package/dist/core/chart/series/seriesTypeRegistry.d.ts +5 -0
- package/dist/core/chart/types.d.ts +1 -1
- package/dist/core/clipboard/index.d.ts +1 -1
- package/dist/core/debug/index.d.ts +1 -1
- package/dist/core/keybindings/index.d.ts +1 -1
- package/dist/core/loading/index.d.ts +1 -1
- package/dist/core/locale/index.d.ts +1 -1
- package/dist/core/stacked/paneResize.d.ts +3 -0
- package/dist/core/stacked/types.d.ts +10 -0
- package/dist/core/theme-editor/index.d.ts +1 -1
- package/dist/createStackedChart-DqcLCFGS.js +1338 -0
- package/dist/createStackedChart-DqcLCFGS.js.map +1 -0
- package/dist/examples/PluginDemonstration.d.ts +1 -1
- package/dist/hooks-DH-3bewj.js +69 -0
- package/dist/hooks-DH-3bewj.js.map +1 -0
- package/dist/{index-BBpJwOct.js → index-0InEyj0q.js} +119 -121
- package/dist/index-0InEyj0q.js.map +1 -0
- package/dist/{index-qunX30Xu.js → index-B7PTX94B.js} +2133 -2133
- package/dist/index-B7PTX94B.js.map +1 -0
- package/dist/{index-BMiZoKmm.js → index-BgrvqltV.js} +67 -67
- package/dist/index-BgrvqltV.js.map +1 -0
- package/dist/{index-DoYxf1cV.js → index-CWxIHdwX.js} +38 -98
- package/dist/index-CWxIHdwX.js.map +1 -0
- package/dist/index-CaXWSOTk.js.map +1 -1
- package/dist/{mockDatafeed-927foCM4.js → index-Cv6ZDLWf.js} +227 -217
- package/dist/index-Cv6ZDLWf.js.map +1 -0
- package/dist/index-Dag88bW4.js.map +1 -1
- package/dist/index-qhscKTDy.js.map +1 -1
- package/dist/index.core.d.ts +9 -7
- package/dist/index.d.ts +2 -15
- package/dist/indicators--eJGmVox.js.map +1 -1
- package/dist/optionsSync-QUiN4Inw.js +119 -0
- package/dist/optionsSync-QUiN4Inw.js.map +1 -0
- package/dist/plugins/3d/index.d.ts +2 -2
- package/dist/plugins/3d.d.ts +2 -2
- package/dist/plugins/3d.js +3 -1
- package/dist/plugins/3d.js.map +1 -1
- package/dist/plugins/analysis/index.d.ts +1 -1
- package/dist/plugins/analysis/indicators.d.ts +1 -1
- package/dist/plugins/analysis.d.ts +2 -2
- package/dist/plugins/analysis.js +2 -2
- package/dist/plugins/analysis.js.map +1 -1
- package/dist/plugins/annotations/index.d.ts +1 -1
- package/dist/plugins/annotations.d.ts +2 -2
- package/dist/plugins/annotations.js.map +1 -1
- package/dist/plugins/anomaly-detection.js +1 -1
- package/dist/plugins/anomaly-detection.js.map +1 -1
- package/dist/plugins/broken-axis.d.ts +2 -2
- package/dist/plugins/builtins/crosshair/CrosshairPlugin.d.ts +1 -1
- package/dist/plugins/builtins/index.d.ts +1 -1
- package/dist/plugins/caching.d.ts +2 -2
- package/dist/plugins/clipboard/index.d.ts +2 -2
- package/dist/plugins/clipboard.d.ts +2 -2
- package/dist/plugins/clipboard.js.map +1 -1
- package/dist/plugins/context-menu/index.d.ts +1 -1
- package/dist/plugins/context-menu.d.ts +2 -2
- package/dist/plugins/context-menu.js +1 -1
- package/dist/plugins/context-menu.js.map +1 -1
- package/dist/plugins/createPlugin.d.ts +8 -0
- package/dist/plugins/data-export/index.d.ts +1 -1
- package/dist/plugins/data-export.d.ts +2 -2
- package/dist/plugins/data-export.js +2 -2
- package/dist/plugins/data-export.js.map +1 -1
- package/dist/plugins/data-transform.d.ts +2 -2
- package/dist/plugins/data-transform.js +19 -19
- package/dist/plugins/data-transform.js.map +1 -1
- package/dist/plugins/debug/index.d.ts +2 -2
- package/dist/plugins/debug.d.ts +2 -2
- package/dist/plugins/debug.js +33 -33
- package/dist/plugins/debug.js.map +1 -1
- package/dist/plugins/forecasting/index.d.ts +1 -1
- package/dist/plugins/forecasting.js.map +1 -1
- package/dist/plugins/gpu/index.d.ts +2 -2
- package/dist/plugins/gpu.d.ts +2 -2
- package/dist/plugins/gpu.js +2033 -209
- package/dist/plugins/gpu.js.map +1 -1
- package/dist/plugins/i18n/index.d.ts +2 -2
- package/dist/plugins/i18n.d.ts +2 -2
- package/dist/plugins/i18n.js +286 -23
- package/dist/plugins/i18n.js.map +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/keyboard.d.ts +2 -2
- package/dist/plugins/keyboard.js +65 -5
- package/dist/plugins/keyboard.js.map +1 -1
- package/dist/plugins/latex.js +766 -207
- package/dist/plugins/latex.js.map +1 -1
- package/dist/plugins/lazy-load.d.ts +2 -2
- package/dist/plugins/loading/index.d.ts +2 -3
- package/dist/plugins/loading.d.ts +2 -2
- package/dist/plugins/loading.js +3 -4
- package/dist/plugins/ml-integration.d.ts +2 -2
- package/dist/plugins/ml-integration.js +5 -5
- package/dist/plugins/ml-integration.js.map +1 -1
- package/dist/plugins/offscreen.d.ts +2 -2
- package/dist/plugins/offscreen.js +11 -10
- package/dist/plugins/offscreen.js.map +1 -1
- package/dist/plugins/pattern-recognition.d.ts +2 -2
- package/dist/plugins/pattern-recognition.js +1 -1
- package/dist/plugins/pattern-recognition.js.map +1 -1
- package/dist/plugins/radar.d.ts +2 -2
- package/dist/plugins/regression.d.ts +2 -2
- package/dist/plugins/regression.js +255 -257
- package/dist/plugins/regression.js.map +1 -1
- package/dist/plugins/roi.js +9 -9
- package/dist/plugins/roi.js.map +1 -1
- package/dist/plugins/snapshot/index.d.ts +1 -1
- package/dist/plugins/snapshot/types.d.ts +1 -1
- package/dist/plugins/snapshot.d.ts +2 -2
- package/dist/plugins/snapshot.js.map +1 -1
- package/dist/plugins/streaming/index.d.ts +2 -2
- package/dist/plugins/streaming.d.ts +2 -2
- package/dist/plugins/streaming.js +1 -1
- package/dist/plugins/sync/index.d.ts +3 -2
- package/dist/plugins/sync.d.ts +2 -2
- package/dist/plugins/sync.js.map +1 -1
- package/dist/plugins/theme-editor/index.d.ts +1 -1
- package/dist/plugins/theme-editor.d.ts +2 -2
- package/dist/plugins/tools/index.d.ts +1 -1
- package/dist/plugins/tools/tooltip/index.d.ts +1 -1
- package/dist/plugins/tools.d.ts +2 -2
- package/dist/plugins/tools.js +1 -1
- package/dist/plugins/types.d.ts +1 -1
- package/dist/plugins/video-recorder.d.ts +2 -2
- package/dist/plugins/virtualization.d.ts +2 -2
- package/dist/plugins/virtualization.js +1 -1
- package/dist/pool-DZ8shSqv.js +109 -0
- package/dist/pool-DZ8shSqv.js.map +1 -0
- package/dist/react/StackedPlot.d.ts +31 -0
- package/dist/react/VeloPlot.d.ts +29 -0
- package/dist/react/index.d.ts +25 -3
- package/dist/react/useChartSync.d.ts +8 -0
- package/dist/react/useIndicator.d.ts +12 -0
- package/dist/react/useVeloPlot.d.ts +19 -0
- package/dist/react.js +325 -24
- package/dist/react.js.map +1 -1
- package/dist/renderer/NativeWebGLRenderer.d.ts +2 -1
- package/dist/renderer/native/NativeWebGLRenderer.d.ts +5 -1
- package/dist/renderer/native/draw.d.ts +2 -47
- package/dist/renderer/native/drawCore.d.ts +27 -0
- package/dist/renderer/native/drawExtended.d.ts +29 -0
- package/dist/renderer/native/frameRenderExtended.d.ts +1 -0
- package/dist/renderer/native/frameRenderRegistry.d.ts +27 -0
- package/dist/renderer/native/programFactoryCore.d.ts +6 -0
- package/dist/renderer/native/programFactoryExtended.d.ts +4 -0
- package/dist/renderer/native/utils.d.ts +3 -29
- package/dist/renderer/native/utilsCore.d.ts +14 -0
- package/dist/renderer/native/utilsExtended.d.ts +17 -0
- package/dist/renderer/overlaySeriesExtended.d.ts +1 -0
- package/dist/renderer/registerExtendedSeries.d.ts +1 -0
- package/dist/renderer/registerWebGPU.d.ts +2 -0
- package/dist/renderer/seriesBufferExtended.d.ts +4 -0
- package/dist/scientific/index.d.ts +44 -0
- package/dist/scientific/registerScientific.d.ts +1 -0
- package/dist/scientific.d.ts +1 -0
- package/dist/scientific.js +91 -0
- package/dist/scientific.js.map +1 -0
- package/dist/solid/VeloPlot.d.ts +16 -0
- package/dist/solid/index.d.ts +13 -0
- package/dist/solid/useChartSync.d.ts +6 -0
- package/dist/solid/useIndicator.d.ts +11 -0
- package/dist/solid/useStackedPlot.d.ts +14 -0
- package/dist/solid/useVeloPlot.d.ts +18 -0
- package/dist/solid.d.ts +1 -0
- package/dist/solid.js +169 -0
- package/dist/solid.js.map +1 -0
- package/dist/stackedSync-tnrunZMt.js +100 -0
- package/dist/stackedSync-tnrunZMt.js.map +1 -0
- package/dist/svelte/StackedPlot.svelte +29 -0
- package/dist/svelte/StackedPlot.test.ts +114 -0
- package/dist/svelte/VeloPlot.svelte +44 -0
- package/dist/svelte/VeloPlot.test.ts +105 -0
- package/dist/svelte/index.d.ts +11 -0
- package/dist/svelte/index.test.ts +20 -0
- package/dist/svelte/index.ts +15 -0
- package/dist/svelte/useChartSync.d.ts +8 -0
- package/dist/svelte/useChartSync.test.ts +49 -0
- package/dist/svelte/useChartSync.ts +29 -0
- package/dist/svelte/useIndicator.d.ts +13 -0
- package/dist/svelte/useIndicator.test.ts +67 -0
- package/dist/svelte/useIndicator.ts +43 -0
- package/dist/svelte/useStackedPlot.d.ts +16 -0
- package/dist/svelte/useStackedPlot.test.ts +76 -0
- package/dist/svelte/useStackedPlot.ts +54 -0
- package/dist/svelte/useVeloPlot.d.ts +21 -0
- package/dist/svelte/useVeloPlot.test.ts +100 -0
- package/dist/svelte/useVeloPlot.ts +81 -0
- package/dist/svelte.d.ts +1 -0
- package/dist/svelte.js +140 -0
- package/dist/svelte.js.map +1 -0
- package/dist/testing/index.d.ts +1 -1
- package/dist/theme/index.d.ts +2 -1
- package/dist/trading/index.d.ts +1 -4
- package/dist/trading/registerTrading.d.ts +3 -0
- package/dist/trading.js +42 -42
- package/dist/types.d.ts +4 -4
- package/dist/{utils-BK5UUXxj.js → utils-Dx0h0bgQ.js} +9 -9
- package/dist/{utils-BK5UUXxj.js.map → utils-Dx0h0bgQ.js.map} +1 -1
- package/dist/velo-plot.full.js +2216 -1346
- package/dist/velo-plot.full.js.map +1 -1
- package/dist/velo-plot.js +33 -28
- package/dist/velo-plot.js.map +1 -1
- package/dist/vue/StackedPlot.vue.d.ts +48 -0
- package/dist/vue/VeloPlot.vue.d.ts +64 -0
- package/dist/vue/index.d.ts +250 -0
- package/dist/vue/useChartSync.d.ts +52 -0
- package/dist/vue/useIndicator.d.ts +23 -0
- package/dist/vue/useStackedPlot.d.ts +15 -0
- package/dist/vue/useVeloPlot.d.ts +20 -0
- package/dist/vue.d.ts +1 -0
- package/dist/vue.js +309 -0
- package/dist/vue.js.map +1 -0
- package/dist/workers/indicatorsAsync.d.ts +2 -0
- package/dist/workers/pool.d.ts +9 -0
- package/package.json +96 -10
- package/dist/ChartCore-ivzLqxVb.js +0 -8350
- package/dist/ChartCore-ivzLqxVb.js.map +0 -1
- package/dist/SciPlot-CEU4ApgD.js +0 -463
- package/dist/SciPlot-CEU4ApgD.js.map +0 -1
- package/dist/createStackedChart-DxNW0VkF.js +0 -705
- package/dist/createStackedChart-DxNW0VkF.js.map +0 -1
- package/dist/gpuRenderer-BpaMYz-k.js +0 -1848
- package/dist/gpuRenderer-BpaMYz-k.js.map +0 -1
- package/dist/index-BBpJwOct.js.map +0 -1
- package/dist/index-BMiZoKmm.js.map +0 -1
- package/dist/index-DoYxf1cV.js.map +0 -1
- package/dist/index-qunX30Xu.js.map +0 -1
- package/dist/index-x4stH3jD.js +0 -282
- package/dist/index-x4stH3jD.js.map +0 -1
- package/dist/index.core-COREBDNq.js.map +0 -1
- package/dist/mockDatafeed-927foCM4.js.map +0 -1
- package/dist/pool-15HMCNv8.js +0 -88
- package/dist/pool-15HMCNv8.js.map +0 -1
- package/dist/react/SciPlot.d.ts +0 -60
- package/dist/react/useSciPlot.d.ts +0 -56
- package/dist/symbols-DT0eLlpW.js +0 -568
- package/dist/symbols-DT0eLlpW.js.map +0 -1
package/dist/react.js
CHANGED
|
@@ -1,31 +1,332 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { jsx as O, jsxs as A } from "react/jsx-runtime";
|
|
2
|
+
import { useState as R, useRef as m, useEffect as b, useCallback as E, forwardRef as F, useImperativeHandle as K, useMemo as T } from "react";
|
|
3
|
+
import { p as B, o as j, s as G, d as H } from "./optionsSync-QUiN4Inw.js";
|
|
4
|
+
import { c as J, a as X, i as Y, r as Z, b as q } from "./chartSyncBridge-D_rCtbFq.js";
|
|
5
|
+
import { a as D, u as L } from "./a11y-Bw6urYpr.js";
|
|
6
|
+
import { s as P, b as z, a as Q } from "./stackedSync-tnrunZMt.js";
|
|
7
|
+
import { c as U } from "./createStackedChart-DqcLCFGS.js";
|
|
8
|
+
function I(a, t = {}) {
|
|
9
|
+
const [l, n] = R(null), [i, p] = R(!1), [S, C] = R(null), [y, d] = R(null), c = m(null), o = m(null), v = m(t), x = m(B(t));
|
|
10
|
+
v.current = t, b(() => {
|
|
11
|
+
const r = a.current;
|
|
12
|
+
if (r) {
|
|
13
|
+
try {
|
|
14
|
+
const e = J(
|
|
15
|
+
r,
|
|
16
|
+
v.current,
|
|
17
|
+
{
|
|
18
|
+
onBoundsChange: d,
|
|
19
|
+
onError: C
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
c.current = e.chart, o.current = e.destroy, n(e.chart), p(!0), d(e.getBounds()), C(null), x.current = B(v.current);
|
|
23
|
+
} catch (e) {
|
|
24
|
+
console.error("[useVeloPlot] Failed to initialize chart:", e), C(e instanceof Error ? e : new Error(String(e))), p(!1);
|
|
25
|
+
}
|
|
26
|
+
return () => {
|
|
27
|
+
var e;
|
|
28
|
+
(e = o.current) == null || e.call(o), o.current = null, c.current = null, n(null), p(!1);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}, [a]), b(() => {
|
|
32
|
+
const r = c.current;
|
|
33
|
+
if (!r || !i) return;
|
|
34
|
+
const e = B(t), k = x.current;
|
|
35
|
+
j(k, e) && (G(r, k, e), x.current = e);
|
|
36
|
+
});
|
|
37
|
+
const s = E((r) => {
|
|
38
|
+
const e = c.current;
|
|
39
|
+
e && (e.addSeries(r), d(e.getViewBounds()));
|
|
40
|
+
}, []), f = E((r, e) => {
|
|
41
|
+
var k;
|
|
42
|
+
(k = c.current) == null || k.updateSeries(r, e);
|
|
43
|
+
}, []), g = E((r) => {
|
|
44
|
+
var e;
|
|
45
|
+
(e = c.current) == null || e.removeSeries(r);
|
|
46
|
+
}, []), u = E((r) => {
|
|
47
|
+
var e;
|
|
48
|
+
(e = c.current) == null || e.zoom(r);
|
|
49
|
+
}, []), h = E(() => {
|
|
50
|
+
const r = c.current;
|
|
51
|
+
r && (r.resetZoom(), d(r.getViewBounds()));
|
|
52
|
+
}, []);
|
|
53
|
+
return {
|
|
54
|
+
chart: l,
|
|
55
|
+
isReady: i,
|
|
56
|
+
error: S,
|
|
57
|
+
bounds: y,
|
|
58
|
+
addSeries: s,
|
|
59
|
+
updateSeries: f,
|
|
60
|
+
removeSeries: g,
|
|
61
|
+
zoom: u,
|
|
62
|
+
resetZoom: h
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const N = F(
|
|
66
|
+
function({
|
|
67
|
+
series: t = [],
|
|
68
|
+
zoom: l,
|
|
69
|
+
onZoomChange: n,
|
|
70
|
+
cursor: i,
|
|
71
|
+
width: p = "100%",
|
|
72
|
+
height: S = 400,
|
|
73
|
+
className: C = "",
|
|
74
|
+
style: y = {},
|
|
75
|
+
debug: d = !1,
|
|
76
|
+
ariaLabel: c,
|
|
77
|
+
keyboardNav: o = !0,
|
|
78
|
+
...v
|
|
79
|
+
}, x) {
|
|
80
|
+
const s = m(null), f = m(/* @__PURE__ */ new Map()), g = m(null), {
|
|
81
|
+
chart: u,
|
|
82
|
+
isReady: h,
|
|
83
|
+
bounds: r,
|
|
84
|
+
addSeries: e,
|
|
85
|
+
updateSeries: k,
|
|
86
|
+
removeSeries: V,
|
|
87
|
+
resetZoom: $
|
|
88
|
+
} = I(s, v);
|
|
89
|
+
K(
|
|
90
|
+
x,
|
|
91
|
+
() => ({
|
|
92
|
+
getChart: () => u,
|
|
93
|
+
resetZoom: $,
|
|
94
|
+
getBounds: () => r
|
|
95
|
+
}),
|
|
96
|
+
[u, $, r]
|
|
97
|
+
), b(() => {
|
|
98
|
+
!h || !u || (f.current = H(
|
|
99
|
+
{ addSeries: e, updateSeries: k, removeSeries: V, autoScale: () => u.autoScale() },
|
|
100
|
+
t,
|
|
101
|
+
f.current
|
|
102
|
+
));
|
|
103
|
+
}, [t, h, u, e, k, V]), b(() => {
|
|
104
|
+
!h || !u || !l || u.zoom(l);
|
|
105
|
+
}, [h, u, l]), b(() => {
|
|
106
|
+
if (!h || !u || !n) return;
|
|
107
|
+
const M = (w) => {
|
|
108
|
+
n({
|
|
109
|
+
xMin: w.x[0],
|
|
110
|
+
xMax: w.x[1],
|
|
111
|
+
yMin: w.y[0],
|
|
112
|
+
yMax: w.y[1]
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
return u.on("zoom", M), () => u.off("zoom", M);
|
|
116
|
+
}, [h, u, n]), b(() => {
|
|
117
|
+
!h || !u || (i != null && i.enabled ? u.enableCursor(i) : u.disableCursor());
|
|
118
|
+
}, [h, u, i]), b(() => {
|
|
119
|
+
const M = s.current;
|
|
120
|
+
if (!(!h || !u || !M))
|
|
121
|
+
return g.current = D(M, u, {
|
|
122
|
+
label: c,
|
|
123
|
+
series: t,
|
|
124
|
+
bounds: r,
|
|
125
|
+
enableKeyboard: o
|
|
126
|
+
}), () => {
|
|
127
|
+
var w;
|
|
128
|
+
(w = g.current) == null || w.cleanup(), g.current = null;
|
|
129
|
+
};
|
|
130
|
+
}, [h, u, o, c, r, t]), b(() => {
|
|
131
|
+
const M = s.current;
|
|
132
|
+
!M || !g.current || L(M, g.current.srTable, {
|
|
133
|
+
label: c,
|
|
134
|
+
series: t,
|
|
135
|
+
bounds: r
|
|
136
|
+
});
|
|
137
|
+
}, [t, r, c]);
|
|
138
|
+
const _ = T(
|
|
139
|
+
() => ({
|
|
140
|
+
position: "relative",
|
|
141
|
+
width: typeof p == "number" ? `${p}px` : p,
|
|
142
|
+
height: typeof S == "number" ? `${S}px` : S,
|
|
143
|
+
outline: "none",
|
|
144
|
+
...y
|
|
145
|
+
}),
|
|
146
|
+
[p, S, y]
|
|
147
|
+
);
|
|
148
|
+
return /* @__PURE__ */ O(
|
|
149
|
+
"div",
|
|
150
|
+
{
|
|
151
|
+
ref: s,
|
|
152
|
+
className: `velo-plot-container ${C}`,
|
|
153
|
+
style: _,
|
|
154
|
+
children: d && r && /* @__PURE__ */ A(
|
|
155
|
+
"div",
|
|
156
|
+
{
|
|
157
|
+
style: {
|
|
158
|
+
position: "absolute",
|
|
159
|
+
top: 8,
|
|
160
|
+
right: 8,
|
|
161
|
+
background: "rgba(0,0,0,0.7)",
|
|
162
|
+
color: "#0f0",
|
|
163
|
+
padding: "4px 8px",
|
|
164
|
+
borderRadius: 4,
|
|
165
|
+
fontSize: 11,
|
|
166
|
+
fontFamily: "monospace",
|
|
167
|
+
pointerEvents: "none"
|
|
168
|
+
},
|
|
169
|
+
children: [
|
|
170
|
+
/* @__PURE__ */ A("div", { children: [
|
|
171
|
+
"X: [",
|
|
172
|
+
r.xMin.toFixed(3),
|
|
173
|
+
", ",
|
|
174
|
+
r.xMax.toFixed(3),
|
|
175
|
+
"]"
|
|
176
|
+
] }),
|
|
177
|
+
/* @__PURE__ */ A("div", { children: [
|
|
178
|
+
"Y: [",
|
|
179
|
+
r.yMin.toExponential(2),
|
|
180
|
+
", ",
|
|
181
|
+
r.yMax.toExponential(2),
|
|
182
|
+
"]"
|
|
183
|
+
] }),
|
|
184
|
+
/* @__PURE__ */ A("div", { children: [
|
|
185
|
+
"Series: ",
|
|
186
|
+
t.length
|
|
187
|
+
] })
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
function W(a) {
|
|
196
|
+
const t = m(null), l = m(null), n = m(null), [i, p] = R(null), [S, C] = R(!1), y = m(a), d = m(P(a.panes)), c = m(/* @__PURE__ */ new Map());
|
|
197
|
+
y.current = a;
|
|
198
|
+
const o = E(() => {
|
|
199
|
+
var g;
|
|
200
|
+
const s = t.current;
|
|
201
|
+
if (!s) return;
|
|
202
|
+
(g = n.current) == null || g.call(n);
|
|
203
|
+
const f = U({
|
|
204
|
+
...y.current,
|
|
205
|
+
container: s
|
|
12
206
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
207
|
+
l.current = f, n.current = () => {
|
|
208
|
+
f.destroy(), l.current = null;
|
|
209
|
+
}, p(f), d.current = P(y.current.panes), c.current = z(
|
|
210
|
+
f,
|
|
211
|
+
y.current.panes,
|
|
212
|
+
/* @__PURE__ */ new Map()
|
|
213
|
+
), f.whenReady().then(() => C(!0));
|
|
16
214
|
}, []);
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
(
|
|
20
|
-
}, []),
|
|
21
|
-
|
|
22
|
-
(
|
|
215
|
+
b(() => (o(), () => {
|
|
216
|
+
var s;
|
|
217
|
+
C(!1), (s = n.current) == null || s.call(n), n.current = null, p(null);
|
|
218
|
+
}), [o]), b(() => {
|
|
219
|
+
const s = l.current;
|
|
220
|
+
if (!s || !S) return;
|
|
221
|
+
if (P(a.panes) !== d.current) {
|
|
222
|
+
o();
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
Q(s, a), c.current = z(
|
|
226
|
+
s,
|
|
227
|
+
a.panes,
|
|
228
|
+
c.current
|
|
229
|
+
);
|
|
230
|
+
});
|
|
231
|
+
const v = E((s) => {
|
|
232
|
+
var f;
|
|
233
|
+
(f = l.current) == null || f.fitAll(s);
|
|
234
|
+
}, []), x = E(() => {
|
|
235
|
+
var s;
|
|
236
|
+
(s = l.current) == null || s.resetAll();
|
|
23
237
|
}, []);
|
|
24
|
-
return { containerRef:
|
|
238
|
+
return { containerRef: t, stack: i, isReady: S, fitAll: v, resetAll: x };
|
|
239
|
+
}
|
|
240
|
+
const ae = F(
|
|
241
|
+
function({
|
|
242
|
+
width: t = "100%",
|
|
243
|
+
height: l = 480,
|
|
244
|
+
className: n = "",
|
|
245
|
+
style: i = {},
|
|
246
|
+
indicators: p,
|
|
247
|
+
onCrosshairMove: S,
|
|
248
|
+
drawingTools: C,
|
|
249
|
+
ariaLabel: y,
|
|
250
|
+
panes: d,
|
|
251
|
+
...c
|
|
252
|
+
}, o) {
|
|
253
|
+
const { containerRef: v, stack: x, isReady: s, fitAll: f, resetAll: g } = W({
|
|
254
|
+
panes: d,
|
|
255
|
+
...c
|
|
256
|
+
});
|
|
257
|
+
K(
|
|
258
|
+
o,
|
|
259
|
+
() => ({
|
|
260
|
+
getStack: () => x,
|
|
261
|
+
fitAll: () => f(),
|
|
262
|
+
resetAll: g,
|
|
263
|
+
getBounds: () => (x == null ? void 0 : x.getMaster().getViewBounds()) ?? null
|
|
264
|
+
}),
|
|
265
|
+
[x, f, g]
|
|
266
|
+
);
|
|
267
|
+
const u = T(
|
|
268
|
+
() => ({
|
|
269
|
+
position: "relative",
|
|
270
|
+
width: typeof t == "number" ? `${t}px` : t,
|
|
271
|
+
height: typeof l == "number" ? `${l}px` : l,
|
|
272
|
+
...i
|
|
273
|
+
}),
|
|
274
|
+
[t, l, i]
|
|
275
|
+
);
|
|
276
|
+
return /* @__PURE__ */ O(
|
|
277
|
+
"div",
|
|
278
|
+
{
|
|
279
|
+
ref: v,
|
|
280
|
+
className: `velo-plot-stacked ${n}`,
|
|
281
|
+
style: u,
|
|
282
|
+
role: "img",
|
|
283
|
+
"aria-label": y ?? `Stacked chart with ${d.length} panes`,
|
|
284
|
+
"data-ready": s ? "true" : "false"
|
|
285
|
+
}
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
function le(a, t, l = {}) {
|
|
290
|
+
const [n, i] = R(null), [p, S] = R(!1), [C, y] = R(null), d = m(n);
|
|
291
|
+
return d.current = n, b(() => {
|
|
292
|
+
if (!a) return;
|
|
293
|
+
let c = !1;
|
|
294
|
+
return S(!0), y(null), X(a, t, l).then((o) => {
|
|
295
|
+
c || (i(o), S(!1));
|
|
296
|
+
}).catch((o) => {
|
|
297
|
+
c || (y(o instanceof Error ? o : new Error(String(o))), S(!1));
|
|
298
|
+
}), () => {
|
|
299
|
+
c = !0;
|
|
300
|
+
const o = d.current;
|
|
301
|
+
o && !Y(a) && Z(a, o.id);
|
|
302
|
+
};
|
|
303
|
+
}, [a, t, JSON.stringify(l)]), { result: n, isLoading: p, error: C };
|
|
304
|
+
}
|
|
305
|
+
function ee(a, t) {
|
|
306
|
+
const [l, n] = R(null);
|
|
307
|
+
return b(() => {
|
|
308
|
+
if (a.length < 2) {
|
|
309
|
+
n(null);
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
const i = q(a, t);
|
|
313
|
+
return n(i.group), () => {
|
|
314
|
+
i.destroy(), n(null);
|
|
315
|
+
};
|
|
316
|
+
}, [a, JSON.stringify(t)]), { group: l };
|
|
25
317
|
}
|
|
318
|
+
const ie = ee, fe = N, de = N, pe = I, Se = I;
|
|
26
319
|
export {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
320
|
+
de as SciChart,
|
|
321
|
+
fe as SciPlot,
|
|
322
|
+
ae as StackedPlot,
|
|
323
|
+
N as VeloPlot,
|
|
324
|
+
ie as useChartGroup,
|
|
325
|
+
ee as useChartSync,
|
|
326
|
+
le as useIndicator,
|
|
327
|
+
Se as useSciChart,
|
|
328
|
+
pe as useSciPlot,
|
|
329
|
+
W as useStackedPlot,
|
|
330
|
+
I as useVeloPlot
|
|
30
331
|
};
|
|
31
332
|
//# sourceMappingURL=react.js.map
|
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sources":["../src/react/useStackedPlot.ts"],"sourcesContent":["/**\n * useStackedPlot - React hook for multi-pane stacked charts\n */\n\nimport {\n useEffect,\n useRef,\n useState,\n useCallback,\n type RefObject,\n} from \"react\";\nimport { createStackedChart } from \"../core/stacked\";\nimport type { StackedChart, StackedChartOptions } from \"../core/stacked\";\nimport type { Range } from \"../types\";\n\nexport interface UseStackedPlotOptions extends Omit<StackedChartOptions, \"container\"> {}\n\nexport interface UseStackedPlotReturn {\n containerRef: RefObject<HTMLDivElement>;\n stack: StackedChart | null;\n isReady: boolean;\n fitAll: (options?: { x?: Range; padding?: number }) => void;\n resetAll: () => void;\n}\n\nexport function useStackedPlot(\n options: UseStackedPlotOptions,\n): UseStackedPlotReturn {\n const containerRef = useRef<HTMLDivElement>(null);\n const stackRef = useRef<StackedChart | null>(null);\n const [stack, setStack] = useState<StackedChart | null>(null);\n const [isReady, setIsReady] = useState(false);\n const optionsRef = useRef(options);\n optionsRef.current = options;\n\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return;\n\n const created = createStackedChart({\n ...optionsRef.current,\n container: el,\n });\n stackRef.current = created;\n setStack(created);\n\n created.whenReady().then(() => setIsReady(true));\n\n return () => {\n setIsReady(false);\n created.destroy();\n stackRef.current = null;\n setStack(null);\n };\n }, []);\n\n const fitAll = useCallback((opts?: { x?: Range; padding?: number }) => {\n stackRef.current?.fitAll(opts);\n }, []);\n\n const resetAll = useCallback(() => {\n stackRef.current?.resetAll();\n }, []);\n\n return { containerRef, stack, isReady, fitAll, resetAll };\n}\n"],"names":["useStackedPlot","options","containerRef","useRef","stackRef","stack","setStack","useState","isReady","setIsReady","optionsRef","useEffect","el","created","createStackedChart","fitAll","useCallback","opts","_a","resetAll"],"mappings":";;;AAyBO,SAASA,EACdC,GACsB;AACtB,QAAMC,IAAeC,EAAuB,IAAI,GAC1CC,IAAWD,EAA4B,IAAI,GAC3C,CAACE,GAAOC,CAAQ,IAAIC,EAA8B,IAAI,GACtD,CAACC,GAASC,CAAU,IAAIF,EAAS,EAAK,GACtCG,IAAaP,EAAOF,CAAO;AACjC,EAAAS,EAAW,UAAUT,GAErBU,EAAU,MAAM;AACd,UAAMC,IAAKV,EAAa;AACxB,QAAI,CAACU,EAAI;AAET,UAAMC,IAAUC,EAAmB;AAAA,MACjC,GAAGJ,EAAW;AAAA,MACd,WAAWE;AAAA,IAAA,CACZ;AACD,WAAAR,EAAS,UAAUS,GACnBP,EAASO,CAAO,GAEhBA,EAAQ,YAAY,KAAK,MAAMJ,EAAW,EAAI,CAAC,GAExC,MAAM;AACX,MAAAA,EAAW,EAAK,GAChBI,EAAQ,QAAA,GACRT,EAAS,UAAU,MACnBE,EAAS,IAAI;AAAA,IACf;AAAA,EACF,GAAG,CAAA,CAAE;AAEL,QAAMS,IAASC,EAAY,CAACC,MAA2C;;AACrE,KAAAC,IAAAd,EAAS,YAAT,QAAAc,EAAkB,OAAOD;AAAA,EAC3B,GAAG,CAAA,CAAE,GAECE,IAAWH,EAAY,MAAM;;AACjC,KAAAE,IAAAd,EAAS,YAAT,QAAAc,EAAkB;AAAA,EACpB,GAAG,CAAA,CAAE;AAEL,SAAO,EAAE,cAAAhB,GAAc,OAAAG,GAAO,SAAAG,GAAS,QAAAO,GAAQ,UAAAI,EAAA;AACjD;"}
|
|
1
|
+
{"version":3,"file":"react.js","sources":["../src/react/useVeloPlot.ts","../src/react/VeloPlot.tsx","../src/react/useStackedPlot.ts","../src/react/StackedPlot.tsx","../src/react/useIndicator.ts","../src/react/useChartSync.ts","../src/react/index.ts"],"sourcesContent":["/**\n * useVeloPlot - React hook for Velo Plot\n */\n\nimport {\n useEffect,\n useRef,\n useState,\n useCallback,\n type RefObject,\n} from \"react\";\nimport type { Chart } from \"../core/Chart\";\nimport type {\n SeriesOptions,\n SeriesUpdateData,\n ZoomOptions,\n Bounds,\n} 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 interface UseVeloPlotReturn {\n chart: Chart | null;\n isReady: boolean;\n error: Error | null;\n bounds: Bounds | null;\n addSeries: (options: SeriesOptions) => void;\n updateSeries: (id: string, data: SeriesUpdateData) => void;\n removeSeries: (id: string) => void;\n zoom: (options: ZoomOptions) => void;\n resetZoom: () => void;\n}\n\nexport function useVeloPlot(\n containerRef: RefObject<HTMLDivElement>,\n options: UseVeloPlotOptions = {},\n): UseVeloPlotReturn {\n const [chart, setChart] = useState<Chart | null>(null);\n const [isReady, setIsReady] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const [bounds, setBounds] = useState<Bounds | null>(null);\n\n const chartRef = useRef<Chart | null>(null);\n const destroyRef = useRef<(() => void) | null>(null);\n const optionsRef = useRef(options);\n const prevSyncOptionsRef = useRef(pickSyncableOptions(options));\n optionsRef.current = options;\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n try {\n const handle = createChartLifecycle(\n container,\n optionsRef.current,\n {\n onBoundsChange: setBounds,\n onError: setError,\n },\n );\n chartRef.current = handle.chart;\n destroyRef.current = handle.destroy;\n setChart(handle.chart);\n setIsReady(true);\n setBounds(handle.getBounds());\n setError(null);\n prevSyncOptionsRef.current = pickSyncableOptions(optionsRef.current);\n } catch (err) {\n console.error(\"[useVeloPlot] Failed to initialize chart:\", err);\n setError(err instanceof Error ? err : new Error(String(err)));\n setIsReady(false);\n }\n\n return () => {\n destroyRef.current?.();\n destroyRef.current = null;\n chartRef.current = null;\n setChart(null);\n setIsReady(false);\n };\n }, [containerRef]);\n\n useEffect(() => {\n const currentChart = chartRef.current;\n if (!currentChart || !isReady) return;\n\n const next = pickSyncableOptions(options);\n const prev = prevSyncOptionsRef.current;\n if (optionsChanged(prev, next)) {\n syncChartOptions(currentChart, prev, next);\n prevSyncOptionsRef.current = next;\n }\n });\n\n const addSeries = useCallback((seriesOptions: SeriesOptions) => {\n const c = chartRef.current;\n if (c) {\n c.addSeries(seriesOptions);\n setBounds(c.getViewBounds());\n }\n }, []);\n\n const updateSeries = useCallback((id: string, data: SeriesUpdateData) => {\n chartRef.current?.updateSeries(id, data);\n }, []);\n\n const removeSeries = useCallback((id: string) => {\n chartRef.current?.removeSeries(id);\n }, []);\n\n const zoom = useCallback((zoomOptions: ZoomOptions) => {\n chartRef.current?.zoom(zoomOptions);\n }, []);\n\n const resetZoom = useCallback(() => {\n const c = chartRef.current;\n if (c) {\n c.resetZoom();\n setBounds(c.getViewBounds());\n }\n }, []);\n\n return {\n chart,\n isReady,\n error,\n bounds,\n addSeries,\n updateSeries,\n removeSeries,\n zoom,\n resetZoom,\n };\n}\n","/**\n * VeloPlot - React Component for Scientific Charts\n */\n\nimport {\n useRef,\n useEffect,\n useImperativeHandle,\n forwardRef,\n useMemo,\n type CSSProperties,\n} from \"react\";\nimport { useVeloPlot, type UseVeloPlotOptions } from \"./useVeloPlot\";\nimport type { ZoomOptions, CursorOptions, Bounds } from \"../types\";\nimport type { Chart } from \"../core/Chart\";\nimport {\n diffSeries,\n applyChartA11y,\n updateA11y,\n type VeloPlotSeries,\n} from \"../bindings/shared\";\n\nexport type { VeloPlotSeries } from \"../bindings/shared\";\n\nexport interface VeloPlotProps extends UseVeloPlotOptions {\n series?: VeloPlotSeries[];\n zoom?: ZoomOptions;\n onZoomChange?: (bounds: Bounds) => void;\n cursor?: CursorOptions;\n width?: number | string;\n height?: number | string;\n className?: string;\n style?: CSSProperties;\n debug?: boolean;\n /** Custom aria-label for accessibility */\n ariaLabel?: string;\n /** Enable keyboard navigation (default: true) */\n keyboardNav?: boolean;\n}\n\nexport interface VeloPlotRef {\n getChart: () => Chart | null;\n resetZoom: () => void;\n getBounds: () => Bounds | null;\n}\n\nexport const VeloPlot = forwardRef<VeloPlotRef, VeloPlotProps>(\n function VeloPlot(\n {\n series = [],\n zoom: zoomProp,\n onZoomChange,\n cursor,\n width = \"100%\",\n height = 400,\n className = \"\",\n style = {},\n debug = false,\n ariaLabel,\n keyboardNav = true,\n ...chartOptions\n },\n ref,\n ) {\n const containerRef = useRef<HTMLDivElement>(null);\n const previousSeriesRef = useRef<Map<string, VeloPlotSeries>>(new Map());\n const a11yRef = useRef<ReturnType<typeof applyChartA11y> | null>(null);\n\n const {\n chart,\n isReady,\n bounds,\n addSeries,\n updateSeries,\n removeSeries,\n resetZoom,\n } = useVeloPlot(containerRef, chartOptions);\n\n useImperativeHandle(\n ref,\n () => ({\n getChart: () => chart,\n resetZoom,\n getBounds: () => bounds,\n }),\n [chart, resetZoom, bounds],\n );\n\n useEffect(() => {\n if (!isReady || !chart) return;\n previousSeriesRef.current = diffSeries(\n { addSeries, updateSeries, removeSeries, autoScale: () => chart.autoScale() },\n series,\n previousSeriesRef.current,\n );\n }, [series, isReady, chart, addSeries, updateSeries, removeSeries]);\n\n useEffect(() => {\n if (!isReady || !chart || !zoomProp) return;\n chart.zoom(zoomProp);\n }, [isReady, chart, zoomProp]);\n\n useEffect(() => {\n if (!isReady || !chart || !onZoomChange) return;\n const handler = (event: { x: [number, number]; y: [number, number] }) => {\n onZoomChange({\n xMin: event.x[0],\n xMax: event.x[1],\n yMin: event.y[0],\n yMax: event.y[1],\n });\n };\n chart.on(\"zoom\", handler);\n return () => chart.off(\"zoom\", handler);\n }, [isReady, chart, onZoomChange]);\n\n useEffect(() => {\n if (!isReady || !chart) return;\n if (cursor?.enabled) {\n chart.enableCursor(cursor);\n } else {\n chart.disableCursor();\n }\n }, [isReady, chart, cursor]);\n\n useEffect(() => {\n const el = containerRef.current;\n if (!isReady || !chart || !el) return;\n\n a11yRef.current = applyChartA11y(el, chart, {\n label: ariaLabel,\n series,\n bounds,\n enableKeyboard: keyboardNav,\n });\n\n return () => {\n a11yRef.current?.cleanup();\n a11yRef.current = null;\n };\n }, [isReady, chart, keyboardNav, ariaLabel, bounds, series]);\n\n useEffect(() => {\n const el = containerRef.current;\n if (!el || !a11yRef.current) return;\n updateA11y(el, a11yRef.current.srTable, {\n label: ariaLabel,\n series,\n bounds,\n });\n }, [series, bounds, ariaLabel]);\n\n const containerStyle = useMemo<CSSProperties>(\n () => ({\n position: \"relative\",\n width: typeof width === \"number\" ? `${width}px` : width,\n height: typeof height === \"number\" ? `${height}px` : height,\n outline: \"none\",\n ...style,\n }),\n [width, height, style],\n );\n\n return (\n <div\n ref={containerRef}\n className={`velo-plot-container ${className}`}\n style={containerStyle}\n >\n {debug && bounds && (\n <div\n style={{\n position: \"absolute\",\n top: 8,\n right: 8,\n background: \"rgba(0,0,0,0.7)\",\n color: \"#0f0\",\n padding: \"4px 8px\",\n borderRadius: 4,\n fontSize: 11,\n fontFamily: \"monospace\",\n pointerEvents: \"none\",\n }}\n >\n <div>\n X: [{bounds.xMin.toFixed(3)}, {bounds.xMax.toFixed(3)}]\n </div>\n <div>\n Y: [{bounds.yMin.toExponential(2)}, {bounds.yMax.toExponential(2)}]\n </div>\n <div>Series: {series.length}</div>\n </div>\n )}\n </div>\n );\n },\n);\n\nexport default VeloPlot;\n","/**\n * useStackedPlot - React hook for multi-pane stacked charts\n */\n\nimport {\n useEffect,\n useRef,\n useState,\n useCallback,\n type RefObject,\n} from \"react\";\nimport { createStackedChart } from \"../core/stacked\";\nimport type { StackedChart, StackedChartOptions } from \"../core/stacked\";\nimport type { Range } from \"../types\";\nimport {\n stackedStructureKey,\n syncStackedOptions,\n syncStackedPaneSeries,\n} from \"../bindings/shared\";\nimport type { VeloPlotSeries } from \"../bindings/shared\";\n\nexport interface UseStackedPlotOptions\n extends Omit<StackedChartOptions, \"container\"> {}\n\nexport interface UseStackedPlotReturn {\n containerRef: RefObject<HTMLDivElement>;\n stack: StackedChart | null;\n isReady: boolean;\n fitAll: (options?: { x?: Range; padding?: number }) => void;\n resetAll: () => void;\n}\n\nexport function useStackedPlot(\n options: UseStackedPlotOptions,\n): UseStackedPlotReturn {\n const containerRef = useRef<HTMLDivElement>(null);\n const stackRef = useRef<StackedChart | null>(null);\n const destroyRef = useRef<(() => void) | null>(null);\n const [stack, setStack] = useState<StackedChart | null>(null);\n const [isReady, setIsReady] = useState(false);\n\n const optionsRef = useRef(options);\n const structureKeyRef = useRef(stackedStructureKey(options.panes));\n const paneSeriesRef = useRef(new Map<string, Map<string, VeloPlotSeries>>());\n optionsRef.current = options;\n\n const mountStack = useCallback(() => {\n const el = containerRef.current;\n if (!el) return;\n\n destroyRef.current?.();\n const created = createStackedChart({\n ...optionsRef.current,\n container: el,\n });\n stackRef.current = created;\n destroyRef.current = () => {\n created.destroy();\n stackRef.current = null;\n };\n setStack(created);\n structureKeyRef.current = stackedStructureKey(optionsRef.current.panes);\n paneSeriesRef.current = syncStackedPaneSeries(\n created,\n optionsRef.current.panes,\n new Map(),\n );\n\n created.whenReady().then(() => setIsReady(true));\n }, []);\n\n useEffect(() => {\n mountStack();\n return () => {\n setIsReady(false);\n destroyRef.current?.();\n destroyRef.current = null;\n setStack(null);\n };\n }, [mountStack]);\n\n useEffect(() => {\n const current = stackRef.current;\n if (!current || !isReady) return;\n\n const nextKey = stackedStructureKey(options.panes);\n if (nextKey !== structureKeyRef.current) {\n mountStack();\n return;\n }\n\n syncStackedOptions(current, options);\n paneSeriesRef.current = syncStackedPaneSeries(\n current,\n options.panes,\n paneSeriesRef.current,\n );\n });\n\n const fitAll = useCallback((opts?: { x?: Range; padding?: number }) => {\n stackRef.current?.fitAll(opts);\n }, []);\n\n const resetAll = useCallback(() => {\n stackRef.current?.resetAll();\n }, []);\n\n return { containerRef, stack, isReady, fitAll, resetAll };\n}\n","/**\n * StackedPlot - Declarative React component for multi-pane charts\n */\n\nimport {\n forwardRef,\n useImperativeHandle,\n useMemo,\n type CSSProperties,\n} from \"react\";\nimport { useStackedPlot, type UseStackedPlotOptions } from \"./useStackedPlot\";\nimport type { StackedChart } from \"../core/stacked\";\nimport type { Bounds } from \"../types\";\nimport type { AddIndicatorOptions } from \"../core/indicator/addIndicator\";\nimport type { IndicatorPresetName } from \"../core/indicator/indicatorPresets\";\n\nexport interface StackedPlotIndicator extends AddIndicatorOptions {\n type: IndicatorPresetName;\n}\n\nexport interface StackedPlotProps extends UseStackedPlotOptions {\n width?: number | string;\n height?: number | string;\n className?: string;\n style?: CSSProperties;\n indicators?: StackedPlotIndicator[];\n onCrosshairMove?: (event: { price?: number; x: number }) => void;\n drawingTools?: string[];\n ariaLabel?: string;\n}\n\nexport interface StackedPlotRef {\n getStack: () => StackedChart | null;\n fitAll: () => void;\n resetAll: () => void;\n getBounds: () => Bounds | null;\n}\n\nexport const StackedPlot = forwardRef<StackedPlotRef, StackedPlotProps>(\n function StackedPlot(\n {\n width = \"100%\",\n height = 480,\n className = \"\",\n style = {},\n indicators: _indicators,\n onCrosshairMove: _onCrosshairMove,\n drawingTools: _drawingTools,\n ariaLabel,\n panes,\n ...stackOptions\n },\n ref,\n ) {\n const { containerRef, stack, isReady, fitAll, resetAll } = useStackedPlot({\n panes,\n ...stackOptions,\n });\n\n useImperativeHandle(\n ref,\n () => ({\n getStack: () => stack,\n fitAll: () => fitAll(),\n resetAll,\n getBounds: () => stack?.getMaster().getViewBounds() ?? null,\n }),\n [stack, fitAll, resetAll],\n );\n\n const containerStyle = useMemo<CSSProperties>(\n () => ({\n position: \"relative\",\n width: typeof width === \"number\" ? `${width}px` : width,\n height: typeof height === \"number\" ? `${height}px` : height,\n ...style,\n }),\n [width, height, style],\n );\n\n return (\n <div\n ref={containerRef as React.RefObject<HTMLDivElement>}\n className={`velo-plot-stacked ${className}`}\n style={containerStyle}\n role=\"img\"\n aria-label={ariaLabel ?? `Stacked chart with ${panes.length} panes`}\n data-ready={isReady ? \"true\" : \"false\"}\n />\n );\n },\n);\n\nexport default StackedPlot;\n","/**\n * useIndicator - React hook for trading indicators\n */\n\nimport { useEffect, useRef, useState } from \"react\";\nimport type { Chart } from \"../core/chart/types\";\nimport type { AddIndicatorOptions, AddIndicatorResult } from \"../core/indicator/addIndicator\";\nimport type { IndicatorPresetName } from \"../core/indicator/indicatorPresets\";\nimport {\n addIndicatorToHost,\n isStackedChart,\n removeIndicatorFromChart,\n type IndicatorHost,\n} from \"../bindings/shared\";\n\nexport interface UseIndicatorReturn {\n result: (AddIndicatorResult & { paneId?: string }) | null;\n isLoading: boolean;\n error: Error | null;\n}\n\nexport function useIndicator(\n host: IndicatorHost,\n preset: IndicatorPresetName,\n options: AddIndicatorOptions = {},\n): UseIndicatorReturn {\n const [result, setResult] = useState<\n (AddIndicatorResult & { paneId?: string }) | null\n >(null);\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const resultRef = useRef(result);\n resultRef.current = result;\n\n useEffect(() => {\n if (!host) return;\n\n let cancelled = false;\n setIsLoading(true);\n setError(null);\n\n addIndicatorToHost(host, preset, options)\n .then((res) => {\n if (!cancelled) {\n setResult(res);\n setIsLoading(false);\n }\n })\n .catch((err) => {\n if (!cancelled) {\n setError(err instanceof Error ? err : new Error(String(err)));\n setIsLoading(false);\n }\n });\n\n return () => {\n cancelled = true;\n const res = resultRef.current;\n if (res && !isStackedChart(host)) {\n removeIndicatorFromChart(host as Chart, res.id);\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [host, preset, JSON.stringify(options)]);\n\n return { result, isLoading, error };\n}\n","/**\n * useChartSync - React hook for synchronizing multiple charts\n */\n\nimport { useEffect, useState } from \"react\";\nimport type { ChartLike, SyncOptions } from \"../core/sync\";\nimport { ChartGroup } from \"../core/sync\";\nimport { createChartSync } from \"../bindings/shared\";\n\nexport interface UseChartSyncReturn {\n group: ChartGroup | null;\n}\n\nexport function useChartSync(\n charts: ChartLike[],\n options?: SyncOptions,\n): UseChartSyncReturn {\n const [group, setGroup] = useState<ChartGroup | null>(null);\n\n useEffect(() => {\n if (charts.length < 2) {\n setGroup(null);\n return;\n }\n\n const handle = createChartSync(charts, options);\n setGroup(handle.group);\n\n return () => {\n handle.destroy();\n setGroup(null);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [charts, JSON.stringify(options)]);\n\n return { group };\n}\n\n/** Alias matching roadmap naming (`useChartGroup` ≡ `useChartSync`). */\nexport const useChartGroup = useChartSync;\n","/**\n * React bindings for Velo Plot\n */\n\nexport {\n VeloPlot,\n type VeloPlotProps,\n type VeloPlotRef,\n type VeloPlotSeries,\n} from \"./VeloPlot\";\nexport {\n StackedPlot,\n type StackedPlotProps,\n type StackedPlotRef,\n type StackedPlotIndicator,\n} from \"./StackedPlot\";\nexport {\n useVeloPlot,\n type UseVeloPlotOptions,\n type UseVeloPlotReturn,\n} from \"./useVeloPlot\";\nexport {\n useStackedPlot,\n type UseStackedPlotOptions,\n type UseStackedPlotReturn,\n} from \"./useStackedPlot\";\nexport {\n useIndicator,\n type UseIndicatorReturn,\n} from \"./useIndicator\";\nexport {\n useChartSync,\n useChartGroup,\n type UseChartSyncReturn,\n} from \"./useChartSync\";\n\n// ---------------------------------------------------------------------------\n// Backward-compatible aliases (SciPlot / SciChart branding → VeloPlot)\n// Removed in v4.0.\n// ---------------------------------------------------------------------------\nimport { VeloPlot as VeloPlotImpl } from \"./VeloPlot\";\nimport { useVeloPlot as useVeloPlotImpl } from \"./useVeloPlot\";\n\n/**\n * @deprecated Use `VeloPlot` instead. **Removed in v4.0.**\n */\nexport const SciPlot = VeloPlotImpl;\n/**\n * @deprecated Use `VeloPlot` instead. **Removed in v4.0.**\n */\nexport const SciChart = VeloPlotImpl;\n/**\n * @deprecated Use `useVeloPlot` instead. **Removed in v4.0.**\n */\nexport const useSciPlot = useVeloPlotImpl;\n/**\n * @deprecated Use `useVeloPlot` instead. **Removed in v4.0.**\n */\nexport const useSciChart = useVeloPlotImpl;\n\nexport type {\n VeloPlotProps as SciPlotProps,\n VeloPlotRef as SciPlotRef,\n VeloPlotSeries as SciPlotSeries,\n VeloPlotProps as SciChartProps,\n VeloPlotRef as SciChartRef,\n VeloPlotSeries as SciChartSeries,\n} from \"./VeloPlot\";\nexport type {\n UseVeloPlotOptions as UseSciPlotOptions,\n UseVeloPlotReturn as UseSciPlotReturn,\n UseVeloPlotOptions as UseSciChartOptions,\n UseVeloPlotReturn as UseSciChartReturn,\n} from \"./useVeloPlot\";\n"],"names":["useVeloPlot","containerRef","options","chart","setChart","useState","isReady","setIsReady","error","setError","bounds","setBounds","chartRef","useRef","destroyRef","optionsRef","prevSyncOptionsRef","pickSyncableOptions","useEffect","container","handle","createChartLifecycle","err","_a","currentChart","next","prev","optionsChanged","syncChartOptions","addSeries","useCallback","seriesOptions","c","updateSeries","id","data","removeSeries","zoom","zoomOptions","resetZoom","VeloPlot","forwardRef","series","zoomProp","onZoomChange","cursor","width","height","className","style","debug","ariaLabel","keyboardNav","chartOptions","ref","previousSeriesRef","a11yRef","useImperativeHandle","diffSeries","handler","event","el","applyChartA11y","updateA11y","containerStyle","useMemo","jsx","jsxs","useStackedPlot","stackRef","stack","setStack","structureKeyRef","stackedStructureKey","paneSeriesRef","mountStack","created","createStackedChart","syncStackedPaneSeries","current","syncStackedOptions","fitAll","opts","resetAll","StackedPlot","_indicators","_onCrosshairMove","_drawingTools","panes","stackOptions","useIndicator","host","preset","result","setResult","isLoading","setIsLoading","resultRef","cancelled","addIndicatorToHost","res","isStackedChart","removeIndicatorFromChart","useChartSync","charts","group","setGroup","createChartSync","useChartGroup","SciPlot","VeloPlotImpl","SciChart","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,GAAMC,GAAQ,KAAK,UAAU1F,CAAO,CAAC,CAAC,GAEnC,EAAE,QAAA2F,GAAQ,WAAAE,GAAW,OAAAvF,EAAA;AAC9B;ACrDO,SAAS+F,GACdC,GACAtG,GACoB;AACpB,QAAM,CAACuG,GAAOC,CAAQ,IAAIrG,EAA4B,IAAI;AAE1D,SAAAa,EAAU,MAAM;AACd,QAAIsF,EAAO,SAAS,GAAG;AACrB,MAAAE,EAAS,IAAI;AACb;AAAA,IACF;AAEA,UAAMtF,IAASuF,EAAgBH,GAAQtG,CAAO;AAC9C,WAAAwG,EAAStF,EAAO,KAAK,GAEd,MAAM;AACX,MAAAA,EAAO,QAAA,GACPsF,EAAS,IAAI;AAAA,IACf;AAAA,EAEF,GAAG,CAACF,GAAQ,KAAK,UAAUtG,CAAO,CAAC,CAAC,GAE7B,EAAE,OAAAuG,EAAA;AACX;AAGO,MAAMG,KAAgBL,ICOhBM,KAAUC,GAIVC,KAAWD,GAIXE,KAAaC,GAIbC,KAAcD;"}
|
|
@@ -12,5 +12,6 @@
|
|
|
12
12
|
* - Minimal state changes per frame
|
|
13
13
|
*/
|
|
14
14
|
export { NativeWebGLRenderer } from './native/NativeWebGLRenderer';
|
|
15
|
-
export { interleaveBandData, interleaveData, interleaveStepData, interleaveErrorData,
|
|
15
|
+
export { interleaveBandData, interleaveData, interleaveStepData, interleaveErrorData, parseColor, brightenColor, } from './native/utilsCore';
|
|
16
|
+
export { interleaveBoxPlotData, interleaveWaterfallData, } from './native/utils';
|
|
16
17
|
export type { NativeRenderOptions, NativeSeriesRenderData } from './native/types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NativeRenderOptions, NativeSeriesRenderData } from './types';
|
|
1
|
+
import { NativeRenderOptions, NativeSeriesRenderData, ProgramBundle } from './types';
|
|
2
2
|
|
|
3
3
|
export declare class NativeWebGLRenderer {
|
|
4
4
|
private canvas;
|
|
@@ -8,6 +8,10 @@ export declare class NativeWebGLRenderer {
|
|
|
8
8
|
private buffers;
|
|
9
9
|
private textures;
|
|
10
10
|
private isInitialized;
|
|
11
|
+
private heatmapShaderReady;
|
|
12
|
+
/** Optional hook for extended bundles to install the heatmap shader program. */
|
|
13
|
+
static heatmapProgramInstaller: ((gl: WebGLRenderingContext, bundle: ProgramBundle) => void) | null;
|
|
14
|
+
installHeatmapProgram(): void;
|
|
11
15
|
setDPR(dpr: number): void;
|
|
12
16
|
constructor(canvas: HTMLCanvasElement);
|
|
13
17
|
get available(): boolean;
|
|
@@ -1,47 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare function calculateUniforms(bounds: Bounds, invertX?: boolean): {
|
|
5
|
-
scale: [number, number];
|
|
6
|
-
translate: [number, number];
|
|
7
|
-
};
|
|
8
|
-
export declare function renderLine(gl: WebGLRenderingContext, prog: ShaderProgram, buffer: WebGLBuffer, count: number, uniforms: {
|
|
9
|
-
scale: [number, number];
|
|
10
|
-
translate: [number, number];
|
|
11
|
-
}, color: [number, number, number, number], width?: number): void;
|
|
12
|
-
export declare function renderBand(gl: WebGLRenderingContext, prog: ShaderProgram, buffer: WebGLBuffer, count: number, uniforms: {
|
|
13
|
-
scale: [number, number];
|
|
14
|
-
translate: [number, number];
|
|
15
|
-
}, color: [number, number, number, number]): void;
|
|
16
|
-
export declare function renderPoints(gl: WebGLRenderingContext, prog: ShaderProgram, buffer: WebGLBuffer, count: number, uniforms: {
|
|
17
|
-
scale: [number, number];
|
|
18
|
-
translate: [number, number];
|
|
19
|
-
}, color: [number, number, number, number], pointSize: number, symbol?: string): void;
|
|
20
|
-
export declare function renderHeatmap(gl: WebGLRenderingContext, prog: ShaderProgram, buffer: WebGLBuffer, count: number, uniforms: {
|
|
21
|
-
scale: [number, number];
|
|
22
|
-
translate: [number, number];
|
|
23
|
-
}, zBounds?: {
|
|
24
|
-
min: number;
|
|
25
|
-
max: number;
|
|
26
|
-
}, texture?: WebGLTexture): void;
|
|
27
|
-
export declare function renderBar(gl: WebGLRenderingContext, prog: ShaderProgram, buffer: WebGLBuffer, count: number, uniforms: {
|
|
28
|
-
scale: [number, number];
|
|
29
|
-
translate: [number, number];
|
|
30
|
-
}, color: [number, number, number, number]): void;
|
|
31
|
-
export declare function renderErrorBars(gl: WebGLRenderingContext, prog: ShaderProgram, buffer: WebGLBuffer, count: number, uniforms: {
|
|
32
|
-
scale: [number, number];
|
|
33
|
-
translate: [number, number];
|
|
34
|
-
}, color: [number, number, number, number], width?: number): void;
|
|
35
|
-
export declare function renderBoxPlot(gl: WebGLRenderingContext, programs: {
|
|
36
|
-
line: ShaderProgram;
|
|
37
|
-
point: ShaderProgram;
|
|
38
|
-
}, data: {
|
|
39
|
-
boxBuffer: WebGLBuffer;
|
|
40
|
-
boxCount: number;
|
|
41
|
-
linesBuffer: WebGLBuffer;
|
|
42
|
-
linesCount: number;
|
|
43
|
-
}, uniforms: {
|
|
44
|
-
scale: [number, number];
|
|
45
|
-
translate: [number, number];
|
|
46
|
-
}, style: any): void;
|
|
47
|
-
export declare function computeSeriesColor(style: any): [number, number, number, number];
|
|
1
|
+
export { calculateUniforms, renderLine, renderBand, renderPoints, renderErrorBars, computeSeriesColor, } from './drawCore';
|
|
2
|
+
export { renderHeatmap, renderBar, renderBoxPlot } from './drawExtended';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Bounds } from '../../types';
|
|
2
|
+
import { ShaderProgram } from './types';
|
|
3
|
+
|
|
4
|
+
export declare function calculateUniforms(bounds: Bounds, invertX?: boolean): {
|
|
5
|
+
scale: [number, number];
|
|
6
|
+
translate: [number, number];
|
|
7
|
+
};
|
|
8
|
+
export declare function renderLine(gl: WebGLRenderingContext, prog: ShaderProgram, buffer: WebGLBuffer, count: number, uniforms: {
|
|
9
|
+
scale: [number, number];
|
|
10
|
+
translate: [number, number];
|
|
11
|
+
}, color: [number, number, number, number], width?: number): void;
|
|
12
|
+
export declare function renderBand(gl: WebGLRenderingContext, prog: ShaderProgram, buffer: WebGLBuffer, count: number, uniforms: {
|
|
13
|
+
scale: [number, number];
|
|
14
|
+
translate: [number, number];
|
|
15
|
+
}, color: [number, number, number, number]): void;
|
|
16
|
+
export declare function renderPoints(gl: WebGLRenderingContext, prog: ShaderProgram, buffer: WebGLBuffer, count: number, uniforms: {
|
|
17
|
+
scale: [number, number];
|
|
18
|
+
translate: [number, number];
|
|
19
|
+
}, color: [number, number, number, number], pointSize: number, symbol?: string): void;
|
|
20
|
+
export declare function renderErrorBars(gl: WebGLRenderingContext, prog: ShaderProgram, buffer: WebGLBuffer, count: number, uniforms: {
|
|
21
|
+
scale: [number, number];
|
|
22
|
+
translate: [number, number];
|
|
23
|
+
}, color: [number, number, number, number], width?: number): void;
|
|
24
|
+
export declare function computeSeriesColor(style: {
|
|
25
|
+
color?: string;
|
|
26
|
+
opacity?: number;
|
|
27
|
+
}): [number, number, number, number];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ShaderProgram } from './types';
|
|
2
|
+
|
|
3
|
+
export declare function renderHeatmap(gl: WebGLRenderingContext, prog: ShaderProgram, buffer: WebGLBuffer, count: number, uniforms: {
|
|
4
|
+
scale: [number, number];
|
|
5
|
+
translate: [number, number];
|
|
6
|
+
}, zBounds?: {
|
|
7
|
+
min: number;
|
|
8
|
+
max: number;
|
|
9
|
+
}, texture?: WebGLTexture): void;
|
|
10
|
+
export declare function renderBar(gl: WebGLRenderingContext, prog: ShaderProgram, buffer: WebGLBuffer, count: number, uniforms: {
|
|
11
|
+
scale: [number, number];
|
|
12
|
+
translate: [number, number];
|
|
13
|
+
}, color: [number, number, number, number]): void;
|
|
14
|
+
export declare function renderBoxPlot(gl: WebGLRenderingContext, programs: {
|
|
15
|
+
line: ShaderProgram;
|
|
16
|
+
point: ShaderProgram;
|
|
17
|
+
}, data: {
|
|
18
|
+
boxBuffer: WebGLBuffer;
|
|
19
|
+
boxCount: number;
|
|
20
|
+
linesBuffer: WebGLBuffer;
|
|
21
|
+
linesCount: number;
|
|
22
|
+
}, uniforms: {
|
|
23
|
+
scale: [number, number];
|
|
24
|
+
translate: [number, number];
|
|
25
|
+
}, style: {
|
|
26
|
+
color?: string;
|
|
27
|
+
opacity?: number;
|
|
28
|
+
width?: number;
|
|
29
|
+
}): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function registerExtendedFrameRenderers(): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { NativeSeriesRenderData, ProgramBundle, NativeRenderOptions } from './types';
|
|
2
|
+
|
|
3
|
+
export interface FrameRenderContext {
|
|
4
|
+
gl: WebGLRenderingContext;
|
|
5
|
+
canvas: HTMLCanvasElement;
|
|
6
|
+
dpr: number;
|
|
7
|
+
programs: ProgramBundle;
|
|
8
|
+
options: NativeRenderOptions;
|
|
9
|
+
bounds: {
|
|
10
|
+
xMin: number;
|
|
11
|
+
xMax: number;
|
|
12
|
+
yMin: number;
|
|
13
|
+
yMax: number;
|
|
14
|
+
};
|
|
15
|
+
pa: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export type ExtendedFrameRenderer = (ctx: FrameRenderContext, s: NativeSeriesRenderData, seriesUniforms: {
|
|
23
|
+
scale: [number, number];
|
|
24
|
+
translate: [number, number];
|
|
25
|
+
}, color: [number, number, number, number]) => void;
|
|
26
|
+
export declare function registerFrameRenderer(type: string, fn: ExtendedFrameRenderer): void;
|
|
27
|
+
export declare function getFrameRenderer(type: string): ExtendedFrameRenderer | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ProgramBundle, ProgramMode, ShaderProgram } from './types';
|
|
2
|
+
|
|
3
|
+
declare function createProgram(gl: WebGLRenderingContext, vertSource: string, fragSource: string, mode: ProgramMode): ShaderProgram;
|
|
4
|
+
/** Core WebGL programs (line + scatter). Heatmap is registered by extended bundles. */
|
|
5
|
+
export declare function createCoreProgramBundle(gl: WebGLRenderingContext): ProgramBundle;
|
|
6
|
+
export { createProgram };
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
export declare function parseColor(color: string): [number, number, number, number];
|
|
2
|
-
export declare function brightenColor(color: string, isDarkTheme?: boolean): string;
|
|
3
|
-
export declare function interleaveData(x: Float32Array | Float64Array | number[], y: Float32Array | Float64Array | number[]): Float32Array;
|
|
4
|
-
export declare function interleaveStepData(x: Float32Array | Float64Array | number[], y: Float32Array | Float64Array | number[], mode?: "before" | "after" | "center"): Float32Array;
|
|
5
|
-
export declare function interleaveBandData(x: Float32Array | Float64Array | number[], y1: Float32Array | Float64Array | number[], y2: Float32Array | Float64Array | number[]): Float32Array;
|
|
6
|
-
export declare function interleaveErrorData(x: Float32Array | Float64Array | number[], y: Float32Array | Float64Array | number[], yErr?: {
|
|
7
|
-
yError?: Float32Array | Float64Array;
|
|
8
|
-
yErrorMinus?: Float32Array | Float64Array;
|
|
9
|
-
yErrorPlus?: Float32Array | Float64Array;
|
|
10
|
-
}, xErr?: {
|
|
11
|
-
xError?: Float32Array | Float64Array;
|
|
12
|
-
xErrorMinus?: Float32Array | Float64Array;
|
|
13
|
-
xErrorPlus?: Float32Array | Float64Array;
|
|
14
|
-
}): Float32Array;
|
|
15
|
-
export declare function interleaveBoxPlotData(x: Float32Array | Float64Array | number[], min: Float32Array | Float64Array | number[], q1: Float32Array | Float64Array | number[], median: Float32Array | Float64Array | number[], q3: Float32Array | Float64Array | number[], max: Float32Array | Float64Array | number[], width: number): {
|
|
16
|
-
lines: Float32Array;
|
|
17
|
-
boxes: Float32Array;
|
|
18
|
-
};
|
|
19
1
|
/**
|
|
20
|
-
*
|
|
21
|
-
* Creates rectangles that show cumulative changes from a running total
|
|
2
|
+
* Native WebGL utilities — re-exports core + extended for backward compatibility.
|
|
22
3
|
*/
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
negativeData: Float32Array;
|
|
26
|
-
subtotalData: Float32Array;
|
|
27
|
-
connectorData: Float32Array;
|
|
28
|
-
positiveCount: number;
|
|
29
|
-
negativeCount: number;
|
|
30
|
-
subtotalCount: number;
|
|
31
|
-
};
|
|
4
|
+
export { parseColor, brightenColor, interleaveData, interleaveStepData, interleaveBandData, interleaveErrorData, } from './utilsCore';
|
|
5
|
+
export { interleaveBoxPlotData, interleaveWaterfallData, } from './utilsExtended';
|