@forgecharts/sdk 1.1.27 → 1.1.29
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/dist/__tests__/backwardCompatibility.test.d.ts +14 -0
- package/dist/__tests__/backwardCompatibility.test.d.ts.map +1 -0
- package/dist/__tests__/candleInvariant.test.d.ts +20 -0
- package/dist/__tests__/candleInvariant.test.d.ts.map +1 -0
- package/dist/__tests__/public-api-surface.d.ts +13 -0
- package/dist/__tests__/public-api-surface.d.ts.map +1 -0
- package/dist/__tests__/timeframeBoundary.test.d.ts +17 -0
- package/dist/__tests__/timeframeBoundary.test.d.ts.map +1 -0
- package/dist/api/DrawingManager.d.ts +20 -0
- package/dist/api/DrawingManager.d.ts.map +1 -0
- package/dist/api/EventBus.d.ts +19 -0
- package/dist/api/EventBus.d.ts.map +1 -0
- package/dist/api/IndicatorDAG.d.ts +85 -0
- package/dist/api/IndicatorDAG.d.ts.map +1 -0
- package/dist/api/IndicatorRegistry.d.ts +22 -0
- package/dist/api/IndicatorRegistry.d.ts.map +1 -0
- package/dist/api/LayoutManager.d.ts +30 -0
- package/dist/api/LayoutManager.d.ts.map +1 -0
- package/dist/api/PaneManager.d.ts +42 -0
- package/dist/api/PaneManager.d.ts.map +1 -0
- package/dist/api/ReferenceAPI.d.ts +78 -0
- package/dist/api/ReferenceAPI.d.ts.map +1 -0
- package/dist/api/TChart.d.ts +345 -0
- package/dist/api/TChart.d.ts.map +1 -0
- package/{src/api/createChart.ts → dist/api/createChart.d.ts} +2 -7
- package/dist/api/createChart.d.ts.map +1 -0
- package/dist/api/drawing tools/fib gann menu/fibRetracement.d.ts +4 -0
- package/dist/api/drawing tools/fib gann menu/fibRetracement.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/crossLine.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/crossLine.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/disjointChannel.d.ts +17 -0
- package/dist/api/drawing tools/lines menu/disjointChannel.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/extendedLine.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/extendedLine.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/flatTopBottom.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/flatTopBottom.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/horizontal.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/horizontal.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/horizontalRay.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/horizontalRay.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/infoLine.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/infoLine.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/insidePitchfork.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/insidePitchfork.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/parallelChannel.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/parallelChannel.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/pitchfork.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/pitchfork.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/ray.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/ray.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/regressionTrend.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/regressionTrend.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/schiffPitchfork.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/schiffPitchfork.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/trendAngle.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/trendAngle.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/trendline.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/trendline.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/vertical.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/vertical.d.ts.map +1 -0
- package/{src/api/drawing tools/pointers menu/crosshair.ts → dist/api/drawing tools/pointers menu/crosshair.d.ts } +8 -9
- package/dist/api/drawing tools/pointers menu/crosshair.d.ts.map +1 -0
- package/dist/api/drawing tools/pointers menu/cursor.d.ts +15 -0
- package/dist/api/drawing tools/pointers menu/cursor.d.ts.map +1 -0
- package/{src/api/drawing tools/pointers menu/demonstration.ts → dist/api/drawing tools/pointers menu/demonstration.d.ts } +12 -17
- package/dist/api/drawing tools/pointers menu/demonstration.d.ts.map +1 -0
- package/{src/api/drawing tools/pointers menu/dot.ts → dist/api/drawing tools/pointers menu/dot.d.ts } +10 -13
- package/dist/api/drawing tools/pointers menu/dot.d.ts.map +1 -0
- package/dist/api/drawing tools/shapes menu/rectangle.d.ts +4 -0
- package/dist/api/drawing tools/shapes menu/rectangle.d.ts.map +1 -0
- package/dist/api/drawing tools/shapes menu/text.d.ts +4 -0
- package/dist/api/drawing tools/shapes menu/text.d.ts.map +1 -0
- package/dist/api/drawingUtils.d.ts +22 -0
- package/dist/api/drawingUtils.d.ts.map +1 -0
- package/dist/core/CanvasLayer.d.ts +26 -0
- package/dist/core/CanvasLayer.d.ts.map +1 -0
- package/dist/core/Chart.d.ts +164 -0
- package/dist/core/Chart.d.ts.map +1 -0
- package/dist/core/CoordTransform.d.ts +168 -0
- package/dist/core/CoordTransform.d.ts.map +1 -0
- package/dist/core/Crosshair.d.ts +30 -0
- package/dist/core/Crosshair.d.ts.map +1 -0
- package/dist/core/IndicatorEngine.d.ts +51 -0
- package/dist/core/IndicatorEngine.d.ts.map +1 -0
- package/dist/core/InteractionManager.d.ts +197 -0
- package/dist/core/InteractionManager.d.ts.map +1 -0
- package/dist/core/PriceScale.d.ts +27 -0
- package/dist/core/PriceScale.d.ts.map +1 -0
- package/dist/core/Series.d.ts +40 -0
- package/dist/core/Series.d.ts.map +1 -0
- package/dist/core/TimeScale.d.ts +43 -0
- package/dist/core/TimeScale.d.ts.map +1 -0
- package/dist/datafeed/DatafeedConnector.d.ts +89 -0
- package/dist/datafeed/DatafeedConnector.d.ts.map +1 -0
- package/dist/engine/CandleEngine.d.ts +207 -0
- package/dist/engine/CandleEngine.d.ts.map +1 -0
- package/dist/engine/__tests__/CandleEngine.test.d.ts +2 -0
- package/dist/engine/__tests__/CandleEngine.test.d.ts.map +1 -0
- package/dist/engine/candleInvariants.d.ts +66 -0
- package/dist/engine/candleInvariants.d.ts.map +1 -0
- package/{src/engine/mergeUtils.ts → dist/engine/mergeUtils.d.ts} +15 -52
- package/dist/engine/mergeUtils.d.ts.map +1 -0
- package/dist/engine/timeframeUtils.d.ts +80 -0
- package/dist/engine/timeframeUtils.d.ts.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8101 -0
- package/dist/index.js.map +1 -0
- package/{src/internal.ts → dist/internal.d.ts} +1 -13
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +8852 -0
- package/dist/internal.js.map +1 -0
- package/dist/licensing/ChartRuntimeResolver.d.ts +233 -0
- package/dist/licensing/ChartRuntimeResolver.d.ts.map +1 -0
- package/dist/licensing/LicenseManager.d.ts +55 -0
- package/dist/licensing/LicenseManager.d.ts.map +1 -0
- package/dist/licensing/__tests__/ChartRuntimeResolver.test.d.ts +13 -0
- package/dist/licensing/__tests__/ChartRuntimeResolver.test.d.ts.map +1 -0
- package/dist/licensing/__tests__/LicenseManager.test.d.ts +12 -0
- package/dist/licensing/__tests__/LicenseManager.test.d.ts.map +1 -0
- package/dist/licensing/licenseTypes.d.ts +18 -0
- package/dist/licensing/licenseTypes.d.ts.map +1 -0
- package/dist/pine/PineCompiler.d.ts +35 -0
- package/dist/pine/PineCompiler.d.ts.map +1 -0
- package/dist/pine/diagnostics.d.ts +20 -0
- package/dist/pine/diagnostics.d.ts.map +1 -0
- package/{src/pine/index.ts → dist/pine/index.d.ts} +4 -3
- package/dist/pine/index.d.ts.map +1 -0
- package/dist/pine/pine-ast.d.ts +142 -0
- package/dist/pine/pine-ast.d.ts.map +1 -0
- package/dist/pine/pine-lexer.d.ts +41 -0
- package/dist/pine/pine-lexer.d.ts.map +1 -0
- package/dist/pine/pine-parser.d.ts +51 -0
- package/dist/pine/pine-parser.d.ts.map +1 -0
- package/dist/pine/pine-transpiler.d.ts +33 -0
- package/dist/pine/pine-transpiler.d.ts.map +1 -0
- package/dist/pixi/LayerName.d.ts +18 -0
- package/dist/pixi/LayerName.d.ts.map +1 -0
- package/dist/pixi/PixiCandlestickRenderer.d.ts +23 -0
- package/dist/pixi/PixiCandlestickRenderer.d.ts.map +1 -0
- package/dist/pixi/PixiChart.d.ts +72 -0
- package/dist/pixi/PixiChart.d.ts.map +1 -0
- package/dist/pixi/PixiCrosshairRenderer.d.ts +29 -0
- package/dist/pixi/PixiCrosshairRenderer.d.ts.map +1 -0
- package/dist/pixi/PixiDrawingRenderer.d.ts +17 -0
- package/dist/pixi/PixiDrawingRenderer.d.ts.map +1 -0
- package/dist/pixi/PixiGridRenderer.d.ts +22 -0
- package/dist/pixi/PixiGridRenderer.d.ts.map +1 -0
- package/dist/pixi/PixiLayerManager.d.ts +56 -0
- package/dist/pixi/PixiLayerManager.d.ts.map +1 -0
- package/dist/react/canvas/ChartCanvas.d.ts +85 -0
- package/dist/react/canvas/ChartCanvas.d.ts.map +1 -0
- package/dist/react/canvas/ChartContextMenu.d.ts +18 -0
- package/dist/react/canvas/ChartContextMenu.d.ts.map +1 -0
- package/dist/react/canvas/ChartSettingsDialog.d.ts +25 -0
- package/dist/react/canvas/ChartSettingsDialog.d.ts.map +1 -0
- package/dist/react/canvas/IndicatorLabel.d.ts +21 -0
- package/dist/react/canvas/IndicatorLabel.d.ts.map +1 -0
- package/dist/react/canvas/IndicatorPane.d.ts +32 -0
- package/dist/react/canvas/IndicatorPane.d.ts.map +1 -0
- package/dist/react/canvas/PointerOverlay.d.ts +23 -0
- package/dist/react/canvas/PointerOverlay.d.ts.map +1 -0
- package/dist/react/canvas/toolbars/LeftToolbar.d.ts +19 -0
- package/dist/react/canvas/toolbars/LeftToolbar.d.ts.map +1 -0
- package/dist/react/hooks/useChartCapabilities.d.ts +21 -0
- package/dist/react/hooks/useChartCapabilities.d.ts.map +1 -0
- package/{src/react/index.ts → dist/react/index.d.ts} +2 -23
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +11559 -0
- package/dist/react/index.js.map +1 -0
- package/{src/react/internal.ts → dist/react/internal.d.ts} +2 -26
- package/dist/react/internal.d.ts.map +1 -0
- package/dist/react/internal.js +12148 -0
- package/dist/react/internal.js.map +1 -0
- package/dist/react/shell/ManagedAppShell.d.ts +91 -0
- package/dist/react/shell/ManagedAppShell.d.ts.map +1 -0
- package/dist/react/trading/TradingBridge.d.ts +86 -0
- package/dist/react/trading/TradingBridge.d.ts.map +1 -0
- package/dist/react/workspace/ChartWorkspace.d.ts +73 -0
- package/dist/react/workspace/ChartWorkspace.d.ts.map +1 -0
- package/dist/react/workspace/FloatingPanel.d.ts +18 -0
- package/dist/react/workspace/FloatingPanel.d.ts.map +1 -0
- package/dist/react/workspace/IndicatorsDialog.d.ts +8 -0
- package/dist/react/workspace/IndicatorsDialog.d.ts.map +1 -0
- package/dist/react/workspace/LayoutMenu.d.ts +33 -0
- package/dist/react/workspace/LayoutMenu.d.ts.map +1 -0
- package/dist/react/workspace/SymbolSearchDialog.d.ts +10 -0
- package/dist/react/workspace/SymbolSearchDialog.d.ts.map +1 -0
- package/dist/react/workspace/TabBar.d.ts +17 -0
- package/dist/react/workspace/TabBar.d.ts.map +1 -0
- package/dist/react/workspace/toolbars/BottomToolbar.d.ts +19 -0
- package/dist/react/workspace/toolbars/BottomToolbar.d.ts.map +1 -0
- package/dist/react/workspace/toolbars/RightToolbar.d.ts +8 -0
- package/dist/react/workspace/toolbars/RightToolbar.d.ts.map +1 -0
- package/dist/react/workspace/toolbars/TopToolbar.d.ts +41 -0
- package/dist/react/workspace/toolbars/TopToolbar.d.ts.map +1 -0
- package/dist/renderers/CandlestickRenderer.d.ts +13 -0
- package/dist/renderers/CandlestickRenderer.d.ts.map +1 -0
- package/dist/renderers/HistogramRenderer.d.ts +11 -0
- package/dist/renderers/HistogramRenderer.d.ts.map +1 -0
- package/dist/renderers/LineRenderer.d.ts +12 -0
- package/dist/renderers/LineRenderer.d.ts.map +1 -0
- package/dist/theme/colors.d.ts +4 -0
- package/dist/theme/colors.d.ts.map +1 -0
- package/dist/tools/barDivergenceCheck.d.ts +120 -0
- package/dist/tools/barDivergenceCheck.d.ts.map +1 -0
- package/dist/trading/TradingOverlayStore.d.ts +86 -0
- package/dist/trading/TradingOverlayStore.d.ts.map +1 -0
- package/dist/trading/UnmanagedIngestion.d.ts +91 -0
- package/dist/trading/UnmanagedIngestion.d.ts.map +1 -0
- package/dist/trading/__tests__/ManagedTradingController.test.d.ts +18 -0
- package/dist/trading/__tests__/ManagedTradingController.test.d.ts.map +1 -0
- package/dist/trading/__tests__/TradingOverlayStore.test.d.ts +16 -0
- package/dist/trading/__tests__/TradingOverlayStore.test.d.ts.map +1 -0
- package/dist/trading/__tests__/UnmanagedIngestion.test.d.ts +16 -0
- package/dist/trading/__tests__/UnmanagedIngestion.test.d.ts.map +1 -0
- package/dist/trading/managed/ManagedTradingController.d.ts +110 -0
- package/dist/trading/managed/ManagedTradingController.d.ts.map +1 -0
- package/dist/trading/managed/managedCapabilities.d.ts +45 -0
- package/dist/trading/managed/managedCapabilities.d.ts.map +1 -0
- package/dist/trading/managed/managedTypes.d.ts +122 -0
- package/dist/trading/managed/managedTypes.d.ts.map +1 -0
- package/dist/trading/tradingTypes.d.ts +89 -0
- package/dist/trading/tradingTypes.d.ts.map +1 -0
- package/dist/tscript/TScriptIndicator.d.ts +41 -0
- package/dist/tscript/TScriptIndicator.d.ts.map +1 -0
- package/dist/tscript/ast.d.ts +89 -0
- package/dist/tscript/ast.d.ts.map +1 -0
- package/dist/tscript/lexer.d.ts +36 -0
- package/dist/tscript/lexer.d.ts.map +1 -0
- package/dist/tscript/parser.d.ts +50 -0
- package/dist/tscript/parser.d.ts.map +1 -0
- package/dist/tscript/runtime.d.ts +123 -0
- package/dist/tscript/runtime.d.ts.map +1 -0
- package/dist/tscript/series.d.ts +49 -0
- package/dist/tscript/series.d.ts.map +1 -0
- package/dist/types/IChart.d.ts +48 -0
- package/dist/types/IChart.d.ts.map +1 -0
- package/{src/types/IRenderer.ts → dist/types/IRenderer.d.ts} +2 -8
- package/dist/types/IRenderer.d.ts.map +1 -0
- package/dist/types/ISeries.d.ts +26 -0
- package/dist/types/ISeries.d.ts.map +1 -0
- package/package.json +5 -1
- package/src/__tests__/backwardCompatibility.test.ts +0 -191
- package/src/__tests__/candleInvariant.test.ts +0 -500
- package/src/__tests__/public-api-surface.ts +0 -76
- package/src/__tests__/timeframeBoundary.test.ts +0 -583
- package/src/api/DrawingManager.ts +0 -188
- package/src/api/EventBus.ts +0 -53
- package/src/api/IndicatorDAG.ts +0 -389
- package/src/api/IndicatorRegistry.ts +0 -47
- package/src/api/LayoutManager.ts +0 -72
- package/src/api/PaneManager.ts +0 -129
- package/src/api/ReferenceAPI.ts +0 -195
- package/src/api/TChart.ts +0 -881
- package/src/api/drawing tools/fib gann menu/fibRetracement.ts +0 -27
- package/src/api/drawing tools/lines menu/crossLine.ts +0 -21
- package/src/api/drawing tools/lines menu/disjointChannel.ts +0 -74
- package/src/api/drawing tools/lines menu/extendedLine.ts +0 -22
- package/src/api/drawing tools/lines menu/flatTopBottom.ts +0 -45
- package/src/api/drawing tools/lines menu/horizontal.ts +0 -24
- package/src/api/drawing tools/lines menu/horizontalRay.ts +0 -25
- package/src/api/drawing tools/lines menu/infoLine.ts +0 -127
- package/src/api/drawing tools/lines menu/insidePitchfork.ts +0 -21
- package/src/api/drawing tools/lines menu/modifiedSchiffPitchfork.ts +0 -18
- package/src/api/drawing tools/lines menu/parallelChannel.ts +0 -47
- package/src/api/drawing tools/lines menu/pitchfork.ts +0 -15
- package/src/api/drawing tools/lines menu/ray.ts +0 -28
- package/src/api/drawing tools/lines menu/regressionTrend.ts +0 -157
- package/src/api/drawing tools/lines menu/schiffPitchfork.ts +0 -18
- package/src/api/drawing tools/lines menu/trendAngle.ts +0 -64
- package/src/api/drawing tools/lines menu/trendline.ts +0 -16
- package/src/api/drawing tools/lines menu/vertical.ts +0 -16
- package/src/api/drawing tools/pointers menu/cursor.ts +0 -16
- package/src/api/drawing tools/shapes menu/rectangle.ts +0 -24
- package/src/api/drawing tools/shapes menu/text.ts +0 -30
- package/src/api/drawingUtils.ts +0 -82
- package/src/core/CanvasLayer.ts +0 -77
- package/src/core/Chart.ts +0 -917
- package/src/core/CoordTransform.ts +0 -282
- package/src/core/Crosshair.ts +0 -207
- package/src/core/IndicatorEngine.ts +0 -216
- package/src/core/InteractionManager.ts +0 -899
- package/src/core/PriceScale.ts +0 -133
- package/src/core/Series.ts +0 -132
- package/src/core/TimeScale.ts +0 -175
- package/src/datafeed/DatafeedConnector.ts +0 -300
- package/src/engine/CandleEngine.ts +0 -458
- package/src/engine/__tests__/CandleEngine.test.ts +0 -402
- package/src/engine/candleInvariants.ts +0 -172
- package/src/engine/timeframeUtils.ts +0 -118
- package/src/index.ts +0 -190
- package/src/licensing/ChartRuntimeResolver.ts +0 -380
- package/src/licensing/LicenseManager.ts +0 -131
- package/src/licensing/__tests__/ChartRuntimeResolver.test.ts +0 -207
- package/src/licensing/__tests__/LicenseManager.test.ts +0 -180
- package/src/licensing/licenseTypes.ts +0 -19
- package/src/pine/PineCompiler.ts +0 -68
- package/src/pine/diagnostics.ts +0 -30
- package/src/pine/pine-ast.ts +0 -163
- package/src/pine/pine-lexer.ts +0 -265
- package/src/pine/pine-parser.ts +0 -439
- package/src/pine/pine-transpiler.ts +0 -301
- package/src/pixi/LayerName.ts +0 -35
- package/src/pixi/PixiCandlestickRenderer.ts +0 -125
- package/src/pixi/PixiChart.ts +0 -425
- package/src/pixi/PixiCrosshairRenderer.ts +0 -134
- package/src/pixi/PixiDrawingRenderer.ts +0 -121
- package/src/pixi/PixiGridRenderer.ts +0 -136
- package/src/pixi/PixiLayerManager.ts +0 -102
- package/src/react/canvas/ChartCanvas.tsx +0 -984
- package/src/react/canvas/ChartContextMenu.tsx +0 -60
- package/src/react/canvas/ChartSettingsDialog.tsx +0 -133
- package/src/react/canvas/IndicatorLabel.tsx +0 -347
- package/src/react/canvas/IndicatorPane.tsx +0 -503
- package/src/react/canvas/PointerOverlay.tsx +0 -126
- package/src/react/canvas/toolbars/LeftToolbar.tsx +0 -1096
- package/src/react/hooks/useChartCapabilities.ts +0 -76
- package/src/react/shell/ManagedAppShell.tsx +0 -699
- package/src/react/trading/TradingBridge.ts +0 -156
- package/src/react/workspace/ChartWorkspace.tsx +0 -228
- package/src/react/workspace/FloatingPanel.tsx +0 -131
- package/src/react/workspace/IndicatorsDialog.tsx +0 -246
- package/src/react/workspace/LayoutMenu.tsx +0 -345
- package/src/react/workspace/SymbolSearchDialog.tsx +0 -377
- package/src/react/workspace/TabBar.tsx +0 -87
- package/src/react/workspace/toolbars/BottomToolbar.tsx +0 -372
- package/src/react/workspace/toolbars/RightToolbar.tsx +0 -46
- package/src/react/workspace/toolbars/TopToolbar.tsx +0 -431
- package/src/renderers/CandlestickRenderer.ts +0 -130
- package/src/renderers/HistogramRenderer.ts +0 -63
- package/src/renderers/LineRenderer.ts +0 -77
- package/src/theme/colors.ts +0 -21
- package/src/tools/barDivergenceCheck.ts +0 -305
- package/src/trading/TradingOverlayStore.ts +0 -161
- package/src/trading/UnmanagedIngestion.ts +0 -156
- package/src/trading/__tests__/ManagedTradingController.test.ts +0 -338
- package/src/trading/__tests__/TradingOverlayStore.test.ts +0 -323
- package/src/trading/__tests__/UnmanagedIngestion.test.ts +0 -205
- package/src/trading/managed/ManagedTradingController.ts +0 -292
- package/src/trading/managed/managedCapabilities.ts +0 -98
- package/src/trading/managed/managedTypes.ts +0 -151
- package/src/trading/tradingTypes.ts +0 -135
- package/src/tscript/TScriptIndicator.ts +0 -54
- package/src/tscript/ast.ts +0 -105
- package/src/tscript/lexer.ts +0 -190
- package/src/tscript/parser.ts +0 -334
- package/src/tscript/runtime.ts +0 -525
- package/src/tscript/series.ts +0 -84
- package/src/types/IChart.ts +0 -56
- package/src/types/ISeries.ts +0 -30
- package/tsconfig.json +0 -23
- package/tsup.config.ts +0 -16
- package/vitest.config.ts +0 -25
|
@@ -11,25 +11,20 @@
|
|
|
11
11
|
* The SDK crosshair (`Chart.setCrosshairEnabled`) is NOT active in this mode;
|
|
12
12
|
* all visuals come from the SVG overlay.
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
export const
|
|
16
|
-
export const DEMONSTRATION_STYLE = 'none' as const;
|
|
17
|
-
|
|
14
|
+
export declare const DEMONSTRATION_LABEL = "Demonstration";
|
|
15
|
+
export declare const DEMONSTRATION_STYLE: "none";
|
|
18
16
|
/** Radius (px) of the large highlight circle drawn around the cursor. */
|
|
19
|
-
export const DEMONSTRATION_RADIUS = 44;
|
|
20
|
-
|
|
17
|
+
export declare const DEMONSTRATION_RADIUS = 44;
|
|
21
18
|
/** Fill colour of the demonstration circle. */
|
|
22
|
-
export const DEMONSTRATION_FILL
|
|
23
|
-
|
|
19
|
+
export declare const DEMONSTRATION_FILL = "rgba(255, 200, 50, 0.18)";
|
|
24
20
|
/** Stroke colour of the demonstration circle. */
|
|
25
|
-
export const DEMONSTRATION_STROKE =
|
|
26
|
-
|
|
21
|
+
export declare const DEMONSTRATION_STROKE = "rgba(255, 200, 50, 0.7)";
|
|
27
22
|
/** Colour used for the dashed crosshair lines. */
|
|
28
|
-
export const DEMONSTRATION_COLOR
|
|
29
|
-
|
|
23
|
+
export declare const DEMONSTRATION_COLOR = "var(--crosshair-overlay, rgba(255,255,255,0.75))";
|
|
30
24
|
/** Descriptor used by the toolbar and tool-selection logic. */
|
|
31
|
-
export const demonstrationTool
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
25
|
+
export declare const demonstrationTool: {
|
|
26
|
+
readonly type: "demonstration";
|
|
27
|
+
readonly label: "Demonstration";
|
|
28
|
+
readonly cursorStyle: "none";
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=demonstration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"demonstration.d.ts","sourceRoot":"","sources":["../../../../src/api/drawing tools/pointers menu/demonstration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,mBAAmB,kBAAmB,CAAC;AACpD,eAAO,MAAM,mBAAmB,EAAI,MAAe,CAAC;AAEpD,yEAAyE;AACzE,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,+CAA+C;AAC/C,eAAO,MAAM,kBAAkB,6BAA+B,CAAC;AAE/D,iDAAiD;AACjD,eAAO,MAAM,oBAAoB,4BAA4B,CAAC;AAE9D,kDAAkD;AAClD,eAAO,MAAM,mBAAmB,qDAAsD,CAAC;AAEvF,+DAA+D;AAC/D,eAAO,MAAM,iBAAiB;;;;CAIpB,CAAC"}
|
|
@@ -8,19 +8,16 @@
|
|
|
8
8
|
* The SDK crosshair (`Chart.setCrosshairEnabled`) is NOT active in this mode;
|
|
9
9
|
* all visuals come from the SVG overlay.
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
export const
|
|
13
|
-
export const DOT_STYLE = 'none' as const;
|
|
14
|
-
|
|
11
|
+
export declare const DOT_LABEL = "Dot";
|
|
12
|
+
export declare const DOT_STYLE: "none";
|
|
15
13
|
/** Radius (px) of the filled dot drawn at the crosshair intersection. */
|
|
16
|
-
export const DOT_RADIUS = 3;
|
|
17
|
-
|
|
14
|
+
export declare const DOT_RADIUS = 3;
|
|
18
15
|
/** Colour used for both the crosshair lines and the dot fill. */
|
|
19
|
-
export const DOT_COLOR
|
|
20
|
-
|
|
16
|
+
export declare const DOT_COLOR = "var(--crosshair-overlay, rgba(255,255,255,0.75))";
|
|
21
17
|
/** Descriptor used by the toolbar and tool-selection logic. */
|
|
22
|
-
export const dotTool
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
18
|
+
export declare const dotTool: {
|
|
19
|
+
readonly type: "dot";
|
|
20
|
+
readonly label: "Dot";
|
|
21
|
+
readonly cursorStyle: "none";
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=dot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dot.d.ts","sourceRoot":"","sources":["../../../../src/api/drawing tools/pointers menu/dot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,eAAO,MAAM,SAAS,QAAS,CAAC;AAChC,eAAO,MAAM,SAAS,EAAI,MAAe,CAAC;AAE1C,yEAAyE;AACzE,eAAO,MAAM,UAAU,IAAI,CAAC;AAE5B,iEAAiE;AACjE,eAAO,MAAM,SAAS,qDAAsD,CAAC;AAE7E,+DAA+D;AAC/D,eAAO,MAAM,OAAO;;;;CAIV,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangle.d.ts","sourceRoot":"","sources":["../../../../src/api/drawing tools/shapes menu/rectangle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,wBAAgB,eAAe,CAC7B,GAAG,EAAE,wBAAwB,EAC7B,CAAC,EAAE,OAAO,EACV,CAAC,EAAE,cAAc,GAChB,IAAI,CAgBN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../src/api/drawing tools/shapes menu/text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,wBAAgB,UAAU,CACxB,GAAG,EAAE,wBAAwB,EAC7B,CAAC,EAAE,OAAO,EACV,CAAC,EAAE,cAAc,GAChB,IAAI,CAsBN"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Drawing } from '@forgecharts/types';
|
|
2
|
+
import type { CoordTransform } from '../core/CoordTransform';
|
|
3
|
+
export declare const HANDLE_HALF = 5;
|
|
4
|
+
export declare const HANDLE_FILL = "#2196f3";
|
|
5
|
+
export declare const HANDLE_STROKE = "rgba(255,255,255,0.9)";
|
|
6
|
+
export declare function rayExit(plotW: number, plotH: number, px: number, py: number, dx: number, dy: number): {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const TF_SECS: Record<string, number>;
|
|
11
|
+
export declare function formatDuration(seconds: number): string;
|
|
12
|
+
export type PF3 = {
|
|
13
|
+
x0: number;
|
|
14
|
+
y0: number;
|
|
15
|
+
x1: number;
|
|
16
|
+
y1: number;
|
|
17
|
+
x2: number;
|
|
18
|
+
y2: number;
|
|
19
|
+
};
|
|
20
|
+
export declare function getPF3(d: Drawing, t: CoordTransform): PF3 | null;
|
|
21
|
+
export declare function drawPitchforkLines(ctx: CanvasRenderingContext2D, t: CoordTransform, pivotX: number, pivotY: number, midX: number, midY: number, x1: number, y1: number, x2: number, y2: number): void;
|
|
22
|
+
//# sourceMappingURL=drawingUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawingUtils.d.ts","sourceRoot":"","sources":["../../src/api/drawingUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,eAAO,MAAM,WAAW,IAAM,CAAC;AAC/B,eAAO,MAAM,WAAW,YAAc,CAAC;AACvC,eAAO,MAAM,aAAa,0BAA0B,CAAC;AAGrD,wBAAgB,OAAO,CACrB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,GACT;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAU1B;AAGD,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAK1C,CAAC;AAEF,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMtD;AAGD,MAAM,MAAM,GAAG,GAAG;IAChB,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,cAAc,GAAG,GAAG,GAAG,IAAI,CAQhE;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,wBAAwB,EAC7B,CAAC,EAAE,cAAc,EACjB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAC9B,IAAI,EAAE,MAAM,EAAG,IAAI,EAAE,MAAM,EAC3B,EAAE,EAAE,MAAM,EAAK,EAAE,EAAE,MAAM,EACzB,EAAE,EAAE,MAAM,EAAK,EAAE,EAAE,MAAM,GACxB,IAAI,CAaN"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CanvasLayer — a single <canvas> element inside the chart container.
|
|
3
|
+
* Each layer has an independent bitmap; layers are stacked via CSS z-index.
|
|
4
|
+
* Physical pixels are pre-scaled by devicePixelRatio for crisp rendering.
|
|
5
|
+
*/
|
|
6
|
+
export type CanvasLayerOptions = {
|
|
7
|
+
readonly width: number;
|
|
8
|
+
readonly height: number;
|
|
9
|
+
readonly dpr: number;
|
|
10
|
+
readonly zIndex: number;
|
|
11
|
+
};
|
|
12
|
+
export declare class CanvasLayer {
|
|
13
|
+
readonly canvas: HTMLCanvasElement;
|
|
14
|
+
readonly context: CanvasRenderingContext2D;
|
|
15
|
+
private _width;
|
|
16
|
+
private _height;
|
|
17
|
+
private _dpr;
|
|
18
|
+
constructor(container: HTMLElement, options: CanvasLayerOptions);
|
|
19
|
+
get width(): number;
|
|
20
|
+
get height(): number;
|
|
21
|
+
get dpr(): number;
|
|
22
|
+
resize(width: number, height: number, dpr: number): void;
|
|
23
|
+
destroy(): void;
|
|
24
|
+
private _applyDpr;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=CanvasLayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CanvasLayer.d.ts","sourceRoot":"","sources":["../../src/core/CanvasLayer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,qBAAa,WAAW;IACtB,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAC;IAE3C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,IAAI,CAAS;gBAET,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB;IAmB/D,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAaxD,OAAO,IAAI,IAAI;IAIf,OAAO,CAAC,SAAS;CAQlB"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type { ChartOptions, Drawing, DrawingType, Timeframe } from '@forgecharts/types';
|
|
2
|
+
import type { IChart, IChartPlugin } from '../types/IChart';
|
|
3
|
+
import type { ISeries } from '../types/ISeries';
|
|
4
|
+
import { TimeScale } from './TimeScale';
|
|
5
|
+
import { PriceScale } from './PriceScale';
|
|
6
|
+
import { CoordTransform } from './CoordTransform';
|
|
7
|
+
import { DrawingManager } from '../api/DrawingManager';
|
|
8
|
+
/**
|
|
9
|
+
* Chart — entry point for the ForgeCharts SDK.
|
|
10
|
+
*
|
|
11
|
+
* Manages the canvas layer stack, time/price scales, all series,
|
|
12
|
+
* and the interaction model. Uses the browser Canvas 2D API directly;
|
|
13
|
+
* no third-party chart library dependencies.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const chart = new Chart(containerEl, { theme: 'dark' });
|
|
18
|
+
* const series = chart.addSeries({ type: 'candlestick' });
|
|
19
|
+
* series.setData(ohlcvArray);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class Chart implements IChart {
|
|
23
|
+
private readonly _container;
|
|
24
|
+
private readonly _options;
|
|
25
|
+
private readonly _colors;
|
|
26
|
+
private readonly _gridLayer;
|
|
27
|
+
private readonly _seriesLayer;
|
|
28
|
+
private readonly _overlayLayer;
|
|
29
|
+
private readonly _timeScale;
|
|
30
|
+
private readonly _priceScale;
|
|
31
|
+
private readonly _transform;
|
|
32
|
+
private readonly _crosshair;
|
|
33
|
+
private _series;
|
|
34
|
+
private _plugins;
|
|
35
|
+
private _animationFrame;
|
|
36
|
+
private _dirty;
|
|
37
|
+
private _indicatorsVisible;
|
|
38
|
+
/** When true the user has manually adjusted the price scale; auto-fit is suspended. */
|
|
39
|
+
private _priceScaleManual;
|
|
40
|
+
/** Active timeframe — used for last-price countdown. */
|
|
41
|
+
private _interval;
|
|
42
|
+
/** Last second at which we ticked the countdown to force a re-render. */
|
|
43
|
+
private _lastCountdownSec;
|
|
44
|
+
private readonly _resizeObserver;
|
|
45
|
+
private readonly _interaction;
|
|
46
|
+
private readonly _drawingMgr;
|
|
47
|
+
private _drawingTool;
|
|
48
|
+
private _drawingState;
|
|
49
|
+
private _drawingP0;
|
|
50
|
+
private _drawingP1;
|
|
51
|
+
private _drawingCursorPt;
|
|
52
|
+
/** When false the crosshair is suppressed (e.g. Arrow/cursor mode). */
|
|
53
|
+
private _crosshairEnabled;
|
|
54
|
+
/** Called whenever a drawing is committed (created or updated). */
|
|
55
|
+
onDrawingCommitted: ((drawing: Drawing) => void) | undefined;
|
|
56
|
+
/** Called whenever a drawing is deleted. */
|
|
57
|
+
onDrawingDeleted: ((id: string) => void) | undefined;
|
|
58
|
+
/** Called when the user right-clicks a drawing. x/y are canvas-relative pixels. */
|
|
59
|
+
onDrawingContextMenu: ((id: string, x: number, y: number) => void) | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Called after every pan or zoom interaction so external code (e.g. TChart)
|
|
62
|
+
* can check whether the visible time range now extends past the oldest
|
|
63
|
+
* loaded bar and trigger a lazy history fetch.
|
|
64
|
+
*/
|
|
65
|
+
onViewportChanged: (() => void) | undefined;
|
|
66
|
+
constructor(container: HTMLElement, options?: ChartOptions);
|
|
67
|
+
addSeries(options: Parameters<IChart['addSeries']>[0]): ISeries;
|
|
68
|
+
removeSeries(series: ISeries): void;
|
|
69
|
+
addPlugin(plugin: IChartPlugin): void;
|
|
70
|
+
removePlugin(plugin: IChartPlugin): void;
|
|
71
|
+
/** Set the active timeframe so the last-price countdown is accurate. */
|
|
72
|
+
setInterval(tf: Timeframe): void;
|
|
73
|
+
timeScale(): TimeScale;
|
|
74
|
+
priceScale(): PriceScale;
|
|
75
|
+
applyOptions(options: Partial<ChartOptions>): void;
|
|
76
|
+
/** Pans the viewport so the latest bar is visible at the right edge. */
|
|
77
|
+
scrollToEnd(): void;
|
|
78
|
+
/** Returns the coordinate transform for this chart. */
|
|
79
|
+
transform(): CoordTransform;
|
|
80
|
+
resize(width: number, height: number): void;
|
|
81
|
+
destroy(): void;
|
|
82
|
+
private _scheduleRender;
|
|
83
|
+
private _render;
|
|
84
|
+
private _renderGrid;
|
|
85
|
+
setAllDrawingsVisible(v: boolean): void;
|
|
86
|
+
setIndicatorsVisible(v: boolean): void;
|
|
87
|
+
private _renderSeries;
|
|
88
|
+
private _renderOverlay;
|
|
89
|
+
/**
|
|
90
|
+
* Snaps a pixel X coordinate to the nearest bar's centre pixel.
|
|
91
|
+
* If no bars are loaded, or the nearest bar is more than SNAP_PX pixels away,
|
|
92
|
+
* returns the original x so the crosshair always renders at the cursor position.
|
|
93
|
+
*/
|
|
94
|
+
private _snapXToBar;
|
|
95
|
+
private _computeViewport;
|
|
96
|
+
private _onResize;
|
|
97
|
+
private _handleKeyAction;
|
|
98
|
+
/**
|
|
99
|
+
* Fits the price scale to the high/low range of bars visible in the current
|
|
100
|
+
* time window. Called every render frame so the scale tracks panning/zooming.
|
|
101
|
+
*/
|
|
102
|
+
private _autoFitPriceToData;
|
|
103
|
+
/**
|
|
104
|
+
* Renders the last-price dotted line, price label, and countdown timer.
|
|
105
|
+
* Drawn on the overlay canvas above all series but below the crosshair.
|
|
106
|
+
*/
|
|
107
|
+
private _renderLastPriceLine;
|
|
108
|
+
/** Pans the viewport so the latest bar sits near the right edge. */
|
|
109
|
+
private _scrollToLatestBar;
|
|
110
|
+
/**
|
|
111
|
+
* Returns the current visible time and price ranges.
|
|
112
|
+
*/
|
|
113
|
+
getViewport(): import('@forgecharts/types').Viewport;
|
|
114
|
+
/**
|
|
115
|
+
* Restores a previously saved viewport (time range + manual price range).
|
|
116
|
+
*/
|
|
117
|
+
restoreViewport(v: import('@forgecharts/types').Viewport): void;
|
|
118
|
+
/**
|
|
119
|
+
* Clears the manual-price-scale flag so the price axis returns to auto-fit mode.
|
|
120
|
+
* Call this after restoring a saved viewport so stale price ranges don't persist.
|
|
121
|
+
*/
|
|
122
|
+
resetPriceScale(): void;
|
|
123
|
+
/**
|
|
124
|
+
* Sets the default viewport: shows 10 days of price history with the latest
|
|
125
|
+
* bar positioned near the right edge (5% right margin for breathing room).
|
|
126
|
+
* Also resets the price scale to auto-fit so prices center vertically.
|
|
127
|
+
* Called on initial data load and when the user double-clicks either axis.
|
|
128
|
+
*/
|
|
129
|
+
fitDefaultView(): void;
|
|
130
|
+
/** Returns the DrawingManager owned by this chart. */
|
|
131
|
+
drawingManager(): DrawingManager;
|
|
132
|
+
/** Force a redraw on the next animation frame. */
|
|
133
|
+
markDirty(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Activates a drawing tool. While active, mouse clicks place anchors.
|
|
136
|
+
* The tool auto-cancels after each commit. Press Escape to cancel mid-placement.
|
|
137
|
+
*/
|
|
138
|
+
startDrawingTool(type: DrawingType): void;
|
|
139
|
+
/** Cancels any in-progress drawing and returns to cursor mode. */
|
|
140
|
+
cancelDrawingTool(): void;
|
|
141
|
+
/**
|
|
142
|
+
* Show or hide the interactive crosshair lines.
|
|
143
|
+
* Pass `false` for Arrow/cursor mode; `true` for crosshair / dot / demonstration.
|
|
144
|
+
*/
|
|
145
|
+
setCrosshairEnabled(enabled: boolean): void;
|
|
146
|
+
/**
|
|
147
|
+
* Hides (`true`) or restores (`false`) the native OS cursor.
|
|
148
|
+
* Call with `true` for dot and demonstration pointer modes whose visuals
|
|
149
|
+
* come from PointerOverlay rather than the SDK crosshair.
|
|
150
|
+
*/
|
|
151
|
+
setNativeCursorHidden(hidden: boolean): void;
|
|
152
|
+
/** Deletes the currently selected drawing (if any). */
|
|
153
|
+
deleteSelectedDrawing(): void;
|
|
154
|
+
private _handleDrawClick;
|
|
155
|
+
private _buildDraftPreview;
|
|
156
|
+
/**
|
|
157
|
+
* Snaps the pixel position to the nearest bar's time within SNAP_PX.
|
|
158
|
+
* Returns a DrawingPoint with the snapped time and the raw price at y.
|
|
159
|
+
*/
|
|
160
|
+
private _snapToBar;
|
|
161
|
+
private _resolveOptions;
|
|
162
|
+
private _resolveColors;
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=Chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../src/core/Chart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAA2C,OAAO,EAAE,WAAW,EAAuB,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtJ,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA6BvD;;;;;;;;;;;;;GAaG;AACH,qBAAa,KAAM,YAAW,MAAM;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAc;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyB;IAClD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IAGtC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAc;IACzC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAc;IAE5C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAiB;IAC5C,OAAO,CAAC,QAAQ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tB,sDAAsD;IACtD,cAAc,IAAI,cAAc;IAIhC,kDAAkD;IAClD,SAAS,IAAI,IAAI;IAIjB;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAUzC,kEAAkE;IAClE,iBAAiB,IAAI,IAAI;IAUzB;;;OAGG;IACH,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAS3C;;;;OAIG;IACH,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAI5C,uDAAuD;IACvD,qBAAqB,IAAI,IAAI;IAW7B,OAAO,CAAC,gBAAgB;IAkGxB,OAAO,CAAC,kBAAkB;IA6B1B;;;OAGG;IACH,OAAO,CAAC,UAAU;IAuBlB,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,cAAc;CAOvB"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import type { TimeRange, PriceRange, Point, DrawingPoint } from '@forgecharts/types';
|
|
2
|
+
import type { TimeScale } from './TimeScale';
|
|
3
|
+
import type { PriceScale } from './PriceScale';
|
|
4
|
+
/**
|
|
5
|
+
* Immutable snapshot of the plot area geometry (excluding axes).
|
|
6
|
+
* All coordinates are in logical canvas pixels (pre-DPR).
|
|
7
|
+
*/
|
|
8
|
+
export type PlotArea = {
|
|
9
|
+
/** Left edge — always 0. */
|
|
10
|
+
readonly left: number;
|
|
11
|
+
/** Top edge — always 0. */
|
|
12
|
+
readonly top: number;
|
|
13
|
+
/** Right edge = canvasWidth − priceScaleWidth. */
|
|
14
|
+
readonly right: number;
|
|
15
|
+
/** Bottom edge = canvasHeight − timeScaleHeight. */
|
|
16
|
+
readonly bottom: number;
|
|
17
|
+
/** Drawable width (canvasWidth − priceScaleWidth). */
|
|
18
|
+
readonly width: number;
|
|
19
|
+
/** Drawable height (canvasHeight − timeScaleHeight). */
|
|
20
|
+
readonly height: number;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* CoordTransform — the single source of truth for all coordinate conversions.
|
|
24
|
+
*
|
|
25
|
+
* Converts between chart data-space coordinates (Unix timestamp in seconds,
|
|
26
|
+
* price) and canvas pixel coordinates (x, y). Every chart subsystem that
|
|
27
|
+
* needs coordinate maths — the Crosshair, series renderers, drawing tools,
|
|
28
|
+
* plugins — should use this class rather than reading scale internals directly.
|
|
29
|
+
*
|
|
30
|
+
* A `CoordTransform` instance is owned by `Chart` and can be retrieved via
|
|
31
|
+
* `chart.transform()`. It is kept up-to-date with every resize; callers
|
|
32
|
+
* hold a stable reference and always see current values.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const t = chart.transform();
|
|
37
|
+
*
|
|
38
|
+
* // Data → pixel
|
|
39
|
+
* const x = t.timeToX(bar.time);
|
|
40
|
+
* const y = t.priceToY(bar.close);
|
|
41
|
+
* const { x, y } = t.toPixel(bar.time, bar.close);
|
|
42
|
+
*
|
|
43
|
+
* // Pixel → data (e.g. read pointer position)
|
|
44
|
+
* const { time, price } = t.fromPixel(event.offsetX, event.offsetY);
|
|
45
|
+
*
|
|
46
|
+
* // Zoom on wheel
|
|
47
|
+
* t.zoomTime(0.9, event.offsetX); // zoom in
|
|
48
|
+
*
|
|
49
|
+
* // Pan on drag
|
|
50
|
+
* t.pan(dx, dy);
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare class CoordTransform {
|
|
54
|
+
private _canvasWidth;
|
|
55
|
+
private _canvasHeight;
|
|
56
|
+
private readonly _timeScale;
|
|
57
|
+
private readonly _priceScale;
|
|
58
|
+
/** Width of the right-side price axis in logical pixels. */
|
|
59
|
+
readonly priceScaleWidth: number;
|
|
60
|
+
/** Height of the bottom time axis in logical pixels. */
|
|
61
|
+
readonly timeScaleHeight: number;
|
|
62
|
+
constructor(timeScale: TimeScale, priceScale: PriceScale, priceScaleWidth: number, timeScaleHeight: number);
|
|
63
|
+
/**
|
|
64
|
+
* Stores the current canvas size.
|
|
65
|
+
* **Must be called** by `Chart` once at construction and after every resize.
|
|
66
|
+
*/
|
|
67
|
+
update(canvasWidth: number, canvasHeight: number): void;
|
|
68
|
+
/**
|
|
69
|
+
* The drawable region excluding both axes.
|
|
70
|
+
* Use this to clip drawing operations or check mouse bounds.
|
|
71
|
+
*/
|
|
72
|
+
get plotArea(): PlotArea;
|
|
73
|
+
/** Full logical canvas width (plot area + price axis). */
|
|
74
|
+
get canvasWidth(): number;
|
|
75
|
+
/** Full logical canvas height (plot area + time axis). */
|
|
76
|
+
get canvasHeight(): number;
|
|
77
|
+
/** Drawable width (canvas width minus the price axis). */
|
|
78
|
+
get plotWidth(): number;
|
|
79
|
+
/** Drawable height (canvas height minus the time axis). */
|
|
80
|
+
get plotHeight(): number;
|
|
81
|
+
/**
|
|
82
|
+
* Maps a Unix timestamp (seconds) to a canvas X pixel.
|
|
83
|
+
*
|
|
84
|
+
* Returns a value in `[0, plotWidth]` for visible times; may be negative
|
|
85
|
+
* or exceed `plotWidth` for off-screen bars — useful for clipping checks.
|
|
86
|
+
*/
|
|
87
|
+
timeToX(time: number): number;
|
|
88
|
+
/**
|
|
89
|
+
* Maps a canvas X pixel coordinate back to a Unix timestamp (seconds).
|
|
90
|
+
*/
|
|
91
|
+
xToTime(x: number): number;
|
|
92
|
+
/**
|
|
93
|
+
* Maps a price value to a canvas Y pixel.
|
|
94
|
+
*
|
|
95
|
+
* Y = 0 is the top of the canvas. Higher prices map to smaller Y values
|
|
96
|
+
* in normal (non-inverted) scale mode.
|
|
97
|
+
*/
|
|
98
|
+
priceToY(price: number): number;
|
|
99
|
+
/**
|
|
100
|
+
* Maps a canvas Y pixel coordinate back to a price value.
|
|
101
|
+
*/
|
|
102
|
+
yToPrice(y: number): number;
|
|
103
|
+
/**
|
|
104
|
+
* Converts a data-space point to a canvas pixel.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* const { x, y } = transform.toPixel(bar.time, bar.high);
|
|
109
|
+
* ctx.arc(x, y, 3, 0, Math.PI * 2);
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
toPixel(time: number, price: number): Point;
|
|
113
|
+
/**
|
|
114
|
+
* Converts a canvas pixel to a data-space point (time, price).
|
|
115
|
+
*
|
|
116
|
+
* Returned `time` is in Unix seconds; `price` is in the same units as the
|
|
117
|
+
* price scale (e.g. USD for BTCUSDT charts).
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* canvas.addEventListener('click', e => {
|
|
122
|
+
* const { time, price } = transform.fromPixel(e.offsetX, e.offsetY);
|
|
123
|
+
* });
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
fromPixel(x: number, y: number): DrawingPoint;
|
|
127
|
+
/**
|
|
128
|
+
* Returns `true` when pixel `(x, y)` falls inside the plot area —
|
|
129
|
+
* i.e. not over the axis gutter regions.
|
|
130
|
+
*/
|
|
131
|
+
inPlotArea(x: number, y: number): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Zooms the time axis around a canvas-space pivot X pixel.
|
|
134
|
+
*
|
|
135
|
+
* @param factor Multiplier applied to the visible time span.
|
|
136
|
+
* `< 1` = zoom in (fewer bars visible),
|
|
137
|
+
* `> 1` = zoom out (more bars visible).
|
|
138
|
+
* @param pivotX Canvas X pixel that remains fixed during the zoom.
|
|
139
|
+
* Pass `event.offsetX` from a wheel event.
|
|
140
|
+
*/
|
|
141
|
+
zoomTime(factor: number, pivotX: number): void;
|
|
142
|
+
/**
|
|
143
|
+
* Zooms the price axis around a canvas-space pivot Y pixel.
|
|
144
|
+
*
|
|
145
|
+
* @param factor Multiplier for the visible price span.
|
|
146
|
+
* `> 1` = zoom out (wider range), `< 1` = zoom in (narrower range).
|
|
147
|
+
* @param pivotY Canvas Y pixel that stays fixed during the zoom.
|
|
148
|
+
*/
|
|
149
|
+
zoomPrice(factor: number, pivotY: number): void;
|
|
150
|
+
/**
|
|
151
|
+
* Pans the chart by a pixel delta — typically called from a drag handler.
|
|
152
|
+
*
|
|
153
|
+
* - `deltaX > 0` (right drag) shifts the visible time range backward
|
|
154
|
+
* (revealing older bars).
|
|
155
|
+
* - `deltaX < 0` (left drag) shifts forward (revealing newer bars).
|
|
156
|
+
* - `deltaY > 0` (down drag) shifts the visible price range downward.
|
|
157
|
+
* - `deltaY < 0` (up drag) shifts the price range upward.
|
|
158
|
+
*
|
|
159
|
+
* @param deltaX Horizontal pixel displacement since last event.
|
|
160
|
+
* @param deltaY Vertical pixel displacement since last event.
|
|
161
|
+
*/
|
|
162
|
+
pan(deltaX: number, deltaY: number): void;
|
|
163
|
+
/** The currently visible time range (Unix seconds). */
|
|
164
|
+
get timeRange(): TimeRange;
|
|
165
|
+
/** The currently visible price range. */
|
|
166
|
+
get priceRange(): PriceRange;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=CoordTransform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoordTransform.d.ts","sourceRoot":"","sources":["../../src/core/CoordTransform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,4BAA4B;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2BAA2B;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,QAAQ,CAA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AC,EAAE,MAAM,GAAG,YAAY;IAI7C;;;OAGG;IACH,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO;IAMzC;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAI9C;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAa/C;;;;;;;;;;;OAWG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAyBzC,uDAAuD;IACvD,IAAI,SAAS,IAAI,SAAS,CAEzB;IAED,yCAAyC;IACzC,IAAI,UAAU,IAAI,UAAU,CAE3B;CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ChartColors, ChartOptions } from '@forgecharts/types';
|
|
2
|
+
import type { CanvasLayer } from './CanvasLayer';
|
|
3
|
+
import type { CoordTransform } from './CoordTransform';
|
|
4
|
+
/**
|
|
5
|
+
* Crosshair — renders the interactive cross-line overlay and price/time labels.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Crosshair {
|
|
8
|
+
private _x;
|
|
9
|
+
private _snapTime;
|
|
10
|
+
private _y;
|
|
11
|
+
private readonly _layer;
|
|
12
|
+
private readonly _colors;
|
|
13
|
+
private readonly _options;
|
|
14
|
+
private readonly _transform;
|
|
15
|
+
/** IANA timezone for the time label on the crosshair. Falls back to UTC. */
|
|
16
|
+
timezone: string | undefined;
|
|
17
|
+
/** Active timeframe — controls whether time is shown alongside the date. */
|
|
18
|
+
interval: string;
|
|
19
|
+
constructor(layer: CanvasLayer, colors: ChartColors, chartOptions: ChartOptions, transform: CoordTransform);
|
|
20
|
+
update(x: number, y: number, snapTime?: number): void;
|
|
21
|
+
hide(): void;
|
|
22
|
+
destroy(): void;
|
|
23
|
+
render(ctx: CanvasRenderingContext2D, width: number, height: number): void;
|
|
24
|
+
private _applyLineStyle;
|
|
25
|
+
/** Formats a price as a fixed-decimal string. */
|
|
26
|
+
private _formatPrice;
|
|
27
|
+
/** Formats a Unix timestamp (seconds) as a human-readable date/time string. */
|
|
28
|
+
private _formatTime;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=Crosshair.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Crosshair.d.ts","sourceRoot":"","sources":["../../src/core/Crosshair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAoB,MAAM,oBAAoB,CAAC;AACtF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,EAAE,CAAuB;IACjC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,EAAE,CAAuB;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;IACtD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAiB;IAC5C,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAa;IACzC,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAQ;gBAGtB,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,WAAW,EACnB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,cAAc;IAyB3B,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;IAMrD,IAAI,IAAI,IAAI;IAMZ,OAAO,IAAI,IAAI;IAIf,MAAM,CAAC,GAAG,EAAE,wBAAwB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IA6G1E,OAAO,CAAC,eAAe;IAMvB,iDAAiD;IACjD,OAAO,CAAC,YAAY;IAMpB,+EAA+E;IAC/E,OAAO,CAAC,WAAW;CAiBpB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IndicatorEngine — pure, stateless computation functions.
|
|
3
|
+
*
|
|
4
|
+
* All functions accept a readonly OHLCV array and operation-specific
|
|
5
|
+
* parameters, and return plain value arrays. No side effects, no
|
|
6
|
+
* class instances. Safe to call from any renderer or React component.
|
|
7
|
+
*/
|
|
8
|
+
import type { OHLCV, PriceField } from '@forgecharts/types';
|
|
9
|
+
export type IndicatorPoint = {
|
|
10
|
+
readonly time: number;
|
|
11
|
+
readonly value: number;
|
|
12
|
+
};
|
|
13
|
+
export type MACDPoint = {
|
|
14
|
+
readonly time: number;
|
|
15
|
+
readonly macd: number;
|
|
16
|
+
readonly signal: number;
|
|
17
|
+
readonly histogram: number;
|
|
18
|
+
};
|
|
19
|
+
/** Simple Moving Average over bar close prices. */
|
|
20
|
+
export declare function computeSMA(bars: readonly OHLCV[], period: number): IndicatorPoint[];
|
|
21
|
+
/** Exponential Moving Average over bar close prices. */
|
|
22
|
+
export declare function computeEMA(bars: readonly OHLCV[], period: number): IndicatorPoint[];
|
|
23
|
+
/**
|
|
24
|
+
* Relative Strength Index using Wilder's smoothing.
|
|
25
|
+
* Returns values in [0, 100].
|
|
26
|
+
* Requires at least `period + 1` bars; returns [] otherwise.
|
|
27
|
+
*/
|
|
28
|
+
export declare function computeRSI(bars: readonly OHLCV[], period?: number): IndicatorPoint[];
|
|
29
|
+
/**
|
|
30
|
+
* MACD — Moving Average Convergence/Divergence.
|
|
31
|
+
* Returns MACD line, Signal line, and Histogram.
|
|
32
|
+
* Standard defaults: fast=12, slow=26, signal=9.
|
|
33
|
+
*/
|
|
34
|
+
export declare function computeMACD(bars: readonly OHLCV[], fastPeriod?: number, slowPeriod?: number, signalPeriod?: number): MACDPoint[];
|
|
35
|
+
/** Volume bars — raw volume values keyed by bar time. */
|
|
36
|
+
export declare function computeVolume(bars: readonly OHLCV[]): IndicatorPoint[];
|
|
37
|
+
/** Extracts a single numeric value from an OHLCV bar by named price field. */
|
|
38
|
+
export declare function extractField(bar: OHLCV, field: PriceField): number;
|
|
39
|
+
/**
|
|
40
|
+
* SMA over an arbitrary `IndicatorPoint[]` series (not just OHLCV close).
|
|
41
|
+
* Enables chains such as EMA(SMA(close, 20), 10).
|
|
42
|
+
*/
|
|
43
|
+
export declare function computeSMAFromSeries(input: readonly IndicatorPoint[], period: number): IndicatorPoint[];
|
|
44
|
+
/**
|
|
45
|
+
* EMA over an arbitrary `IndicatorPoint[]` series.
|
|
46
|
+
* Seeds the EMA from the first input value.
|
|
47
|
+
*/
|
|
48
|
+
export declare function computeEMAFromSeries(input: readonly IndicatorPoint[], period: number): IndicatorPoint[];
|
|
49
|
+
/** WMA (Weighted Moving Average) over an arbitrary `IndicatorPoint[]` series. */
|
|
50
|
+
export declare function computeWMAFromSeries(input: readonly IndicatorPoint[], period: number): IndicatorPoint[];
|
|
51
|
+
//# sourceMappingURL=IndicatorEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IndicatorEngine.d.ts","sourceRoot":"","sources":["../../src/core/IndicatorEngine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAI5D,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM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