nmrium 2.3.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. package/lib/component/1d/HorizontalAxis1D.d.ts.map +1 -1
  2. package/lib/component/1d/HorizontalAxis1D.js +4 -1
  3. package/lib/component/1d/HorizontalAxis1D.js.map +1 -1
  4. package/lib/component/1d/SVGContent1D.d.ts.map +1 -1
  5. package/lib/component/1d/SVGContent1D.js +2 -1
  6. package/lib/component/1d/SVGContent1D.js.map +1 -1
  7. package/lib/component/1d/Viewer1D.d.ts.map +1 -1
  8. package/lib/component/1d/Viewer1D.js +2 -1
  9. package/lib/component/1d/Viewer1D.js.map +1 -1
  10. package/lib/component/1d/integral/IntegralResizable.d.ts.map +1 -1
  11. package/lib/component/1d/integral/IntegralResizable.js +4 -4
  12. package/lib/component/1d/integral/IntegralResizable.js.map +1 -1
  13. package/lib/component/1d/peaks/PeakEditionManager.d.ts +1 -1
  14. package/lib/component/1d/ranges/Range.d.ts.map +1 -1
  15. package/lib/component/1d/ranges/Range.js +3 -3
  16. package/lib/component/1d/ranges/Range.js.map +1 -1
  17. package/lib/component/1d/ranges/Signals.d.ts +2 -0
  18. package/lib/component/1d/ranges/Signals.d.ts.map +1 -0
  19. package/lib/component/1d/ranges/Signals.js +16 -0
  20. package/lib/component/1d/ranges/Signals.js.map +1 -0
  21. package/lib/component/1d-2d/components/RangeIndicator.d.ts +13 -0
  22. package/lib/component/1d-2d/components/RangeIndicator.d.ts.map +1 -0
  23. package/lib/component/1d-2d/components/RangeIndicator.js +52 -0
  24. package/lib/component/1d-2d/components/RangeIndicator.js.map +1 -0
  25. package/lib/component/1d-2d/components/Signals1D.d.ts +19 -0
  26. package/lib/component/1d-2d/components/Signals1D.d.ts.map +1 -0
  27. package/lib/component/1d-2d/components/Signals1D.js +155 -0
  28. package/lib/component/1d-2d/components/Signals1D.js.map +1 -0
  29. package/lib/component/1d-2d/tools/BrushXY.js +6 -6
  30. package/lib/component/1d-2d/tools/BrushXY.js.map +1 -1
  31. package/lib/component/1d-2d/tools/CrossLinePointer.d.ts +16 -1
  32. package/lib/component/1d-2d/tools/CrossLinePointer.d.ts.map +1 -1
  33. package/lib/component/1d-2d/tools/CrossLinePointer.js +25 -15
  34. package/lib/component/1d-2d/tools/CrossLinePointer.js.map +1 -1
  35. package/lib/component/1d-2d/tools/CursorToolIcon.d.ts +9 -0
  36. package/lib/component/1d-2d/tools/CursorToolIcon.d.ts.map +1 -0
  37. package/lib/component/1d-2d/tools/CursorToolIcon.js +58 -0
  38. package/lib/component/1d-2d/tools/CursorToolIcon.js.map +1 -0
  39. package/lib/component/2d/1d-tracer/Left1DChart.d.ts.map +1 -1
  40. package/lib/component/2d/1d-tracer/Left1DChart.js +7 -2
  41. package/lib/component/2d/1d-tracer/Left1DChart.js.map +1 -1
  42. package/lib/component/2d/1d-tracer/Ranges1D.d.ts +9 -0
  43. package/lib/component/2d/1d-tracer/Ranges1D.d.ts.map +1 -0
  44. package/lib/component/2d/1d-tracer/Ranges1D.js +20 -0
  45. package/lib/component/2d/1d-tracer/Ranges1D.js.map +1 -0
  46. package/lib/component/2d/1d-tracer/Top1DChart.d.ts.map +1 -1
  47. package/lib/component/2d/1d-tracer/Top1DChart.js +7 -2
  48. package/lib/component/2d/1d-tracer/Top1DChart.js.map +1 -1
  49. package/lib/component/2d/DirectAxis2D.d.ts.map +1 -1
  50. package/lib/component/2d/DirectAxis2D.js +4 -1
  51. package/lib/component/2d/DirectAxis2D.js.map +1 -1
  52. package/lib/component/2d/IndirectAxis2D.d.ts.map +1 -1
  53. package/lib/component/2d/IndirectAxis2D.js +5 -2
  54. package/lib/component/2d/IndirectAxis2D.js.map +1 -1
  55. package/lib/component/2d/Viewer2D.d.ts.map +1 -1
  56. package/lib/component/2d/Viewer2D.js +2 -1
  57. package/lib/component/2d/Viewer2D.js.map +1 -1
  58. package/lib/component/2d/ft/FTContainer.d.ts.map +1 -1
  59. package/lib/component/2d/ft/FTContainer.js.map +1 -1
  60. package/lib/component/AnchorSVG.d.ts +36 -0
  61. package/lib/component/AnchorSVG.d.ts.map +1 -0
  62. package/lib/component/AnchorSVG.js +140 -0
  63. package/lib/component/AnchorSVG.js.map +1 -0
  64. package/lib/component/EventsTrackers/BrushTracker.d.ts.map +1 -1
  65. package/lib/component/EventsTrackers/BrushTracker.js +16 -2
  66. package/lib/component/EventsTrackers/BrushTracker.js.map +1 -1
  67. package/lib/component/EventsTrackers/MouseTracker.d.ts +3 -0
  68. package/lib/component/EventsTrackers/MouseTracker.d.ts.map +1 -1
  69. package/lib/component/EventsTrackers/MouseTracker.js +15 -0
  70. package/lib/component/EventsTrackers/MouseTracker.js.map +1 -1
  71. package/lib/component/context/KeyModifierContext.d.ts +2 -0
  72. package/lib/component/context/KeyModifierContext.d.ts.map +1 -1
  73. package/lib/component/context/KeyModifierContext.js +26 -6
  74. package/lib/component/context/KeyModifierContext.js.map +1 -1
  75. package/lib/component/elements/D3Axis.d.ts.map +1 -1
  76. package/lib/component/elements/D3Axis.js +4 -3
  77. package/lib/component/elements/D3Axis.js.map +1 -1
  78. package/lib/component/elements/DraggableDialog.d.ts.map +1 -1
  79. package/lib/component/elements/DraggableDialog.js +1 -2
  80. package/lib/component/elements/DraggableDialog.js.map +1 -1
  81. package/lib/component/elements/Sections.d.ts +3 -3
  82. package/lib/component/elements/Sections.d.ts.map +1 -1
  83. package/lib/component/elements/Sections.js +1 -1
  84. package/lib/component/elements/Sections.js.map +1 -1
  85. package/lib/component/elements/export/ExportOptionsModal.js +2 -5
  86. package/lib/component/elements/export/ExportOptionsModal.js.map +1 -1
  87. package/lib/component/header/AutoPeakPickingOptionPanel.d.ts.map +1 -1
  88. package/lib/component/header/AutoPeakPickingOptionPanel.js +59 -31
  89. package/lib/component/header/AutoPeakPickingOptionPanel.js.map +1 -1
  90. package/lib/component/header/Header.d.ts.map +1 -1
  91. package/lib/component/header/Header.js +2 -4
  92. package/lib/component/header/Header.js.map +1 -1
  93. package/lib/component/header/RangesPickingOptionPanel.d.ts.map +1 -1
  94. package/lib/component/header/RangesPickingOptionPanel.js +34 -19
  95. package/lib/component/header/RangesPickingOptionPanel.js.map +1 -1
  96. package/lib/component/hooks/useAddMultipletSignal.d.ts +7 -0
  97. package/lib/component/hooks/useAddMultipletSignal.d.ts.map +1 -0
  98. package/lib/component/hooks/useAddMultipletSignal.js +28 -0
  99. package/lib/component/hooks/useAddMultipletSignal.js.map +1 -0
  100. package/lib/component/hooks/useFilter.d.ts.map +1 -1
  101. package/lib/component/hooks/useFilter.js.map +1 -1
  102. package/lib/component/hooks/useSaveSettings.d.ts.map +1 -1
  103. package/lib/component/hooks/useSaveSettings.js +3 -6
  104. package/lib/component/hooks/useSaveSettings.js.map +1 -1
  105. package/lib/component/hooks/useSpectrum.d.ts +3 -1
  106. package/lib/component/hooks/useSpectrum.d.ts.map +1 -1
  107. package/lib/component/hooks/useSpectrum.js +1 -1
  108. package/lib/component/hooks/useSpectrum.js.map +1 -1
  109. package/lib/component/hooks/useSpectrumWithDataSource.d.ts +1 -1
  110. package/lib/component/hooks/useSpectrumWithDataSource.d.ts.map +1 -1
  111. package/lib/component/hooks/useSpectrumWithDataSource.js.map +1 -1
  112. package/lib/component/hooks/useTempSpectrum.d.ts +1 -1
  113. package/lib/component/hooks/useTempSpectrum.d.ts.map +1 -1
  114. package/lib/component/hooks/use_ticks_config.d.ts +1 -4
  115. package/lib/component/hooks/use_ticks_config.d.ts.map +1 -1
  116. package/lib/component/hooks/use_ticks_config.js +1 -6
  117. package/lib/component/hooks/use_ticks_config.js.map +1 -1
  118. package/lib/component/modal/PublicationStringModal.d.ts +1 -1
  119. package/lib/component/modal/PublicationStringModal.d.ts.map +1 -1
  120. package/lib/component/modal/PublicationStringModal.js +4 -8
  121. package/lib/component/modal/PublicationStringModal.js.map +1 -1
  122. package/lib/component/modal/SaveAsModal.js +3 -6
  123. package/lib/component/modal/SaveAsModal.js.map +1 -1
  124. package/lib/component/modal/aboutUs/AboutUsModal.d.ts.map +1 -1
  125. package/lib/component/modal/aboutUs/AboutUsModal.js +2 -4
  126. package/lib/component/modal/aboutUs/AboutUsModal.js.map +1 -1
  127. package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts.map +1 -1
  128. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +38 -36
  129. package/lib/component/modal/editRange/forms/components/NewSignalTab.js.map +1 -1
  130. package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts +142 -24
  131. package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts.map +1 -1
  132. package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts +142 -24
  133. package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts.map +1 -1
  134. package/lib/component/modal/setting/tanstack_general_settings/general_settings.d.ts.map +1 -1
  135. package/lib/component/modal/setting/tanstack_general_settings/general_settings.js +9 -12
  136. package/lib/component/modal/setting/tanstack_general_settings/general_settings.js.map +1 -1
  137. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts +142 -24
  138. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts.map +1 -1
  139. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts +120 -24
  140. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts.map +1 -1
  141. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts +120 -24
  142. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts.map +1 -1
  143. package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts +20 -4
  144. package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts.map +1 -1
  145. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts +120 -24
  146. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts.map +1 -1
  147. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts +120 -24
  148. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts.map +1 -1
  149. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.js +12 -1
  150. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.js.map +1 -1
  151. package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts +120 -24
  152. package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts.map +1 -1
  153. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts +120 -24
  154. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts.map +1 -1
  155. package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts +120 -24
  156. package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts.map +1 -1
  157. package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts +120 -24
  158. package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts.map +1 -1
  159. package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts +120 -24
  160. package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts.map +1 -1
  161. package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts +120 -24
  162. package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts.map +1 -1
  163. package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts +120 -24
  164. package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts.map +1 -1
  165. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts +120 -24
  166. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts.map +1 -1
  167. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts +120 -24
  168. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts.map +1 -1
  169. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts +120 -24
  170. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts.map +1 -1
  171. package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts +120 -24
  172. package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts.map +1 -1
  173. package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.d.ts +22 -0
  174. package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.d.ts.map +1 -1
  175. package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.js +15 -2
  176. package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.js.map +1 -1
  177. package/lib/component/modal/setting/tanstack_general_settings/validation.d.ts +22 -0
  178. package/lib/component/modal/setting/tanstack_general_settings/validation.d.ts.map +1 -1
  179. package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js +1 -1
  180. package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js.map +1 -1
  181. package/lib/component/panels/PeaksPanel/PeaksPanel.d.ts.map +1 -1
  182. package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -9
  183. package/lib/component/panels/PeaksPanel/PeaksPanel.js.map +1 -1
  184. package/lib/component/panels/PeaksPanel/PeaksPreferences.js +1 -1
  185. package/lib/component/panels/PeaksPanel/PeaksPreferences.js.map +1 -1
  186. package/lib/component/panels/PeaksPanel/PeaksTable.d.ts.map +1 -1
  187. package/lib/component/panels/PeaksPanel/PeaksTable.js +9 -9
  188. package/lib/component/panels/PeaksPanel/PeaksTable.js.map +1 -1
  189. package/lib/component/panels/RangesPanel/RangesPanel.d.ts.map +1 -1
  190. package/lib/component/panels/RangesPanel/RangesPanel.js +1 -3
  191. package/lib/component/panels/RangesPanel/RangesPanel.js.map +1 -1
  192. package/lib/component/panels/RangesPanel/RangesTableRow.d.ts.map +1 -1
  193. package/lib/component/panels/RangesPanel/RangesTableRow.js +10 -12
  194. package/lib/component/panels/RangesPanel/RangesTableRow.js.map +1 -1
  195. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts +1 -1
  196. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts.map +1 -1
  197. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.js +1 -1
  198. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.js.map +1 -1
  199. package/lib/component/panels/SummaryPanel/SummaryPanel.d.ts.map +1 -1
  200. package/lib/component/panels/SummaryPanel/SummaryPanel.js +7 -0
  201. package/lib/component/panels/SummaryPanel/SummaryPanel.js.map +1 -1
  202. package/lib/component/panels/filtersPanel/FilterPanel.d.ts.map +1 -1
  203. package/lib/component/panels/filtersPanel/FilterPanel.js +5 -2
  204. package/lib/component/panels/filtersPanel/FilterPanel.js.map +1 -1
  205. package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js +1 -1
  206. package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js.map +1 -1
  207. package/lib/component/panels/filtersPanel/processings_sections_panel.d.ts +2 -0
  208. package/lib/component/panels/filtersPanel/processings_sections_panel.d.ts.map +1 -0
  209. package/lib/component/panels/filtersPanel/processings_sections_panel.js +134 -0
  210. package/lib/component/panels/filtersPanel/processings_sections_panel.js.map +1 -0
  211. package/lib/component/panels/hooks/use_processings_mutation.d.ts +10 -0
  212. package/lib/component/panels/hooks/use_processings_mutation.d.ts.map +1 -0
  213. package/lib/component/panels/hooks/use_processings_mutation.js +130 -0
  214. package/lib/component/panels/hooks/use_processings_mutation.js.map +1 -0
  215. package/lib/component/panels/informationPanel/InformationPanel.js +1 -1
  216. package/lib/component/panels/informationPanel/InformationPanel.js.map +1 -1
  217. package/lib/component/reducer/Reducer.d.ts.map +1 -1
  218. package/lib/component/reducer/Reducer.js +4 -0
  219. package/lib/component/reducer/Reducer.js.map +1 -1
  220. package/lib/component/reducer/actions/CorrelationsActions.js +2 -2
  221. package/lib/component/reducer/actions/CorrelationsActions.js.map +1 -1
  222. package/lib/component/reducer/actions/FiltersActions.d.ts +2 -0
  223. package/lib/component/reducer/actions/FiltersActions.d.ts.map +1 -1
  224. package/lib/component/reducer/actions/FiltersActions.js +1 -1
  225. package/lib/component/reducer/actions/FiltersActions.js.map +1 -1
  226. package/lib/component/reducer/actions/MoleculeActions.d.ts +9 -0
  227. package/lib/component/reducer/actions/MoleculeActions.d.ts.map +1 -1
  228. package/lib/component/reducer/actions/RangesActions.d.ts +11 -2
  229. package/lib/component/reducer/actions/RangesActions.d.ts.map +1 -1
  230. package/lib/component/reducer/actions/RangesActions.js +36 -29
  231. package/lib/component/reducer/actions/RangesActions.js.map +1 -1
  232. package/lib/component/reducer/actions/SpectraActions.d.ts +8 -2
  233. package/lib/component/reducer/actions/SpectraActions.d.ts.map +1 -1
  234. package/lib/component/reducer/actions/SpectraActions.js +6 -1
  235. package/lib/component/reducer/actions/SpectraActions.js.map +1 -1
  236. package/lib/component/reducer/actions/ToolsActions.d.ts.map +1 -1
  237. package/lib/component/reducer/actions/ToolsActions.js +5 -17
  238. package/lib/component/reducer/actions/ToolsActions.js.map +1 -1
  239. package/lib/component/reducer/helper/getTraceSpectrumID.d.ts +5 -0
  240. package/lib/component/reducer/helper/getTraceSpectrumID.d.ts.map +1 -0
  241. package/lib/component/reducer/helper/getTraceSpectrumID.js +14 -0
  242. package/lib/component/reducer/helper/getTraceSpectrumID.js.map +1 -0
  243. package/lib/component/reducer/preferences/actions/setPreferences.d.ts +2 -2
  244. package/lib/component/reducer/preferences/actions/setPreferences.d.ts.map +1 -1
  245. package/lib/component/reducer/preferences/actions/setPreferences.js +8 -5
  246. package/lib/component/reducer/preferences/actions/setPreferences.js.map +1 -1
  247. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  248. package/lib/component/reducer/preferences/preferencesReducer.d.ts.map +1 -1
  249. package/lib/component/toolbar/ToolTypes.d.ts +21 -1
  250. package/lib/component/toolbar/ToolTypes.d.ts.map +1 -1
  251. package/lib/component/toolbar/ToolTypes.js +40 -0
  252. package/lib/component/toolbar/ToolTypes.js.map +1 -1
  253. package/lib/component/toolbar/nmr_toolbar.d.ts.map +1 -1
  254. package/lib/component/toolbar/nmr_toolbar.js +12 -36
  255. package/lib/component/toolbar/nmr_toolbar.js.map +1 -1
  256. package/lib/component/utility/CoreSlot.d.ts +27 -0
  257. package/lib/component/utility/CoreSlot.d.ts.map +1 -0
  258. package/lib/component/utility/CoreSlot.js +56 -0
  259. package/lib/component/utility/CoreSlot.js.map +1 -0
  260. package/lib/component/workspaces/workspaceDefaultProperties.d.ts.map +1 -1
  261. package/lib/component/workspaces/workspaceDefaultProperties.js +19 -2
  262. package/lib/component/workspaces/workspaceDefaultProperties.js.map +1 -1
  263. package/lib/data/data1d/Spectrum1D/initiateDatum1D.d.ts.map +1 -1
  264. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +13 -5
  265. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js.map +1 -1
  266. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.d.ts.map +1 -1
  267. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
  268. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js.map +1 -1
  269. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.d.ts.map +1 -1
  270. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +35 -30
  271. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js.map +1 -1
  272. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts.map +1 -1
  273. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +1 -0
  274. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js.map +1 -1
  275. package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts.map +1 -1
  276. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +12 -4
  277. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js.map +1 -1
  278. package/lib/data/data2d/Spectrum2D/isSpectrum2D.d.ts +1 -1
  279. package/lib/data/data2d/Spectrum2D/isSpectrum2D.d.ts.map +1 -1
  280. package/lib/data/data2d/Spectrum2D/isSpectrum2D.js.map +1 -1
  281. package/lib/data/utilities/RangeUtilities.d.ts +1 -6
  282. package/lib/data/utilities/RangeUtilities.d.ts.map +1 -1
  283. package/lib/data/utilities/RangeUtilities.js +10 -27
  284. package/lib/data/utilities/RangeUtilities.js.map +1 -1
  285. package/lib/versionInfo.js +1 -1
  286. package/package.json +29 -27
  287. package/src/component/1d/HorizontalAxis1D.tsx +12 -2
  288. package/src/component/1d/SVGContent1D.tsx +2 -0
  289. package/src/component/1d/Viewer1D.tsx +2 -0
  290. package/src/component/1d/integral/IntegralResizable.tsx +6 -6
  291. package/src/component/1d/ranges/Range.tsx +6 -6
  292. package/src/component/1d/ranges/Signals.tsx +28 -0
  293. package/src/component/1d-2d/components/RangeIndicator.tsx +106 -0
  294. package/src/component/1d-2d/components/Signals1D.tsx +306 -0
  295. package/src/component/1d-2d/tools/BrushXY.tsx +8 -8
  296. package/src/component/1d-2d/tools/CrossLinePointer.tsx +75 -32
  297. package/src/component/1d-2d/tools/CursorToolIcon.tsx +110 -0
  298. package/src/component/2d/1d-tracer/Left1DChart.tsx +26 -1
  299. package/src/component/2d/1d-tracer/Ranges1D.tsx +38 -0
  300. package/src/component/2d/1d-tracer/Top1DChart.tsx +31 -2
  301. package/src/component/2d/DirectAxis2D.tsx +12 -3
  302. package/src/component/2d/IndirectAxis2D.tsx +9 -5
  303. package/src/component/2d/Viewer2D.tsx +5 -2
  304. package/src/component/2d/ft/FTContainer.tsx +1 -0
  305. package/src/component/AnchorSVG.tsx +369 -0
  306. package/src/component/EventsTrackers/BrushTracker.tsx +25 -5
  307. package/src/component/EventsTrackers/MouseTracker.tsx +21 -0
  308. package/src/component/context/KeyModifierContext.tsx +32 -8
  309. package/src/component/elements/D3Axis.tsx +31 -9
  310. package/src/component/elements/DraggableDialog.tsx +1 -2
  311. package/src/component/elements/Sections.tsx +4 -4
  312. package/src/component/elements/export/ExportOptionsModal.tsx +22 -31
  313. package/src/component/header/AutoPeakPickingOptionPanel.tsx +173 -102
  314. package/src/component/header/Header.tsx +2 -4
  315. package/src/component/header/RangesPickingOptionPanel.tsx +72 -59
  316. package/src/component/hooks/useAddMultipletSignal.tsx +32 -0
  317. package/src/component/hooks/useFilter.ts +2 -1
  318. package/src/component/hooks/useSaveSettings.tsx +4 -15
  319. package/src/component/hooks/useSpectrum.ts +7 -1
  320. package/src/component/hooks/useSpectrumWithDataSource.ts +16 -8
  321. package/src/component/hooks/use_ticks_config.ts +1 -7
  322. package/src/component/modal/PublicationStringModal.tsx +8 -14
  323. package/src/component/modal/SaveAsModal.tsx +41 -50
  324. package/src/component/modal/aboutUs/AboutUsModal.tsx +5 -4
  325. package/src/component/modal/editRange/forms/components/NewSignalTab.tsx +57 -57
  326. package/src/component/modal/setting/tanstack_general_settings/general_settings.tsx +23 -29
  327. package/src/component/modal/setting/tanstack_general_settings/tabs/axis_tab.tsx +76 -12
  328. package/src/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.ts +16 -2
  329. package/src/component/panels/MoleculesPanel/hooks/useAtomAssignment.tsx +1 -1
  330. package/src/component/panels/PeaksPanel/PeaksPanel.tsx +1 -8
  331. package/src/component/panels/PeaksPanel/PeaksPreferences.tsx +1 -1
  332. package/src/component/panels/PeaksPanel/PeaksTable.tsx +11 -9
  333. package/src/component/panels/RangesPanel/RangesPanel.tsx +1 -3
  334. package/src/component/panels/RangesPanel/RangesTableRow.tsx +10 -12
  335. package/src/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.tsx +2 -2
  336. package/src/component/panels/SummaryPanel/SummaryPanel.tsx +13 -11
  337. package/src/component/panels/filtersPanel/FilterPanel.tsx +10 -0
  338. package/src/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.tsx +1 -0
  339. package/src/component/panels/filtersPanel/processings_sections_panel.tsx +307 -0
  340. package/src/component/panels/hooks/use_processings_mutation.ts +171 -0
  341. package/src/component/panels/informationPanel/InformationPanel.tsx +1 -1
  342. package/src/component/reducer/Reducer.ts +4 -0
  343. package/src/component/reducer/actions/CorrelationsActions.ts +2 -2
  344. package/src/component/reducer/actions/FiltersActions.ts +1 -1
  345. package/src/component/reducer/actions/RangesActions.ts +53 -30
  346. package/src/component/reducer/actions/SpectraActions.ts +20 -1
  347. package/src/component/reducer/actions/ToolsActions.ts +5 -21
  348. package/src/component/reducer/helper/getTraceSpectrumID.tsx +25 -0
  349. package/src/component/reducer/preferences/actions/setPreferences.ts +18 -10
  350. package/src/component/reducer/preferences/preferencesReducer.ts +1 -1
  351. package/src/component/toolbar/ToolTypes.ts +92 -1
  352. package/src/component/toolbar/nmr_toolbar.tsx +15 -71
  353. package/src/component/utility/CoreSlot.tsx +126 -0
  354. package/src/component/workspaces/workspaceDefaultProperties.ts +19 -2
  355. package/src/data/data1d/Spectrum1D/initiateDatum1D.ts +14 -8
  356. package/src/data/data1d/Spectrum1D/peaks/autoPeakPicking.ts +1 -0
  357. package/src/data/data1d/Spectrum1D/peaks/optimizePeaks.ts +35 -30
  358. package/src/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.ts +1 -0
  359. package/src/data/data2d/Spectrum2D/initiateDatum2D.ts +12 -4
  360. package/src/data/data2d/Spectrum2D/isSpectrum2D.ts +1 -1
  361. package/src/data/utilities/RangeUtilities.ts +12 -36
  362. package/src/versionInfo.ts +1 -1
  363. package/lib/component/1d/integral/IntegralIndicator.d.ts +0 -9
  364. package/lib/component/1d/integral/IntegralIndicator.d.ts.map +0 -1
  365. package/lib/component/1d/integral/IntegralIndicator.js +0 -22
  366. package/lib/component/1d/integral/IntegralIndicator.js.map +0 -1
  367. package/lib/component/utility/renderCoreSlot.d.ts +0 -11
  368. package/lib/component/utility/renderCoreSlot.d.ts.map +0 -1
  369. package/lib/component/utility/renderCoreSlot.js +0 -13
  370. package/lib/component/utility/renderCoreSlot.js.map +0 -1
  371. package/src/component/1d/integral/IntegralIndicator.tsx +0 -43
  372. package/src/component/utility/renderCoreSlot.tsx +0 -21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nmrium",
