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
@@ -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, useScale2DX } from '../utilities/scale.js';
8
9
 
10
+ import { Ranges1D } from './Ranges1D.tsx';
11
+
9
12
  interface Top1DChartProps {
10
13
  verticalMargin?: number;
11
14
  data: Spectrum1D;
@@ -37,8 +40,11 @@ function usePath(spectrum: Spectrum1D, options: UsePathOptions) {
37
40
  function Top1DChart({ verticalMargin = 10, data: spectrum }: Top1DChartProps) {
38
41
  const { width, margin, displayerKey } = useChartData();
39
42
  const height = margin.top;
43
+ const svgRef = useRef<SVGSVGElement>(null);
44
+ const scale = useScale2DX();
40
45
 
41
46
  const path = usePath(spectrum, { height, verticalMargin });
47
+ const ranges = spectrum.ranges.values;
42
48
 
43
49
  if (!width || !height) {
44
50
  return null;
@@ -46,11 +52,20 @@ function Top1DChart({ verticalMargin = 10, data: spectrum }: Top1DChartProps) {
46
52
 
47
53
  const innerWidth = width - margin.left - margin.right;
48
54
  return (
49
- <svg viewBox={`0 0 ${width} ${height}`} width={width} height={height}>
55
+ <svg
56
+ ref={svgRef}
57
+ viewBox={`0 0 ${width} ${height}`}
58
+ width={width}
59
+ height={height}
60
+ style={{ overflow: 'visible' }}
61
+ >
50
62
  <defs>
51
63
  <clipPath id={`${displayerKey}clip-top`}>
52
64
  <rect width={innerWidth} height={height} x={margin.left} y="0" />
53
65
  </clipPath>
66
+ <clipPath id={`${displayerKey}clip-top-ranges`}>
67
+ <rect width={innerWidth} height={height + 20} x={margin.left} y="0" />
68
+ </clipPath>
54
69
  </defs>
55
70
  <g clipPath={`url(#${displayerKey}clip-top)`}>
56
71
  <path
@@ -61,6 +76,20 @@ function Top1DChart({ verticalMargin = 10, data: spectrum }: Top1DChartProps) {
61
76
  d={path}
62
77
  />
63
78
  </g>
79
+ <g clipPath={`url(#${displayerKey}clip-top-ranges)`}>
80
+ <Ranges1D
81
+ ranges={ranges}
82
+ orientation="horizontal"
83
+ spectrumId={spectrum.id}
84
+ />
85
+ <Signals1D
86
+ ranges={ranges}
87
+ orientation="horizontal"
88
+ spectrumId={spectrum.id}
89
+ scale={scale}
90
+ position={margin.top}
91
+ />
92
+ </g>
64
93
  </svg>
65
94
  );
66
95
  }
@@ -1,5 +1,6 @@
1
1
  import { memo, useRef } from 'react';
2
2
  import { useLinearPrimaryTicks } from 'react-d3-utils';
3
+ import { SVGStyledText } from 'react-science/ui';
3
4
 
4
5
  import { useIsInset } from '../1d/inset/InsetProvider.tsx';
5
6
  import { AxisUnitPicker } from '../1d-2d/components/axis_unit_picker.tsx';
@@ -8,6 +9,7 @@ import { D3Axis } from '../elements/D3Axis.js';
8
9
  import { useCheckExportStatus } from '../hooks/useViewportSize.tsx';
9
10
  import { axisUnitToLabel, useDirectAxisUnit } from '../hooks/use_axis_unit.ts';
10
11
  import { useGridline2DConfig } from '../hooks/use_gridlines_config.ts';
12
+ import { useTicksConfig } from '../hooks/use_ticks_config.ts';
11
13
 
12
14
  import { useScale2DX } from './utilities/scale.js';
13
15
 
@@ -93,11 +95,18 @@ interface UnitLabelProps {
93
95
  }
94
96
  function UnitLabel(props: UnitLabelProps) {
95
97
  const { width, children } = props;
96
-
98
+ const { labelStyle } = useTicksConfig();
97
99
  return (
98
- <text fill="#000" x={width - 60} y="20" dy="0.71em" textAnchor="end">
100
+ <SVGStyledText
101
+ fill="black"
102
+ x={width - 60}
103
+ y="20"
104
+ dy="0.71em"
105
+ textAnchor="end"
106
+ {...labelStyle}
107
+ >
99
108
  {children}
100
- </text>
109
+ </SVGStyledText>
101
110
  );
102
111
  }
103
112
 
@@ -1,5 +1,6 @@
1
1
  import { memo, useRef } from 'react';
2
2
  import { useLinearPrimaryTicks } from 'react-d3-utils';
3
+ import { SVGStyledText } from 'react-science/ui';
3
4
 
4
5
  import { useIsInset } from '../1d/inset/InsetProvider.tsx';
5
6
  import { AxisUnitPicker } from '../1d-2d/components/axis_unit_picker.tsx';
@@ -13,6 +14,7 @@ import {
13
14
  useIndirectAxisUnit,
14
15
  } from '../hooks/use_axis_unit.ts';
15
16
  import { useGridline2DConfig } from '../hooks/use_gridlines_config.ts';
17
+ import { useTicksConfig } from '../hooks/use_ticks_config.ts';
16
18
 
17
19
  import { useScale2DY } from './utilities/scale.js';
18
20
 
@@ -108,8 +110,8 @@ interface UnitLabelProps {
108
110
  }
109
111
  function UnitLabel(props: UnitLabelProps) {
110
112
  const { children } = props;
111
-
112
- const { getTextWidth } = useTextMetrics({ labelSize: 10 });
113
+ const { labelStyle } = useTicksConfig();
114
+ const { getTextWidth } = useTextMetrics({ labelSize: labelStyle.fontSize });
113
115
  const labelHeight = getTextWidth(children);
114
116
 
115
117
  return (
@@ -124,14 +126,16 @@ function UnitLabel(props: UnitLabelProps) {
124
126
  y={-5}
125
127
  opacity={0.8}
126
128
  />
127
- <text
128
- fill="#000"
129
+
130
+ <SVGStyledText
131
+ fill="black"
129
132
  transform="rotate(-90)"
130
133
  dominantBaseline="middle"
131
134
  textAnchor="end"
135
+ {...labelStyle}
132
136
  >
133
137
  {children}
134
- </text>
138
+ </SVGStyledText>
135
139
  </>
136
140
  );
137
141
  }
@@ -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 Spinner from '../loader/Spinner.js';
@@ -60,8 +61,10 @@ function Viewer2D(props: Viewer2DProps) {
60
61
  selectedTool === options.phaseCorrectionTwoDimensions.id && (
61
62
  <PhaseTraces />
62
63
  )}
63
-
64
- <CrossLinePointer />
64
+ <CursorToolIcon />
65
+ <CrossLinePointer axis="X" dimensionBorder={DIMENSION.TOP} />
66
+ <CrossLinePointer axis="Y" dimensionBorder={DIMENSION.LEFT} />
67
+ <CrossLinePointer axis="XY" dimensionBorder={DIMENSION.MAIN} />
65
68
  <XYLabelPointer data1D={spectrumData} layout={DIMENSION} />
66
69
 
67
70
  <>
@@ -24,6 +24,7 @@ export function FTContainer(props: FTContainerProps) {
24
24
  <>
25
25
  {spectra.x && <Top1DChart data={spectra.x} />}
26
26
  {spectra.y && <Left1DChart data={spectra.y} />}
27
+
27
28
  <ClipPathContainer>
28
29
  <Contours />
29
30
  </ClipPathContainer>
@@ -0,0 +1,369 @@
1
+ import type { CSSProperties, KeyboardEvent, MouseEvent } from 'react';
2
+ import { useRef, useState } from 'react';
3
+
4
+ type CursorOrientation = 'horizontal' | 'vertical';
5
+
6
+ const CUR_MOVE = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='12' viewBox='0 0 22 12'%3E%3Cpath d='M1 6h20M1 6l4-4M1 6l4 4M21 6l-4-4M21 6l-4 4' fill='none' stroke='black' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 11 6, ew-resize`;
7
+ const CUR_MOVE_VERTICAL = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='22' viewBox='0 0 12 22'%3E%3Cpath d='M6 1v20M6 1l-4 4M6 1l4 4M6 21l-4-4M6 21l4-4' fill='none' stroke='black' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 6 11, ns-resize`;
8
+ type AnchorShape = 'diamond' | 'circle' | 'square' | 'triangle';
9
+
10
+ interface AnchorStyle {
11
+ size?: number;
12
+ hoverSize?: number;
13
+ dragSize?: number;
14
+ fill?: string;
15
+ stroke?: string;
16
+ hoverFill?: string;
17
+ hoverStroke?: string;
18
+ dragFill?: string;
19
+ dragStroke?: string;
20
+ strokeWidth?: number;
21
+ guideColor?: string;
22
+ guideDragColor?: string;
23
+ guideStyle?: 'solid' | 'dashed' | 'dotted';
24
+ }
25
+
26
+ interface AnchorPosition {
27
+ x: number;
28
+ y: number;
29
+ }
30
+
31
+ interface AnchorProps {
32
+ position: AnchorPosition;
33
+ shape?: AnchorShape;
34
+ svgHeight: number;
35
+ anchorStyle?: AnchorStyle;
36
+ restoreFocusOnLeave?: boolean;
37
+ onDragMove?: (newPosition: AnchorPosition) => void;
38
+ onDragEnd?: (lastPosition: AnchorPosition) => void;
39
+ onDragStart?: (position: AnchorPosition) => void;
40
+ onDelete?: () => void;
41
+ cursorOrientation?: CursorOrientation;
42
+ }
43
+
44
+ interface DragState {
45
+ startX: number;
46
+ startY: number;
47
+ startAnchorX: number;
48
+ startAnchorY: number;
49
+ }
50
+
51
+ type InteractionState = 'idle' | 'hovered' | 'dragging';
52
+
53
+ interface VisualTokens {
54
+ fill: string;
55
+ stroke: string;
56
+ cursor: string;
57
+ }
58
+
59
+ function resolveVisuals(
60
+ state: InteractionState,
61
+ idleFill: string,
62
+ idleStroke: string,
63
+ hoverFill: string,
64
+ hoverStroke: string,
65
+ dragFill: string,
66
+ dragStroke: string,
67
+ cursorOrientation: CursorOrientation,
68
+ ): VisualTokens {
69
+ const cursor =
70
+ cursorOrientation === 'horizontal' ? CUR_MOVE : CUR_MOVE_VERTICAL;
71
+ if (state === 'dragging') {
72
+ return {
73
+ fill: dragFill,
74
+ stroke: dragStroke,
75
+ cursor,
76
+ };
77
+ }
78
+
79
+ if (state === 'hovered') {
80
+ return {
81
+ fill: hoverFill,
82
+ stroke: hoverStroke,
83
+ cursor,
84
+ };
85
+ }
86
+
87
+ return {
88
+ fill: idleFill,
89
+ stroke: idleStroke,
90
+ cursor: 'default',
91
+ };
92
+ }
93
+
94
+ function clientToSvg(
95
+ event: MouseEvent<SVGGElement>,
96
+ svg: SVGSVGElement | null,
97
+ ): { x: number; y: number } {
98
+ const { clientX, clientY } = event;
99
+ if (!svg) return { x: clientX, y: clientY };
100
+
101
+ const pt = svg.createSVGPoint();
102
+ pt.x = clientX;
103
+ pt.y = clientY;
104
+
105
+ const ctm = svg.getScreenCTM();
106
+
107
+ if (!ctm) return { x: clientX, y: clientY };
108
+
109
+ return pt.matrixTransform(ctm.inverse());
110
+ }
111
+
112
+ interface ShapeRendererProps {
113
+ shape?: AnchorShape;
114
+ fill: string;
115
+ stroke: string;
116
+ strokeWidth: number;
117
+ size: number;
118
+ }
119
+
120
+ function ShapeRenderer({
121
+ shape,
122
+ fill,
123
+ stroke,
124
+ strokeWidth,
125
+ size,
126
+ }: ShapeRendererProps) {
127
+ const half = size / 2;
128
+ const inset = strokeWidth / 2;
129
+
130
+ const common: CSSProperties = {
131
+ filter: 'drop-shadow(0 2px 4px rgba(0,0,0,.14))',
132
+ pointerEvents: 'all',
133
+ };
134
+
135
+ if (shape === 'circle') {
136
+ return (
137
+ <circle
138
+ cx={0}
139
+ cy={0}
140
+ r={half - inset}
141
+ fill={fill}
142
+ stroke={stroke}
143
+ strokeWidth={strokeWidth}
144
+ style={common}
145
+ />
146
+ );
147
+ }
148
+
149
+ if (shape === 'diamond') {
150
+ return (
151
+ <polygon
152
+ points={`
153
+ 0,-${half - inset}
154
+ ${half - inset},0
155
+ 0,${half - inset}
156
+ -${half - inset},0
157
+ `}
158
+ fill={fill}
159
+ stroke={stroke}
160
+ strokeWidth={strokeWidth}
161
+ strokeLinejoin="round"
162
+ style={common}
163
+ />
164
+ );
165
+ }
166
+
167
+ if (shape === 'triangle') {
168
+ return (
169
+ <polygon
170
+ points={`
171
+ 0,-${half - inset}
172
+ ${half - inset},${half - inset}
173
+ -${half - inset},${half - inset}
174
+ `}
175
+ fill={fill}
176
+ stroke={stroke}
177
+ strokeWidth={strokeWidth}
178
+ strokeLinejoin="round"
179
+ style={common}
180
+ />
181
+ );
182
+ }
183
+
184
+ return (
185
+ <rect
186
+ x={-half + inset}
187
+ y={-half + inset}
188
+ width={size - strokeWidth}
189
+ height={size - strokeWidth}
190
+ rx={1}
191
+ fill={fill}
192
+ stroke={stroke}
193
+ strokeWidth={strokeWidth}
194
+ style={common}
195
+ />
196
+ );
197
+ }
198
+
199
+ export function Anchor(props: AnchorProps) {
200
+ const {
201
+ position,
202
+ shape,
203
+ svgHeight,
204
+ anchorStyle = {},
205
+ restoreFocusOnLeave = false,
206
+ onDragStart,
207
+ onDragMove,
208
+ onDragEnd,
209
+ onDelete,
210
+ cursorOrientation = 'horizontal',
211
+ } = props;
212
+ const {
213
+ size = 16,
214
+ hoverSize = size,
215
+ dragSize = size,
216
+ fill: idleFill = '#ffffff',
217
+ stroke: idleStroke = '#d1d5db',
218
+ hoverFill = '#f3f4f6',
219
+ hoverStroke = '#9ca3af',
220
+ dragFill = '#f3f4f6',
221
+ dragStroke = '#6b7280',
222
+ strokeWidth = 1,
223
+ guideColor = 'rgba(156,163,175,0.6)',
224
+ guideDragColor = 'rgba(107,114,128,0.8)',
225
+ guideStyle = 'solid',
226
+ } = anchorStyle;
227
+
228
+ const [hovered, setHovered] = useState(false);
229
+ const [dragging, setDragging] = useState(false);
230
+
231
+ const dragState = useRef<DragState | null>(null);
232
+ const prevFocus = useRef<Element | null>(null);
233
+
234
+ const interactionState: InteractionState = dragging
235
+ ? 'dragging'
236
+ : hovered
237
+ ? 'hovered'
238
+ : 'idle';
239
+
240
+ const { fill, stroke, cursor } = resolveVisuals(
241
+ interactionState,
242
+ idleFill,
243
+ idleStroke,
244
+ hoverFill,
245
+ hoverStroke,
246
+ dragFill,
247
+ dragStroke,
248
+ cursorOrientation,
249
+ );
250
+
251
+ function handleMouseDown(e: MouseEvent<SVGGElement>) {
252
+ e.preventDefault();
253
+ setDragging(true);
254
+
255
+ const svg = e.currentTarget.ownerSVGElement;
256
+
257
+ const { x, y } = clientToSvg(e, svg);
258
+ dragState.current = {
259
+ startX: x,
260
+ startY: y,
261
+ startAnchorX: position.x,
262
+ startAnchorY: position.y,
263
+ };
264
+ onDragStart?.(position);
265
+ const onMove = (e: globalThis.MouseEvent) => {
266
+ const current = dragState.current;
267
+ if (!current) return;
268
+ const { x, y } = clientToSvg(
269
+ e as unknown as MouseEvent<SVGGElement>,
270
+ svg,
271
+ );
272
+ const newX = current.startAnchorX + x - current.startX;
273
+ const newY = current.startAnchorY + y - current.startY;
274
+
275
+ onDragMove?.({ x: newX, y: newY });
276
+ };
277
+
278
+ const onUp = () => {
279
+ setDragging(false);
280
+ dragState.current = null;
281
+ onDragEnd?.({ x: position.x, y: position.y });
282
+
283
+ window.removeEventListener('mousemove', onMove);
284
+ window.removeEventListener('mouseup', onUp);
285
+ };
286
+
287
+ window.addEventListener('mousemove', onMove);
288
+ window.addEventListener('mouseup', onUp);
289
+ }
290
+
291
+ function handleKeyDown(e: KeyboardEvent<SVGGElement>) {
292
+ if (e.key === 'Delete' || e.key === 'Backspace') {
293
+ e.preventDefault();
294
+ onDelete?.();
295
+ }
296
+ }
297
+
298
+ function handleMouseEnter(e: MouseEvent<SVGGElement>) {
299
+ setHovered(true);
300
+ prevFocus.current = document.activeElement;
301
+ e.currentTarget.focus();
302
+ }
303
+
304
+ function handleMouseLeave(e: MouseEvent<SVGGElement>) {
305
+ setHovered(false);
306
+
307
+ if (restoreFocusOnLeave && prevFocus.current instanceof HTMLElement) {
308
+ prevFocus.current.focus();
309
+ } else {
310
+ e.currentTarget.blur();
311
+ }
312
+
313
+ prevFocus.current = null;
314
+ }
315
+
316
+ return (
317
+ <>
318
+ {(hovered || dragging) && (
319
+ <line
320
+ x1={position.x}
321
+ y1={0}
322
+ x2={position.x}
323
+ y2={svgHeight}
324
+ stroke={dragging ? guideDragColor : guideColor}
325
+ strokeWidth={1}
326
+ strokeDasharray={
327
+ guideStyle === 'dashed'
328
+ ? '6 4'
329
+ : guideStyle === 'dotted'
330
+ ? '1 3'
331
+ : undefined
332
+ }
333
+ pointerEvents="none"
334
+ />
335
+ )}
336
+
337
+ <g
338
+ transform={`translate(${position.x} ${position.y})`}
339
+ style={{
340
+ cursor,
341
+ outline: 'none',
342
+ }}
343
+ tabIndex={0}
344
+ data-self-control="true"
345
+ onMouseDown={handleMouseDown}
346
+ onMouseEnter={handleMouseEnter}
347
+ onMouseLeave={handleMouseLeave}
348
+ onKeyDown={handleKeyDown}
349
+ >
350
+ {(hovered || dragging) && (
351
+ <circle
352
+ r={(hovered ? hoverSize : dragSize) * 1.5}
353
+ fill={stroke}
354
+ opacity={dragging ? 0.2 : 0.15}
355
+ pointerEvents="none"
356
+ />
357
+ )}
358
+
359
+ <ShapeRenderer
360
+ shape={shape}
361
+ fill={fill}
362
+ stroke={stroke}
363
+ strokeWidth={strokeWidth}
364
+ size={hovered ? hoverSize : dragging ? dragSize : size}
365
+ />
366
+ </g>
367
+ </>
368
+ );
369
+ }
@@ -134,7 +134,9 @@ interface BrushTrackerProps {
134
134
  brushDetectionOptions?: BaseDetectBrushingOptions;
135
135
  clickTriggerMode?: 'native' | 'debounced';
136
136
  }
137
-
137
+ function isSelfControlledTarget(target: EventTarget) {
138
+ return (target as Element).closest('[data-self-control="true"]') !== null;
139
+ }
138
140
  function getMouseXY(event: MouseEvent, currentTarget?: Element) {
139
141
  const boundingRect = (
140
142
  currentTarget ?? event.currentTarget
@@ -169,6 +171,7 @@ export function BrushTracker(options: BrushTrackerProps) {
169
171
  const boundingRectRef = useRef<DOMRect | null>(null);
170
172
  const startPositionRef = useRef<Position>({ x: 0, y: 0 });
171
173
  const lastRef = useRef<Position>({ x: 0, y: 0 });
174
+ const isSelfControlledRef = useRef(false);
172
175
 
173
176
  const handleClickWithDebounce = useCallback(
174
177
  (event: MouseEvent, currentTarget: Element) => {
@@ -199,22 +202,39 @@ export function BrushTracker(options: BrushTrackerProps) {
199
202
  );
200
203
 
201
204
  function handleClick(event: MouseEvent) {
202
- if (isDraggingRef.current || clickTriggerMode !== 'native') return;
205
+ if (
206
+ isDraggingRef.current ||
207
+ clickTriggerMode !== 'native' ||
208
+ isSelfControlledRef.current
209
+ ) {
210
+ return;
211
+ }
212
+
203
213
  const { x, y } = getMouseXY(event);
204
214
  onClick({ ...event, x, y });
205
215
  }
206
216
 
207
217
  function handleDoubleClick(event: MouseEvent) {
208
- if (isDraggingRef.current || clickTriggerMode !== 'native') return;
209
-
218
+ if (
219
+ isDraggingRef.current ||
220
+ clickTriggerMode !== 'native' ||
221
+ isSelfControlledRef.current
222
+ ) {
223
+ return;
224
+ }
210
225
  const { x, y } = getMouseXY(event);
211
226
  onDoubleClick({ ...event, x, y });
212
227
  }
213
-
214
228
  const pointerDownHandler = useCallback(
215
229
  (event: PointerEvent) => {
216
230
  event.persist();
217
231
  const currentTarget = event.currentTarget;
232
+ isSelfControlledRef.current = isSelfControlledTarget(event.target);
233
+
234
+ if (isSelfControlledRef.current) {
235
+ return;
236
+ }
237
+
218
238
  isDraggingRef.current = false; // Reset dragging flag
219
239
 
220
240
  //check that the right or left mouse button pressed
@@ -23,12 +23,33 @@ interface MouseTrackerProps {
23
23
  noPropagation?: boolean;
24
24
  }
25
25
 
26
+ const disableMouseAttribute = 'data-disable-mouse-tracking' as const;
27
+
28
+ function isMouseTrackingDisabled(target: EventTarget) {
29
+ return (
30
+ (target as Element).closest(`[${CSS.escape(disableMouseAttribute)}]`) !==
31
+ null
32
+ );
33
+ }
34
+
35
+ export const disableMouseTrackingProps = {
36
+ [disableMouseAttribute]: true,
37
+ } as const;
38
+
26
39
  export function MouseTracker(props: MouseTrackerProps) {
27
40
  const { children, className, style, noPropagation } = props;
28
41
  const [mouseTrackerState, setMouseTrackerState] =
29
42
  useState<MouseTrackerData | null>(null);
30
43
  const mouseMoveHandler = useCallback(
31
44
  (event: MouseEvent) => {
45
+ if (isMouseTrackingDisabled(event.target)) {
46
+ setMouseTrackerState(null);
47
+ if (noPropagation) {
48
+ event.stopPropagation();
49
+ }
50
+ return;
51
+ }
52
+
32
53
  const boundingRect = event.currentTarget.getBoundingClientRect();
33
54
  const x = event.clientX - boundingRect.x;
34
55
  const y = event.clientY - boundingRect.y;