velo-plot 1.11.1 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +35 -2
  2. package/dist/{index.core-CYu3tydL.js → ChartCore-BimVvUEg.js} +1936 -1588
  3. package/dist/ChartCore-BimVvUEg.js.map +1 -0
  4. package/dist/axisFormat-B7o_uIEA.js +127 -0
  5. package/dist/axisFormat-B7o_uIEA.js.map +1 -0
  6. package/dist/core/OverlayRenderer.d.ts +1 -2
  7. package/dist/core/chart/ChartCore.d.ts +18 -1
  8. package/dist/core/chart/ChartRenderLoop.d.ts +4 -0
  9. package/dist/core/chart/ChartScaling.d.ts +11 -0
  10. package/dist/core/chart/NavigationUtils.d.ts +12 -0
  11. package/dist/core/chart/exporter/SVGExporter.d.ts +7 -2
  12. package/dist/core/chart/types.d.ts +13 -1
  13. package/dist/core/format/axisFormat.d.ts +16 -0
  14. package/dist/core/indicator/buildIndicatorPane.d.ts +22 -0
  15. package/dist/core/indicator/buildIndicatorSeries.d.ts +14 -0
  16. package/dist/core/indicator/index.d.ts +3 -0
  17. package/dist/core/indicator/types.d.ts +74 -0
  18. package/dist/core/render/pixelSnap.d.ts +8 -0
  19. package/dist/core/series/SeriesBounds.d.ts +1 -1
  20. package/dist/core/stacked/createStackedChart.d.ts +3 -0
  21. package/dist/core/stacked/index.d.ts +6 -0
  22. package/dist/core/stacked/paneAxis.d.ts +20 -0
  23. package/dist/core/stacked/paneResize.d.ts +29 -0
  24. package/dist/core/stacked/stackExport.d.ts +18 -0
  25. package/dist/core/stacked/types.d.ts +120 -0
  26. package/dist/core/sync/index.d.ts +25 -70
  27. package/dist/createStackedChart-CjsKcOvX.js +1088 -0
  28. package/dist/createStackedChart-CjsKcOvX.js.map +1 -0
  29. package/dist/index-CUGS98p4.js +277 -0
  30. package/dist/index-CUGS98p4.js.map +1 -0
  31. package/dist/index-ChgIdk3N.js +229 -0
  32. package/dist/index-ChgIdk3N.js.map +1 -0
  33. package/dist/{index-D8ifudJH.js → index-DjeWClO9.js} +601 -561
  34. package/dist/index-DjeWClO9.js.map +1 -0
  35. package/dist/index.core-C_-CFftD.js +167 -0
  36. package/dist/index.core-C_-CFftD.js.map +1 -0
  37. package/dist/index.d.ts +2 -0
  38. package/dist/math-Ddm2EZjj.js +85 -0
  39. package/dist/math-Ddm2EZjj.js.map +1 -0
  40. package/dist/plugins/analysis.js +132 -130
  41. package/dist/plugins/analysis.js.map +1 -1
  42. package/dist/plugins/anomaly-detection.d.ts +1 -0
  43. package/dist/plugins/anomaly-detection.js +221 -0
  44. package/dist/plugins/anomaly-detection.js.map +1 -0
  45. package/dist/plugins/broken-axis.d.ts +3 -0
  46. package/dist/plugins/broken-axis.js +262 -0
  47. package/dist/plugins/broken-axis.js.map +1 -0
  48. package/dist/plugins/caching.d.ts +3 -0
  49. package/dist/plugins/caching.js +182 -0
  50. package/dist/plugins/caching.js.map +1 -0
  51. package/dist/plugins/data-transform.d.ts +3 -0
  52. package/dist/plugins/data-transform.js +146 -0
  53. package/dist/plugins/data-transform.js.map +1 -0
  54. package/dist/plugins/debug.js +12 -11
  55. package/dist/plugins/debug.js.map +1 -1
  56. package/dist/plugins/forecasting.d.ts +1 -0
  57. package/dist/plugins/forecasting.js +236 -0
  58. package/dist/plugins/forecasting.js.map +1 -0
  59. package/dist/plugins/latex.d.ts +1 -0
  60. package/dist/plugins/latex.js +454 -0
  61. package/dist/plugins/latex.js.map +1 -0
  62. package/dist/plugins/lazy-load.d.ts +3 -0
  63. package/dist/plugins/lazy-load.js +189 -0
  64. package/dist/plugins/lazy-load.js.map +1 -0
  65. package/dist/plugins/ml-integration.d.ts +3 -0
  66. package/dist/plugins/ml-integration.js +355 -0
  67. package/dist/plugins/ml-integration.js.map +1 -0
  68. package/dist/plugins/offscreen.d.ts +3 -0
  69. package/dist/plugins/offscreen.js +169 -0
  70. package/dist/plugins/offscreen.js.map +1 -0
  71. package/dist/plugins/pattern-recognition.d.ts +3 -0
  72. package/dist/plugins/pattern-recognition.js +690 -0
  73. package/dist/plugins/pattern-recognition.js.map +1 -0
  74. package/dist/plugins/radar.d.ts +3 -0
  75. package/dist/plugins/radar.js +103 -0
  76. package/dist/plugins/radar.js.map +1 -0
  77. package/dist/plugins/regression.d.ts +3 -0
  78. package/dist/plugins/regression.js +634 -0
  79. package/dist/plugins/regression.js.map +1 -0
  80. package/dist/plugins/roi.d.ts +1 -0
  81. package/dist/plugins/roi.js +223 -0
  82. package/dist/plugins/roi.js.map +1 -0
  83. package/dist/plugins/snapshot/types.d.ts +1 -1
  84. package/dist/plugins/snapshot.d.ts +3 -0
  85. package/dist/plugins/snapshot.js +90 -0
  86. package/dist/plugins/snapshot.js.map +1 -0
  87. package/dist/plugins/sync/index.d.ts +2 -1
  88. package/dist/plugins/sync.js +12 -244
  89. package/dist/plugins/sync.js.map +1 -1
  90. package/dist/plugins/tools/tooltip/TooltipManager.d.ts +9 -1
  91. package/dist/plugins/tools/tooltip/format.d.ts +7 -0
  92. package/dist/plugins/tools/tooltip/types.d.ts +6 -8
  93. package/dist/plugins/tools.js +1 -1
  94. package/dist/plugins/video-recorder.d.ts +3 -0
  95. package/dist/plugins/video-recorder.js +104 -0
  96. package/dist/plugins/video-recorder.js.map +1 -0
  97. package/dist/plugins/virtualization.d.ts +3 -0
  98. package/dist/plugins/virtualization.js +6 -0
  99. package/dist/plugins/virtualization.js.map +1 -0
  100. package/dist/react/index.d.ts +2 -1
  101. package/dist/react/useStackedPlot.d.ts +17 -0
  102. package/dist/react.d.ts +1 -0
  103. package/dist/react.js +31 -0
  104. package/dist/react.js.map +1 -0
  105. package/dist/types.d.ts +21 -1
  106. package/dist/utils-BK5UUXxj.js +172 -0
  107. package/dist/utils-BK5UUXxj.js.map +1 -0
  108. package/dist/velo-plot.full.js +1000 -5576
  109. package/dist/velo-plot.full.js.map +1 -1
  110. package/dist/velo-plot.js +23 -22
  111. package/dist/velo-plot.js.map +1 -1
  112. package/package.json +17 -3
  113. package/dist/EventEmitter-DAbs2K1C.js +0 -60
  114. package/dist/EventEmitter-DAbs2K1C.js.map +0 -1
  115. package/dist/index-D8ifudJH.js.map +0 -1
  116. package/dist/index.core-CYu3tydL.js.map +0 -1
  117. package/dist/utils-Dbro9-qM.js +0 -254
  118. package/dist/utils-Dbro9-qM.js.map +0 -1