3
3
  "description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
4
- "version": "2.3.0",
4
+ "version": "2.5.0",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "exports": {
@@ -26,7 +26,7 @@
26
26
  "clean-lib": "rimraf lib",
27
27
  "cspell": "cspell lint \"**/*.tsx\"",
28
28
  "dev": "vite --host localhost --port 3000 --open",
29
- "eslint": "eslint . --cache --max-warnings=102",
29
+ "eslint": "eslint . --cache --max-warnings=103",
30
30
  "eslint-fix": "node --run eslint -- --fix",
31
31
  "install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start",
32
32
  "knip": "knip",
@@ -66,13 +66,14 @@
66
66
  "@emotion/react": "^11.14.0",
67
67
  "@emotion/styled": "^11.14.1",
68
68
  "@hookform/resolvers": "^5.4.0",
69
- "@tanstack/react-form": "^1.33.0",
69
+ "@tanstack/react-form": "^1.33.1",
70
70
  "@tanstack/react-store": "^0.11.0",
71
71
  "@tanstack/react-table": "^8.21.3",
72
- "@zakodium/nmr-types": "^0.5.16",
73
- "@zakodium/nmrium-core": "^0.7.33",
74
- "@zakodium/nmrium-core-plugins": "^0.7.42",
72
+ "@zakodium/nmr-types": "^0.5.19",
73
+ "@zakodium/nmrium-core": "^0.7.41",
74
+ "@zakodium/nmrium-core-plugins": "^0.7.54",
75
75
  "@zakodium/pdnd-esm": "^1.1.0",
76
+ "@zakodium/utils": "^0.2.0",
76
77
  "@zip.js/zip.js": "^2.8.26",
77
78
  "cheminfo-font": "^1.27.0",
78
79
  "cheminfo-types": "^1.15.0",
@@ -86,34 +87,35 @@
86
87
  "file-collection": "^6.6.1",
87
88
  "file-saver": "^2.0.5",
88
89
  "get-jpaths": "^1.4.1",
89
- "immer": "^11.1.8",
90
+ "immer": "^11.1.11",
90
91
  "lodash": "^4.18.1",
91
92
  "mf-parser": "^3.9.1",
92
93
  "ml-array-mean": "^2.0.0",
93
94
  "ml-array-median": "^2.0.0",
94
95
  "ml-conrec": "^6.0.0",
95
- "ml-gsd": "^14.2.0",
96
+ "ml-gsd": "^14.2.1",
96
97
  "ml-signal-processing": "^2.2.2",
97
- "ml-spectra-processing": "^14.29.1",
98
+ "ml-spectra-processing": "^14.29.2",
98
99
  "ml-tree-similarity": "^2.2.0",
99
100
  "nmr-correlation": "2.3.3",
100
- "nmr-processing": "^22.16.0",
101
+ "nmr-processing": "^22.19.1",
101
102
  "numeral": "^2.0.6",
102
- "openchemlib": "^9.23.0",
103
- "openchemlib-utils": "^8.17.0",
103
+ "openchemlib": "^9.24.0",
104
+ "openchemlib-utils": "^8.17.1",
104
105
  "papaparse": "^5.5.4",
105
106
  "react-d3-utils": "^3.1.2",
107
+ "react-draggable": "=4.5.0",
106
108
  "react-dropzone": "^15.0.0",
107
109
  "react-error-boundary": "^6.1.2",
108
- "react-hook-form": "^7.80.0",
109
- "react-icons": "^5.6.0",
110
+ "react-hook-form": "^7.81.0",
111
+ "react-icons": "^5.7.0",
110
112
  "react-inspector": "^9.0.0",
111
113
  "react-mf": "^3.1.1",
112
- "react-ocl": "^8.7.1",
114
+ "react-ocl": "^8.7.2",
113
115
  "react-ocl-nmr": "^4.1.1",
114
116
  "react-plot": "^3.1.2",
115
117
  "react-rnd": "^10.5.3",
116
- "react-science": "^20.2.0",
118
+ "react-science": "^20.4.0",
117
119
  "react-table": "^7.8.0",
118
120
  "smart-array-filter": "^5.0.0",
119
121
  "ts-pattern": "^5.9.0",
@@ -121,9 +123,9 @@
121
123
  "zod": "^4.4.3"
122
124
  },
