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
@@ -0,0 +1,306 @@
1
+ import styled from '@emotion/styled';
2
+ import type { Range, Signal1D } from '@zakodium/nmr-types';
3
+ import type { ScaleLinear } from 'd3-scale';
4
+ import type { ComponentProps } from 'react';
5
+ import { useMemo, useRef, useState } from 'react';
6
+
7
+ import { Anchor } from '../../AnchorSVG.tsx';
8
+ import { disableMouseTrackingProps } from '../../EventsTrackers/MouseTracker.tsx';
9
+ import { useChartData } from '../../context/ChartContext.tsx';
10
+ import { useDispatch } from '../../context/DispatchContext.tsx';
11
+ import { useAddMultipletSignal } from '../../hooks/useAddMultipletSignal.tsx';
12
+ import { useSpectraBottomMargin } from '../../hooks/useSpectraBottomMargin.ts';
13
+
14
+ import type { IndicatorOrientation } from './RangeIndicator.tsx';
15
+ import { useMarginBottom } from './RangeIndicator.tsx';
16
+
17
+ const POINTER_SIZE = 4;
18
+ const BackAreaSize = 20;
19
+ interface SignalCursorProps {
20
+ range: Range;
21
+ scale: ScaleLinear<number, number, number>;
22
+ orientation: IndicatorOrientation;
23
+ spectrumId: string;
24
+ }
25
+ interface InnerSignals1D extends SignalCursorProps {
26
+ position: number;
27
+ }
28
+ interface Signals1DProps extends Omit<InnerSignals1D, 'range'> {
29
+ ranges: Range[];
30
+ }
31
+ const Container = styled.g`
32
+ .signals-block {
33
+ display: none;
34
+ }
35
+
36
+ &:hover .signals-block,
37
+ .signals-block.dragging {
38
+ display: block !important;
39
+ }
40
+ `;
41
+
42
+ export function Signals1D(props: Signals1DProps) {
43
+ const { ranges, orientation, spectrumId, scale, position } = props;
44
+
45
+ return ranges.map((range) => {
46
+ const { id } = range;
47
+
48
+ return (
49
+ <Container key={id} data-no-export="true">
50
+ <SignalCursor
51
+ spectrumId={spectrumId}
52
+ range={range}
53
+ orientation={orientation}
54
+ scale={scale}
55
+ />
56
+ <InnerSignals1D
57
+ {...{ orientation, spectrumId, scale, position, range }}
58
+ />
59
+ </Container>
60
+ );
61
+ });
62
+ }
63
+
64
+ interface GuideLineProps {
65
+ orientation: IndicatorOrientation;
66
+ position: number;
67
+ length: number;
68
+ color: string;
69
+ }
70
+
71
+ function GuideLine({ orientation, position, length, color }: GuideLineProps) {
72
+ const isVerticalLine = orientation === 'horizontal';
73
+
74
+ return (
75
+ <line
76
+ transform={
77
+ isVerticalLine ? `translate(${position} 0)` : `translate(0 ${position})`
78
+ }
79
+ x1={0}
80
+ x2={isVerticalLine ? 0 : length}
81
+ y1={0}
82
+ y2={isVerticalLine ? length : 0}
83
+ stroke={color}
84
+ strokeDasharray="6 4"
85
+ shapeRendering="crispEdges"
86
+ vectorEffect="non-scaling-stroke"
87
+ pointerEvents="none"
88
+ />
89
+ );
90
+ }
91
+ function SignalCursor(props: SignalCursorProps) {
92
+ const { orientation, range, scale, spectrumId } = props;
93
+ const { from, to } = range;
94
+ const fromInPixel = scale(from);
95
+ const toInPixel = scale(to);
96
+ const start = Math.min(fromInPixel, toInPixel);
97
+ const size = Math.abs(fromInPixel - toInPixel);
98
+ const { displayerMode, height, margin } = useChartData();
99
+
100
+ const top = useMarginBottom(orientation);
101
+ const [pointerPosition, setPosition] = useState<number | null>(null);
102
+ const addMultipletSignal = useAddMultipletSignal();
103
+
104
+ function handleMove(event: React.MouseEvent<SVGRectElement>) {
105
+ const rect = event.currentTarget.getBoundingClientRect();
106
+ const local =
107
+ orientation === 'horizontal'
108
+ ? event.clientX - rect.left
109
+ : event.clientY - rect.top;
110
+ setPosition(local);
111
+ }
112
+
113
+ function handleAddSignal(e: React.MouseEvent<SVGGElement, MouseEvent>) {
114
+ e.stopPropagation();
115
+ const boundingRect = e.currentTarget.getBoundingClientRect();
116
+ const x = e.clientX - boundingRect.left + start;
117
+ const y = e.clientY - boundingRect.top + start;
118
+
119
+ const valueInPixel = orientation === 'horizontal' ? x : y;
120
+ const delta = scale.invert(valueInPixel);
121
+ addMultipletSignal({ range, delta, spectrumId });
122
+ }
123
+ const offset = useSpectraBottomMargin();
124
+ const offset1D = offset - 10;
125
+ const translateY = displayerMode === '1D' ? top - offset1D : top;
126
+ const guideLineLength =
127
+ orientation === 'horizontal'
128
+ ? displayerMode === '1D'
129
+ ? height - margin.bottom
130
+ : margin.top
131
+ : margin.left;
132
+
133
+ return (
134
+ <>
135
+ <g
136
+ {...disableMouseTrackingProps}
137
+ transform={
138
+ orientation === 'horizontal'
139
+ ? `translate(${start} ${translateY})`
140
+ : `translate(${top} ${start})`
141
+ }
142
+ onMouseMove={handleMove}
143
+ onMouseLeave={() => setPosition(null)}
144
+ onClick={handleAddSignal}
145
+ >
146
+ {pointerPosition !== null && (
147
+ <circle
148
+ cx={
149
+ orientation === 'horizontal'
150
+ ? pointerPosition
151
+ : POINTER_SIZE + offset1D + 1
152
+ }
153
+ cy={
154
+ orientation === 'horizontal'
155
+ ? POINTER_SIZE + offset1D + 1
156
+ : pointerPosition
157
+ }
158
+ r={POINTER_SIZE}
159
+ fill="green"
160
+ />
161
+ )}
162
+ <BackArea
163
+ orientation={orientation}
164
+ size={size}
165
+ length={displayerMode === '1D' ? BackAreaSize : undefined}
166
+ />
167
+ </g>
168
+
169
+ {pointerPosition !== null && (
170
+ <GuideLine
171
+ orientation={orientation}
172
+ position={start + pointerPosition}
173
+ length={guideLineLength}
174
+ color="green"
175
+ />
176
+ )}
177
+ </>
178
+ );
179
+ }
180
+
181
+ function InnerSignals1D(props: InnerSignals1D) {
182
+ const { range, orientation, spectrumId, scale, position } = props;
183
+ const draggingAnchorRef = useRef<{ index: number; delta: number } | null>(
184
+ null,
185
+ );
186
+ // Only used during active drag for local updates
187
+ const [draggingAnchor, setDraggingAnchor] = useState<{
188
+ index: number;
189
+ delta: number;
190
+ } | null>(null);
191
+ const dispatch = useDispatch();
192
+
193
+ function handleDragMove(
194
+ index: number,
195
+ newPosition: { x: number; y: number },
196
+ ) {
197
+ const delta = orientation === 'horizontal' ? newPosition.x : newPosition.y;
198
+ const from = orientation === 'horizontal' ? range.from : range.to;
199
+ const to = orientation === 'horizontal' ? range.to : range.from;
200
+ const clampedX = Math.max(scale(to), Math.min(scale(from), delta));
201
+ const updated = { index, delta: scale.invert(clampedX) };
202
+ draggingAnchorRef.current = updated;
203
+ setDraggingAnchor(updated);
204
+ }
205
+ function handleDragEnd(signal: Signal1D) {
206
+ const finalDelta = draggingAnchorRef.current?.delta;
207
+
208
+ if (!finalDelta) return;
209
+
210
+ draggingAnchorRef.current = null;
211
+ setDraggingAnchor(null);
212
+ dispatch({
213
+ type: 'CHANGE_SIGNAL_DELTA',
214
+ payload: {
215
+ value: finalDelta,
216
+ rangeId: range.id,
217
+ signalId: signal.id,
218
+ spectrumId,
219
+ },
220
+ });
221
+ }
222
+
223
+ function handleDelete(signal: Signal1D) {
224
+ dispatch({
225
+ type: 'DELETE_1D_SIGNAL',
226
+ payload: {
227
+ rangeId: range.id,
228
+ signalId: signal.id,
229
+ spectrumId,
230
+ },
231
+ });
232
+ }
233
+
234
+ const signals = useMemo(() => {
235
+ const result: Signal1D[] = [];
236
+ let flatIndex = 0;
237
+
238
+ for (const signal of range.signals ?? []) {
239
+ const isDragging = draggingAnchor?.index === flatIndex;
240
+
241
+ result.push({
242
+ ...signal,
243
+ delta: isDragging ? draggingAnchor.delta : signal.delta,
244
+ });
245
+
246
+ flatIndex++;
247
+ }
248
+
249
+ return result;
250
+ }, [range, draggingAnchor?.index, draggingAnchor?.delta]);
251
+
252
+ if (!scale) return null;
253
+ return (
254
+ <g className={`signals-block ${draggingAnchor !== null ? 'dragging' : ''}`}>
255
+ {signals.map((signal, index) => {
256
+ const { id, delta } = signal;
257
+ const x = orientation === 'horizontal' ? scale(delta) : position - 5;
258
+ const y = orientation === 'horizontal' ? position - 5 : scale(delta);
259
+
260
+ return (
261
+ <Anchor
262
+ key={id}
263
+ position={{ x, y }}
264
+ shape="circle"
265
+ onDragMove={(newPosition) => handleDragMove(index, newPosition)}
266
+ onDragEnd={() => handleDragEnd(signal)}
267
+ onDelete={() => handleDelete(signal)}
268
+ cursorOrientation={orientation}
269
+ anchorStyle={{
270
+ guideStyle: 'dashed',
271
+ size: 8,
272
+ hoverSize: 15,
273
+ dragSize: 15,
274
+ hoverStroke: 'red',
275
+ dragStroke: 'darkgreen',
276
+ guideColor: 'red',
277
+ guideDragColor: 'darkgreen',
278
+ fill: 'red',
279
+ stroke: 'transparent',
280
+ }}
281
+ svgHeight={position}
282
+ />
283
+ );
284
+ })}
285
+ </g>
286
+ );
287
+ }
288
+
289
+ interface BackAreaProps extends ComponentProps<'rect'> {
290
+ orientation: IndicatorOrientation;
291
+ size: number;
292
+ length?: number;
293
+ }
294
+
295
+ function BackArea(props: BackAreaProps) {
296
+ const { orientation, size, length = 5, ...other } = props;
297
+ return (
298
+ <rect
299
+ width={orientation === 'horizontal' ? size : length * 2}
300
+ height={orientation === 'horizontal' ? length * 2 : size}
301
+ fill="transparent"
302
+ data-no-export="true"
303
+ {...other}
304
+ />
305
+ );
306
+ }
@@ -146,14 +146,6 @@ export default function BrushXY(props: BrushXYProps) {
146
146
  },
