@forgecharts/sdk 1.1.27 → 1.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (356) hide show
  1. package/dist/__tests__/backwardCompatibility.test.d.ts +14 -0
  2. package/dist/__tests__/backwardCompatibility.test.d.ts.map +1 -0
  3. package/dist/__tests__/candleInvariant.test.d.ts +20 -0
  4. package/dist/__tests__/candleInvariant.test.d.ts.map +1 -0
  5. package/dist/__tests__/public-api-surface.d.ts +13 -0
  6. package/dist/__tests__/public-api-surface.d.ts.map +1 -0
  7. package/dist/__tests__/timeframeBoundary.test.d.ts +17 -0
  8. package/dist/__tests__/timeframeBoundary.test.d.ts.map +1 -0
  9. package/dist/api/DrawingManager.d.ts +20 -0
  10. package/dist/api/DrawingManager.d.ts.map +1 -0
  11. package/dist/api/EventBus.d.ts +19 -0
  12. package/dist/api/EventBus.d.ts.map +1 -0
  13. package/dist/api/IndicatorDAG.d.ts +85 -0
  14. package/dist/api/IndicatorDAG.d.ts.map +1 -0
  15. package/dist/api/IndicatorRegistry.d.ts +22 -0
  16. package/dist/api/IndicatorRegistry.d.ts.map +1 -0
  17. package/dist/api/LayoutManager.d.ts +30 -0
  18. package/dist/api/LayoutManager.d.ts.map +1 -0
  19. package/dist/api/PaneManager.d.ts +42 -0
  20. package/dist/api/PaneManager.d.ts.map +1 -0
  21. package/dist/api/ReferenceAPI.d.ts +78 -0
  22. package/dist/api/ReferenceAPI.d.ts.map +1 -0
  23. package/dist/api/TChart.d.ts +345 -0
  24. package/dist/api/TChart.d.ts.map +1 -0
  25. package/{src/api/createChart.ts → dist/api/createChart.d.ts} +2 -7
  26. package/dist/api/createChart.d.ts.map +1 -0
  27. package/dist/api/drawing tools/fib gann menu/fibRetracement.d.ts +4 -0
  28. package/dist/api/drawing tools/fib gann menu/fibRetracement.d.ts.map +1 -0
  29. package/dist/api/drawing tools/lines menu/crossLine.d.ts +4 -0
  30. package/dist/api/drawing tools/lines menu/crossLine.d.ts.map +1 -0
  31. package/dist/api/drawing tools/lines menu/disjointChannel.d.ts +17 -0
  32. package/dist/api/drawing tools/lines menu/disjointChannel.d.ts.map +1 -0
  33. package/dist/api/drawing tools/lines menu/extendedLine.d.ts +4 -0
  34. package/dist/api/drawing tools/lines menu/extendedLine.d.ts.map +1 -0
  35. package/dist/api/drawing tools/lines menu/flatTopBottom.d.ts +4 -0
  36. package/dist/api/drawing tools/lines menu/flatTopBottom.d.ts.map +1 -0
  37. package/dist/api/drawing tools/lines menu/horizontal.d.ts +4 -0
  38. package/dist/api/drawing tools/lines menu/horizontal.d.ts.map +1 -0
  39. package/dist/api/drawing tools/lines menu/horizontalRay.d.ts +4 -0
  40. package/dist/api/drawing tools/lines menu/horizontalRay.d.ts.map +1 -0
  41. package/dist/api/drawing tools/lines menu/infoLine.d.ts +4 -0
  42. package/dist/api/drawing tools/lines menu/infoLine.d.ts.map +1 -0
  43. package/dist/api/drawing tools/lines menu/insidePitchfork.d.ts +4 -0
  44. package/dist/api/drawing tools/lines menu/insidePitchfork.d.ts.map +1 -0
  45. package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.d.ts +4 -0
  46. package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.d.ts.map +1 -0
  47. package/dist/api/drawing tools/lines menu/parallelChannel.d.ts +4 -0
  48. package/dist/api/drawing tools/lines menu/parallelChannel.d.ts.map +1 -0
  49. package/dist/api/drawing tools/lines menu/pitchfork.d.ts +4 -0
  50. package/dist/api/drawing tools/lines menu/pitchfork.d.ts.map +1 -0
  51. package/dist/api/drawing tools/lines menu/ray.d.ts +4 -0
  52. package/dist/api/drawing tools/lines menu/ray.d.ts.map +1 -0
  53. package/dist/api/drawing tools/lines menu/regressionTrend.d.ts +4 -0
  54. package/dist/api/drawing tools/lines menu/regressionTrend.d.ts.map +1 -0
  55. package/dist/api/drawing tools/lines menu/schiffPitchfork.d.ts +4 -0
  56. package/dist/api/drawing tools/lines menu/schiffPitchfork.d.ts.map +1 -0
  57. package/dist/api/drawing tools/lines menu/trendAngle.d.ts +4 -0
  58. package/dist/api/drawing tools/lines menu/trendAngle.d.ts.map +1 -0
  59. package/dist/api/drawing tools/lines menu/trendline.d.ts +4 -0
  60. package/dist/api/drawing tools/lines menu/trendline.d.ts.map +1 -0
  61. package/dist/api/drawing tools/lines menu/vertical.d.ts +4 -0
  62. package/dist/api/drawing tools/lines menu/vertical.d.ts.map +1 -0
  63. package/{src/api/drawing tools/pointers menu/crosshair.ts → dist/api/drawing tools/pointers menu/crosshair.d.ts } +8 -9
  64. package/dist/api/drawing tools/pointers menu/crosshair.d.ts.map +1 -0
  65. package/dist/api/drawing tools/pointers menu/cursor.d.ts +15 -0
  66. package/dist/api/drawing tools/pointers menu/cursor.d.ts.map +1 -0
  67. package/{src/api/drawing tools/pointers menu/demonstration.ts → dist/api/drawing tools/pointers menu/demonstration.d.ts } +12 -17
  68. package/dist/api/drawing tools/pointers menu/demonstration.d.ts.map +1 -0
  69. package/{src/api/drawing tools/pointers menu/dot.ts → dist/api/drawing tools/pointers menu/dot.d.ts } +10 -13
  70. package/dist/api/drawing tools/pointers menu/dot.d.ts.map +1 -0
  71. package/dist/api/drawing tools/shapes menu/rectangle.d.ts +4 -0
  72. package/dist/api/drawing tools/shapes menu/rectangle.d.ts.map +1 -0
  73. package/dist/api/drawing tools/shapes menu/text.d.ts +4 -0
  74. package/dist/api/drawing tools/shapes menu/text.d.ts.map +1 -0
  75. package/dist/api/drawingUtils.d.ts +22 -0
  76. package/dist/api/drawingUtils.d.ts.map +1 -0
  77. package/dist/core/CanvasLayer.d.ts +26 -0
  78. package/dist/core/CanvasLayer.d.ts.map +1 -0
  79. package/dist/core/Chart.d.ts +164 -0
  80. package/dist/core/Chart.d.ts.map +1 -0
  81. package/dist/core/CoordTransform.d.ts +168 -0
  82. package/dist/core/CoordTransform.d.ts.map +1 -0
  83. package/dist/core/Crosshair.d.ts +30 -0
  84. package/dist/core/Crosshair.d.ts.map +1 -0
  85. package/dist/core/IndicatorEngine.d.ts +51 -0
  86. package/dist/core/IndicatorEngine.d.ts.map +1 -0
  87. package/dist/core/InteractionManager.d.ts +197 -0
  88. package/dist/core/InteractionManager.d.ts.map +1 -0
  89. package/dist/core/PriceScale.d.ts +27 -0
  90. package/dist/core/PriceScale.d.ts.map +1 -0
  91. package/dist/core/Series.d.ts +40 -0
  92. package/dist/core/Series.d.ts.map +1 -0
  93. package/dist/core/TimeScale.d.ts +43 -0
  94. package/dist/core/TimeScale.d.ts.map +1 -0
  95. package/dist/datafeed/DatafeedConnector.d.ts +89 -0
  96. package/dist/datafeed/DatafeedConnector.d.ts.map +1 -0
  97. package/dist/engine/CandleEngine.d.ts +207 -0
  98. package/dist/engine/CandleEngine.d.ts.map +1 -0
  99. package/dist/engine/__tests__/CandleEngine.test.d.ts +2 -0
  100. package/dist/engine/__tests__/CandleEngine.test.d.ts.map +1 -0
  101. package/dist/engine/candleInvariants.d.ts +66 -0
  102. package/dist/engine/candleInvariants.d.ts.map +1 -0
  103. package/{src/engine/mergeUtils.ts → dist/engine/mergeUtils.d.ts} +15 -52
  104. package/dist/engine/mergeUtils.d.ts.map +1 -0
  105. package/dist/engine/timeframeUtils.d.ts +80 -0
  106. package/dist/engine/timeframeUtils.d.ts.map +1 -0
  107. package/dist/index.d.ts +40 -0
  108. package/dist/index.d.ts.map +1 -0
  109. package/dist/index.js +8101 -0
  110. package/dist/index.js.map +1 -0
  111. package/{src/internal.ts → dist/internal.d.ts} +1 -13
  112. package/dist/internal.d.ts.map +1 -0
  113. package/dist/internal.js +8852 -0
  114. package/dist/internal.js.map +1 -0
  115. package/dist/licensing/ChartRuntimeResolver.d.ts +233 -0
  116. package/dist/licensing/ChartRuntimeResolver.d.ts.map +1 -0
  117. package/dist/licensing/LicenseManager.d.ts +55 -0
  118. package/dist/licensing/LicenseManager.d.ts.map +1 -0
  119. package/dist/licensing/__tests__/ChartRuntimeResolver.test.d.ts +13 -0
  120. package/dist/licensing/__tests__/ChartRuntimeResolver.test.d.ts.map +1 -0
  121. package/dist/licensing/__tests__/LicenseManager.test.d.ts +12 -0
  122. package/dist/licensing/__tests__/LicenseManager.test.d.ts.map +1 -0
  123. package/dist/licensing/licenseTypes.d.ts +18 -0
  124. package/dist/licensing/licenseTypes.d.ts.map +1 -0
  125. package/dist/pine/PineCompiler.d.ts +35 -0
  126. package/dist/pine/PineCompiler.d.ts.map +1 -0
  127. package/dist/pine/diagnostics.d.ts +20 -0
  128. package/dist/pine/diagnostics.d.ts.map +1 -0
  129. package/{src/pine/index.ts → dist/pine/index.d.ts} +4 -3
  130. package/dist/pine/index.d.ts.map +1 -0
  131. package/dist/pine/pine-ast.d.ts +142 -0
  132. package/dist/pine/pine-ast.d.ts.map +1 -0
  133. package/dist/pine/pine-lexer.d.ts +41 -0
  134. package/dist/pine/pine-lexer.d.ts.map +1 -0
  135. package/dist/pine/pine-parser.d.ts +51 -0
  136. package/dist/pine/pine-parser.d.ts.map +1 -0
  137. package/dist/pine/pine-transpiler.d.ts +33 -0
  138. package/dist/pine/pine-transpiler.d.ts.map +1 -0
  139. package/dist/pixi/LayerName.d.ts +18 -0
  140. package/dist/pixi/LayerName.d.ts.map +1 -0
  141. package/dist/pixi/PixiCandlestickRenderer.d.ts +23 -0
  142. package/dist/pixi/PixiCandlestickRenderer.d.ts.map +1 -0
  143. package/dist/pixi/PixiChart.d.ts +72 -0
  144. package/dist/pixi/PixiChart.d.ts.map +1 -0
  145. package/dist/pixi/PixiCrosshairRenderer.d.ts +29 -0
  146. package/dist/pixi/PixiCrosshairRenderer.d.ts.map +1 -0
  147. package/dist/pixi/PixiDrawingRenderer.d.ts +17 -0
  148. package/dist/pixi/PixiDrawingRenderer.d.ts.map +1 -0
  149. package/dist/pixi/PixiGridRenderer.d.ts +22 -0
  150. package/dist/pixi/PixiGridRenderer.d.ts.map +1 -0
  151. package/dist/pixi/PixiLayerManager.d.ts +56 -0
  152. package/dist/pixi/PixiLayerManager.d.ts.map +1 -0
  153. package/dist/react/canvas/ChartCanvas.d.ts +85 -0
  154. package/dist/react/canvas/ChartCanvas.d.ts.map +1 -0
  155. package/dist/react/canvas/ChartContextMenu.d.ts +18 -0
  156. package/dist/react/canvas/ChartContextMenu.d.ts.map +1 -0
  157. package/dist/react/canvas/ChartSettingsDialog.d.ts +25 -0
  158. package/dist/react/canvas/ChartSettingsDialog.d.ts.map +1 -0
  159. package/dist/react/canvas/IndicatorLabel.d.ts +21 -0
  160. package/dist/react/canvas/IndicatorLabel.d.ts.map +1 -0
  161. package/dist/react/canvas/IndicatorPane.d.ts +32 -0
  162. package/dist/react/canvas/IndicatorPane.d.ts.map +1 -0
  163. package/dist/react/canvas/PointerOverlay.d.ts +23 -0
  164. package/dist/react/canvas/PointerOverlay.d.ts.map +1 -0
  165. package/dist/react/canvas/toolbars/LeftToolbar.d.ts +19 -0
  166. package/dist/react/canvas/toolbars/LeftToolbar.d.ts.map +1 -0
  167. package/dist/react/hooks/useChartCapabilities.d.ts +21 -0
  168. package/dist/react/hooks/useChartCapabilities.d.ts.map +1 -0
  169. package/{src/react/index.ts → dist/react/index.d.ts} +2 -23
  170. package/dist/react/index.d.ts.map +1 -0
  171. package/dist/react/index.js +11559 -0
  172. package/dist/react/index.js.map +1 -0
  173. package/{src/react/internal.ts → dist/react/internal.d.ts} +2 -26
  174. package/dist/react/internal.d.ts.map +1 -0
  175. package/dist/react/internal.js +12148 -0
  176. package/dist/react/internal.js.map +1 -0
  177. package/dist/react/shell/ManagedAppShell.d.ts +91 -0
  178. package/dist/react/shell/ManagedAppShell.d.ts.map +1 -0
  179. package/dist/react/trading/TradingBridge.d.ts +86 -0
  180. package/dist/react/trading/TradingBridge.d.ts.map +1 -0
  181. package/dist/react/workspace/ChartWorkspace.d.ts +73 -0
  182. package/dist/react/workspace/ChartWorkspace.d.ts.map +1 -0
  183. package/dist/react/workspace/FloatingPanel.d.ts +18 -0
  184. package/dist/react/workspace/FloatingPanel.d.ts.map +1 -0
  185. package/dist/react/workspace/IndicatorsDialog.d.ts +8 -0
  186. package/dist/react/workspace/IndicatorsDialog.d.ts.map +1 -0
  187. package/dist/react/workspace/LayoutMenu.d.ts +33 -0
  188. package/dist/react/workspace/LayoutMenu.d.ts.map +1 -0
  189. package/dist/react/workspace/SymbolSearchDialog.d.ts +10 -0
  190. package/dist/react/workspace/SymbolSearchDialog.d.ts.map +1 -0
  191. package/dist/react/workspace/TabBar.d.ts +17 -0
  192. package/dist/react/workspace/TabBar.d.ts.map +1 -0
  193. package/dist/react/workspace/toolbars/BottomToolbar.d.ts +19 -0
  194. package/dist/react/workspace/toolbars/BottomToolbar.d.ts.map +1 -0
  195. package/dist/react/workspace/toolbars/RightToolbar.d.ts +8 -0
  196. package/dist/react/workspace/toolbars/RightToolbar.d.ts.map +1 -0
  197. package/dist/react/workspace/toolbars/TopToolbar.d.ts +41 -0
  198. package/dist/react/workspace/toolbars/TopToolbar.d.ts.map +1 -0
  199. package/dist/renderers/CandlestickRenderer.d.ts +13 -0
  200. package/dist/renderers/CandlestickRenderer.d.ts.map +1 -0
  201. package/dist/renderers/HistogramRenderer.d.ts +11 -0
  202. package/dist/renderers/HistogramRenderer.d.ts.map +1 -0
  203. package/dist/renderers/LineRenderer.d.ts +12 -0
  204. package/dist/renderers/LineRenderer.d.ts.map +1 -0
  205. package/dist/theme/colors.d.ts +4 -0
  206. package/dist/theme/colors.d.ts.map +1 -0
  207. package/dist/tools/barDivergenceCheck.d.ts +120 -0
  208. package/dist/tools/barDivergenceCheck.d.ts.map +1 -0
  209. package/dist/trading/TradingOverlayStore.d.ts +86 -0
  210. package/dist/trading/TradingOverlayStore.d.ts.map +1 -0
  211. package/dist/trading/UnmanagedIngestion.d.ts +91 -0
  212. package/dist/trading/UnmanagedIngestion.d.ts.map +1 -0
  213. package/dist/trading/__tests__/ManagedTradingController.test.d.ts +18 -0
  214. package/dist/trading/__tests__/ManagedTradingController.test.d.ts.map +1 -0
  215. package/dist/trading/__tests__/TradingOverlayStore.test.d.ts +16 -0
  216. package/dist/trading/__tests__/TradingOverlayStore.test.d.ts.map +1 -0
  217. package/dist/trading/__tests__/UnmanagedIngestion.test.d.ts +16 -0
  218. package/dist/trading/__tests__/UnmanagedIngestion.test.d.ts.map +1 -0
  219. package/dist/trading/managed/ManagedTradingController.d.ts +110 -0
  220. package/dist/trading/managed/ManagedTradingController.d.ts.map +1 -0
  221. package/dist/trading/managed/managedCapabilities.d.ts +45 -0
  222. package/dist/trading/managed/managedCapabilities.d.ts.map +1 -0
  223. package/dist/trading/managed/managedTypes.d.ts +122 -0
  224. package/dist/trading/managed/managedTypes.d.ts.map +1 -0
  225. package/dist/trading/tradingTypes.d.ts +89 -0
  226. package/dist/trading/tradingTypes.d.ts.map +1 -0
  227. package/dist/tscript/TScriptIndicator.d.ts +41 -0
  228. package/dist/tscript/TScriptIndicator.d.ts.map +1 -0
  229. package/dist/tscript/ast.d.ts +89 -0
  230. package/dist/tscript/ast.d.ts.map +1 -0
  231. package/dist/tscript/lexer.d.ts +36 -0
  232. package/dist/tscript/lexer.d.ts.map +1 -0
  233. package/dist/tscript/parser.d.ts +50 -0
  234. package/dist/tscript/parser.d.ts.map +1 -0
  235. package/dist/tscript/runtime.d.ts +123 -0
  236. package/dist/tscript/runtime.d.ts.map +1 -0
  237. package/dist/tscript/series.d.ts +49 -0
  238. package/dist/tscript/series.d.ts.map +1 -0
  239. package/dist/types/IChart.d.ts +48 -0
  240. package/dist/types/IChart.d.ts.map +1 -0
  241. package/{src/types/IRenderer.ts → dist/types/IRenderer.d.ts} +2 -8
  242. package/dist/types/IRenderer.d.ts.map +1 -0
  243. package/dist/types/ISeries.d.ts +26 -0
  244. package/dist/types/ISeries.d.ts.map +1 -0
  245. package/package.json +5 -1
  246. package/src/__tests__/backwardCompatibility.test.ts +0 -191
  247. package/src/__tests__/candleInvariant.test.ts +0 -500
  248. package/src/__tests__/public-api-surface.ts +0 -76
  249. package/src/__tests__/timeframeBoundary.test.ts +0 -583
  250. package/src/api/DrawingManager.ts +0 -188
  251. package/src/api/EventBus.ts +0 -53
  252. package/src/api/IndicatorDAG.ts +0 -389
  253. package/src/api/IndicatorRegistry.ts +0 -47
  254. package/src/api/LayoutManager.ts +0 -72
  255. package/src/api/PaneManager.ts +0 -129
  256. package/src/api/ReferenceAPI.ts +0 -195
  257. package/src/api/TChart.ts +0 -881
  258. package/src/api/drawing tools/fib gann menu/fibRetracement.ts +0 -27
  259. package/src/api/drawing tools/lines menu/crossLine.ts +0 -21
  260. package/src/api/drawing tools/lines menu/disjointChannel.ts +0 -74
  261. package/src/api/drawing tools/lines menu/extendedLine.ts +0 -22
  262. package/src/api/drawing tools/lines menu/flatTopBottom.ts +0 -45
  263. package/src/api/drawing tools/lines menu/horizontal.ts +0 -24
  264. package/src/api/drawing tools/lines menu/horizontalRay.ts +0 -25
  265. package/src/api/drawing tools/lines menu/infoLine.ts +0 -127
  266. package/src/api/drawing tools/lines menu/insidePitchfork.ts +0 -21
  267. package/src/api/drawing tools/lines menu/modifiedSchiffPitchfork.ts +0 -18
  268. package/src/api/drawing tools/lines menu/parallelChannel.ts +0 -47
  269. package/src/api/drawing tools/lines menu/pitchfork.ts +0 -15
  270. package/src/api/drawing tools/lines menu/ray.ts +0 -28
  271. package/src/api/drawing tools/lines menu/regressionTrend.ts +0 -157
  272. package/src/api/drawing tools/lines menu/schiffPitchfork.ts +0 -18
  273. package/src/api/drawing tools/lines menu/trendAngle.ts +0 -64
  274. package/src/api/drawing tools/lines menu/trendline.ts +0 -16
  275. package/src/api/drawing tools/lines menu/vertical.ts +0 -16
  276. package/src/api/drawing tools/pointers menu/cursor.ts +0 -16
  277. package/src/api/drawing tools/shapes menu/rectangle.ts +0 -24
  278. package/src/api/drawing tools/shapes menu/text.ts +0 -30
  279. package/src/api/drawingUtils.ts +0 -82
  280. package/src/core/CanvasLayer.ts +0 -77
  281. package/src/core/Chart.ts +0 -917
  282. package/src/core/CoordTransform.ts +0 -282
  283. package/src/core/Crosshair.ts +0 -207
  284. package/src/core/IndicatorEngine.ts +0 -216
  285. package/src/core/InteractionManager.ts +0 -899
  286. package/src/core/PriceScale.ts +0 -133
  287. package/src/core/Series.ts +0 -132
  288. package/src/core/TimeScale.ts +0 -175
  289. package/src/datafeed/DatafeedConnector.ts +0 -300
  290. package/src/engine/CandleEngine.ts +0 -458
  291. package/src/engine/__tests__/CandleEngine.test.ts +0 -402
  292. package/src/engine/candleInvariants.ts +0 -172
  293. package/src/engine/timeframeUtils.ts +0 -118
  294. package/src/index.ts +0 -190
  295. package/src/licensing/ChartRuntimeResolver.ts +0 -380
  296. package/src/licensing/LicenseManager.ts +0 -131
  297. package/src/licensing/__tests__/ChartRuntimeResolver.test.ts +0 -207
  298. package/src/licensing/__tests__/LicenseManager.test.ts +0 -180
  299. package/src/licensing/licenseTypes.ts +0 -19
  300. package/src/pine/PineCompiler.ts +0 -68
  301. package/src/pine/diagnostics.ts +0 -30
  302. package/src/pine/pine-ast.ts +0 -163
  303. package/src/pine/pine-lexer.ts +0 -265
  304. package/src/pine/pine-parser.ts +0 -439
  305. package/src/pine/pine-transpiler.ts +0 -301
  306. package/src/pixi/LayerName.ts +0 -35
  307. package/src/pixi/PixiCandlestickRenderer.ts +0 -125
  308. package/src/pixi/PixiChart.ts +0 -425
  309. package/src/pixi/PixiCrosshairRenderer.ts +0 -134
  310. package/src/pixi/PixiDrawingRenderer.ts +0 -121
  311. package/src/pixi/PixiGridRenderer.ts +0 -136
  312. package/src/pixi/PixiLayerManager.ts +0 -102
  313. package/src/react/canvas/ChartCanvas.tsx +0 -984
  314. package/src/react/canvas/ChartContextMenu.tsx +0 -60
  315. package/src/react/canvas/ChartSettingsDialog.tsx +0 -133
  316. package/src/react/canvas/IndicatorLabel.tsx +0 -347
  317. package/src/react/canvas/IndicatorPane.tsx +0 -503
  318. package/src/react/canvas/PointerOverlay.tsx +0 -126
  319. package/src/react/canvas/toolbars/LeftToolbar.tsx +0 -1096
  320. package/src/react/hooks/useChartCapabilities.ts +0 -76
  321. package/src/react/shell/ManagedAppShell.tsx +0 -699
  322. package/src/react/trading/TradingBridge.ts +0 -156
  323. package/src/react/workspace/ChartWorkspace.tsx +0 -228
  324. package/src/react/workspace/FloatingPanel.tsx +0 -131
  325. package/src/react/workspace/IndicatorsDialog.tsx +0 -246
  326. package/src/react/workspace/LayoutMenu.tsx +0 -345
  327. package/src/react/workspace/SymbolSearchDialog.tsx +0 -377
  328. package/src/react/workspace/TabBar.tsx +0 -87
  329. package/src/react/workspace/toolbars/BottomToolbar.tsx +0 -372
  330. package/src/react/workspace/toolbars/RightToolbar.tsx +0 -46
  331. package/src/react/workspace/toolbars/TopToolbar.tsx +0 -431
  332. package/src/renderers/CandlestickRenderer.ts +0 -130
  333. package/src/renderers/HistogramRenderer.ts +0 -63
  334. package/src/renderers/LineRenderer.ts +0 -77
  335. package/src/theme/colors.ts +0 -21
  336. package/src/tools/barDivergenceCheck.ts +0 -305
  337. package/src/trading/TradingOverlayStore.ts +0 -161
  338. package/src/trading/UnmanagedIngestion.ts +0 -156
  339. package/src/trading/__tests__/ManagedTradingController.test.ts +0 -338
  340. package/src/trading/__tests__/TradingOverlayStore.test.ts +0 -323
  341. package/src/trading/__tests__/UnmanagedIngestion.test.ts +0 -205
  342. package/src/trading/managed/ManagedTradingController.ts +0 -292
  343. package/src/trading/managed/managedCapabilities.ts +0 -98
  344. package/src/trading/managed/managedTypes.ts +0 -151
  345. package/src/trading/tradingTypes.ts +0 -135
  346. package/src/tscript/TScriptIndicator.ts +0 -54
  347. package/src/tscript/ast.ts +0 -105
  348. package/src/tscript/lexer.ts +0 -190
  349. package/src/tscript/parser.ts +0 -334
  350. package/src/tscript/runtime.ts +0 -525
  351. package/src/tscript/series.ts +0 -84
  352. package/src/types/IChart.ts +0 -56
  353. package/src/types/ISeries.ts +0 -30
  354. package/tsconfig.json +0 -23
  355. package/tsup.config.ts +0 -16
  356. package/vitest.config.ts +0 -25