123
125
  "devDependencies": {
124
- "@blueprintjs/core": "^6.16.0",
125
- "@blueprintjs/icons": "^6.11.0",
126
- "@blueprintjs/select": "^6.3.0",
126
+ "@blueprintjs/core": "^6.17.2",
127
+ "@blueprintjs/icons": "^6.13.0",
128
+ "@blueprintjs/select": "^6.3.3",
127
129
  "@playwright/test": "=1.57.0",
128
130
  "@simbathesailor/use-what-changed": "^2.0.0",
129
131
  "@types/d3-array": "^3.2.2",
@@ -132,38 +134,38 @@
132
134
  "@types/dlv": "^1.1.5",
133
135
  "@types/file-saver": "^2.0.7",
134
136
  "@types/lodash": "^4.17.24",
135
- "@types/node": "^26.0.1",
137
+ "@types/node": "^26.1.1",
136
138
  "@types/numeral": "^2.0.5",
137
139
  "@types/papaparse": "^5.5.2",
138
140
  "@types/react": "^18.3.13",
139
141
  "@types/react-dom": "^18.3.1",
140
142
  "@types/react-table": "^7.7.20",
141
143
  "@vitejs/plugin-react": "^6.0.3",
142
- "@vitest/coverage-v8": "^4.1.9",
144
+ "@vitest/coverage-v8": "^4.1.10",
143
145
  "@zakodium/tsconfig": "^1.0.5",
144
146
  "cross-env": "^10.1.0",
145
147
  "cspell": "^10.0.1",
146
148
  "eslint": "^9.39.2",
147
149
  "eslint-config-cheminfo-react": "^20.1.0",
148
150
  "eslint-config-cheminfo-typescript": "^22.1.0",
149
- "knip": "^6.23.0",
151
+ "knip": "^6.26.0",
150
152
  "modern-normalize": "^3.0.1",
151
153
  "postcss": "^8.5.16",
152
154
  "postcss-styled-syntax": "^0.7.2",
153
- "prettier": "^3.9.1",
155
+ "prettier": "^3.9.5",
154
156
  "rc-menu": "^9.16.1",
155
157
  "react": "^18.3.1",
156
158
  "react-dom": "^18.3.1",
157
- "react-router-dom": "^7.18.0",
159
+ "react-router-dom": "^7.18.1",
158
160
  "rimraf": "^6.1.3",
159
161
  "serve": "^14.2.6",
160
162
  "stylelint": "^17.14.0",
161
163
  "stylelint-config-standard": "^40.0.0",
162
164
  "typescript": "~6.0.3",
163
- "vite": "=8.0.16",
164
- "vitest": "^4.1.9"
165
+ "vite": "^8.1.4",
166
+ "vitest": "^4.1.10"
165
167
  },