147
147
  );
148
148
 
149
- const scaleX = axis === 'X' || axis === 'XY' ? brush.scaleX : 1;
150
- const scaleY = axis === 'Y' || axis === 'XY' ? brush.scaleY : 1;
151
-
152
- startX = axis === 'Y' ? margin.left : brush.startX || margin.left;
153
- startY = axis === 'X' ? margin.top : brush.startY || margin.top;
154
- endX = axis === 'Y' ? finalWidth : brush.endX || finalWidth;
155
- endY = axis === 'X' ? finalHeight : brush.endY || finalHeight;
156
-
157
149
  let y1;
158
150
  let x1;
159
151
 
@@ -168,6 +160,14 @@ export default function BrushXY(props: BrushXYProps) {
168
160
  x1 = Math.round((endX + startX) / 2);
169
161
  }
170
162
 
163
+ const scaleX = axis === 'X' || axis === 'XY' ? brush.scaleX : 1;
164
+ const scaleY = axis === 'Y' || axis === 'XY' ? brush.scaleY : 1;
165
+
166
+ startX = axis === 'Y' ? margin.left : brush.startX || margin.left;
167
+ startY = axis === 'X' ? margin.top : brush.startY || margin.top;
168
+ endX = axis === 'Y' ? finalWidth : brush.endX || finalWidth;
169
+ endY = axis === 'X' ? finalHeight : brush.endY || finalHeight;
170
+
171
171
  const invScaleX = 1 / scaleX;
