@forgecharts/sdk 1.1.23 → 1.1.28
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__/backwardCompatibility.test.js +159 -0
- package/dist/__tests__/backwardCompatibility.test.js.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__/candleInvariant.test.js +415 -0
- package/dist/__tests__/candleInvariant.test.js.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/{src/__tests__/public-api-surface.ts → dist/__tests__/public-api-surface.js} +4 -42
- package/dist/__tests__/public-api-surface.js.map +1 -0
- package/dist/__tests__/timeframeBoundary.test.d.ts +17 -0
- package/dist/__tests__/timeframeBoundary.test.d.ts.map +1 -0
- package/dist/__tests__/timeframeBoundary.test.js +452 -0
- package/dist/__tests__/timeframeBoundary.test.js.map +1 -0
- package/dist/api/DrawingManager.d.ts +20 -0
- package/dist/api/DrawingManager.d.ts.map +1 -0
- package/dist/api/DrawingManager.js +190 -0
- package/dist/api/DrawingManager.js.map +1 -0
- package/dist/api/EventBus.d.ts +19 -0
- package/dist/api/EventBus.d.ts.map +1 -0
- package/dist/api/EventBus.js +44 -0
- package/dist/api/EventBus.js.map +1 -0
- package/dist/api/IndicatorDAG.d.ts +85 -0
- package/dist/api/IndicatorDAG.d.ts.map +1 -0
- package/dist/api/IndicatorDAG.js +316 -0
- package/dist/api/IndicatorDAG.js.map +1 -0
- package/dist/api/IndicatorRegistry.d.ts +22 -0
- package/dist/api/IndicatorRegistry.d.ts.map +1 -0
- package/dist/api/IndicatorRegistry.js +39 -0
- package/dist/api/IndicatorRegistry.js.map +1 -0
- package/dist/api/LayoutManager.d.ts +30 -0
- package/dist/api/LayoutManager.d.ts.map +1 -0
- package/dist/api/LayoutManager.js +51 -0
- package/dist/api/LayoutManager.js.map +1 -0
- package/dist/api/PaneManager.d.ts +42 -0
- package/dist/api/PaneManager.d.ts.map +1 -0
- package/dist/api/PaneManager.js +119 -0
- package/dist/api/PaneManager.js.map +1 -0
- package/dist/api/ReferenceAPI.d.ts +78 -0
- package/dist/api/ReferenceAPI.d.ts.map +1 -0
- package/dist/api/ReferenceAPI.js +153 -0
- package/dist/api/ReferenceAPI.js.map +1 -0
- package/dist/api/TChart.d.ts +345 -0
- package/dist/api/TChart.d.ts.map +1 -0
- package/dist/api/TChart.js +765 -0
- package/dist/api/TChart.js.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/createChart.js +42 -0
- package/dist/api/createChart.js.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/fib gann menu/fibRetracement.js +22 -0
- package/dist/api/drawing tools/fib gann menu/fibRetracement.js.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/crossLine.js +16 -0
- package/dist/api/drawing tools/lines menu/crossLine.js.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/disjointChannel.js +59 -0
- package/dist/api/drawing tools/lines menu/disjointChannel.js.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/extendedLine.js +17 -0
- package/dist/api/drawing tools/lines menu/extendedLine.js.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/flatTopBottom.js +41 -0
- package/dist/api/drawing tools/lines menu/flatTopBottom.js.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/horizontal.js +19 -0
- package/dist/api/drawing tools/lines menu/horizontal.js.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/horizontalRay.js +20 -0
- package/dist/api/drawing tools/lines menu/horizontalRay.js.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/infoLine.js +107 -0
- package/dist/api/drawing tools/lines menu/infoLine.js.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/insidePitchfork.js +31 -0
- package/dist/api/drawing tools/lines menu/insidePitchfork.js.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/modifiedSchiffPitchfork.js +15 -0
- package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.js.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/parallelChannel.js +43 -0
- package/dist/api/drawing tools/lines menu/parallelChannel.js.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/pitchfork.js +12 -0
- package/dist/api/drawing tools/lines menu/pitchfork.js.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/ray.js +23 -0
- package/dist/api/drawing tools/lines menu/ray.js.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/regressionTrend.js +127 -0
- package/dist/api/drawing tools/lines menu/regressionTrend.js.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/schiffPitchfork.js +15 -0
- package/dist/api/drawing tools/lines menu/schiffPitchfork.js.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/trendAngle.js +51 -0
- package/dist/api/drawing tools/lines menu/trendAngle.js.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/trendline.js +11 -0
- package/dist/api/drawing tools/lines menu/trendline.js.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/dist/api/drawing tools/lines menu/vertical.js +11 -0
- package/dist/api/drawing tools/lines menu/vertical.js.map +1 -0
- package/dist/api/drawing tools/pointers menu/crosshair.d.ts +16 -0
- package/dist/api/drawing tools/pointers menu/crosshair.d.ts.map +1 -0
- package/{src/api/drawing tools/pointers menu/crosshair.ts → dist/api/drawing tools/pointers menu/crosshair.js } +6 -7
- package/dist/api/drawing tools/pointers menu/crosshair.js.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/cursor.ts → dist/api/drawing tools/pointers menu/cursor.js } +7 -8
- package/dist/api/drawing tools/pointers menu/cursor.js.map +1 -0
- package/dist/api/drawing tools/pointers menu/demonstration.d.ts +30 -0
- package/dist/api/drawing tools/pointers menu/demonstration.d.ts.map +1 -0
- package/{src/api/drawing tools/pointers menu/demonstration.ts → dist/api/drawing tools/pointers menu/demonstration.js } +9 -14
- package/dist/api/drawing tools/pointers menu/demonstration.js.map +1 -0
- package/dist/api/drawing tools/pointers menu/dot.d.ts +23 -0
- package/dist/api/drawing tools/pointers menu/dot.d.ts.map +1 -0
- package/{src/api/drawing tools/pointers menu/dot.ts → dist/api/drawing tools/pointers menu/dot.js } +8 -11
- package/dist/api/drawing tools/pointers menu/dot.js.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/rectangle.js +19 -0
- package/dist/api/drawing tools/shapes menu/rectangle.js.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/drawing tools/shapes menu/text.js +25 -0
- package/dist/api/drawing tools/shapes menu/text.js.map +1 -0
- package/dist/api/drawingUtils.d.ts +22 -0
- package/dist/api/drawingUtils.d.ts.map +1 -0
- package/dist/api/drawingUtils.js +83 -0
- package/dist/api/drawingUtils.js.map +1 -0
- package/dist/core/CanvasLayer.d.ts +26 -0
- package/dist/core/CanvasLayer.d.ts.map +1 -0
- package/dist/core/CanvasLayer.js +56 -0
- package/dist/core/CanvasLayer.js.map +1 -0
- package/dist/core/Chart.d.ts +164 -0
- package/dist/core/Chart.d.ts.map +1 -0
- package/dist/core/Chart.js +839 -0
- package/dist/core/Chart.js.map +1 -0
- package/dist/core/CoordTransform.d.ts +168 -0
- package/dist/core/CoordTransform.d.ts.map +1 -0
- package/dist/core/CoordTransform.js +224 -0
- package/dist/core/CoordTransform.js.map +1 -0
- package/dist/core/Crosshair.d.ts +30 -0
- package/dist/core/Crosshair.d.ts.map +1 -0
- package/dist/core/Crosshair.js +186 -0
- package/dist/core/Crosshair.js.map +1 -0
- package/dist/core/IndicatorEngine.d.ts +51 -0
- package/dist/core/IndicatorEngine.d.ts.map +1 -0
- package/dist/core/IndicatorEngine.js +181 -0
- package/dist/core/IndicatorEngine.js.map +1 -0
- package/dist/core/InteractionManager.d.ts +197 -0
- package/dist/core/InteractionManager.d.ts.map +1 -0
- package/dist/core/InteractionManager.js +698 -0
- package/dist/core/InteractionManager.js.map +1 -0
- package/dist/core/PriceScale.d.ts +27 -0
- package/dist/core/PriceScale.d.ts.map +1 -0
- package/dist/core/PriceScale.js +113 -0
- package/dist/core/PriceScale.js.map +1 -0
- package/dist/core/Series.d.ts +40 -0
- package/dist/core/Series.d.ts.map +1 -0
- package/dist/core/Series.js +114 -0
- package/dist/core/Series.js.map +1 -0
- package/dist/core/TimeScale.d.ts +43 -0
- package/dist/core/TimeScale.d.ts.map +1 -0
- package/dist/core/TimeScale.js +150 -0
- package/dist/core/TimeScale.js.map +1 -0
- package/dist/datafeed/DatafeedConnector.d.ts +89 -0
- package/dist/datafeed/DatafeedConnector.d.ts.map +1 -0
- package/dist/datafeed/DatafeedConnector.js +268 -0
- package/dist/datafeed/DatafeedConnector.js.map +1 -0
- package/dist/engine/CandleEngine.d.ts +207 -0
- package/dist/engine/CandleEngine.d.ts.map +1 -0
- package/dist/engine/CandleEngine.js +318 -0
- package/dist/engine/CandleEngine.js.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/__tests__/CandleEngine.test.js +300 -0
- package/dist/engine/__tests__/CandleEngine.test.js.map +1 -0
- package/dist/engine/candleInvariants.d.ts +66 -0
- package/dist/engine/candleInvariants.d.ts.map +1 -0
- package/dist/engine/candleInvariants.js +134 -0
- package/dist/engine/candleInvariants.js.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/mergeUtils.js +64 -0
- package/dist/engine/mergeUtils.js.map +1 -0
- package/dist/engine/timeframeUtils.d.ts +80 -0
- package/dist/engine/timeframeUtils.d.ts.map +1 -0
- package/{src/engine/timeframeUtils.ts → dist/engine/timeframeUtils.js} +30 -48
- package/dist/engine/timeframeUtils.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +29 -0
- package/dist/internal.d.ts.map +1 -0
- package/{src/internal.ts → dist/internal.js} +2 -11
- 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/ChartRuntimeResolver.js +310 -0
- package/dist/licensing/ChartRuntimeResolver.js.map +1 -0
- package/dist/licensing/LicenseManager.d.ts +55 -0
- package/dist/licensing/LicenseManager.d.ts.map +1 -0
- package/dist/licensing/LicenseManager.js +114 -0
- package/dist/licensing/LicenseManager.js.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__/ChartRuntimeResolver.test.js +177 -0
- package/dist/licensing/__tests__/ChartRuntimeResolver.test.js.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/__tests__/LicenseManager.test.js +153 -0
- package/dist/licensing/__tests__/LicenseManager.test.js.map +1 -0
- package/dist/licensing/licenseTypes.d.ts +18 -0
- package/dist/licensing/licenseTypes.d.ts.map +1 -0
- package/dist/licensing/licenseTypes.js +2 -0
- package/dist/licensing/licenseTypes.js.map +1 -0
- package/dist/pine/PineCompiler.d.ts +35 -0
- package/dist/pine/PineCompiler.d.ts.map +1 -0
- package/dist/pine/PineCompiler.js +44 -0
- package/dist/pine/PineCompiler.js.map +1 -0
- package/dist/pine/diagnostics.d.ts +20 -0
- package/dist/pine/diagnostics.d.ts.map +1 -0
- package/dist/pine/diagnostics.js +11 -0
- package/dist/pine/diagnostics.js.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/index.js +5 -0
- package/dist/pine/index.js.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-ast.js +19 -0
- package/dist/pine/pine-ast.js.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-lexer.js +249 -0
- package/dist/pine/pine-lexer.js.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-parser.js +416 -0
- package/dist/pine/pine-parser.js.map +1 -0
- package/dist/pine/pine-transpiler.d.ts +33 -0
- package/dist/pine/pine-transpiler.d.ts.map +1 -0
- package/dist/pine/pine-transpiler.js +260 -0
- package/dist/pine/pine-transpiler.js.map +1 -0
- package/dist/pixi/LayerName.d.ts +18 -0
- package/dist/pixi/LayerName.d.ts.map +1 -0
- package/dist/pixi/LayerName.js +35 -0
- package/dist/pixi/LayerName.js.map +1 -0
- package/dist/pixi/PixiCandlestickRenderer.d.ts +23 -0
- package/dist/pixi/PixiCandlestickRenderer.d.ts.map +1 -0
- package/dist/pixi/PixiCandlestickRenderer.js +107 -0
- package/dist/pixi/PixiCandlestickRenderer.js.map +1 -0
- package/dist/pixi/PixiChart.d.ts +72 -0
- package/dist/pixi/PixiChart.d.ts.map +1 -0
- package/dist/pixi/PixiChart.js +367 -0
- package/dist/pixi/PixiChart.js.map +1 -0
- package/dist/pixi/PixiCrosshairRenderer.d.ts +29 -0
- package/dist/pixi/PixiCrosshairRenderer.d.ts.map +1 -0
- package/dist/pixi/PixiCrosshairRenderer.js +110 -0
- package/dist/pixi/PixiCrosshairRenderer.js.map +1 -0
- package/dist/pixi/PixiDrawingRenderer.d.ts +17 -0
- package/dist/pixi/PixiDrawingRenderer.d.ts.map +1 -0
- package/dist/pixi/PixiDrawingRenderer.js +111 -0
- package/dist/pixi/PixiDrawingRenderer.js.map +1 -0
- package/dist/pixi/PixiGridRenderer.d.ts +22 -0
- package/dist/pixi/PixiGridRenderer.d.ts.map +1 -0
- package/dist/pixi/PixiGridRenderer.js +114 -0
- package/dist/pixi/PixiGridRenderer.js.map +1 -0
- package/dist/pixi/PixiLayerManager.d.ts +56 -0
- package/dist/pixi/PixiLayerManager.d.ts.map +1 -0
- package/dist/pixi/PixiLayerManager.js +92 -0
- package/dist/pixi/PixiLayerManager.js.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/ChartCanvas.js +604 -0
- package/dist/react/canvas/ChartCanvas.js.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/ChartContextMenu.js +5 -0
- package/dist/react/canvas/ChartContextMenu.js.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/ChartSettingsDialog.js +28 -0
- package/dist/react/canvas/ChartSettingsDialog.js.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/IndicatorLabel.js +196 -0
- package/dist/react/canvas/IndicatorLabel.js.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/IndicatorPane.js +395 -0
- package/dist/react/canvas/IndicatorPane.js.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/PointerOverlay.js +61 -0
- package/dist/react/canvas/PointerOverlay.js.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/canvas/toolbars/LeftToolbar.js +407 -0
- package/dist/react/canvas/toolbars/LeftToolbar.js.map +1 -0
- package/dist/react/hooks/useChartCapabilities.d.ts +21 -0
- package/dist/react/hooks/useChartCapabilities.d.ts.map +1 -0
- package/dist/react/hooks/useChartCapabilities.js +66 -0
- package/dist/react/hooks/useChartCapabilities.js.map +1 -0
- package/dist/react/index.d.ts +30 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +28 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/internal.d.ts +38 -0
- package/dist/react/internal.d.ts.map +1 -0
- package/dist/react/internal.js +44 -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/shell/ManagedAppShell.js +440 -0
- package/dist/react/shell/ManagedAppShell.js.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/trading/TradingBridge.js +73 -0
- package/dist/react/trading/TradingBridge.js.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/ChartWorkspace.js +42 -0
- package/dist/react/workspace/ChartWorkspace.js.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/FloatingPanel.js +82 -0
- package/dist/react/workspace/FloatingPanel.js.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/IndicatorsDialog.js +121 -0
- package/dist/react/workspace/IndicatorsDialog.js.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/LayoutMenu.js +113 -0
- package/dist/react/workspace/LayoutMenu.js.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/SymbolSearchDialog.js +245 -0
- package/dist/react/workspace/SymbolSearchDialog.js.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/TabBar.js +29 -0
- package/dist/react/workspace/TabBar.js.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/BottomToolbar.js +236 -0
- package/dist/react/workspace/toolbars/BottomToolbar.js.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/RightToolbar.js +18 -0
- package/dist/react/workspace/toolbars/RightToolbar.js.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/react/workspace/toolbars/TopToolbar.js +82 -0
- package/dist/react/workspace/toolbars/TopToolbar.js.map +1 -0
- package/dist/renderers/CandlestickRenderer.d.ts +13 -0
- package/dist/renderers/CandlestickRenderer.d.ts.map +1 -0
- package/dist/renderers/CandlestickRenderer.js +98 -0
- package/dist/renderers/CandlestickRenderer.js.map +1 -0
- package/dist/renderers/HistogramRenderer.d.ts +11 -0
- package/dist/renderers/HistogramRenderer.d.ts.map +1 -0
- package/dist/renderers/HistogramRenderer.js +50 -0
- package/dist/renderers/HistogramRenderer.js.map +1 -0
- package/dist/renderers/LineRenderer.d.ts +12 -0
- package/dist/renderers/LineRenderer.d.ts.map +1 -0
- package/dist/renderers/LineRenderer.js +64 -0
- package/dist/renderers/LineRenderer.js.map +1 -0
- package/dist/theme/colors.d.ts +4 -0
- package/dist/theme/colors.d.ts.map +1 -0
- package/dist/theme/colors.js +19 -0
- package/dist/theme/colors.js.map +1 -0
- package/dist/tools/barDivergenceCheck.d.ts +120 -0
- package/dist/tools/barDivergenceCheck.d.ts.map +1 -0
- package/dist/tools/barDivergenceCheck.js +200 -0
- package/dist/tools/barDivergenceCheck.js.map +1 -0
- package/dist/trading/TradingOverlayStore.d.ts +86 -0
- package/dist/trading/TradingOverlayStore.d.ts.map +1 -0
- package/dist/trading/TradingOverlayStore.js +139 -0
- package/dist/trading/TradingOverlayStore.js.map +1 -0
- package/dist/trading/UnmanagedIngestion.d.ts +91 -0
- package/dist/trading/UnmanagedIngestion.d.ts.map +1 -0
- package/dist/trading/UnmanagedIngestion.js +114 -0
- package/dist/trading/UnmanagedIngestion.js.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__/ManagedTradingController.test.js +271 -0
- package/dist/trading/__tests__/ManagedTradingController.test.js.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__/TradingOverlayStore.test.js +267 -0
- package/dist/trading/__tests__/TradingOverlayStore.test.js.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/__tests__/UnmanagedIngestion.test.js +170 -0
- package/dist/trading/__tests__/UnmanagedIngestion.test.js.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/ManagedTradingController.js +247 -0
- package/dist/trading/managed/ManagedTradingController.js.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/managedCapabilities.js +79 -0
- package/dist/trading/managed/managedCapabilities.js.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/managed/managedTypes.js +13 -0
- package/dist/trading/managed/managedTypes.js.map +1 -0
- package/dist/trading/tradingTypes.d.ts +89 -0
- package/dist/trading/tradingTypes.d.ts.map +1 -0
- package/dist/trading/tradingTypes.js +8 -0
- package/dist/trading/tradingTypes.js.map +1 -0
- package/dist/tscript/TScriptIndicator.d.ts +41 -0
- package/dist/tscript/TScriptIndicator.d.ts.map +1 -0
- package/dist/tscript/TScriptIndicator.js +47 -0
- package/dist/tscript/TScriptIndicator.js.map +1 -0
- package/dist/tscript/ast.d.ts +89 -0
- package/dist/tscript/ast.d.ts.map +1 -0
- package/dist/tscript/ast.js +22 -0
- package/dist/tscript/ast.js.map +1 -0
- package/dist/tscript/lexer.d.ts +36 -0
- package/dist/tscript/lexer.d.ts.map +1 -0
- package/dist/tscript/lexer.js +187 -0
- package/dist/tscript/lexer.js.map +1 -0
- package/dist/tscript/parser.d.ts +50 -0
- package/dist/tscript/parser.d.ts.map +1 -0
- package/dist/tscript/parser.js +318 -0
- package/dist/tscript/parser.js.map +1 -0
- package/dist/tscript/runtime.d.ts +123 -0
- package/dist/tscript/runtime.d.ts.map +1 -0
- package/dist/tscript/runtime.js +475 -0
- package/dist/tscript/runtime.js.map +1 -0
- package/dist/tscript/series.d.ts +49 -0
- package/dist/tscript/series.d.ts.map +1 -0
- package/dist/tscript/series.js +79 -0
- package/dist/tscript/series.js.map +1 -0
- package/dist/types/IChart.d.ts +48 -0
- package/dist/types/IChart.d.ts.map +1 -0
- package/dist/types/IChart.js +2 -0
- package/dist/types/IChart.js.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/IRenderer.js +2 -0
- package/dist/types/IRenderer.js.map +1 -0
- package/dist/types/ISeries.d.ts +26 -0
- package/dist/types/ISeries.d.ts.map +1 -0
- package/dist/types/ISeries.js +2 -0
- package/dist/types/ISeries.js.map +1 -0
- package/package.json +32 -4
- package/src/__tests__/backwardCompatibility.test.ts +0 -191
- package/src/__tests__/candleInvariant.test.ts +0 -500
- 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/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/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/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 -22
- package/tsup.config.ts +0 -15
- package/vitest.config.ts +0 -25
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { Graphics, Container, Text, TextStyle } from 'pixi.js';
|
|
2
|
-
import type { ChartColors } from '@forgecharts/types';
|
|
3
|
-
import type { CoordTransform } from '../core/CoordTransform';
|
|
4
|
-
import { computeTicks } from '../core/TimeScale';
|
|
5
|
-
import { formatTimestampLabel } from '@forgecharts/utils';
|
|
6
|
-
import type { TimeScale } from '../core/TimeScale';
|
|
7
|
-
|
|
8
|
-
const TICK_LEN = 4;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* PixiGridRenderer — draws background fill, horizontal grid lines (price),
|
|
12
|
-
* vertical grid lines (time), and the axis separator borders.
|
|
13
|
-
*
|
|
14
|
-
* All drawing uses PixiJS `Graphics` which is GPU-batched.
|
|
15
|
-
*/
|
|
16
|
-
export class PixiGridRenderer {
|
|
17
|
-
private readonly _gfx: Graphics;
|
|
18
|
-
private readonly _timeLabels: Container;
|
|
19
|
-
private readonly _priceLabels: Container;
|
|
20
|
-
private readonly _timeScale: TimeScale;
|
|
21
|
-
|
|
22
|
-
constructor(
|
|
23
|
-
layer: Container,
|
|
24
|
-
private readonly _colors: ChartColors,
|
|
25
|
-
timeScale: TimeScale,
|
|
26
|
-
) {
|
|
27
|
-
this._timeScale = timeScale;
|
|
28
|
-
this._gfx = new Graphics();
|
|
29
|
-
this._timeLabels = new Container();
|
|
30
|
-
this._priceLabels = new Container();
|
|
31
|
-
layer.addChild(this._gfx, this._timeLabels, this._priceLabels);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
draw(transform: CoordTransform, width: number, height: number): void {
|
|
35
|
-
const gfx = this._gfx;
|
|
36
|
-
gfx.clear();
|
|
37
|
-
|
|
38
|
-
const { plotWidth: pw, plotHeight: ph, priceScaleWidth, timeScaleHeight } = transform;
|
|
39
|
-
const { min: priceMin, max: priceMax } = transform.priceRange;
|
|
40
|
-
const { from: timeFrom, to: timeTo } = transform.timeRange;
|
|
41
|
-
|
|
42
|
-
// ── Background ────────────────────────────────────────────────────────────
|
|
43
|
-
gfx.rect(0, 0, width, height).fill(this._colors.background);
|
|
44
|
-
|
|
45
|
-
// ── Horizontal price grid ─────────────────────────────────────────────────
|
|
46
|
-
const priceTicks = computeTicks(priceMin, priceMax, Math.max(2, Math.floor(ph / 50)));
|
|
47
|
-
this._priceLabels.removeChildren();
|
|
48
|
-
|
|
49
|
-
const labelStyle = new TextStyle({
|
|
50
|
-
fontSize: 11,
|
|
51
|
-
fontFamily: 'system-ui, sans-serif',
|
|
52
|
-
fill: this._colors.text,
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
for (const tick of priceTicks) {
|
|
56
|
-
if (tick < priceMin || tick > priceMax) continue;
|
|
57
|
-
const y = transform.priceToY(tick);
|
|
58
|
-
if (y < 0 || y > ph) continue;
|
|
59
|
-
|
|
60
|
-
gfx.moveTo(0, y).lineTo(pw, y).stroke({ color: this._colors.grid, width: 1, alpha: 0.5 });
|
|
61
|
-
|
|
62
|
-
// Tick mark on axis border
|
|
63
|
-
gfx.moveTo(pw, y).lineTo(pw + TICK_LEN, y).stroke({ color: this._colors.border, width: 1 });
|
|
64
|
-
|
|
65
|
-
// Price label
|
|
66
|
-
const t = new Text({ text: this._formatPrice(tick), style: labelStyle });
|
|
67
|
-
t.x = pw + TICK_LEN + 2;
|
|
68
|
-
t.y = y - t.height / 2;
|
|
69
|
-
this._priceLabels.addChild(t);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// ── Vertical time grid ────────────────────────────────────────────────────
|
|
73
|
-
const approxTicks = Math.max(2, Math.floor(pw / 100));
|
|
74
|
-
const span = timeTo - timeFrom;
|
|
75
|
-
const rawStep = span / approxTicks;
|
|
76
|
-
const step = this._niceTimeStep(rawStep);
|
|
77
|
-
const startTime = Math.ceil(timeFrom / step) * step;
|
|
78
|
-
|
|
79
|
-
this._timeLabels.removeChildren();
|
|
80
|
-
const timeLabelStyle = new TextStyle({
|
|
81
|
-
fontSize: 11,
|
|
82
|
-
fontFamily: 'system-ui, sans-serif',
|
|
83
|
-
fill: this._colors.text,
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
for (let t = startTime; t <= timeTo; t += step) {
|
|
87
|
-
const x = transform.timeToX(t);
|
|
88
|
-
if (x < 0 || x > pw) continue;
|
|
89
|
-
|
|
90
|
-
gfx.moveTo(x, 0).lineTo(x, ph).stroke({ color: this._colors.grid, width: 1, alpha: 0.4 });
|
|
91
|
-
gfx.moveTo(x, ph).lineTo(x, ph + TICK_LEN).stroke({ color: this._colors.border, width: 1 });
|
|
92
|
-
|
|
93
|
-
const label = formatTimestampLabel(t, step);
|
|
94
|
-
const tl = new Text({ text: label, style: timeLabelStyle });
|
|
95
|
-
tl.x = x - tl.width / 2;
|
|
96
|
-
tl.y = ph + TICK_LEN + 2;
|
|
97
|
-
this._timeLabels.addChild(tl);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// ── Axis separator lines ──────────────────────────────────────────────────
|
|
101
|
-
gfx
|
|
102
|
-
.moveTo(0, ph).lineTo(pw, ph)
|
|
103
|
-
.stroke({ color: this._colors.border, width: 1 });
|
|
104
|
-
gfx
|
|
105
|
-
.moveTo(pw, 0).lineTo(pw, ph)
|
|
106
|
-
.stroke({ color: this._colors.border, width: 1 });
|
|
107
|
-
|
|
108
|
-
// ── Price axis background fill ────────────────────────────────────────────
|
|
109
|
-
gfx.rect(pw, 0, priceScaleWidth, ph).fill(this._colors.backgroundSecondary);
|
|
110
|
-
|
|
111
|
-
// ── Time axis background fill ─────────────────────────────────────────────
|
|
112
|
-
gfx.rect(0, ph, pw, timeScaleHeight).fill(this._colors.backgroundSecondary);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
private _formatPrice(price: number): string {
|
|
116
|
-
const decimals = price < 1 ? 6 : price < 1000 ? 4 : 2;
|
|
117
|
-
return price.toFixed(decimals);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
private _niceTimeStep(rawSeconds: number): number {
|
|
121
|
-
const nice = [
|
|
122
|
-
1, 5, 10, 30, 60, 300, 600, 900, 1800, 3600, 7200, 14400, 21600, 43200,
|
|
123
|
-
86400, // 1 day
|
|
124
|
-
7 * 86400, // 1 week
|
|
125
|
-
14 * 86400, // 2 weeks
|
|
126
|
-
30 * 86400, // ~1 month
|
|
127
|
-
91 * 86400, // ~quarter
|
|
128
|
-
182 * 86400, // ~half year
|
|
129
|
-
365 * 86400, // ~1 year
|
|
130
|
-
];
|
|
131
|
-
for (const s of nice) {
|
|
132
|
-
if (s >= rawSeconds) return s;
|
|
133
|
-
}
|
|
134
|
-
return 365 * 86400 * Math.ceil(rawSeconds / (365 * 86400));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { Container } from 'pixi.js';
|
|
2
|
-
import { LayerName, LAYER_NAMES, LAYER_LABEL } from './LayerName';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* DirtyFlags — bitmask that tracks which layers need to be redrawn.
|
|
6
|
-
*
|
|
7
|
-
* Call `mark(layer)` whenever data or viewport changes affecting a layer.
|
|
8
|
-
* Call `isDirty(layer)` before redrawing to skip unnecessary work.
|
|
9
|
-
* Call `clear(layer)` after the layer finishes drawing.
|
|
10
|
-
*/
|
|
11
|
-
export class DirtyFlags {
|
|
12
|
-
private _bits = 0;
|
|
13
|
-
|
|
14
|
-
mark(layer: LayerName): void {
|
|
15
|
-
this._bits |= 1 << layer;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
markAll(): void {
|
|
19
|
-
this._bits = (1 << LAYER_NAMES.length) - 1;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
isDirty(layer: LayerName): boolean {
|
|
23
|
-
return (this._bits & (1 << layer)) !== 0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
clear(layer: LayerName): void {
|
|
27
|
-
this._bits &= ~(1 << layer);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
clearAll(): void {
|
|
31
|
-
this._bits = 0;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* PixiLayerManager — owns one PixiJS `Container` per layer, stacked by z-index.
|
|
37
|
-
*
|
|
38
|
-
* Responsibilities:
|
|
39
|
-
* - Creates and names seven containers corresponding to `LayerName` values
|
|
40
|
-
* - Attaches all containers to a root `Container` already mounted in the stage
|
|
41
|
-
* - Exposes `get(layer)` so renderers can add display objects to the right layer
|
|
42
|
-
* - Owns a `DirtyFlags` instance for selective redraw signalling
|
|
43
|
-
* - `clear(layer)` removes all children from a layer without destroying the container
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```ts
|
|
47
|
-
* const layers = new PixiLayerManager(stage);
|
|
48
|
-
*
|
|
49
|
-
* // Direct child access
|
|
50
|
-
* const seriesContainer = layers.get(LayerName.PriceSeries);
|
|
51
|
-
*
|
|
52
|
-
* // Invalidation
|
|
53
|
-
* layers.dirty.mark(LayerName.PriceSeries);
|
|
54
|
-
* if (layers.dirty.isDirty(LayerName.PriceSeries)) {
|
|
55
|
-
* // redraw…
|
|
56
|
-
* layers.dirty.clear(LayerName.PriceSeries);
|
|
57
|
-
* }
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
export class PixiLayerManager {
|
|
61
|
-
private readonly _containers = new Map<LayerName, Container>();
|
|
62
|
-
readonly dirty = new DirtyFlags();
|
|
63
|
-
|
|
64
|
-
constructor(stage: Container) {
|
|
65
|
-
for (const name of LAYER_NAMES) {
|
|
66
|
-
const c = new Container();
|
|
67
|
-
c.label = LAYER_LABEL[name];
|
|
68
|
-
c.zIndex = name;
|
|
69
|
-
stage.addChild(c);
|
|
70
|
-
this._containers.set(name, c);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// PixiJS v8: sortableChildren must be true on the stage so zIndex is respected
|
|
74
|
-
stage.sortableChildren = true;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/** Returns the `Container` for the given layer. */
|
|
78
|
-
get(layer: LayerName): Container {
|
|
79
|
-
const c = this._containers.get(layer);
|
|
80
|
-
if (!c) throw new Error(`[ForgeCharts] Unknown layer: ${layer}`);
|
|
81
|
-
return c;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/** Removes all display objects from a layer (preserves the container itself). */
|
|
85
|
-
clear(layer: LayerName): void {
|
|
86
|
-
this.get(layer).removeChildren();
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/** Removes all display objects from every layer. */
|
|
90
|
-
clearAll(): void {
|
|
91
|
-
for (const name of LAYER_NAMES) this.clear(name);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/** Destroys all container children (use on chart destroy). */
|
|
95
|
-
destroy(): void {
|
|
96
|
-
for (const name of LAYER_NAMES) {
|
|
97
|
-
const c = this._containers.get(name);
|
|
98
|
-
c?.destroy({ children: true });
|
|
99
|
-
}
|
|
100
|
-
this._containers.clear();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import type { OHLCV, SeriesOptions, Viewport, Rect, ChartColors } from '@forgecharts/types';
|
|
2
|
-
import type { IRenderer } from '../types/IRenderer';
|
|
3
|
-
import { mapRange } from '@forgecharts/utils';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* CandlestickRenderer — draws OHLCV data as Japanese candlesticks.
|
|
7
|
-
* All rendering is pure Canvas 2D; no third-party dependencies.
|
|
8
|
-
*/
|
|
9
|
-
export class CandlestickRenderer implements IRenderer {
|
|
10
|
-
private readonly _colors: ChartColors;
|
|
11
|
-
|
|
12
|
-
constructor(colors: ChartColors) {
|
|
13
|
-
this._colors = colors;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
draw(
|
|
17
|
-
ctx: CanvasRenderingContext2D,
|
|
18
|
-
bars: readonly OHLCV[],
|
|
19
|
-
viewport: Viewport,
|
|
20
|
-
rect: Rect,
|
|
21
|
-
options: SeriesOptions,
|
|
22
|
-
): void {
|
|
23
|
-
if (options.type !== 'candlestick' && options.type !== 'heikinashi' && options.type !== 'bar') {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const plotData = options.type === 'heikinashi' ? this._toHeikinAshi(bars) : bars;
|
|
27
|
-
|
|
28
|
-
const upColor = 'upColor' in options ? (options.upColor ?? '#26a641') : '#26a641';
|
|
29
|
-
const downColor = 'downColor' in options ? (options.downColor ?? '#f85149') : '#f85149';
|
|
30
|
-
const wickUpColor = 'wickUpColor' in options ? (options.wickUpColor ?? upColor) : upColor;
|
|
31
|
-
const wickDownColor =
|
|
32
|
-
'wickDownColor' in options ? (options.wickDownColor ?? downColor) : downColor;
|
|
33
|
-
const borderVisible = 'borderVisible' in options ? (options.borderVisible ?? false) : false;
|
|
34
|
-
|
|
35
|
-
const plotW = rect.width - 70; // price axis reserved
|
|
36
|
-
const plotH = rect.height - 30; // time axis reserved
|
|
37
|
-
|
|
38
|
-
// ── Bar pitch: pixels per candle ─────────────────────────────────────────
|
|
39
|
-
// IMPORTANT: must be derived from the visible time range + candle interval,
|
|
40
|
-
// NOT from total bar count. Using bar count means pitch shrinks as you pan
|
|
41
|
-
// into history (more bars → narrower candles) and widens as you pan forward
|
|
42
|
-
// (fewer bars visible → wider candles with gaps), which is wrong.
|
|
43
|
-
|
|
44
|
-
// Infer candle interval from the median gap between consecutive bars.
|
|
45
|
-
let candleInterval = 0;
|
|
46
|
-
if (plotData.length >= 2) {
|
|
47
|
-
const deltas: number[] = [];
|
|
48
|
-
for (let i = 1; i < Math.min(plotData.length, 20); i++) {
|
|
49
|
-
const d = plotData[i]!.time - plotData[i - 1]!.time;
|
|
50
|
-
if (d > 0) deltas.push(d);
|
|
51
|
-
}
|
|
52
|
-
if (deltas.length > 0) {
|
|
53
|
-
deltas.sort((a, b) => a - b);
|
|
54
|
-
candleInterval = deltas[Math.floor(deltas.length / 2)]!;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const visibleSpan = viewport.timeRange.to - viewport.timeRange.from;
|
|
59
|
-
const pixelsPerSecond = visibleSpan > 0 ? plotW / visibleSpan : 1;
|
|
60
|
-
const barPitch = candleInterval > 0
|
|
61
|
-
? candleInterval * pixelsPerSecond // correct: interval-based
|
|
62
|
-
: plotW / Math.max(1, plotData.length); // fallback for edge cases
|
|
63
|
-
|
|
64
|
-
const minBarWidth = 1;
|
|
65
|
-
const maxBarWidth = 20;
|
|
66
|
-
const gap = Math.max(1, Math.round(barPitch * 0.15));
|
|
67
|
-
const barWidth = Math.min(
|
|
68
|
-
maxBarWidth,
|
|
69
|
-
Math.max(minBarWidth, Math.floor(barPitch) - gap),
|
|
70
|
-
);
|
|
71
|
-
const halfBar = Math.max(0.5, barWidth / 2);
|
|
72
|
-
|
|
73
|
-
for (const bar of plotData) {
|
|
74
|
-
const x = mapRange(
|
|
75
|
-
bar.time,
|
|
76
|
-
viewport.timeRange.from,
|
|
77
|
-
viewport.timeRange.to,
|
|
78
|
-
0,
|
|
79
|
-
plotW,
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
if (x < -barWidth || x > plotW + barWidth) continue;
|
|
83
|
-
|
|
84
|
-
const yOpen = mapRange(bar.open, viewport.priceRange.max, viewport.priceRange.min, 0, plotH);
|
|
85
|
-
const yClose = mapRange(bar.close, viewport.priceRange.max, viewport.priceRange.min, 0, plotH);
|
|
86
|
-
const yHigh = mapRange(bar.high, viewport.priceRange.max, viewport.priceRange.min, 0, plotH);
|
|
87
|
-
const yLow = mapRange(bar.low, viewport.priceRange.max, viewport.priceRange.min, 0, plotH);
|
|
88
|
-
|
|
89
|
-
const bullish = bar.close >= bar.open;
|
|
90
|
-
const bodyColor = bullish ? upColor : downColor;
|
|
91
|
-
const bodyTop = Math.min(yOpen, yClose);
|
|
92
|
-
const bodyBottom = Math.max(yOpen, yClose);
|
|
93
|
-
const bodyH = Math.max(1, bodyBottom - bodyTop);
|
|
94
|
-
|
|
95
|
-
// Wick
|
|
96
|
-
ctx.beginPath();
|
|
97
|
-
ctx.strokeStyle = bullish ? wickUpColor : wickDownColor;
|
|
98
|
-
ctx.lineWidth = 1;
|
|
99
|
-
ctx.moveTo(x, yHigh);
|
|
100
|
-
ctx.lineTo(x, bodyTop);
|
|
101
|
-
ctx.moveTo(x, bodyBottom);
|
|
102
|
-
ctx.lineTo(x, yLow);
|
|
103
|
-
ctx.stroke();
|
|
104
|
-
|
|
105
|
-
// Body
|
|
106
|
-
ctx.fillStyle = bodyColor;
|
|
107
|
-
ctx.fillRect(x - halfBar, bodyTop, barWidth, bodyH);
|
|
108
|
-
|
|
109
|
-
if (borderVisible) {
|
|
110
|
-
ctx.strokeStyle = bodyColor;
|
|
111
|
-
ctx.lineWidth = 1;
|
|
112
|
-
ctx.strokeRect(x - halfBar, bodyTop, barWidth, bodyH);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
private _toHeikinAshi(bars: readonly OHLCV[]): OHLCV[] {
|
|
118
|
-
const result: OHLCV[] = [];
|
|
119
|
-
for (let i = 0; i < bars.length; i++) {
|
|
120
|
-
const bar = bars[i]!;
|
|
121
|
-
const prev = result[i - 1] ?? bar;
|
|
122
|
-
const haClose = (bar.open + bar.high + bar.low + bar.close) / 4;
|
|
123
|
-
const haOpen = (prev.open + prev.close) / 2;
|
|
124
|
-
const haHigh = Math.max(bar.high, haOpen, haClose);
|
|
125
|
-
const haLow = Math.min(bar.low, haOpen, haClose);
|
|
126
|
-
result.push({ time: bar.time, open: haOpen, high: haHigh, low: haLow, close: haClose, volume: bar.volume });
|
|
127
|
-
}
|
|
128
|
-
return result;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { OHLCV, SeriesOptions, Viewport, Rect, ChartColors } from '@forgecharts/types';
|
|
2
|
-
import type { IRenderer } from '../types/IRenderer';
|
|
3
|
-
import { mapRange } from '@forgecharts/utils';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* HistogramRenderer — draws volume or indicator values as vertical bars.
|
|
7
|
-
*/
|
|
8
|
-
export class HistogramRenderer implements IRenderer {
|
|
9
|
-
private readonly _colors: ChartColors;
|
|
10
|
-
|
|
11
|
-
constructor(colors: ChartColors) {
|
|
12
|
-
this._colors = colors;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
draw(
|
|
16
|
-
ctx: CanvasRenderingContext2D,
|
|
17
|
-
bars: readonly OHLCV[],
|
|
18
|
-
viewport: Viewport,
|
|
19
|
-
rect: Rect,
|
|
20
|
-
options: SeriesOptions,
|
|
21
|
-
): void {
|
|
22
|
-
if (options.type !== 'histogram') return;
|
|
23
|
-
|
|
24
|
-
const color = options.color ?? '#8b949e';
|
|
25
|
-
const plotW = rect.width - 70;
|
|
26
|
-
const plotH = rect.height - 30;
|
|
27
|
-
|
|
28
|
-
// Derive pitch from candle interval × pixels-per-second (same fix as CandlestickRenderer)
|
|
29
|
-
let candleInterval = 0;
|
|
30
|
-
if (bars.length >= 2) {
|
|
31
|
-
const deltas: number[] = [];
|
|
32
|
-
for (let i = 1; i < Math.min(bars.length, 20); i++) {
|
|
33
|
-
const d = bars[i]!.time - bars[i - 1]!.time;
|
|
34
|
-
if (d > 0) deltas.push(d);
|
|
35
|
-
}
|
|
36
|
-
if (deltas.length > 0) {
|
|
37
|
-
deltas.sort((a, b) => a - b);
|
|
38
|
-
candleInterval = deltas[Math.floor(deltas.length / 2)]!;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
const visibleSpan = viewport.timeRange.to - viewport.timeRange.from;
|
|
42
|
-
const pixelsPerSecond = visibleSpan > 0 ? plotW / visibleSpan : 1;
|
|
43
|
-
const barPitch = candleInterval > 0
|
|
44
|
-
? candleInterval * pixelsPerSecond
|
|
45
|
-
: plotW / Math.max(1, bars.length);
|
|
46
|
-
const barWidth = Math.max(1, Math.floor(barPitch) - 1);
|
|
47
|
-
const halfBar = barWidth / 2;
|
|
48
|
-
const baseline = plotH; // draws from bottom up
|
|
49
|
-
|
|
50
|
-
for (const bar of bars) {
|
|
51
|
-
const x = mapRange(bar.time, viewport.timeRange.from, viewport.timeRange.to, 0, plotW);
|
|
52
|
-
if (x < -barWidth || x > plotW + barWidth) continue;
|
|
53
|
-
|
|
54
|
-
const y = mapRange(bar.volume, viewport.priceRange.max, viewport.priceRange.min, 0, plotH);
|
|
55
|
-
const barH = Math.max(1, baseline - y);
|
|
56
|
-
|
|
57
|
-
ctx.fillStyle = bar.close >= bar.open ? '#26a641' : '#f85149';
|
|
58
|
-
ctx.fillRect(x - halfBar, y, barWidth, barH);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
void color; // unused when per-bar coloring is active
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { OHLCV, SeriesOptions, Viewport, Rect, ChartColors } from '@forgecharts/types';
|
|
2
|
-
import type { IRenderer } from '../types/IRenderer';
|
|
3
|
-
import { mapRange } from '@forgecharts/utils';
|
|
4
|
-
import { hexToRgba } from '@forgecharts/utils';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* LineRenderer — draws close prices as a line or area series.
|
|
8
|
-
*/
|
|
9
|
-
export class LineRenderer implements IRenderer {
|
|
10
|
-
private readonly _colors: ChartColors;
|
|
11
|
-
|
|
12
|
-
constructor(colors: ChartColors) {
|
|
13
|
-
this._colors = colors;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
draw(
|
|
17
|
-
ctx: CanvasRenderingContext2D,
|
|
18
|
-
bars: readonly OHLCV[],
|
|
19
|
-
viewport: Viewport,
|
|
20
|
-
rect: Rect,
|
|
21
|
-
options: SeriesOptions,
|
|
22
|
-
): void {
|
|
23
|
-
if (options.type !== 'line' && options.type !== 'area') return;
|
|
24
|
-
if (bars.length < 2) return;
|
|
25
|
-
|
|
26
|
-
const color = options.color ?? '#58a6ff';
|
|
27
|
-
const lineWidth = options.lineWidth ?? 2;
|
|
28
|
-
const isArea = options.type === 'area';
|
|
29
|
-
|
|
30
|
-
const plotW = rect.width - 70;
|
|
31
|
-
const plotH = rect.height - 30;
|
|
32
|
-
|
|
33
|
-
const points = bars.map((bar) => ({
|
|
34
|
-
x: mapRange(bar.time, viewport.timeRange.from, viewport.timeRange.to, 0, plotW),
|
|
35
|
-
y: mapRange(bar.close, viewport.priceRange.max, viewport.priceRange.min, 0, plotH),
|
|
36
|
-
}));
|
|
37
|
-
|
|
38
|
-
// Line path
|
|
39
|
-
ctx.beginPath();
|
|
40
|
-
ctx.strokeStyle = color;
|
|
41
|
-
ctx.lineWidth = lineWidth;
|
|
42
|
-
this._applyLineStyle(ctx, options.lineStyle ?? 'solid');
|
|
43
|
-
|
|
44
|
-
const first = points[0]!;
|
|
45
|
-
ctx.moveTo(first.x, first.y);
|
|
46
|
-
for (let i = 1; i < points.length; i++) {
|
|
47
|
-
ctx.lineTo(points[i]!.x, points[i]!.y);
|
|
48
|
-
}
|
|
49
|
-
ctx.stroke();
|
|
50
|
-
ctx.setLineDash([]);
|
|
51
|
-
|
|
52
|
-
// Area fill
|
|
53
|
-
if (isArea) {
|
|
54
|
-
ctx.beginPath();
|
|
55
|
-
ctx.moveTo(first.x, plotH);
|
|
56
|
-
ctx.lineTo(first.x, first.y);
|
|
57
|
-
for (let i = 1; i < points.length; i++) {
|
|
58
|
-
ctx.lineTo(points[i]!.x, points[i]!.y);
|
|
59
|
-
}
|
|
60
|
-
const last = points[points.length - 1]!;
|
|
61
|
-
ctx.lineTo(last.x, plotH);
|
|
62
|
-
ctx.closePath();
|
|
63
|
-
|
|
64
|
-
const gradient = ctx.createLinearGradient(0, 0, 0, plotH);
|
|
65
|
-
gradient.addColorStop(0, hexToRgba(color, 0.3));
|
|
66
|
-
gradient.addColorStop(1, hexToRgba(color, 0.0));
|
|
67
|
-
ctx.fillStyle = gradient;
|
|
68
|
-
ctx.fill();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
private _applyLineStyle(ctx: CanvasRenderingContext2D, style: string): void {
|
|
73
|
-
if (style === 'dashed') ctx.setLineDash([6, 3]);
|
|
74
|
-
else if (style === 'dotted') ctx.setLineDash([2, 3]);
|
|
75
|
-
else ctx.setLineDash([]);
|
|
76
|
-
}
|
|
77
|
-
}
|
package/src/theme/colors.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ChartColors } from '@forgecharts/types';
|
|
2
|
-
|
|
3
|
-
export const DARK_COLORS: ChartColors = {
|
|
4
|
-
background: '#000000',
|
|
5
|
-
backgroundSecondary: '#0a0a0a',
|
|
6
|
-
text: '#ffffff',
|
|
7
|
-
textMuted: '#888888',
|
|
8
|
-
grid: '#2a2a2a',
|
|
9
|
-
border: '#333333',
|
|
10
|
-
crosshair: '#ffffff',
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const LIGHT_COLORS: ChartColors = {
|
|
14
|
-
background: '#ffffff',
|
|
15
|
-
backgroundSecondary: '#f5f5f5',
|
|
16
|
-
text: '#000000',
|
|
17
|
-
textMuted: '#666666',
|
|
18
|
-
grid: '#e8e8e8',
|
|
19
|
-
border: '#cccccc',
|
|
20
|
-
crosshair: '#000000',
|
|
21
|
-
};
|