166
168
  "volta": {
167
- "node": "24.15.0"
169
+ "node": "24.18.0"
168
170
  }
169
171
  }
@@ -1,5 +1,6 @@
1
1
  import { useMemo, useRef } from 'react';
2
2
  import { useLinearPrimaryTicks } from 'react-d3-utils';
3
+ import { SVGStyledText } from 'react-science/ui';
3
4
 
4
5
  import { AxisUnitPicker } from '../1d-2d/components/axis_unit_picker.tsx';
5
6
  import { useChartData } from '../context/ChartContext.js';
@@ -11,6 +12,7 @@ import {
11
12
  useHorizontalAxisUnit,
12
13
  } from '../hooks/use_axis_unit.ts';
13
14
  import { useGridline1DConfig } from '../hooks/use_gridlines_config.ts';
15
+ import { useTicksConfig } from '../hooks/use_ticks_config.ts';
14
16
 
15
17
  import { useIsInset } from './inset/InsetProvider.js';
16
18
 
@@ -33,6 +35,7 @@ export function HorizontalAxis1D() {
33
35
  'horizontal',
34
36
  refAxis,
35
37
  );
38
+ const { labelStyle } = useTicksConfig();
36
39
  const gridConfig = useGridline1DConfig();
37
40
 
38
41
  if (!width || !height) {
@@ -59,9 +62,16 @@ export function HorizontalAxis1D() {
59
62
  allowedUnits={allowedUnits}
60
63
  onChange={setUnit}
61
64
  >
62
- <text fill="#000" x={width - 10} y="30" dy="0.70em" textAnchor="end">
65
+ <SVGStyledText
66
+ fill="black"
67
+ x={width - 10}
68
+ y="30"
69
+ dy="0.70em"
70
+ textAnchor="end"
71
+ {...labelStyle}
72
+ >
63
73
  {unitLabel}
64
- </text>
74
+ </SVGStyledText>
65
75
  </AxisUnitPicker>
66
76
  )}