172
172
  const invScaleY = 1 / scaleY;
173
173
  const horizontalScaleTransform = `scale(1, ${scaleY})`;
@@ -1,20 +1,19 @@
1
- import type { CSSProperties } from 'react';
1
+ import styled from '@emotion/styled';
2
2
 
3
+ import type { BrushAxis } from '../../EventsTrackers/BrushTracker.js';
3
4
  import { useBrushTracker } from '../../EventsTrackers/BrushTracker.js';
4
5
  import { useMouseTracker } from '../../EventsTrackers/MouseTracker.js';
5
6
  import { useChartData } from '../../context/ChartContext.js';
7
+ import type { Margin } from '../../reducer/Reducer.js';
6
8
  import { options } from '../../toolbar/ToolTypes.js';
7
9
 
8
- const styles: Record<'line', CSSProperties> = {
9
- line: {
10
- stroke: 'black',
11
- strokeOpacity: 1,
12
- shapeRendering: 'crispEdges',
13
- strokeWidth: '1',
14
- willChange: 'transform',
15
- },
16
- };
17
-
10
+ const Line = styled.line`
11
+ stroke: black;
12
+ stroke-opacity: 1;
13
+ shape-rendering: crispedges;
14
+ stroke-width: 1;
15
+ will-change: transform;
16
+ `;
18
17
  const allowTools = new Set([
19
18
  options.zoom.id,
20
19
  options.apodization.id,
@@ -35,27 +34,69 @@ const allowTools = new Set([
35
34
  options.inset.id,
36
35
  ]);
37
36
 
38
- function CrossLinePointer() {
37
+ interface DimensionBorder {
38
+ startX: number;
39
+ startY: number;
40
+ endX?: number;
41
+ endY?: number;
42
+ }
43
+
44
+ const defaultDimensionBorder: DimensionBorder = {
45
+ startX: 0,
46
+ startY: 0,
47
+ };
48
+
49
+ interface CrossLinePointerProps {
50
+ axis?: BrushAxis;
51
+ dimensionBorder?: DimensionBorder;
52
+ width?: number;
53
+ height?: number;
54
+ margin?: Margin;
55
+ }
56
+
57
+ function CrossLinePointer(props: CrossLinePointerProps) {
58
+ const {
59
+ axis = 'XY',
60
+ dimensionBorder = defaultDimensionBorder,
61
+ width: externalWidth,
62
+ height: externalHeight,
63
+ margin: externalMargin,
64
+ } = props;
65
+
39
66
  const {
40
67
  height,
41
68
  width,
42
- margin,
69
+ margin: innerMargin,
43
70
  toolOptions: { selectedTool },
44
71
  } = useChartData();
45
72
  const position = useMouseTracker();
46
73
  const brushState = useBrushTracker();
47
74
 
75
+ const margin = externalMargin ?? innerMargin;
76
+ const finalWidth = externalWidth || width - margin.left - margin.right;
77
+ const finalHeight = externalHeight || height - margin.top - margin.bottom;
78
+
79
+ const {
80
+ startX,
81
+ startY,
82
+ endX = finalWidth,
83
+ endY = finalHeight,
84
+ } = dimensionBorder;
85
+
48
86
  if (
49
87
  !allowTools.has(selectedTool) ||
50
88
  brushState.step === 'brushing' ||
51
89
  !position ||
52
- position.x > width - margin.right ||
53
- position.y > height - margin.bottom ||
54
90
  !width ||
55
- !height
91
+ !height ||
92
+ position.x < startX ||
93
+ position.x > endX ||
94
+ position.y < startY ||
95
+ position.y > endY
56
96
  ) {
57
97
  return null;
58
98
  }
99
+
59
100
  return (
60
101
  <div
61
102
  key="crossLine"
@@ -76,22 +117,24 @@ function CrossLinePointer() {
76
117
  }}
77
118
  >
78
119
  <svg width={2 * width} height={2 * height}>
79
- <line
80
- style={styles.line}
81
- x1={width}
82
- y1="0"
83
- x2={width}
84
- y2={height * 2}
85
- key="vertical_line"
86
- />
87
- <line
88
- style={styles.line}
89
- x1="0"
90
- y1={height}
91
- x2={width * 2}
92
- y2={height}
93
- key="horizontal_line"
94
- />
120
+ {(axis === 'X' || axis === 'XY') && (
121
+ <Line
122
+ x1={width}
123
+ y1="0"
124
+ x2={width}
125
+ y2={height * 2}
126
+ key="vertical_line"
127
+ />
128
+ )}
129
+ {(axis === 'Y' || axis === 'XY') && (
130
+ <Line
131
+ x1="0"
132
+ y1={height}
133
+ x2={width * 2}
134
+ y2={height}
135
+ key="horizontal_line"
136
+ />
137
+ )}
95
138
  </svg>
96
139
  </div>
97
140
  );
@@ -0,0 +1,110 @@
1
+ import styled from '@emotion/styled';
2
+ import { createElement } from 'react';
3
+ import { TbRulerMeasure } from 'react-icons/tb';
4
+
5
+ import { useMouseTracker } from '../../EventsTrackers/MouseTracker.js';
6
+ import { useChartData } from '../../context/ChartContext.js';
7
+ import { useKeyModifiers } from '../../context/KeyModifierContext.tsx';
8
+ import type { IconDataContext, Tool } from '../../toolbar/ToolTypes.ts';
9
+ import { getToolIcon } from '../../toolbar/ToolTypes.ts';
10
+
11
+ const CursorWrapper = styled.div`
12
+ position: absolute;
13
+ top: 0;
14
+ left: 0;
15
+ pointer-events: none;
16
+ overflow: visible;
17
+ will-change: transform;
18
+ z-index: 99;
19
+ opacity: 0.5;
20
+ `;
21
+
22
+ export type CursorPlacement =
23
+ | 'top'
24
+ | 'bottom'
25
+ | 'left'
26
+ | 'right'
27
+ | 'top-left'
28
+ | 'top-right'
29
+ | 'bottom-left'
30
+ | 'bottom-right';
31
+
32
+ interface CursorHeaderProps {
33
+ placement?: CursorPlacement;
34
+ offset?: number;
35
+ size?: number;
36
+ }
37
+
38
+ function getCursorOffset(placement: CursorPlacement, offset: number) {
39
+ const x = placement.includes('left')
40
+ ? -offset
41
+ : placement.includes('right')
42
+ ? offset
43
+ : 0;
44
+ const y = placement.includes('top')
45
+ ? -offset
46
+ : placement.includes('bottom')
47
+ ? offset
48
+ : 0;
49
+ return { x, y };
50
+ }
51
+
52
+ interface ToolIconRendererProps extends IconDataContext {
53
+ toolId: Tool;
54
+ size?: number;
55
+ strokeWidth?: number;
56
+ }
57
+
58
+ function ToolIconRenderer(props: ToolIconRendererProps) {
59
+ const { toolId, size, strokeWidth, ...idc } = props;
60
+
61
+ const icon = getToolIcon(toolId, idc);
62
+ if (!icon) return null;
63
+ return createElement(icon, { fontSize: size, strokeWidth });
64
+ }
65
+ export function CursorToolIcon({
66
+ placement = 'bottom-right',
67
+ offset = 25,
68
+ size = 25,
69
+ }: CursorHeaderProps) {
70
+ const {
71
+ width,
72
+ height,
73
+ margin,
74
+ toolOptions: { selectedTool },
75
+ } = useChartData();
76
+ const mousePosition = useMouseTracker();
77
+ const { isPrimary, shiftKey } = useKeyModifiers();
78
+ if (
79
+ !mousePosition ||
80
+ !width ||
81
+ !height ||
82
+ mousePosition.x > width - margin.right ||
83
+ mousePosition.y > height - margin.bottom
84
+ ) {
85
+ return null;
86
+ }
87
+
88
+ const { x: offsetX, y: offsetY } = getCursorOffset(placement, offset);
89
+
90
+ const x = mousePosition.x + offsetX - size / 2;
91
+ const y = mousePosition.y + offsetY - size / 2;
92
+ const showRulerIcon = selectedTool === 'zoom' && shiftKey;
93
+
94
+ return (
95
+ <CursorWrapper
96
+ style={{
97
+ transform: `translate(${x}px, ${y}px)`,
98
+ }}
99
+ >
100
+ {showRulerIcon ? (
101
+ <TbRulerMeasure size={size} />
102
+ ) : (
103
+ <ToolIconRenderer
104
+ toolId={isPrimary ? selectedTool : 'zoom'}
105
+ size={size}
106
+ />
107
+ )}
108
+ </CursorWrapper>
109
+ );
110
+ }
@@ -1,11 +1,14 @@
1
1
  import type { Spectrum1D } from '@zakodium/nmrium-core';
2
- import { memo } from 'react';
2
+ import { memo, useRef } from 'react';
3
3
 
4
+ import { Signals1D } from '../../1d-2d/components/Signals1D.tsx';
4
5
  import { useChartData } from '../../context/ChartContext.js';
5
6
  import useXYReduce from '../../hooks/useXYReduce.js';
6
7
  import { PathBuilder } from '../../utility/PathBuilder.js';
7
8
  import { use1DTraceYScale, useScale2DY } from '../utilities/scale.js';
8
9
 
10
+ import { Ranges1D } from './Ranges1D.tsx';
11
+
9
12
  interface Left1DChartProps {
10
13
  horizontalMargin?: number;
11
14
  data: Spectrum1D;
@@ -44,10 +47,13 @@ function Left1DChart({
44
47
  data: spectrum,
45
48
  }: Left1DChartProps) {
46
49
  const { height, margin, displayerKey } = useChartData();
50
+ const svgRef = useRef<SVGSVGElement>(null);
51
+ const scale = useScale2DY();
47
52
 
48
53
  const width = margin.left;
49
54
 
50
55
  const path = usePath(spectrum, { horizontalMargin, width });
56
+ const ranges = spectrum.ranges.values;
51
57
 
52
58
  const innerHeight = height - margin.bottom - margin.top;
53
59
 
@@ -55,6 +61,8 @@ function Left1DChart({
55
61
 
56
62
  return (
57
63
  <svg
64
+ ref={svgRef}
65
+ style={{ overflow: 'visible' }}
58
66
  viewBox={`0 0 ${width} ${innerHeight + margin.top}`}
59
67
  width={width}
60
68
  height={innerHeight + margin.top}
@@ -63,6 +71,9 @@ function Left1DChart({
63
71
  <clipPath id={`${displayerKey}clip-left`}>
64
72
  <rect width={width} height={innerHeight} x="0" y={margin.top} />
65
73
  </clipPath>
74
+ <clipPath id={`${displayerKey}clip-left-ranges`}>
75
+ <rect width={width + 20} height={innerHeight} x="0" y={margin.top} />
76
+ </clipPath>
66
77
  </defs>
67
78
  <g clipPath={`url(#${displayerKey}clip-left)`}>
68
79
  <path
@@ -72,6 +83,20 @@ function Left1DChart({
72
83
  d={path}
73
84
  />
74
85
  </g>
86
+ <g clipPath={`url(#${displayerKey}clip-left-ranges)`}>
87
+ <Ranges1D
88
+ ranges={ranges}
89
+ orientation="vertical"
90
+ spectrumId={spectrum.id}
91
+ />
92
+ <Signals1D
93
+ ranges={ranges}
94
+ orientation="vertical"
95
+ spectrumId={spectrum.id}
96
+ scale={scale}
97
+ position={margin.left}
98
+ />
99
+ </g>
75
100
  </svg>
76
101
  );
77
102
  }
@@ -0,0 +1,38 @@
1
+ import type { Range } from '@zakodium/nmr-types';
2
+
3
+ import { getOpacityBasedOnSignalKind } from '../../../data/utilities/RangeUtilities.ts';
4
+ import { RangeIndicator } from '../../1d-2d/components/RangeIndicator.tsx';
5
+ import { useScale2DX, useScale2DY } from '../utilities/scale.js';
6
+
7
+ interface Ranges1DProps {
8
+ ranges: Range[];
9
+ orientation: 'horizontal' | 'vertical';
10
+ spectrumId: string;
11
+ }
12
+
13
+ export function Ranges1D(props: Ranges1DProps) {
14
+ const { ranges, orientation } = props;
15
+ const scaleX = useScale2DX();
16
+ const scaleY = useScale2DY();
17
+ const scale = orientation === 'horizontal' ? scaleX : scaleY;
18
+
19
+ return ranges.map((range) => {
20
+ const opacity = getOpacityBasedOnSignalKind(range);
21
+
22
+ const { from, to, id } = range;
23
+ const fromInPixel = scale(from);
24
+ const toInPixel = scale(to);
25
+ const start = Math.min(fromInPixel, toInPixel);
26
+ const size = Math.abs(fromInPixel - toInPixel);
27
+
28
+ return (
29
+ <RangeIndicator
30
+ orientation={orientation}
31
+ key={id}
32
+ position={start}
33
+ size={size}
34
+ opacity={opacity}
35
+ />
36
+ );
37
+ });
38
+ }