nmrium 1.9.0 → 1.10.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 (472) hide show
  1. package/lib/component/1d/ApodizationLine.js +1 -1
  2. package/lib/component/1d/ApodizationLine.js.map +1 -1
  3. package/lib/component/1d/BrushTracker1D.d.ts.map +1 -1
  4. package/lib/component/1d/BrushTracker1D.js.map +1 -1
  5. package/lib/component/1d/FooterBanner.js.map +1 -1
  6. package/lib/component/1d/LinesSeries.js +2 -2
  7. package/lib/component/1d/LinesSeries.js.map +1 -1
  8. package/lib/component/1d/SVGContent1D.d.ts.map +1 -1
  9. package/lib/component/1d/SVGContent1D.js +2 -1
  10. package/lib/component/1d/SVGContent1D.js.map +1 -1
  11. package/lib/component/1d/SimilarityTree.d.ts.map +1 -1
  12. package/lib/component/1d/SimilarityTree.js.map +1 -1
  13. package/lib/component/1d/inset/InsetProvider.d.ts.map +1 -1
  14. package/lib/component/1d/inset/InsetProvider.js.map +1 -1
  15. package/lib/component/1d/integral/IntegralResizable.d.ts.map +1 -1
  16. package/lib/component/1d/integral/IntegralResizable.js.map +1 -1
  17. package/lib/component/1d/matrix/Boxplot.js.map +1 -1
  18. package/lib/component/1d/multiAnalysis/AnalysisRange.d.ts.map +1 -1
  19. package/lib/component/1d/multiAnalysis/AnalysisRange.js.map +1 -1
  20. package/lib/component/1d/multiplicityTree/MultiplicityTree.d.ts.map +1 -1
  21. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +13 -20
  22. package/lib/component/1d/multiplicityTree/MultiplicityTree.js.map +1 -1
  23. package/lib/component/1d/multiplicityTree/generateTreeNodes.d.ts +1 -0
  24. package/lib/component/1d/multiplicityTree/generateTreeNodes.d.ts.map +1 -1
  25. package/lib/component/1d/multiplicityTree/generateTreeNodes.js +2 -1
  26. package/lib/component/1d/multiplicityTree/generateTreeNodes.js.map +1 -1
  27. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts.map +1 -1
  28. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js.map +1 -1
  29. package/lib/component/1d/peaks/PeakEditionManager.d.ts.map +1 -1
  30. package/lib/component/1d/peaks/PeakEditionManager.js +2 -2
  31. package/lib/component/1d/peaks/PeakEditionManager.js.map +1 -1
  32. package/lib/component/1d/peaks/Peaks.d.ts +4 -1
  33. package/lib/component/1d/peaks/Peaks.d.ts.map +1 -1
  34. package/lib/component/1d/peaks/Peaks.js.map +1 -1
  35. package/lib/component/1d/ranges/AssignmentLabel.d.ts +2 -1
  36. package/lib/component/1d/ranges/AssignmentLabel.d.ts.map +1 -1
  37. package/lib/component/1d/ranges/AssignmentLabel.js +6 -4
  38. package/lib/component/1d/ranges/AssignmentLabel.js.map +1 -1
  39. package/lib/component/1d/ranges/Atoms.js +2 -2
  40. package/lib/component/1d/ranges/Atoms.js.map +1 -1
  41. package/lib/component/1d/ranges/Range.d.ts +2 -1
  42. package/lib/component/1d/ranges/Range.d.ts.map +1 -1
  43. package/lib/component/1d/ranges/Range.js +28 -56
  44. package/lib/component/1d/ranges/Range.js.map +1 -1
  45. package/lib/component/1d/ranges/Ranges.d.ts.map +1 -1
  46. package/lib/component/1d/ranges/Ranges.js +19 -13
  47. package/lib/component/1d/ranges/Ranges.js.map +1 -1
  48. package/lib/component/1d/ranges/useAssignmentsPopoverActionsButtons.d.ts +14 -0
  49. package/lib/component/1d/ranges/useAssignmentsPopoverActionsButtons.d.ts.map +1 -0
  50. package/lib/component/1d/ranges/useAssignmentsPopoverActionsButtons.js +67 -0
  51. package/lib/component/1d/ranges/useAssignmentsPopoverActionsButtons.js.map +1 -0
  52. package/lib/component/1d/tool/BaseLineZones.d.ts.map +1 -1
  53. package/lib/component/1d/tool/BaseLineZones.js.map +1 -1
  54. package/lib/component/1d/utilities/intersectionResolver.d.ts.map +1 -1
  55. package/lib/component/1d/utilities/intersectionResolver.js.map +1 -1
  56. package/lib/component/1d-2d/FieldEdition.d.ts.map +1 -1
  57. package/lib/component/1d-2d/FieldEdition.js.map +1 -1
  58. package/lib/component/2d/1d-tracer/VerticalSliceChart.js.map +1 -1
  59. package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraces.js +1 -1
  60. package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraces.js.map +1 -1
  61. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js +1 -1
  62. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js.map +1 -1
  63. package/lib/component/2d/BrushTracker2D.d.ts.map +1 -1
  64. package/lib/component/2d/BrushTracker2D.js +41 -46
  65. package/lib/component/2d/BrushTracker2D.js.map +1 -1
  66. package/lib/component/2d/FooterBanner.d.ts +2 -2
  67. package/lib/component/2d/FooterBanner.d.ts.map +1 -1
  68. package/lib/component/2d/FooterBanner.js +63 -97
  69. package/lib/component/2d/FooterBanner.js.map +1 -1
  70. package/lib/component/2d/SVGContent2D.d.ts +2 -2
  71. package/lib/component/2d/SVGContent2D.d.ts.map +1 -1
  72. package/lib/component/2d/SVGContent2D.js.map +1 -1
  73. package/lib/component/2d/SlicingView.js +1 -1
  74. package/lib/component/2d/SlicingView.js.map +1 -1
  75. package/lib/component/2d/Viewer2D.js +1 -1
  76. package/lib/component/2d/Viewer2D.js.map +1 -1
  77. package/lib/component/2d/ft/FTContainer.d.ts +2 -2
  78. package/lib/component/2d/ft/FTContainer.d.ts.map +1 -1
  79. package/lib/component/2d/ft/FTContainer.js +1 -1
  80. package/lib/component/2d/ft/FTContainer.js.map +1 -1
  81. package/lib/component/2d/tools/XYLabelPointer.d.ts +2 -2
  82. package/lib/component/2d/tools/XYLabelPointer.d.ts.map +1 -1
  83. package/lib/component/2d/tools/XYLabelPointer.js +10 -9
  84. package/lib/component/2d/tools/XYLabelPointer.js.map +1 -1
  85. package/lib/component/2d/useTracesSpectra.d.ts +3 -2
  86. package/lib/component/2d/useTracesSpectra.d.ts.map +1 -1
  87. package/lib/component/2d/useTracesSpectra.js +16 -10
  88. package/lib/component/2d/useTracesSpectra.js.map +1 -1
  89. package/lib/component/2d/utilities/extractSpectrumSignals.js +2 -2
  90. package/lib/component/2d/utilities/extractSpectrumSignals.js.map +1 -1
  91. package/lib/component/2d/zones/Signal.js.map +1 -1
  92. package/lib/component/2d/zones/SignalsGuideLines.d.ts.map +1 -1
  93. package/lib/component/2d/zones/SignalsGuideLines.js +15 -13
  94. package/lib/component/2d/zones/SignalsGuideLines.js.map +1 -1
  95. package/lib/component/2d/zones/ZonesAssignmentsLabels.js +1 -1
  96. package/lib/component/2d/zones/ZonesAssignmentsLabels.js.map +1 -1
  97. package/lib/component/EventsTrackers/BrushTracker.d.ts +5 -6
  98. package/lib/component/EventsTrackers/BrushTracker.d.ts.map +1 -1
  99. package/lib/component/EventsTrackers/BrushTracker.js +2 -0
  100. package/lib/component/EventsTrackers/BrushTracker.js.map +1 -1
  101. package/lib/component/assignment/utilities/getAssignments.js +1 -2
  102. package/lib/component/assignment/utilities/getAssignments.js.map +1 -1
  103. package/lib/component/context/KeyModifierContext.d.ts +3 -2
  104. package/lib/component/context/KeyModifierContext.d.ts.map +1 -1
  105. package/lib/component/context/KeyModifierContext.js +7 -4
  106. package/lib/component/context/KeyModifierContext.js.map +1 -1
  107. package/lib/component/elements/ActionsButtonsPopover.d.ts.map +1 -1
  108. package/lib/component/elements/ActionsButtonsPopover.js +17 -3
  109. package/lib/component/elements/ActionsButtonsPopover.js.map +1 -1
  110. package/lib/component/elements/AssignmentsCell.d.ts.map +1 -1
  111. package/lib/component/elements/AssignmentsCell.js.map +1 -1
  112. package/lib/component/elements/Button.d.ts.map +1 -1
  113. package/lib/component/elements/Button.js.map +1 -1
  114. package/lib/component/elements/CheckController.d.ts.map +1 -1
  115. package/lib/component/elements/CheckController.js.map +1 -1
  116. package/lib/component/elements/ContextMenuBluePrint.d.ts.map +1 -1
  117. package/lib/component/elements/ContextMenuBluePrint.js.map +1 -1
  118. package/lib/component/elements/D3Axis.d.ts.map +1 -1
  119. package/lib/component/elements/DraggableDialog.d.ts.map +1 -1
  120. package/lib/component/elements/DraggableDialog.js.map +1 -1
  121. package/lib/component/elements/Input.d.ts.map +1 -1
  122. package/lib/component/elements/Input.js.map +1 -1
  123. package/lib/component/elements/Input2.d.ts.map +1 -1
  124. package/lib/component/elements/Input2.js.map +1 -1
  125. package/lib/component/elements/Input2Controller.d.ts.map +1 -1
  126. package/lib/component/elements/Input2Controller.js.map +1 -1
  127. package/lib/component/elements/Label.d.ts.map +1 -1
  128. package/lib/component/elements/Label.js.map +1 -1
  129. package/lib/component/elements/NumberInput2.d.ts.map +1 -1
  130. package/lib/component/elements/NumberInput2.js.map +1 -1
  131. package/lib/component/elements/NumberInput2Controller.d.ts.map +1 -1
  132. package/lib/component/elements/NumberInput2Controller.js.map +1 -1
  133. package/lib/component/elements/ReactTable/ReactTable.d.ts.map +1 -1
  134. package/lib/component/elements/ReactTable/ReactTable.js.map +1 -1
  135. package/lib/component/elements/ReadOnly.d.ts.map +1 -1
  136. package/lib/component/elements/ReadOnly.js.map +1 -1
  137. package/lib/component/elements/Sections.js.map +1 -1
  138. package/lib/component/elements/Select.d.ts.map +1 -1
  139. package/lib/component/elements/Select.js.map +1 -1
  140. package/lib/component/elements/ToolbarPopoverItem.d.ts.map +1 -1
  141. package/lib/component/elements/export/ExportContent.d.ts.map +1 -1
  142. package/lib/component/elements/export/ExportContent.js.map +1 -1
  143. package/lib/component/elements/print/PrintContent.d.ts.map +1 -1
  144. package/lib/component/elements/print/PrintContent.js.map +1 -1
  145. package/lib/component/hooks/useActiveSpectrumIntegralsViewState.d.ts.map +1 -1
  146. package/lib/component/hooks/useActiveSpectrumIntegralsViewState.js +2 -4
  147. package/lib/component/hooks/useActiveSpectrumIntegralsViewState.js.map +1 -1
  148. package/lib/component/hooks/useActiveSpectrumPeaksViewState.d.ts.map +1 -1
  149. package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +2 -4
  150. package/lib/component/hooks/useActiveSpectrumPeaksViewState.js.map +1 -1
  151. package/lib/component/hooks/useActiveSpectrumRangesViewState.d.ts.map +1 -1
  152. package/lib/component/hooks/useActiveSpectrumRangesViewState.js +2 -4
  153. package/lib/component/hooks/useActiveSpectrumRangesViewState.js.map +1 -1
  154. package/lib/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
  155. package/lib/component/hooks/useActiveSpectrumStyleOptions.js.map +1 -1
  156. package/lib/component/hooks/useActiveSpectrumZonesViewState.d.ts.map +1 -1
  157. package/lib/component/hooks/useActiveSpectrumZonesViewState.js +2 -4
  158. package/lib/component/hooks/useActiveSpectrumZonesViewState.js.map +1 -1
  159. package/lib/component/hooks/useExport.js +1 -1
  160. package/lib/component/hooks/useExport.js.map +1 -1
  161. package/lib/component/hooks/useSaveSettings.d.ts.map +1 -1
  162. package/lib/component/hooks/useSaveSettings.js +28 -47
  163. package/lib/component/hooks/useSaveSettings.js.map +1 -1
  164. package/lib/component/hooks/useSetActiveSpectrumAction.d.ts +2 -1
  165. package/lib/component/hooks/useSetActiveSpectrumAction.d.ts.map +1 -1
  166. package/lib/component/hooks/useSetActiveSpectrumAction.js +2 -2
  167. package/lib/component/hooks/useSetActiveSpectrumAction.js.map +1 -1
  168. package/lib/component/hooks/useSpectrumWithDataSource.js +1 -1
  169. package/lib/component/hooks/useSpectrumWithDataSource.js.map +1 -1
  170. package/lib/component/hooks/useWorkspaceAction.d.ts +1 -1
  171. package/lib/component/hooks/useWorkspaceAction.d.ts.map +1 -1
  172. package/lib/component/hooks/useWorkspaceAction.js +3 -0
  173. package/lib/component/hooks/useWorkspaceAction.js.map +1 -1
  174. package/lib/component/modal/ImportPublicationStringModal.d.ts.map +1 -1
  175. package/lib/component/modal/ImportPublicationStringModal.js.map +1 -1
  176. package/lib/component/modal/changeSum/ChangeSumModal.d.ts.map +1 -1
  177. package/lib/component/modal/changeSum/ChangeSumModal.js.map +1 -1
  178. package/lib/component/modal/metaImportation/MetaImportationModal.d.ts.map +1 -1
  179. package/lib/component/modal/metaImportation/MetaImportationModal.js.map +1 -1
  180. package/lib/component/modal/setting/GeneralSettings.d.ts.map +1 -1
  181. package/lib/component/modal/setting/GeneralSettings.js +5 -1
  182. package/lib/component/modal/setting/GeneralSettings.js.map +1 -1
  183. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts.map +1 -1
  184. package/lib/component/panels/IntegralsPanel/IntegralTable.js.map +1 -1
  185. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +1 -1
  186. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts.map +1 -1
  187. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +14 -10
  188. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js.map +1 -1
  189. package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.d.ts.map +1 -1
  190. package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js +27 -18
  191. package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js.map +1 -1
  192. package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.d.ts.map +1 -1
  193. package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.js +0 -3
  194. package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.js.map +1 -1
  195. package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
  196. package/lib/component/panels/RangesPanel/RangesPanel.js.map +1 -1
  197. package/lib/component/panels/RangesPanel/RangesTable.d.ts.map +1 -1
  198. package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
  199. package/lib/component/panels/RangesPanel/RangesTable.js.map +1 -1
  200. package/lib/component/panels/RangesPanel/RangesTableRow.d.ts.map +1 -1
  201. package/lib/component/panels/RangesPanel/RangesTableRow.js +5 -20
  202. package/lib/component/panels/RangesPanel/RangesTableRow.js.map +1 -1
  203. package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.d.ts.map +1 -1
  204. package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js.map +1 -1
  205. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentColumn.d.ts +9 -0
  206. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentColumn.d.ts.map +1 -0
  207. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentColumn.js +19 -0
  208. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentColumn.js.map +1 -0
  209. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts.map +1 -1
  210. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.js.map +1 -1
  211. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +2 -2
  212. package/lib/component/panels/SummaryPanel/SummaryPanel.js +6 -6
  213. package/lib/component/panels/SummaryPanel/SummaryPanel.js.map +1 -1
  214. package/lib/component/panels/accordionItems.d.ts.map +1 -1
  215. package/lib/component/panels/accordionItems.js.map +1 -1
  216. package/lib/component/panels/extra/preferences/NucleusPreferences.d.ts.map +1 -1
  217. package/lib/component/panels/informationPanel/InformationEditionModal.d.ts.map +1 -1
  218. package/lib/component/panels/informationPanel/InformationEditionModal.js.map +1 -1
  219. package/lib/component/panels/predictionPanel/PredictionPanel.d.ts.map +1 -1
  220. package/lib/component/panels/predictionPanel/PredictionPanel.js +13 -9
  221. package/lib/component/panels/predictionPanel/PredictionPanel.js.map +1 -1
  222. package/lib/component/reducer/Reducer.js +7 -7
  223. package/lib/component/reducer/Reducer.js.map +1 -1
  224. package/lib/component/reducer/actions/AssignmentsActions.d.ts.map +1 -1
  225. package/lib/component/reducer/actions/AssignmentsActions.js +9 -9
  226. package/lib/component/reducer/actions/AssignmentsActions.js.map +1 -1
  227. package/lib/component/reducer/actions/CorrelationsActions.d.ts.map +1 -1
  228. package/lib/component/reducer/actions/CorrelationsActions.js +21 -21
  229. package/lib/component/reducer/actions/CorrelationsActions.js.map +1 -1
  230. package/lib/component/reducer/actions/DatabaseActions.js +1 -1
  231. package/lib/component/reducer/actions/DatabaseActions.js.map +1 -1
  232. package/lib/component/reducer/actions/DomainActions.d.ts.map +1 -1
  233. package/lib/component/reducer/actions/DomainActions.js +10 -18
  234. package/lib/component/reducer/actions/DomainActions.js.map +1 -1
  235. package/lib/component/reducer/actions/FiltersActions.d.ts.map +1 -1
  236. package/lib/component/reducer/actions/FiltersActions.js +28 -44
  237. package/lib/component/reducer/actions/FiltersActions.js.map +1 -1
  238. package/lib/component/reducer/actions/InsetActions.d.ts.map +1 -1
  239. package/lib/component/reducer/actions/InsetActions.js +9 -18
  240. package/lib/component/reducer/actions/InsetActions.js.map +1 -1
  241. package/lib/component/reducer/actions/IntegralsActions.d.ts +1 -1
  242. package/lib/component/reducer/actions/IntegralsActions.d.ts.map +1 -1
  243. package/lib/component/reducer/actions/IntegralsActions.js +43 -48
  244. package/lib/component/reducer/actions/IntegralsActions.js.map +1 -1
  245. package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -1
  246. package/lib/component/reducer/actions/MoleculeActions.d.ts.map +1 -1
  247. package/lib/component/reducer/actions/MoleculeActions.js +64 -10
  248. package/lib/component/reducer/actions/MoleculeActions.js.map +1 -1
  249. package/lib/component/reducer/actions/PeaksActions.d.ts.map +1 -1
  250. package/lib/component/reducer/actions/PeaksActions.js +110 -121
  251. package/lib/component/reducer/actions/PeaksActions.js.map +1 -1
  252. package/lib/component/reducer/actions/PreferencesActions.d.ts.map +1 -1
  253. package/lib/component/reducer/actions/PreferencesActions.js +2 -1
  254. package/lib/component/reducer/actions/PreferencesActions.js.map +1 -1
  255. package/lib/component/reducer/actions/RangesActions.d.ts +18 -18
  256. package/lib/component/reducer/actions/RangesActions.d.ts.map +1 -1
  257. package/lib/component/reducer/actions/RangesActions.js +148 -171
  258. package/lib/component/reducer/actions/RangesActions.js.map +1 -1
  259. package/lib/component/reducer/actions/SpectraActions.d.ts.map +1 -1
  260. package/lib/component/reducer/actions/SpectraActions.js +29 -31
  261. package/lib/component/reducer/actions/SpectraActions.js.map +1 -1
  262. package/lib/component/reducer/actions/ToolsActions.d.ts.map +1 -1
  263. package/lib/component/reducer/actions/ToolsActions.js +10 -11
  264. package/lib/component/reducer/actions/ToolsActions.js.map +1 -1
  265. package/lib/component/reducer/actions/ZonesActions.d.ts +8 -9
  266. package/lib/component/reducer/actions/ZonesActions.d.ts.map +1 -1
  267. package/lib/component/reducer/actions/ZonesActions.js +123 -151
  268. package/lib/component/reducer/actions/ZonesActions.js.map +1 -1
  269. package/lib/component/reducer/helper/get2DRange.d.ts +3 -1
  270. package/lib/component/reducer/helper/get2DRange.d.ts.map +1 -1
  271. package/lib/component/reducer/helper/get2DRange.js.map +1 -1
  272. package/lib/component/reducer/helper/getSpectrum.js +1 -1
  273. package/lib/component/reducer/helper/getSpectrum.js.map +1 -1
  274. package/lib/component/reducer/helper/setIntegralsViewProperty.js +1 -1
  275. package/lib/component/reducer/helper/setIntegralsViewProperty.js.map +1 -1
  276. package/lib/component/reducer/helper/setRangesViewProperty.js +1 -1
  277. package/lib/component/reducer/helper/setRangesViewProperty.js.map +1 -1
  278. package/lib/component/useWatchForm.d.ts.map +1 -1
  279. package/lib/component/useWatchForm.js.map +1 -1
  280. package/lib/component/utility/stackOverlappingLabels.d.ts +1 -1
  281. package/lib/component/utility/stackOverlappingLabels.d.ts.map +1 -1
  282. package/lib/component/utility/stackOverlappingLabels.js.map +1 -1
  283. package/lib/data/SpectraManager.d.ts.map +1 -1
  284. package/lib/data/SpectraManager.js.map +1 -1
  285. package/lib/data/data1d/Spectrum1D/isRangeAssigned.d.ts.map +1 -1
  286. package/lib/data/data1d/Spectrum1D/isRangeAssigned.js +0 -3
  287. package/lib/data/data1d/Spectrum1D/isRangeAssigned.js.map +1 -1
  288. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.d.ts +8 -1
  289. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.d.ts.map +1 -1
  290. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -2
  291. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js.map +1 -1
  292. package/lib/data/data1d/Spectrum1D/ranges/changeRangeSignal.d.ts +2 -2
  293. package/lib/data/data1d/Spectrum1D/ranges/changeRangeSignal.js +3 -3
  294. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts +4 -14
  295. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts.map +1 -1
  296. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.js +1 -1
  297. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.js.map +1 -1
  298. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js.map +1 -1
  299. package/lib/data/data2d/Spectrum2D/zones/changeZoneSignal.d.ts +3 -5
  300. package/lib/data/data2d/Spectrum2D/zones/changeZoneSignal.d.ts.map +1 -1
  301. package/lib/data/data2d/Spectrum2D/zones/changeZoneSignal.js +3 -5
  302. package/lib/data/data2d/Spectrum2D/zones/changeZoneSignal.js.map +1 -1
  303. package/lib/data/data2d/Spectrum2D/zones/detectZones.d.ts +2 -1
  304. package/lib/data/data2d/Spectrum2D/zones/detectZones.d.ts.map +1 -1
  305. package/lib/data/data2d/Spectrum2D/zones/detectZones.js.map +1 -1
  306. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +7 -63
  307. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts.map +1 -1
  308. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.js +9 -14
  309. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.js.map +1 -1
  310. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +2 -10
  311. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts.map +1 -1
  312. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +23 -43
  313. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js.map +1 -1
  314. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +1 -54
  315. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts.map +1 -1
  316. package/lib/data/data2d/Spectrum2D/zones/initiateZones.js +1 -1
  317. package/lib/data/data2d/Spectrum2D/zones/initiateZones.js.map +1 -1
  318. package/lib/data/molecules/Molecule.d.ts.map +1 -1
  319. package/lib/data/molecules/Molecule.js.map +1 -1
  320. package/lib/data/types/data1d/RangeDetectionResult.d.ts.map +1 -1
  321. package/lib/data/utilities/FindUtilities.d.ts.map +1 -1
  322. package/lib/data/utilities/FindUtilities.js +11 -11
  323. package/lib/data/utilities/FindUtilities.js.map +1 -1
  324. package/lib/utils/clipboard/clipboardComponents.d.ts.map +1 -1
  325. package/lib/utils/clipboard/clipboardComponents.js.map +1 -1
  326. package/lib/utils/clipboard/clipboardHooks.d.ts +2 -2
  327. package/lib/utils/clipboard/clipboardHooks.d.ts.map +1 -1
  328. package/lib/utils/clipboard/clipboardHooks.js +10 -4
  329. package/lib/utils/clipboard/clipboardHooks.js.map +1 -1
  330. package/lib/versionInfo.d.ts.map +1 -1
  331. package/lib/versionInfo.js +1 -1
  332. package/lib/versionInfo.js.map +1 -1
  333. package/package.json +24 -22
  334. package/src/component/1d/ApodizationLine.tsx +1 -1
  335. package/src/component/1d/BrushTracker1D.tsx +10 -10
  336. package/src/component/1d/FooterBanner.tsx +2 -2
  337. package/src/component/1d/LinesSeries.tsx +2 -2
  338. package/src/component/1d/SVGContent1D.tsx +6 -2
  339. package/src/component/1d/SimilarityTree.tsx +3 -2
  340. package/src/component/1d/inset/InsetProvider.tsx +4 -2
  341. package/src/component/1d/integral/IntegralResizable.tsx +2 -1
  342. package/src/component/1d/matrix/Boxplot.tsx +3 -3
  343. package/src/component/1d/multiAnalysis/AnalysisRange.tsx +2 -1
  344. package/src/component/1d/multiplicityTree/MultiplicityTree.tsx +24 -23
  345. package/src/component/1d/multiplicityTree/generateTreeNodes.ts +10 -1
  346. package/src/component/1d/peaks/PeakAnnotationsSpreadMode.tsx +4 -2
  347. package/src/component/1d/peaks/PeakEditionManager.tsx +8 -3
  348. package/src/component/1d/peaks/Peaks.tsx +5 -1
  349. package/src/component/1d/ranges/AssignmentLabel.tsx +8 -5
  350. package/src/component/1d/ranges/Atoms.tsx +2 -2
  351. package/src/component/1d/ranges/Range.tsx +42 -74
  352. package/src/component/1d/ranges/Ranges.tsx +33 -28
  353. package/src/component/1d/ranges/useAssignmentsPopoverActionsButtons.tsx +93 -0
  354. package/src/component/1d/tool/BaseLineZones.tsx +2 -1
  355. package/src/component/1d/utilities/intersectionResolver.ts +3 -4
  356. package/src/component/1d-2d/FieldEdition.tsx +2 -2
  357. package/src/component/2d/1d-tracer/VerticalSliceChart.tsx +2 -2
  358. package/src/component/2d/1d-tracer/phase-correction-traces/PhaseTraces.tsx +1 -1
  359. package/src/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.tsx +1 -1
  360. package/src/component/2d/BrushTracker2D.tsx +50 -55
  361. package/src/component/2d/FooterBanner.tsx +80 -105
  362. package/src/component/2d/SVGContent2D.tsx +2 -3
  363. package/src/component/2d/SlicingView.tsx +1 -1
  364. package/src/component/2d/Viewer2D.tsx +2 -2
  365. package/src/component/2d/ft/FTContainer.tsx +4 -5
  366. package/src/component/2d/tools/XYLabelPointer.tsx +12 -11
  367. package/src/component/2d/useTracesSpectra.ts +25 -14
  368. package/src/component/2d/utilities/extractSpectrumSignals.ts +2 -2
  369. package/src/component/2d/zones/Signal.tsx +1 -1
  370. package/src/component/2d/zones/SignalsGuideLines.tsx +21 -19
  371. package/src/component/2d/zones/ZonesAssignmentsLabels.tsx +4 -4
  372. package/src/component/EventsTrackers/BrushTracker.tsx +24 -17
  373. package/src/component/assignment/utilities/getAssignments.ts +1 -2
  374. package/src/component/context/KeyModifierContext.tsx +13 -5
  375. package/src/component/elements/ActionsButtonsPopover.tsx +25 -8
  376. package/src/component/elements/AssignmentsCell.tsx +1 -2
  377. package/src/component/elements/Button.tsx +3 -2
  378. package/src/component/elements/CheckController.tsx +2 -1
  379. package/src/component/elements/ContextMenuBluePrint.tsx +2 -1
  380. package/src/component/elements/D3Axis.tsx +3 -3
  381. package/src/component/elements/DraggableDialog.tsx +2 -1
  382. package/src/component/elements/Input.tsx +4 -2
  383. package/src/component/elements/Input2.tsx +1 -2
  384. package/src/component/elements/Input2Controller.tsx +2 -1
  385. package/src/component/elements/Label.tsx +2 -1
  386. package/src/component/elements/NumberInput2.tsx +4 -2
  387. package/src/component/elements/NumberInput2Controller.tsx +3 -1
  388. package/src/component/elements/ReactTable/ReactTable.tsx +1 -3
  389. package/src/component/elements/ReadOnly.tsx +4 -2
  390. package/src/component/elements/Sections.tsx +5 -4
  391. package/src/component/elements/Select.tsx +4 -2
  392. package/src/component/elements/ToolbarPopoverItem.tsx +3 -3
  393. package/src/component/elements/export/ExportContent.tsx +1 -2
  394. package/src/component/elements/print/PrintContent.tsx +1 -2
  395. package/src/component/hooks/useActiveSpectrumIntegralsViewState.ts +2 -6
  396. package/src/component/hooks/useActiveSpectrumPeaksViewState.ts +2 -6
  397. package/src/component/hooks/useActiveSpectrumRangesViewState.ts +2 -6
  398. package/src/component/hooks/useActiveSpectrumStyleOptions.ts +2 -2
  399. package/src/component/hooks/useActiveSpectrumZonesViewState.ts +2 -6
  400. package/src/component/hooks/useExport.tsx +1 -1
  401. package/src/component/hooks/useSaveSettings.tsx +68 -81
  402. package/src/component/hooks/useSetActiveSpectrumAction.ts +3 -2
  403. package/src/component/hooks/useSpectrumWithDataSource.ts +1 -1
  404. package/src/component/hooks/useWorkspaceAction.ts +5 -0
  405. package/src/component/modal/ImportPublicationStringModal.tsx +1 -2
  406. package/src/component/modal/changeSum/ChangeSumModal.tsx +4 -2
  407. package/src/component/modal/metaImportation/MetaImportationModal.tsx +1 -2
  408. package/src/component/modal/setting/GeneralSettings.tsx +7 -2
  409. package/src/component/panels/IntegralsPanel/IntegralTable.tsx +4 -2
  410. package/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx +17 -13
  411. package/src/component/panels/MoleculesPanel/hooks/useAtomAssignment.tsx +32 -16
  412. package/src/component/panels/MoleculesPanel/utilities/getAssignIds.ts +0 -4
  413. package/src/component/panels/RangesPanel/RangesPanel.tsx +1 -1
  414. package/src/component/panels/RangesPanel/RangesTable.tsx +3 -8
  415. package/src/component/panels/RangesPanel/RangesTableRow.tsx +14 -47
  416. package/src/component/panels/RangesPanel/TableColumns/ActionsColumn.tsx +1 -2
  417. package/src/component/panels/RangesPanel/TableColumns/SignalAssignmentColumn.tsx +40 -0
  418. package/src/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.tsx +1 -2
  419. package/src/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.tsx +2 -2
  420. package/src/component/panels/SummaryPanel/SummaryPanel.tsx +6 -6
  421. package/src/component/panels/accordionItems.tsx +4 -2
  422. package/src/component/panels/extra/preferences/NucleusPreferences.tsx +2 -2
  423. package/src/component/panels/informationPanel/InformationEditionModal.tsx +4 -2
  424. package/src/component/panels/predictionPanel/PredictionPanel.tsx +17 -9
  425. package/src/component/reducer/Reducer.ts +8 -8
  426. package/src/component/reducer/actions/AssignmentsActions.ts +8 -13
  427. package/src/component/reducer/actions/CorrelationsActions.ts +21 -22
  428. package/src/component/reducer/actions/DatabaseActions.ts +1 -1
  429. package/src/component/reducer/actions/DomainActions.ts +16 -22
  430. package/src/component/reducer/actions/FiltersActions.ts +34 -58
  431. package/src/component/reducer/actions/InsetActions.ts +9 -19
  432. package/src/component/reducer/actions/IntegralsActions.ts +48 -59
  433. package/src/component/reducer/actions/MoleculeActions.ts +94 -14
  434. package/src/component/reducer/actions/PeaksActions.ts +112 -136
  435. package/src/component/reducer/actions/PreferencesActions.ts +4 -3
  436. package/src/component/reducer/actions/RangesActions.ts +196 -244
  437. package/src/component/reducer/actions/SpectraActions.ts +40 -45
  438. package/src/component/reducer/actions/ToolsActions.ts +9 -13
  439. package/src/component/reducer/actions/ZonesActions.ts +158 -218
  440. package/src/component/reducer/helper/get2DRange.ts +4 -1
  441. package/src/component/reducer/helper/getSpectrum.ts +1 -1
  442. package/src/component/reducer/helper/setIntegralsViewProperty.ts +1 -1
  443. package/src/component/reducer/helper/setRangesViewProperty.ts +1 -1
  444. package/src/component/useWatchForm.tsx +2 -1
  445. package/src/component/utility/stackOverlappingLabels.ts +4 -1
  446. package/src/data/SpectraManager.ts +0 -2
  447. package/src/data/data1d/Spectrum1D/isRangeAssigned.ts +0 -4
  448. package/src/data/data1d/Spectrum1D/ranges/autoRangesDetection.ts +15 -5
  449. package/src/data/data1d/Spectrum1D/ranges/changeRangeSignal.ts +5 -5
  450. package/src/data/data1d/Spectrum1D/ranges/detectRanges.ts +5 -14
  451. package/src/data/data2d/Spectrum2D/initiateDatum2D.ts +2 -2
  452. package/src/data/data2d/Spectrum2D/zones/changeZoneSignal.ts +3 -5
  453. package/src/data/data2d/Spectrum2D/zones/detectZones.ts +3 -2
  454. package/src/data/data2d/Spectrum2D/zones/detectZonesManual.ts +19 -16
  455. package/src/data/data2d/Spectrum2D/zones/getDetectionZones.ts +35 -56
  456. package/src/data/data2d/Spectrum2D/zones/initiateZones.ts +1 -1
  457. package/src/data/molecules/Molecule.ts +2 -1
  458. package/src/data/types/data1d/RangeDetectionResult.ts +4 -2
  459. package/src/data/utilities/FindUtilities.ts +9 -8
  460. package/src/utils/clipboard/clipboardComponents.tsx +2 -1
  461. package/src/utils/clipboard/clipboardHooks.ts +14 -8
  462. package/src/versionInfo.ts +1 -1
  463. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentColumn.d.ts +0 -8
  464. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentColumn.d.ts.map +0 -1
  465. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentColumn.js +0 -17
  466. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentColumn.js.map +0 -1
  467. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.d.ts +0 -17
  468. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.d.ts.map +0 -1
  469. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +0 -40
  470. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js.map +0 -1
  471. package/src/component/panels/RangesPanel/TableColumns/RangeAssignmentColumn.tsx +0 -36
  472. package/src/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.tsx +0 -89