67
77
  </D3Axis>
@@ -20,6 +20,7 @@ import Peaks from './peaks/Peaks.js';
20
20
  import PeaksShapes from './peaks/PeaksShapes.js';
21
21
  import Ranges from './ranges/Ranges.js';
22
22
  import RangesIntegrals from './ranges/RangesIntegrals.js';
23
+ import { Signals } from './ranges/Signals.tsx';
23
24
 
24
25
  export function SVGContent1D() {
25
26
  return (
@@ -47,6 +48,7 @@ export function SVGContent1D() {
47
48
 
48
49
  <SimilarityTree />
49
50
  </ClipPathContainer>
51
+ <Signals />
50
52
  <JGraph />
51
53
  <PredictionErrorsNotations />
52
54
 
@@ -5,6 +5,7 @@ import { SVGRootContainer } from '../1d-2d/components/SVGRootContainer.js';
5
5
  import { ViewerResponsiveWrapper } from '../1d-2d/components/ViewerResponsiveWrapper.js';
6
6
  import BrushXY from '../1d-2d/tools/BrushXY.js';
7
7
  import CrossLinePointer from '../1d-2d/tools/CrossLinePointer.js';
8
+ import { CursorToolIcon } from '../1d-2d/tools/CursorToolIcon.tsx';
8
9
  import { MouseTracker } from '../EventsTrackers/MouseTracker.js';
9
10
  import { useChartData } from '../context/ChartContext.js';
10
11
  import { ScaleProvider } from '../context/ScaleContext.js';
@@ -47,6 +48,7 @@ function InnerViewer1D(props: InnerViewer1DProps) {
47
48
  position: 'absolute',
48
49
  }}
49
50
  >
51
+ <CursorToolIcon />
50
52
  <CrossLinePointer />
51
53
  <BrushXY axis="XY" enableHorizontalGuideline />
52
54
  <XLabelPointer />
@@ -1,6 +1,7 @@
1
1
  import styled from '@emotion/styled';
2
2
  import type { Integral } from '@zakodium/nmr-types';
3
3
 
4
+ import { RangeIndicator } from '../../1d-2d/components/RangeIndicator.tsx';
4
5
  import { useChartData } from '../../context/ChartContext.js';
5
6
  import { useDispatch } from '../../context/DispatchContext.js';
6
7
  import { useScaleChecked } from '../../context/ScaleContext.js';
@@ -10,8 +11,6 @@ import { useHighlight } from '../../highlight/index.js';
10
11
  import { useResizerStatus } from '../../hooks/useResizerStatus.js';
11
12
  import useSpectrum from '../../hooks/useSpectrum.js';
12
13
 
13
- import { IntegralIndicator } from './IntegralIndicator.js';
14
-
15
14
  const Group = styled.g<{ isActive: boolean }>`
16
15
  rect {
17
16
  fill: ${(props) => (props.isActive ? '#ff6f0057' : 'transparent')};
@@ -39,7 +38,7 @@ function IntegralResizable({
39
38
  const { id, integral, to, from } = integralData;
40
39
  const highlight = useHighlight([id], {
41
40
  type: 'INTEGRAL',
42
- extra: { id, spectrumID: spectrum.id },
41
+ extra: { id, spectrumID: spectrum?.id },
43
42
  });
44
43
 
45
44
  function handleOnStopResizing(position: Position) {
@@ -51,7 +50,7 @@ function IntegralResizable({
51
50
  from: scaleX().invert(position.x2),
52
51
  to: scaleX().invert(position.x1),
53
52
  },
54
- spectrumKey: spectrum.id,
53
+ spectrumKey: spectrum?.id,
55
54
  },
56
55
  });
57
56
  }
@@ -77,10 +76,11 @@ function IntegralResizable({
77
76
  return (
78
77
  <Group isActive={highlight.isActive || isActive}>
79
78
  <rect width={width} height={bottom} data-no-export="true" />
80
- <IntegralIndicator
79
+ <RangeIndicator
80
+ position={0}
81
81
  value={integral}
82
82
  format={integralFormat}
83
- width={width}
83
+ size={width}
84
84
  />
85
85
  </Group>
86
86
  );
@@ -7,6 +7,7 @@ import {
7
7
  } from '../../../data/data1d/Spectrum1D/index.js';
8
8
  import { isRangeAssigned } from '../../../data/data1d/Spectrum1D/isRangeAssigned.js';
9
9
  import { getOpacityBasedOnSignalKind } from '../../../data/utilities/RangeUtilities.js';
10
+ import { RangeIndicator } from '../../1d-2d/components/RangeIndicator.tsx';
10
11
  import {
11
12
  useAssignment,
12
13
  useAssignmentContext,
@@ -27,7 +28,6 @@ import useSpectrum from '../../hooks/useSpectrum.js';
27
28
  import { EditRangeModal } from '../../modal/editRange/EditRangeModal.js';
28
29
  import type { StackOverlappingLabelsMapReturnType } from '../../utility/stackOverlappingLabels.js';
29
30
  import { useIsInset } from '../inset/InsetProvider.js';
30
- import { IntegralIndicator } from '../integral/IntegralIndicator.js';
31
31
  import { useScaleX } from '../utilities/scale.js';
32
32
 
33
33
  import { AssignmentLabel } from './AssignmentLabel.js';
@@ -64,7 +64,7 @@ function Range(options: RangeProps) {
64
64
  ),
65
65
  {
66
66
  type: 'RANGE',
67
- extra: { id, spectrumID: spectrum.id },
67
+ extra: { id, spectrumID: spectrum?.id },
68
68
  },
69
69
  );
70
70
 
@@ -74,7 +74,6 @@ function Range(options: RangeProps) {
74
74
  const { showIntegralsValues } = useActiveSpectrumRangesViewState();
75
75
 
76
76
  const { isDialogOpen } = useDialogData();
77
-
78
77
  const isBlockedByEditing = selectedTool && isDialogOpen(EditRangeModal);
79
78
 
80
79
  function handleOnStopResizing(position: Position) {
@@ -213,11 +212,12 @@ function Range(options: RangeProps) {
213
212
  <Atoms range={range} x={rangeWidth / 2} />
214
213
 
215
214
  {showIntegralsValues && (
216
- <IntegralIndicator
215
+ <RangeIndicator
216
+ position={0}
217
+ size={rangeWidth}
217
218
  value={integration}
218
- format={relativeFormat}
219
- width={rangeWidth}
220
219
  opacity={opacity}
220
+ format={relativeFormat}
221
221
  />
222
222
  )}
223
223
  </g>
@@ -0,0 +1,28 @@
1
+ import { isSpectrum1D } from '@zakodium/nmrium-core';
2
+
3
+ import { Signals1D } from '../../1d-2d/components/Signals1D.tsx';
4
+ import { useChartData } from '../../context/ChartContext.tsx';
5
+ import { useScaleChecked } from '../../context/ScaleContext.tsx';
6
+ import useSpectrum from '../../hooks/useSpectrum.ts';
7
+
8
+ export function Signals() {
9
+ const spectrum = useSpectrum();
10
+ const { scaleX } = useScaleChecked();
11
+ const { height, margin } = useChartData();
12
+
13
+ if (!isSpectrum1D(spectrum)) return null;
14
+
15
+ const {
16
+ id,
17
+ ranges: { values },
18
+ } = spectrum;
19
+ return (
20
+ <Signals1D
21
+ orientation="horizontal"
22
+ spectrumId={id}
23
+ ranges={values}
24
+ scale={scaleX()}
25
+ position={height - margin.bottom}
26
+ />
27
+ );
28
+ }
@@ -0,0 +1,106 @@
1
+ import styled from '@emotion/styled';
2
+
3
+ import { useChartData } from '../../context/ChartContext.tsx';
4
+ import { formatNumber } from '../../utility/formatNumber.ts';
5
+
6
+ const Path = styled.path`
7
+ fill: none;
8
+ stroke-width: 1px;
9
+ shape-rendering: crispedges;
10
+ stroke: black;
11
+
12
+ &:hover {
13
+ stroke: red;
14
+ }
15
+ `;
16
+ const Text = styled.text`
17
+ font-size: 11px;
18
+ fill: black;
19
+ `;
20
+
21
+ export type IndicatorOrientation = 'horizontal' | 'vertical';
22
+
23
+ interface RangeIndicatorProps extends Pick<
24
+ React.HTMLAttributes<SVGGElement>,
25
+ 'onClick'
26
+ > {
27
+ position: number;
28
+ size: number;
29
+ orientation?: IndicatorOrientation;
30
+ value?: number;
31
+ format?: string;
32
+ opacity?: number;
33
+ }
34
+ const BRACKET_LENGTH = 5;
35
+
36
+ interface Layout {
37
+ groupTransform: string;
38
+ pathD: string;
39
+ textTransform: string;
40
+ textAnchor: 'start' | 'end' | undefined;
41
+ }
42
+
43
+ function getLayout(
44
+ orientation: IndicatorOrientation,
45
+ position: number,
46
+ size: number,
47
+ top: number,
48
+ ): Layout {
49
+ if (orientation === 'vertical') {
50
+ return {
51
+ groupTransform: `translate(${top} ${position})`,
52
+ pathD: `M0 0 L${BRACKET_LENGTH} 0 L${BRACKET_LENGTH} ${size} L0 ${size}`,
53
+ textTransform: `translate(${-BRACKET_LENGTH - 4} ${Math.round(size / 2) + 4})`,
54
+ textAnchor: 'end',
55
+ };
56
+ }
57
+
58
+ return {
59
+ groupTransform: `translate(${position} ${top})`,
60
+ pathD: `M0 0 L0 ${BRACKET_LENGTH} L${size} ${BRACKET_LENGTH} L${size} 0`,
61
+ textTransform: `rotate(-90) translate(5 ${Math.round(size / 2) + 4})`,
62
+ textAnchor: undefined,
63
+ };
64
+ }
65
+
66
+ export function useMarginBottom(
67
+ orientation: IndicatorOrientation,
68
+ offset = 10,
69
+ ) {
70
+ const { margin, height, displayerMode } = useChartData();
71
+ if (displayerMode === '1D') {
72
+ return height - margin.bottom - offset;
73
+ }
74
+
75
+ if (orientation === 'vertical') {
76
+ return margin.left - offset;
77
+ }
78
+
79
+ return margin.top - offset;
80
+ }
81
+
82
+ export function RangeIndicator(props: RangeIndicatorProps) {
83
+ const {
84
+ position,
85
+ size,
86
+ orientation = 'horizontal',
87
+ value,
88
+ format,
89
+ opacity = 1,
90
+ onClick,
91
+ } = props;
92
+ const resolvedTop = useMarginBottom(orientation);
93
+
94
+ const layout = getLayout(orientation, position, size, resolvedTop);
95
+
96
+ return (
97
+ <g transform={layout.groupTransform} style={{ opacity }} onClick={onClick}>
98
+ <Path d={layout.pathD} />
99
+ {value !== undefined && (
100
+ <Text transform={layout.textTransform} textAnchor={layout.textAnchor}>
101
+ {formatNumber(value, format ?? '')}
102
+ </Text>
103
+ )}
104
+ </g>
105
+ );
106
+ }