velo-plot 1.11.1
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/LICENSE +21 -0
- package/README.md +119 -0
- package/dist/EventEmitter-DAbs2K1C.js +60 -0
- package/dist/EventEmitter-DAbs2K1C.js.map +1 -0
- package/dist/core/Chart.d.ts +15 -0
- package/dist/core/ChartControls.d.ts +41 -0
- package/dist/core/ChartInitQueue.d.ts +50 -0
- package/dist/core/ChartLegend.d.ts +74 -0
- package/dist/core/ChartStatistics.d.ts +18 -0
- package/dist/core/EventEmitter.d.ts +30 -0
- package/dist/core/InteractionManager.d.ts +96 -0
- package/dist/core/OverlayRenderer.d.ts +89 -0
- package/dist/core/Series.d.ts +4 -0
- package/dist/core/animation/AnimationEngine.d.ts +156 -0
- package/dist/core/animation/index.d.ts +6 -0
- package/dist/core/annotations/AnnotationManager.d.ts +61 -0
- package/dist/core/annotations/index.d.ts +5 -0
- package/dist/core/annotations/types.d.ts +159 -0
- package/dist/core/chart/ChartAnimatedNavigation.d.ts +53 -0
- package/dist/core/chart/ChartAxisManager.d.ts +61 -0
- package/dist/core/chart/ChartCore.d.ts +336 -0
- package/dist/core/chart/ChartExporter.d.ts +18 -0
- package/dist/core/chart/ChartNavigation.d.ts +33 -0
- package/dist/core/chart/ChartPluginBridge.d.ts +34 -0
- package/dist/core/chart/ChartRenderLoop.d.ts +100 -0
- package/dist/core/chart/ChartRenderer.d.ts +52 -0
- package/dist/core/chart/ChartScaling.d.ts +31 -0
- package/dist/core/chart/ChartSeries.d.ts +4 -0
- package/dist/core/chart/ChartSetup.d.ts +67 -0
- package/dist/core/chart/ChartStateManager.d.ts +54 -0
- package/dist/core/chart/ChartUI.d.ts +40 -0
- package/dist/core/chart/exporter/SVGExporter.d.ts +6 -0
- package/dist/core/chart/exporter/index.d.ts +5 -0
- package/dist/core/chart/index.d.ts +14 -0
- package/dist/core/chart/series/SeriesActions.d.ts +7 -0
- package/dist/core/chart/series/SeriesBuffer.d.ts +4 -0
- package/dist/core/chart/series/index.d.ts +6 -0
- package/dist/core/chart/series/types.d.ts +22 -0
- package/dist/core/chart/types.d.ts +188 -0
- package/dist/core/clipboard/index.d.ts +137 -0
- package/dist/core/debug/index.d.ts +143 -0
- package/dist/core/index.d.ts +17 -0
- package/dist/core/keybindings/index.d.ts +157 -0
- package/dist/core/layout/index.d.ts +12 -0
- package/dist/core/layout/types.d.ts +165 -0
- package/dist/core/loading/index.d.ts +104 -0
- package/dist/core/locale/index.d.ts +91 -0
- package/dist/core/responsive/ResponsiveManager.d.ts +133 -0
- package/dist/core/responsive/index.d.ts +4 -0
- package/dist/core/selection/SelectionManager.d.ts +165 -0
- package/dist/core/selection/index.d.ts +4 -0
- package/dist/core/series/Series.d.ts +73 -0
- package/dist/core/series/SeriesBounds.d.ts +3 -0
- package/dist/core/series/SeriesDataUtils.d.ts +7 -0
- package/dist/core/series/index.d.ts +6 -0
- package/dist/core/sync/index.d.ts +147 -0
- package/dist/core/theme-editor/index.d.ts +122 -0
- package/dist/examples/PluginDemonstration.d.ts +20 -0
- package/dist/examples.d.ts +25 -0
- package/dist/gpu/adapter/gpuRenderer.d.ts +135 -0
- package/dist/gpu/adapter/index.d.ts +7 -0
- package/dist/gpu/adapter/seriesAdapter.d.ts +88 -0
- package/dist/gpu/backends/webgl/WebGLBackend.d.ts +42 -0
- package/dist/gpu/backends/webgl/index.d.ts +5 -0
- package/dist/gpu/backends/webgl/programFactory.d.ts +30 -0
- package/dist/gpu/backends/webgl/shaders.d.ts +14 -0
- package/dist/gpu/backends/webgpu/MassiveDataRenderer.d.ts +111 -0
- package/dist/gpu/backends/webgpu/WebGPUBackend.d.ts +58 -0
- package/dist/gpu/backends/webgpu/pipelines/bandPipeline.d.ts +24 -0
- package/dist/gpu/backends/webgpu/pipelines/heatmapPipeline.d.ts +28 -0
- package/dist/gpu/backends/webgpu/pipelines/index.d.ts +10 -0
- package/dist/gpu/backends/webgpu/pipelines/instancedLinePipeline.d.ts +23 -0
- package/dist/gpu/backends/webgpu/pipelines/instancedPointPipeline.d.ts +25 -0
- package/dist/gpu/backends/webgpu/pipelines/linePipeline.d.ts +23 -0
- package/dist/gpu/backends/webgpu/pipelines/pointPipeline.d.ts +28 -0
- package/dist/gpu/backends/webgpu/pipelines/trianglePipeline.d.ts +5 -0
- package/dist/gpu/backends/webgpu/pipelines/triangleShader.d.ts +1 -0
- package/dist/gpu/backends/webgpu/shaders/heatmap.wgsl.d.ts +8 -0
- package/dist/gpu/backends/webgpu/shaders/index.d.ts +8 -0
- package/dist/gpu/backends/webgpu/shaders/instanced.wgsl.d.ts +16 -0
- package/dist/gpu/backends/webgpu/shaders/line.wgsl.d.ts +8 -0
- package/dist/gpu/backends/webgpu/shaders/point.wgsl.d.ts +9 -0
- package/dist/gpu/benchmark/benchmark.d.ts +74 -0
- package/dist/gpu/benchmark/index.d.ts +5 -0
- package/dist/gpu/compute/gpuCompute.d.ts +72 -0
- package/dist/gpu/compute/index.d.ts +6 -0
- package/dist/gpu/compute/shaders.d.ts +9 -0
- package/dist/gpu/drawList.d.ts +77 -0
- package/dist/gpu/examples/gallery.d.ts +20 -0
- package/dist/gpu/examples/index.d.ts +3 -0
- package/dist/gpu/examples/webgpu-line-demo.d.ts +8 -0
- package/dist/gpu/examples/webgpu-triangle.d.ts +1 -0
- package/dist/gpu/frame.d.ts +25 -0
- package/dist/gpu/index.d.ts +24 -0
- package/dist/gpu/resources/bufferStore.d.ts +40 -0
- package/dist/gpu/resources/index.d.ts +9 -0
- package/dist/gpu/resources/pipelineCache.d.ts +33 -0
- package/dist/gpu/resources/textureStore.d.ts +41 -0
- package/dist/gpu/types.d.ts +47 -0
- package/dist/index-BMiZoKmm.js +536 -0
- package/dist/index-BMiZoKmm.js.map +1 -0
- package/dist/index-Ce2JgkH_.js +282 -0
- package/dist/index-Ce2JgkH_.js.map +1 -0
- package/dist/index-D8ifudJH.js +2431 -0
- package/dist/index-D8ifudJH.js.map +1 -0
- package/dist/index-Dag88bW4.js +499 -0
- package/dist/index-Dag88bW4.js.map +1 -0
- package/dist/index-qhscKTDy.js +309 -0
- package/dist/index-qhscKTDy.js.map +1 -0
- package/dist/index-x4stH3jD.js +282 -0
- package/dist/index-x4stH3jD.js.map +1 -0
- package/dist/index.core-CYu3tydL.js +7252 -0
- package/dist/index.core-CYu3tydL.js.map +1 -0
- package/dist/index.core.d.ts +20 -0
- package/dist/index.d.ts +51 -0
- package/dist/overlay/CanvasOverlay.d.ts +102 -0
- package/dist/overlay/index.d.ts +4 -0
- package/dist/plugins/3d/Area3DRenderer.d.ts +122 -0
- package/dist/plugins/3d/Axes3D.d.ts +104 -0
- package/dist/plugins/3d/Bubble3DRenderer.d.ts +198 -0
- package/dist/plugins/3d/Impulse3DRenderer.d.ts +130 -0
- package/dist/plugins/3d/Line3DRenderer.d.ts +118 -0
- package/dist/plugins/3d/PointCloud3DRenderer.d.ts +84 -0
- package/dist/plugins/3d/Raycaster3D.d.ts +137 -0
- package/dist/plugins/3d/Ribbon3DRenderer.d.ts +83 -0
- package/dist/plugins/3d/SurfaceBar3DRenderer.d.ts +92 -0
- package/dist/plugins/3d/SurfaceMesh3DRenderer.d.ts +130 -0
- package/dist/plugins/3d/Tooltip3D.d.ts +71 -0
- package/dist/plugins/3d/VectorField3DRenderer.d.ts +86 -0
- package/dist/plugins/3d/Voxel3DRenderer.d.ts +89 -0
- package/dist/plugins/3d/Waterfall3DRenderer.d.ts +94 -0
- package/dist/plugins/3d/camera/OrbitCamera.d.ts +99 -0
- package/dist/plugins/3d/camera/index.d.ts +1 -0
- package/dist/plugins/3d/colorThemes.d.ts +39 -0
- package/dist/plugins/3d/controls/OrbitController.d.ts +69 -0
- package/dist/plugins/3d/controls/index.d.ts +1 -0
- package/dist/plugins/3d/index.d.ts +50 -0
- package/dist/plugins/3d/math/Mat4.d.ts +33 -0
- package/dist/plugins/3d/math/Vec3.d.ts +37 -0
- package/dist/plugins/3d/math/index.d.ts +4 -0
- package/dist/plugins/3d/mesh/InstancedMesh.d.ts +42 -0
- package/dist/plugins/3d/mesh/geometry.d.ts +34 -0
- package/dist/plugins/3d/mesh/index.d.ts +2 -0
- package/dist/plugins/3d/series/Area3D.d.ts +17 -0
- package/dist/plugins/3d/series/Column3D.d.ts +20 -0
- package/dist/plugins/3d/series/Heatmap3D.d.ts +17 -0
- package/dist/plugins/3d/series/Impulse3D.d.ts +16 -0
- package/dist/plugins/3d/series/PointLine3D.d.ts +20 -0
- package/dist/plugins/3d/series/Ribbon3D.d.ts +17 -0
- package/dist/plugins/3d/series/Scatter3D.d.ts +21 -0
- package/dist/plugins/3d/series/SurfaceMesh3D.d.ts +35 -0
- package/dist/plugins/3d/series/Waterfall3D.d.ts +38 -0
- package/dist/plugins/3d/series/index.d.ts +13 -0
- package/dist/plugins/3d/series/types.d.ts +143 -0
- package/dist/plugins/3d/shader/index.d.ts +2 -0
- package/dist/plugins/3d/shader/programs.d.ts +24 -0
- package/dist/plugins/3d/shader/sources.d.ts +27 -0
- package/dist/plugins/3d/types.d.ts +71 -0
- package/dist/plugins/3d.d.ts +3 -0
- package/dist/plugins/3d.js +5498 -0
- package/dist/plugins/3d.js.map +1 -0
- package/dist/plugins/PluginContext.d.ts +53 -0
- package/dist/plugins/PluginManager.d.ts +129 -0
- package/dist/plugins/PluginRegistry.d.ts +38 -0
- package/dist/plugins/analysis/SeriesFit.d.ts +3 -0
- package/dist/plugins/analysis/contours.d.ts +20 -0
- package/dist/plugins/analysis/fft.d.ts +138 -0
- package/dist/plugins/analysis/filters.d.ts +76 -0
- package/dist/plugins/analysis/fitting.d.ts +24 -0
- package/dist/plugins/analysis/index.d.ts +29 -0
- package/dist/plugins/analysis/indicators.d.ts +148 -0
- package/dist/plugins/analysis/math.d.ts +32 -0
- package/dist/plugins/analysis/statistics.d.ts +78 -0
- package/dist/plugins/analysis/utils.d.ts +150 -0
- package/dist/plugins/analysis.d.ts +3 -0
- package/dist/plugins/analysis.js +1202 -0
- package/dist/plugins/analysis.js.map +1 -0
- package/dist/plugins/annotations/index.d.ts +16 -0
- package/dist/plugins/annotations.d.ts +3 -0
- package/dist/plugins/annotations.js +438 -0
- package/dist/plugins/annotations.js.map +1 -0
- package/dist/plugins/anomaly-detection/algorithms.d.ts +38 -0
- package/dist/plugins/anomaly-detection/index.d.ts +16 -0
- package/dist/plugins/anomaly-detection/types.d.ts +57 -0
- package/dist/plugins/broken-axis/BrokenAxisScale.d.ts +24 -0
- package/dist/plugins/broken-axis/exports.d.ts +6 -0
- package/dist/plugins/broken-axis/index.d.ts +6 -0
- package/dist/plugins/broken-axis/types.d.ts +50 -0
- package/dist/plugins/builtins/crosshair/CrosshairPlugin.d.ts +40 -0
- package/dist/plugins/builtins/crosshair/index.d.ts +1 -0
- package/dist/plugins/builtins/data-logger/DataLoggerPlugin.d.ts +11 -0
- package/dist/plugins/builtins/data-logger/index.d.ts +1 -0
- package/dist/plugins/builtins/direction-indicator/DirectionIndicatorPlugin.d.ts +17 -0
- package/dist/plugins/builtins/direction-indicator/index.d.ts +2 -0
- package/dist/plugins/builtins/grid-highlight/GridHighlightPlugin.d.ts +17 -0
- package/dist/plugins/builtins/grid-highlight/index.d.ts +1 -0
- package/dist/plugins/builtins/index.d.ts +25 -0
- package/dist/plugins/builtins/stats/StatsPlugin.d.ts +11 -0
- package/dist/plugins/builtins/stats/index.d.ts +1 -0
- package/dist/plugins/builtins/watermark/WatermarkPlugin.d.ts +15 -0
- package/dist/plugins/builtins/watermark/index.d.ts +1 -0
- package/dist/plugins/caching/exports.d.ts +6 -0
- package/dist/plugins/caching/index.d.ts +6 -0
- package/dist/plugins/caching/types.d.ts +120 -0
- package/dist/plugins/clipboard/index.d.ts +20 -0
- package/dist/plugins/clipboard.d.ts +3 -0
- package/dist/plugins/clipboard.js +270 -0
- package/dist/plugins/clipboard.js.map +1 -0
- package/dist/plugins/context-menu/index.d.ts +12 -0
- package/dist/plugins/context-menu/renderer.d.ts +43 -0
- package/dist/plugins/context-menu/types.d.ts +202 -0
- package/dist/plugins/context-menu.d.ts +3 -0
- package/dist/plugins/context-menu.js +621 -0
- package/dist/plugins/context-menu.js.map +1 -0
- package/dist/plugins/data-export/formatters.d.ts +34 -0
- package/dist/plugins/data-export/index.d.ts +15 -0
- package/dist/plugins/data-export/types.d.ts +166 -0
- package/dist/plugins/data-export.d.ts +3 -0
- package/dist/plugins/data-export.js +463 -0
- package/dist/plugins/data-export.js.map +1 -0
- package/dist/plugins/data-transform/index.d.ts +6 -0
- package/dist/plugins/data-transform/types.d.ts +34 -0
- package/dist/plugins/debug/index.d.ts +24 -0
- package/dist/plugins/debug.d.ts +3 -0
- package/dist/plugins/debug.js +330 -0
- package/dist/plugins/debug.js.map +1 -0
- package/dist/plugins/drag-edit/exports.d.ts +6 -0
- package/dist/plugins/drag-edit/index.d.ts +6 -0
- package/dist/plugins/drag-edit/types.d.ts +118 -0
- package/dist/plugins/forecasting/algorithms.d.ts +6 -0
- package/dist/plugins/forecasting/exports.d.ts +3 -0
- package/dist/plugins/forecasting/index.d.ts +11 -0
- package/dist/plugins/forecasting/types.d.ts +88 -0
- package/dist/plugins/gpu/index.d.ts +24 -0
- package/dist/plugins/gpu.d.ts +3 -0
- package/dist/plugins/gpu.js +2430 -0
- package/dist/plugins/gpu.js.map +1 -0
- package/dist/plugins/i18n/index.d.ts +22 -0
- package/dist/plugins/i18n.d.ts +3 -0
- package/dist/plugins/i18n.js +37 -0
- package/dist/plugins/i18n.js.map +1 -0
- package/dist/plugins/index.d.ts +110 -0
- package/dist/plugins/keyboard/index.d.ts +15 -0
- package/dist/plugins/keyboard.d.ts +3 -0
- package/dist/plugins/keyboard.js +8 -0
- package/dist/plugins/keyboard.js.map +1 -0
- package/dist/plugins/latex/exports.d.ts +6 -0
- package/dist/plugins/latex/index.d.ts +8 -0
- package/dist/plugins/latex/parser.d.ts +6 -0
- package/dist/plugins/latex/renderer.d.ts +6 -0
- package/dist/plugins/latex/symbols.d.ts +28 -0
- package/dist/plugins/latex/types.d.ts +88 -0
- package/dist/plugins/lazy-load/exports.d.ts +6 -0
- package/dist/plugins/lazy-load/index.d.ts +6 -0
- package/dist/plugins/lazy-load/types.d.ts +121 -0
- package/dist/plugins/loading/index.d.ts +15 -0
- package/dist/plugins/loading.d.ts +3 -0
- package/dist/plugins/loading.js +7 -0
- package/dist/plugins/loading.js.map +1 -0
- package/dist/plugins/ml-integration/exports.d.ts +11 -0
- package/dist/plugins/ml-integration/index.d.ts +6 -0
- package/dist/plugins/ml-integration/native-algorithms.d.ts +69 -0
- package/dist/plugins/ml-integration/types.d.ts +74 -0
- package/dist/plugins/offscreen/exports.d.ts +6 -0
- package/dist/plugins/offscreen/index.d.ts +6 -0
- package/dist/plugins/offscreen/pool.d.ts +32 -0
- package/dist/plugins/offscreen/types.d.ts +35 -0
- package/dist/plugins/pattern-recognition/index.d.ts +6 -0
- package/dist/plugins/pattern-recognition/patterns.d.ts +3 -0
- package/dist/plugins/pattern-recognition/types.d.ts +245 -0
- package/dist/plugins/radar/index.d.ts +6 -0
- package/dist/plugins/radar/types.d.ts +40 -0
- package/dist/plugins/regression/algorithms.d.ts +6 -0
- package/dist/plugins/regression/index.d.ts +6 -0
- package/dist/plugins/regression/types.d.ts +261 -0
- package/dist/plugins/roi/exports.d.ts +6 -0
- package/dist/plugins/roi/index.d.ts +49 -0
- package/dist/plugins/roi/types.d.ts +60 -0
- package/dist/plugins/snapshot/index.d.ts +11 -0
- package/dist/plugins/snapshot/types.d.ts +38 -0
- package/dist/plugins/streaming/index.d.ts +32 -0
- package/dist/plugins/streaming.d.ts +3 -0
- package/dist/plugins/streaming.js +13 -0
- package/dist/plugins/streaming.js.map +1 -0
- package/dist/plugins/sync/index.d.ts +22 -0
- package/dist/plugins/sync.d.ts +3 -0
- package/dist/plugins/sync.js +261 -0
- package/dist/plugins/sync.js.map +1 -0
- package/dist/plugins/theme-editor/index.d.ts +18 -0
- package/dist/plugins/theme-editor.d.ts +3 -0
- package/dist/plugins/theme-editor.js +7 -0
- package/dist/plugins/theme-editor.js.map +1 -0
- package/dist/plugins/tools/delta-tool/index.d.ts +159 -0
- package/dist/plugins/tools/index.d.ts +21 -0
- package/dist/plugins/tools/peak-tool/index.d.ts +159 -0
- package/dist/plugins/tools/tooltip/TooltipManager.d.ts +213 -0
- package/dist/plugins/tools/tooltip/TooltipPositioner.d.ts +83 -0
- package/dist/plugins/tools/tooltip/TooltipRenderer.d.ts +64 -0
- package/dist/plugins/tools/tooltip/index.d.ts +18 -0
- package/dist/plugins/tools/tooltip/templates/AnnotationTemplate.d.ts +18 -0
- package/dist/plugins/tools/tooltip/templates/CrosshairTemplate.d.ts +39 -0
- package/dist/plugins/tools/tooltip/templates/DefaultTemplate.d.ts +30 -0
- package/dist/plugins/tools/tooltip/templates/HeatmapTemplate.d.ts +34 -0
- package/dist/plugins/tools/tooltip/templates/MinimalTemplate.d.ts +26 -0
- package/dist/plugins/tools/tooltip/templates/RangeTemplate.d.ts +18 -0
- package/dist/plugins/tools/tooltip/templates/ScientificTemplate.d.ts +34 -0
- package/dist/plugins/tools/tooltip/templates/index.d.ts +27 -0
- package/dist/plugins/tools/tooltip/themes.d.ts +48 -0
- package/dist/plugins/tools/tooltip/types.d.ts +396 -0
- package/dist/plugins/tools.d.ts +3 -0
- package/dist/plugins/tools.js +9 -0
- package/dist/plugins/tools.js.map +1 -0
- package/dist/plugins/types.d.ts +451 -0
- package/dist/plugins/video-recorder/exports.d.ts +6 -0
- package/dist/plugins/video-recorder/index.d.ts +6 -0
- package/dist/plugins/video-recorder/types.d.ts +55 -0
- package/dist/plugins/virtualization/exports.d.ts +6 -0
- package/dist/plugins/virtualization/index.d.ts +6 -0
- package/dist/plugins/virtualization/types.d.ts +48 -0
- package/dist/react/SciPlot.d.ts +60 -0
- package/dist/react/index.d.ts +5 -0
- package/dist/react/useSciPlot.d.ts +56 -0
- package/dist/renderer/BarRenderer.d.ts +14 -0
- package/dist/renderer/CandlestickRenderer.d.ts +12 -0
- package/dist/renderer/GaugeRenderer.d.ts +3 -0
- package/dist/renderer/HeatmapRenderer.d.ts +15 -0
- package/dist/renderer/NativeWebGLRenderer.d.ts +16 -0
- package/dist/renderer/PolarRenderer.d.ts +64 -0
- package/dist/renderer/RendererInterface.d.ts +70 -0
- package/dist/renderer/SankeyRenderer.d.ts +3 -0
- package/dist/renderer/WebGPURenderer.d.ts +16 -0
- package/dist/renderer/index.d.ts +13 -0
- package/dist/renderer/native/NativeWebGLRenderer.d.ts +31 -0
- package/dist/renderer/native/bufferStore.d.ts +11 -0
- package/dist/renderer/native/draw.d.ts +47 -0
- package/dist/renderer/native/programFactory.d.ts +3 -0
- package/dist/renderer/native/renderFrame.d.ts +3 -0
- package/dist/renderer/native/shaderSources.d.ts +6 -0
- package/dist/renderer/native/textureStore.d.ts +8 -0
- package/dist/renderer/native/types.d.ts +77 -0
- package/dist/renderer/native/utils.d.ts +31 -0
- package/dist/renderer/radar/RadarRenderer.d.ts +71 -0
- package/dist/renderer/radar/index.d.ts +10 -0
- package/dist/renderer/shaders.d.ts +77 -0
- package/dist/renderer/ternary/TernaryRenderer.d.ts +39 -0
- package/dist/renderer/ternary/index.d.ts +6 -0
- package/dist/renderer/ternary/types.d.ts +56 -0
- package/dist/scales/index.d.ts +54 -0
- package/dist/serialization/index.d.ts +153 -0
- package/dist/streaming/backpressure.d.ts +179 -0
- package/dist/streaming/index.d.ts +7 -0
- package/dist/streaming/mock.d.ts +12 -0
- package/dist/streaming/types.d.ts +57 -0
- package/dist/streaming/utils.d.ts +19 -0
- package/dist/streaming/websocket.d.ts +6 -0
- package/dist/testing/index.d.ts +225 -0
- package/dist/theme/colorSchemes.d.ts +56 -0
- package/dist/theme/index.d.ts +138 -0
- package/dist/types.d.ts +753 -0
- package/dist/utils-Dbro9-qM.js +254 -0
- package/dist/utils-Dbro9-qM.js.map +1 -0
- package/dist/velo-plot.d.ts +1 -0
- package/dist/velo-plot.full.d.ts +1 -0
- package/dist/velo-plot.full.js +5804 -0
- package/dist/velo-plot.full.js.map +1 -0
- package/dist/velo-plot.js +31 -0
- package/dist/velo-plot.js.map +1 -0
- package/dist/workers/downsample.d.ts +34 -0
- package/dist/workers/downsample.worker.d.ts +46 -0
- package/package.json +185 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Line Vertex Shader
|
|
3
|
+
*
|
|
4
|
+
* Transforms 2D points from data space to clip space using uniforms.
|
|
5
|
+
* This allows zoom/pan without recreating vertex buffers.
|
|
6
|
+
*/
|
|
7
|
+
export declare const lineVertexShader = "\nprecision highp float;\n\n// Attributes (per-vertex data)\nattribute vec2 position;\n\n// Uniforms (constant across all vertices)\nuniform vec2 uScale; // Zoom factor [scaleX, scaleY]\nuniform vec2 uTranslate; // Pan offset [translateX, translateY]\nuniform vec2 uResolution; // Canvas size in pixels\n\n// Varying (passed to fragment shader)\nvarying float vAlpha;\n\nvoid main() {\n // Transform position: apply scale and translate\n vec2 pos = position * uScale + uTranslate;\n\n // pos is now in normalized device coordinates (-1 to 1)\n gl_Position = vec4(pos, 0.0, 1.0);\n\n // Pass alpha for potential fading effects\n vAlpha = 1.0;\n}\n";
|
|
8
|
+
/**
|
|
9
|
+
* Line Fragment Shader
|
|
10
|
+
*
|
|
11
|
+
* Simple solid color output with configurable opacity.
|
|
12
|
+
*/
|
|
13
|
+
export declare const lineFragmentShader = "\nprecision highp float;\n\n// Uniforms\nuniform vec4 uColor; // RGBA color\n\n// Varying from vertex shader\nvarying float vAlpha;\n\nvoid main() {\n gl_FragColor = vec4(uColor.rgb, uColor.a * vAlpha);\n}\n";
|
|
14
|
+
/**
|
|
15
|
+
* Antialiased Line Vertex Shader
|
|
16
|
+
*
|
|
17
|
+
* For thick lines with proper antialiasing, we need to expand
|
|
18
|
+
* lines into quads and compute distance from line center.
|
|
19
|
+
*/
|
|
20
|
+
export declare const lineAAVertexShader = "\nprecision highp float;\n\nattribute vec2 position;\nattribute vec2 normal; // Perpendicular to line direction\nattribute float miter; // Miter length for joins\n\nuniform vec2 uScale;\nuniform vec2 uTranslate;\nuniform vec2 uResolution;\nuniform float uLineWidth;\n\nvarying vec2 vNormal;\nvarying float vLineWidth;\n\nvoid main() {\n // Transform position\n vec2 pos = position * uScale + uTranslate;\n\n // Convert to screen space for line width calculation\n vec2 screenPos = (pos * 0.5 + 0.5) * uResolution;\n\n // Offset by line width in screen space\n float halfWidth = uLineWidth * 0.5;\n screenPos += normal * halfWidth * miter;\n\n // Convert back to clip space\n pos = (screenPos / uResolution) * 2.0 - 1.0;\n\n gl_Position = vec4(pos, 0.0, 1.0);\n\n vNormal = normal;\n vLineWidth = uLineWidth;\n}\n";
|
|
21
|
+
/**
|
|
22
|
+
* Antialiased Line Fragment Shader
|
|
23
|
+
*
|
|
24
|
+
* Uses distance-based antialiasing for smooth edges.
|
|
25
|
+
*/
|
|
26
|
+
export declare const lineAAFragmentShader = "\nprecision highp float;\n\nuniform vec4 uColor;\nuniform float uLineWidth;\n\nvarying vec2 vNormal;\nvarying float vLineWidth;\n\nvoid main() {\n // Distance from line center (0 at center, 1 at edge)\n float dist = length(vNormal);\n\n // Smooth step for antialiasing\n float aa = 1.0 / uLineWidth;\n float alpha = 1.0 - smoothstep(1.0 - aa, 1.0, dist);\n\n gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\n}\n";
|
|
27
|
+
/**
|
|
28
|
+
* Point/Scatter Vertex Shader
|
|
29
|
+
*
|
|
30
|
+
* Renders data points as squares/circles.
|
|
31
|
+
*/
|
|
32
|
+
export declare const pointVertexShader = "\nprecision highp float;\n\nattribute vec2 position;\n\nuniform vec2 uScale;\nuniform vec2 uTranslate;\nuniform float uPointSize;\n\nvoid main() {\n vec2 pos = position * uScale + uTranslate;\n gl_Position = vec4(pos, 0.0, 1.0);\n gl_PointSize = uPointSize;\n}\n";
|
|
33
|
+
/**
|
|
34
|
+
* Point/Scatter Fragment Shader
|
|
35
|
+
*
|
|
36
|
+
* Renders circular points with smooth edges.
|
|
37
|
+
*/
|
|
38
|
+
export declare const pointFragmentShader = "\nprecision highp float;\n\nuniform vec4 uColor;\n\nvoid main() {\n // Distance from point center\n vec2 coord = gl_PointCoord - vec2(0.5);\n float dist = length(coord);\n\n // Discard outside circle\n if (dist > 0.5) discard;\n\n // Smooth edge\n float alpha = 1.0 - smoothstep(0.4, 0.5, dist);\n\n gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\n}\n";
|
|
39
|
+
/**
|
|
40
|
+
* Heatmap Vertex Shader (for future density plots)
|
|
41
|
+
*/
|
|
42
|
+
export declare const heatmapVertexShader = "\nprecision highp float;\n\nattribute vec2 position;\nattribute float value;\n\nuniform vec2 uScale;\nuniform vec2 uTranslate;\n\nvarying float vValue;\n\nvoid main() {\n vec2 pos = position * uScale + uTranslate;\n gl_Position = vec4(pos, 0.0, 1.0);\n vValue = value;\n}\n";
|
|
43
|
+
/**
|
|
44
|
+
* Heatmap Fragment Shader
|
|
45
|
+
*
|
|
46
|
+
* Maps values to colors using a colormap.
|
|
47
|
+
*/
|
|
48
|
+
export declare const heatmapFragmentShader = "\nprecision highp float;\n\nuniform float uMinValue;\nuniform float uMaxValue;\nuniform sampler2D uColormap;\n\nvarying float vValue;\n\nvoid main() {\n float normalized = (vValue - uMinValue) / (uMaxValue - uMinValue);\n normalized = clamp(normalized, 0.0, 1.0);\n\n vec4 color = texture2D(uColormap, vec2(normalized, 0.5));\n gl_FragColor = color;\n}\n";
|
|
49
|
+
/**
|
|
50
|
+
* Bar Chart Vertex Shader
|
|
51
|
+
*
|
|
52
|
+
* Renders rectangular bars using quad primitives.
|
|
53
|
+
*/
|
|
54
|
+
export declare const barVertexShader = "\nprecision highp float;\n\n// Attributes\nattribute vec2 position; // Corner position of bar quad [x, y]\nattribute vec2 barData; // [barX, barY] - center and height of bar\n\n// Uniforms\nuniform vec2 uScale;\nuniform vec2 uTranslate;\nuniform float uBarWidth; // Width of bars in data units\n\nvoid main() {\n // Calculate bar corner in data space\n float halfWidth = uBarWidth * 0.5;\n vec2 dataPos = vec2(\n barData.x + position.x * halfWidth, // X: center \u00B1 halfWidth\n position.y * barData.y // Y: 0 to barY\n );\n \n // Transform to clip space\n vec2 clipPos = dataPos * uScale + uTranslate;\n gl_Position = vec4(clipPos, 0.0, 1.0);\n}\n";
|
|
55
|
+
export declare const barFragmentShader = "\nprecision highp float;\n\nuniform vec4 uColor;\n\nvoid main() {\n gl_FragColor = uColor;\n}\n";
|
|
56
|
+
export declare const Shaders: {
|
|
57
|
+
line: {
|
|
58
|
+
vertex: string;
|
|
59
|
+
fragment: string;
|
|
60
|
+
};
|
|
61
|
+
lineAA: {
|
|
62
|
+
vertex: string;
|
|
63
|
+
fragment: string;
|
|
64
|
+
};
|
|
65
|
+
point: {
|
|
66
|
+
vertex: string;
|
|
67
|
+
fragment: string;
|
|
68
|
+
};
|
|
69
|
+
bar: {
|
|
70
|
+
vertex: string;
|
|
71
|
+
fragment: string;
|
|
72
|
+
};
|
|
73
|
+
heatmap: {
|
|
74
|
+
vertex: string;
|
|
75
|
+
fragment: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { TernaryData, TernaryOptions, CartesianPoint } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Convert ternary coordinates (a, b, c) to Cartesian (x, y)
|
|
5
|
+
*
|
|
6
|
+
* The triangle is positioned with:
|
|
7
|
+
* - A (top vertex) at (0.5, sqrt(3)/2)
|
|
8
|
+
* - B (bottom-left) at (0, 0)
|
|
9
|
+
* - C (bottom-right) at (1, 0)
|
|
10
|
+
*
|
|
11
|
+
* Formula:
|
|
12
|
+
* x = c + b/2
|
|
13
|
+
* y = b * sqrt(3)/2
|
|
14
|
+
*/
|
|
15
|
+
export declare function ternaryToCartesian(a: number, b: number, c: number): CartesianPoint;
|
|
16
|
+
/**
|
|
17
|
+
* Convert arrays of ternary coordinates to Cartesian
|
|
18
|
+
*/
|
|
19
|
+
export declare function convertTernaryData(data: TernaryData): CartesianPoint[];
|
|
20
|
+
/**
|
|
21
|
+
* Draw ternary grid lines
|
|
22
|
+
*/
|
|
23
|
+
export declare function drawTernaryGrid(ctx: CanvasRenderingContext2D, centerX: number, centerY: number, size: number, divisions?: number, gridColor?: string, gridWidth?: number): void;
|
|
24
|
+
/**
|
|
25
|
+
* Draw ternary triangle outline
|
|
26
|
+
*/
|
|
27
|
+
export declare function drawTernaryOutline(ctx: CanvasRenderingContext2D, centerX: number, centerY: number, size: number, color?: string, lineWidth?: number): void;
|
|
28
|
+
/**
|
|
29
|
+
* Draw ternary component labels
|
|
30
|
+
*/
|
|
31
|
+
export declare function drawTernaryLabels(ctx: CanvasRenderingContext2D, centerX: number, centerY: number, size: number, labelA?: string, labelB?: string, labelC?: string, fontSize?: number, color?: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Render ternary scatter points
|
|
34
|
+
*/
|
|
35
|
+
export declare function renderTernaryPoints(ctx: CanvasRenderingContext2D, data: TernaryData, centerX: number, centerY: number, size: number, pointSize?: number, color?: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Complete ternary plot renderer
|
|
38
|
+
*/
|
|
39
|
+
export declare function renderTernaryPlot(ctx: CanvasRenderingContext2D, data: TernaryData, options?: TernaryOptions): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Ternary plot renderer exports
|
|
3
|
+
* @module renderer/ternary
|
|
4
|
+
*/
|
|
5
|
+
export { ternaryToCartesian, convertTernaryData, drawTernaryGrid, drawTernaryOutline, drawTernaryLabels, renderTernaryPoints, renderTernaryPlot, } from './TernaryRenderer';
|
|
6
|
+
export type { TernaryData, TernaryStyle, TernaryOptions, CartesianPoint, } from './types';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Types for ternary plots
|
|
3
|
+
* @module renderer/ternary/types
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Ternary data structure (3 components that sum to 1)
|
|
7
|
+
*/
|
|
8
|
+
export interface TernaryData {
|
|
9
|
+
/** Component A values (0-1) */
|
|
10
|
+
a: number[];
|
|
11
|
+
/** Component B values (0-1) */
|
|
12
|
+
b: number[];
|
|
13
|
+
/** Component C values (0-1) */
|
|
14
|
+
c: number[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Ternary plot style options
|
|
18
|
+
*/
|
|
19
|
+
export interface TernaryStyle {
|
|
20
|
+
/** Point size for scatter mode */
|
|
21
|
+
pointSize?: number;
|
|
22
|
+
/** Point color */
|
|
23
|
+
color?: string;
|
|
24
|
+
/** Fill opacity for regions */
|
|
25
|
+
fillOpacity?: number;
|
|
26
|
+
/** Grid line color */
|
|
27
|
+
gridColor?: string;
|
|
28
|
+
/** Grid line width */
|
|
29
|
+
gridWidth?: number;
|
|
30
|
+
/** Number of grid divisions */
|
|
31
|
+
gridDivisions?: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Ternary plot configuration
|
|
35
|
+
*/
|
|
36
|
+
export interface TernaryOptions {
|
|
37
|
+
/** Label for component A (top vertex) */
|
|
38
|
+
labelA?: string;
|
|
39
|
+
/** Label for component B (bottom-left vertex) */
|
|
40
|
+
labelB?: string;
|
|
41
|
+
/** Label for component C (bottom-right vertex) */
|
|
42
|
+
labelC?: string;
|
|
43
|
+
/** Style options */
|
|
44
|
+
style?: TernaryStyle;
|
|
45
|
+
/** Show grid lines */
|
|
46
|
+
showGrid?: boolean;
|
|
47
|
+
/** Show labels */
|
|
48
|
+
showLabels?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Cartesian coordinates (result of ternary → cartesian conversion)
|
|
52
|
+
*/
|
|
53
|
+
export interface CartesianPoint {
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scale interface and implementations
|
|
3
|
+
*
|
|
4
|
+
* Scales transform data values to pixel coordinates and vice versa.
|
|
5
|
+
*/
|
|
6
|
+
export interface Scale {
|
|
7
|
+
/** Data domain [min, max] */
|
|
8
|
+
domain: [number, number];
|
|
9
|
+
/** Pixel range [min, max] */
|
|
10
|
+
range: [number, number];
|
|
11
|
+
/** Scale type identifier */
|
|
12
|
+
type: "linear" | "log";
|
|
13
|
+
/** Set the domain */
|
|
14
|
+
setDomain(min: number, max: number): void;
|
|
15
|
+
/** Set the range */
|
|
16
|
+
setRange(min: number, max: number): void;
|
|
17
|
+
/** Transform data value to pixel */
|
|
18
|
+
transform(value: number): number;
|
|
19
|
+
/** Transform pixel to data value */
|
|
20
|
+
invert(pixel: number): number;
|
|
21
|
+
/** Generate nice tick values */
|
|
22
|
+
ticks(count?: number): number[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Linear scale - proportional mapping
|
|
26
|
+
*/
|
|
27
|
+
export declare class LinearScale implements Scale {
|
|
28
|
+
domain: [number, number];
|
|
29
|
+
range: [number, number];
|
|
30
|
+
readonly type: "linear";
|
|
31
|
+
setDomain(min: number, max: number): void;
|
|
32
|
+
setRange(min: number, max: number): void;
|
|
33
|
+
transform(value: number): number;
|
|
34
|
+
invert(pixel: number): number;
|
|
35
|
+
ticks(count?: number): number[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Logarithmic scale - for exponential data
|
|
39
|
+
*/
|
|
40
|
+
export declare class LogScale implements Scale {
|
|
41
|
+
domain: [number, number];
|
|
42
|
+
range: [number, number];
|
|
43
|
+
readonly type: "log";
|
|
44
|
+
private base;
|
|
45
|
+
setDomain(min: number, max: number): void;
|
|
46
|
+
setRange(min: number, max: number): void;
|
|
47
|
+
transform(value: number): number;
|
|
48
|
+
invert(pixel: number): number;
|
|
49
|
+
ticks(count?: number): number[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Factory function to create scale by type
|
|
53
|
+
*/
|
|
54
|
+
export declare function createScale(type: "linear" | "log"): Scale;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { Bounds, SeriesType, SeriesStyle } from '../types';
|
|
2
|
+
import { Annotation } from '../core/annotations';
|
|
3
|
+
|
|
4
|
+
/** Version of the serialization format */
|
|
5
|
+
export declare const SERIALIZATION_VERSION = 1;
|
|
6
|
+
/** Serialized axis configuration */
|
|
7
|
+
export interface SerializedAxis {
|
|
8
|
+
id: string;
|
|
9
|
+
position?: 'left' | 'right' | 'top' | 'bottom';
|
|
10
|
+
label?: string;
|
|
11
|
+
scale?: 'linear' | 'log';
|
|
12
|
+
min?: number;
|
|
13
|
+
max?: number;
|
|
14
|
+
auto?: boolean;
|
|
15
|
+
invertAxis?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Serialized series data */
|
|
18
|
+
export interface SerializedSeries {
|
|
19
|
+
id: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
type: SeriesType;
|
|
22
|
+
yAxisId?: string;
|
|
23
|
+
style?: SeriesStyle;
|
|
24
|
+
visible?: boolean;
|
|
25
|
+
/** Data is stored as base64 encoded Float32Array for compactness */
|
|
26
|
+
data: {
|
|
27
|
+
x: string;
|
|
28
|
+
y: string;
|
|
29
|
+
y2?: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** Complete serialized chart state */
|
|
33
|
+
export interface ChartState {
|
|
34
|
+
/** Serialization format version */
|
|
35
|
+
version: number;
|
|
36
|
+
/** Timestamp when state was saved */
|
|
37
|
+
timestamp: number;
|
|
38
|
+
/** Current view bounds */
|
|
39
|
+
viewBounds: Bounds;
|
|
40
|
+
/** X-axis configuration */
|
|
41
|
+
xAxis: SerializedAxis;
|
|
42
|
+
/** Y-axes configurations */
|
|
43
|
+
yAxes: SerializedAxis[];
|
|
44
|
+
/** Primary Y axis ID */
|
|
45
|
+
primaryYAxisId: string;
|
|
46
|
+
/** Series data and configuration */
|
|
47
|
+
series: SerializedSeries[];
|
|
48
|
+
/** Annotations */
|
|
49
|
+
annotations: Annotation[];
|
|
50
|
+
/** Active theme name (if applicable) */
|
|
51
|
+
themeName?: string;
|
|
52
|
+
options?: {
|
|
53
|
+
showLegend?: boolean;
|
|
54
|
+
showControls?: boolean;
|
|
55
|
+
showStatistics?: boolean;
|
|
56
|
+
autoScroll?: boolean;
|
|
57
|
+
};
|
|
58
|
+
/** Plugin-specific data */
|
|
59
|
+
plugins?: Record<string, any>;
|
|
60
|
+
}
|
|
61
|
+
/** Options for serialization */
|
|
62
|
+
export interface SerializeOptions {
|
|
63
|
+
/** Include series data (default: true) */
|
|
64
|
+
includeData?: boolean;
|
|
65
|
+
/** Include annotations (default: true) */
|
|
66
|
+
includeAnnotations?: boolean;
|
|
67
|
+
/** Compress output (default: false) */
|
|
68
|
+
compress?: boolean;
|
|
69
|
+
}
|
|
70
|
+
/** Options for deserialization */
|
|
71
|
+
export interface DeserializeOptions {
|
|
72
|
+
/** Merge with existing state instead of replacing (default: false) */
|
|
73
|
+
merge?: boolean;
|
|
74
|
+
/** Skip data loading (default: false) */
|
|
75
|
+
skipData?: boolean;
|
|
76
|
+
/** Skip annotations (default: false) */
|
|
77
|
+
skipAnnotations?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Encode Float32Array to base64 string
|
|
81
|
+
*/
|
|
82
|
+
export declare function encodeFloat32Array(arr: Float32Array | Float64Array): string;
|
|
83
|
+
/**
|
|
84
|
+
* Decode base64 string to Float32Array
|
|
85
|
+
*/
|
|
86
|
+
export declare function decodeFloat32Array(base64: string): Float32Array;
|
|
87
|
+
/**
|
|
88
|
+
* Compress string using simple LZ-based compression
|
|
89
|
+
*/
|
|
90
|
+
export declare function compressString(str: string): string;
|
|
91
|
+
/**
|
|
92
|
+
* Decompress string
|
|
93
|
+
*/
|
|
94
|
+
export declare function decompressString(compressed: string): string;
|
|
95
|
+
/**
|
|
96
|
+
* Convert chart state to URL-safe hash
|
|
97
|
+
*/
|
|
98
|
+
export declare function stateToUrlHash(state: ChartState, compress?: boolean): string;
|
|
99
|
+
/**
|
|
100
|
+
* Parse chart state from URL hash
|
|
101
|
+
*/
|
|
102
|
+
export declare function urlHashToState(hash: string, compressed?: boolean): ChartState | null;
|
|
103
|
+
/**
|
|
104
|
+
* Validate a chart state object
|
|
105
|
+
*/
|
|
106
|
+
export declare function validateChartState(state: unknown): state is ChartState;
|
|
107
|
+
/** State snapshot for undo/redo */
|
|
108
|
+
export interface StateSnapshot {
|
|
109
|
+
timestamp: number;
|
|
110
|
+
viewBounds: Bounds;
|
|
111
|
+
label?: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Simple state history manager for undo/redo
|
|
115
|
+
*/
|
|
116
|
+
export declare class StateHistory {
|
|
117
|
+
private history;
|
|
118
|
+
private currentIndex;
|
|
119
|
+
private maxSize;
|
|
120
|
+
constructor(maxSize?: number);
|
|
121
|
+
/**
|
|
122
|
+
* Push a new state to history
|
|
123
|
+
*/
|
|
124
|
+
push(snapshot: StateSnapshot): void;
|
|
125
|
+
/**
|
|
126
|
+
* Undo to previous state
|
|
127
|
+
*/
|
|
128
|
+
undo(): StateSnapshot | null;
|
|
129
|
+
/**
|
|
130
|
+
* Redo to next state
|
|
131
|
+
*/
|
|
132
|
+
redo(): StateSnapshot | null;
|
|
133
|
+
/**
|
|
134
|
+
* Check if undo is available
|
|
135
|
+
*/
|
|
136
|
+
canUndo(): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Check if redo is available
|
|
139
|
+
*/
|
|
140
|
+
canRedo(): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Get current state
|
|
143
|
+
*/
|
|
144
|
+
current(): StateSnapshot | null;
|
|
145
|
+
/**
|
|
146
|
+
* Clear history
|
|
147
|
+
*/
|
|
148
|
+
clear(): void;
|
|
149
|
+
/**
|
|
150
|
+
* Get history length
|
|
151
|
+
*/
|
|
152
|
+
get length(): number;
|
|
153
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { DataPoint } from './types';
|
|
2
|
+
|
|
3
|
+
export type OverflowStrategy = 'drop-oldest' | 'drop-newest' | 'pause' | 'sample' | 'block';
|
|
4
|
+
export interface BackpressureConfig {
|
|
5
|
+
/** Maximum buffer size before triggering backpressure (default: 10000) */
|
|
6
|
+
maxBuffer: number;
|
|
7
|
+
/** Warning threshold as fraction of maxBuffer (default: 0.7) */
|
|
8
|
+
warningThreshold?: number;
|
|
9
|
+
/** Critical threshold as fraction of maxBuffer (default: 0.9) */
|
|
10
|
+
criticalThreshold?: number;
|
|
11
|
+
/** Overflow handling strategy (default: 'drop-oldest') */
|
|
12
|
+
strategy: OverflowStrategy;
|
|
13
|
+
/** For 'sample' strategy: keep every Nth point (default: 2) */
|
|
14
|
+
sampleRate?: number;
|
|
15
|
+
/** Callback when pressure level changes */
|
|
16
|
+
onPressure?: (stats: PressureStats) => void;
|
|
17
|
+
/** Callback when buffer overflows */
|
|
18
|
+
onOverflow?: (droppedCount: number) => void;
|
|
19
|
+
/** Callback when back to normal */
|
|
20
|
+
onRecovery?: () => void;
|
|
21
|
+
}
|
|
22
|
+
export interface PressureStats {
|
|
23
|
+
/** Current buffer fill level (0-1) */
|
|
24
|
+
fillLevel: number;
|
|
25
|
+
/** Pressure state */
|
|
26
|
+
state: 'normal' | 'warning' | 'critical' | 'overflow';
|
|
27
|
+
/** Current buffer size */
|
|
28
|
+
bufferSize: number;
|
|
29
|
+
/** Maximum buffer size */
|
|
30
|
+
maxBuffer: number;
|
|
31
|
+
/** Points dropped due to overflow */
|
|
32
|
+
droppedCount: number;
|
|
33
|
+
/** Points sampled/skipped */
|
|
34
|
+
sampledCount: number;
|
|
35
|
+
/** Incoming rate (points per second) */
|
|
36
|
+
incomingRate: number;
|
|
37
|
+
/** Outgoing rate (points per second) */
|
|
38
|
+
outgoingRate: number;
|
|
39
|
+
/** Whether stream is paused due to backpressure */
|
|
40
|
+
isPaused: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface BufferHealth {
|
|
43
|
+
/** Overall health score (0-100) */
|
|
44
|
+
score: number;
|
|
45
|
+
/** Health status */
|
|
46
|
+
status: 'healthy' | 'degraded' | 'critical';
|
|
47
|
+
/** Recommendations */
|
|
48
|
+
recommendations: string[];
|
|
49
|
+
}
|
|
50
|
+
export declare class CircularBuffer<T> {
|
|
51
|
+
private buffer;
|
|
52
|
+
private head;
|
|
53
|
+
private tail;
|
|
54
|
+
private count;
|
|
55
|
+
private readonly capacity;
|
|
56
|
+
constructor(capacity: number);
|
|
57
|
+
/**
|
|
58
|
+
* Add item to buffer
|
|
59
|
+
* @returns true if item was added, false if buffer was full
|
|
60
|
+
*/
|
|
61
|
+
push(item: T): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Add item, overwriting oldest if full
|
|
64
|
+
* @returns the overwritten item, or undefined
|
|
65
|
+
*/
|
|
66
|
+
pushOverwrite(item: T): T | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Remove and return oldest item
|
|
69
|
+
*/
|
|
70
|
+
shift(): T | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Remove and return multiple items
|
|
73
|
+
*/
|
|
74
|
+
shiftMany(n: number): T[];
|
|
75
|
+
/**
|
|
76
|
+
* Peek at oldest item without removing
|
|
77
|
+
*/
|
|
78
|
+
peek(): T | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Get all items as array
|
|
81
|
+
*/
|
|
82
|
+
toArray(): T[];
|
|
83
|
+
/**
|
|
84
|
+
* Clear the buffer
|
|
85
|
+
*/
|
|
86
|
+
clear(): void;
|
|
87
|
+
/**
|
|
88
|
+
* Get current size
|
|
89
|
+
*/
|
|
90
|
+
size(): number;
|
|
91
|
+
/**
|
|
92
|
+
* Check if buffer is full
|
|
93
|
+
*/
|
|
94
|
+
isFull(): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Check if buffer is empty
|
|
97
|
+
*/
|
|
98
|
+
isEmpty(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Get fill level (0-1)
|
|
101
|
+
*/
|
|
102
|
+
fillLevel(): number;
|
|
103
|
+
/**
|
|
104
|
+
* Get capacity
|
|
105
|
+
*/
|
|
106
|
+
getCapacity(): number;
|
|
107
|
+
}
|
|
108
|
+
export declare class BackpressureManager {
|
|
109
|
+
private config;
|
|
110
|
+
private buffers;
|
|
111
|
+
private stats;
|
|
112
|
+
private paused;
|
|
113
|
+
private sampleCounter;
|
|
114
|
+
private incomingHistory;
|
|
115
|
+
private outgoingHistory;
|
|
116
|
+
private lastRateUpdate;
|
|
117
|
+
private currentIncoming;
|
|
118
|
+
private currentOutgoing;
|
|
119
|
+
constructor(config: BackpressureConfig);
|
|
120
|
+
/**
|
|
121
|
+
* Add points to the buffer with backpressure handling
|
|
122
|
+
*/
|
|
123
|
+
push(seriesId: string, points: DataPoint[]): number;
|
|
124
|
+
/**
|
|
125
|
+
* Consume points from buffer
|
|
126
|
+
*/
|
|
127
|
+
consume(seriesId: string, count?: number): DataPoint[];
|
|
128
|
+
/**
|
|
129
|
+
* Consume all points from buffer
|
|
130
|
+
*/
|
|
131
|
+
consumeAll(seriesId: string): DataPoint[];
|
|
132
|
+
/**
|
|
133
|
+
* Get current pressure stats for a series
|
|
134
|
+
*/
|
|
135
|
+
getPressureStats(seriesId: string): PressureStats;
|
|
136
|
+
/**
|
|
137
|
+
* Get aggregate stats for all series
|
|
138
|
+
*/
|
|
139
|
+
getGlobalStats(): PressureStats;
|
|
140
|
+
/**
|
|
141
|
+
* Get buffer health assessment
|
|
142
|
+
*/
|
|
143
|
+
getHealth(): BufferHealth;
|
|
144
|
+
/**
|
|
145
|
+
* Check if paused due to backpressure
|
|
146
|
+
*/
|
|
147
|
+
isPaused(): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Resume if paused
|
|
150
|
+
*/
|
|
151
|
+
resume(): void;
|
|
152
|
+
/**
|
|
153
|
+
* Clear all buffers
|
|
154
|
+
*/
|
|
155
|
+
clear(seriesId?: string): void;
|
|
156
|
+
/**
|
|
157
|
+
* Update configuration
|
|
158
|
+
*/
|
|
159
|
+
updateConfig(config: Partial<BackpressureConfig>): void;
|
|
160
|
+
/**
|
|
161
|
+
* Get current configuration
|
|
162
|
+
*/
|
|
163
|
+
getConfig(): BackpressureConfig;
|
|
164
|
+
private checkPressure;
|
|
165
|
+
private updateRates;
|
|
166
|
+
private getAverageRate;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Create a backpressure manager with default settings
|
|
170
|
+
*/
|
|
171
|
+
export declare function createBackpressureManager(maxBuffer?: number, strategy?: OverflowStrategy): BackpressureManager;
|
|
172
|
+
/**
|
|
173
|
+
* Create a high-performance backpressure manager optimized for real-time
|
|
174
|
+
*/
|
|
175
|
+
export declare function createRealtimeBackpressure(maxBuffer?: number): BackpressureManager;
|
|
176
|
+
/**
|
|
177
|
+
* Create a lossless backpressure manager (for when data loss is unacceptable)
|
|
178
|
+
*/
|
|
179
|
+
export declare function createLosslessBackpressure(maxBuffer?: number): BackpressureManager;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DataPoint, WebSocketStream } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Mock WebSocket stream for testing
|
|
5
|
+
*/
|
|
6
|
+
export declare function createMockStream(config: {
|
|
7
|
+
interval?: number;
|
|
8
|
+
generatePoint?: () => DataPoint;
|
|
9
|
+
}): WebSocketStream & {
|
|
10
|
+
start: () => void;
|
|
11
|
+
stop: () => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebSocket Streaming Types
|
|
3
|
+
*/
|
|
4
|
+
export interface WebSocketStreamConfig {
|
|
5
|
+
/** WebSocket URL */
|
|
6
|
+
url: string;
|
|
7
|
+
/** Reconnection attempts (default: 5) */
|
|
8
|
+
maxReconnectAttempts?: number;
|
|
9
|
+
/** Delay between reconnection attempts in ms (default: 1000) */
|
|
10
|
+
reconnectDelay?: number;
|
|
11
|
+
/** Buffer size before flushing to chart (default: 10) */
|
|
12
|
+
bufferSize?: number;
|
|
13
|
+
/** Throttle updates in ms (default: 16 for 60fps) */
|
|
14
|
+
throttleMs?: number;
|
|
15
|
+
/** Transform incoming message to data point */
|
|
16
|
+
parseMessage?: (data: unknown) => DataPoint | DataPoint[] | null;
|
|
17
|
+
/** Called on connection open */
|
|
18
|
+
onConnect?: () => void;
|
|
19
|
+
/** Called on connection close */
|
|
20
|
+
onDisconnect?: (event: CloseEvent) => void;
|
|
21
|
+
/** Called on error */
|
|
22
|
+
onError?: (error: Event) => void;
|
|
23
|
+
/** Called when reconnecting */
|
|
24
|
+
onReconnect?: (attempt: number) => void;
|
|
25
|
+
}
|
|
26
|
+
export interface DataPoint {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
seriesId?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface WebSocketStream {
|
|
32
|
+
/** Connect to the WebSocket server */
|
|
33
|
+
connect(): void;
|
|
34
|
+
/** Disconnect from the WebSocket server */
|
|
35
|
+
disconnect(): void;
|
|
36
|
+
/** Check if connected */
|
|
37
|
+
isConnected(): boolean;
|
|
38
|
+
/** Get connection state */
|
|
39
|
+
getState(): WebSocketState;
|
|
40
|
+
/** Subscribe to data for a specific series */
|
|
41
|
+
subscribe(seriesId: string, callback: (points: DataPoint[]) => void): () => void;
|
|
42
|
+
/** Unsubscribe all listeners */
|
|
43
|
+
unsubscribeAll(): void;
|
|
44
|
+
/** Send a message to the WebSocket server */
|
|
45
|
+
send(message: unknown): void;
|
|
46
|
+
/** Get statistics */
|
|
47
|
+
getStats(): StreamStats;
|
|
48
|
+
}
|
|
49
|
+
export interface StreamStats {
|
|
50
|
+
messagesReceived: number;
|
|
51
|
+
pointsProcessed: number;
|
|
52
|
+
reconnectCount: number;
|
|
53
|
+
lastMessageTime: number | null;
|
|
54
|
+
connectionUptime: number;
|
|
55
|
+
bufferSize: number;
|
|
56
|
+
}
|
|
57
|
+
export type WebSocketState = 'connecting' | 'connected' | 'disconnected' | 'reconnecting' | 'error';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DataPoint, WebSocketStream } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default message parser - expects { x, y, seriesId? } or array of same
|
|
5
|
+
*/
|
|
6
|
+
export declare function defaultParser(data: unknown): DataPoint | DataPoint[] | null;
|
|
7
|
+
/**
|
|
8
|
+
* Helper to create a parser for custom message formats
|
|
9
|
+
*/
|
|
10
|
+
export declare function createMessageParser<T>(transform: (message: T) => DataPoint | DataPoint[] | null): (data: unknown) => DataPoint | DataPoint[] | null;
|
|
11
|
+
/**
|
|
12
|
+
* Helper to connect a WebSocket stream to a chart
|
|
13
|
+
*/
|
|
14
|
+
export declare function connectStreamToChart(stream: WebSocketStream, chart: {
|
|
15
|
+
appendData: (seriesId: string, data: {
|
|
16
|
+
x: Float32Array;
|
|
17
|
+
y: Float32Array;
|
|
18
|
+
}) => void;
|
|
19
|
+
}, seriesIds?: string[]): () => void;
|