@@ -12,7 +12,7 @@ import type {
12
12
  import type { Spectrum1D, Spectrum2D, Spectrum } from '@zakodium/nmrium-core';
13
13
  import type { NmrData1D, NmrData2DFt } from 'cheminfo-types';
14
14
  import type { Draft } from 'immer';
15
- import { current } from 'immer';
15
+ import { current, isDraft } from 'immer';
16
16
  import { xFindClosestIndex } from 'ml-spectra-processing';
17
17
  import type { Filter1D, FilterDomainUpdateRules } from 'nmr-processing';
18
18
  import {
@@ -321,38 +321,36 @@ function findSpectrum(
321
321
  options: SpectrumOptions,
322
322
  ): { index: number; spectrum: Spectrum } | null {
323
323
  const { target } = options;
324
- const spectra = current(draft).data;
324
+ const spectra = draft.data;
325
325
  if (target === 'active') {
326
326
  const activeSpectrum = getActiveSpectrum(draft);
327
-
328
327
  if (!activeSpectrum) return null;
328
+
329
329
  const { index } = activeSpectrum;
330
- return { index, spectrum: structuredClone(spectra[index]) };
330
+ return { index, spectrum: spectra[index] };
331
331
  }
332
332
 
333
333
  if (target === 'current') {
334
334
  const { spectrum } = options;
335
-
336
335
  if (!spectrum) return null;
337
336
 
338
337
  const index = spectra.findIndex((datum) => datum.id === spectrum.id);
339
- return { index, spectrum: structuredClone(spectrum) };
338
+ return { index, spectrum };
340
339
  }
341
340
 
342
341
  if (target === 'id') {
343
342
  const { id } = options;
344
343
  const index = spectra.findIndex((spectrum) => spectrum.id === id);
345
-
346
344
  if (index === -1) return null;
347
345
 
348
- return { index, spectrum: structuredClone(spectra[index]) };
346
+ return { index, spectrum: spectra[index] };
349
347
  }
350
348
  if (target === 'index') {
351
349
  const { index } = options;
352
350
  const spectrum = spectra?.[index];
353
351
  if (spectrum) return null;
354
352
 
355
- return { index, spectrum: structuredClone(spectrum) };
353
+ return { index, spectrum };
356
354
  }
357
355
 
358
356
  return null;
@@ -441,8 +439,7 @@ function rollbackSpectrumByFilter(
441
439
  let currentIsFid = false;
442
440
  const toolData = draft.toolOptions.data;
443
441
  if (currentSpectrum) {
444
- const { index } = currentSpectrum;
445
- let { spectrum } = currentSpectrum;
442
+ const { index, spectrum } = currentSpectrum;
446
443
  previousIsFid = isFid1DSpectrum(spectrum) || isFid2DSpectrum(spectrum);
447
444
  const filterIndex = spectrum.filters.findIndex((f) => f[searchBy] === key);
448
445
  if (filterIndex === -1 || reset) {
@@ -458,16 +455,15 @@ function rollbackSpectrumByFilter(
458
455
  reapplyFilters(spectrum, filters);
459
456
  }
460
457
 
461
- //if the filter is not exists, create a clone of the current data
462
- draft.tempData = structuredClone(current(draft).data);
463
-
464
- draft.tempData[index] = spectrum;
465
- spectrum = structuredClone(spectrum);
458
+ // If the filter doesn't exist, create a clone of the current data.
459
+ draft.tempData = current(draft).data.slice();
460
+ draft.tempData[index] = structuredClone(
461
+ isDraft(spectrum) ? current(spectrum) : spectrum,
462
+ );
466
463
 
467
464
  if (tempRollback) {
468
465
  reapplyFilters(spectrum);
469
466
  }
470
- draft.data[index] = spectrum;
471
467
  }
472
468
 
473
469
  if (filterIndex !== -1 && !reset) {
@@ -477,7 +473,7 @@ function rollbackSpectrumByFilter(
477
473
  //set active filter
478
474
  toolData.activeFilterID = spectrum.filters?.[filterIndex]?.id || null;
479
475
 
480
- const filters: any[] = spectrum.filters.slice(0, filterIndex);
476
+ const filters = spectrum.filters.slice(0, filterIndex);
481
477
 
482
478
  updateDomainOptions = getFilterDomain(spectrum, {
483
479
  startIndex: Math.min(activeFilterIndex, filterIndex),
@@ -487,7 +483,9 @@ function rollbackSpectrumByFilter(
487
483
  reapplyFilters(spectrum, filters);
488
484
 
489
485
  draft.tempData = current(draft).data.slice();
490
- draft.tempData[index] = structuredClone(spectrum);
486
+ draft.tempData[index] = structuredClone(
487
+ isDraft(spectrum) ? current(spectrum) : spectrum,
488
+ );
491
489
 
492
490
  // apply the current Filters
493
491
  if (applyFilter) {
@@ -502,8 +500,6 @@ function rollbackSpectrumByFilter(
502
500
  });
503
501
  }
504
502
 
505
- draft.data[index] = spectrum;
506
-
507
503
  currentIsFid = isFid1DSpectrum(spectrum) || isFid2DSpectrum(spectrum);
508
504
 
509
505
  // Update the X and Y domains when switching from FT to FID spectrum,
@@ -750,12 +746,10 @@ function afterRollback(draft: Draft<State>, filterKey: any) {
750
746
  * getActiveFilterIndex return active filter index. Otherwise, its returns -1
751
747
  */
752
748
  function getActiveFilterIndex(draft: Draft<State>) {
753
- const activeSpectrum = getActiveSpectrum(draft);
749
+ const spectrum = getSpectrum(draft);
754
750
  const id = draft.toolOptions.data.activeFilterID;
755
- if (id && activeSpectrum) {
756
- const spectrum = draft.data[activeSpectrum.index];
757
- const index = spectrum.filters.findIndex((filter) => filter.id === id);
758
- return index;
751
+ if (id && spectrum) {
752
+ return spectrum.filters.findIndex((filter) => filter.id === id);
759
753
  }
760
754
  return -1;
761
755
  }
@@ -799,17 +793,14 @@ function handleShiftSpectrumAlongXAxis(
799
793
  action: ShiftSpectrumAction,
800
794
  ) {
801
795
  const activeSpectrum = getActiveSpectrum(draft);
802
-
803
- if (!activeSpectrum) {
804
- return;
805
- }
796
+ if (!activeSpectrum) return;
806
797
 
807
798
  const activeFilterIndex = getActiveFilterIndex(draft);
808
799
 
809
800
  //apply filter into the spectrum
810
801
  const options = action.payload;
811
802
 
812
- const index = activeSpectrum?.index;
803
+ const index = activeSpectrum.index;
813
804
  const isOneDimensionSpectrum = isSpectrum1D(draft.data[index]);
814
805
  const isOneDimensionShiftFilter = isOneDimensionShift(options);
815
806
 
@@ -1841,20 +1832,13 @@ function handleApplyExclusionZone(
1841
1832
  ) {
1842
1833
  const { zones } = action.payload;
1843
1834
 
1844
- const activeSpectrum = getActiveSpectrum(draft);
1845
-
1846
- if (!activeSpectrum) {
1847
- return;
1848
- }
1849
- const datum = draft.data[activeSpectrum.index];
1835
+ const spectrum = getSpectrum(draft);
1836
+ if (!isSpectrum1D(spectrum)) return;
1850
1837
 
1851
- if (!isSpectrum1D(datum)) {
1852
- return;
1853
- }
1854
1838
  const activeFilterIndex = getActiveFilterIndex(draft);
1855
1839
 
1856
1840
  Filters1DManager.applyFilters(
1857
- datum,
1841
+ spectrum,
1858
1842
  [
1859
1843
  {
1860
1844
  name: 'exclusionZones',
@@ -1879,8 +1863,8 @@ function handleAddExclusionZone(
1879
1863
  let spectra: Spectrum1D[];
1880
1864
 
1881
1865
  const activeSpectrum = getActiveSpectrum(draft);
1882
- if (activeSpectrum?.id) {
1883
- const index = activeSpectrum?.index;
1866
+ if (activeSpectrum) {
1867
+ const index = activeSpectrum.index;
1884
1868
  spectra = [draft.data[index]] as Spectrum1D[];
1885
1869
  } else {
1886
1870
  spectra = getSpectraByNucleus(
@@ -1916,12 +1900,11 @@ function handleDeleteExclusionZone(
1916
1900
  ) {
1917
1901
  const { zone, spectrumId } = action.payload;
1918
1902
 
1919
- // if spectrum id exists, remove the selected exclusion zone in the spectrum
1903
+ // If spectrum id exists, remove the selected exclusion zone in the spectrum.
1920
1904
  if (spectrumId) {
1921
- const spectrumIndex = draft.data.findIndex(
1922
- (spectrum) => spectrum.id === spectrumId,
1923
- );
1924
- const spectrum = draft.data[spectrumIndex];
1905
+ const spectrum = getSpectrum(draft, spectrumId);
1906
+ if (!spectrum) return;
1907
+
1925
1908
  const filter = spectrum.filters.find(
1926
1909
  (_filter) => _filter.name === 'exclusionZones',
1927
1910
  );
@@ -1954,20 +1937,13 @@ function handleSetOneDimensionPhaseCorrectionPivotPoint(
1954
1937
  action: SetOneDimensionPhaseCorrectionPivotPoint,
1955
1938
  ) {
1956
1939
  const { value: xValue } = action.payload;
1957
- const activeSpectrum = getActiveSpectrum(draft);
1958
1940
 
1959
- if (!activeSpectrum) {
1960
- return;
1961
- }
1962
- const datum = draft.data[activeSpectrum.index];
1963
-
1964
- if (!isSpectrum1D(datum)) {
1965
- return;
1966
- }
1941
+ const spectrum = getSpectrum(draft);
1942
+ if (!isSpectrum1D(spectrum)) return;
1967
1943
 
1968
1944
  const scaleX = getXScale(draft);
1969
1945
  const value = scaleX.invert(xValue);
1970
- const index = xFindClosestIndex(datum.data.x, value);
1946
+ const index = xFindClosestIndex(spectrum.data.x, value);
1971
1947
  draft.toolOptions.data.pivot = { value, index };
1972
1948
  }
1973
1949
  function handleSetTwoDimensionPhaseCorrectionPivotPoint(
@@ -7,7 +7,7 @@ import { scaleLinear } from 'd3-scale';
7
7
  import { zoomIdentity } from 'd3-zoom';
8
8
  import type { Draft } from 'immer';
9
9
 
10
- import { isSpectrum1D } from '../../../data/data1d/Spectrum1D/isSpectrum1D.js';
10
+ import { isSpectrum1D } from '../../../data/data1d/Spectrum1D/index.ts';
11
11
  import { insetMargin } from '../../1d/inset/InsetProvider.js';
12
12
  import type {
13
13
  Inset,
@@ -28,8 +28,8 @@ import type { SpectraDirection, State } from '../Reducer.js';
28
28
  import type { ZoomType } from '../helper/Zoom1DManager.js';
29
29
  import { toScaleRatio, wheelZoom } from '../helper/Zoom1DManager.js';
30
30
  import { preparePop } from '../helper/ZoomHistoryManager.js';
31
- import { getActiveSpectrum } from '../helper/getActiveSpectrum.js';
32
31
  import getRange from '../helper/getRange.js';
32
+ import { getSpectrum } from '../helper/getSpectrum.ts';
33
33
  import type { ActionType } from '../types/ActionType.js';
34
34
 
35
35
  import type { MoveOptions } from './DomainActions.js';
@@ -104,14 +104,10 @@ export type InsetsActions =
104
104
  | ToggleInsetDisplayingPeaksModeAction;
105
105
 
106
106
  function handleAddInset(draft: Draft<State>, action: AddInsetAction) {
107
- const activeSpectrum = getActiveSpectrum(draft);
108
-
109
- if (!activeSpectrum) return;
110
-
111
- const { index } = activeSpectrum;
112
- const datum = draft.data[index];
107
+ const { startX, endX } = action.payload;
113
108
 
114
- if (!isSpectrum1D(datum)) return;
109
+ const spectrum = getSpectrum(draft);
110
+ if (!isSpectrum1D(spectrum)) return;
115
111
 
116
112
  const {
117
113
  yDomain,
@@ -121,9 +117,8 @@ function handleAddInset(draft: Draft<State>, action: AddInsetAction) {
121
117
  width: baseWidth,
122
118
  height: baseHeight,
123
119
  } = draft;
124
- const { id: spectrumKey } = datum;
120
+ const { id: spectrumKey } = spectrum;
125
121
 
126
- const { startX, endX } = action.payload;
127
122
  const xDomain = getRange(draft, { startX, endX });
128
123
 
129
124
  const width = Math.max(100, Math.abs(startX - endX));
@@ -154,22 +149,17 @@ function handleAddInset(draft: Draft<State>, action: AddInsetAction) {
154
149
  draft.insets[nucleus] = [inset];
155
150
  }
156
151
  }
157
- function handleDeleteInset(draft: Draft<State>, action: DeleteInsetAction) {
158
- const activeSpectrum = getActiveSpectrum(draft);
159
152
 
160
- if (!activeSpectrum) return;
161
-
162
- const { index } = activeSpectrum;
163
- const datum = draft.data[index];
153
+ function handleDeleteInset(draft: Draft<State>, action: DeleteInsetAction) {
154
+ const { insetKey } = action.payload;
164
155
 
165
- if (!isSpectrum1D(datum)) return;
166
156
  const {
167
157
  view: {
168
158
  spectra: { activeTab },
169
159
  },
170
160
  } = draft;
171
161
 
172
- const { insetKey } = action.payload;
162
+ if (!activeTab) return;
173
163
 
174
164
  draft.insets[activeTab] = draft.insets[activeTab].filter(
175
165
  (inset) => inset.id !== insetKey,
@@ -20,7 +20,6 @@ import {
20
20
  } from '../../../data/data1d/Spectrum1D/index.js';
21
21
  import type { FilterType } from '../../utility/filterType.js';
22
22
  import type { State } from '../Reducer.js';
23
- import { getActiveSpectrum } from '../helper/getActiveSpectrum.js';
24
23
  import getRange from '../helper/getRange.js';
25
24
  import { getSpectrum } from '../helper/getSpectrum.js';
26
25
  import { setIntegralsViewProperty } from '../helper/setIntegralsViewProperty.js';
@@ -70,21 +69,15 @@ function handleChangeIntegralSum(
70
69
  action: ChangeIntegralSumAction,
71
70
  ) {
72
71
  const { options } = action.payload;
73
- const {
74
- data,
75
- view: {
76
- spectra: { activeTab: nucleus },
77
- },
78
- } = draft;
79
72
 
80
- const activeSpectrum = getActiveSpectrum(draft);
73
+ const spectrum = getSpectrum(draft);
74
+ if (!isSpectrum1D(spectrum)) return;
81
75
 
82
- if (activeSpectrum?.id) {
83
- const { index } = activeSpectrum;
84
- const datum = data[index] as Spectrum1D;
85
- setSumOptions(datum.integrals, { options, nucleus });
86
- updateIntegralsRelativeValues(datum, true);
87
- }
76
+ setSumOptions(spectrum.integrals, {
77
+ options,
78
+ nucleus: spectrum.info.nucleus,
79
+ });
80
+ updateIntegralsRelativeValues(spectrum, true);
88
81
  }
89
82
 
90
83
  interface AddIntegralOptions {
@@ -92,19 +85,19 @@ interface AddIntegralOptions {
92
85
  to: number;
93
86
  }
94
87
 
95
- function initiateIntegralSumOptions(datum: Spectrum1D, options: SumParams) {
88
+ function initiateIntegralSumOptions(spectrum: Spectrum1D, options: SumParams) {
96
89
  const { molecules, nucleus } = options;
97
- datum.integrals.options = initSumOptions(datum.integrals.options, {
90
+ spectrum.integrals.options = initSumOptions(spectrum.integrals.options, {
98
91
  molecules,
99
92
  nucleus,
100
93
  });
101
94
  }
102
95
 
103
- function addIntegral(datum: Spectrum1D, options: AddIntegralOptions) {
96
+ function addIntegral(spectrum: Spectrum1D, options: AddIntegralOptions) {
104
97
  const { from, to } = options;
105
- const { x, re } = datum.data;
98
+ const { x, re } = spectrum.data;
106
99
 
107
- const shiftX = getShiftX(datum);
100
+ const shiftX = getShiftX(spectrum);
108
101
  const integration = xyIntegration({ x, y: re }, { from, to });
109
102
  const integral: Integral = {
110
103
  id: crypto.randomUUID(),
@@ -116,26 +109,24 @@ function addIntegral(datum: Spectrum1D, options: AddIntegralOptions) {
116
109
  absolute: integration,
117
110
  kind: 'signal',
118
111
  };
119
- datum.integrals.values.push(integral);
112
+ spectrum.integrals.values.push(integral);
120
113
  }
121
114
 
122
115
  function handleAddIntegral(draft: Draft<State>, action: AddIntegralAction) {
123
116
  const { startX, endX } = action.payload;
124
117
  const {
125
- data,
126
118
  molecules,
127
119
  view: {
128
120
  spectra: { activeTab: nucleus },
129
121
  },
130
122
  } = draft;
131
123
 
132
- const activeSpectrum = getActiveSpectrum(draft);
133
- if (activeSpectrum?.id) {
124
+ const spectrum = getSpectrum(draft);
125
+ if (isSpectrum1D(spectrum)) {
134
126
  const [from, to] = getRange(draft, { startX, endX });
135
- const datum = data[activeSpectrum.index] as Spectrum1D;
136
- addIntegral(datum, { from, to });
137
- initiateIntegralSumOptions(datum, { molecules, nucleus });
138
- updateIntegralsRelativeValues(datum);
127
+ addIntegral(spectrum, { from, to });
128
+ initiateIntegralSumOptions(spectrum, { molecules, nucleus });
129
+ updateIntegralsRelativeValues(spectrum);
139
130
  }
140
131
  }
141
132
 
@@ -144,18 +135,18 @@ function handleDeleteIntegral(
144
135
  action: DeleteIntegralAction,
145
136
  ) {
146
137
  const { id: integralID, spectrumKey } = action?.payload || {};
147
- const datum = getSpectrum(draft, spectrumKey);
138
+ const spectrum = getSpectrum(draft, spectrumKey);
148
139
 
149
- if (!isSpectrum1D(datum)) return;
140
+ if (!isSpectrum1D(spectrum)) return;
150
141
 
151
142
  if (!integralID) {
152
- datum.integrals.values = [];
143
+ spectrum.integrals.values = [];
153
144
  } else {
154
- const peakIndex = datum.integrals.values.findIndex(
145
+ const peakIndex = spectrum.integrals.values.findIndex(
155
146
  (p: any) => p.id === integralID,
156
147
  );
157
- datum.integrals.values.splice(peakIndex, 1);
158
- updateIntegralsRelativeValues(datum);
148
+ spectrum.integrals.values.splice(peakIndex, 1);
149
+ updateIntegralsRelativeValues(spectrum);
159
150
  }
160
151
  }
161
152
 
@@ -163,23 +154,20 @@ function handleChangeIntegral(
163
154
  draft: Draft<State>,
164
155
  action: ChangeIntegralAction,
165
156
  ) {
166
- const state = original(draft) as State;
167
157
  const { integral, spectrumKey } = action.payload;
168
158
 
169
- const originalDatum = getSpectrum(state, spectrumKey);
170
- const datum = getSpectrum(draft, spectrumKey);
171
-
172
- if (!isSpectrum1D(datum) || !isSpectrum1D(originalDatum)) {
173
- return;
174
- }
159
+ const spectrum = getSpectrum(draft, spectrumKey);
160
+ if (!isSpectrum1D(spectrum)) return;
175
161
 
176
- const { x, re } = originalDatum.data;
177
- const integralIndex = originalDatum.integrals.values.findIndex(
178
- (i: any) => i.id === integral.id,
162
+ const integralIndex = spectrum.integrals.values.findIndex(
163
+ (i) => i.id === integral.id,
179
164
  );
180
165
 
181
166
  if (integralIndex !== -1) {
182
- datum.integrals.values[integralIndex] = {
167
+ const {
168
+ data: { x, re },
169
+ } = original(spectrum) as Spectrum1D;
170
+ spectrum.integrals.values[integralIndex] = {
183
171
  ...integral,
184
172
  originalFrom: integral.from,
185
173
  originalTo: integral.to,
@@ -188,7 +176,7 @@ function handleChangeIntegral(
188
176
  { from: integral.from, to: integral.to },
189
177
  ),
190
178
  };
191
- updateIntegralsRelativeValues(datum);
179
+ updateIntegralsRelativeValues(spectrum);
192
180
  }
193
181
  }
194
182
 
@@ -196,28 +184,29 @@ function handleChangeIntegralsRelativeValue(
196
184
  draft: Draft<State>,
197
185
  action: ChangeIntegralRelativeValueAction,
198
186
  ) {
199
- const activeSpectrum = getActiveSpectrum(draft);
200
187
  const { id, value } = action.payload;
201
- if (activeSpectrum?.id) {
202
- const { index } = activeSpectrum;
203
- changeIntegralsRelative(draft.data[index] as Spectrum1D, { id, value });
204
- }
188
+
189
+ const spectrum = getSpectrum(draft);
190
+ if (!isSpectrum1D(spectrum)) return;
191
+
192
+ changeIntegralsRelative(spectrum, { id, value });
205
193
  }
206
194
 
207
- function handleChangeIntegralsSumFlag(draft: any) {
208
- const activeSpectrum = getActiveSpectrum(draft);
209
- if (activeSpectrum) {
210
- const { index } = activeSpectrum;
211
- const integralOptions = draft.data[index].integrals.options;
212
- integralOptions.isSumConstant = !integralOptions.isSumConstant;
213
- }
195
+ function handleChangeIntegralsSumFlag(draft: Draft<State>) {
196
+ const spectrum = getSpectrum(draft);
197
+ if (!isSpectrum1D(spectrum)) return;
198
+
199
+ const integralOptions = spectrum.integrals.options;
200
+ integralOptions.isSumConstant = !integralOptions.isSumConstant;
214
201
  }
215
202
 
216
203
  function handleCutIntegral(draft: Draft<State>, action: CutIntegralAction) {
217
204
  const { cutValue } = action.payload;
218
- const spectrum = getSpectrum(draft) as Spectrum1D;
219
- const integrals = spectrum.integrals.values;
220
205
 
206
+ const spectrum = getSpectrum(draft);
207
+ if (!isSpectrum1D(spectrum)) return;
208
+
209
+ const integrals = spectrum.integrals.values;
221
210
  for (let i = 0; i < integrals.length; i++) {
222
211
  const { to, from } = integrals[i];
223
212
  if (cutValue > from && cutValue < to) {
@@ -3,7 +3,7 @@ import type { Logger } from 'cheminfo-types';
3
3
  import type { FifoLogger } from 'fifo-logger';
4
4
  import type { Draft } from 'immer';
5
5
  import { Molecule } from 'openchemlib';
6
- import type { TopicMolecule } from 'openchemlib-utils';
6
+ import type { DiaIDAndInfo, TopicMolecule } from 'openchemlib-utils';
7
7
  import { getAtoms, nbLabileH } from 'openchemlib-utils';
8
8
 
9
9
  import type {
@@ -13,18 +13,19 @@ import type {
13
13
  } from '../../../data/PredictionManager.js';
14
14
  import { generateSpectra } from '../../../data/PredictionManager.js';
15
15
  import { changeSpectraRelativeSum } from '../../../data/data1d/Spectrum1D/SumManager.js';
16
+ import { isSpectrum1D } from '../../../data/data1d/Spectrum1D/isSpectrum1D.ts';
16
17
  import type { MoleculeBoundingRect } from '../../../data/molecules/Molecule.js';
17
18
  import { DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT } from '../../../data/molecules/Molecule.js';
18
19
  import * as MoleculeManager from '../../../data/molecules/MoleculeManager.js';
19
20
  import { generateColor } from '../../../data/utilities/generateColor.js';
20
21
  import { convertPixelToPercent } from '../../hooks/useSVGUnitConverter.js';
22
+ import { extractFromAtom } from '../../panels/MoleculesPanel/utilities/extractFromAtom.ts';
23
+ import nucleusToString from '../../utility/nucleusToString.ts';
21
24
  import type { State } from '../Reducer.js';
22
25
  import { MARGIN } from '../core/Constants.js';
23
26
  import type { ActionType } from '../types/ActionType.js';
24
27
 
25
- import { unlinkRange } from './RangesActions.js';
26
28
  import { setActiveTab } from './ToolsActions.js';
27
- import { unlinkZone } from './ZonesActions.js';
28
29
  import { deepReplaceDiaIDs } from './utilities/deepReplaceDiaIDs.js';
29
30
 
30
31
  interface AddMoleculeProps {
@@ -48,7 +49,10 @@ type SetMoleculeAction = ActionType<
48
49
  mappings?: ReturnType<TopicMolecule['getDiaIDsMapping']>;
49
50
  }
50
51
  >;
51
- type DeleteMoleculeAction = ActionType<'DELETE_MOLECULE', { id: string }>;
52
+ type DeleteMoleculeAction = ActionType<
53
+ 'DELETE_MOLECULE',
54
+ { id: string; diaIDs?: DiaIDAndInfo[] }
55
+ >;
52
56
  type PredictSpectraFromMoleculeAction = ActionType<
53
57
  'PREDICT_SPECTRA',
54
58
  {
@@ -68,8 +72,10 @@ type ToggleMoleculeLabelAction = ActionType<
68
72
  { id: string }
69
73
  >;
70
74
 
71
- interface ChangeMoleculeAnnotationOptions
72
- extends Pick<MoleculeView, 'atomAnnotation'> {
75
+ interface ChangeMoleculeAnnotationOptions extends Pick<
76
+ MoleculeView,
77
+ 'atomAnnotation'
78
+ > {
73
79
  id: string;
74
80
  }
75
81
 
@@ -165,12 +171,83 @@ function handleSetMolecule(draft: Draft<State>, action: SetMoleculeAction) {
165
171
  setMolecule(draft, action.payload);
166
172
  }
167
173
 
168
- function removeAssignments(draft: Draft<State>) {
169
- if (draft.displayerMode === '1D') {
170
- unlinkRange(draft);
174
+ function clearDiaIDs(
175
+ obj: Partial<{ diaIDs?: string[]; nbAtoms?: number }>,
176
+ options: {
177
+ diaIDsObj: Record<string, DiaIDAndInfo>;
178
+ nucleus: string[] | string;
179
+ },
180
+ ) {
181
+ const { diaIDsObj, nucleus } = options;
182
+ if (!obj.diaIDs?.some((id) => id in diaIDsObj)) {
183
+ return;
184
+ }
185
+
186
+ const nucleusValue = nucleusToString(nucleus);
187
+ let updatedDiaIDs = [...obj.diaIDs];
188
+ let updatedNbAtoms = obj.nbAtoms || 0;
189
+
190
+ for (const id of obj.diaIDs) {
191
+ const atomInfo = diaIDsObj[id];
192
+ if (!atomInfo) continue;
193
+
194
+ const { nbAtoms: removedCount, oclIDs } = extractFromAtom(
195
+ atomInfo,
196
+ nucleusValue,
197
+ );
198
+ const removalSet = new Set(oclIDs);
199
+
200
+ updatedDiaIDs = updatedDiaIDs.filter(
201
+ (candidate) => !removalSet.has(candidate),
202
+ );
203
+ updatedNbAtoms -= removedCount;
204
+ }
205
+
206
+ if (updatedDiaIDs.length > 0) {
207
+ obj.diaIDs = updatedDiaIDs;
208
+ } else {
209
+ delete obj.diaIDs;
210
+ }
211
+
212
+ if (updatedNbAtoms > 0) {
213
+ obj.nbAtoms = updatedNbAtoms;
214
+ } else {
215
+ delete obj.nbAtoms;
216
+ }
217
+ }
218
+
219
+ function clearAssignments(draft: Draft<State>, diaIDs: DiaIDAndInfo[]) {
220
+ const diaIDsObj: Record<string, DiaIDAndInfo> = {};
221
+ for (const diaItem of diaIDs) {
222
+ diaIDsObj[diaItem.idCode] = diaItem;
171
223
  }
172
- if (draft.displayerMode === '2D') {
173
- unlinkZone(draft, {});
224
+
225
+ for (const spectrum of draft.data) {
226
+ const {
227
+ info: { nucleus },
228
+ } = spectrum;
229
+
230
+ if (isSpectrum1D(spectrum)) {
231
+ const ranges = spectrum.ranges.values;
232
+ for (const range of ranges) {
233
+ const { signals = [] } = range;
234
+ for (const signal of signals) {
235
+ clearDiaIDs(signal, { diaIDsObj, nucleus });
236
+ }
237
+ }
238
+ } else {
239
+ const zones = spectrum.zones.values;
240
+ for (const zone of zones) {
241
+ const { signals = [] } = zone;
242
+ clearDiaIDs(zone.x, { diaIDsObj, nucleus });
243
+ clearDiaIDs(zone.y, { diaIDsObj, nucleus });
244
+
245
+ for (const signal of signals) {
246
+ clearDiaIDs(signal.x, { diaIDsObj, nucleus });
247
+ clearDiaIDs(signal.y, { diaIDsObj, nucleus });
248
+ }
249
+ }
250
+ }
174
251
  }
175
252
  }
176
253
 
@@ -179,13 +256,16 @@ function handleDeleteMolecule(
179
256
  draft: Draft<State>,
180
257
  action: DeleteMoleculeAction,
181
258
  ) {
182
- const { id } = action.payload;
183
- // remove Assignments links of the active spectrum
184
- removeAssignments(draft);
259
+ const { id, diaIDs } = action.payload;
185
260
 
186
261
  const moleculeIndex = draft.molecules.findIndex(
187
262
  (molecule) => molecule.id === id,
188
263
  );
264
+
265
+ if (diaIDs) {
266
+ clearAssignments(draft, diaIDs);
267
+ }
268
+
189
269
  draft.molecules.splice(moleculeIndex, 1);
190
270
 
191
271
  // delete the molecule view object for this id