@@ -0,0 +1,167 @@
1
+ var l = Object.defineProperty;
2
+ var g = (i, e, r) => e in i ? l(i, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[e] = r;
3
+ var u = (i, e, r) => g(i, typeof e != "symbol" ? e + "" : e, r);
4
+ import { N as f } from "./ChartCore-BimVvUEg.js";
5
+ import "./axisFormat-B7o_uIEA.js";
6
+ import "./index-x4stH3jD.js";
7
+ function b(i) {
8
+ return new f(i);
9
+ }
10
+ class d {
11
+ constructor() {
12
+ u(this, "entries", /* @__PURE__ */ new Map());
13
+ }
14
+ /**
15
+ * Register a plugin globally
16
+ */
17
+ register(e) {
18
+ const r = e.manifest.name;
19
+ this.entries.has(r) && console.warn(
20
+ `[SciPlot Registry] Plugin "${r}" is already registered, overwriting`
21
+ ), this.entries.set(r, e);
22
+ }
23
+ /**
24
+ * Unregister a plugin
25
+ */
26
+ unregister(e) {
27
+ const r = this.entries.has(e);
28
+ return this.entries.delete(e), r;
29
+ }
30
+ /**
31
+ * Get a registered plugin factory by name
32
+ */
33
+ get(e) {
34
+ var r;
35
+ return (r = this.entries.get(e)) == null ? void 0 : r.factory;
36
+ }
37
+ /**
38
+ * List all registered plugins
39
+ */
40
+ list() {
41
+ return Array.from(this.entries.values()).map((e) => e.manifest);
42
+ }
43
+ /**
44
+ * Search plugins by capability
45
+ */
46
+ findByCapability(e) {
47
+ const r = [];
48
+ return this.entries.forEach((n) => {
49
+ var s;
50
+ (s = n.manifest.provides) != null && s.includes(e) && r.push(n.manifest);
51
+ }), r;
52
+ }
53
+ /**
54
+ * Search plugins by tag
55
+ */
56
+ findByTag(e) {
57
+ const r = [], n = e.toLowerCase();
58
+ return this.entries.forEach((s) => {
59
+ var o;
60
+ (o = s.manifest.tags) != null && o.some((c) => c.toLowerCase().includes(n)) && r.push(s.manifest);
61
+ }), r;
62
+ }
63
+ /**
64
+ * Check if a plugin is registered
65
+ */
66
+ has(e) {
67
+ return this.entries.has(e);
68
+ }
69
+ /**
70
+ * Get plugin count
71
+ */
72
+ get size() {
73
+ return this.entries.size;
74
+ }
75
+ /**
76
+ * Clear all registrations
77
+ */
78
+ clear() {
79
+ this.entries.clear();
80
+ }
81
+ }
82
+ let t = null;
83
+ function a() {
84
+ return t || (t = new d()), t;
85
+ }
86
+ function p(i) {
87
+ a().register(i);
88
+ }
89
+ function h(i, e) {
90
+ return (r) => ({
91
+ ...e(r),
92
+ manifest: i
93
+ });
94
+ }
95
+ function w(i, e) {
96
+ const r = h(i, e);
97
+ return p({ manifest: i, factory: r }), r;
98
+ }
99
+ async function $(i, e) {
100
+ const r = a().get(i);
101
+ if (!r) {
102
+ console.warn(`[SciPlot] Plugin "${i}" not found in registry`);
103
+ return;
104
+ }
105
+ return r(e);
106
+ }
107
+ function C() {
108
+ const i = a(), e = [
109
+ "analysis",
110
+ "visualization",
111
+ "interaction",
112
+ "data-source",
113
+ "export",
114
+ "ui",
115
+ "annotation",
116
+ "theme"
117
+ ], r = {};
118
+ return e.forEach((n) => {
119
+ r[n] = i.findByCapability(n);
120
+ }), r;
121
+ }
122
+ function z(i) {
123
+ const e = [];
124
+ return i.name ? /^[@a-z0-9-]+\/[a-z0-9-]+$|^[a-z0-9-]+$/.test(i.name) || e.push(
125
+ 'Invalid name format. Use lowercase with hyphens, optionally scoped (e.g., "@org/name")'
126
+ ) : e.push("Missing required field: name"), i.version ? /^\d+\.\d+\.\d+$/.test(i.version) || e.push("Invalid version format. Use semantic versioning (e.g., 1.0.0)") : e.push("Missing required field: version"), i.dependencies && (Array.isArray(i.dependencies) || e.push("dependencies must be an array")), i.provides && (Array.isArray(i.provides) || e.push("provides must be an array")), e;
127
+ }
128
+ function A(i, e) {
129
+ const r = [];
130
+ if (i.engineVersion) {
131
+ const [n] = i.engineVersion.split(".").map(Number), [s] = e.split(".").map(Number);
132
+ if (n > s)
133
+ return {
134
+ compatible: !1,
135
+ warnings: [
136
+ `Plugin requires engine v${i.engineVersion}, current is v${e}`
137
+ ]
138
+ };
139
+ n < s && r.push(
140
+ `Plugin was built for engine v${i.engineVersion}, may have compatibility issues`
141
+ );
142
+ }
143
+ return { compatible: !0, warnings: r };
144
+ }
145
+ function M(i) {
146
+ return i;
147
+ }
148
+ function R(i, e) {
149
+ return (r) => ({
150
+ ...e(r),
151
+ manifest: i
152
+ });
153
+ }
154
+ export {
155
+ w as a,
156
+ C as b,
157
+ b as c,
158
+ h as d,
159
+ A as e,
160
+ M as f,
161
+ a as g,
162
+ R as h,
163
+ $ as l,
164
+ p as r,
165
+ z as v
166
+ };
167
+ //# sourceMappingURL=index.core-C_-CFftD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.core-C_-CFftD.js","sources":["../src/renderer/RendererInterface.ts","../src/plugins/PluginRegistry.ts","../src/plugins/index.ts"],"sourcesContent":["/**\n * WebGL Renderer Interface & Factory\n *\n * This module provides a common interface for WebGL rendering.\n * Currently optimized for NativeWebGLRenderer (zero dependencies).\n */\n\nimport type { Bounds } from '../types';\nimport { NativeWebGLRenderer } from './NativeWebGLRenderer';\n\n// ============================================\n// Common Types\n// ============================================\n\nexport interface SeriesRenderData {\n id: string;\n buffer: WebGLBuffer;\n count: number;\n style: any;\n visible: boolean;\n type: string;\n zBounds?: { min: number; max: number };\n colormapTexture?: WebGLTexture;\n}\n\nexport interface RenderOptions {\n bounds: Bounds;\n backgroundColor?: [number, number, number, number];\n}\n\n// ============================================\n// Renderer Interface\n// ============================================\n\n/**\n * Common interface for all WebGL renderer implementations\n */\nexport interface IWebGLRenderer {\n /** Check if WebGL is available and initialized */\n readonly available: boolean;\n\n /**\n * Create or update a GPU buffer with interleaved X,Y data\n * @param id - Unique buffer identifier\n * @param data - Interleaved Float32Array [x0, y0, x1, y1, ...]\n */\n createBuffer(id: string, data: Float32Array): void;\n\n /**\n * Get a buffer by ID\n */\n getBuffer(id: string): WebGLBuffer | undefined;\n\n /**\n * Delete a buffer and free GPU memory\n */\n deleteBuffer(id: string): void;\n \n /** \n * Create a 1D texture for heatmaps \n */\n createColormapTexture(id: string, data: Uint8Array): WebGLTexture;\n\n /**\n * Render a frame with all visible series\n */\n render(series: SeriesRenderData[], options: RenderOptions): void;\n\n /**\n * Handle canvas resize\n */\n resize(): void;\n\n /**\n * Get WebGL capabilities/limits\n */\n getLimits(): Record<string, unknown>;\n\n /**\n * Cleanup and destroy all GPU resources\n */\n destroy(): void;\n}\n\n// ============================================\n// Factory Functions\n// ============================================\n\n/**\n * Create a WebGL renderer (Native WebGL)\n *\n * @param canvas - Target canvas element\n */\nexport function createRenderer(canvas: HTMLCanvasElement): IWebGLRenderer {\n return new NativeWebGLRenderer(canvas);\n}\n\n/**\n * Create a renderer synchronously (native only)\n */\nexport { NativeWebGLRenderer as createNativeRenderer } from './NativeWebGLRenderer';\n","/**\n * Sci Plot - Global Plugin Registry\n * \n * Provides a global registry for third-party plugins that can be\n * discovered and loaded by name without explicit imports.\n * \n * @module plugins/PluginRegistry\n */\n\nimport type {\n PluginFactory,\n PluginManifest,\n PluginCapability,\n PluginRegistry,\n PluginRegistryEntry,\n} from \"./types\";\n\n// ============================================\n// Global Registry Implementation\n// ============================================\n\nclass PluginRegistryImpl implements PluginRegistry {\n private entries = new Map<string, PluginRegistryEntry>();\n\n /**\n * Register a plugin globally\n */\n register(entry: PluginRegistryEntry): void {\n const name = entry.manifest.name;\n\n if (this.entries.has(name)) {\n console.warn(\n `[SciPlot Registry] Plugin \"${name}\" is already registered, overwriting`\n );\n }\n\n this.entries.set(name, entry);\n }\n\n /**\n * Unregister a plugin\n */\n unregister(name: string): boolean {\n const existed = this.entries.has(name);\n this.entries.delete(name);\n return existed;\n }\n\n /**\n * Get a registered plugin factory by name\n */\n get(name: string): PluginFactory | undefined {\n return this.entries.get(name)?.factory;\n }\n\n /**\n * List all registered plugins\n */\n list(): PluginManifest[] {\n return Array.from(this.entries.values()).map((e) => e.manifest);\n }\n\n /**\n * Search plugins by capability\n */\n findByCapability(capability: PluginCapability): PluginManifest[] {\n const results: PluginManifest[] = [];\n\n this.entries.forEach((entry) => {\n if (entry.manifest.provides?.includes(capability)) {\n results.push(entry.manifest);\n }\n });\n\n return results;\n }\n\n /**\n * Search plugins by tag\n */\n findByTag(tag: string): PluginManifest[] {\n const results: PluginManifest[] = [];\n const lowerTag = tag.toLowerCase();\n\n this.entries.forEach((entry) => {\n if (entry.manifest.tags?.some((t) => t.toLowerCase().includes(lowerTag))) {\n results.push(entry.manifest);\n }\n });\n\n return results;\n }\n\n /**\n * Check if a plugin is registered\n */\n has(name: string): boolean {\n return this.entries.has(name);\n }\n\n /**\n * Get plugin count\n */\n get size(): number {\n return this.entries.size;\n }\n\n /**\n * Clear all registrations\n */\n clear(): void {\n this.entries.clear();\n }\n}\n\n// ============================================\n// Singleton Instance\n// ============================================\n\nlet registryInstance: PluginRegistryImpl | null = null;\n\n/**\n * Get the global plugin registry singleton\n */\nexport function getPluginRegistry(): PluginRegistry {\n if (!registryInstance) {\n registryInstance = new PluginRegistryImpl();\n }\n return registryInstance;\n}\n\n/**\n * Register a plugin in the global registry\n * Shorthand for getPluginRegistry().register()\n */\nexport function registerPlugin(entry: PluginRegistryEntry): void {\n getPluginRegistry().register(entry);\n}\n\n/**\n * Create a plugin factory with manifest validation\n */\nexport function definePlugin<TConfig = unknown>(\n manifest: PluginManifest,\n factory: (config?: TConfig) => Omit<import(\"./types\").ChartPlugin<TConfig>, \"manifest\">\n): PluginFactory<TConfig> {\n return (config?: TConfig) => {\n const plugin = factory(config);\n return {\n ...plugin,\n manifest,\n };\n };\n}\n\n/**\n * Register a plugin from definition\n */\nexport function defineAndRegister<TConfig = unknown>(\n manifest: PluginManifest,\n factory: (config?: TConfig) => Omit<import(\"./types\").ChartPlugin<TConfig>, \"manifest\">\n): PluginFactory<TConfig> {\n const pluginFactory = definePlugin(manifest, factory);\n registerPlugin({ manifest, factory: pluginFactory as PluginFactory });\n return pluginFactory;\n}\n\n// ============================================\n// Plugin Discovery Helpers\n// ============================================\n\n/**\n * Load a plugin from the registry by name\n */\nexport async function loadPlugin<TConfig = unknown>(\n name: string,\n config?: TConfig\n): Promise<import(\"./types\").ChartPlugin<TConfig> | undefined> {\n const factory = getPluginRegistry().get(name);\n if (!factory) {\n console.warn(`[SciPlot] Plugin \"${name}\" not found in registry`);\n return undefined;\n }\n return factory(config) as import(\"./types\").ChartPlugin<TConfig>;\n}\n\n/**\n * List available plugins by category\n */\nexport function listPluginsByCategory(): Record<PluginCapability, PluginManifest[]> {\n const registry = getPluginRegistry();\n const categories: PluginCapability[] = [\n \"analysis\",\n \"visualization\",\n \"interaction\",\n \"data-source\",\n \"export\",\n \"ui\",\n \"annotation\",\n \"theme\",\n ];\n\n const result: Record<string, PluginManifest[]> = {};\n categories.forEach((cat) => {\n result[cat] = registry.findByCapability(cat);\n });\n\n return result as Record<PluginCapability, PluginManifest[]>;\n}\n\n// ============================================\n// Plugin Validation\n// ============================================\n\n/**\n * Validate a plugin manifest\n */\nexport function validateManifest(manifest: PluginManifest): string[] {\n const errors: string[] = [];\n\n if (!manifest.name) {\n errors.push(\"Missing required field: name\");\n } else if (!/^[@a-z0-9-]+\\/[a-z0-9-]+$|^[a-z0-9-]+$/.test(manifest.name)) {\n errors.push(\n 'Invalid name format. Use lowercase with hyphens, optionally scoped (e.g., \"@org/name\")'\n );\n }\n\n if (!manifest.version) {\n errors.push(\"Missing required field: version\");\n } else if (!/^\\d+\\.\\d+\\.\\d+$/.test(manifest.version)) {\n errors.push(\"Invalid version format. Use semantic versioning (e.g., 1.0.0)\");\n }\n\n if (manifest.dependencies) {\n if (!Array.isArray(manifest.dependencies)) {\n errors.push(\"dependencies must be an array\");\n }\n }\n\n if (manifest.provides) {\n if (!Array.isArray(manifest.provides)) {\n errors.push(\"provides must be an array\");\n }\n }\n\n return errors;\n}\n\n/**\n * Validate a plugin for compatibility\n */\nexport function checkPluginCompatibility(\n manifest: PluginManifest,\n engineVersion: string\n): { compatible: boolean; warnings: string[] } {\n const warnings: string[] = [];\n\n if (manifest.engineVersion) {\n const [reqMajor] = manifest.engineVersion.split(\".\").map(Number);\n const [curMajor] = engineVersion.split(\".\").map(Number);\n\n if (reqMajor > curMajor) {\n return {\n compatible: false,\n warnings: [\n `Plugin requires engine v${manifest.engineVersion}, current is v${engineVersion}`,\n ],\n };\n }\n\n if (reqMajor < curMajor) {\n warnings.push(\n `Plugin was built for engine v${manifest.engineVersion}, may have compatibility issues`\n );\n }\n }\n\n return { compatible: true, warnings };\n}\n","/**\n * Sci Plot - Plugin System\n * \n * Comprehensive plugin architecture for extending chart functionality.\n * \n * Features:\n * - Complete lifecycle hooks (init, render, data, view, interaction, destroy)\n * - Rich plugin context with access to all chart internals\n * - Plugin storage for persistent state\n * - Dependency management between plugins\n * - Global registry for third-party plugins\n * - Built-in plugins for common use cases\n * \n * @packageDocumentation\n * @module plugins\n */\n\n// ============================================\n// Core Types\n// ============================================\nexport type {\n // Manifest & Metadata\n PluginVersion,\n PluginCapability,\n PluginManifest,\n\n // Context Types\n PluginContext,\n RenderContext,\n CoordinateContext,\n DataContext,\n UIContext,\n EventContext,\n PluginStorage,\n PluginLogger,\n OverlayOptions,\n NotificationOptions,\n PickResult,\n\n // Hook Event Types\n BeforeRenderEvent,\n AfterRenderEvent,\n InteractionEvent,\n ViewChangeEvent,\n SeriesChangeEvent,\n DataUpdateEvent,\n\n // Plugin Types\n ChartPlugin,\n PluginFactory,\n TypedPlugin,\n\n // Manager Types\n PluginManager,\n PluginRegistry,\n PluginRegistryEntry,\n} from \"./types\";\n\n// ============================================\n// Core Implementation\n// ============================================\nexport { createPluginContext } from \"./PluginContext\";\nexport type { ContextDependencies } from \"./PluginContext\";\n\nexport { PluginManagerImpl } from \"./PluginManager\";\n\n// ============================================\n// Registry\n// ============================================\nexport {\n getPluginRegistry,\n registerPlugin,\n definePlugin,\n defineAndRegister,\n loadPlugin,\n listPluginsByCategory,\n validateManifest,\n checkPluginCompatibility,\n} from \"./PluginRegistry\";\n\n// ============================================\n// Built-in Plugins\n// ============================================\nexport {\n // Individual plugins\n CrosshairPlugin,\n StatsPlugin,\n WatermarkPlugin,\n GridHighlightPlugin,\n DataLoggerPlugin,\n DirectionIndicatorPlugin,\n\n // Plugin collection\n BuiltinPlugins,\n\n // Plugin configs\n type CrosshairPluginConfig,\n type StatsPluginConfig,\n type WatermarkPluginConfig,\n type GridHighlightConfig,\n type DataLoggerConfig,\n type DirectionIndicatorConfig,\n} from \"./builtins\";\n\n// ============================================\n// Modular Plugins\n// ============================================\nexport { Plugin3D, type Plugin3DConfig } from \"./3d\";\nexport { PluginGpu, type PluginGpuConfig } from \"./gpu\";\nexport { PluginAnalysis, type PluginAnalysisConfig } from \"./analysis\";\nexport { PluginTools, type PluginToolsConfig } from \"./tools\";\nexport { PluginAnnotations, type PluginAnnotationsConfig } from \"./annotations\";\nexport { PluginStreaming, type PluginStreamingConfig } from \"./streaming\";\nexport { PluginThemeEditor, type PluginThemeEditorConfig } from \"./theme-editor\";\nexport { PluginI18n, type PluginI18nConfig } from \"./i18n\";\nexport { PluginKeyboard, type PluginKeyboardConfig } from \"./keyboard\";\nexport { PluginClipboard, type PluginClipboardConfig } from \"./clipboard\";\nexport { PluginSync, type PluginSyncConfig } from \"./sync\";\nexport { PluginDebug, type PluginDebugConfig } from \"./debug\";\nexport { PluginLoading, type PluginLoadingConfig } from \"./loading\";\nexport { PluginDataExport, type PluginDataExportConfig } from \"./data-export\";\nexport { PluginContextMenu, type PluginContextMenuConfig } from \"./context-menu\";\nexport { PluginAnomalyDetection, type PluginAnomalyDetectionConfig, type AnomalyDetectionResult, type AnomalyPoint, type AnomalyMethod } from \"./anomaly-detection\";\nexport { PluginMLIntegration, type PluginMLIntegrationConfig, type MLIntegrationAPI, type MLModelAPI, type PredictionResult, type VisualizationConfig } from \"./ml-integration\";\nexport { PluginPatternRecognition, type PluginPatternRecognitionConfig, type PatternRecognitionAPI, type PatternMatch, type PatternDetectionResult } from \"./pattern-recognition\";\nexport { PluginRegression, type PluginRegressionConfig, type RegressionAPI, type RegressionResult, type RegressionData } from \"./regression\";\nexport { PluginRadar, type PluginRadarConfig, type RadarAPI, type RadarSeriesData, type RadarPoint } from \"./radar\";\nexport { PluginSnapshot, type PluginSnapshotConfig, type SnapshotExportAPI, type SnapshotExportOptions, type SnapshotResolution, type SnapshotFormat } from \"./snapshot\";\nexport { PluginDataTransform, type PluginDataTransformConfig, type DataTransformAPI, type TransformOp, type TransformType } from \"./data-transform\";\nexport { PluginLaTeX, type PluginLaTeXConfig, type LaTeXPluginAPI, type LaTeXDimensions } from \"./latex\";\nexport * from \"./forecasting\";\n\n// Drag & Drop Editing\nexport { PluginDragEdit, type PluginDragEditConfig, type DragEditAPI, type DragEditEvent } from \"./drag-edit\";\n\n// Caching\nexport { PluginCaching, type PluginCachingConfig, type CachingAPI, type CacheStats } from \"./caching\";\n\n// Lazy Loading\nexport { PluginLazyLoad, type PluginLazyLoadConfig, type LazyLoadAPI, type DataProvider } from \"./lazy-load\";\n\n// Broken Axis\nexport { PluginBrokenAxis, type PluginBrokenAxisConfig, type BrokenAxisAPI, type AxisBreak } from \"./broken-axis\";\n\n// Video Recorder\nexport { PluginVideoRecorder, type PluginVideoRecorderConfig, type VideoRecorderAPI, type VideoRecorderOptions } from \"./video-recorder\";\n\n// Offscreen Rendering\nexport { PluginOffscreen, type PluginOffscreenConfig, type OffscreenAPI, type OffscreenStats, type OffscreenMode, type OffscreenTransferMode, type OffscreenFallbackMode } from \"./offscreen\";\n\n// Virtualization\nexport { PluginVirtualization, type PluginVirtualizationConfig, type VirtualizationAPI, type VirtualizationStats, type VirtualizationMode, type VirtualizationStrategy } from \"./virtualization\";\n\n// ROI\nexport { PluginROI, type PluginROIConfig, type RoiAPI, type RoiRegion, type RoiPoint, type RoiMaskResult, type RoiTool, type RoiEvent, type RoiSelectedEvent } from \"./roi\";\n\n// ============================================\n// Helper for creating typed plugins\n// ============================================\n\n/**\n * Helper function to create a plugin with proper typing\n * \n * @example\n * ```typescript\n * const MyPlugin = createPlugin({\n * manifest: {\n * name: 'my-plugin',\n * version: '1.0.0',\n * provides: ['analysis'],\n * },\n * onInit(ctx) {\n * ctx.log.info('Plugin initialized!');\n * },\n * onAfterRender(ctx, event) {\n * // Custom rendering\n * },\n * api: {\n * doSomething() { return 'done'; }\n * }\n * });\n * \n * chart.use(MyPlugin);\n * ```\n */\nexport function createPlugin<TConfig = void, TApi extends Record<string, unknown> = {}>(\n definition: import(\"./types\").ChartPlugin<TConfig> & { api?: TApi }\n): import(\"./types\").ChartPlugin<TConfig> & { api: TApi } {\n return definition as import(\"./types\").ChartPlugin<TConfig> & { api: TApi };\n}\n\n/**\n * Helper function to create a configurable plugin factory\n * \n * @example\n * ```typescript\n * interface MyConfig {\n * color: string;\n * enabled: boolean;\n * }\n * \n * const MyPlugin = createConfigurablePlugin<MyConfig>(\n * {\n * name: 'my-plugin',\n * version: '1.0.0',\n * },\n * (config) => ({\n * onInit(ctx) {\n * ctx.log.info(`Color: ${config?.color}`);\n * }\n * })\n * );\n * \n * chart.use(MyPlugin({ color: 'red', enabled: true }));\n * ```\n */\nexport function createConfigurablePlugin<TConfig = void>(\n manifest: import(\"./types\").PluginManifest,\n factory: (config?: TConfig) => Omit<import(\"./types\").ChartPlugin<TConfig>, \"manifest\">\n): import(\"./types\").PluginFactory<TConfig> {\n return (config?: TConfig) => ({\n ...factory(config),\n manifest,\n });\n}\n"],"names":["createRenderer","canvas","NativeWebGLRenderer","PluginRegistryImpl","__publicField","entry","name","existed","_a","capability","results","tag","lowerTag","t","registryInstance","getPluginRegistry","registerPlugin","definePlugin","manifest","factory","config","defineAndRegister","pluginFactory","loadPlugin","listPluginsByCategory","registry","categories","result","cat","validateManifest","errors","checkPluginCompatib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AAER;"}
package/dist/index.d.ts CHANGED
@@ -44,6 +44,8 @@ export { DebugOverlay, createDebugOverlay, enableDebugMode, type DebugStats, typ
44
44
  export { LoadingIndicator, createLoadingIndicator, showLoading, showProgress, type LoadingIndicatorType, type LoadingIndicatorOptions, type LoadingState, } from './core/loading';
45
45
  export { generateSineWave, generateSquareWave, generateSawtoothWave, generateTriangleWave, generateRandomData, generateCVData, generateNyquistData, benchmarkRender, assertPerformance, createSnapshot, compareSnapshots, waitForFrames, waitFor, type MockChartOptions, type WaveformOptions, type RandomDataOptions, type BenchmarkResult as TestBenchmarkResult, type BenchmarkOptions as TestBenchmarkOptions, type SnapshotOptions, type ChartSnapshot, } from './testing';
46
46
  export { ChartGroup, createChartGroup, linkCharts, createMasterSlave, type SyncAxis, type SyncOptions, type ChartLike, type SyncEvent, } from './core/sync';
47
+ export { createStackedChart, STACKED_MAX_PANES, STACKED_DEFAULT_MIN_PANE_RATIO, type StackedChart, type StackedChartOptions, type StackedPaneConfig, type StackedSyncOptions, } from './core/stacked';
48
+ export { buildIndicatorSeries, createIndicatorSeries, buildIndicatorPane, detectIndicatorMarkers, type IndicatorData, type IndicatorSeriesOptions, type IndicatorStyle, type IndicatorLineLayer, type IndicatorLineColorZones, type BuildIndicatorPaneOptions, } from './core/indicator';
47
49
  export { ThemeEditor, createThemeEditor, getPresetTheme, getPresetNames, THEME_PRESETS, type EditorTheme, type ThemeEditorOptions, type ThemePreset, type ColorGroup, type ColorProperty, } from './core/theme-editor';
48
50
  export { BackpressureManager, CircularBuffer, createBackpressureManager, createRealtimeBackpressure, createLosslessBackpressure, type OverflowStrategy, type BackpressureConfig, type PressureStats, type BufferHealth, } from './streaming/backpressure';
49
51
  export { sma, ema, wma, dema, tema, rsi, macd, stochastic, roc, momentum, bollingerBands, atr, standardDeviation, vwap, obv, adx, aroon, percentChange, cumsum, normalize, type IndicatorResult, type OHLCData, } from './plugins/analysis';
@@ -0,0 +1,85 @@
1
+ function d(a, i) {
2
+ const e = i.length, n = a.map((t, c) => [...t, i[c]]);
3
+ for (let t = 0; t < e; t++) {
4
+ let c = t;
5
+ for (let s = t + 1; s < e; s++)
6
+ Math.abs(n[s][t]) > Math.abs(n[c][t]) && (c = s);
7
+ const l = n[t];
8
+ n[t] = n[c], n[c] = l;
9
+ const o = n[t][t];
10
+ if (Math.abs(o) < 1e-12)
11
+ throw new Error("Matrix is singular or near-singular");
12
+ for (let s = t + 1; s < e; s++) {
13
+ const f = n[s][t] / o;
14
+ for (let u = t; u <= e; u++)
15
+ n[s][u] -= f * n[t][u];
16
+ }
17
+ }
18
+ const r = new Array(e).fill(0);
19
+ for (let t = e - 1; t >= 0; t--) {
20
+ let c = 0;
21
+ for (let l = t + 1; l < e; l++)
22
+ c += n[t][l] * r[l];
23
+ r[t] = (n[t][e] - c) / n[t][t];
24
+ }
25
+ return r;
26
+ }
27
+ function w(a, i, e) {
28
+ const n = a.length;
29
+ if (n === 0) return 0;
30
+ let r = 0;
31
+ for (let o = 0; o < n; o++) r += i[o];
32
+ const t = r / n;
33
+ let c = 0, l = 0;
34
+ for (let o = 0; o < n; o++) {
35
+ const s = i[o], f = e(a[o]);
36
+ c += (s - t) * (s - t), l += (s - f) * (s - f);
37
+ }
38
+ return c === 0 ? 1 : 1 - l / c;
39
+ }
40
+ function v(a, i, e, n) {
41
+ const r = a.length;
42
+ if (r < 2) return 0;
43
+ let t = 0;
44
+ const c = e !== void 0 ? e : a[0], l = n !== void 0 ? n : a[r - 1];
45
+ for (let o = 0; o < r - 1; o++) {
46
+ const s = a[o], f = a[o + 1];
47
+ if (f < c) continue;
48
+ if (s > l) break;
49
+ const u = Math.max(s, c), h = Math.min(f, l);
50
+ if (u < h) {
51
+ const m = i[o] + (i[o + 1] - i[o]) * ((u - s) / (f - s)), g = i[o] + (i[o + 1] - i[o]) * ((h - s) / (f - s));
52
+ t += (h - u) * (m + g) / 2;
53
+ }
54
+ }
55
+ return t;
56
+ }
57
+ function b(a, i) {
58
+ const e = a.length;
59
+ if (e < 2) return new Float32Array(0);
60
+ const n = new Float32Array(e);
61
+ for (let r = 0; r < e - 1; r++) {
62
+ const t = a[r + 1] - a[r];
63
+ n[r] = t !== 0 ? (i[r + 1] - i[r]) / t : 0;
64
+ }
65
+ return n[e - 1] = n[e - 2], n;
66
+ }
67
+ function A(a, i) {
68
+ const e = a.length;
69
+ if (e < 1) return new Float32Array(0);
70
+ const n = new Float32Array(e);
71
+ n[0] = 0;
72
+ for (let r = 0; r < e - 1; r++) {
73
+ const c = (a[r + 1] - a[r]) * (i[r] + i[r + 1]) / 2;
74
+ n[r + 1] = n[r] + c;
75
+ }
76
+ return n;
77
+ }
78
+ export {
79
+ w as a,
80
+ A as c,
81
+ b as d,
82
+ v as i,
83
+ d as s
84
+ };
85
+ //# sourceMappingURL=math-Ddm2EZjj.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math-Ddm2EZjj.js","sources":["../src/plugins/analysis/math.ts"],"sourcesContent":["/**\n * Mathematical utilities for numerical analysis and regression.\n */\n\n/**\n * Solve a system of linear equations Ax = B using Gaussian elimination with partial pivoting.\n * \n * @param A - Matrix coefficients\n * @param B - Right hand side vector\n * @returns Solution vector x\n */\nexport function solveLinearSystem(A: number[][], B: number[]): number[] {\n const n = B.length;\n const matrix = A.map((row, i) => [...row, B[i]]);\n\n for (let i = 0; i < n; i++) {\n // Partial pivoting\n let maxRow = i;\n for (let k = i + 1; k < n; k++) {\n if (Math.abs(matrix[k][i]) > Math.abs(matrix[maxRow][i])) {\n maxRow = k;\n }\n }\n\n // Swap rows\n const temp = matrix[i];\n matrix[i] = matrix[maxRow];\n matrix[maxRow] = temp;\n\n // Pivot must be non-zero\n const pivot = matrix[i][i];\n if (Math.abs(pivot) < 1e-12) {\n throw new Error(\"Matrix is singular or near-singular\");\n }\n\n // Eliminate below\n for (let k = i + 1; k < n; k++) {\n const factor = matrix[k][i] / pivot;\n for (let j = i; j <= n; j++) {\n matrix[k][j] -= factor * matrix[i][j];\n }\n }\n }\n\n // Back substitution\n const x = new Array(n).fill(0);\n for (let i = n - 1; i >= 0; i--) {\n let sum = 0;\n for (let j = i + 1; j < n; j++) {\n sum += matrix[i][j] * x[j];\n }\n x[i] = (matrix[i][n] - sum) / matrix[i][i];\n }\n\n return x;\n}\n\n/**\n * Calculate R² (coefficient of determination)\n */\nexport function calculateR2(\n x: number[] | Float32Array,\n y: number[] | Float32Array,\n fitFn: (x: number) => number\n): number {\n const n = x.length;\n if (n === 0) return 0;\n\n let sumY = 0;\n for (let i = 0; i < n; i++) sumY += y[i];\n const meanY = sumY / n;\n\n let ssTot = 0; // Total sum of squares\n let ssRes = 0; // Residual sum of squares\n\n for (let i = 0; i < n; i++) {\n const yi = y[i];\n const fi = fitFn(x[i]);\n ssTot += (yi - meanY) * (yi - meanY);\n ssRes += (yi - fi) * (yi - fi);\n }\n\n return ssTot === 0 ? 1 : 1 - ssRes / ssTot;\n}\n\n/**\n * Numerical integration using the trapezoidal rule.\n * \n * @param x - X values (must be sorted)\n * @param y - Y values\n * @param xMin - Optional start of integration range\n * @param xMax - Optional end of integration range\n */\nexport function integrate(\n x: number[] | Float32Array,\n y: number[] | Float32Array,\n xMin?: number,\n xMax?: number\n): number {\n const n = x.length;\n if (n < 2) return 0;\n\n let area = 0;\n const start = xMin !== undefined ? xMin : x[0];\n const end = xMax !== undefined ? xMax : x[n - 1];\n\n for (let i = 0; i < n - 1; i++) {\n const x1 = x[i];\n const x2 = x[i + 1];\n \n // Skip if outside range\n if (x2 < start) continue;\n if (x1 > end) break;\n\n // Handle partial intervals at boundaries\n const ia = Math.max(x1, start);\n const ib = Math.min(x2, end);\n\n if (ia < ib) {\n // Linear interpolation for y values at boundaries if needed\n const y1 = y[i] + (y[i + 1] - y[i]) * ((ia - x1) / (x2 - x1));\n const y2 = y[i] + (y[i + 1] - y[i]) * ((ib - x1) / (x2 - x1));\n \n area += (ib - ia) * (y1 + y2) / 2;\n }\n }\n\n return area;\n}\n\n/**\n * Calculate numerical derivative dy/dx\n */\nexport function derivative(\n x: number[] | Float32Array,\n y: number[] | Float32Array\n): Float32Array {\n const n = x.length;\n if (n < 2) return new Float32Array(0);\n\n const result = new Float32Array(n);\n for (let i = 0; i < n - 1; i++) {\n const dx = x[i + 1] - x[i];\n result[i] = dx !== 0 ? (y[i + 1] - y[i]) / dx : 0;\n }\n // Last point same as previous for length matching\n result[n - 1] = result[n - 2];\n return result;\n}\n\n/**\n * Calculate cumulative integral (area array)\n */\nexport function cumulativeIntegral(\n x: number[] | Float32Array,\n y: number[] | Float32Array\n): Float32Array {\n const n = x.length;\n if (n < 1) return new Float32Array(0);\n\n const result = new Float32Array(n);\n result[0] = 0;\n \n for (let i = 0; i < n - 1; i++) {\n const dx = x[i + 1] - x[i];\n const area = dx * (y[i] + y[i + 1]) / 2;\n result[i + 1] = result[i] + area;\n }\n \n return result;\n}\n"],"names":["solveLinearSystem","A","B","n","matrix","row","i","maxRow","k","temp","pivot","factor","j","x","sum","calculateR2","y","fitFn","sumY","meanY","ssTot","ssRes","yi","fi","integrate","xMin","xMax","area","start","end","x1","x2","ia","ib","y1","y2","derivative","result","dx","cumulativeIntegral"],"mappings":"AAWO,SAASA,EAAkBC,GAAeC,GAAuB;AACtE,QAAMC,IAAID,EAAE,QACNE,IAASH,EAAE,IAAI,CAACI,GAAKC,MAAM,CAAC,GAAGD,GAAKH,EAAEI,CAAC,CAAC,CAAC;AAE/C,WAASA,IAAI,GAAGA,IAAIH,GAAGG,KAAK;AAE1B,QAAIC,IAASD;AACb,aAASE,IAAIF,IAAI,GAAGE,IAAIL,GAAGK;AACzB,MAAI,KAAK,IAAIJ,EAAOI,CAAC,EAAEF,CAAC,CAAC,IAAI,KAAK,IAAIF,EAAOG,CAAM,EAAED,CAAC,CAAC,MACrDC,IAASC;AAKb,UAAMC,IAAOL,EAAOE,CAAC;AACrB,IAAAF,EAAOE,CAAC,IAAIF,EAAOG,CAAM,GACzBH,EAAOG,CAAM,IAAIE;AAGjB,UAAMC,IAAQN,EAAOE,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