@forgecharts/sdk 1.1.27 → 1.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (581) 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__/backwardCompatibility.test.js +159 -0
  4. package/dist/__tests__/backwardCompatibility.test.js.map +1 -0
  5. package/dist/__tests__/candleInvariant.test.d.ts +20 -0
  6. package/dist/__tests__/candleInvariant.test.d.ts.map +1 -0
  7. package/dist/__tests__/candleInvariant.test.js +415 -0
  8. package/dist/__tests__/candleInvariant.test.js.map +1 -0
  9. package/dist/__tests__/public-api-surface.d.ts +13 -0
  10. package/dist/__tests__/public-api-surface.d.ts.map +1 -0
  11. package/{src/__tests__/public-api-surface.ts → dist/__tests__/public-api-surface.js} +4 -42
  12. package/dist/__tests__/public-api-surface.js.map +1 -0
  13. package/dist/__tests__/timeframeBoundary.test.d.ts +17 -0
  14. package/dist/__tests__/timeframeBoundary.test.d.ts.map +1 -0
  15. package/dist/__tests__/timeframeBoundary.test.js +452 -0
  16. package/dist/__tests__/timeframeBoundary.test.js.map +1 -0
  17. package/dist/api/DrawingManager.d.ts +20 -0
  18. package/dist/api/DrawingManager.d.ts.map +1 -0
  19. package/dist/api/DrawingManager.js +190 -0
  20. package/dist/api/DrawingManager.js.map +1 -0
  21. package/dist/api/EventBus.d.ts +19 -0
  22. package/dist/api/EventBus.d.ts.map +1 -0
  23. package/dist/api/EventBus.js +44 -0
  24. package/dist/api/EventBus.js.map +1 -0
  25. package/dist/api/IndicatorDAG.d.ts +85 -0
  26. package/dist/api/IndicatorDAG.d.ts.map +1 -0
  27. package/dist/api/IndicatorDAG.js +316 -0
  28. package/dist/api/IndicatorDAG.js.map +1 -0
  29. package/dist/api/IndicatorRegistry.d.ts +22 -0
  30. package/dist/api/IndicatorRegistry.d.ts.map +1 -0
  31. package/dist/api/IndicatorRegistry.js +39 -0
  32. package/dist/api/IndicatorRegistry.js.map +1 -0
  33. package/dist/api/LayoutManager.d.ts +30 -0
  34. package/dist/api/LayoutManager.d.ts.map +1 -0
  35. package/dist/api/LayoutManager.js +51 -0
  36. package/dist/api/LayoutManager.js.map +1 -0
  37. package/dist/api/PaneManager.d.ts +42 -0
  38. package/dist/api/PaneManager.d.ts.map +1 -0
  39. package/dist/api/PaneManager.js +119 -0
  40. package/dist/api/PaneManager.js.map +1 -0
  41. package/dist/api/ReferenceAPI.d.ts +78 -0
  42. package/dist/api/ReferenceAPI.d.ts.map +1 -0
  43. package/dist/api/ReferenceAPI.js +153 -0
  44. package/dist/api/ReferenceAPI.js.map +1 -0
  45. package/dist/api/TChart.d.ts +345 -0
  46. package/dist/api/TChart.d.ts.map +1 -0
  47. package/dist/api/TChart.js +765 -0
  48. package/dist/api/TChart.js.map +1 -0
  49. package/{src/api/createChart.ts → dist/api/createChart.d.ts} +2 -7
  50. package/dist/api/createChart.d.ts.map +1 -0
  51. package/dist/api/createChart.js +42 -0
  52. package/dist/api/createChart.js.map +1 -0
  53. package/dist/api/drawing tools/fib gann menu/fibRetracement.d.ts +4 -0
  54. package/dist/api/drawing tools/fib gann menu/fibRetracement.d.ts.map +1 -0
  55. package/dist/api/drawing tools/fib gann menu/fibRetracement.js +22 -0
  56. package/dist/api/drawing tools/fib gann menu/fibRetracement.js.map +1 -0
  57. package/dist/api/drawing tools/lines menu/crossLine.d.ts +4 -0
  58. package/dist/api/drawing tools/lines menu/crossLine.d.ts.map +1 -0
  59. package/dist/api/drawing tools/lines menu/crossLine.js +16 -0
  60. package/dist/api/drawing tools/lines menu/crossLine.js.map +1 -0
  61. package/dist/api/drawing tools/lines menu/disjointChannel.d.ts +17 -0
  62. package/dist/api/drawing tools/lines menu/disjointChannel.d.ts.map +1 -0
  63. package/dist/api/drawing tools/lines menu/disjointChannel.js +59 -0
  64. package/dist/api/drawing tools/lines menu/disjointChannel.js.map +1 -0
  65. package/dist/api/drawing tools/lines menu/extendedLine.d.ts +4 -0
  66. package/dist/api/drawing tools/lines menu/extendedLine.d.ts.map +1 -0
  67. package/dist/api/drawing tools/lines menu/extendedLine.js +17 -0
  68. package/dist/api/drawing tools/lines menu/extendedLine.js.map +1 -0
  69. package/dist/api/drawing tools/lines menu/flatTopBottom.d.ts +4 -0
  70. package/dist/api/drawing tools/lines menu/flatTopBottom.d.ts.map +1 -0
  71. package/dist/api/drawing tools/lines menu/flatTopBottom.js +41 -0
  72. package/dist/api/drawing tools/lines menu/flatTopBottom.js.map +1 -0
  73. package/dist/api/drawing tools/lines menu/horizontal.d.ts +4 -0
  74. package/dist/api/drawing tools/lines menu/horizontal.d.ts.map +1 -0
  75. package/dist/api/drawing tools/lines menu/horizontal.js +19 -0
  76. package/dist/api/drawing tools/lines menu/horizontal.js.map +1 -0
  77. package/dist/api/drawing tools/lines menu/horizontalRay.d.ts +4 -0
  78. package/dist/api/drawing tools/lines menu/horizontalRay.d.ts.map +1 -0
  79. package/dist/api/drawing tools/lines menu/horizontalRay.js +20 -0
  80. package/dist/api/drawing tools/lines menu/horizontalRay.js.map +1 -0
  81. package/dist/api/drawing tools/lines menu/infoLine.d.ts +4 -0
  82. package/dist/api/drawing tools/lines menu/infoLine.d.ts.map +1 -0
  83. package/dist/api/drawing tools/lines menu/infoLine.js +107 -0
  84. package/dist/api/drawing tools/lines menu/infoLine.js.map +1 -0
  85. package/dist/api/drawing tools/lines menu/insidePitchfork.d.ts +4 -0
  86. package/dist/api/drawing tools/lines menu/insidePitchfork.d.ts.map +1 -0
  87. package/dist/api/drawing tools/lines menu/insidePitchfork.js +31 -0
  88. package/dist/api/drawing tools/lines menu/insidePitchfork.js.map +1 -0
  89. package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.d.ts +4 -0
  90. package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.d.ts.map +1 -0
  91. package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.js +15 -0
  92. package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.js.map +1 -0
  93. package/dist/api/drawing tools/lines menu/parallelChannel.d.ts +4 -0
  94. package/dist/api/drawing tools/lines menu/parallelChannel.d.ts.map +1 -0
  95. package/dist/api/drawing tools/lines menu/parallelChannel.js +43 -0
  96. package/dist/api/drawing tools/lines menu/parallelChannel.js.map +1 -0
  97. package/dist/api/drawing tools/lines menu/pitchfork.d.ts +4 -0
  98. package/dist/api/drawing tools/lines menu/pitchfork.d.ts.map +1 -0
  99. package/dist/api/drawing tools/lines menu/pitchfork.js +12 -0
  100. package/dist/api/drawing tools/lines menu/pitchfork.js.map +1 -0
  101. package/dist/api/drawing tools/lines menu/ray.d.ts +4 -0
  102. package/dist/api/drawing tools/lines menu/ray.d.ts.map +1 -0
  103. package/dist/api/drawing tools/lines menu/ray.js +23 -0
  104. package/dist/api/drawing tools/lines menu/ray.js.map +1 -0
  105. package/dist/api/drawing tools/lines menu/regressionTrend.d.ts +4 -0
  106. package/dist/api/drawing tools/lines menu/regressionTrend.d.ts.map +1 -0
  107. package/dist/api/drawing tools/lines menu/regressionTrend.js +127 -0
  108. package/dist/api/drawing tools/lines menu/regressionTrend.js.map +1 -0
  109. package/dist/api/drawing tools/lines menu/schiffPitchfork.d.ts +4 -0
  110. package/dist/api/drawing tools/lines menu/schiffPitchfork.d.ts.map +1 -0
  111. package/dist/api/drawing tools/lines menu/schiffPitchfork.js +15 -0
  112. package/dist/api/drawing tools/lines menu/schiffPitchfork.js.map +1 -0
  113. package/dist/api/drawing tools/lines menu/trendAngle.d.ts +4 -0
  114. package/dist/api/drawing tools/lines menu/trendAngle.d.ts.map +1 -0
  115. package/dist/api/drawing tools/lines menu/trendAngle.js +51 -0
  116. package/dist/api/drawing tools/lines menu/trendAngle.js.map +1 -0
  117. package/dist/api/drawing tools/lines menu/trendline.d.ts +4 -0
  118. package/dist/api/drawing tools/lines menu/trendline.d.ts.map +1 -0
  119. package/dist/api/drawing tools/lines menu/trendline.js +11 -0
  120. package/dist/api/drawing tools/lines menu/trendline.js.map +1 -0
  121. package/dist/api/drawing tools/lines menu/vertical.d.ts +4 -0
  122. package/dist/api/drawing tools/lines menu/vertical.d.ts.map +1 -0
  123. package/dist/api/drawing tools/lines menu/vertical.js +11 -0
  124. package/dist/api/drawing tools/lines menu/vertical.js.map +1 -0
  125. package/dist/api/drawing tools/pointers menu/crosshair.d.ts +16 -0
  126. package/dist/api/drawing tools/pointers menu/crosshair.d.ts.map +1 -0
  127. package/{src/api/drawing tools/pointers menu/crosshair.ts → dist/api/drawing tools/pointers menu/crosshair.js } +6 -7
  128. package/dist/api/drawing tools/pointers menu/crosshair.js.map +1 -0
  129. package/dist/api/drawing tools/pointers menu/cursor.d.ts +15 -0
  130. package/dist/api/drawing tools/pointers menu/cursor.d.ts.map +1 -0
  131. package/{src/api/drawing tools/pointers menu/cursor.ts → dist/api/drawing tools/pointers menu/cursor.js } +7 -8
  132. package/dist/api/drawing tools/pointers menu/cursor.js.map +1 -0
  133. package/dist/api/drawing tools/pointers menu/demonstration.d.ts +30 -0
  134. package/dist/api/drawing tools/pointers menu/demonstration.d.ts.map +1 -0
  135. package/{src/api/drawing tools/pointers menu/demonstration.ts → dist/api/drawing tools/pointers menu/demonstration.js } +9 -14
  136. package/dist/api/drawing tools/pointers menu/demonstration.js.map +1 -0
  137. package/dist/api/drawing tools/pointers menu/dot.d.ts +23 -0
  138. package/dist/api/drawing tools/pointers menu/dot.d.ts.map +1 -0
  139. package/{src/api/drawing tools/pointers menu/dot.ts → dist/api/drawing tools/pointers menu/dot.js } +8 -11
  140. package/dist/api/drawing tools/pointers menu/dot.js.map +1 -0
  141. package/dist/api/drawing tools/shapes menu/rectangle.d.ts +4 -0
  142. package/dist/api/drawing tools/shapes menu/rectangle.d.ts.map +1 -0
  143. package/dist/api/drawing tools/shapes menu/rectangle.js +19 -0
  144. package/dist/api/drawing tools/shapes menu/rectangle.js.map +1 -0
  145. package/dist/api/drawing tools/shapes menu/text.d.ts +4 -0
  146. package/dist/api/drawing tools/shapes menu/text.d.ts.map +1 -0
  147. package/dist/api/drawing tools/shapes menu/text.js +25 -0
  148. package/dist/api/drawing tools/shapes menu/text.js.map +1 -0
  149. package/dist/api/drawingUtils.d.ts +22 -0
  150. package/dist/api/drawingUtils.d.ts.map +1 -0
  151. package/dist/api/drawingUtils.js +83 -0
  152. package/dist/api/drawingUtils.js.map +1 -0
  153. package/dist/core/CanvasLayer.d.ts +26 -0
  154. package/dist/core/CanvasLayer.d.ts.map +1 -0
  155. package/dist/core/CanvasLayer.js +56 -0
  156. package/dist/core/CanvasLayer.js.map +1 -0
  157. package/dist/core/Chart.d.ts +164 -0
  158. package/dist/core/Chart.d.ts.map +1 -0
  159. package/dist/core/Chart.js +839 -0
  160. package/dist/core/Chart.js.map +1 -0
  161. package/dist/core/CoordTransform.d.ts +168 -0
  162. package/dist/core/CoordTransform.d.ts.map +1 -0
  163. package/dist/core/CoordTransform.js +224 -0
  164. package/dist/core/CoordTransform.js.map +1 -0
  165. package/dist/core/Crosshair.d.ts +30 -0
  166. package/dist/core/Crosshair.d.ts.map +1 -0
  167. package/dist/core/Crosshair.js +186 -0
  168. package/dist/core/Crosshair.js.map +1 -0
  169. package/dist/core/IndicatorEngine.d.ts +51 -0
  170. package/dist/core/IndicatorEngine.d.ts.map +1 -0
  171. package/dist/core/IndicatorEngine.js +181 -0
  172. package/dist/core/IndicatorEngine.js.map +1 -0
  173. package/dist/core/InteractionManager.d.ts +197 -0
  174. package/dist/core/InteractionManager.d.ts.map +1 -0
  175. package/dist/core/InteractionManager.js +698 -0
  176. package/dist/core/InteractionManager.js.map +1 -0
  177. package/dist/core/PriceScale.d.ts +27 -0
  178. package/dist/core/PriceScale.d.ts.map +1 -0
  179. package/dist/core/PriceScale.js +113 -0
  180. package/dist/core/PriceScale.js.map +1 -0
  181. package/dist/core/Series.d.ts +40 -0
  182. package/dist/core/Series.d.ts.map +1 -0
  183. package/dist/core/Series.js +114 -0
  184. package/dist/core/Series.js.map +1 -0
  185. package/dist/core/TimeScale.d.ts +43 -0
  186. package/dist/core/TimeScale.d.ts.map +1 -0
  187. package/dist/core/TimeScale.js +150 -0
  188. package/dist/core/TimeScale.js.map +1 -0
  189. package/dist/datafeed/DatafeedConnector.d.ts +89 -0
  190. package/dist/datafeed/DatafeedConnector.d.ts.map +1 -0
  191. package/dist/datafeed/DatafeedConnector.js +268 -0
  192. package/dist/datafeed/DatafeedConnector.js.map +1 -0
  193. package/dist/engine/CandleEngine.d.ts +207 -0
  194. package/dist/engine/CandleEngine.d.ts.map +1 -0
  195. package/dist/engine/CandleEngine.js +318 -0
  196. package/dist/engine/CandleEngine.js.map +1 -0
  197. package/dist/engine/__tests__/CandleEngine.test.d.ts +2 -0
  198. package/dist/engine/__tests__/CandleEngine.test.d.ts.map +1 -0
  199. package/dist/engine/__tests__/CandleEngine.test.js +300 -0
  200. package/dist/engine/__tests__/CandleEngine.test.js.map +1 -0
  201. package/dist/engine/candleInvariants.d.ts +66 -0
  202. package/dist/engine/candleInvariants.d.ts.map +1 -0
  203. package/dist/engine/candleInvariants.js +134 -0
  204. package/dist/engine/candleInvariants.js.map +1 -0
  205. package/{src/engine/mergeUtils.ts → dist/engine/mergeUtils.d.ts} +15 -52
  206. package/dist/engine/mergeUtils.d.ts.map +1 -0
  207. package/dist/engine/mergeUtils.js +64 -0
  208. package/dist/engine/mergeUtils.js.map +1 -0
  209. package/dist/engine/timeframeUtils.d.ts +80 -0
  210. package/dist/engine/timeframeUtils.d.ts.map +1 -0
  211. package/{src/engine/timeframeUtils.ts → dist/engine/timeframeUtils.js} +30 -48
  212. package/dist/engine/timeframeUtils.js.map +1 -0
  213. package/dist/index.d.ts +40 -0
  214. package/dist/index.d.ts.map +1 -0
  215. package/dist/index.js +49 -0
  216. package/dist/index.js.map +1 -0
  217. package/dist/internal.d.ts +29 -0
  218. package/dist/internal.d.ts.map +1 -0
  219. package/{src/internal.ts → dist/internal.js} +1 -10
  220. package/dist/internal.js.map +1 -0
  221. package/dist/licensing/ChartRuntimeResolver.d.ts +233 -0
  222. package/dist/licensing/ChartRuntimeResolver.d.ts.map +1 -0
  223. package/dist/licensing/ChartRuntimeResolver.js +310 -0
  224. package/dist/licensing/ChartRuntimeResolver.js.map +1 -0
  225. package/dist/licensing/LicenseManager.d.ts +55 -0
  226. package/dist/licensing/LicenseManager.d.ts.map +1 -0
  227. package/dist/licensing/LicenseManager.js +114 -0
  228. package/dist/licensing/LicenseManager.js.map +1 -0
  229. package/dist/licensing/__tests__/ChartRuntimeResolver.test.d.ts +13 -0
  230. package/dist/licensing/__tests__/ChartRuntimeResolver.test.d.ts.map +1 -0
  231. package/dist/licensing/__tests__/ChartRuntimeResolver.test.js +177 -0
  232. package/dist/licensing/__tests__/ChartRuntimeResolver.test.js.map +1 -0
  233. package/dist/licensing/__tests__/LicenseManager.test.d.ts +12 -0
  234. package/dist/licensing/__tests__/LicenseManager.test.d.ts.map +1 -0
  235. package/dist/licensing/__tests__/LicenseManager.test.js +153 -0
  236. package/dist/licensing/__tests__/LicenseManager.test.js.map +1 -0
  237. package/dist/licensing/licenseTypes.d.ts +18 -0
  238. package/dist/licensing/licenseTypes.d.ts.map +1 -0
  239. package/dist/licensing/licenseTypes.js +2 -0
  240. package/dist/licensing/licenseTypes.js.map +1 -0
  241. package/dist/pine/PineCompiler.d.ts +35 -0
  242. package/dist/pine/PineCompiler.d.ts.map +1 -0
  243. package/dist/pine/PineCompiler.js +44 -0
  244. package/dist/pine/PineCompiler.js.map +1 -0
  245. package/dist/pine/diagnostics.d.ts +20 -0
  246. package/dist/pine/diagnostics.d.ts.map +1 -0
  247. package/dist/pine/diagnostics.js +11 -0
  248. package/dist/pine/diagnostics.js.map +1 -0
  249. package/{src/pine/index.ts → dist/pine/index.d.ts} +4 -3
  250. package/dist/pine/index.d.ts.map +1 -0
  251. package/dist/pine/index.js +5 -0
  252. package/dist/pine/index.js.map +1 -0
  253. package/dist/pine/pine-ast.d.ts +142 -0
  254. package/dist/pine/pine-ast.d.ts.map +1 -0
  255. package/dist/pine/pine-ast.js +19 -0
  256. package/dist/pine/pine-ast.js.map +1 -0
  257. package/dist/pine/pine-lexer.d.ts +41 -0
  258. package/dist/pine/pine-lexer.d.ts.map +1 -0
  259. package/dist/pine/pine-lexer.js +249 -0
  260. package/dist/pine/pine-lexer.js.map +1 -0
  261. package/dist/pine/pine-parser.d.ts +51 -0
  262. package/dist/pine/pine-parser.d.ts.map +1 -0
  263. package/dist/pine/pine-parser.js +416 -0
  264. package/dist/pine/pine-parser.js.map +1 -0
  265. package/dist/pine/pine-transpiler.d.ts +33 -0
  266. package/dist/pine/pine-transpiler.d.ts.map +1 -0
  267. package/dist/pine/pine-transpiler.js +260 -0
  268. package/dist/pine/pine-transpiler.js.map +1 -0
  269. package/dist/pixi/LayerName.d.ts +18 -0
  270. package/dist/pixi/LayerName.d.ts.map +1 -0
  271. package/dist/pixi/LayerName.js +35 -0
  272. package/dist/pixi/LayerName.js.map +1 -0
  273. package/dist/pixi/PixiCandlestickRenderer.d.ts +23 -0
  274. package/dist/pixi/PixiCandlestickRenderer.d.ts.map +1 -0
  275. package/dist/pixi/PixiCandlestickRenderer.js +107 -0
  276. package/dist/pixi/PixiCandlestickRenderer.js.map +1 -0
  277. package/dist/pixi/PixiChart.d.ts +72 -0
  278. package/dist/pixi/PixiChart.d.ts.map +1 -0
  279. package/dist/pixi/PixiChart.js +367 -0
  280. package/dist/pixi/PixiChart.js.map +1 -0
  281. package/dist/pixi/PixiCrosshairRenderer.d.ts +29 -0
  282. package/dist/pixi/PixiCrosshairRenderer.d.ts.map +1 -0
  283. package/dist/pixi/PixiCrosshairRenderer.js +110 -0
  284. package/dist/pixi/PixiCrosshairRenderer.js.map +1 -0
  285. package/dist/pixi/PixiDrawingRenderer.d.ts +17 -0
  286. package/dist/pixi/PixiDrawingRenderer.d.ts.map +1 -0
  287. package/dist/pixi/PixiDrawingRenderer.js +111 -0
  288. package/dist/pixi/PixiDrawingRenderer.js.map +1 -0
  289. package/dist/pixi/PixiGridRenderer.d.ts +22 -0
  290. package/dist/pixi/PixiGridRenderer.d.ts.map +1 -0
  291. package/dist/pixi/PixiGridRenderer.js +114 -0
  292. package/dist/pixi/PixiGridRenderer.js.map +1 -0
  293. package/dist/pixi/PixiLayerManager.d.ts +56 -0
  294. package/dist/pixi/PixiLayerManager.d.ts.map +1 -0
  295. package/dist/pixi/PixiLayerManager.js +92 -0
  296. package/dist/pixi/PixiLayerManager.js.map +1 -0
  297. package/dist/react/canvas/ChartCanvas.d.ts +85 -0
  298. package/dist/react/canvas/ChartCanvas.d.ts.map +1 -0
  299. package/dist/react/canvas/ChartCanvas.js +604 -0
  300. package/dist/react/canvas/ChartCanvas.js.map +1 -0
  301. package/dist/react/canvas/ChartContextMenu.d.ts +18 -0
  302. package/dist/react/canvas/ChartContextMenu.d.ts.map +1 -0
  303. package/dist/react/canvas/ChartContextMenu.js +5 -0
  304. package/dist/react/canvas/ChartContextMenu.js.map +1 -0
  305. package/dist/react/canvas/ChartSettingsDialog.d.ts +25 -0
  306. package/dist/react/canvas/ChartSettingsDialog.d.ts.map +1 -0
  307. package/dist/react/canvas/ChartSettingsDialog.js +28 -0
  308. package/dist/react/canvas/ChartSettingsDialog.js.map +1 -0
  309. package/dist/react/canvas/IndicatorLabel.d.ts +21 -0
  310. package/dist/react/canvas/IndicatorLabel.d.ts.map +1 -0
  311. package/dist/react/canvas/IndicatorLabel.js +196 -0
  312. package/dist/react/canvas/IndicatorLabel.js.map +1 -0
  313. package/dist/react/canvas/IndicatorPane.d.ts +32 -0
  314. package/dist/react/canvas/IndicatorPane.d.ts.map +1 -0
  315. package/dist/react/canvas/IndicatorPane.js +395 -0
  316. package/dist/react/canvas/IndicatorPane.js.map +1 -0
  317. package/dist/react/canvas/PointerOverlay.d.ts +23 -0
  318. package/dist/react/canvas/PointerOverlay.d.ts.map +1 -0
  319. package/dist/react/canvas/PointerOverlay.js +61 -0
  320. package/dist/react/canvas/PointerOverlay.js.map +1 -0
  321. package/dist/react/canvas/toolbars/LeftToolbar.d.ts +19 -0
  322. package/dist/react/canvas/toolbars/LeftToolbar.d.ts.map +1 -0
  323. package/dist/react/canvas/toolbars/LeftToolbar.js +407 -0
  324. package/dist/react/canvas/toolbars/LeftToolbar.js.map +1 -0
  325. package/dist/react/hooks/useChartCapabilities.d.ts +21 -0
  326. package/dist/react/hooks/useChartCapabilities.d.ts.map +1 -0
  327. package/dist/react/hooks/useChartCapabilities.js +66 -0
  328. package/dist/react/hooks/useChartCapabilities.js.map +1 -0
  329. package/dist/react/index.d.ts +30 -0
  330. package/dist/react/index.d.ts.map +1 -0
  331. package/{src/react/index.ts → dist/react/index.js} +1 -24
  332. package/dist/react/index.js.map +1 -0
  333. package/dist/react/internal.d.ts +38 -0
  334. package/dist/react/internal.d.ts.map +1 -0
  335. package/{src/react/internal.ts → dist/react/internal.js} +1 -19
  336. package/dist/react/internal.js.map +1 -0
  337. package/dist/react/shell/ManagedAppShell.d.ts +91 -0
  338. package/dist/react/shell/ManagedAppShell.d.ts.map +1 -0
  339. package/dist/react/shell/ManagedAppShell.js +440 -0
  340. package/dist/react/shell/ManagedAppShell.js.map +1 -0
  341. package/dist/react/trading/TradingBridge.d.ts +86 -0
  342. package/dist/react/trading/TradingBridge.d.ts.map +1 -0
  343. package/dist/react/trading/TradingBridge.js +73 -0
  344. package/dist/react/trading/TradingBridge.js.map +1 -0
  345. package/dist/react/workspace/ChartWorkspace.d.ts +73 -0
  346. package/dist/react/workspace/ChartWorkspace.d.ts.map +1 -0
  347. package/dist/react/workspace/ChartWorkspace.js +42 -0
  348. package/dist/react/workspace/ChartWorkspace.js.map +1 -0
  349. package/dist/react/workspace/FloatingPanel.d.ts +18 -0
  350. package/dist/react/workspace/FloatingPanel.d.ts.map +1 -0
  351. package/dist/react/workspace/FloatingPanel.js +82 -0
  352. package/dist/react/workspace/FloatingPanel.js.map +1 -0
  353. package/dist/react/workspace/IndicatorsDialog.d.ts +8 -0
  354. package/dist/react/workspace/IndicatorsDialog.d.ts.map +1 -0
  355. package/dist/react/workspace/IndicatorsDialog.js +121 -0
  356. package/dist/react/workspace/IndicatorsDialog.js.map +1 -0
  357. package/dist/react/workspace/LayoutMenu.d.ts +33 -0
  358. package/dist/react/workspace/LayoutMenu.d.ts.map +1 -0
  359. package/dist/react/workspace/LayoutMenu.js +113 -0
  360. package/dist/react/workspace/LayoutMenu.js.map +1 -0
  361. package/dist/react/workspace/SymbolSearchDialog.d.ts +10 -0
  362. package/dist/react/workspace/SymbolSearchDialog.d.ts.map +1 -0
  363. package/dist/react/workspace/SymbolSearchDialog.js +245 -0
  364. package/dist/react/workspace/SymbolSearchDialog.js.map +1 -0
  365. package/dist/react/workspace/TabBar.d.ts +17 -0
  366. package/dist/react/workspace/TabBar.d.ts.map +1 -0
  367. package/dist/react/workspace/TabBar.js +29 -0
  368. package/dist/react/workspace/TabBar.js.map +1 -0
  369. package/dist/react/workspace/toolbars/BottomToolbar.d.ts +19 -0
  370. package/dist/react/workspace/toolbars/BottomToolbar.d.ts.map +1 -0
  371. package/dist/react/workspace/toolbars/BottomToolbar.js +236 -0
  372. package/dist/react/workspace/toolbars/BottomToolbar.js.map +1 -0
  373. package/dist/react/workspace/toolbars/RightToolbar.d.ts +8 -0
  374. package/dist/react/workspace/toolbars/RightToolbar.d.ts.map +1 -0
  375. package/dist/react/workspace/toolbars/RightToolbar.js +18 -0
  376. package/dist/react/workspace/toolbars/RightToolbar.js.map +1 -0
  377. package/dist/react/workspace/toolbars/TopToolbar.d.ts +41 -0
  378. package/dist/react/workspace/toolbars/TopToolbar.d.ts.map +1 -0
  379. package/dist/react/workspace/toolbars/TopToolbar.js +82 -0
  380. package/dist/react/workspace/toolbars/TopToolbar.js.map +1 -0
  381. package/dist/renderers/CandlestickRenderer.d.ts +13 -0
  382. package/dist/renderers/CandlestickRenderer.d.ts.map +1 -0
  383. package/dist/renderers/CandlestickRenderer.js +98 -0
  384. package/dist/renderers/CandlestickRenderer.js.map +1 -0
  385. package/dist/renderers/HistogramRenderer.d.ts +11 -0
  386. package/dist/renderers/HistogramRenderer.d.ts.map +1 -0
  387. package/dist/renderers/HistogramRenderer.js +50 -0
  388. package/dist/renderers/HistogramRenderer.js.map +1 -0
  389. package/dist/renderers/LineRenderer.d.ts +12 -0
  390. package/dist/renderers/LineRenderer.d.ts.map +1 -0
  391. package/dist/renderers/LineRenderer.js +64 -0
  392. package/dist/renderers/LineRenderer.js.map +1 -0
  393. package/dist/theme/colors.d.ts +4 -0
  394. package/dist/theme/colors.d.ts.map +1 -0
  395. package/dist/theme/colors.js +19 -0
  396. package/dist/theme/colors.js.map +1 -0
  397. package/dist/tools/barDivergenceCheck.d.ts +120 -0
  398. package/dist/tools/barDivergenceCheck.d.ts.map +1 -0
  399. package/dist/tools/barDivergenceCheck.js +200 -0
  400. package/dist/tools/barDivergenceCheck.js.map +1 -0
  401. package/dist/trading/TradingOverlayStore.d.ts +86 -0
  402. package/dist/trading/TradingOverlayStore.d.ts.map +1 -0
  403. package/dist/trading/TradingOverlayStore.js +139 -0
  404. package/dist/trading/TradingOverlayStore.js.map +1 -0
  405. package/dist/trading/UnmanagedIngestion.d.ts +91 -0
  406. package/dist/trading/UnmanagedIngestion.d.ts.map +1 -0
  407. package/dist/trading/UnmanagedIngestion.js +114 -0
  408. package/dist/trading/UnmanagedIngestion.js.map +1 -0
  409. package/dist/trading/__tests__/ManagedTradingController.test.d.ts +18 -0
  410. package/dist/trading/__tests__/ManagedTradingController.test.d.ts.map +1 -0
  411. package/dist/trading/__tests__/ManagedTradingController.test.js +271 -0
  412. package/dist/trading/__tests__/ManagedTradingController.test.js.map +1 -0
  413. package/dist/trading/__tests__/TradingOverlayStore.test.d.ts +16 -0
  414. package/dist/trading/__tests__/TradingOverlayStore.test.d.ts.map +1 -0
  415. package/dist/trading/__tests__/TradingOverlayStore.test.js +267 -0
  416. package/dist/trading/__tests__/TradingOverlayStore.test.js.map +1 -0
  417. package/dist/trading/__tests__/UnmanagedIngestion.test.d.ts +16 -0
  418. package/dist/trading/__tests__/UnmanagedIngestion.test.d.ts.map +1 -0
  419. package/dist/trading/__tests__/UnmanagedIngestion.test.js +170 -0
  420. package/dist/trading/__tests__/UnmanagedIngestion.test.js.map +1 -0
  421. package/dist/trading/managed/ManagedTradingController.d.ts +110 -0
  422. package/dist/trading/managed/ManagedTradingController.d.ts.map +1 -0
  423. package/dist/trading/managed/ManagedTradingController.js +247 -0
  424. package/dist/trading/managed/ManagedTradingController.js.map +1 -0
  425. package/dist/trading/managed/managedCapabilities.d.ts +45 -0
  426. package/dist/trading/managed/managedCapabilities.d.ts.map +1 -0
  427. package/dist/trading/managed/managedCapabilities.js +79 -0
  428. package/dist/trading/managed/managedCapabilities.js.map +1 -0
  429. package/dist/trading/managed/managedTypes.d.ts +122 -0
  430. package/dist/trading/managed/managedTypes.d.ts.map +1 -0
  431. package/dist/trading/managed/managedTypes.js +13 -0
  432. package/dist/trading/managed/managedTypes.js.map +1 -0
  433. package/dist/trading/tradingTypes.d.ts +89 -0
  434. package/dist/trading/tradingTypes.d.ts.map +1 -0
  435. package/dist/trading/tradingTypes.js +8 -0
  436. package/dist/trading/tradingTypes.js.map +1 -0
  437. package/dist/tscript/TScriptIndicator.d.ts +41 -0
  438. package/dist/tscript/TScriptIndicator.d.ts.map +1 -0
  439. package/dist/tscript/TScriptIndicator.js +47 -0
  440. package/dist/tscript/TScriptIndicator.js.map +1 -0
  441. package/dist/tscript/ast.d.ts +89 -0
  442. package/dist/tscript/ast.d.ts.map +1 -0
  443. package/dist/tscript/ast.js +22 -0
  444. package/dist/tscript/ast.js.map +1 -0
  445. package/dist/tscript/lexer.d.ts +36 -0
  446. package/dist/tscript/lexer.d.ts.map +1 -0
  447. package/dist/tscript/lexer.js +187 -0
  448. package/dist/tscript/lexer.js.map +1 -0
  449. package/dist/tscript/parser.d.ts +50 -0
  450. package/dist/tscript/parser.d.ts.map +1 -0
  451. package/dist/tscript/parser.js +318 -0
  452. package/dist/tscript/parser.js.map +1 -0
  453. package/dist/tscript/runtime.d.ts +123 -0
  454. package/dist/tscript/runtime.d.ts.map +1 -0
  455. package/dist/tscript/runtime.js +475 -0
  456. package/dist/tscript/runtime.js.map +1 -0
  457. package/dist/tscript/series.d.ts +49 -0
  458. package/dist/tscript/series.d.ts.map +1 -0
  459. package/dist/tscript/series.js +79 -0
  460. package/dist/tscript/series.js.map +1 -0
  461. package/dist/types/IChart.d.ts +48 -0
  462. package/dist/types/IChart.d.ts.map +1 -0
  463. package/dist/types/IChart.js +2 -0
  464. package/dist/types/IChart.js.map +1 -0
  465. package/{src/types/IRenderer.ts → dist/types/IRenderer.d.ts} +2 -8
  466. package/dist/types/IRenderer.d.ts.map +1 -0
  467. package/dist/types/IRenderer.js +2 -0
  468. package/dist/types/IRenderer.js.map +1 -0
  469. package/dist/types/ISeries.d.ts +26 -0
  470. package/dist/types/ISeries.d.ts.map +1 -0
  471. package/dist/types/ISeries.js +2 -0
  472. package/dist/types/ISeries.js.map +1 -0
  473. package/package.json +5 -1
  474. package/src/__tests__/backwardCompatibility.test.ts +0 -191
  475. package/src/__tests__/candleInvariant.test.ts +0 -500
  476. package/src/__tests__/timeframeBoundary.test.ts +0 -583
  477. package/src/api/DrawingManager.ts +0 -188
  478. package/src/api/EventBus.ts +0 -53
  479. package/src/api/IndicatorDAG.ts +0 -389
  480. package/src/api/IndicatorRegistry.ts +0 -47
  481. package/src/api/LayoutManager.ts +0 -72
  482. package/src/api/PaneManager.ts +0 -129
  483. package/src/api/ReferenceAPI.ts +0 -195
  484. package/src/api/TChart.ts +0 -881
  485. package/src/api/drawing tools/fib gann menu/fibRetracement.ts +0 -27
  486. package/src/api/drawing tools/lines menu/crossLine.ts +0 -21
  487. package/src/api/drawing tools/lines menu/disjointChannel.ts +0 -74
  488. package/src/api/drawing tools/lines menu/extendedLine.ts +0 -22
  489. package/src/api/drawing tools/lines menu/flatTopBottom.ts +0 -45
  490. package/src/api/drawing tools/lines menu/horizontal.ts +0 -24
  491. package/src/api/drawing tools/lines menu/horizontalRay.ts +0 -25
  492. package/src/api/drawing tools/lines menu/infoLine.ts +0 -127
  493. package/src/api/drawing tools/lines menu/insidePitchfork.ts +0 -21
  494. package/src/api/drawing tools/lines menu/modifiedSchiffPitchfork.ts +0 -18
  495. package/src/api/drawing tools/lines menu/parallelChannel.ts +0 -47
  496. package/src/api/drawing tools/lines menu/pitchfork.ts +0 -15
  497. package/src/api/drawing tools/lines menu/ray.ts +0 -28
  498. package/src/api/drawing tools/lines menu/regressionTrend.ts +0 -157
  499. package/src/api/drawing tools/lines menu/schiffPitchfork.ts +0 -18
  500. package/src/api/drawing tools/lines menu/trendAngle.ts +0 -64
  501. package/src/api/drawing tools/lines menu/trendline.ts +0 -16
  502. package/src/api/drawing tools/lines menu/vertical.ts +0 -16
  503. package/src/api/drawing tools/shapes menu/rectangle.ts +0 -24
  504. package/src/api/drawing tools/shapes menu/text.ts +0 -30
  505. package/src/api/drawingUtils.ts +0 -82
  506. package/src/core/CanvasLayer.ts +0 -77
  507. package/src/core/Chart.ts +0 -917
  508. package/src/core/CoordTransform.ts +0 -282
  509. package/src/core/Crosshair.ts +0 -207
  510. package/src/core/IndicatorEngine.ts +0 -216
  511. package/src/core/InteractionManager.ts +0 -899
  512. package/src/core/PriceScale.ts +0 -133
  513. package/src/core/Series.ts +0 -132
  514. package/src/core/TimeScale.ts +0 -175
  515. package/src/datafeed/DatafeedConnector.ts +0 -300
  516. package/src/engine/CandleEngine.ts +0 -458
  517. package/src/engine/__tests__/CandleEngine.test.ts +0 -402
  518. package/src/engine/candleInvariants.ts +0 -172
  519. package/src/index.ts +0 -190
  520. package/src/licensing/ChartRuntimeResolver.ts +0 -380
  521. package/src/licensing/LicenseManager.ts +0 -131
  522. package/src/licensing/__tests__/ChartRuntimeResolver.test.ts +0 -207
  523. package/src/licensing/__tests__/LicenseManager.test.ts +0 -180
  524. package/src/licensing/licenseTypes.ts +0 -19
  525. package/src/pine/PineCompiler.ts +0 -68
  526. package/src/pine/diagnostics.ts +0 -30
  527. package/src/pine/pine-ast.ts +0 -163
  528. package/src/pine/pine-lexer.ts +0 -265
  529. package/src/pine/pine-parser.ts +0 -439
  530. package/src/pine/pine-transpiler.ts +0 -301
  531. package/src/pixi/LayerName.ts +0 -35
  532. package/src/pixi/PixiCandlestickRenderer.ts +0 -125
  533. package/src/pixi/PixiChart.ts +0 -425
  534. package/src/pixi/PixiCrosshairRenderer.ts +0 -134
  535. package/src/pixi/PixiDrawingRenderer.ts +0 -121
  536. package/src/pixi/PixiGridRenderer.ts +0 -136
  537. package/src/pixi/PixiLayerManager.ts +0 -102
  538. package/src/react/canvas/ChartCanvas.tsx +0 -984
  539. package/src/react/canvas/ChartContextMenu.tsx +0 -60
  540. package/src/react/canvas/ChartSettingsDialog.tsx +0 -133
  541. package/src/react/canvas/IndicatorLabel.tsx +0 -347
  542. package/src/react/canvas/IndicatorPane.tsx +0 -503
  543. package/src/react/canvas/PointerOverlay.tsx +0 -126
  544. package/src/react/canvas/toolbars/LeftToolbar.tsx +0 -1096
  545. package/src/react/hooks/useChartCapabilities.ts +0 -76
  546. package/src/react/shell/ManagedAppShell.tsx +0 -699
  547. package/src/react/trading/TradingBridge.ts +0 -156
  548. package/src/react/workspace/ChartWorkspace.tsx +0 -228
  549. package/src/react/workspace/FloatingPanel.tsx +0 -131
  550. package/src/react/workspace/IndicatorsDialog.tsx +0 -246
  551. package/src/react/workspace/LayoutMenu.tsx +0 -345
  552. package/src/react/workspace/SymbolSearchDialog.tsx +0 -377
  553. package/src/react/workspace/TabBar.tsx +0 -87
  554. package/src/react/workspace/toolbars/BottomToolbar.tsx +0 -372
  555. package/src/react/workspace/toolbars/RightToolbar.tsx +0 -46
  556. package/src/react/workspace/toolbars/TopToolbar.tsx +0 -431
  557. package/src/renderers/CandlestickRenderer.ts +0 -130
  558. package/src/renderers/HistogramRenderer.ts +0 -63
  559. package/src/renderers/LineRenderer.ts +0 -77
  560. package/src/theme/colors.ts +0 -21
  561. package/src/tools/barDivergenceCheck.ts +0 -305
  562. package/src/trading/TradingOverlayStore.ts +0 -161
  563. package/src/trading/UnmanagedIngestion.ts +0 -156
  564. package/src/trading/__tests__/ManagedTradingController.test.ts +0 -338
  565. package/src/trading/__tests__/TradingOverlayStore.test.ts +0 -323
  566. package/src/trading/__tests__/UnmanagedIngestion.test.ts +0 -205
  567. package/src/trading/managed/ManagedTradingController.ts +0 -292
  568. package/src/trading/managed/managedCapabilities.ts +0 -98
  569. package/src/trading/managed/managedTypes.ts +0 -151
  570. package/src/trading/tradingTypes.ts +0 -135
  571. package/src/tscript/TScriptIndicator.ts +0 -54
  572. package/src/tscript/ast.ts +0 -105
  573. package/src/tscript/lexer.ts +0 -190
  574. package/src/tscript/parser.ts +0 -334
  575. package/src/tscript/runtime.ts +0 -525
  576. package/src/tscript/series.ts +0 -84
  577. package/src/types/IChart.ts +0 -56
  578. package/src/types/ISeries.ts +0 -30
  579. package/tsconfig.json +0 -23
  580. package/tsup.config.ts +0 -16
  581. 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
- }