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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Chart } from '../core/Chart';
|
|
2
|
+
import { SeriesOptions, SeriesUpdateData, ZoomOptions, Bounds } from '../types';
|
|
3
|
+
import { ChartBindingOptions } from '../bindings/shared';
|
|
4
|
+
|
|
5
|
+
export interface UseVeloPlotOptions extends ChartBindingOptions {
|
|
6
|
+
}
|
|
7
|
+
export declare function createVeloPlot(options?: UseVeloPlotOptions): {
|
|
8
|
+
chart: import('svelte/store').Writable<Chart | null>;
|
|
9
|
+
isReady: import('svelte/store').Writable<boolean>;
|
|
10
|
+
error: import('svelte/store').Writable<Error | null>;
|
|
11
|
+
bounds: import('svelte/store').Writable<Bounds | null>;
|
|
12
|
+
mount: (container: HTMLDivElement) => void;
|
|
13
|
+
unmount: () => void;
|
|
14
|
+
updateOptions: (next: UseVeloPlotOptions) => void;
|
|
15
|
+
addSeries: (opts: SeriesOptions) => void;
|
|
16
|
+
updateSeries: (id: string, data: SeriesUpdateData) => void | undefined;
|
|
17
|
+
removeSeries: (id: string) => void | undefined;
|
|
18
|
+
zoom: (z: ZoomOptions) => void | undefined;
|
|
19
|
+
resetZoom: () => void;
|
|
20
|
+
};
|
|
21
|
+
export { createVeloPlot as useVeloPlot };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { describe, it, expect, vi, afterEach } from "vitest";
|
|
2
|
+
import { get } from "svelte/store";
|
|
3
|
+
import { createVeloPlot } from "./useVeloPlot";
|
|
4
|
+
import { buildMockChart } from "../bindings/test-utils";
|
|
5
|
+
import * as shared from "../bindings/shared";
|
|
6
|
+
|
|
7
|
+
const mockChart = buildMockChart();
|
|
8
|
+
|
|
9
|
+
vi.mock("../bindings/shared/chartLifecycle", () => ({
|
|
10
|
+
createChartLifecycle: vi.fn(() => ({
|
|
11
|
+
chart: mockChart,
|
|
12
|
+
getBounds: () => mockChart.getViewBounds(),
|
|
13
|
+
destroy: mockChart.destroy,
|
|
14
|
+
})),
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
vi.spyOn(shared, "optionsChanged").mockReturnValue(true);
|
|
18
|
+
vi.spyOn(shared, "syncChartOptions");
|
|
19
|
+
|
|
20
|
+
describe("createVeloPlot svelte", () => {
|
|
21
|
+
afterEach(() => {
|
|
22
|
+
document.body.replaceChildren();
|
|
23
|
+
vi.clearAllMocks();
|
|
24
|
+
vi.mocked(shared.optionsChanged).mockReturnValue(true);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("mounts and exercises chart API", () => {
|
|
28
|
+
const el = document.createElement("div");
|
|
29
|
+
document.body.appendChild(el);
|
|
30
|
+
const api = createVeloPlot({ animations: false });
|
|
31
|
+
api.mount(el);
|
|
32
|
+
expect(get(api.isReady)).toBe(true);
|
|
33
|
+
api.addSeries({ id: "s", type: "line", data: { x: new Float32Array(), y: new Float32Array() } });
|
|
34
|
+
api.updateSeries("s", { x: new Float32Array(), y: new Float32Array() });
|
|
35
|
+
api.removeSeries("s");
|
|
36
|
+
api.zoom({ x: [0, 1] });
|
|
37
|
+
api.resetZoom();
|
|
38
|
+
api.updateOptions({ theme: "dark" });
|
|
39
|
+
expect(shared.syncChartOptions).toHaveBeenCalled();
|
|
40
|
+
api.unmount();
|
|
41
|
+
expect(mockChart.destroy).toHaveBeenCalled();
|
|
42
|
+
el.remove();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("remounts chart on second mount call", () => {
|
|
46
|
+
const el = document.createElement("div");
|
|
47
|
+
const api = createVeloPlot({});
|
|
48
|
+
api.mount(el);
|
|
49
|
+
api.mount(el);
|
|
50
|
+
expect(mockChart.destroy).toHaveBeenCalled();
|
|
51
|
+
api.unmount();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("invokes onBoundsChange from lifecycle", async () => {
|
|
55
|
+
const el = document.createElement("div");
|
|
56
|
+
const api = createVeloPlot({});
|
|
57
|
+
api.mount(el);
|
|
58
|
+
const { createChartLifecycle } = await import("../bindings/shared/chartLifecycle");
|
|
59
|
+
const callbacks = vi.mocked(createChartLifecycle).mock.calls.at(-1)?.[2] ?? {};
|
|
60
|
+
callbacks.onBoundsChange?.(mockChart.getViewBounds());
|
|
61
|
+
expect(get(api.bounds)).toEqual(mockChart.getViewBounds());
|
|
62
|
+
api.unmount();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("updateOptions skips sync when chart is missing", () => {
|
|
66
|
+
const api = createVeloPlot({ theme: "dark" });
|
|
67
|
+
vi.mocked(shared.syncChartOptions).mockClear();
|
|
68
|
+
api.updateOptions({ theme: "light" });
|
|
69
|
+
expect(shared.syncChartOptions).not.toHaveBeenCalled();
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("updateOptions skips sync when options are unchanged", () => {
|
|
73
|
+
vi.mocked(shared.optionsChanged).mockReturnValue(false);
|
|
74
|
+
const el = document.createElement("div");
|
|
75
|
+
const api = createVeloPlot({ theme: "dark" });
|
|
76
|
+
api.mount(el);
|
|
77
|
+
vi.mocked(shared.syncChartOptions).mockClear();
|
|
78
|
+
api.updateOptions({ theme: "dark" });
|
|
79
|
+
expect(shared.syncChartOptions).not.toHaveBeenCalled();
|
|
80
|
+
api.unmount();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("records lifecycle errors", async () => {
|
|
84
|
+
const { createChartLifecycle } = await import("../bindings/shared/chartLifecycle");
|
|
85
|
+
vi.mocked(createChartLifecycle).mockImplementationOnce((_el, _opts, callbacks = {}) => {
|
|
86
|
+
queueMicrotask(() => callbacks.onError?.(new Error("svelte lifecycle")));
|
|
87
|
+
return {
|
|
88
|
+
chart: mockChart,
|
|
89
|
+
getBounds: () => mockChart.getViewBounds(),
|
|
90
|
+
destroy: mockChart.destroy,
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
const el = document.createElement("div");
|
|
94
|
+
const api = createVeloPlot({});
|
|
95
|
+
api.mount(el);
|
|
96
|
+
await Promise.resolve();
|
|
97
|
+
expect(get(api.error)?.message).toBe("svelte lifecycle");
|
|
98
|
+
api.unmount();
|
|
99
|
+
});
|
|
100
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte composables for velo-plot (exported as functions).
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { writable, get } from "svelte/store";
|
|
6
|
+
import type { Chart } from "../core/Chart";
|
|
7
|
+
import type { SeriesOptions, SeriesUpdateData, ZoomOptions, Bounds } from "../types";
|
|
8
|
+
import {
|
|
9
|
+
createChartLifecycle,
|
|
10
|
+
type ChartBindingOptions,
|
|
11
|
+
optionsChanged,
|
|
12
|
+
syncChartOptions,
|
|
13
|
+
pickSyncableOptions,
|
|
14
|
+
} from "../bindings/shared";
|
|
15
|
+
|
|
16
|
+
export interface UseVeloPlotOptions extends ChartBindingOptions {}
|
|
17
|
+
|
|
18
|
+
export function createVeloPlot(options: UseVeloPlotOptions = {}) {
|
|
19
|
+
const chart = writable<Chart | null>(null);
|
|
20
|
+
const isReady = writable(false);
|
|
21
|
+
const error = writable<Error | null>(null);
|
|
22
|
+
const bounds = writable<Bounds | null>(null);
|
|
23
|
+
|
|
24
|
+
let destroy: (() => void) | null = null;
|
|
25
|
+
let prevSync = pickSyncableOptions(options);
|
|
26
|
+
|
|
27
|
+
const mount = (container: HTMLDivElement) => {
|
|
28
|
+
destroy?.();
|
|
29
|
+
const handle = createChartLifecycle(container, options, {
|
|
30
|
+
onBoundsChange: (b) => bounds.set(b),
|
|
31
|
+
onError: (e) => error.set(e),
|
|
32
|
+
});
|
|
33
|
+
chart.set(handle.chart);
|
|
34
|
+
destroy = handle.destroy;
|
|
35
|
+
bounds.set(handle.getBounds());
|
|
36
|
+
isReady.set(true);
|
|
37
|
+
prevSync = pickSyncableOptions(options);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const updateOptions = (next: UseVeloPlotOptions) => {
|
|
41
|
+
const c = get(chart);
|
|
42
|
+
if (!c) return;
|
|
43
|
+
const picked = pickSyncableOptions(next);
|
|
44
|
+
if (optionsChanged(prevSync, picked)) {
|
|
45
|
+
syncChartOptions(c, prevSync, picked);
|
|
46
|
+
prevSync = picked;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const unmount = () => {
|
|
51
|
+
destroy?.();
|
|
52
|
+
destroy = null;
|
|
53
|
+
chart.set(null);
|
|
54
|
+
isReady.set(false);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
chart,
|
|
59
|
+
isReady,
|
|
60
|
+
error,
|
|
61
|
+
bounds,
|
|
62
|
+
mount,
|
|
63
|
+
unmount,
|
|
64
|
+
updateOptions,
|
|
65
|
+
addSeries: (opts: SeriesOptions) => {
|
|
66
|
+
get(chart)?.addSeries(opts);
|
|
67
|
+
const c = get(chart);
|
|
68
|
+
if (c) bounds.set(c.getViewBounds());
|
|
69
|
+
},
|
|
70
|
+
updateSeries: (id: string, data: SeriesUpdateData) => get(chart)?.updateSeries(id, data),
|
|
71
|
+
removeSeries: (id: string) => get(chart)?.removeSeries(id),
|
|
72
|
+
zoom: (z: ZoomOptions) => get(chart)?.zoom(z),
|
|
73
|
+
resetZoom: () => {
|
|
74
|
+
get(chart)?.resetZoom();
|
|
75
|
+
const c = get(chart);
|
|
76
|
+
if (c) bounds.set(c.getViewBounds());
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { createVeloPlot as useVeloPlot };
|
package/dist/svelte.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './svelte/index'
|
package/dist/svelte.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { writable as f, get as i } from "svelte/store";
|
|
2
|
+
import { p as m, o as g, s as k } from "./optionsSync-QUiN4Inw.js";
|
|
3
|
+
import { c as b, i as w, r as P, a as I, b as O } from "./chartSyncBridge-D_rCtbFq.js";
|
|
4
|
+
import { c as v } from "./createStackedChart-DqcLCFGS.js";
|
|
5
|
+
import { s as S, a as A, b as C } from "./stackedSync-tnrunZMt.js";
|
|
6
|
+
function y(u = {}) {
|
|
7
|
+
const n = f(null), c = f(!1), s = f(null), a = f(null);
|
|
8
|
+
let r = null, d = m(u);
|
|
9
|
+
return {
|
|
10
|
+
chart: n,
|
|
11
|
+
isReady: c,
|
|
12
|
+
error: s,
|
|
13
|
+
bounds: a,
|
|
14
|
+
mount: (t) => {
|
|
15
|
+
r == null || r();
|
|
16
|
+
const e = b(t, u, {
|
|
17
|
+
onBoundsChange: (l) => a.set(l),
|
|
18
|
+
onError: (l) => s.set(l)
|
|
19
|
+
});
|
|
20
|
+
n.set(e.chart), r = e.destroy, a.set(e.getBounds()), c.set(!0), d = m(u);
|
|
21
|
+
},
|
|
22
|
+
unmount: () => {
|
|
23
|
+
r == null || r(), r = null, n.set(null), c.set(!1);
|
|
24
|
+
},
|
|
25
|
+
updateOptions: (t) => {
|
|
26
|
+
const e = i(n);
|
|
27
|
+
if (!e) return;
|
|
28
|
+
const l = m(t);
|
|
29
|
+
g(d, l) && (k(e, d, l), d = l);
|
|
30
|
+
},
|
|
31
|
+
addSeries: (t) => {
|
|
32
|
+
var l;
|
|
33
|
+
(l = i(n)) == null || l.addSeries(t);
|
|
34
|
+
const e = i(n);
|
|
35
|
+
e && a.set(e.getViewBounds());
|
|
36
|
+
},
|
|
37
|
+
updateSeries: (t, e) => {
|
|
38
|
+
var l;
|
|
39
|
+
return (l = i(n)) == null ? void 0 : l.updateSeries(t, e);
|
|
40
|
+
},
|
|
41
|
+
removeSeries: (t) => {
|
|
42
|
+
var e;
|
|
43
|
+
return (e = i(n)) == null ? void 0 : e.removeSeries(t);
|
|
44
|
+
},
|
|
45
|
+
zoom: (t) => {
|
|
46
|
+
var e;
|
|
47
|
+
return (e = i(n)) == null ? void 0 : e.zoom(t);
|
|
48
|
+
},
|
|
49
|
+
resetZoom: () => {
|
|
50
|
+
var e;
|
|
51
|
+
(e = i(n)) == null || e.resetZoom();
|
|
52
|
+
const t = i(n);
|
|
53
|
+
t && a.set(t.getViewBounds());
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function L(u) {
|
|
58
|
+
const n = f(null), c = f(!1);
|
|
59
|
+
let s = null, a = S(u.panes), r = /* @__PURE__ */ new Map();
|
|
60
|
+
const d = (o) => {
|
|
61
|
+
s == null || s();
|
|
62
|
+
const t = v({ ...u, container: o });
|
|
63
|
+
n.set(t), s = () => t.destroy(), a = S(u.panes), r = C(t, u.panes, /* @__PURE__ */ new Map()), t.whenReady().then(() => c.set(!0));
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
stack: n,
|
|
67
|
+
isReady: c,
|
|
68
|
+
mount: d,
|
|
69
|
+
unmount: () => {
|
|
70
|
+
s == null || s(), n.set(null), c.set(!1);
|
|
71
|
+
},
|
|
72
|
+
sync: (o) => {
|
|
73
|
+
const t = i(n);
|
|
74
|
+
if (!t || !i(c)) return;
|
|
75
|
+
if (S(o.panes) !== a) {
|
|
76
|
+
d(t.container);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
A(t, o), r = C(t, o.panes, r);
|
|
80
|
+
},
|
|
81
|
+
fitAll: (o) => {
|
|
82
|
+
var t;
|
|
83
|
+
return (t = i(n)) == null ? void 0 : t.fitAll(o);
|
|
84
|
+
},
|
|
85
|
+
resetAll: () => {
|
|
86
|
+
var o;
|
|
87
|
+
return (o = i(n)) == null ? void 0 : o.resetAll();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function M(u, n, c = {}) {
|
|
92
|
+
const s = f(null), a = f(!1), r = f(null);
|
|
93
|
+
return { result: s, isLoading: a, error: r, run: async () => {
|
|
94
|
+
const p = u();
|
|
95
|
+
if (p) {
|
|
96
|
+
a.set(!0);
|
|
97
|
+
try {
|
|
98
|
+
const o = await I(p, n, c);
|
|
99
|
+
s.set(o), a.set(!1);
|
|
100
|
+
} catch (o) {
|
|
101
|
+
r.set(o instanceof Error ? o : new Error(String(o))), a.set(!1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}, cleanup: () => {
|
|
105
|
+
const p = u();
|
|
106
|
+
let o = null;
|
|
107
|
+
s.subscribe((e) => {
|
|
108
|
+
o = (e == null ? void 0 : e.id) ?? null;
|
|
109
|
+
})(), o && p && !w(p) && P(p, o);
|
|
110
|
+
} };
|
|
111
|
+
}
|
|
112
|
+
function B(u, n) {
|
|
113
|
+
const c = f(null);
|
|
114
|
+
let s = null;
|
|
115
|
+
return { group: c, sync: () => {
|
|
116
|
+
s == null || s.destroy();
|
|
117
|
+
const d = u();
|
|
118
|
+
if (d.length < 2) {
|
|
119
|
+
c.set(null);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
s = O(d, n), c.set(s.group);
|
|
123
|
+
}, destroy: () => {
|
|
124
|
+
s == null || s.destroy(), c.set(null);
|
|
125
|
+
} };
|
|
126
|
+
}
|
|
127
|
+
const Z = B, x = y, F = y, G = y;
|
|
128
|
+
export {
|
|
129
|
+
F as createSciPlot,
|
|
130
|
+
L as createStackedPlot,
|
|
131
|
+
y as createVeloPlot,
|
|
132
|
+
Z as useChartGroup,
|
|
133
|
+
B as useChartSync,
|
|
134
|
+
M as useIndicator,
|
|
135
|
+
G as useSciChart,
|
|
136
|
+
x as useSciPlot,
|
|
137
|
+
L as useStackedPlot,
|
|
138
|
+
y as useVeloPlot
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=svelte.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svelte.js","sources":["../src/svelte/useVeloPlot.ts","../src/svelte/useStackedPlot.ts","../src/svelte/useIndicator.ts","../src/svelte/useChartSync.ts","../src/svelte/index.ts"],"sourcesContent":["/**\n * Svelte composables for velo-plot (exported as functions).\n */\n\nimport { writable, get } from \"svelte/store\";\nimport type { Chart } from \"../core/Chart\";\nimport type { SeriesOptions, SeriesUpdateData, ZoomOptions, Bounds } from \"../types\";\nimport {\n createChartLifecycle,\n type ChartBindingOptions,\n optionsChanged,\n syncChartOptions,\n pickSyncableOptions,\n} from \"../bindings/shared\";\n\nexport interface UseVeloPlotOptions extends ChartBindingOptions {}\n\nexport function createVeloPlot(options: UseVeloPlotOptions = {}) {\n const chart = writable<Chart | null>(null);\n const isReady = writable(false);\n const error = writable<Error | null>(null);\n const bounds = writable<Bounds | null>(null);\n\n let destroy: (() => void) | null = null;\n let prevSync = pickSyncableOptions(options);\n\n const mount = (container: HTMLDivElement) => {\n destroy?.();\n const handle = createChartLifecycle(container, options, {\n onBoundsChange: (b) => bounds.set(b),\n onError: (e) => error.set(e),\n });\n chart.set(handle.chart);\n destroy = handle.destroy;\n bounds.set(handle.getBounds());\n isReady.set(true);\n prevSync = pickSyncableOptions(options);\n };\n\n const updateOptions = (next: UseVeloPlotOptions) => {\n const c = get(chart);\n if (!c) return;\n const picked = pickSyncableOptions(next);\n if (optionsChanged(prevSync, picked)) {\n syncChartOptions(c, prevSync, picked);\n prevSync = picked;\n }\n };\n\n const unmount = () => {\n destroy?.();\n destroy = null;\n chart.set(null);\n isReady.set(false);\n };\n\n return {\n chart,\n isReady,\n error,\n bounds,\n mount,\n unmount,\n updateOptions,\n addSeries: (opts: SeriesOptions) => {\n get(chart)?.addSeries(opts);\n const c = get(chart);\n if (c) bounds.set(c.getViewBounds());\n },\n updateSeries: (id: string, data: SeriesUpdateData) => get(chart)?.updateSeries(id, data),\n removeSeries: (id: string) => get(chart)?.removeSeries(id),\n zoom: (z: ZoomOptions) => get(chart)?.zoom(z),\n resetZoom: () => {\n get(chart)?.resetZoom();\n const c = get(chart);\n if (c) bounds.set(c.getViewBounds());\n },\n };\n}\n\nexport { createVeloPlot as useVeloPlot };\n","import { writable, get } from \"svelte/store\";\nimport { createStackedChart } from \"../core/stacked\";\nimport type { StackedChart, StackedChartOptions } from \"../core/stacked\";\nimport type { Range } from \"../types\";\nimport { stackedStructureKey, syncStackedOptions, syncStackedPaneSeries } from \"../bindings/shared\";\nimport type { VeloPlotSeries } from \"../bindings/shared\";\n\nexport function createStackedPlot(options: Omit<StackedChartOptions, \"container\">) {\n const stack = writable<StackedChart | null>(null);\n const isReady = writable(false);\n let destroy: (() => void) | null = null;\n let structureKey = stackedStructureKey(options.panes);\n let paneSeries = new Map<string, Map<string, VeloPlotSeries>>();\n\n const mount = (container: HTMLDivElement) => {\n destroy?.();\n const created = createStackedChart({ ...options, container });\n stack.set(created);\n destroy = () => created.destroy();\n structureKey = stackedStructureKey(options.panes);\n paneSeries = syncStackedPaneSeries(created, options.panes, new Map());\n created.whenReady().then(() => isReady.set(true));\n };\n\n const sync = (next: Omit<StackedChartOptions, \"container\">) => {\n const s = get(stack);\n if (!s || !get(isReady)) return;\n const nextKey = stackedStructureKey(next.panes);\n if (nextKey !== structureKey) {\n mount(s.container);\n return;\n }\n syncStackedOptions(s, next);\n paneSeries = syncStackedPaneSeries(s, next.panes, paneSeries);\n };\n\n const unmount = () => {\n destroy?.();\n stack.set(null);\n isReady.set(false);\n };\n\n return {\n stack,\n isReady,\n mount,\n unmount,\n sync,\n fitAll: (opts?: { x?: Range; padding?: number }) => get(stack)?.fitAll(opts),\n resetAll: () => get(stack)?.resetAll(),\n };\n}\n\nexport { createStackedPlot as useStackedPlot };\n","import { writable } from \"svelte/store\";\nimport type { AddIndicatorOptions, AddIndicatorResult } from \"../core/indicator/addIndicator\";\nimport type { IndicatorPresetName } from \"../core/indicator/indicatorPresets\";\nimport { addIndicatorToHost, isStackedChart, removeIndicatorFromChart, type IndicatorHost } from \"../bindings/shared\";\nimport type { Chart } from \"../core/chart/types\";\n\nexport function useIndicator(\n getHost: () => IndicatorHost,\n preset: IndicatorPresetName,\n options: AddIndicatorOptions = {},\n) {\n const result = writable<(AddIndicatorResult & { paneId?: string }) | null>(null);\n const isLoading = writable(false);\n const error = writable<Error | null>(null);\n\n const run = async () => {\n const host = getHost();\n if (!host) return;\n isLoading.set(true);\n try {\n const res = await addIndicatorToHost(host, preset, options);\n result.set(res);\n isLoading.set(false);\n } catch (e) {\n error.set(e instanceof Error ? e : new Error(String(e)));\n isLoading.set(false);\n }\n };\n\n const cleanupIndicator = () => {\n const host = getHost();\n let currentId: string | null = null;\n const unsub = result.subscribe((r) => {\n currentId = r?.id ?? null;\n });\n unsub();\n if (currentId && host && !isStackedChart(host)) {\n removeIndicatorFromChart(host as Chart, currentId);\n }\n };\n\n return { result, isLoading, error, run, cleanup: cleanupIndicator };\n}\n","import { writable } from \"svelte/store\";\nimport type { ChartLike, SyncOptions } from \"../core/sync\";\nimport { ChartGroup } from \"../core/sync\";\nimport { createChartSync } from \"../bindings/shared\";\n\nexport function useChartSync(getCharts: () => ChartLike[], options?: SyncOptions) {\n const group = writable<ChartGroup | null>(null);\n let handle: ReturnType<typeof createChartSync> | null = null;\n\n const sync = () => {\n handle?.destroy();\n const charts = getCharts();\n if (charts.length < 2) {\n group.set(null);\n return;\n }\n handle = createChartSync(charts, options);\n group.set(handle.group);\n };\n\n const destroy = () => {\n handle?.destroy();\n group.set(null);\n };\n\n return { group, sync, destroy };\n}\n\nexport const useChartGroup = useChartSync;\n","export { createVeloPlot, useVeloPlot, type UseVeloPlotOptions } from \"./useVeloPlot\";\nexport { createStackedPlot, useStackedPlot } from \"./useStackedPlot\";\nexport { useIndicator } from \"./useIndicator\";\nexport { useChartSync, useChartGroup } from \"./useChartSync\";\n\nimport { useVeloPlot as useVeloPlotImpl, createVeloPlot as createVeloPlotImpl } from \"./useVeloPlot\";\n\n/** @deprecated Use `useVeloPlot` / `createVeloPlot` instead. **Removed in v4.0.** */\nexport const useSciPlot = useVeloPlotImpl;\n/** @deprecated Use `createVeloPlot` instead. **Removed in v4.0.** */\nexport const createSciPlot = createVeloPlotImpl;\n/** @deprecated Use `useVeloPlot` instead. **Removed in v4.0.** */\nexport const useSciChart = useVeloPlotImpl;\n\n// Svelte components: import from 'velo-plot/svelte/VeloPlot.svelte' (shipped as source)\n"],"names":["createVeloPlot","options","chart","writable","isReady","error","bounds","destroy","prevSync","pickSyncableOptions","container","handle","createChartLifecycle","b","e","next","c","get","picked","optionsChanged","syncChartOptions","opts","_a","id","data","z","createStackedPlot","stack","structureKey","stackedStructureKey","paneSeries","mount","created","createStackedChart","syncStackedPaneSeries","s","syncStackedOptions","useIndicator","getHost","preset","result","isLoading","host","res","addIndicatorToHost","currentId","r","isStackedChart","removeIndicatorFromChart","useChartSync","getCharts","group","charts","createChartSync","useChartGroup","useSciPlot","useVeloPlotImpl","createSciPlot","createVeloPlotImpl","useSciChart"],"mappings":";;;;;AAiBO,SAASA,EAAeC,IAA8B,IAAI;AAC/D,QAAMC,IAAQC,EAAuB,IAAI,GACnCC,IAAUD,EAAS,EAAK,GACxBE,IAAQF,EAAuB,IAAI,GACnCG,IAASH,EAAwB,IAAI;AAE3C,MAAII,IAA+B,MAC/BC,IAAWC,EAAoBR,CAAO;AAgC1C,SAAO;AAAA,IACL,OAAAC;AAAA,IACA,SAAAE;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,OAnCY,CAACI,MAA8B;AAC3C,MAAAH,KAAA,QAAAA;AACA,YAAMI,IAASC,EAAqBF,GAAWT,GAAS;AAAA,QACtD,gBAAgB,CAACY,MAAMP,EAAO,IAAIO,CAAC;AAAA,QACnC,SAAS,CAACC,MAAMT,EAAM,IAAIS,CAAC;AAAA,MAAA,CAC5B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AM;AACpB,IAAAA,KAAA,QAAAA,EAAQ,WACRwC,EAAM,IAAI,IAAI;AAAA,EAChB,EAEsB;AACxB;AAEO,MAAMG,IAAgBL,GCpBhBM,IAAaC,GAEbC,IAAgBC,GAEhBC,IAAcH;"}
|
package/dist/testing/index.d.ts
CHANGED
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Theme - Visual styling configuration for
|
|
2
|
+
* Theme - Visual styling configuration for VeloPlot
|
|
3
3
|
*
|
|
4
4
|
* Provides customizable themes for the chart including:
|
|
5
5
|
* - Grid styling
|
|
@@ -123,6 +123,7 @@ export declare const DARK_THEME: ChartTheme;
|
|
|
123
123
|
export declare const MIDNIGHT_THEME: ChartTheme;
|
|
124
124
|
/** Light theme - Clean white background */
|
|
125
125
|
export declare const LIGHT_THEME: ChartTheme;
|
|
126
|
+
export declare const HIGH_CONTRAST_THEME: ChartTheme;
|
|
126
127
|
/** Electrochemistry theme - Professional blue tones */
|
|
127
128
|
export declare const ELECTROCHEM_THEME: ChartTheme;
|
|
128
129
|
/**
|
package/dist/trading/index.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* velo-plot/trading — focused trading dashboard bundle (Stage 2).
|
|
3
|
-
* Tree-shakes scientific/3D plugins; includes stacked charts, indicators, drawings, replay.
|
|
4
|
-
*/
|
|
1
|
+
|
|
5
2
|
export { createChart } from '../core/Chart';
|
|
6
3
|
export { createStackedChart } from '../core/stacked/createStackedChart';
|
|
7
4
|
export type { Chart, ChartOptions } from '../core/Chart';
|
package/dist/trading.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as k } from "./
|
|
3
|
-
import {
|
|
1
|
+
import { a as P, f as b, g as v, c as B } from "./createStackedChart-DqcLCFGS.js";
|
|
2
|
+
import { c as S, b as U, f as H, i as I, a as k, m as _ } from "./axisFormat-Sz4WIJfQ.js";
|
|
3
|
+
import { P as R, a as G, b as K, c as j, d as X } from "./index-Cv6ZDLWf.js";
|
|
4
4
|
import { PluginAnnotations as q } from "./plugins/annotations.js";
|
|
5
|
-
import {
|
|
6
|
-
import { P as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { PluginKeyboard as J } from "./plugins/keyboard.js";
|
|
6
|
+
import { P as O } from "./index-BgrvqltV.js";
|
|
7
|
+
import { C as V } from "./index-CaXWSOTk.js";
|
|
8
|
+
import { D as Z, e as $, d as ee, c as te } from "./ChartCore-AnR_3Xkb.js";
|
|
9
9
|
const p = 864e5;
|
|
10
|
-
function
|
|
10
|
+
function g(e) {
|
|
11
11
|
let a = e >>> 0;
|
|
12
12
|
return () => {
|
|
13
13
|
a = a + 1831565813 >>> 0;
|
|
@@ -16,7 +16,7 @@ function w(e) {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
function h(e) {
|
|
19
|
-
return e !== void 0 ?
|
|
19
|
+
return e !== void 0 ? g(e) : Math.random;
|
|
20
20
|
}
|
|
21
21
|
function D(e, a, t = Date.UTC(2024, 0, 2)) {
|
|
22
22
|
const l = typeof e == "object" ? e : { startMs: e, seed: a };
|
|
@@ -25,31 +25,31 @@ function D(e, a, t = Date.UTC(2024, 0, 2)) {
|
|
|
25
25
|
seed: l.seed
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const { startMs: l, seed:
|
|
28
|
+
function w(e, a = Date.UTC(2024, 0, 2), t) {
|
|
29
|
+
const { startMs: l, seed: y } = D(a, t), n = h(y), u = new Float64Array(e), c = new Float32Array(e), f = new Float32Array(e), d = new Float32Array(e), s = new Float32Array(e), m = new Float32Array(e);
|
|
30
30
|
let i = l, r = 100;
|
|
31
31
|
for (let o = 0; o < e; o++) {
|
|
32
32
|
for (; new Date(i).getUTCDay() === 0 || new Date(i).getUTCDay() === 6; )
|
|
33
33
|
i += p;
|
|
34
34
|
u[o] = i, c[o] = r;
|
|
35
35
|
const A = (n() - 0.48) * 3;
|
|
36
|
-
s[o] = r + A, f[o] = Math.max(c[o], s[o]) + n() * 1.5,
|
|
36
|
+
s[o] = r + A, f[o] = Math.max(c[o], s[o]) + n() * 1.5, d[o] = Math.min(c[o], s[o]) - n() * 1.5, m[o] = 5e5 + n() * 2e6, r = s[o], i += p;
|
|
37
37
|
}
|
|
38
|
-
return { x: u, open: c, high: f, low:
|
|
38
|
+
return { x: u, open: c, high: f, low: d, close: s, volume: m };
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
const { startMs: l, seed:
|
|
40
|
+
function x(e, a = Date.UTC(2024, 0, 1), t) {
|
|
41
|
+
const { startMs: l, seed: y } = D(
|
|
42
42
|
a,
|
|
43
43
|
t,
|
|
44
44
|
Date.UTC(2024, 0, 1)
|
|
45
|
-
), n = h(
|
|
45
|
+
), n = h(y), u = new Float64Array(e), c = new Float32Array(e), f = new Float32Array(e), d = new Float32Array(e), s = new Float32Array(e), m = new Float32Array(e);
|
|
46
46
|
let i = 100;
|
|
47
47
|
for (let r = 0; r < e; r++) {
|
|
48
48
|
u[r] = l + r * p, c[r] = i;
|
|
49
49
|
const o = (n() - 0.48) * 3;
|
|
50
|
-
s[r] = i + o, f[r] = Math.max(c[r], s[r]) + n() * 1.5,
|
|
50
|
+
s[r] = i + o, f[r] = Math.max(c[r], s[r]) + n() * 1.5, d[r] = Math.min(c[r], s[r]) - n() * 1.5, m[r] = 5e5 + n() * 2e6, i = s[r];
|
|
51
51
|
}
|
|
52
|
-
return { x: u, open: c, high: f, low:
|
|
52
|
+
return { x: u, open: c, high: f, low: d, close: s, volume: m };
|
|
53
53
|
}
|
|
54
54
|
function M(e) {
|
|
55
55
|
let a = 0;
|
|
@@ -64,32 +64,32 @@ function T(e) {
|
|
|
64
64
|
return a;
|
|
65
65
|
}
|
|
66
66
|
export {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
V as ChartGroup,
|
|
68
|
+
Z as DARK_THEME,
|
|
69
|
+
$ as DEFAULT_THEME,
|
|
70
|
+
ee as LIGHT_THEME,
|
|
71
71
|
q as PluginAnnotations,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
72
|
+
R as PluginDrawingTools,
|
|
73
|
+
J as PluginKeyboard,
|
|
74
|
+
G as PluginReplay,
|
|
75
|
+
O as PluginStreaming,
|
|
76
|
+
P as addIndicatorToChart,
|
|
77
|
+
S as applyBusinessDayX,
|
|
78
|
+
K as barsToOhlc,
|
|
79
|
+
b as buildIndicatorPaneFromPreset,
|
|
80
|
+
U as businessDaySpanMs,
|
|
81
|
+
j as computeHeikinAshi,
|
|
82
|
+
v as computeIndicatorFromSeries,
|
|
83
|
+
te as createChart,
|
|
84
|
+
X as createMockDatafeed,
|
|
85
|
+
B as createStackedChart,
|
|
86
86
|
T as findHighestBarIndex,
|
|
87
87
|
M as findLowestBarIndex,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
H as formatBusinessDayTick,
|
|
89
|
+
w as generateBusinessDayOhlcv,
|
|
90
|
+
x as generateContinuousOhlcv,
|
|
91
|
+
I as isBusinessDay,
|
|
92
|
+
k as isBusinessDayScaleActive,
|
|
93
|
+
_ as mapToBusinessDayScale
|
|
94
94
|
};
|
|
95
95
|
//# sourceMappingURL=trading.js.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Core type definitions for
|
|
2
|
+
* Core type definitions for Velo Plot
|
|
3
3
|
*/
|
|
4
4
|
/** 2D point */
|
|
5
5
|
export interface Point {
|
|
@@ -225,9 +225,9 @@ export interface SeriesUpdateData {
|
|
|
225
225
|
/** New value for Gauge charts */
|
|
226
226
|
value?: number;
|
|
227
227
|
/** New nodes for Sankey diagrams */
|
|
228
|
-
nodes?:
|
|
228
|
+
nodes?: SankeyNode[] | string[];
|
|
229
229
|
/** New links for Sankey diagrams */
|
|
230
|
-
links?:
|
|
230
|
+
links?: SankeyLink[];
|
|
231
231
|
/** If true, append to existing data; if false, replace */
|
|
232
232
|
append?: boolean;
|
|
233
233
|
}
|
|
@@ -556,7 +556,7 @@ export interface ChartOptions {
|
|
|
556
556
|
/** Responsive design configuration */
|
|
557
557
|
responsive?: import('./core/responsive').ResponsiveConfig | boolean;
|
|
558
558
|
/** Initial plugins to load */
|
|
559
|
-
plugins?:
|
|
559
|
+
plugins?: import('./plugins/types').ChartPlugin[];
|
|
560
560
|
/** Loading indicator configuration */
|
|
561
561
|
loading?: boolean | import('./plugins/loading').PluginLoadingConfig;
|
|
562
562
|
/**
|
|
@@ -156,17 +156,17 @@ function V(t, e, n, r) {
|
|
|
156
156
|
return i;
|
|
157
157
|
}
|
|
158
158
|
export {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
159
|
+
w as a,
|
|
160
|
+
I as b,
|
|
161
|
+
D as c,
|
|
162
|
+
v as d,
|
|
163
|
+
S as e,
|
|
164
164
|
F as f,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
g,
|
|
166
|
+
C as h,
|
|
167
|
+
B as i,
|
|
168
168
|
E as m,
|
|
169
169
|
V as s,
|
|
170
170
|
k as v
|
|
171
171
|
};
|
|
172
|
-
//# sourceMappingURL=utils-
|
|
172
|
+
//# sourceMappingURL=utils-Dx0h0bgQ.js.map
|