@@ -1,1096 +0,0 @@
1
- import React, { useState, useEffect, useRef } from 'react';
2
- import ReactDOM from 'react-dom';
3
- import type { DrawingToolType, DrawingType, PointerToolType } from '../../../';
4
-
5
- // ─── Pointer tools ────────────────────────────────────────────────────────────
6
-
7
- const POINTER_TOOLS: PointerToolType[] = ['cursor', 'crosshair', 'dot', 'demonstration'];
8
-
9
- const POINTER_ICONS: Record<PointerToolType, React.ReactNode> = {
10
- cursor: (
11
- <svg viewBox="0 0 16 16" width="15" height="15" fill="currentColor">
12
- <path d="M4 1l8 7-4 1-2 5-2-13z" />
13
- </svg>
14
- ),
15
- crosshair: (
16
- <svg viewBox="0 0 16 16" width="15" height="15" stroke="currentColor" fill="none" strokeWidth="1.5">
17
- {/* top arm */}
18
- <line x1="8" y1="1" x2="8" y2="6" />
19
- {/* bottom arm */}
20
- <line x1="8" y1="10" x2="8" y2="15" />
21
- {/* left arm */}
22
- <line x1="1" y1="8" x2="6" y2="8" />
23
- {/* right arm */}
24
- <line x1="10" y1="8" x2="15" y2="8" />
25
- </svg>
26
- ),
27
- dot: (
28
- <svg viewBox="0 0 16 16" width="15" height="15" fill="currentColor">
29
- <circle cx="8" cy="8" r="4" />
30
- </svg>
31
- ),
32
- demonstration: (
33
- <svg viewBox="0 0 16 16" width="15" height="15" stroke="currentColor" fill="none" strokeWidth="1.6">
34
- <line x1="8" y1="1" x2="8" y2="4.5" />
35
- <line x1="8" y1="11.5" x2="8" y2="15" />
36
- <line x1="1" y1="8" x2="4.5" y2="8" />
37
- <line x1="11.5" y1="8" x2="15" y2="8" />
38
- <circle cx="8" cy="8" r="4" />
39
- </svg>
40
- ),
41
- };
42
-
43
- const POINTER_LABELS: Record<PointerToolType, string> = {
44
- cursor: 'Arrow',
45
- crosshair: 'Cross',
46
- dot: 'Dot',
47
- demonstration: 'Demonstration',
48
- };
49
-
50
- // ─── Lines menu data ──────────────────────────────────────────────────────────
51
-
52
- interface LineItem {
53
- tool: string;
54
- label: string;
55
- shortcut?: string;
56
- icon: React.ReactNode;
57
- }
58
-
59
- interface LineSection {
60
- heading: string;
61
- items: LineItem[];
62
- }
63
-
64
- const LINES_SECTIONS: LineSection[] = [
65
- {
66
- heading: 'Lines',
67
- items: [
68
- {
69
- tool: 'trendline',
70
- label: 'Trendline',
71
- shortcut: 'Alt+T',
72
- icon: (
73
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
74
- <line x1="2" y1="14" x2="16" y2="4" />
75
- <circle cx="2" cy="14" r="1.5" fill="currentColor" stroke="none" />
76
- <circle cx="16" cy="4" r="1.5" fill="currentColor" stroke="none" />
77
- </svg>
78
- ),
79
- },
80
- {
81
- tool: 'ray',
82
- label: 'Ray',
83
- icon: (
84
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
85
- <line x1="2" y1="13" x2="16" y2="5" />
86
- <circle cx="2" cy="13" r="1.5" fill="currentColor" stroke="none" />
87
- <polygon points="16,5 14,6.5 14.5,8.5" fill="currentColor" stroke="none" />
88
- </svg>
89
- ),
90
- },
91
- {
92
- tool: 'infoLine',
93
- label: 'Info line',
94
- icon: (
95
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
96
- <line x1="1" y1="13" x2="17" y2="5" />
97
- <polygon points="1,13 3,12 2.5,10" fill="currentColor" stroke="none" />
98
- <polygon points="17,5 15,6.5 15.5,8.5" fill="currentColor" stroke="none" />
99
- </svg>
100
- ),
101
- },
102
- {
103
- tool: 'extendedLine',
104
- label: 'Extended line',
105
- icon: (
106
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
107
- <line x1="2" y1="14" x2="16" y2="4" />
108
- <circle cx="2" cy="14" r="1.5" fill="currentColor" stroke="none" />
109
- <polygon points="16,4 14,5.5 14.5,7.5" fill="currentColor" stroke="none" />
110
- </svg>
111
- ),
112
- },
113
- {
114
- tool: 'trendAngle',
115
- label: 'Trend angle',
116
- icon: (
117
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
118
- <line x1="2" y1="14" x2="16" y2="4" />
119
- <path d="M 2 14 A 5 5 0 0 1 7.5 11.8" strokeWidth="1.4" />
120
- <text x="6.5" y="16" fontSize="5.5" fill="currentColor" stroke="none" fontFamily="sans-serif">θ</text>
121
- </svg>
122
- ),
123
- },
124
- {
125
- tool: 'horizontal',
126
- label: 'Horizontal line',
127
- shortcut: 'Alt+H',
128
- icon: (
129
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
130
- <line x1="1" y1="9" x2="17" y2="9" />
131
- </svg>
132
- ),
133
- },
134
- {
135
- tool: 'horizontalRay',
136
- label: 'Horizontal ray',
137
- shortcut: 'Alt+J',
138
- icon: (
139
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
140
- <line x1="3" y1="9" x2="17" y2="9" />
141
- <circle cx="3" cy="9" r="1.5" fill="currentColor" stroke="none" />
142
- <polygon points="17,9 15,7.5 15,10.5" fill="currentColor" stroke="none" />
143
- </svg>
144
- ),
145
- },
146
- {
147
- tool: 'vertical',
148
- label: 'Vertical line',
149
- shortcut: 'Alt+V',
150
- icon: (
151
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
152
- <line x1="9" y1="1" x2="9" y2="17" />
153
- </svg>
154
- ),
155
- },
156
- {
157
- tool: 'crossLine',
158
- label: 'Cross line',
159
- shortcut: 'Alt+C',
160
- icon: (
161
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
162
- <line x1="1" y1="9" x2="17" y2="9" />
163
- <line x1="9" y1="1" x2="9" y2="17" />
164
- </svg>
165
- ),
166
- },
167
- ],
168
- },
169
- {
170
- heading: 'Channels',
171
- items: [
172
- {
173
- tool: 'parallelChannel',
174
- label: 'Parallel channel',
175
- icon: (
176
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
177
- <line x1="2" y1="13" x2="16" y2="7" />
178
- <line x1="2" y1="9" x2="16" y2="3" />
179
- </svg>
180
- ),
181
- },
182
- {
183
- tool: 'regressionTrend',
184
- label: 'Regression trend',
185
- icon: (
186
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
187
- <line x1="2" y1="13" x2="16" y2="5" />
188
- <line x1="2" y1="11" x2="16" y2="3" strokeDasharray="2 2" strokeWidth="1.2" />
189
- <line x1="2" y1="15" x2="16" y2="7" strokeDasharray="2 2" strokeWidth="1.2" />
190
- </svg>
191
- ),
192
- },
193
- {
194
- tool: 'flatTopBottom',
195
- label: 'Flat top/bottom',
196
- icon: (
197
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
198
- <line x1="2" y1="5" x2="16" y2="5" />
199
- <line x1="2" y1="13" x2="16" y2="9" />
200
- </svg>
201
- ),
202
- },
203
- {
204
- tool: 'disjointChannel',
205
- label: 'Disjoint channel',
206
- icon: (
207
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
208
- <line x1="2" y1="12" x2="8" y2="8" />
209
- <line x1="10" y1="10" x2="16" y2="6" />
210
- <line x1="2" y1="15" x2="8" y2="11" strokeDasharray="2 2" strokeWidth="1.2" />
211
- <line x1="10" y1="13" x2="16" y2="9" strokeDasharray="2 2" strokeWidth="1.2" />
212
- </svg>
213
- ),
214
- },
215
- ],
216
- },
217
- {
218
- heading: 'Pitchforks',
219
- items: [
220
- {
221
- tool: 'pitchfork',
222
- label: 'Pitchfork',
223
- icon: (
224
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
225
- <line x1="9" y1="15" x2="9" y2="6" />
226
- <line x1="9" y1="6" x2="4" y2="2" />
227
- <line x1="9" y1="6" x2="14" y2="2" />
228
- <line x1="4" y1="2" x2="14" y2="2" strokeWidth="1" />
229
- </svg>
230
- ),
231
- },
232
- {
233
- tool: 'schiffPitchfork',
234
- label: 'Schiff pitchfork',
235
- icon: (
236
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
237
- <line x1="9" y1="15" x2="9" y2="7" />
238
- <line x1="9" y1="7" x2="3.5" y2="2" />
239
- <line x1="9" y1="7" x2="14.5" y2="2" />
240
- <line x1="3.5" y1="2" x2="14.5" y2="2" strokeWidth="1" />
241
- <circle cx="9" cy="11" r="1" fill="currentColor" stroke="none" />
242
- </svg>
243
- ),
244
- },
245
- {
246
- tool: 'modifiedSchiffPitchfork',
247
- label: 'Modified Schiff pitchfork',
248
- icon: (
249
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
250
- <line x1="9" y1="16" x2="9" y2="8" />
251
- <line x1="9" y1="8" x2="4" y2="2" />
252
- <line x1="9" y1="8" x2="14" y2="2" />
253
- <line x1="4" y1="2" x2="14" y2="2" strokeWidth="1" />
254
- <line x1="6.5" y1="5" x2="11.5" y2="5" strokeWidth="1" strokeDasharray="1.5 1.5" />
255
- </svg>
256
- ),
257
- },
258
- {
259
- tool: 'insidePitchfork',
260
- label: 'Inside pitchfork',
261
- icon: (
262
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.8">
263
- <line x1="9" y1="15" x2="9" y2="9" />
264
- <line x1="4" y1="2" x2="14" y2="2" strokeWidth="1" />
265
- <line x1="9" y1="9" x2="4" y2="2" />
266
- <line x1="9" y1="9" x2="14" y2="2" />
267
- </svg>
268
- ),
269
- },
270
- ],
271
- },
272
- ];
273
-
274
- const LINES_MENU_TOOLS = new Set<DrawingToolType>(
275
- LINES_SECTIONS.flatMap((s) => s.items.map((i) => i.tool as DrawingToolType)),
276
- );
277
-
278
- const ALL_LINES_ITEMS = LINES_SECTIONS.flatMap((s) => s.items);
279
- const LINES_ITEM_MAP = new Map<string, LineItem>(ALL_LINES_ITEMS.map((i) => [i.tool, i]));
280
- const DEFAULT_LINES_TOOL = ALL_LINES_ITEMS[0]?.tool ?? 'trendline';
281
-
282
- // ─── Fibonacci & Gann menu data ───────────────────────────────────────────────
283
-
284
- type FibGannTool =
285
- | 'fibRetracement'
286
- | 'trendBasedFibExtension'
287
- | 'fibChannel'
288
- | 'fibTimeZone'
289
- | 'fibSpeedResistanceFan'
290
- | 'trendBasedFibTime'
291
- | 'fibCircles'
292
- | 'fibSpiral'
293
- | 'fibSpeedResistanceArcs'
294
- | 'fibWedge'
295
- | 'pitchfan'
296
- | 'gannBox'
297
- | 'gannSquareFixed'
298
- | 'gannSquare'
299
- | 'gannFan';
300
-
301
- interface FibGannItem {
302
- tool: FibGannTool;
303
- label: string;
304
- shortcut?: string;
305
- icon: React.ReactNode;
306
- }
307
-
308
- interface FibGannSection {
309
- heading: string;
310
- items: FibGannItem[];
311
- }
312
-
313
- const FIB_GANN_SECTIONS: FibGannSection[] = [
314
- {
315
- heading: 'Fibonacci',
316
- items: [
317
- {
318
- tool: 'fibRetracement',
319
- label: 'Fib retracement',
320
- shortcut: 'Alt+F',
321
- icon: (
322
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.5">
323
- <line x1="2" y1="3" x2="16" y2="3" />
324
- <line x1="2" y1="6" x2="16" y2="6" />
325
- <line x1="2" y1="9" x2="16" y2="9" />
326
- <line x1="2" y1="12" x2="16" y2="12" />
327
- <line x1="2" y1="15" x2="16" y2="15" />
328
- </svg>
329
- ),
330
- },
331
- {
332
- tool: 'trendBasedFibExtension',
333
- label: 'Trend-based fib extension',
334
- icon: (
335
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.5">
336
- <line x1="2" y1="14" x2="10" y2="6" />
337
- <line x1="10" y1="6" x2="16" y2="3" strokeDasharray="2 2" strokeWidth="1.2" />
338
- <line x1="10" y1="9" x2="16" y2="9" strokeWidth="1" />
339
- <line x1="10" y1="12" x2="16" y2="12" strokeWidth="1" />
340
- <line x1="10" y1="14" x2="16" y2="14" strokeWidth="1" />
341
- <circle cx="2" cy="14" r="1.2" fill="currentColor" stroke="none" />
342
- <circle cx="10" cy="6" r="1.2" fill="currentColor" stroke="none" />
343
- </svg>
344
- ),
345
- },
346
- {
347
- tool: 'fibChannel',
348
- label: 'Fib channel',
349
- icon: (
350
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.5">
351
- <line x1="2" y1="14" x2="16" y2="6" />
352
- <line x1="2" y1="11" x2="16" y2="3" strokeWidth="1" />
353
- <line x1="2" y1="12.5" x2="16" y2="4.5" strokeWidth="0.8" strokeDasharray="2 2" />
354
- <line x1="2" y1="9" x2="16" y2="1" strokeWidth="0.8" strokeDasharray="2 2" />
355
- </svg>
356
- ),
357
- },
358
- {
359
- tool: 'fibTimeZone',
360
- label: 'Fib time zone',
361
- icon: (
362
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.5">
363
- <line x1="3" y1="2" x2="3" y2="16" />
364
- <line x1="6" y1="2" x2="6" y2="16" strokeWidth="1" />
365
- <line x1="10" y1="2" x2="10" y2="16" strokeWidth="1" />
366
- <line x1="15" y1="2" x2="15" y2="16" strokeWidth="1" />
367
- </svg>
368
- ),
369
- },
370
- {
371
- tool: 'fibSpeedResistanceFan',
372
- label: 'Fib speed resistance fan',
373
- icon: (
374
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.5">
375
- <line x1="2" y1="15" x2="16" y2="2" />
376
- <line x1="2" y1="15" x2="16" y2="6" strokeWidth="1" />
377
- <line x1="2" y1="15" x2="16" y2="10" strokeWidth="1" />
378
- <circle cx="2" cy="15" r="1.2" fill="currentColor" stroke="none" />
379
- </svg>
380
- ),
381
- },
382
- {
383
- tool: 'trendBasedFibTime',
384
- label: 'Trend-based fib time',
385
- icon: (
386
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.5">
387
- <line x1="2" y1="13" x2="9" y2="5" />
388
- <line x1="9" y1="2" x2="9" y2="16" strokeWidth="1" />
389
- <line x1="12" y1="2" x2="12" y2="16" strokeWidth="0.8" />
390
- <line x1="15" y1="2" x2="15" y2="16" strokeWidth="0.8" />
391
- </svg>
392
- ),
393
- },
394
- {
395
- tool: 'fibCircles',
396
- label: 'Fib circles',
397
- icon: (
398
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.5">
399
- <circle cx="5" cy="13" r="2" />
400
- <circle cx="5" cy="13" r="4.5" strokeWidth="1" />
401
- <circle cx="5" cy="13" r="7.5" strokeWidth="1" />
402
- <circle cx="5" cy="13" r="1" fill="currentColor" stroke="none" />
403
- </svg>
404
- ),
405
- },
406
- {
407
- tool: 'fibSpiral',
408
- label: 'Fib spiral',
409
- icon: (
410
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.5">
411
- <path d="M 9 9 Q 9 14 14 14 Q 14 4 4 4 Q 4 16 16 16" />
412
- <circle cx="9" cy="9" r="1" fill="currentColor" stroke="none" />
413
- </svg>
414
- ),
415
- },
416
- {
417
- tool: 'fibSpeedResistanceArcs',
418
- label: 'Fib speed resistance arcs',
419
- icon: (
420
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.5">
421
- <path d="M 2 15 A 4 4 0 0 1 6 11" />
422
- <path d="M 2 15 A 8 8 0 0 1 10 7" strokeWidth="1" />
423
- <path d="M 2 15 A 13 13 0 0 1 15 2" strokeWidth="1" />
424
- <circle cx="2" cy="15" r="1.2" fill="currentColor" stroke="none" />
425
- </svg>
426
- ),
427
- },
428
- {
429
- tool: 'fibWedge',
430
- label: 'Fib wedge',
431
- icon: (
432
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.5">
433
- <line x1="2" y1="15" x2="16" y2="3" />
434
- <line x1="2" y1="15" x2="16" y2="8" />
435
- <line x1="2" y1="15" x2="16" y2="12" strokeWidth="1" />
436
- <circle cx="2" cy="15" r="1.2" fill="currentColor" stroke="none" />
437
- </svg>
438
- ),
439
- },
440
- {
441
- tool: 'pitchfan',
442
- label: 'Pitchfan',
443
- icon: (
444
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.5">
445
- <line x1="2" y1="15" x2="16" y2="3" />
446
- <line x1="2" y1="15" x2="16" y2="9" strokeWidth="1" />
447
- <line x1="2" y1="15" x2="16" y2="15" strokeWidth="1" />
448
- <line x1="8" y1="3" x2="8" y2="15" strokeWidth="0.8" strokeDasharray="2 2" />
449
- <circle cx="2" cy="15" r="1.2" fill="currentColor" stroke="none" />
450
- </svg>
451
- ),
452
- },
453
- ],
454
- },
455
- {
456
- heading: 'Gann',
457
- items: [
458
- {
459
- tool: 'gannBox',
460
- label: 'Gann box',
461
- icon: (
462
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.5">
463
- <rect x="2" y="3" width="14" height="12" />
464
- <line x1="2" y1="3" x2="16" y2="15" strokeWidth="1" />
465
- <line x1="2" y1="15" x2="16" y2="3" strokeWidth="1" />
466
- </svg>
467
- ),
468
- },
469
- {
470
- tool: 'gannSquareFixed',
471
- label: 'Gann square fixed',
472
- icon: (
473
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.5">
474
- <rect x="3" y="3" width="12" height="12" />
475
- <line x1="3" y1="9" x2="15" y2="9" strokeWidth="0.8" />
476
- <line x1="9" y1="3" x2="9" y2="15" strokeWidth="0.8" />
477
- <circle cx="9" cy="9" r="1.2" fill="currentColor" stroke="none" />
478
- </svg>
479
- ),
480
- },
481
- {
482
- tool: 'gannSquare',
483
- label: 'Gann square',
484
- icon: (
485
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.5">
486
- <rect x="3" y="3" width="12" height="12" />
487
- <line x1="3" y1="3" x2="15" y2="15" strokeWidth="1" />
488
- <line x1="9" y1="3" x2="9" y2="15" strokeWidth="0.8" />
489
- <line x1="3" y1="9" x2="15" y2="9" strokeWidth="0.8" />
490
- </svg>
491
- ),
492
- },
493
- {
494
- tool: 'gannFan',
495
- label: 'Gann fan',
496
- icon: (
497
- <svg viewBox="0 0 18 18" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="1.5">
498
- <line x1="2" y1="16" x2="16" y2="2" />
499
- <line x1="2" y1="16" x2="16" y2="6" strokeWidth="1" />
500
- <line x1="2" y1="16" x2="16" y2="10" strokeWidth="1" />
501
- <line x1="2" y1="16" x2="16" y2="16" strokeWidth="0.8" />
502
- <line x1="2" y1="16" x2="6" y2="2" strokeWidth="1" />
503
- <circle cx="2" cy="16" r="1.2" fill="currentColor" stroke="none" />
504
- </svg>
505
- ),
506
- },
507
- ],
508
- },
509
- ];
510
-
511
- const FIB_GANN_TOOLS = new Set<DrawingToolType>(
512
- FIB_GANN_SECTIONS.flatMap((s) => s.items.map((i) => i.tool as DrawingToolType)),
513
- );
514
-
515
- const FIB_GANN_ITEM_MAP = new Map<DrawingToolType, FibGannItem>(
516
- FIB_GANN_SECTIONS.flatMap((s) => s.items.map((i) => [i.tool as DrawingToolType, i])),
517
- );
518
-
519
- // ─── Other tools ──────────────────────────────────────────────────────────────
520
-
521
- type OtherTool = 'rectangle' | 'text';
522
-
523
- const OTHER_ICONS: Record<OtherTool, React.ReactNode> = {
524
- rectangle: (
525
- <svg viewBox="0 0 16 16" width="15" height="15" stroke="currentColor" fill="none" strokeWidth="2">
526
- <rect x="2" y="4" width="12" height="8" />
527
- </svg>
528
- ),
529
- text: (
530
- <svg viewBox="0 0 16 16" width="15" height="15" fill="currentColor">
531
- <text x="3" y="13" fontSize="13" fontFamily="serif" fontWeight="bold">T</text>
532
- </svg>
533
- ),
534
- };
535
-
536
- const OTHER_LABELS: Record<OtherTool, string> = {
537
- rectangle: 'Rectangle',
538
- text: 'Text',
539
- };
540
-
541
- const OTHER_TOOL_ORDER: OtherTool[] = ['rectangle', 'text'];
542
-
543
- // ─── Unified drawing-tool item map (Lines + FibGann + Other) ─────────────────
544
- // Used by the floating favorites toolbar to look up icons/labels for any tool.
545
-
546
- const ALL_DRAWING_ITEM_MAP = new Map<DrawingToolType, { label: string; icon: React.ReactNode }>([
547
- ...ALL_LINES_ITEMS.map((i) => [i.tool as DrawingToolType, i] as [DrawingToolType, { label: string; icon: React.ReactNode }]),
548
- ...FIB_GANN_SECTIONS.flatMap((s) => s.items).map((i) => [i.tool as DrawingToolType, i] as [DrawingToolType, { label: string; icon: React.ReactNode }]),
549
- ...OTHER_TOOL_ORDER.map((t) => [t as DrawingToolType, { label: OTHER_LABELS[t], icon: OTHER_ICONS[t] }] as [DrawingToolType, { label: string; icon: React.ReactNode }]),
550
- ]);
551
-
552
- // ─── Star icon ────────────────────────────────────────────────────────────────
553
-
554
- function StarIcon({ filled }: { filled: boolean }): React.ReactElement {
555
- return (
556
- <svg
557
- viewBox="0 0 16 16"
558
- width="13"
559
- height="13"
560
- fill={filled ? '#f5a623' : 'none'}
561
- stroke={filled ? '#f5a623' : 'currentColor'}
562
- strokeWidth="1.4"
563
- strokeLinecap="round"
564
- strokeLinejoin="round"
565
- >
566
- <path d="M8 1.5l1.8 3.6 4 .58-2.9 2.83.68 3.99L8 10.35l-3.58 1.88.68-3.99L2.2 5.68l4-.58z" />
567
- </svg>
568
- );
569
- }
570
-
571
- // ─── Pointer group ────────────────────────────────────────────────────────────
572
-
573
- function PointerGroup({
574
- activeTool,
575
- onSelectTool,
576
- }: {
577
- activeTool: DrawingToolType;
578
- onSelectTool: (tool: DrawingToolType) => void;
579
- }): React.ReactElement {
580
- const [flyoutOpen, setFlyoutOpen] = useState(false);
581
- const groupRef = useRef<HTMLDivElement>(null);
582
-
583
- const activePointer: PointerToolType = (POINTER_TOOLS as string[]).includes(activeTool)
584
- ? (activeTool as PointerToolType)
585
- : 'cursor';
586
- const isPointerActive = (POINTER_TOOLS as string[]).includes(activeTool);
587
-
588
- useEffect(() => {
589
- if (!flyoutOpen) return;
590
- const handler = (e: MouseEvent) => {
591
- if (groupRef.current && !groupRef.current.contains(e.target as Node)) setFlyoutOpen(false);
592
- };
593
- document.addEventListener('mousedown', handler);
594
- return () => document.removeEventListener('mousedown', handler);
595
- }, [flyoutOpen]);
596
-
597
- return (
598
- <div ref={groupRef} className="dt-pointer-group">
599
- <button
600
- className={`drawing-tool-btn dt-pointer-main${isPointerActive ? ' is-active' : ''}`}
601
- title={POINTER_LABELS[activePointer]}
602
- onClick={() => setFlyoutOpen((o) => !o)}
603
- >
604
- {POINTER_ICONS[activePointer]}
605
- </button>
606
- <button
607
- className={`dt-pointer-expand${flyoutOpen ? ' is-open' : ''}`}
608
- title="Pointer tools"
609
- onClick={(e) => { e.stopPropagation(); setFlyoutOpen((o) => !o); }}
610
- >
611
- <svg viewBox="0 0 6 10" width="5" height="8" fill="currentColor">
612
- <path d="M1 1l4 4-4 4" stroke="currentColor" strokeWidth="1.4" fill="none" strokeLinecap="round" strokeLinejoin="round" />
613
- </svg>
614
- </button>
615
- {flyoutOpen && (
616
- <div className="dt-pointer-flyout">
617
- <div className="dt-flyout-label">Pointer</div>
618
- {POINTER_TOOLS.map((tool) => (
619
- <button
620
- key={tool}
621
- className={`dt-flyout-item${activeTool === tool ? ' is-active' : ''}`}
622
- onClick={() => { onSelectTool(tool); setFlyoutOpen(false); }}
623
- >
624
- <span className="dt-flyout-icon">{POINTER_ICONS[tool]}</span>
625
- <span className="dt-flyout-name">{POINTER_LABELS[tool]}</span>
626
- {activeTool === tool && <span className="dt-flyout-check">✓</span>}
627
- </button>
628
- ))}
629
- </div>
630
- )}
631
- </div>
632
- );
633
- }
634
-
635
- // ─── Lines group ──────────────────────────────────────────────────────────────
636
-
637
- function LinesGroup({
638
- activeTool,
639
- favorites,
640
- onSelectTool,
641
- onFavoritesChange,
642
- }: {
643
- activeTool: DrawingToolType;
644
- favorites: DrawingToolType[];
645
- onSelectTool: (tool: DrawingToolType) => void;
646
- onFavoritesChange: (favs: DrawingToolType[]) => void;
647
- }): React.ReactElement {
648
- const [panelOpen, setPanelOpen] = useState(false);
649
- const groupRef = useRef<HTMLDivElement>(null);
650
- const isLinesActive = LINES_MENU_TOOLS.has(activeTool);
651
- const [lastTool, setLastTool] = useState<string>(DEFAULT_LINES_TOOL);
652
-
653
- const currentItem = (isLinesActive
654
- ? LINES_ITEM_MAP.get(activeTool as string)
655
- : LINES_ITEM_MAP.get(lastTool)) ?? LINES_ITEM_MAP.get(DEFAULT_LINES_TOOL)!;
656
-
657
- useEffect(() => {
658
- if (!panelOpen) return;
659
- const handler = (e: MouseEvent) => {
660
- if (groupRef.current && !groupRef.current.contains(e.target as Node)) setPanelOpen(false);
661
- };
662
- document.addEventListener('mousedown', handler);
663
- return () => document.removeEventListener('mousedown', handler);
664
- }, [panelOpen]);
665
-
666
- const toggleFavorite = (tool: DrawingToolType, e: React.MouseEvent) => {
667
- e.stopPropagation();
668
- const next = favorites.includes(tool)
669
- ? favorites.filter((f) => f !== tool)
670
- : [...favorites, tool];
671
- onFavoritesChange(next);
672
- };
673
-
674
- return (
675
- <div ref={groupRef} className="dt-lines-group">
676
- <button
677
- className={`drawing-tool-btn dt-lines-main${isLinesActive ? ' is-active' : ''}`}
678
- title={currentItem.label}
679
- onClick={() => setPanelOpen((o) => !o)}
680
- >
681
- {currentItem.icon}
682
- </button>
683
- <button
684
- className={`dt-pointer-expand${panelOpen ? ' is-open' : ''}`}
685
- title="Lines tools"
686
- onClick={(e) => { e.stopPropagation(); setPanelOpen((o) => !o); }}
687
- >
688
- <svg viewBox="0 0 6 10" width="5" height="8" fill="currentColor">
689
- <path d="M1 1l4 4-4 4" stroke="currentColor" strokeWidth="1.4" fill="none" strokeLinecap="round" strokeLinejoin="round" />
690
- </svg>
691
- </button>
692
- {panelOpen && (
693
- <div className="dt-lines-panel">
694
- {LINES_SECTIONS.map((section) => (
695
- <div key={section.heading} className="dt-lines-section">
696
- <div className="dt-lines-heading">{section.heading.toUpperCase()}</div>
697
- {section.items.map((item) => {
698
- const isFav = favorites.includes(item.tool as DrawingToolType);
699
- return (
700
- <button
701
- key={item.tool}
702
- className={`dt-lines-item dt-fibgann-item${activeTool === (item.tool as DrawingToolType) ? ' is-active' : ''}`}
703
- onClick={() => { setLastTool(item.tool); onSelectTool(item.tool as DrawingToolType); setPanelOpen(false); }}
704
- >
705
- <span className="dt-lines-icon">{item.icon}</span>
706
- <span className="dt-lines-name">{item.label}</span>
707
- {item.shortcut && <span className="dt-lines-shortcut">{item.shortcut}</span>}
708
- <button
709
- className={`dt-star-btn${isFav ? ' is-starred' : ''}`}
710
- title={isFav ? 'Remove from favorites' : 'Add to favorites'}
711
- onClick={(e) => toggleFavorite(item.tool as DrawingToolType, e)}
712
- >
713
- <StarIcon filled={isFav} />
714
- </button>
715
- </button>
716
- );
717
- })}
718
- </div>
719
- ))}
720
- </div>
721
- )}
722
- </div>
723
- );
724
- }
725
-
726
- // ─── FibGann group ────────────────────────────────────────────────────────────
727
-
728
- function FibGannGroup({
729
- activeTool,
730
- favorites,
731
- onSelectTool,
732
- onFavoritesChange,
733
- }: {
734
- activeTool: DrawingToolType;
735
- favorites: DrawingToolType[];
736
- onSelectTool: (tool: DrawingToolType) => void;
737
- onFavoritesChange: (favs: DrawingToolType[]) => void;
738
- }): React.ReactElement {
739
- const [panelOpen, setPanelOpen] = useState(false);
740
- const groupRef = useRef<HTMLDivElement>(null);
741
- const isFibGannActive = FIB_GANN_TOOLS.has(activeTool);
742
- const [lastTool, setLastTool] = useState<DrawingToolType>('fibRetracement');
743
-
744
- const currentItem = (isFibGannActive
745
- ? FIB_GANN_ITEM_MAP.get(activeTool)
746
- : FIB_GANN_ITEM_MAP.get(lastTool)) ?? FIB_GANN_ITEM_MAP.get('fibRetracement')!;
747
-
748
- useEffect(() => {
749
- if (!panelOpen) return;
750
- const handler = (e: MouseEvent) => {
751
- if (groupRef.current && !groupRef.current.contains(e.target as Node)) setPanelOpen(false);
752
- };
753
- document.addEventListener('mousedown', handler);
754
- return () => document.removeEventListener('mousedown', handler);
755
- }, [panelOpen]);
756
-
757
- const toggleFavorite = (tool: DrawingToolType, e: React.MouseEvent) => {
758
- e.stopPropagation();
759
- const next = favorites.includes(tool)
760
- ? favorites.filter((f) => f !== tool)
761
- : [...favorites, tool];
762
- onFavoritesChange(next);
763
- };
764
-
765
- return (
766
- <div ref={groupRef} className="dt-lines-group">
767
- <button
768
- className={`drawing-tool-btn dt-lines-main${isFibGannActive ? ' is-active' : ''}`}
769
- title={currentItem.label}
770
- onClick={() => setPanelOpen((o) => !o)}
771
- >
772
- {currentItem.icon}
773
- </button>
774
- <button
775
- className={`dt-pointer-expand${panelOpen ? ' is-open' : ''}`}
776
- title="Fibonacci & Gann tools"
777
- onClick={(e) => { e.stopPropagation(); setPanelOpen((o) => !o); }}
778
- >
779
- <svg viewBox="0 0 6 10" width="5" height="8" fill="currentColor">
780
- <path d="M1 1l4 4-4 4" stroke="currentColor" strokeWidth="1.4" fill="none" strokeLinecap="round" strokeLinejoin="round" />
781
- </svg>
782
- </button>
783
- {panelOpen && (
784
- <div className="dt-lines-panel dt-fibgann-panel">
785
- {FIB_GANN_SECTIONS.map((section) => (
786
- <div key={section.heading} className="dt-lines-section">
787
- <div className="dt-lines-heading">{section.heading.toUpperCase()}</div>
788
- {section.items.map((item) => {
789
- const isFav = favorites.includes(item.tool as DrawingToolType);
790
- return (
791
- <button
792
- key={item.tool}
793
- className={`dt-lines-item dt-fibgann-item${activeTool === (item.tool as DrawingToolType) ? ' is-active' : ''}`}
794
- onClick={() => { setLastTool(item.tool as DrawingToolType); onSelectTool(item.tool as DrawingToolType); setPanelOpen(false); }}
795
- >
796
- <span className="dt-lines-icon">{item.icon}</span>
797
- <span className="dt-lines-name">{item.label}</span>
798
- {item.shortcut && <span className="dt-lines-shortcut">{item.shortcut}</span>}
799
- <button
800
- className={`dt-star-btn${isFav ? ' is-starred' : ''}`}
801
- title={isFav ? 'Remove from favorites' : 'Add to favorites'}
802
- onClick={(e) => toggleFavorite(item.tool as DrawingToolType, e)}
803
- >
804
- <StarIcon filled={isFav} />
805
- </button>
806
- </button>
807
- );
808
- })}
809
- </div>
810
- ))}
811
- </div>
812
- )}
813
- </div>
814
- );
815
- }
816
-
817
- // ─── Favorites floating toolbar ───────────────────────────────────────────────
818
-
819
- function FavoritesFloatingToolbar({
820
- favorites,
821
- activeTool,
822
- onSelectTool,
823
- }: {
824
- favorites: DrawingToolType[];
825
- activeTool: DrawingToolType;
826
- onSelectTool: (tool: DrawingToolType) => void;
827
- }): React.ReactElement | null {
828
- const [pos, setPos] = useState({ x: 60, y: 60 });
829
- const [dragging, setDragging] = useState(false);
830
- const dragOffset = useRef({ x: 0, y: 0 });
831
-
832
- useEffect(() => {
833
- if (!dragging) return;
834
- const onMove = (e: MouseEvent) => {
835
- setPos({ x: e.clientX - dragOffset.current.x, y: e.clientY - dragOffset.current.y });
836
- };
837
- const onUp = () => setDragging(false);
838
- window.addEventListener('mousemove', onMove);
839
- window.addEventListener('mouseup', onUp);
840
- return () => {
841
- window.removeEventListener('mousemove', onMove);
842
- window.removeEventListener('mouseup', onUp);
843
- };
844
- }, [dragging]);
845
-
846
- const validFavs = favorites.filter((f) => ALL_DRAWING_ITEM_MAP.has(f));
847
- if (validFavs.length === 0) return null;
848
-
849
- return ReactDOM.createPortal(
850
- <div className="dt-favorites-toolbar" style={{ left: pos.x, top: pos.y }}>
851
- <div
852
- className="dt-favorites-handle"
853
- title="Drag to reposition"
854
- onMouseDown={(e) => {
855
- dragOffset.current = { x: e.clientX - pos.x, y: e.clientY - pos.y };
856
- setDragging(true);
857
- e.preventDefault();
858
- }}
859
- >
860
- <svg viewBox="0 0 6 12" width="4" height="10" fill="currentColor" opacity="0.5">
861
- <circle cx="1.5" cy="2" r="1.2" />
862
- <circle cx="1.5" cy="6" r="1.2" />
863
- <circle cx="1.5" cy="10" r="1.2" />
864
- <circle cx="4.5" cy="2" r="1.2" />
865
- <circle cx="4.5" cy="6" r="1.2" />
866
- <circle cx="4.5" cy="10" r="1.2" />
867
- </svg>
868
- </div>
869
- {validFavs.map((tool) => {
870
- const item = ALL_DRAWING_ITEM_MAP.get(tool)!;
871
- return (
872
- <button
873
- key={tool}
874
- className={`drawing-tool-btn dt-fav-btn${activeTool === tool ? ' is-active' : ''}`}
875
- title={item.label}
876
- onClick={() => onSelectTool(tool)}
877
- >
878
- {item.icon}
879
- </button>
880
- );
881
- })}
882
- </div>,
883
- document.body,
884
- );
885
- }
886
-
887
- // ─── Utility tools ────────────────────────────────────────────────────────────
888
-
889
- export type VisibilityAction = 'hideDrawings' | 'hideIndicators' | 'hidePositions' | 'hideAll';
890
-
891
- // Reusable expand chevron SVG
892
- const ExpandChevron = () => (
893
- <svg viewBox="0 0 6 10" width="5" height="8" fill="currentColor">
894
- <path d="M1 1l4 4-4 4" stroke="currentColor" strokeWidth="1.4" fill="none" strokeLinecap="round" strokeLinejoin="round" />
895
- </svg>
896
- );
897
-
898
- // ─── Visibility tool ──────────────────────────────────────────────────────────
899
-
900
- function VisibilityTool({
901
- onAction,
902
- activeAction,
903
- onDeactivate,
904
- }: {
905
- onAction?: (action: VisibilityAction) => void;
906
- activeAction?: VisibilityAction | null;
907
- onDeactivate?: () => void;
908
- }): React.ReactElement {
909
- const [flyoutOpen, setFlyoutOpen] = useState(false);
910
- const groupRef = useRef<HTMLDivElement>(null);
911
-
912
- useEffect(() => {
913
- if (!flyoutOpen) return;
914
- const handler = (e: MouseEvent) => {
915
- if (groupRef.current && !groupRef.current.contains(e.target as Node)) setFlyoutOpen(false);
916
- };
917
- document.addEventListener('mousedown', handler);
918
- return () => document.removeEventListener('mousedown', handler);
919
- }, [flyoutOpen]);
920
-
921
- const VISIBILITY_ITEMS: { action: VisibilityAction; label: string }[] = [
922
- { action: 'hideDrawings', label: 'Hide drawings' },
923
- { action: 'hideIndicators', label: 'Hide indicators' },
924
- { action: 'hidePositions', label: 'Hide positions and orders' },
925
- { action: 'hideAll', label: 'Hide all' },
926
- ];
927
-
928
- return (
929
- <div ref={groupRef} className="dt-pointer-group">
930
- <button
931
- className={`drawing-tool-btn dt-pointer-main${activeAction ? ' dt-vis-active' : ''}`}
932
- title={activeAction ? 'Restore visibility' : 'Visibility'}
933
- onClick={() => {
934
- if (activeAction) {
935
- onDeactivate?.();
936
- } else {
937
- setFlyoutOpen((o) => !o);
938
- }
939
- }}
940
- >
941
- {/* Eye with strikethrough */}
942
- <svg viewBox="0 0 16 16" width="15" height="15" stroke="currentColor" fill="none" strokeWidth="1.6" strokeLinecap="round">
943
- <path d="M1 8 Q4 3 8 3 Q12 3 15 8 Q12 13 8 13 Q4 13 1 8" />
944
- <circle cx="8" cy="8" r="2.2" />
945
- <line x1="2.5" y1="13.5" x2="13.5" y2="2.5" strokeWidth="1.5" />
946
- </svg>
947
- </button>
948
- <button
949
- className={`dt-pointer-expand${flyoutOpen ? ' is-open' : ''}`}
950
- title="Visibility options"
951
- onClick={(e) => { e.stopPropagation(); setFlyoutOpen((o) => !o); }}
952
- >
953
- <ExpandChevron />
954
- </button>
955
- {flyoutOpen && (
956
- <div className="dt-pointer-flyout">
957
- {VISIBILITY_ITEMS.map(({ action, label }) => (
958
- <button
959
- key={action}
960
- className={`dt-flyout-item${activeAction === action ? ' is-active' : ''}`}
961
- onClick={() => { onAction?.(action); setFlyoutOpen(false); }}
962
- >
963
- <span className="dt-flyout-name">{label}</span>
964
- {activeAction === action && <span className="dt-flyout-check">✓</span>}
965
- </button>
966
- ))}
967
- </div>
968
- )}
969
- </div>
970
- );
971
- }
972
-
973
- // ─── LeftToolbar ──────────────────────────────────────────────────────────────
974
-
975
- type Props = {
976
- activeTool: DrawingToolType;
977
- onSelectTool: (tool: DrawingToolType) => void;
978
- /** Current drawing-tool favorites, controlled by the parent. */
979
- drawingFavorites?: DrawingToolType[];
980
- /** Called when the user stars/unstars a drawing tool. */
981
- onDrawingFavoritesChange?: (favs: DrawingToolType[]) => void;
982
- onVisibilityAction?: (action: VisibilityAction) => void;
983
- visibilityActiveAction?: VisibilityAction | null;
984
- onVisibilityDeactivate?: () => void;
985
- onLinkClick?: () => void;
986
- onDeleteClick?: () => void;
987
- };
988
-
989
- export function LeftToolbar({ activeTool, onSelectTool, drawingFavorites, onDrawingFavoritesChange, onVisibilityAction, visibilityActiveAction, onVisibilityDeactivate, onLinkClick, onDeleteClick }: Props): React.ReactElement {
990
- const [favorites, setFavorites] = useState<DrawingToolType[]>(drawingFavorites ?? []);
991
-
992
- const handleFavoritesChange = (favs: DrawingToolType[]) => {
993
- setFavorites(favs);
994
- onDrawingFavoritesChange?.(favs);
995
- };
996
-
997
- return (
998
- <>
999
- <div
1000
- style={{
1001
- display: 'flex',
1002
- flexDirection: 'column',
1003
- alignItems: 'center',
1004
- gap: 2,
1005
- padding: '6px 4px',
1006
- background: 'var(--toolbar-bg)',
1007
- borderRadius: 8,
1008
- width: 40,
1009
- flexShrink: 0,
1010
- userSelect: 'none',
1011
- }}
1012
- >
1013
- <PointerGroup activeTool={activeTool} onSelectTool={onSelectTool} />
1014
-
1015
- <LinesGroup
1016
- activeTool={activeTool}
1017
- favorites={favorites}
1018
- onSelectTool={onSelectTool}
1019
- onFavoritesChange={handleFavoritesChange}
1020
- />
1021
-
1022
- <FibGannGroup
1023
- activeTool={activeTool}
1024
- favorites={favorites}
1025
- onSelectTool={onSelectTool}
1026
- onFavoritesChange={handleFavoritesChange}
1027
- />
1028
-
1029
- {OTHER_TOOL_ORDER.map((tool) => {
1030
- const isFav = favorites.includes(tool as DrawingToolType);
1031
- return (
1032
- <div key={tool} className="dt-other-tool-wrap">
1033
- <button
1034
- title={OTHER_LABELS[tool]}
1035
- onClick={() => onSelectTool(tool as DrawingType)}
1036
- className={`drawing-tool-btn${activeTool === tool ? ' is-active' : ''}`}
1037
- >
1038
- {OTHER_ICONS[tool]}
1039
- </button>
1040
- <button
1041
- className={`dt-star-btn dt-other-star${isFav ? ' is-starred' : ''}`}
1042
- title={isFav ? 'Remove from favorites' : 'Add to favorites'}
1043
- onClick={() => handleFavoritesChange(
1044
- isFav
1045
- ? favorites.filter((f) => f !== (tool as DrawingToolType))
1046
- : [...favorites, tool as DrawingToolType]
1047
- )}
1048
- >
1049
- <StarIcon filled={isFav} />
1050
- </button>
1051
- </div>
1052
- );
1053
- })}
1054
-
1055
- <VisibilityTool
1056
- {...(onVisibilityAction ? { onAction: onVisibilityAction } : {})}
1057
- activeAction={visibilityActiveAction ?? null}
1058
- {...(onVisibilityDeactivate ? { onDeactivate: onVisibilityDeactivate } : {})}
1059
- />
1060
-
1061
- {/* Link / sync */}
1062
- <button
1063
- className="drawing-tool-btn"
1064
- title="Link chart"
1065
- onClick={onLinkClick}
1066
- >
1067
- <svg viewBox="0 0 16 16" width="15" height="15" stroke="currentColor" fill="none" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round">
1068
- <path d="M7 9 A3.5 3.5 0 0 0 9.5 5.5 L11 4 A2.5 2.5 0 1 1 14.5 7.5 L13 9 A3.5 3.5 0 0 1 9.5 10.5" />
1069
- <path d="M9 7 A3.5 3.5 0 0 0 6.5 10.5 L5 12 A2.5 2.5 0 1 1 1.5 8.5 L3 7 A3.5 3.5 0 0 1 6.5 5.5" />
1070
- </svg>
1071
- </button>
1072
-
1073
- {/* Delete / trash */}
1074
- <button
1075
- className="drawing-tool-btn"
1076
- title="Remove selected drawing"
1077
- onClick={onDeleteClick}
1078
- >
1079
- <svg viewBox="0 0 16 16" width="15" height="15" stroke="currentColor" fill="none" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round">
1080
- <line x1="2.5" y1="4" x2="13.5" y2="4" />
1081
- <path d="M5.5 4 V13 A1 1 0 0 0 6.5 14 H9.5 A1 1 0 0 0 10.5 13 V4" />
1082
- <line x1="6" y1="2" x2="10" y2="2" />
1083
- <line x1="7" y1="6.5" x2="7" y2="11.5" />
1084
- <line x1="9" y1="6.5" x2="9" y2="11.5" />
1085
- </svg>
1086
- </button>
1087
- </div>
1088
-
1089
- <FavoritesFloatingToolbar
1090
- favorites={favorites}
1091
- activeTool={activeTool}
1092
- onSelectTool={onSelectTool}
1093
- />
1094
- </>
1095
- );
1096
- }