@vninvestcharts/widget 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE.md +83 -0
- package/README.md +851 -3
- package/dist/AlertsModal-WKEUDTUZ.js +2 -0
- package/dist/ConnectedTradingPanel-KWJMIKTN.css +2 -0
- package/dist/ConnectedTradingPanel-XDKMOQY5.js +2 -0
- package/dist/PineEditorPanel-AUXB4FD3.js +2 -0
- package/dist/PineEditorPanel-V6YN2OTU.css +2 -0
- package/dist/RightSidebarDockHost-6FPZ6EKV.css +2 -0
- package/dist/RightSidebarDockHost-OBFXKSIY.js +2 -0
- package/dist/StrategyTesterPanel-6IUTS2P4.js +2 -0
- package/dist/StrategyTesterPanel-LEWEUMXP.css +2 -0
- package/dist/VolumeProfileWorker-UREKVPUE.js +189 -0
- package/dist/adapters/index.cjs +2532 -0
- package/dist/adapters/index.d.mts +673 -0
- package/dist/adapters/index.d.ts +673 -0
- package/dist/adapters/index.js +2521 -0
- package/dist/adapters/index.umd.js +2535 -0
- package/dist/chunk-5T6DGB3V.js +2 -0
- package/dist/chunk-66JBEGR3.js +4 -0
- package/dist/chunk-6D7DVBIK.js +2 -0
- package/dist/chunk-76E7CKUD.js +2 -0
- package/dist/chunk-AKWVXRQ6.js +2 -0
- package/dist/chunk-FHHSTO6Z.js +2 -0
- package/dist/chunk-HPL723JA.js +2 -0
- package/dist/chunk-NVGTF73S.js +2 -0
- package/dist/chunk-PNIB4OM3.js +2 -0
- package/dist/chunk-UKJ5AKQX.js +595 -0
- package/dist/chunk-UYJTX3SD.js +2 -0
- package/dist/combined.css +3068 -0
- package/dist/css-modules-manifest.json +297 -0
- package/dist/dist-Y6PZ2RN3.js +12 -0
- package/dist/drawing/index.cjs +53 -0
- package/dist/drawing/index.d.mts +2 -0
- package/dist/drawing/index.d.ts +2 -0
- package/dist/drawing/index.js +2 -0
- package/dist/drawing/index.umd.js +54 -0
- package/dist/dts/drawing-shim.d.ts +3 -0
- package/dist/dts/index.d.ts +31 -0
- package/dist/dts/lib/Chart.d.ts +31 -0
- package/dist/dts/lib/ChartContext.d.ts +10 -0
- package/dist/dts/lib/EventCapture.d.ts +3 -0
- package/dist/dts/lib/GenericChartComponent.d.ts +5 -0
- package/dist/dts/lib/GenericComponent.d.ts +124 -0
- package/dist/dts/lib/StockChartContext.d.ts +53 -0
- package/dist/dts/lib/adapters/BaseAdapter.d.ts +25 -0
- package/dist/dts/lib/adapters/BinanceAdapter.d.ts +51 -0
- package/dist/dts/lib/adapters/CSVAdapter.d.ts +17 -0
- package/dist/dts/lib/adapters/ContinuousContractAdapter.d.ts +63 -0
- package/dist/dts/lib/adapters/ContinuousContractTypes.d.ts +154 -0
- package/dist/dts/lib/adapters/DBAdapter.d.ts +16 -0
- package/dist/dts/lib/adapters/DataAdapter.d.ts +136 -0
- package/dist/dts/lib/adapters/DjangoVnstockAdapter.d.ts +15 -0
- package/dist/dts/lib/adapters/LocalCacheAdapter.d.ts +18 -0
- package/dist/dts/lib/adapters/MockAdapter.d.ts +22 -0
- package/dist/dts/lib/adapters/RESTAdapter.d.ts +16 -0
- package/dist/dts/lib/adapters/StockDataAdapter.d.ts +1 -0
- package/dist/dts/lib/adapters/UDFDataAdapter.d.ts +29 -0
- package/dist/dts/lib/adapters/VNStocksAdapter.d.ts +8 -0
- package/dist/dts/lib/adapters/WSAdapter.d.ts +30 -0
- package/dist/dts/lib/adapters/gapFixture.d.ts +71 -0
- package/dist/dts/lib/adapters/index.d.ts +15 -0
- package/dist/dts/lib/adapters/rollAlgorithms.d.ts +68 -0
- package/dist/dts/lib/advisory/AdvisoryPanel.d.ts +5 -0
- package/dist/dts/lib/alerts/AlertEvaluator.d.ts +5 -0
- package/dist/dts/lib/alerts/AlertManager.d.ts +123 -0
- package/dist/dts/lib/alerts/types.d.ts +58 -0
- package/dist/dts/lib/cache/cacheDebug.d.ts +3 -0
- package/dist/dts/lib/calendars/ExchangeCalendar.d.ts +23 -0
- package/dist/dts/lib/calendars/calendarRegistry.d.ts +10 -0
- package/dist/dts/lib/calendars/index.d.ts +3 -0
- package/dist/dts/lib/core/ChartPane.d.ts +8 -0
- package/dist/dts/lib/core/ChartSplitter.d.ts +70 -0
- package/dist/dts/lib/core/ChartTerminal.d.ts +12 -0
- package/dist/dts/lib/core/ErrorBoundary.d.ts +17 -0
- package/dist/dts/lib/core/IndicatorLegend.d.ts +47 -0
- package/dist/dts/lib/core/PaneHeader.d.ts +24 -0
- package/dist/dts/lib/core/PaneLabel.d.ts +8 -0
- package/dist/dts/lib/core/PaneSplitter.d.ts +9 -0
- package/dist/dts/lib/core/SeriesPicker.d.ts +10 -0
- package/dist/dts/lib/core/calculators/alignBarsByDate.d.ts +38 -0
- package/dist/dts/lib/core/calculators/buildIndicatorComputationPlan.d.ts +16 -0
- package/dist/dts/lib/core/calculators/calcCVDApprox.d.ts +6 -0
- package/dist/dts/lib/core/calculators/calcStrengthElder.d.ts +7 -0
- package/dist/dts/lib/core/calculators/calcWhaleApprox.d.ts +6 -0
- package/dist/dts/lib/core/calculators/computationHelpers.d.ts +12 -0
- package/dist/dts/lib/core/calculators/computeIndicatorComputationResult.d.ts +3 -0
- package/dist/dts/lib/core/calculators/computeMarketStructure.d.ts +8 -0
- package/dist/dts/lib/core/calculators/computeMomentum.d.ts +22 -0
- package/dist/dts/lib/core/calculators/computeMovingAverage.d.ts +15 -0
- package/dist/dts/lib/core/calculators/computeProfile.d.ts +9 -0
- package/dist/dts/lib/core/calculators/computeTrend.d.ts +10 -0
- package/dist/dts/lib/core/calculators/computeVolatility.d.ts +14 -0
- package/dist/dts/lib/core/calculators/computeVolumeFlow.d.ts +19 -0
- package/dist/dts/lib/core/calculators/enrichData.d.ts +7 -0
- package/dist/dts/lib/core/calculators/enrichDataWithCanonicalStore.d.ts +33 -0
- package/dist/dts/lib/core/calculators/exoticChartData.d.ts +140 -0
- package/dist/dts/lib/core/calculators/fixtures/mockData.d.ts +2 -0
- package/dist/dts/lib/core/calculators/indicatorComputation.d.ts +27 -0
- package/dist/dts/lib/core/calculators/indicatorComputationTypes.d.ts +249 -0
- package/dist/dts/lib/core/calculators/materializeIndicatorValues.d.ts +3 -0
- package/dist/dts/lib/core/calculators/normalizePrices.d.ts +36 -0
- package/dist/dts/lib/core/calculators/resolveCalculationOrder.d.ts +17 -0
- package/dist/dts/lib/core/calculators/types.d.ts +269 -0
- package/dist/dts/lib/core/canvas/ChartRenderContext.d.ts +14 -0
- package/dist/dts/lib/core/canvas/OverlayCanvas.d.ts +19 -0
- package/dist/dts/lib/core/context/ChartSyncContext.d.ts +21 -0
- package/dist/dts/lib/core/context/DataContext.d.ts +15 -0
- package/dist/dts/lib/core/context/PaneManagerContext.d.ts +10 -0
- package/dist/dts/lib/core/hooks/paneSizingHelpers.d.ts +13 -0
- package/dist/dts/lib/core/hooks/useCanvasResize.d.ts +8 -0
- package/dist/dts/lib/core/hooks/useChartTheme.d.ts +12 -0
- package/dist/dts/lib/core/hooks/useDynamicPanes.d.ts +155 -0
- package/dist/dts/lib/core/hooks/useIndicatorSets.d.ts +20 -0
- package/dist/dts/lib/core/hooks/usePaneManager.d.ts +39 -0
- package/dist/dts/lib/core/hooks/usePaneSizes.d.ts +52 -0
- package/dist/dts/lib/core/index.d.ts +41 -0
- package/dist/dts/lib/core/paneScaleSlotDomains.d.ts +3 -0
- package/dist/dts/lib/core/registry/SeriesRegistry.d.ts +22 -0
- package/dist/dts/lib/core/registry/filterPanesBySeriesTier.d.ts +43 -0
- package/dist/dts/lib/core/registry/marketStructure.d.ts +7 -0
- package/dist/dts/lib/core/registry/momentum.d.ts +20 -0
- package/dist/dts/lib/core/registry/movingAverage.d.ts +14 -0
- package/dist/dts/lib/core/registry/priceChartTypes.d.ts +16 -0
- package/dist/dts/lib/core/registry/profile.d.ts +8 -0
- package/dist/dts/lib/core/registry/registerAll.d.ts +1 -0
- package/dist/dts/lib/core/registry/registerPhaseOne.d.ts +3 -0
- package/dist/dts/lib/core/registry/registryCore.d.ts +77 -0
- package/dist/dts/lib/core/registry/trend.d.ts +11 -0
- package/dist/dts/lib/core/registry/volatility.d.ts +11 -0
- package/dist/dts/lib/core/registry/volumeFlow.d.ts +20 -0
- package/dist/dts/lib/core/replay/BarReplayController.d.ts +62 -0
- package/dist/dts/lib/core/replay/ReplayEventBus.d.ts +68 -0
- package/dist/dts/lib/core/replay/ReplayFillSimulator.d.ts +33 -0
- package/dist/dts/lib/core/replay/ReplayOrderBook.d.ts +24 -0
- package/dist/dts/lib/core/replay/ReplayPositionManager.d.ts +30 -0
- package/dist/dts/lib/core/replay/ReplaySessionAnalytics.d.ts +31 -0
- package/dist/dts/lib/core/replay/createReplayTradeMarkerPrimitives.d.ts +7 -0
- package/dist/dts/lib/core/replay/pnlUtils.d.ts +2 -0
- package/dist/dts/lib/core/replay/replayBrokerAdapters.d.ts +51 -0
- package/dist/dts/lib/core/replay/replayTradingTypes.d.ts +61 -0
- package/dist/dts/lib/core/scales/computeScales.d.ts +8 -0
- package/dist/dts/lib/core/seriesValueResolver.d.ts +27 -0
- package/dist/dts/lib/core/sets/builtins.d.ts +2 -0
- package/dist/dts/lib/core/sets/indicatorSetCodec.d.ts +15 -0
- package/dist/dts/lib/core/trading/AnalyticsEngine.d.ts +56 -0
- package/dist/dts/lib/core/trading/BrokerAPI.d.ts +40 -0
- package/dist/dts/lib/core/trading/ExecutionSimulator.d.ts +53 -0
- package/dist/dts/lib/core/trading/FillSettlement.d.ts +38 -0
- package/dist/dts/lib/core/trading/MarketDataPort.d.ts +41 -0
- package/dist/dts/lib/core/trading/MarketRules.d.ts +58 -0
- package/dist/dts/lib/core/trading/OrderManagementSystem.d.ts +57 -0
- package/dist/dts/lib/core/trading/PositionManager.d.ts +79 -0
- package/dist/dts/lib/core/trading/RiskEngine.d.ts +40 -0
- package/dist/dts/lib/core/trading/SettlementCalendar.d.ts +10 -0
- package/dist/dts/lib/core/trading/VirtualBrokerEngine.d.ts +92 -0
- package/dist/dts/lib/core/trading/orderMargin.d.ts +3 -0
- package/dist/dts/lib/core/trading/storage/InMemoryStorageAdapter.d.ts +10 -0
- package/dist/dts/lib/core/trading/storage/TradingStorage.d.ts +34 -0
- package/dist/dts/lib/core/trading/types.d.ts +99 -0
- package/dist/dts/lib/core/types/chart.d.ts +21 -0
- package/dist/dts/lib/core/types/indicator-catalog.d.ts +38 -0
- package/dist/dts/lib/core/types/indicator-set.d.ts +19 -0
- package/dist/dts/lib/core/types/pane-descriptor.d.ts +46 -0
- package/dist/dts/lib/core/types/seriesComponents.d.ts +15 -0
- package/dist/dts/lib/credentials/credentialStore.d.ts +93 -0
- package/dist/dts/lib/helper/SaveChartAsImage.d.ts +90 -0
- package/dist/dts/lib/indicator/defaultOptionsForAppearance.d.ts +105 -0
- package/dist/dts/lib/indicators/builtin/MTFWrapper.d.ts +3 -0
- package/dist/dts/lib/indicators/builtin/VolumeProfileWorker.d.ts +19 -0
- package/dist/dts/lib/indicators/builtin/ac.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/alligator.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/anchoredVwap.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/ao.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/bbi.d.ts +10 -0
- package/dist/dts/lib/indicators/builtin/bias.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/bollinger.d.ts +9 -0
- package/dist/dts/lib/indicators/builtin/brar.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/cci.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/chaikinOscillator.d.ts +14 -0
- package/dist/dts/lib/indicators/builtin/chaikinVol.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/ci.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/cmf.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/cr.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/cvd.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/deltaProfile.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/dema.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/dma.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/dmi.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/donchian.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/ema.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/emv.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/footprint.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/fractals.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/gator.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/hma.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/hv.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/ichimoku.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/kdj.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/keltner.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/ma.d.ts +10 -0
- package/dist/dts/lib/indicators/builtin/maRibbon.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/macd.d.ts +9 -0
- package/dist/dts/lib/indicators/builtin/marketProfile.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/mfi.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/mtm.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/obv.d.ts +10 -0
- package/dist/dts/lib/indicators/builtin/pivotHighLow.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/pivotStandard.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/psy.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/pvt.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/roc.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/rsi.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/sar.d.ts +10 -0
- package/dist/dts/lib/indicators/builtin/sma.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/smfi.d.ts +8 -0
- package/dist/dts/lib/indicators/builtin/stdDev.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/strengthRelative.d.ts +7 -0
- package/dist/dts/lib/indicators/builtin/supertrend.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/tema.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/trix.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/volOsc.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/volume.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/volumeProfile.d.ts +8 -0
- package/dist/dts/lib/indicators/builtin/vr.d.ts +10 -0
- package/dist/dts/lib/indicators/builtin/vwap.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/vwma.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/wma.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/wr.d.ts +10 -0
- package/dist/dts/lib/indicators/builtin/wyckoffWave.d.ts +15 -0
- package/dist/dts/lib/indicators/index.d.ts +63 -0
- package/dist/dts/lib/indicators/indicatorValueShapes.d.ts +15 -0
- package/dist/dts/lib/indicators/outputKeys.d.ts +50 -0
- package/dist/dts/lib/indicators/overlays/CVDIndicator.d.ts +26 -0
- package/dist/dts/lib/indicators/overlays/DarkFlowBadge.d.ts +19 -0
- package/dist/dts/lib/indicators/overlays/ExternalCVDOverlay.d.ts +15 -0
- package/dist/dts/lib/indicators/overlays/WhaleBubbleOverlay.d.ts +14 -0
- package/dist/dts/lib/indicators/overlays/WhaleMarketBubbleOverlay.d.ts +27 -0
- package/dist/dts/lib/indicators/overlays/whaleDetector.d.ts +66 -0
- package/dist/dts/lib/indicators/registry.d.ts +6 -0
- package/dist/dts/lib/indicators/types.d.ts +5 -0
- package/dist/dts/lib/indicators/utils.d.ts +259 -0
- package/dist/dts/lib/pinescript/PineCompiler.d.ts +34 -0
- package/dist/dts/lib/pinescript/ast.d.ts +73 -0
- package/dist/dts/lib/pinescript/compile.d.ts +40 -0
- package/dist/dts/lib/pinescript/grammar.d.ts +12 -0
- package/dist/dts/lib/pinescript/pine.worker.d.ts +1 -0
- package/dist/dts/lib/pinescript/pineBlocks.d.ts +54 -0
- package/dist/dts/lib/pinescript/pineBuiltins.d.ts +47 -0
- package/dist/dts/lib/pinescript/pineEnv.d.ts +46 -0
- package/dist/dts/lib/pinescript/pineMath.d.ts +13 -0
- package/dist/dts/lib/pinescript/pineParse.d.ts +25 -0
- package/dist/dts/lib/pinescript/pineStrings.d.ts +50 -0
- package/dist/dts/lib/pinescript/runtime.d.ts +5 -0
- package/dist/dts/lib/pinescript/scriptRegistry.d.ts +40 -0
- package/dist/dts/lib/pinescript/series-value.d.ts +64 -0
- package/dist/dts/lib/pinescript/vnscript-completion.d.ts +1 -0
- package/dist/dts/lib/pinescript/vnscript-grammar.d.ts +19 -0
- package/dist/dts/lib/scale/discontinuousTimeScaleProvider.d.ts +3 -0
- package/dist/dts/lib/scale/financeDiscontinuousScale.d.ts +15 -0
- package/dist/dts/lib/scale/index.d.ts +1 -0
- package/dist/dts/lib/scale/levels.d.ts +12 -0
- package/dist/dts/lib/series/AlternatingFillAreaSeries.d.ts +13 -0
- package/dist/dts/lib/series/AreaOnlySeries.d.ts +10 -0
- package/dist/dts/lib/series/AreaSeries.d.ts +30 -0
- package/dist/dts/lib/series/BarSeries.d.ts +40 -0
- package/dist/dts/lib/series/BollingerSeries.d.ts +11 -0
- package/dist/dts/lib/series/CandlestickSeries.d.ts +56 -0
- package/dist/dts/lib/series/CircleMarker.d.ts +28 -0
- package/dist/dts/lib/series/ElderRaySeries.d.ts +14 -0
- package/dist/dts/lib/series/FootprintSeries.d.ts +21 -0
- package/dist/dts/lib/series/GroupedBarSeries.d.ts +9 -0
- package/dist/dts/lib/series/HTFOverlaySeries.d.ts +32 -0
- package/dist/dts/lib/series/HistogramSeries.d.ts +51 -0
- package/dist/dts/lib/series/KagiSeries.d.ts +9 -0
- package/dist/dts/lib/series/LineBreakSeries.d.ts +28 -0
- package/dist/dts/lib/series/LineSeries.d.ts +54 -0
- package/dist/dts/lib/series/MACDSeries.d.ts +28 -0
- package/dist/dts/lib/series/MarketProfileSeries.d.ts +18 -0
- package/dist/dts/lib/series/OHLCSeries.d.ts +9 -0
- package/dist/dts/lib/series/OverlayBarSeries.d.ts +9 -0
- package/dist/dts/lib/series/PointAndFigureSeries.d.ts +45 -0
- package/dist/dts/lib/series/RSISeries.d.ts +38 -0
- package/dist/dts/lib/series/RenkoSeries.d.ts +9 -0
- package/dist/dts/lib/series/SARSeries.d.ts +10 -0
- package/dist/dts/lib/series/SVGComponent.d.ts +5 -0
- package/dist/dts/lib/series/ScatterSeries.d.ts +9 -0
- package/dist/dts/lib/series/SquareMarker.d.ts +28 -0
- package/dist/dts/lib/series/StackedBarSeries.d.ts +19 -0
- package/dist/dts/lib/series/StochasticSeries.d.ts +9 -0
- package/dist/dts/lib/series/StraightLine.d.ts +18 -0
- package/dist/dts/lib/series/TriangleMarker.d.ts +30 -0
- package/dist/dts/lib/series/VolumeProfileSeries.d.ts +9 -0
- package/dist/dts/lib/series/index.d.ts +28 -0
- package/dist/dts/lib/strategy/BrokerSimulator.d.ts +11 -0
- package/dist/dts/lib/strategy/types.d.ts +35 -0
- package/dist/dts/lib/tape/TapePanel.d.ts +5 -0
- package/dist/dts/lib/types/adapter.d.ts +1 -0
- package/dist/dts/lib/types/index.d.ts +5 -0
- package/dist/dts/lib/types/indicator.d.ts +11 -0
- package/dist/dts/lib/types/ohlcv.d.ts +1 -0
- package/dist/dts/lib/types/pane.d.ts +23 -0
- package/dist/dts/lib/types/runtime.d.ts +11 -0
- package/dist/dts/lib/types/vninvest.d.ts +320 -0
- package/dist/dts/lib/types.d.ts +45 -0
- package/dist/dts/lib/utils/ChartDataUtil.d.ts +26 -0
- package/dist/dts/lib/utils/PureComponent.d.ts +5 -0
- package/dist/dts/lib/utils/accumulatingWindow.d.ts +1 -0
- package/dist/dts/lib/utils/axisPriceFormat.d.ts +6 -0
- package/dist/dts/lib/utils/barWidth.d.ts +14 -0
- package/dist/dts/lib/utils/identity.d.ts +1 -0
- package/dist/dts/lib/utils/index.d.ts +70 -0
- package/dist/dts/lib/utils/logger.d.ts +28 -0
- package/dist/dts/lib/utils/mappedSlidingWindow.d.ts +1 -0
- package/dist/dts/lib/utils/merge.d.ts +6 -0
- package/dist/dts/lib/utils/noop.d.ts +1 -0
- package/dist/dts/lib/utils/rebind.d.ts +1 -0
- package/dist/dts/lib/utils/shallowEqual.d.ts +1 -0
- package/dist/dts/lib/utils/slidingWindow.d.ts +1 -0
- package/dist/dts/lib/utils/storage.d.ts +32 -0
- package/dist/dts/lib/utils/strokeDasharray.d.ts +3 -0
- package/dist/dts/lib/utils/timezoneFormatter.d.ts +14 -0
- package/dist/dts/lib/utils/zipper.d.ts +4 -0
- package/dist/dts/public-api.d.ts +31 -0
- package/dist/dts/widget/BackfillWorkerFlags.d.ts +12 -0
- package/dist/dts/widget/CanaryRollbackHelper.d.ts +95 -0
- package/dist/dts/widget/CanaryRolloutConfig.d.ts +100 -0
- package/dist/dts/widget/DrawingPriceLabelsOverlay.d.ts +20 -0
- package/dist/dts/widget/ForkDrawingsOverlay.d.ts +16 -0
- package/dist/dts/widget/MeasurementOverlay.d.ts +24 -0
- package/dist/dts/widget/VNInvestCharts.d.ts +5 -0
- package/dist/dts/widget/VNInvestChartsProps.d.ts +302 -0
- package/dist/dts/widget/VNInvestMultiCharts.d.ts +8 -0
- package/dist/dts/widget/VNInvestMultiCharts.types.d.ts +130 -0
- package/dist/dts/widget/WidgetEmptyState.d.ts +11 -0
- package/dist/dts/widget/WidgetErrorBoundary.d.ts +26 -0
- package/dist/dts/widget/adapters/ContinuousFuturesStockDataAdapter.d.ts +18 -0
- package/dist/dts/widget/adapters/DataProviderAdapterWrapper.d.ts +14 -0
- package/dist/dts/widget/adapters/MultiSourceDataAdapter.d.ts +24 -0
- package/dist/dts/widget/adapters/VNInvestClient.d.ts +161 -0
- package/dist/dts/widget/adapters/VNInvestDataAdapter.d.ts +77 -0
- package/dist/dts/widget/adapters/VNInvestWebSocketClient.d.ts +79 -0
- package/dist/dts/widget/adapters/barsPagingPolicy.d.ts +18 -0
- package/dist/dts/widget/adapters/corporateEvents.d.ts +13 -0
- package/dist/dts/widget/adapters/index.d.ts +20 -0
- package/dist/dts/widget/adapters/nativeShapes.d.ts +32 -0
- package/dist/dts/widget/adapters/watchlistRealtimeSync.d.ts +16 -0
- package/dist/dts/widget/alerts/DrawingAlertsHost.d.ts +18 -0
- package/dist/dts/widget/alerts/useDrawingAlerts.d.ts +37 -0
- package/dist/dts/widget/canaryBarFiltering.d.ts +35 -0
- package/dist/dts/widget/capabilities/CapabilityResolver.d.ts +71 -0
- package/dist/dts/widget/capabilities/capabilityProbe.d.ts +28 -0
- package/dist/dts/widget/capabilities/useTierGatedFeatures.d.ts +48 -0
- package/dist/dts/widget/components/BottomPanelHost.d.ts +80 -0
- package/dist/dts/widget/components/BottomPanelSplitter.d.ts +15 -0
- package/dist/dts/widget/components/CapabilityGate.d.ts +65 -0
- package/dist/dts/widget/components/ChartDiagOverlay.d.ts +31 -0
- package/dist/dts/widget/components/ConfirmDialog.d.ts +12 -0
- package/dist/dts/widget/components/DowngradeBanner.d.ts +9 -0
- package/dist/dts/widget/components/ForkPaneSeparators.d.ts +11 -0
- package/dist/dts/widget/components/ForkPaneTooltips.d.ts +23 -0
- package/dist/dts/widget/components/ForkXAxisOverlay.d.ts +11 -0
- package/dist/dts/widget/components/ForkYAxisCrosshairLabels.d.ts +9 -0
- package/dist/dts/widget/components/LayoutDesigner.d.ts +26 -0
- package/dist/dts/widget/components/PremiumFeatureGate.d.ts +10 -0
- package/dist/dts/widget/components/ShortcutHelpModal.d.ts +44 -0
- package/dist/dts/widget/components/SystemMenu.d.ts +66 -0
- package/dist/dts/widget/components/Toast.d.ts +20 -0
- package/dist/dts/widget/components/canvas/BarCountdownBadge.d.ts +8 -0
- package/dist/dts/widget/components/canvas/ChartA11ySummary.d.ts +40 -0
- package/dist/dts/widget/components/canvas/ChartStatusLine.d.ts +39 -0
- package/dist/dts/widget/components/canvas/PricePaneHeader.d.ts +24 -0
- package/dist/dts/widget/components/canvas/PriceScaleMenu.d.ts +27 -0
- package/dist/dts/widget/components/canvas/TimeAxisScrollbar.d.ts +18 -0
- package/dist/dts/widget/components/common/Icons.d.ts +67 -0
- package/dist/dts/widget/components/dock/DataWindow.d.ts +7 -0
- package/dist/dts/widget/components/dock/DockUpgradeNudge.d.ts +10 -0
- package/dist/dts/widget/components/dock/RightSidebarDockHost.d.ts +57 -0
- package/dist/dts/widget/components/dock/WatchlistPanel.d.ts +7 -0
- package/dist/dts/widget/components/dock/WorkspaceRightDockSlot.d.ts +46 -0
- package/dist/dts/widget/components/dock/dockAccess.d.ts +20 -0
- package/dist/dts/widget/components/dock/drawingDockContentBuilders.d.ts +29 -0
- package/dist/dts/widget/components/drawing/DrawingDock.d.ts +47 -0
- package/dist/dts/widget/components/drawing/DrawingInspector.d.ts +94 -0
- package/dist/dts/widget/components/drawing/DrawingListPanel.d.ts +62 -0
- package/dist/dts/widget/components/drawing/DrawingSemanticPointLegend.d.ts +14 -0
- package/dist/dts/widget/components/drawing/FloatingDrawingInspector.d.ts +18 -0
- package/dist/dts/widget/components/drawing/IconPickerPanel.d.ts +5 -0
- package/dist/dts/widget/components/drawing/InlineTextEditor.d.ts +20 -0
- package/dist/dts/widget/components/drawing/PatternScanPanel.d.ts +27 -0
- package/dist/dts/widget/components/drawing/TemplateManagerPanel.d.ts +18 -0
- package/dist/dts/widget/components/events/CorporateEventsOverlay.d.ts +23 -0
- package/dist/dts/widget/components/events/EventMarkerIcon.d.ts +6 -0
- package/dist/dts/widget/components/footer/ChartFooter.d.ts +26 -0
- package/dist/dts/widget/components/footer/MultiChartsFooter.d.ts +37 -0
- package/dist/dts/widget/components/footer/TimeframeFooter.d.ts +25 -0
- package/dist/dts/widget/components/footer/useBarCountdown.d.ts +5 -0
- package/dist/dts/widget/components/header/OHLCHeader.d.ts +72 -0
- package/dist/dts/widget/components/layout/DrawingConflictNotice.d.ts +4 -0
- package/dist/dts/widget/components/layout/GridContainer.d.ts +70 -0
- package/dist/dts/widget/components/layout/GridSlotErrorBoundary.d.ts +17 -0
- package/dist/dts/widget/components/layout/Splitter.d.ts +23 -0
- package/dist/dts/widget/components/layout/gridSplitterMath.d.ts +40 -0
- package/dist/dts/widget/components/layout/useGridSplitterDrag.d.ts +18 -0
- package/dist/dts/widget/components/mobile/MobileChartCarousel.d.ts +11 -0
- package/dist/dts/widget/components/mobile/MobileToolbar.d.ts +29 -0
- package/dist/dts/widget/components/overlays/AdvisoryPanel.d.ts +25 -0
- package/dist/dts/widget/components/overlays/TapePanel.d.ts +25 -0
- package/dist/dts/widget/components/overlays/WhalePanel.d.ts +5 -0
- package/dist/dts/widget/components/panels/AdvisoryPanel.d.ts +25 -0
- package/dist/dts/widget/components/panels/PineEditorPanel.d.ts +18 -0
- package/dist/dts/widget/components/panels/StrategyTesterPanel.d.ts +7 -0
- package/dist/dts/widget/components/panels/TapePanel.d.ts +17 -0
- package/dist/dts/widget/components/panels/index.d.ts +8 -0
- package/dist/dts/widget/components/replay/FloatingReplayToolbar.d.ts +24 -0
- package/dist/dts/widget/components/replay/ReplayCutOverlay.d.ts +8 -0
- package/dist/dts/widget/components/search/SymbolCompareModal.d.ts +24 -0
- package/dist/dts/widget/components/search/SymbolSearchModal.d.ts +12 -0
- package/dist/dts/widget/components/search/VNSymbolSearch.d.ts +83 -0
- package/dist/dts/widget/components/settings/AlertsModal.d.ts +74 -0
- package/dist/dts/widget/components/settings/SettingsContext.d.ts +58 -0
- package/dist/dts/widget/components/settings/SettingsModal.d.ts +78 -0
- package/dist/dts/widget/components/settings/SettingsRangeSlider.d.ts +17 -0
- package/dist/dts/widget/components/settings/SnapshotPreviewModal.d.ts +16 -0
- package/dist/dts/widget/components/settings/WorkspaceSettingsContext.d.ts +27 -0
- package/dist/dts/widget/components/settings/helpers/seriesFormatters.d.ts +11 -0
- package/dist/dts/widget/components/settings/model/appearancePayload.d.ts +31 -0
- package/dist/dts/widget/components/settings/model/chartSettingsSchema.d.ts +100 -0
- package/dist/dts/widget/components/settings/model/defaultSettings.d.ts +5 -0
- package/dist/dts/widget/components/settings/model/indicatorShare.d.ts +29 -0
- package/dist/dts/widget/components/settings/storageKeys.d.ts +29 -0
- package/dist/dts/widget/components/settings/tabs/AppearanceSettingsTab.d.ts +5 -0
- package/dist/dts/widget/components/settings/tabs/IndicatorParamsForm.d.ts +12 -0
- package/dist/dts/widget/components/settings/tabs/IndicatorsSettingsTab.d.ts +34 -0
- package/dist/dts/widget/components/settings/tabs/LicensingSettingsTab.d.ts +5 -0
- package/dist/dts/widget/components/settings/tabs/PanesLayoutSettingsTab.d.ts +11 -0
- package/dist/dts/widget/components/settings/tabs/ResetSettingsTab.d.ts +8 -0
- package/dist/dts/widget/components/settings/tabs/ScalesSettingsTab.d.ts +5 -0
- package/dist/dts/widget/components/settings/tabs/StatusLineSettingsTab.d.ts +5 -0
- package/dist/dts/widget/components/settings/tabs/SymbolSettingsTab.d.ts +5 -0
- package/dist/dts/widget/components/settings/tabs/ThemePaletteSettingsTab.d.ts +9 -0
- package/dist/dts/widget/components/settings/tabs/TradingEventsSettingsTab.d.ts +8 -0
- package/dist/dts/widget/components/toolbar/DrawingToolIcon.d.ts +10 -0
- package/dist/dts/widget/components/toolbar/DrawingToolbar.d.ts +33 -0
- package/dist/dts/widget/components/toolbar/FloatingChartBar.d.ts +20 -0
- package/dist/dts/widget/components/toolbar/FloatingFavoritesBar.d.ts +18 -0
- package/dist/dts/widget/components/toolbar/MultiChartTopbar.d.ts +47 -0
- package/dist/dts/widget/components/toolbar/UnifiedDrawingToolbar.d.ts +28 -0
- package/dist/dts/widget/components/trading/PaperTradePanel.d.ts +41 -0
- package/dist/dts/widget/components/workspace/WorkspaceToolbar.d.ts +25 -0
- package/dist/dts/widget/config/toolGroups.d.ts +11 -0
- package/dist/dts/widget/config/toolShortcuts.d.ts +27 -0
- package/dist/dts/widget/constants/comparison.d.ts +1 -0
- package/dist/dts/widget/constants/symbolSearch.d.ts +14 -0
- package/dist/dts/widget/constants/vn30.d.ts +7 -0
- package/dist/dts/widget/context/DataProviderContext.d.ts +7 -0
- package/dist/dts/widget/context/HoverEmitter.d.ts +50 -0
- package/dist/dts/widget/context/SyncContextShare.d.ts +11 -0
- package/dist/dts/widget/context/VNInvestChartsConfigContext.d.ts +24 -0
- package/dist/dts/widget/context/VNInvestChartsContext.d.ts +70 -0
- package/dist/dts/widget/context/VNInvestChartsStateContext.d.ts +50 -0
- package/dist/dts/widget/context/WidgetI18nContext.d.ts +25 -0
- package/dist/dts/widget/context/WorkspaceLiveTradingContext.d.ts +30 -0
- package/dist/dts/widget/context/WorkspacePaperVisibilityContext.d.ts +23 -0
- package/dist/dts/widget/context/WorkspaceReplayTradingContext.d.ts +36 -0
- package/dist/dts/widget/contexts/SaaSFeatureContext.d.ts +23 -0
- package/dist/dts/widget/data/DataEnvelope.d.ts +100 -0
- package/dist/dts/widget/drawingPriceLabelInputs.d.ts +3 -0
- package/dist/dts/widget/export/chartCsv.d.ts +59 -0
- package/dist/dts/widget/forkAnchorReconciliation.d.ts +6 -0
- package/dist/dts/widget/forkInteractionHelpers.d.ts +69 -0
- package/dist/dts/widget/grid/DeviceProfiles.d.ts +49 -0
- package/dist/dts/widget/grid/GridChartRegistry.d.ts +9 -0
- package/dist/dts/widget/grid/MemoryBudgetManager.d.ts +63 -0
- package/dist/dts/widget/grid/PerformanceMonitor.d.ts +70 -0
- package/dist/dts/widget/grid/customPresets.d.ts +42 -0
- package/dist/dts/widget/grid/presets.d.ts +18 -0
- package/dist/dts/widget/grid/types.d.ts +39 -0
- package/dist/dts/widget/history/BackfillDedupContext.d.ts +63 -0
- package/dist/dts/widget/history/RequestCoordinator.d.ts +59 -0
- package/dist/dts/widget/history/SharedBarStoreContext.d.ts +22 -0
- package/dist/dts/widget/history/cache/IndexedDBCacheMatrix.d.ts +16 -0
- package/dist/dts/widget/history/cache/LocalCacheMatrix.d.ts +86 -0
- package/dist/dts/widget/history/cache/index.d.ts +3 -0
- package/dist/dts/widget/history/chunkStore.d.ts +77 -0
- package/dist/dts/widget/history/externalBarsNormalization.d.ts +9 -0
- package/dist/dts/widget/history/externalBarsNormalization.worker.d.ts +1 -0
- package/dist/dts/widget/history/externalBarsNormalizationAsync.d.ts +25 -0
- package/dist/dts/widget/history/historyDataUtils.d.ts +82 -0
- package/dist/dts/widget/history/historyWindowPlanner.d.ts +89 -0
- package/dist/dts/widget/history/inflightController.d.ts +15 -0
- package/dist/dts/widget/history/requestCoalescing.d.ts +10 -0
- package/dist/dts/widget/history/sessionGuards.d.ts +3 -0
- package/dist/dts/widget/history/singleWriterLane.d.ts +4 -0
- package/dist/dts/widget/history/useExternalBarsNormalization.d.ts +5 -0
- package/dist/dts/widget/hooks/ShortcutManager.d.ts +65 -0
- package/dist/dts/widget/hooks/overlays/PaneHeaderWrapper.d.ts +11 -0
- package/dist/dts/widget/hooks/overlays/overlayHelpers.d.ts +60 -0
- package/dist/dts/widget/hooks/overlays/useDrawingDockNode.d.ts +15 -0
- package/dist/dts/widget/hooks/overlays/useLegendChrome.d.ts +36 -0
- package/dist/dts/widget/hooks/overlays/useMultiSelectActions.d.ts +22 -0
- package/dist/dts/widget/hooks/overlays/useSidebarResize.d.ts +13 -0
- package/dist/dts/widget/hooks/resolveEntitlement.d.ts +73 -0
- package/dist/dts/widget/hooks/useBottomPanelBehavior.d.ts +38 -0
- package/dist/dts/widget/hooks/useBottomPanelHeight.d.ts +39 -0
- package/dist/dts/widget/hooks/useCanvasTheme.d.ts +24 -0
- package/dist/dts/widget/hooks/useChartImperativeHandle.d.ts +57 -0
- package/dist/dts/widget/hooks/useClockAdapter.d.ts +11 -0
- package/dist/dts/widget/hooks/useComparisonState.d.ts +29 -0
- package/dist/dts/widget/hooks/useDialogFocus.d.ts +25 -0
- package/dist/dts/widget/hooks/useDrawingToolShortcuts.d.ts +16 -0
- package/dist/dts/widget/hooks/useFeatureGate.d.ts +28 -0
- package/dist/dts/widget/hooks/useFloatingChartBar.d.ts +33 -0
- package/dist/dts/widget/hooks/useForkRuntime.d.ts +155 -0
- package/dist/dts/widget/hooks/useIndicatorsShareApplier.d.ts +1 -0
- package/dist/dts/widget/hooks/useIntersectionObserver.d.ts +49 -0
- package/dist/dts/widget/hooks/useKeyboardAdapter.d.ts +9 -0
- package/dist/dts/widget/hooks/useLayoutHistory.d.ts +8 -0
- package/dist/dts/widget/hooks/useLicenseDiagnostics.d.ts +15 -0
- package/dist/dts/widget/hooks/useMultiChartReplaySync.d.ts +31 -0
- package/dist/dts/widget/hooks/useMultiWorkspacePersistence.d.ts +49 -0
- package/dist/dts/widget/hooks/usePaperTradeConfig.d.ts +27 -0
- package/dist/dts/widget/hooks/usePaperTradeInteraction.d.ts +27 -0
- package/dist/dts/widget/hooks/usePatTierAuthentication.d.ts +42 -0
- package/dist/dts/widget/hooks/usePineScriptRestore.d.ts +23 -0
- package/dist/dts/widget/hooks/usePortalAdapter.d.ts +8 -0
- package/dist/dts/widget/hooks/useRecentSymbols.d.ts +3 -0
- package/dist/dts/widget/hooks/useReplayState.d.ts +28 -0
- package/dist/dts/widget/hooks/useReplayTrading.d.ts +26 -0
- package/dist/dts/widget/hooks/useResizeAdapter.d.ts +13 -0
- package/dist/dts/widget/hooks/useScaleOverlays.d.ts +62 -0
- package/dist/dts/widget/hooks/useScriptPersistence.d.ts +72 -0
- package/dist/dts/widget/hooks/useSymbolSearch.d.ts +30 -0
- package/dist/dts/widget/hooks/useViewportBreakpoint.d.ts +15 -0
- package/dist/dts/widget/hooks/useWidgetCoordinateBridge.d.ts +70 -0
- package/dist/dts/widget/hooks/useWidgetData.d.ts +138 -0
- package/dist/dts/widget/hooks/useWidgetDataBackfill.d.ts +67 -0
- package/dist/dts/widget/hooks/useWidgetDataEnrichment.d.ts +32 -0
- package/dist/dts/widget/hooks/useWidgetDrawings.d.ts +38 -0
- package/dist/dts/widget/hooks/useWidgetForkInteraction.d.ts +68 -0
- package/dist/dts/widget/hooks/useWidgetInteractionActions.d.ts +36 -0
- package/dist/dts/widget/hooks/useWidgetOverlays.d.ts +190 -0
- package/dist/dts/widget/hooks/useWidgetRuntime.d.ts +20 -0
- package/dist/dts/widget/hooks/useWidgetSettings.d.ts +244 -0
- package/dist/dts/widget/hooks/useWidgetWorkspaceIO.d.ts +24 -0
- package/dist/dts/widget/hooks/useWorkspaceDockPanels.d.ts +11 -0
- package/dist/dts/widget/hooks/useWorkspaceLiveTrading.d.ts +28 -0
- package/dist/dts/widget/hooks/useWorkspaceReplayTrading.d.ts +22 -0
- package/dist/dts/widget/i18n/a11y.messages.en.d.ts +8 -0
- package/dist/dts/widget/i18n/a11y.messages.vi.d.ts +3 -0
- package/dist/dts/widget/i18n/capability.messages.en.d.ts +7 -0
- package/dist/dts/widget/i18n/capability.messages.vi.d.ts +3 -0
- package/dist/dts/widget/i18n/dock.messages.en.d.ts +2 -0
- package/dist/dts/widget/i18n/dock.messages.vi.d.ts +2 -0
- package/dist/dts/widget/i18n/messages.en.d.ts +2 -0
- package/dist/dts/widget/i18n/messages.licensing.d.ts +48 -0
- package/dist/dts/widget/i18n/messages.vi.d.ts +2 -0
- package/dist/dts/widget/i18n/trading.messages.en.d.ts +2 -0
- package/dist/dts/widget/i18n/trading.messages.vi.d.ts +2 -0
- package/dist/dts/widget/i18n/types.d.ts +3 -0
- package/dist/dts/widget/iframe/builtInAdapters.d.ts +63 -0
- package/dist/dts/widget/iframe/host-entry.d.ts +11 -0
- package/dist/dts/widget/iframe/hostSDK.d.ts +151 -0
- package/dist/dts/widget/iframe/iframeBridge.d.ts +165 -0
- package/dist/dts/widget/iframe/iframeEntry.d.ts +52 -0
- package/dist/dts/widget/iframe/iframeFrame.d.ts +15 -0
- package/dist/dts/widget/iframe/iframeQuotes.d.ts +20 -0
- package/dist/dts/widget/iframe/messageProtocol.d.ts +545 -0
- package/dist/dts/widget/iframe/quoteHub.d.ts +20 -0
- package/dist/dts/widget/iframe/useVNInvestChartsHost.d.ts +8 -0
- package/dist/dts/widget/iife-entry.d.ts +61 -0
- package/dist/dts/widget/iifeWidgetInstance.d.ts +60 -0
- package/dist/dts/widget/index.d.ts +56 -0
- package/dist/dts/widget/multiChartDefaults.d.ts +18 -0
- package/dist/dts/widget/paneInteractionUtils.d.ts +25 -0
- package/dist/dts/widget/patterns/autoPatternScan.d.ts +77 -0
- package/dist/dts/widget/patterns/patternDrawingFactory.d.ts +87 -0
- package/dist/dts/widget/plugin/ProPluginRegistry.d.ts +40 -0
- package/dist/dts/widget/runtime/ChartScaleAdapter.d.ts +73 -0
- package/dist/dts/widget/runtime/ChartSerializer.d.ts +12 -0
- package/dist/dts/widget/runtime/ForkRuntimeAdapter.d.ts +19 -0
- package/dist/dts/widget/runtime/IRuntimeEngine.d.ts +40 -0
- package/dist/dts/widget/runtime/WorkspaceSerializer.d.ts +31 -0
- package/dist/dts/widget/runtimePolicy.d.ts +36 -0
- package/dist/dts/widget/styles/injectStyles.d.ts +9 -0
- package/dist/dts/widget/theme/ThemeConfig.d.ts +21 -0
- package/dist/dts/widget/theme/applyTheme.d.ts +3 -0
- package/dist/dts/widget/trading/chart/DraggableOrderHandles.d.ts +15 -0
- package/dist/dts/widget/trading/chart/InteractivePositionOverlay.d.ts +19 -0
- package/dist/dts/widget/trading/chart/PendingOrderOverlay.d.ts +11 -0
- package/dist/dts/widget/trading/chart/QuickTradingHeader.d.ts +20 -0
- package/dist/dts/widget/trading/chart/TradingChartSurface.d.ts +8 -0
- package/dist/dts/widget/trading/chart/TradingOverlaysHost.d.ts +28 -0
- package/dist/dts/widget/trading/chart/priceTicks.d.ts +1 -0
- package/dist/dts/widget/trading/chart/useFloatingDrag.d.ts +40 -0
- package/dist/dts/widget/trading/chart/useTradingHotkeys.d.ts +21 -0
- package/dist/dts/widget/trading/config/paperRuntimeConfig.d.ts +53 -0
- package/dist/dts/widget/trading/context/PaperPanelRegistry.d.ts +45 -0
- package/dist/dts/widget/trading/context/TradingContext.d.ts +80 -0
- package/dist/dts/widget/trading/context/WorkspaceTradingSync.d.ts +24 -0
- package/dist/dts/widget/trading/hooks/usePaperRuntimeConfig.d.ts +36 -0
- package/dist/dts/widget/trading/index.d.ts +5 -0
- package/dist/dts/widget/trading/panel/AccountSummaryTab.d.ts +7 -0
- package/dist/dts/widget/trading/panel/ActiveChartPaperPanel.d.ts +26 -0
- package/dist/dts/widget/trading/panel/ConnectedTradingPanel.d.ts +3 -0
- package/dist/dts/widget/trading/panel/HistoryTab.d.ts +5 -0
- package/dist/dts/widget/trading/panel/MarketFallbackBanner.d.ts +4 -0
- package/dist/dts/widget/trading/panel/OrdersTab.d.ts +8 -0
- package/dist/dts/widget/trading/panel/PaperCapitalDialog.d.ts +8 -0
- package/dist/dts/widget/trading/panel/PaperSettingsModal.d.ts +17 -0
- package/dist/dts/widget/trading/panel/PositionsTab.d.ts +15 -0
- package/dist/dts/widget/trading/panel/TradeHistoryTab.d.ts +5 -0
- package/dist/dts/widget/trading/panel/TradingBottomPanel.d.ts +36 -0
- package/dist/dts/widget/trading/panel/TradingLogTab.d.ts +8 -0
- package/dist/dts/widget/trading/panel/TradingPanelHeader.d.ts +17 -0
- package/dist/dts/widget/trading/panel/csvExport.d.ts +18 -0
- package/dist/dts/widget/trading/ticket/ConnectedTradingDockPanel.d.ts +5 -0
- package/dist/dts/widget/trading/ticket/OrderTicketForm.d.ts +31 -0
- package/dist/dts/widget/trading/ticket/OrderTicketModal.d.ts +29 -0
- package/dist/dts/widget/trading/ticket/RegistryTradingDockPanel.d.ts +9 -0
- package/dist/dts/widget/trading/ticket/RiskCalculatorView.d.ts +9 -0
- package/dist/dts/widget/trading/ticket/TradingDockPanel.d.ts +36 -0
- package/dist/dts/widget/trading/ticket/orderTicketModel.d.ts +49 -0
- package/dist/dts/widget/trading/visibility/paperVisibility.d.ts +38 -0
- package/dist/dts/widget/types/dataProvider.d.ts +8 -0
- package/dist/dts/widget/types/fullChartHandle.d.ts +25 -0
- package/dist/dts/widget/types/saas.d.ts +83 -0
- package/dist/dts/widget/types/symbolSearch.d.ts +9 -0
- package/dist/dts/widget/types/watchlist.d.ts +26 -0
- package/dist/dts/widget/utils/axisHit.d.ts +16 -0
- package/dist/dts/widget/utils/chartRange.d.ts +12 -0
- package/dist/dts/widget/utils/chartTypeOptions.d.ts +38 -0
- package/dist/dts/widget/utils/clickOutside.d.ts +1 -0
- package/dist/dts/widget/utils/coordinateBridge.d.ts +31 -0
- package/dist/dts/widget/utils/crosshairSync.d.ts +50 -0
- package/dist/dts/widget/utils/drawingSync.d.ts +198 -0
- package/dist/dts/widget/utils/enrichedHash.d.ts +15 -0
- package/dist/dts/widget/utils/headerSync.d.ts +12 -0
- package/dist/dts/widget/utils/numberFormat.d.ts +13 -0
- package/dist/dts/widget/utils/paperTradeAdapters.d.ts +11 -0
- package/dist/dts/widget/utils/pineSeriesData.d.ts +71 -0
- package/dist/dts/widget/utils/rangeSync.d.ts +29 -0
- package/dist/dts/widget/utils/telemetry.d.ts +19 -0
- package/dist/dts/widget/utils/widgetEquality.d.ts +57 -0
- package/dist/dts/widget/utils/widgetErrors.d.ts +29 -0
- package/dist/dts/widget/utils/widgetHelpers.d.ts +395 -0
- package/dist/dts/widget/utils/xAxisTickFormatter.d.ts +33 -0
- package/dist/dts/widget/visibleRangeBridge.d.ts +28 -0
- package/dist/dts/widget/visibleRangeDiagnostics.d.ts +10 -0
- package/dist/dts/widget/visibleRangePolicies.d.ts +6 -0
- package/dist/dts/widget/workspace/WorkspaceManager.d.ts +23 -0
- package/dist/dts/widget/workspace/WorkspaceStore.d.ts +85 -0
- package/dist/dts/widget/workspace/types.d.ts +21 -0
- package/dist/externalBarsNormalization.worker.js +108 -0
- package/dist/iframe/index.html +63 -0
- package/dist/iframe/injected.css +6456 -0
- package/dist/iframe/vninvestchart.iframe.css +2 -0
- package/dist/iframe/vninvestchart.iframe.js +945 -0
- package/dist/iframe-host/host-entry.cjs +687 -0
- package/dist/iframe-host/host-entry.d.mts +818 -0
- package/dist/iframe-host/host-entry.d.ts +818 -0
- package/dist/iframe-host/host-entry.js +680 -0
- package/dist/index.cjs +7253 -0
- package/dist/index.css +3390 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +6461 -0
- package/dist/injected.css +6456 -0
- package/dist/rollAlgorithms-2P2ZKKHO.js +2 -0
- package/dist/types/runtime.cjs +8 -0
- package/dist/types/runtime.d.mts +92 -0
- package/dist/types/runtime.d.ts +92 -0
- package/dist/types/runtime.js +5 -0
- package/dist/types/runtime.umd.js +14 -0
- package/dist/vninvestchart.iife.css +2 -0
- package/dist/vninvestchart.iife.js +945 -0
- package/package.json +225 -5
|
@@ -0,0 +1,687 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/widget/iframe/messageProtocol.ts
|
|
4
|
+
function isRequestMessage(msg) {
|
|
5
|
+
return typeof msg === "object" && msg !== null && "type" in msg && typeof msg.type === "string" && msg.type.startsWith("request:");
|
|
6
|
+
}
|
|
7
|
+
function isResponseMessage(msg) {
|
|
8
|
+
return typeof msg === "object" && msg !== null && "type" in msg && typeof msg.type === "string" && msg.type.startsWith("response:");
|
|
9
|
+
}
|
|
10
|
+
function isEventMessage(msg) {
|
|
11
|
+
return typeof msg === "object" && msg !== null && "type" in msg && typeof msg.type === "string" && msg.type.startsWith("event:");
|
|
12
|
+
}
|
|
13
|
+
function isHostToIframeCommand(msg) {
|
|
14
|
+
return isRequestMessage(msg);
|
|
15
|
+
}
|
|
16
|
+
function isIframeToHostEvent(msg) {
|
|
17
|
+
return isEventMessage(msg);
|
|
18
|
+
}
|
|
19
|
+
function generateCorrelationId() {
|
|
20
|
+
return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/widget/iframe/iframeBridge.ts
|
|
24
|
+
var DEFAULT_ALLOWED_ORIGINS = [
|
|
25
|
+
"https://vninvestcharts.com",
|
|
26
|
+
"https://app.vninvestcharts.com",
|
|
27
|
+
"https://charts.vninvestcharts.com",
|
|
28
|
+
"http://localhost:3000",
|
|
29
|
+
"http://localhost:5173",
|
|
30
|
+
"http://127.0.0.1:3000",
|
|
31
|
+
"http://127.0.0.1:5173"
|
|
32
|
+
];
|
|
33
|
+
function matchOriginPattern(pattern, origin) {
|
|
34
|
+
if (pattern === origin) return true;
|
|
35
|
+
if (!pattern.includes("*")) return false;
|
|
36
|
+
if (pattern === "*") return false;
|
|
37
|
+
const parts = pattern.split("*");
|
|
38
|
+
if (parts.length !== 2) return false;
|
|
39
|
+
const [prefix, suffix] = parts;
|
|
40
|
+
if (!suffix.startsWith(".")) return false;
|
|
41
|
+
if (!prefix.endsWith("//")) return false;
|
|
42
|
+
if (!origin.startsWith(prefix)) return false;
|
|
43
|
+
const host = origin.slice(prefix.length);
|
|
44
|
+
return host === suffix.slice(1) || host.endsWith(suffix);
|
|
45
|
+
}
|
|
46
|
+
var IframeBridge = class {
|
|
47
|
+
config;
|
|
48
|
+
pendingRequests = /* @__PURE__ */ new Map();
|
|
49
|
+
messageHandler = null;
|
|
50
|
+
requestHandler = null;
|
|
51
|
+
boundHandleMessage;
|
|
52
|
+
isDestroyed = false;
|
|
53
|
+
readyPromise = null;
|
|
54
|
+
readyResolve = null;
|
|
55
|
+
/**
|
|
56
|
+
* Origin pinned from the first origin-allowlisted incoming message
|
|
57
|
+
* (iframe side). All outbound sends use it instead of the "*" fallback,
|
|
58
|
+
* so widget data is never broadcast to arbitrary windows once the host
|
|
59
|
+
* is known. Re-pinned on every validated message (allows host moves).
|
|
60
|
+
*/
|
|
61
|
+
pinnedSendOrigin = null;
|
|
62
|
+
/** SEC-01: sliding-window counters for the inbound rate limit. */
|
|
63
|
+
rateWindowStart = 0;
|
|
64
|
+
rateCount = 0;
|
|
65
|
+
constructor(config) {
|
|
66
|
+
if (config.allowAnyOrigin) {
|
|
67
|
+
console.warn("[IframeBridge] allowAnyOrigin is ENABLED \u2014 origin validation disabled. This is UNSAFE for production.");
|
|
68
|
+
}
|
|
69
|
+
this.config = {
|
|
70
|
+
requestTimeout: 3e4,
|
|
71
|
+
// SEC-01 defaults: 1 MB per message, 600 messages / 10s.
|
|
72
|
+
maxPayloadBytes: 1e6,
|
|
73
|
+
maxMessages: 600,
|
|
74
|
+
rateWindowMs: 1e4,
|
|
75
|
+
...config
|
|
76
|
+
};
|
|
77
|
+
this.boundHandleMessage = this.handleMessage.bind(this);
|
|
78
|
+
window.addEventListener("message", this.boundHandleMessage);
|
|
79
|
+
this.readyPromise = new Promise((resolve) => {
|
|
80
|
+
this.readyResolve = resolve;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Set handler for incoming events (Host side)
|
|
85
|
+
*/
|
|
86
|
+
setMessageHandler(handler) {
|
|
87
|
+
this.messageHandler = handler;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Set handler for incoming requests (Iframe side)
|
|
91
|
+
*/
|
|
92
|
+
setRequestHandler(handler) {
|
|
93
|
+
this.requestHandler = handler;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Resolve the target origin for outbound sends. Prefers the pinned
|
|
97
|
+
* validated origin; falls back to the configured targetOrigin ("*" only
|
|
98
|
+
* until the first allowlisted message arrives on the iframe side).
|
|
99
|
+
*/
|
|
100
|
+
resolveSendOrigin() {
|
|
101
|
+
return this.pinnedSendOrigin ?? this.config.targetOrigin;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Send a command to the other side
|
|
105
|
+
*/
|
|
106
|
+
async sendCommand(command, timeoutMs) {
|
|
107
|
+
if (this.isDestroyed) {
|
|
108
|
+
throw new Error("Bridge is destroyed");
|
|
109
|
+
}
|
|
110
|
+
const correlationId = command.correlationId;
|
|
111
|
+
return new Promise((resolve, reject) => {
|
|
112
|
+
const timeout = setTimeout(() => {
|
|
113
|
+
this.pendingRequests.delete(correlationId);
|
|
114
|
+
reject(new Error(`Request timeout: ${command.type}`));
|
|
115
|
+
}, timeoutMs ?? this.config.requestTimeout);
|
|
116
|
+
this.pendingRequests.set(correlationId, { resolve, reject, timeout });
|
|
117
|
+
this.config.targetWindow.postMessage(command, this.resolveSendOrigin());
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Send an event (fire-and-forget)
|
|
122
|
+
*/
|
|
123
|
+
sendEvent(event) {
|
|
124
|
+
if (this.isDestroyed) return;
|
|
125
|
+
this.config.targetWindow.postMessage(event, this.resolveSendOrigin());
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Send a response to a request
|
|
129
|
+
*/
|
|
130
|
+
sendResponse(request, payload, success = true, error) {
|
|
131
|
+
if (this.isDestroyed) return;
|
|
132
|
+
const response = {
|
|
133
|
+
type: `response:${request.type.replace("request:", "")}`,
|
|
134
|
+
// ARC-1-keep: legacy bridge
|
|
135
|
+
correlationId: request.correlationId,
|
|
136
|
+
timestamp: Date.now(),
|
|
137
|
+
origin: typeof window !== "undefined" ? window.location.origin : "unknown",
|
|
138
|
+
payload,
|
|
139
|
+
success,
|
|
140
|
+
error
|
|
141
|
+
};
|
|
142
|
+
this.config.targetWindow.postMessage(response, this.resolveSendOrigin());
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Wait for the bridge to be ready (Iframe side)
|
|
146
|
+
*/
|
|
147
|
+
async waitForReady() {
|
|
148
|
+
return this.readyPromise;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Signal that Iframe is ready (Iframe side)
|
|
152
|
+
*/
|
|
153
|
+
signalReady(version, capabilities) {
|
|
154
|
+
if (this.readyResolve) {
|
|
155
|
+
this.readyResolve();
|
|
156
|
+
this.readyResolve = null;
|
|
157
|
+
}
|
|
158
|
+
this.sendEvent({
|
|
159
|
+
type: "event:ready",
|
|
160
|
+
correlationId: generateCorrelationId(),
|
|
161
|
+
timestamp: Date.now(),
|
|
162
|
+
origin: typeof window !== "undefined" ? window.location.origin : "unknown",
|
|
163
|
+
payload: { version, capabilities }
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Validate message origin against allowlist.
|
|
168
|
+
*
|
|
169
|
+
* SEC-01: wildcard patterns are matched as PLAIN STRINGS, never compiled into
|
|
170
|
+
* a RegExp. The previous implementation replaced every `*` with `.*` and then
|
|
171
|
+
* ran `new RegExp`, which left every `.` unescaped, so a pattern like
|
|
172
|
+
* `https:` + wildcard-subdomain + `vninvestcharts.com` also matched origins
|
|
173
|
+
* such as `https://evilvninvestchartsXcom`. Only a leading subdomain
|
|
174
|
+
* wildcard is supported and it must sit on a scheme boundary.
|
|
175
|
+
*/
|
|
176
|
+
isOriginAllowed(origin) {
|
|
177
|
+
if (this.config.allowedOrigins.includes("*") || this.config.allowAnyOrigin) {
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
if (typeof origin !== "string" || origin === "" || origin === "null") {
|
|
181
|
+
return origin === "null" && this.config.allowedOrigins.includes("null");
|
|
182
|
+
}
|
|
183
|
+
return this.config.allowedOrigins.some((allowed) => matchOriginPattern(allowed, origin));
|
|
184
|
+
}
|
|
185
|
+
/** SEC-01: counters for rejected traffic — surfaced for tests/monitoring. */
|
|
186
|
+
stats = { rejectedOrigin: 0, rejectedSize: 0, rejectedRate: 0, accepted: 0 };
|
|
187
|
+
/**
|
|
188
|
+
* SEC-01: size + rate gate, applied after the origin is trusted so that
|
|
189
|
+
* hostile origins are not charged against the budget.
|
|
190
|
+
*/
|
|
191
|
+
passesTrafficBudget(data) {
|
|
192
|
+
const maxBytes = this.config.maxPayloadBytes ?? 1e6;
|
|
193
|
+
if (maxBytes > 0) {
|
|
194
|
+
let size = 0;
|
|
195
|
+
try {
|
|
196
|
+
size = typeof data === "string" ? data.length : JSON.stringify(data)?.length ?? 0;
|
|
197
|
+
} catch {
|
|
198
|
+
this.stats.rejectedSize++;
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
if (size > maxBytes) {
|
|
202
|
+
this.stats.rejectedSize++;
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const maxMessages = this.config.maxMessages ?? 600;
|
|
207
|
+
const windowMs = this.config.rateWindowMs ?? 1e4;
|
|
208
|
+
if (maxMessages > 0) {
|
|
209
|
+
const now = Date.now();
|
|
210
|
+
if (now - this.rateWindowStart >= windowMs) {
|
|
211
|
+
this.rateWindowStart = now;
|
|
212
|
+
this.rateCount = 0;
|
|
213
|
+
}
|
|
214
|
+
if (this.rateCount >= maxMessages) {
|
|
215
|
+
this.stats.rejectedRate++;
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
this.rateCount++;
|
|
219
|
+
}
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Handle incoming postMessage
|
|
224
|
+
*/
|
|
225
|
+
handleMessage(event) {
|
|
226
|
+
if (this.isDestroyed) return;
|
|
227
|
+
if (!this.isOriginAllowed(event.origin)) {
|
|
228
|
+
this.stats.rejectedOrigin++;
|
|
229
|
+
console.warn(`[IframeBridge] Rejected message from unauthorized origin: ${event.origin}`);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
if (this.config.isHost && this.config.targetOrigin !== "*" && event.origin !== this.config.targetOrigin) {
|
|
233
|
+
this.stats.rejectedOrigin++;
|
|
234
|
+
console.warn(`[IframeBridge] Rejected: origin ${event.origin} != expected ${this.config.targetOrigin}`);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (!this.passesTrafficBudget(event.data)) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
this.stats.accepted++;
|
|
241
|
+
if (!this.config.isHost && event.origin !== "null" && event.origin !== "") {
|
|
242
|
+
this.pinnedSendOrigin = event.origin;
|
|
243
|
+
}
|
|
244
|
+
const message = event.data;
|
|
245
|
+
if (isResponseMessage(message)) {
|
|
246
|
+
const pending = this.pendingRequests.get(message.correlationId);
|
|
247
|
+
if (pending) {
|
|
248
|
+
clearTimeout(pending.timeout);
|
|
249
|
+
this.pendingRequests.delete(message.correlationId);
|
|
250
|
+
if (message.success) {
|
|
251
|
+
pending.resolve(message.payload);
|
|
252
|
+
} else {
|
|
253
|
+
pending.reject(new Error(message.error || "Unknown error"));
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
if (isHostToIframeCommand(message) && this.requestHandler) {
|
|
259
|
+
this.requestHandler(message).then((payload) => this.sendResponse(message, payload, true)).catch((error) => this.sendResponse(message, { success: false, error: error.message }, false, error.message));
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (isIframeToHostEvent(message) && this.messageHandler) {
|
|
263
|
+
this.messageHandler(message);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
console.warn("[IframeBridge] Received unknown message type:", message?.type);
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Destroy the bridge and cleanup
|
|
270
|
+
*/
|
|
271
|
+
destroy() {
|
|
272
|
+
if (this.isDestroyed) return;
|
|
273
|
+
this.isDestroyed = true;
|
|
274
|
+
window.removeEventListener("message", this.boundHandleMessage);
|
|
275
|
+
for (const [, pending] of this.pendingRequests) {
|
|
276
|
+
clearTimeout(pending.timeout);
|
|
277
|
+
pending.reject(new Error("Bridge destroyed"));
|
|
278
|
+
}
|
|
279
|
+
this.pendingRequests.clear();
|
|
280
|
+
this.messageHandler = null;
|
|
281
|
+
this.requestHandler = null;
|
|
282
|
+
this.readyResolve = null;
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
function createHostBridge(iframe, allowedOrigins = DEFAULT_ALLOWED_ORIGINS, options = {}) {
|
|
286
|
+
const src = iframe.src;
|
|
287
|
+
if (!src || src.trim() === "") {
|
|
288
|
+
throw new Error(
|
|
289
|
+
"[IframeBridge] Cannot create host bridge: iframe has no src. Set the iframe src before connecting so the expected origin can be derived."
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
return new IframeBridge({
|
|
293
|
+
targetWindow: iframe.contentWindow,
|
|
294
|
+
targetOrigin: new URL(src).origin,
|
|
295
|
+
allowedOrigins,
|
|
296
|
+
isHost: true,
|
|
297
|
+
...options
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// src/widget/iframe/hostSDK.ts
|
|
302
|
+
var EmbedError = class extends Error {
|
|
303
|
+
code;
|
|
304
|
+
recoverable;
|
|
305
|
+
detail;
|
|
306
|
+
constructor(code, message, recoverable = true, detail) {
|
|
307
|
+
super(message);
|
|
308
|
+
this.name = "EmbedError";
|
|
309
|
+
this.code = code;
|
|
310
|
+
this.recoverable = recoverable;
|
|
311
|
+
this.detail = detail;
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
var DEFAULT_CONFIG = {
|
|
315
|
+
allowedOrigins: DEFAULT_ALLOWED_ORIGINS,
|
|
316
|
+
connectionTimeout: 1e4,
|
|
317
|
+
// E4: fail fast by default; slow ops (initialize/captureSnapshot) opt out.
|
|
318
|
+
requestTimeout: 5e3
|
|
319
|
+
};
|
|
320
|
+
var VNInvestChartsHostSDK = class {
|
|
321
|
+
config;
|
|
322
|
+
iframe;
|
|
323
|
+
bridge = null;
|
|
324
|
+
isReady = false;
|
|
325
|
+
version = null;
|
|
326
|
+
capabilities = [];
|
|
327
|
+
readyPromise = null;
|
|
328
|
+
readyResolve = null;
|
|
329
|
+
eventListeners = /* @__PURE__ */ new Map();
|
|
330
|
+
constructor(config) {
|
|
331
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
332
|
+
if (typeof config.iframe === "string") {
|
|
333
|
+
const element = document.querySelector(config.iframe);
|
|
334
|
+
if (!element) {
|
|
335
|
+
throw new Error(`Iframe not found: ${config.iframe}`);
|
|
336
|
+
}
|
|
337
|
+
this.iframe = element;
|
|
338
|
+
} else {
|
|
339
|
+
this.iframe = config.iframe;
|
|
340
|
+
}
|
|
341
|
+
this.readyPromise = new Promise((resolve) => {
|
|
342
|
+
this.readyResolve = resolve;
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Connect to the iframe widget
|
|
347
|
+
*/
|
|
348
|
+
async connect() {
|
|
349
|
+
if (this.bridge) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
await this.waitForIframeLoad();
|
|
353
|
+
this.bridge = createHostBridge(this.iframe, this.config.allowedOrigins, {
|
|
354
|
+
requestTimeout: this.config.requestTimeout,
|
|
355
|
+
onReady: () => this.handleReady(),
|
|
356
|
+
onError: (error) => this.config.onError?.(error)
|
|
357
|
+
});
|
|
358
|
+
this.bridge.setMessageHandler((event) => this.handleEvent(event));
|
|
359
|
+
try {
|
|
360
|
+
await Promise.race([
|
|
361
|
+
this.readyPromise,
|
|
362
|
+
new Promise(
|
|
363
|
+
(_, reject) => setTimeout(() => reject(new Error("Connection timeout")), this.config.connectionTimeout)
|
|
364
|
+
)
|
|
365
|
+
]);
|
|
366
|
+
} catch (error) {
|
|
367
|
+
this.disconnect();
|
|
368
|
+
throw error;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Wait for iframe to finish loading
|
|
373
|
+
*/
|
|
374
|
+
waitForIframeLoad() {
|
|
375
|
+
return new Promise((resolve, reject) => {
|
|
376
|
+
if (this.iframe.contentDocument?.readyState === "complete") {
|
|
377
|
+
resolve();
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
const onLoad = () => {
|
|
381
|
+
this.iframe.removeEventListener("load", onLoad);
|
|
382
|
+
resolve();
|
|
383
|
+
};
|
|
384
|
+
const onError = () => {
|
|
385
|
+
this.iframe.removeEventListener("load", onLoad);
|
|
386
|
+
reject(new Error("Iframe failed to load"));
|
|
387
|
+
};
|
|
388
|
+
this.iframe.addEventListener("load", onLoad);
|
|
389
|
+
this.iframe.addEventListener("error", onError);
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Handle ready signal from iframe
|
|
394
|
+
*/
|
|
395
|
+
handleReady() {
|
|
396
|
+
this.isReady = true;
|
|
397
|
+
this.readyResolve?.();
|
|
398
|
+
this.readyResolve = null;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Handle incoming events from iframe
|
|
402
|
+
*/
|
|
403
|
+
handleEvent(event) {
|
|
404
|
+
if (event.type === "event:ready") {
|
|
405
|
+
this.version = event.payload.version;
|
|
406
|
+
this.capabilities = event.payload.capabilities;
|
|
407
|
+
this.config.onReady?.({ version: this.version, capabilities: this.capabilities });
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
const listeners = this.eventListeners.get(event.type);
|
|
411
|
+
if (listeners) {
|
|
412
|
+
for (const listener of listeners) {
|
|
413
|
+
try {
|
|
414
|
+
listener(event.payload);
|
|
415
|
+
} catch (error) {
|
|
416
|
+
console.error(`[HostSDK] Event listener error for ${event.type}:`, error);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
this.config.onEvent?.(event);
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Get the widget controller API
|
|
424
|
+
*/
|
|
425
|
+
getController() {
|
|
426
|
+
if (!this.bridge) {
|
|
427
|
+
throw new Error("Not connected. Call connect() first.");
|
|
428
|
+
}
|
|
429
|
+
const bridge = this.bridge;
|
|
430
|
+
const toEmbedError = (command, message) => {
|
|
431
|
+
const code = message.startsWith("Request timeout") ? "BRIDGE_TIMEOUT" : "COMMAND_FAILED";
|
|
432
|
+
return new EmbedError(code, message, true, command.type);
|
|
433
|
+
};
|
|
434
|
+
const sendVoid = async (command, timeoutMs) => {
|
|
435
|
+
try {
|
|
436
|
+
const response = await bridge.sendCommand(command, timeoutMs);
|
|
437
|
+
if (!response.success) {
|
|
438
|
+
throw new Error(response.error || "Command failed");
|
|
439
|
+
}
|
|
440
|
+
} catch (error) {
|
|
441
|
+
if (error instanceof EmbedError) throw error;
|
|
442
|
+
throw toEmbedError(command, error instanceof Error ? error.message : String(error));
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
const sendWithData = async (command, extractor, timeoutMs) => {
|
|
446
|
+
try {
|
|
447
|
+
const response = await bridge.sendCommand(command, timeoutMs);
|
|
448
|
+
if (!response.success) {
|
|
449
|
+
throw new Error(response.error || "Command failed");
|
|
450
|
+
}
|
|
451
|
+
return extractor(response);
|
|
452
|
+
} catch (error) {
|
|
453
|
+
if (error instanceof EmbedError) throw error;
|
|
454
|
+
throw toEmbedError(command, error instanceof Error ? error.message : String(error));
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
return {
|
|
458
|
+
initialize: (config) => sendWithData(
|
|
459
|
+
{
|
|
460
|
+
type: "request:initialize",
|
|
461
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
462
|
+
timestamp: Date.now(),
|
|
463
|
+
origin: window.location.origin,
|
|
464
|
+
payload: config
|
|
465
|
+
},
|
|
466
|
+
(payload) => ({ widgetId: payload.widgetId }),
|
|
467
|
+
3e4
|
|
468
|
+
),
|
|
469
|
+
setSymbol: (symbol) => sendVoid({
|
|
470
|
+
type: "request:setSymbol",
|
|
471
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
472
|
+
timestamp: Date.now(),
|
|
473
|
+
origin: window.location.origin,
|
|
474
|
+
payload: { symbol }
|
|
475
|
+
}),
|
|
476
|
+
setTimeframe: (timeframe) => sendVoid({
|
|
477
|
+
type: "request:setTimeframe",
|
|
478
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
479
|
+
timestamp: Date.now(),
|
|
480
|
+
origin: window.location.origin,
|
|
481
|
+
payload: { timeframe }
|
|
482
|
+
}),
|
|
483
|
+
setRange: (range) => sendVoid({
|
|
484
|
+
type: "request:setRange",
|
|
485
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
486
|
+
timestamp: Date.now(),
|
|
487
|
+
origin: window.location.origin,
|
|
488
|
+
payload: { range }
|
|
489
|
+
}),
|
|
490
|
+
setTheme: (theme) => sendVoid({
|
|
491
|
+
type: "request:setTheme",
|
|
492
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
493
|
+
timestamp: Date.now(),
|
|
494
|
+
origin: window.location.origin,
|
|
495
|
+
payload: { theme }
|
|
496
|
+
}),
|
|
497
|
+
setDrawings: (drawings) => sendVoid({
|
|
498
|
+
type: "request:setDrawings",
|
|
499
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
500
|
+
timestamp: Date.now(),
|
|
501
|
+
origin: window.location.origin,
|
|
502
|
+
payload: { drawings }
|
|
503
|
+
}),
|
|
504
|
+
addDrawing: (drawing) => sendVoid({
|
|
505
|
+
type: "request:addDrawing",
|
|
506
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
507
|
+
timestamp: Date.now(),
|
|
508
|
+
origin: window.location.origin,
|
|
509
|
+
payload: { drawing }
|
|
510
|
+
}),
|
|
511
|
+
removeDrawing: (drawingId) => sendVoid({
|
|
512
|
+
type: "request:removeDrawing",
|
|
513
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
514
|
+
timestamp: Date.now(),
|
|
515
|
+
origin: window.location.origin,
|
|
516
|
+
payload: { drawingId }
|
|
517
|
+
}),
|
|
518
|
+
updateDrawing: (drawingId, updates) => sendVoid({
|
|
519
|
+
type: "request:updateDrawing",
|
|
520
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
521
|
+
timestamp: Date.now(),
|
|
522
|
+
origin: window.location.origin,
|
|
523
|
+
payload: { drawingId, updates }
|
|
524
|
+
}),
|
|
525
|
+
setActiveTool: (tool) => sendVoid({
|
|
526
|
+
type: "request:setActiveTool",
|
|
527
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
528
|
+
timestamp: Date.now(),
|
|
529
|
+
origin: window.location.origin,
|
|
530
|
+
payload: { tool }
|
|
531
|
+
}),
|
|
532
|
+
setDockTab: (tab) => sendVoid({
|
|
533
|
+
type: "request:setDockTab",
|
|
534
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
535
|
+
timestamp: Date.now(),
|
|
536
|
+
origin: window.location.origin,
|
|
537
|
+
payload: { tab }
|
|
538
|
+
}),
|
|
539
|
+
setWatchlist: (symbols) => sendVoid({
|
|
540
|
+
type: "request:setWatchlist",
|
|
541
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
542
|
+
timestamp: Date.now(),
|
|
543
|
+
origin: window.location.origin,
|
|
544
|
+
payload: { symbols }
|
|
545
|
+
}),
|
|
546
|
+
exportDrawings: () => sendWithData(
|
|
547
|
+
{
|
|
548
|
+
type: "request:exportDrawings",
|
|
549
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
550
|
+
timestamp: Date.now(),
|
|
551
|
+
origin: window.location.origin,
|
|
552
|
+
payload: {}
|
|
553
|
+
},
|
|
554
|
+
(payload) => payload.drawings
|
|
555
|
+
),
|
|
556
|
+
getVisibleRange: () => sendWithData(
|
|
557
|
+
{
|
|
558
|
+
type: "request:getVisibleRange",
|
|
559
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
560
|
+
timestamp: Date.now(),
|
|
561
|
+
origin: window.location.origin,
|
|
562
|
+
payload: {}
|
|
563
|
+
},
|
|
564
|
+
(payload) => payload.range
|
|
565
|
+
),
|
|
566
|
+
getPaneSnapshots: () => sendWithData(
|
|
567
|
+
{
|
|
568
|
+
type: "request:getPaneSnapshots",
|
|
569
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
570
|
+
timestamp: Date.now(),
|
|
571
|
+
origin: window.location.origin,
|
|
572
|
+
payload: {}
|
|
573
|
+
},
|
|
574
|
+
(payload) => payload.snapshots
|
|
575
|
+
),
|
|
576
|
+
captureSnapshot: (format, quality) => sendWithData(
|
|
577
|
+
{
|
|
578
|
+
type: "request:captureSnapshot",
|
|
579
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
580
|
+
timestamp: Date.now(),
|
|
581
|
+
origin: window.location.origin,
|
|
582
|
+
payload: { format, quality }
|
|
583
|
+
},
|
|
584
|
+
(payload) => payload.dataUrl,
|
|
585
|
+
3e4
|
|
586
|
+
),
|
|
587
|
+
toggleFullscreen: () => sendVoid({
|
|
588
|
+
type: "request:toggleFullscreen",
|
|
589
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
590
|
+
timestamp: Date.now(),
|
|
591
|
+
origin: window.location.origin,
|
|
592
|
+
payload: {}
|
|
593
|
+
}),
|
|
594
|
+
setLocale: (locale) => sendVoid({
|
|
595
|
+
type: "request:setLocale",
|
|
596
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
597
|
+
timestamp: Date.now(),
|
|
598
|
+
origin: window.location.origin,
|
|
599
|
+
payload: { locale }
|
|
600
|
+
}),
|
|
601
|
+
setTimezone: (timezone) => sendVoid({
|
|
602
|
+
type: "request:setTimezone",
|
|
603
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
604
|
+
timestamp: Date.now(),
|
|
605
|
+
origin: window.location.origin,
|
|
606
|
+
payload: { timezone }
|
|
607
|
+
}),
|
|
608
|
+
destroy: () => sendVoid({
|
|
609
|
+
type: "request:destroy",
|
|
610
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
611
|
+
timestamp: Date.now(),
|
|
612
|
+
origin: window.location.origin,
|
|
613
|
+
payload: {}
|
|
614
|
+
}),
|
|
615
|
+
subscribeQuotes: async (symbols, onQuotes) => {
|
|
616
|
+
await sendVoid({
|
|
617
|
+
type: "request:subscribeQuotes",
|
|
618
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
619
|
+
timestamp: Date.now(),
|
|
620
|
+
origin: window.location.origin,
|
|
621
|
+
payload: { symbols }
|
|
622
|
+
});
|
|
623
|
+
const offEvent = this.on("event:quotes", (payload) => {
|
|
624
|
+
onQuotes(payload.updates ?? []);
|
|
625
|
+
});
|
|
626
|
+
let unsubscribed = false;
|
|
627
|
+
return async () => {
|
|
628
|
+
if (unsubscribed) return;
|
|
629
|
+
unsubscribed = true;
|
|
630
|
+
offEvent();
|
|
631
|
+
await sendVoid({
|
|
632
|
+
type: "request:unsubscribeQuotes",
|
|
633
|
+
correlationId: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
634
|
+
timestamp: Date.now(),
|
|
635
|
+
origin: window.location.origin,
|
|
636
|
+
payload: { symbols }
|
|
637
|
+
});
|
|
638
|
+
};
|
|
639
|
+
},
|
|
640
|
+
isReady: () => this.isReady,
|
|
641
|
+
getVersion: () => this.version
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Subscribe to specific event types
|
|
646
|
+
*/
|
|
647
|
+
on(eventType, listener) {
|
|
648
|
+
if (!this.eventListeners.has(eventType)) {
|
|
649
|
+
this.eventListeners.set(eventType, /* @__PURE__ */ new Set());
|
|
650
|
+
}
|
|
651
|
+
this.eventListeners.get(eventType).add(listener);
|
|
652
|
+
return () => {
|
|
653
|
+
this.eventListeners.get(eventType)?.delete(listener);
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Disconnect and cleanup
|
|
658
|
+
*/
|
|
659
|
+
disconnect() {
|
|
660
|
+
if (this.bridge) {
|
|
661
|
+
this.bridge.destroy();
|
|
662
|
+
this.bridge = null;
|
|
663
|
+
}
|
|
664
|
+
this.isReady = false;
|
|
665
|
+
this.version = null;
|
|
666
|
+
this.capabilities = [];
|
|
667
|
+
this.config.onDisconnect?.();
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Check if connected and ready
|
|
671
|
+
*/
|
|
672
|
+
get connected() {
|
|
673
|
+
return this.bridge !== null && this.isReady;
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
async function createVNInvestChartsHost(config) {
|
|
677
|
+
const sdk = new VNInvestChartsHostSDK(config);
|
|
678
|
+
await sdk.connect();
|
|
679
|
+
return sdk;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
exports.DEFAULT_ALLOWED_ORIGINS = DEFAULT_ALLOWED_ORIGINS;
|
|
683
|
+
exports.EmbedError = EmbedError;
|
|
684
|
+
exports.IframeBridge = IframeBridge;
|
|
685
|
+
exports.VNInvestChartsHostSDK = VNInvestChartsHostSDK;
|
|
686
|
+
exports.createHostBridge = createHostBridge;
|
|
687
|
+
exports.createVNInvestChartsHost = createVNInvestChartsHost;
|