velo-plot 2.20.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -8
- package/dist/{ChartCore-ivzLqxVb.js → ChartCore-BpzRvN4Y.js} +978 -861
- package/dist/ChartCore-BpzRvN4Y.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/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-DbWrwtyP.js +57 -0
- package/dist/chartSyncBridge-DbWrwtyP.js.map +1 -0
- package/dist/core/Chart.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 +2 -2
- 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-Dm-YqUT7.js +756 -0
- package/dist/createStackedChart-Dm-YqUT7.js.map +1 -0
- package/dist/examples/PluginDemonstration.d.ts +1 -1
- package/dist/gpuRenderer-BpaMYz-k.js.map +1 -1
- package/dist/hooks-CYPCxoZx.js +69 -0
- package/dist/hooks-CYPCxoZx.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-BMiZoKmm.js.map +1 -1
- 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/index-Dag88bW4.js.map +1 -1
- package/dist/index-qhscKTDy.js.map +1 -1
- package/dist/index-qunX30Xu.js.map +1 -1
- package/dist/index-x4stH3jD.js.map +1 -1
- package/dist/{index.core-COREBDNq.js → index.core-BmZe2jRQ.js} +9 -9
- package/dist/index.core-BmZe2jRQ.js.map +1 -0
- package/dist/index.core.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/indicators--eJGmVox.js.map +1 -1
- package/dist/{mockDatafeed-927foCM4.js → mockDatafeed-DHIDPcpX.js} +150 -146
- package/dist/mockDatafeed-DHIDPcpX.js.map +1 -0
- 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.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/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 +2 -2
- 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.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.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.map +1 -1
- package/dist/plugins/lazy-load.d.ts +2 -2
- package/dist/plugins/loading/index.d.ts +1 -1
- package/dist/plugins/loading.d.ts +2 -2
- 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/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 +1 -1
- 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/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/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 +328 -24
- package/dist/react.js.map +1 -1
- package/dist/scientific/index.d.ts +48 -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 +172 -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 +143 -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.js +6 -6
- package/dist/types.d.ts +1 -1
- 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 +452 -443
- package/dist/velo-plot.full.js.map +1 -1
- package/dist/velo-plot.js +15 -15
- 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 +312 -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 +88 -10
- 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/index-BBpJwOct.js.map +0 -1
- package/dist/index-DoYxf1cV.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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChartPlugin } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Velo Plot - Streaming Plugin
|
|
4
4
|
*
|
|
5
5
|
* Provides real-time data streaming capabilities including:
|
|
6
6
|
* - WebSocket connections
|
|
@@ -24,7 +24,7 @@ export interface PluginStreamingConfig {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* VeloPlot Streaming Plugin
|
|
28
28
|
*
|
|
29
29
|
* Enables seamless integration with real-time data sources.
|
|
30
30
|
*/
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './streaming/index'
|
|
2
|
-
import
|
|
3
|
-
export default
|
|
2
|
+
import VeloPlot from './streaming/index'
|
|
3
|
+
export default VeloPlot
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChartPlugin } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* VeloPlot Engine - Chart Sync Plugin
|
|
4
4
|
*
|
|
5
5
|
* Provides synchronization between multiple chart instances.
|
|
6
6
|
*
|
|
@@ -14,10 +14,11 @@ export interface PluginSyncConfig {
|
|
|
14
14
|
syncAxes?: "x" | "y" | "both";
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* VeloPlot Sync Plugin
|
|
18
18
|
*
|
|
19
19
|
* @deprecated Use `ChartGroup` / `createChartGroup` from `velo-plot` (or `velo-plot/full`) instead.
|
|
20
20
|
* This plugin stub does not perform synchronization. Kept for backward-compatible imports only.
|
|
21
|
+
* **Removed in v4.0.**
|
|
21
22
|
*/
|
|
22
23
|
export declare function PluginSync(config?: PluginSyncConfig): ChartPlugin<PluginSyncConfig>;
|
|
23
24
|
export default PluginSync;
|
package/dist/plugins/sync.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './sync/index'
|
|
2
|
-
import
|
|
3
|
-
export default
|
|
2
|
+
import VeloPlot from './sync/index'
|
|
3
|
+
export default VeloPlot
|
package/dist/plugins/sync.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sources":["../../src/plugins/sync/index.ts"],"sourcesContent":["/**\n *
|
|
1
|
+
{"version":3,"file":"sync.js","sources":["../../src/plugins/sync/index.ts"],"sourcesContent":["/**\n * VeloPlot Engine - Chart Sync Plugin\n * \n * Provides synchronization between multiple chart instances.\n * \n * @module plugins/sync\n */\n\nexport * from \"../../core/sync\";\n\nimport type { PluginManifest, ChartPlugin, PluginContext } from \"../types\";\n\nexport interface PluginSyncConfig {\n /** Group ID to join */\n groupId?: string;\n /** Sync axes: 'x' | 'y' | 'both' */\n syncAxes?: \"x\" | \"y\" | \"both\";\n}\n\nconst manifestSync: PluginManifest = {\n name: \"velo-plot-sync\",\n version: \"1.0.0\",\n description: \"Multi-chart synchronization for velo-plot\",\n provides: [\"interaction\"],\n tags: [\"sync\", \"multi-chart\", \"coordination\"],\n};\n\n/**\n * VeloPlot Sync Plugin\n *\n * @deprecated Use `ChartGroup` / `createChartGroup` from `velo-plot` (or `velo-plot/full`) instead.\n * This plugin stub does not perform synchronization. Kept for backward-compatible imports only.\n * **Removed in v4.0.**\n */\nexport function PluginSync(config: PluginSyncConfig = {}): ChartPlugin<PluginSyncConfig> {\n void config;\n return {\n manifest: manifestSync,\n\n onInit(_ctx: PluginContext) {\n console.warn(\n \"[PluginSync] Deprecated: use ChartGroup / createChartGroup from the core sync module instead.\",\n );\n },\n\n onDestroy(_ctx: PluginContext) {\n },\n };\n}\n\nexport default PluginSync;\n"],"names":["manifestSync","PluginSync","config","_ctx"],"mappings":";AAmBA,MAAMA,IAA+B;AAAA,EACjC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU,CAAC,aAAa;AAAA,EACxB,MAAM,CAAC,QAAQ,eAAe,cAAc;AAChD;AASO,SAASC,EAAWC,IAA2B,IAAmC;AAEvF,SAAO;AAAA,IACL,UAAUF;AAAA,IAEV,OAAOG,GAAqB;AAC1B,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ;AAAA,IAEA,UAAUA,GAAqB;AAAA,IAC/B;AAAA,EAAA;AAEJ;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './theme-editor/index'
|
|
2
|
-
import
|
|
3
|
-
export default
|
|
2
|
+
import VeloPlot from './theme-editor/index'
|
|
3
|
+
export default VeloPlot
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tooltip System - High-performance, customizable tooltips for
|
|
2
|
+
* Tooltip System - High-performance, customizable tooltips for Velo Plot
|
|
3
3
|
*
|
|
4
4
|
* This module provides a comprehensive tooltip system with:
|
|
5
5
|
* - Multiple tooltip types (datapoint, crosshair, heatmap, etc.)
|
package/dist/plugins/tools.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './tools/index'
|
|
2
|
-
import
|
|
3
|
-
export default
|
|
2
|
+
import VeloPlot from './tools/index'
|
|
3
|
+
export default VeloPlot
|
package/dist/plugins/types.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export interface PluginManifest {
|
|
|
36
36
|
dependencies?: string[];
|
|
37
37
|
/** Optional plugins that enhance this one if present */
|
|
38
38
|
optionalDependencies?: string[];
|
|
39
|
-
/** Minimum
|
|
39
|
+
/** Minimum Velo Plot version required */
|
|
40
40
|
engineVersion?: PluginVersion;
|
|
41
41
|
/** Plugin-specific configuration schema (JSON Schema format) */
|
|
42
42
|
configSchema?: Record<string, unknown>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './video-recorder/index'
|
|
2
|
-
import
|
|
3
|
-
export default
|
|
2
|
+
import VeloPlot from './video-recorder/index'
|
|
3
|
+
export default VeloPlot
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './virtualization/index'
|
|
2
|
-
import
|
|
3
|
-
export default
|
|
2
|
+
import VeloPlot from './virtualization/index'
|
|
3
|
+
export default VeloPlot
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var l = (n, e, r) => e in n ? h(n, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[e] = r;
|
|
3
|
+
var i = (n, e, r) => l(n, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
class k {
|
|
5
|
+
constructor(e, r = {}) {
|
|
6
|
+
i(this, "workers", []);
|
|
7
|
+
i(this, "pending", /* @__PURE__ */ new Map());
|
|
8
|
+
i(this, "nextWorker", 0);
|
|
9
|
+
i(this, "poolSize");
|
|
10
|
+
i(this, "syncFallback");
|
|
11
|
+
i(this, "timeoutMs");
|
|
12
|
+
i(this, "workerFactory");
|
|
13
|
+
i(this, "syncHandler");
|
|
14
|
+
i(this, "destroyed", !1);
|
|
15
|
+
if (this.workerFactory = e, this.poolSize = r.poolSize ?? 2, this.syncFallback = r.syncFallback ?? !0, this.timeoutMs = r.timeoutMs ?? 250, this.syncHandler = r.syncHandler, typeof Worker < "u")
|
|
16
|
+
for (let t = 0; t < this.poolSize; t++)
|
|
17
|
+
this.spawnWorker();
|
|
18
|
+
}
|
|
19
|
+
removeWorker(e) {
|
|
20
|
+
const r = this.workers.indexOf(e);
|
|
21
|
+
r >= 0 && this.workers.splice(r, 1), e.terminate();
|
|
22
|
+
}
|
|
23
|
+
workerErrorMessage(e) {
|
|
24
|
+
const r = e;
|
|
25
|
+
return typeof r.message == "string" && r.message ? r.message : "Worker error";
|
|
26
|
+
}
|
|
27
|
+
rejectPendingWithSyncFallback(e, r) {
|
|
28
|
+
this.removeWorker(e);
|
|
29
|
+
const t = this.workerErrorMessage(r), s = [...this.pending.entries()];
|
|
30
|
+
this.pending.clear();
|
|
31
|
+
for (const [, o] of s) {
|
|
32
|
+
if (this.clearTaskTimer(o), this.syncFallback && this.syncHandler) {
|
|
33
|
+
Promise.resolve(this.syncHandler(o.task)).then(o.resolve).catch(o.reject);
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
o.reject(new Error(t));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
clearTaskTimer(e) {
|
|
40
|
+
e.timer !== void 0 && clearTimeout(e.timer);
|
|
41
|
+
}
|
|
42
|
+
settleWithSync(e) {
|
|
43
|
+
if (this.syncFallback && this.syncHandler) {
|
|
44
|
+
Promise.resolve(this.syncHandler(e.task)).then(e.resolve).catch(e.reject);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
e.reject(new Error("Worker task timed out"));
|
|
48
|
+
}
|
|
49
|
+
spawnWorker() {
|
|
50
|
+
const e = this.workerFactory();
|
|
51
|
+
e.onmessage = (r) => {
|
|
52
|
+
const t = r.data;
|
|
53
|
+
if (!(t != null && t.id)) return;
|
|
54
|
+
const s = this.pending.get(t.id);
|
|
55
|
+
if (s) {
|
|
56
|
+
if (this.pending.delete(t.id), this.clearTaskTimer(s), t.type === "error" || t.error) {
|
|
57
|
+
this.syncFallback && this.syncHandler ? this.settleWithSync(s) : s.reject(new Error(t.error ?? "Worker task failed"));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
s.resolve(t);
|
|
61
|
+
}
|
|
62
|
+
}, e.onerror = (r) => {
|
|
63
|
+
this.rejectPendingWithSyncFallback(e, r);
|
|
64
|
+
}, this.workers.push(e);
|
|
65
|
+
}
|
|
66
|
+
/** Dispatch a task to the pool. Falls back to syncHandler when no workers exist. */
|
|
67
|
+
run(e) {
|
|
68
|
+
return this.destroyed ? Promise.reject(new Error("WorkerPool destroyed")) : this.workers.length === 0 ? this.syncFallback && this.syncHandler ? Promise.resolve(this.syncHandler(e)) : Promise.reject(new Error("No workers available and sync fallback disabled")) : new Promise((r, t) => {
|
|
69
|
+
const s = { resolve: r, reject: t, task: e };
|
|
70
|
+
this.timeoutMs > 0 && (s.timer = setTimeout(() => {
|
|
71
|
+
this.pending.has(e.id) && (this.pending.delete(e.id), this.settleWithSync(s));
|
|
72
|
+
}, this.timeoutMs)), this.pending.set(e.id, s);
|
|
73
|
+
const o = this.nextWorker;
|
|
74
|
+
this.nextWorker = (this.nextWorker + 1) % this.workers.length;
|
|
75
|
+
try {
|
|
76
|
+
this.workers[o].postMessage(e);
|
|
77
|
+
} catch (a) {
|
|
78
|
+
if (this.pending.delete(e.id), this.clearTaskTimer(s), this.syncFallback && this.syncHandler) {
|
|
79
|
+
Promise.resolve(this.syncHandler(e)).then(r).catch(t);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
t(a instanceof Error ? a : new Error(String(a)));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
size() {
|
|
87
|
+
return this.workers.length;
|
|
88
|
+
}
|
|
89
|
+
pendingCount() {
|
|
90
|
+
return this.pending.size;
|
|
91
|
+
}
|
|
92
|
+
destroy() {
|
|
93
|
+
this.destroyed = !0;
|
|
94
|
+
for (const e of this.pending.values())
|
|
95
|
+
this.clearTaskTimer(e);
|
|
96
|
+
for (const e of this.workers)
|
|
97
|
+
e.terminate();
|
|
98
|
+
this.workers = [], this.pending.clear();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
let c = 0;
|
|
102
|
+
function y(n = "task") {
|
|
103
|
+
return c += 1, `${n}-${c}-${Date.now()}`;
|
|
104
|
+
}
|
|
105
|
+
export {
|
|
106
|
+
k as W,
|
|
107
|
+
y as n
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=pool-DZ8shSqv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pool-DZ8shSqv.js","sources":["../src/workers/pool.ts"],"sourcesContent":["/**\n * Generic worker pool with round-robin dispatch and sync fallback.\n * @module workers/pool\n */\n\nexport interface WorkerPoolOptions {\n /** Number of workers (default: 2) */\n poolSize?: number;\n /** Run tasks on main thread when Worker is unavailable */\n syncFallback?: boolean;\n /**\n * If a worker never answers (common with broken Vite worker URLs in docs),\n * fall back to syncHandler after this many ms (default: 250).\n * Set 0 to disable.\n */\n timeoutMs?: number;\n}\n\nexport class WorkerPool<TMessage extends { id: string }, TResult = unknown> {\n private workers: Worker[] = [];\n private pending = new Map<\n string,\n {\n resolve: (value: TResult) => void;\n reject: (error: Error) => void;\n task: TMessage;\n timer?: ReturnType<typeof setTimeout>;\n }\n >();\n private nextWorker = 0;\n private readonly poolSize: number;\n private readonly syncFallback: boolean;\n private readonly timeoutMs: number;\n private readonly workerFactory: () => Worker;\n private readonly syncHandler?: (task: TMessage) => TResult | Promise<TResult>;\n private destroyed = false;\n\n constructor(\n workerFactory: () => Worker,\n options: WorkerPoolOptions & {\n syncHandler?: (task: TMessage) => TResult | Promise<TResult>;\n } = {},\n ) {\n this.workerFactory = workerFactory;\n this.poolSize = options.poolSize ?? 2;\n this.syncFallback = options.syncFallback ?? true;\n this.timeoutMs = options.timeoutMs ?? 250;\n this.syncHandler = options.syncHandler;\n\n if (typeof Worker !== \"undefined\") {\n for (let i = 0; i < this.poolSize; i++) {\n this.spawnWorker();\n }\n }\n }\n\n private removeWorker(worker: Worker): void {\n const index = this.workers.indexOf(worker);\n if (index >= 0) this.workers.splice(index, 1);\n worker.terminate();\n }\n\n private workerErrorMessage(event: Event): string {\n const maybe = event as { message?: string };\n if (typeof maybe.message === \"string\" && maybe.message) return maybe.message;\n return \"Worker error\";\n }\n\n private rejectPendingWithSyncFallback(failedWorker: Worker, event: Event): void {\n this.removeWorker(failedWorker);\n const message = this.workerErrorMessage(event);\n const entries = [...this.pending.entries()];\n this.pending.clear();\n\n for (const [, entry] of entries) {\n this.clearTaskTimer(entry);\n if (this.syncFallback && this.syncHandler) {\n Promise.resolve(this.syncHandler(entry.task)).then(entry.resolve).catch(entry.reject);\n continue;\n }\n entry.reject(new Error(message));\n }\n }\n\n private clearTaskTimer(entry: { timer?: ReturnType<typeof setTimeout> }): void {\n if (entry.timer !== undefined) clearTimeout(entry.timer);\n }\n\n private settleWithSync(entry: {\n resolve: (value: TResult) => void;\n reject: (error: Error) => void;\n task: TMessage;\n }): void {\n if (this.syncFallback && this.syncHandler) {\n Promise.resolve(this.syncHandler(entry.task)).then(entry.resolve).catch(entry.reject);\n return;\n }\n entry.reject(new Error(\"Worker task timed out\"));\n }\n\n private spawnWorker(): void {\n const worker = this.workerFactory();\n worker.onmessage = (event: MessageEvent) => {\n const data = event.data as { id?: string; type?: string; error?: string };\n if (!data?.id) return;\n\n const task = this.pending.get(data.id);\n if (!task) return;\n\n this.pending.delete(data.id);\n this.clearTaskTimer(task);\n\n if (data.type === \"error\" || data.error) {\n if (this.syncFallback && this.syncHandler) {\n this.settleWithSync(task);\n } else {\n task.reject(new Error(data.error ?? \"Worker task failed\"));\n }\n return;\n }\n\n task.resolve(data as TResult);\n };\n\n worker.onerror = (event) => {\n this.rejectPendingWithSyncFallback(worker, event);\n };\n\n this.workers.push(worker);\n }\n\n /** Dispatch a task to the pool. Falls back to syncHandler when no workers exist. */\n run(task: TMessage): Promise<TResult> {\n if (this.destroyed) {\n return Promise.reject(new Error(\"WorkerPool destroyed\"));\n }\n\n if (this.workers.length === 0) {\n if (this.syncFallback && this.syncHandler) {\n return Promise.resolve(this.syncHandler(task));\n }\n return Promise.reject(new Error(\"No workers available and sync fallback disabled\"));\n }\n\n return new Promise((resolve, reject) => {\n const entry: {\n resolve: (value: TResult) => void;\n reject: (error: Error) => void;\n task: TMessage;\n timer?: ReturnType<typeof setTimeout>;\n } = { resolve, reject, task };\n\n if (this.timeoutMs > 0) {\n entry.timer = setTimeout(() => {\n if (!this.pending.has(task.id)) return;\n this.pending.delete(task.id);\n // Silent worker (Vite docs often loads a broken worker URL that never\n // answers and never fires onerror) — fall back to main-thread calc.\n this.settleWithSync(entry);\n }, this.timeoutMs);\n }\n\n this.pending.set(task.id, entry);\n const workerIndex = this.nextWorker;\n this.nextWorker = (this.nextWorker + 1) % this.workers.length;\n try {\n this.workers[workerIndex].postMessage(task);\n } catch (err) {\n this.pending.delete(task.id);\n this.clearTaskTimer(entry);\n if (this.syncFallback && this.syncHandler) {\n Promise.resolve(this.syncHandler(task)).then(resolve).catch(reject);\n return;\n }\n reject(err instanceof Error ? err : new Error(String(err)));\n }\n });\n }\n\n size(): number {\n return this.workers.length;\n }\n\n pendingCount(): number {\n return this.pending.size;\n }\n\n destroy(): void {\n this.destroyed = true;\n for (const entry of this.pending.values()) {\n this.clearTaskTimer(entry);\n }\n for (const worker of this.workers) {\n worker.terminate();\n }\n this.workers = [];\n this.pending.clear();\n }\n}\n\nlet taskCounter = 0;\n\n/** Generate a unique task id */\nexport function nextTaskId(prefix = \"task\"): string {\n taskCounter += 1;\n return `${prefix}-${taskCounter}-${Date.now()}`;\n}\n"],"names":["WorkerPool","workerFactory","options","__publicField","i","worker","index","event","maybe","failedWorker","message","entries","entry","data","task","resolve","reject","workerIndex","err","taskCounter","nextTaskId","prefix"],"mappings":"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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { UseStackedPlotOptions } from './useStackedPlot';
|
|
3
|
+
import { StackedChart } from '../core/stacked';
|
|
4
|
+
import { Bounds } from '../types';
|
|
5
|
+
import { AddIndicatorOptions } from '../core/indicator/addIndicator';
|
|
6
|
+
import { IndicatorPresetName } from '../core/indicator/indicatorPresets';
|
|
7
|
+
|
|
8
|
+
export interface StackedPlotIndicator extends AddIndicatorOptions {
|
|
9
|
+
type: IndicatorPresetName;
|
|
10
|
+
}
|
|
11
|
+
export interface StackedPlotProps extends UseStackedPlotOptions {
|
|
12
|
+
width?: number | string;
|
|
13
|
+
height?: number | string;
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: CSSProperties;
|
|
16
|
+
indicators?: StackedPlotIndicator[];
|
|
17
|
+
onCrosshairMove?: (event: {
|
|
18
|
+
price?: number;
|
|
19
|
+
x: number;
|
|
20
|
+
}) => void;
|
|
21
|
+
drawingTools?: string[];
|
|
22
|
+
ariaLabel?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface StackedPlotRef {
|
|
25
|
+
getStack: () => StackedChart | null;
|
|
26
|
+
fitAll: () => void;
|
|
27
|
+
resetAll: () => void;
|
|
28
|
+
getBounds: () => Bounds | null;
|
|
29
|
+
}
|
|
30
|
+
export declare const StackedPlot: import('react').ForwardRefExoticComponent<StackedPlotProps & import('react').RefAttributes<StackedPlotRef>>;
|
|
31
|
+
export default StackedPlot;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { UseVeloPlotOptions } from './useVeloPlot';
|
|
3
|
+
import { ZoomOptions, CursorOptions, Bounds } from '../types';
|
|
4
|
+
import { Chart } from '../core/Chart';
|
|
5
|
+
import { VeloPlotSeries } from '../bindings/shared';
|
|
6
|
+
|
|
7
|
+
export type { VeloPlotSeries } from '../bindings/shared';
|
|
8
|
+
export interface VeloPlotProps extends UseVeloPlotOptions {
|
|
9
|
+
series?: VeloPlotSeries[];
|
|
10
|
+
zoom?: ZoomOptions;
|
|
11
|
+
onZoomChange?: (bounds: Bounds) => void;
|
|
12
|
+
cursor?: CursorOptions;
|
|
13
|
+
width?: number | string;
|
|
14
|
+
height?: number | string;
|
|
15
|
+
className?: string;
|
|
16
|
+
style?: CSSProperties;
|
|
17
|
+
debug?: boolean;
|
|
18
|
+
/** Custom aria-label for accessibility */
|
|
19
|
+
ariaLabel?: string;
|
|
20
|
+
/** Enable keyboard navigation (default: true) */
|
|
21
|
+
keyboardNav?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface VeloPlotRef {
|
|
24
|
+
getChart: () => Chart | null;
|
|
25
|
+
resetZoom: () => void;
|
|
26
|
+
getBounds: () => Bounds | null;
|
|
27
|
+
}
|
|
28
|
+
export declare const VeloPlot: import('react').ForwardRefExoticComponent<VeloPlotProps & import('react').RefAttributes<VeloPlotRef>>;
|
|
29
|
+
export default VeloPlot;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
|
+
import { useVeloPlot as useVeloPlotImpl } from './useVeloPlot';
|
|
1
2
|
/**
|
|
2
3
|
* React bindings for Velo Plot
|
|
3
4
|
*/
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
5
|
+
export { VeloPlot, type VeloPlotProps, type VeloPlotRef, type VeloPlotSeries, } from './VeloPlot';
|
|
6
|
+
export { StackedPlot, type StackedPlotProps, type StackedPlotRef, type StackedPlotIndicator, } from './StackedPlot';
|
|
7
|
+
export { useVeloPlot, type UseVeloPlotOptions, type UseVeloPlotReturn, } from './useVeloPlot';
|
|
8
|
+
export { useStackedPlot, type UseStackedPlotOptions, type UseStackedPlotReturn, } from './useStackedPlot';
|
|
9
|
+
export { useIndicator, type UseIndicatorReturn, } from './useIndicator';
|
|
10
|
+
export { useChartSync, useChartGroup, type UseChartSyncReturn, } from './useChartSync';
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use `VeloPlot` instead. **Removed in v4.0.**
|
|
13
|
+
*/
|
|
14
|
+
export declare const SciPlot: import('react').ForwardRefExoticComponent<import('./VeloPlot').VeloPlotProps & import('react').RefAttributes<import('./VeloPlot').VeloPlotRef>>;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use `VeloPlot` instead. **Removed in v4.0.**
|
|
17
|
+
*/
|
|
18
|
+
export declare const SciChart: import('react').ForwardRefExoticComponent<import('./VeloPlot').VeloPlotProps & import('react').RefAttributes<import('./VeloPlot').VeloPlotRef>>;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use `useVeloPlot` instead. **Removed in v4.0.**
|
|
21
|
+
*/
|
|
22
|
+
export declare const useSciPlot: typeof useVeloPlotImpl;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Use `useVeloPlot` instead. **Removed in v4.0.**
|
|
25
|
+
*/
|
|
26
|
+
export declare const useSciChart: typeof useVeloPlotImpl;
|
|
27
|
+
export type { VeloPlotProps as SciPlotProps, VeloPlotRef as SciPlotRef, VeloPlotSeries as SciPlotSeries, VeloPlotProps as SciChartProps, VeloPlotRef as SciChartRef, VeloPlotSeries as SciChartSeries, } from './VeloPlot';
|
|
28
|
+
export type { UseVeloPlotOptions as UseSciPlotOptions, UseVeloPlotReturn as UseSciPlotReturn, UseVeloPlotOptions as UseSciChartOptions, UseVeloPlotReturn as UseSciChartReturn, } from './useVeloPlot';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChartLike, SyncOptions, ChartGroup } from '../core/sync';
|
|
2
|
+
|
|
3
|
+
export interface UseChartSyncReturn {
|
|
4
|
+
group: ChartGroup | null;
|
|
5
|
+
}
|
|
6
|
+
export declare function useChartSync(charts: ChartLike[], options?: SyncOptions): UseChartSyncReturn;
|
|
7
|
+
/** Alias matching roadmap naming (`useChartGroup` ≡ `useChartSync`). */
|
|
8
|
+
export declare const useChartGroup: typeof useChartSync;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AddIndicatorOptions, AddIndicatorResult } from '../core/indicator/addIndicator';
|
|
2
|
+
import { IndicatorPresetName } from '../core/indicator/indicatorPresets';
|
|
3
|
+
import { IndicatorHost } from '../bindings/shared';
|
|
4
|
+
|
|
5
|
+
export interface UseIndicatorReturn {
|
|
6
|
+
result: (AddIndicatorResult & {
|
|
7
|
+
paneId?: string;
|
|
8
|
+
}) | null;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
error: Error | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function useIndicator(host: IndicatorHost, preset: IndicatorPresetName, options?: AddIndicatorOptions): UseIndicatorReturn;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { Chart } from '../core/Chart';
|
|
3
|
+
import { SeriesOptions, SeriesUpdateData, ZoomOptions, Bounds } from '../types';
|
|
4
|
+
import { ChartBindingOptions } from '../bindings/shared';
|
|
5
|
+
|
|
6
|
+
export interface UseVeloPlotOptions extends ChartBindingOptions {
|
|
7
|
+
}
|
|
8
|
+
export interface UseVeloPlotReturn {
|
|
9
|
+
chart: Chart | null;
|
|
10
|
+
isReady: boolean;
|
|
11
|
+
error: Error | null;
|
|
12
|
+
bounds: Bounds | null;
|
|
13
|
+
addSeries: (options: SeriesOptions) => void;
|
|
14
|
+
updateSeries: (id: string, data: SeriesUpdateData) => void;
|
|
15
|
+
removeSeries: (id: string) => void;
|
|
16
|
+
zoom: (options: ZoomOptions) => void;
|
|
17
|
+
resetZoom: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function useVeloPlot(containerRef: RefObject<HTMLDivElement>, options?: UseVeloPlotOptions): UseVeloPlotReturn;
|