nmrium 1.6.1 → 1.8.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 (488) hide show
  1. package/lib/component/1d/FloatingRanges.js +4 -4
  2. package/lib/component/1d/FloatingRanges.js.map +1 -1
  3. package/lib/component/1d/database/DatabaseSpectrum.js +1 -1
  4. package/lib/component/1d/database/DatabaseSpectrum.js.map +1 -1
  5. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  6. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js.map +1 -1
  7. package/lib/component/1d/multiplicityTree/MultiplicityTree.d.ts.map +1 -1
  8. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +4 -2
  9. package/lib/component/1d/multiplicityTree/MultiplicityTree.js.map +1 -1
  10. package/lib/component/1d/peaks/PeakAnnotations.d.ts.map +1 -1
  11. package/lib/component/1d/peaks/PeakAnnotations.js +2 -2
  12. package/lib/component/1d/peaks/PeakAnnotations.js.map +1 -1
  13. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts.map +1 -1
  14. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +4 -4
  15. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js.map +1 -1
  16. package/lib/component/1d/peaks/Peaks.d.ts +4 -1
  17. package/lib/component/1d/peaks/Peaks.d.ts.map +1 -1
  18. package/lib/component/1d/peaks/Peaks.js +5 -2
  19. package/lib/component/1d/peaks/Peaks.js.map +1 -1
  20. package/lib/component/1d/ranges/Atoms.d.ts.map +1 -1
  21. package/lib/component/1d/ranges/Atoms.js +24 -9
  22. package/lib/component/1d/ranges/Atoms.js.map +1 -1
  23. package/lib/component/1d/ranges/Range.d.ts.map +1 -1
  24. package/lib/component/1d/ranges/Range.js +3 -3
  25. package/lib/component/1d/ranges/Range.js.map +1 -1
  26. package/lib/component/1d/ranges/RangesIntegrals.d.ts.map +1 -1
  27. package/lib/component/1d/ranges/RangesIntegrals.js +5 -3
  28. package/lib/component/1d/ranges/RangesIntegrals.js.map +1 -1
  29. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts +2 -1
  30. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts.map +1 -1
  31. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +32 -41
  32. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js.map +1 -1
  33. package/lib/component/1d-2d/components/FloatMoleculeStructures/FloatMolecules.d.ts.map +1 -1
  34. package/lib/component/1d-2d/components/FloatMoleculeStructures/FloatMolecules.js.map +1 -1
  35. package/lib/component/2d/FooterBanner.js +2 -2
  36. package/lib/component/2d/FooterBanner.js.map +1 -1
  37. package/lib/component/2d/YAxis.d.ts +0 -1
  38. package/lib/component/2d/YAxis.d.ts.map +1 -1
  39. package/lib/component/2d/YAxis.js +11 -4
  40. package/lib/component/2d/YAxis.js.map +1 -1
  41. package/lib/component/2d/useTracesSpectra.d.ts.map +1 -1
  42. package/lib/component/2d/useTracesSpectra.js +2 -0
  43. package/lib/component/2d/useTracesSpectra.js.map +1 -1
  44. package/lib/component/2d/utilities/extractSpectrumSignals.d.ts +2 -9
  45. package/lib/component/2d/utilities/extractSpectrumSignals.d.ts.map +1 -1
  46. package/lib/component/2d/utilities/extractSpectrumSignals.js +4 -5
  47. package/lib/component/2d/utilities/extractSpectrumSignals.js.map +1 -1
  48. package/lib/component/2d/zones/SignalsGuideLines.d.ts.map +1 -1
  49. package/lib/component/2d/zones/SignalsGuideLines.js +7 -10
  50. package/lib/component/2d/zones/SignalsGuideLines.js.map +1 -1
  51. package/lib/component/2d/zones/ZonesAssignmentsLabels.d.ts.map +1 -1
  52. package/lib/component/2d/zones/ZonesAssignmentsLabels.js.map +1 -1
  53. package/lib/component/context/DispatchContext.d.ts +2 -2
  54. package/lib/component/context/DispatchContext.d.ts.map +1 -1
  55. package/lib/component/context/LoggerContext.d.ts.map +1 -1
  56. package/lib/component/context/LoggerContext.js +8 -9
  57. package/lib/component/context/LoggerContext.js.map +1 -1
  58. package/lib/component/context/PreferencesContext.d.ts +7 -3
  59. package/lib/component/context/PreferencesContext.d.ts.map +1 -1
  60. package/lib/component/context/PreferencesContext.js +1 -2
  61. package/lib/component/context/PreferencesContext.js.map +1 -1
  62. package/lib/component/elements/D3Axis.d.ts.map +1 -1
  63. package/lib/component/elements/D3Axis.js +1 -1
  64. package/lib/component/elements/D3Axis.js.map +1 -1
  65. package/lib/component/elements/Sections.js +1 -1
  66. package/lib/component/elements/Sections.js.map +1 -1
  67. package/lib/component/hooks/useActiveSpectrumRangesViewState.d.ts.map +1 -1
  68. package/lib/component/hooks/useActiveSpectrumRangesViewState.js +2 -2
  69. package/lib/component/hooks/useActiveSpectrumRangesViewState.js.map +1 -1
  70. package/lib/component/hooks/useExport.d.ts.map +1 -1
  71. package/lib/component/hooks/useExport.js +24 -6
  72. package/lib/component/hooks/useExport.js.map +1 -1
  73. package/lib/component/loader/Spinner.js +1 -1
  74. package/lib/component/loader/Spinner.js.map +1 -1
  75. package/lib/component/loader/useLoadFiles.d.ts.map +1 -1
  76. package/lib/component/loader/useLoadFiles.js +60 -25
  77. package/lib/component/loader/useLoadFiles.js.map +1 -1
  78. package/lib/component/main/InnerNMRium.d.ts.map +1 -1
  79. package/lib/component/main/InnerNMRium.js +4 -2
  80. package/lib/component/main/InnerNMRium.js.map +1 -1
  81. package/lib/component/main/NMRiumStateProvider.d.ts.map +1 -1
  82. package/lib/component/main/NMRiumStateProvider.js +17 -6
  83. package/lib/component/main/NMRiumStateProvider.js.map +1 -1
  84. package/lib/component/modal/LoadJCAMPModal.d.ts.map +1 -1
  85. package/lib/component/modal/LoadJCAMPModal.js +7 -3
  86. package/lib/component/modal/LoadJCAMPModal.js.map +1 -1
  87. package/lib/component/modal/MoleculeStructureEditorModal.d.ts.map +1 -1
  88. package/lib/component/modal/MoleculeStructureEditorModal.js +7 -3
  89. package/lib/component/modal/MoleculeStructureEditorModal.js.map +1 -1
  90. package/lib/component/modal/MultipletAnalysisModal.js +0 -2
  91. package/lib/component/modal/MultipletAnalysisModal.js.map +1 -1
  92. package/lib/component/modal/SaveAsModal.d.ts.map +1 -1
  93. package/lib/component/modal/SaveAsModal.js +10 -3
  94. package/lib/component/modal/SaveAsModal.js.map +1 -1
  95. package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts.map +1 -1
  96. package/lib/component/modal/changeSum/ChangeSumModalContents.js +0 -2
  97. package/lib/component/modal/changeSum/ChangeSumModalContents.js.map +1 -1
  98. package/lib/component/modal/changeSum/SelectMolecule.d.ts.map +1 -1
  99. package/lib/component/modal/changeSum/SelectMolecule.js +0 -2
  100. package/lib/component/modal/changeSum/SelectMolecule.js.map +1 -1
  101. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +2 -2
  102. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts.map +1 -1
  103. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js +1 -2
  104. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js.map +1 -1
  105. package/lib/component/modal/setting/settings-tabs/ToolsTabContent.d.ts.map +1 -1
  106. package/lib/component/modal/setting/settings-tabs/ToolsTabContent.js +16 -0
  107. package/lib/component/modal/setting/settings-tabs/ToolsTabContent.js.map +1 -1
  108. package/lib/component/modal/setting/settingsValidation.js +2 -2
  109. package/lib/component/modal/setting/settingsValidation.js.map +1 -1
  110. package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts.map +1 -1
  111. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +2 -1
  112. package/lib/component/panels/IntegralsPanel/IntegralPanel.js.map +1 -1
  113. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +1 -1
  114. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts.map +1 -1
  115. package/lib/component/panels/IntegralsPanel/IntegralTable.js +4 -3
  116. package/lib/component/panels/IntegralsPanel/IntegralTable.js.map +1 -1
  117. package/lib/component/panels/MoleculesPanel/MoleculeOptionsPanel.d.ts +6 -0
  118. package/lib/component/panels/MoleculesPanel/MoleculeOptionsPanel.d.ts.map +1 -0
  119. package/lib/component/panels/MoleculesPanel/MoleculeOptionsPanel.js +87 -0
  120. package/lib/component/panels/MoleculesPanel/MoleculeOptionsPanel.js.map +1 -0
  121. package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts.map +1 -1
  122. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +18 -28
  123. package/lib/component/panels/MoleculesPanel/MoleculePanel.js.map +1 -1
  124. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts.map +1 -1
  125. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +32 -25
  126. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js.map +1 -1
  127. package/lib/component/panels/MoleculesPanel/MoleculeStructure.d.ts +13 -0
  128. package/lib/component/panels/MoleculesPanel/MoleculeStructure.d.ts.map +1 -0
  129. package/lib/component/panels/MoleculesPanel/MoleculeStructure.js +66 -0
  130. package/lib/component/panels/MoleculesPanel/MoleculeStructure.js.map +1 -0
  131. package/lib/component/panels/MoleculesPanel/{useAtomAssignment.d.ts → hooks/useAtomAssignment.d.ts} +1 -1
  132. package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.d.ts.map +1 -0
  133. package/lib/component/panels/MoleculesPanel/{useAtomAssignment.js → hooks/useAtomAssignment.js} +50 -19
  134. package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js.map +1 -0
  135. package/lib/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.d.ts +12 -0
  136. package/lib/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.d.ts.map +1 -0
  137. package/lib/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.js +58 -0
  138. package/lib/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.js.map +1 -0
  139. package/lib/component/panels/MoleculesPanel/utilities/AtomData.d.ts +5 -0
  140. package/lib/component/panels/MoleculesPanel/utilities/AtomData.d.ts.map +1 -0
  141. package/lib/component/panels/MoleculesPanel/utilities/AtomData.js +2 -0
  142. package/lib/component/panels/MoleculesPanel/utilities/AtomData.js.map +1 -0
  143. package/lib/component/panels/MoleculesPanel/utilities/extractFromAtom.d.ts +16 -0
  144. package/lib/component/panels/MoleculesPanel/utilities/extractFromAtom.d.ts.map +1 -0
  145. package/lib/component/panels/MoleculesPanel/utilities/extractFromAtom.js +47 -0
  146. package/lib/component/panels/MoleculesPanel/utilities/extractFromAtom.js.map +1 -0
  147. package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.d.ts +18 -0
  148. package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.d.ts.map +1 -0
  149. package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.js +31 -0
  150. package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.js.map +1 -0
  151. package/lib/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.d.ts +3 -0
  152. package/lib/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.d.ts.map +1 -0
  153. package/lib/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.js +12 -0
  154. package/lib/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.js.map +1 -0
  155. package/lib/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.d.ts +4 -0
  156. package/lib/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.d.ts.map +1 -0
  157. package/lib/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.js +25 -0
  158. package/lib/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.js.map +1 -0
  159. package/lib/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.d.ts +6 -0
  160. package/lib/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.d.ts.map +1 -0
  161. package/lib/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.js +18 -0
  162. package/lib/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.js.map +1 -0
  163. package/lib/component/panels/PeaksPanel/PeaksPanel.d.ts.map +1 -1
  164. package/lib/component/panels/PeaksPanel/PeaksPanel.js +24 -26
  165. package/lib/component/panels/PeaksPanel/PeaksPanel.js.map +1 -1
  166. package/lib/component/panels/PeaksPanel/PeaksTable.d.ts +1 -1
  167. package/lib/component/panels/PeaksPanel/PeaksTable.d.ts.map +1 -1
  168. package/lib/component/panels/PeaksPanel/PeaksTable.js +3 -2
  169. package/lib/component/panels/PeaksPanel/PeaksTable.js.map +1 -1
  170. package/lib/component/panels/RangesPanel/RangesHeader.d.ts.map +1 -1
  171. package/lib/component/panels/RangesPanel/RangesHeader.js +3 -2
  172. package/lib/component/panels/RangesPanel/RangesHeader.js.map +1 -1
  173. package/lib/component/panels/RangesPanel/RangesTable.d.ts +1 -1
  174. package/lib/component/panels/RangesPanel/RangesTable.d.ts.map +1 -1
  175. package/lib/component/panels/RangesPanel/RangesTable.js +2 -1
  176. package/lib/component/panels/RangesPanel/RangesTable.js.map +1 -1
  177. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -2
  178. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js.map +1 -1
  179. package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +2 -2
  180. package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js.map +1 -1
  181. package/lib/component/panels/SpectraPanel/SpectraTable.d.ts.map +1 -1
  182. package/lib/component/panels/SpectraPanel/SpectraTable.js +3 -2
  183. package/lib/component/panels/SpectraPanel/SpectraTable.js.map +1 -1
  184. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +2 -2
  185. package/lib/component/panels/SummaryPanel/utilities/Utilities.js.map +1 -1
  186. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +1 -1
  187. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js.map +1 -1
  188. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.d.ts.map +1 -1
  189. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +0 -4
  190. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js.map +1 -1
  191. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +8 -8
  192. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js.map +1 -1
  193. package/lib/component/panels/ZonesPanel/ZonesPanel.d.ts.map +1 -1
  194. package/lib/component/panels/ZonesPanel/ZonesPanel.js +6 -1
  195. package/lib/component/panels/ZonesPanel/ZonesPanel.js.map +1 -1
  196. package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +8 -9
  197. package/lib/component/panels/ZonesPanel/ZonesTable.d.ts.map +1 -1
  198. package/lib/component/panels/ZonesPanel/ZonesTable.js +3 -2
  199. package/lib/component/panels/ZonesPanel/ZonesTable.js.map +1 -1
  200. package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts.map +1 -1
  201. package/lib/component/panels/ZonesPanel/ZonesTableRow.js +0 -2
  202. package/lib/component/panels/ZonesPanel/ZonesTableRow.js.map +1 -1
  203. package/lib/component/panels/ZonesPanel/hooks/useMapZones.d.ts +7 -7
  204. package/lib/component/panels/ZonesPanel/hooks/useMapZones.d.ts.map +1 -1
  205. package/lib/component/panels/ZonesPanel/hooks/useMapZones.js +3 -3
  206. package/lib/component/panels/ZonesPanel/hooks/useMapZones.js.map +1 -1
  207. package/lib/component/panels/databasePanel/DatabasePanel.d.ts.map +1 -1
  208. package/lib/component/panels/databasePanel/DatabasePanel.js +13 -10
  209. package/lib/component/panels/databasePanel/DatabasePanel.js.map +1 -1
  210. package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.d.ts.map +1 -1
  211. package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.js +0 -2
  212. package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.js.map +1 -1
  213. package/lib/component/panels/hooks/useMoleculeAnnotationCore.d.ts +9 -0
  214. package/lib/component/panels/hooks/useMoleculeAnnotationCore.d.ts.map +1 -0
  215. package/lib/component/panels/hooks/useMoleculeAnnotationCore.js +27 -0
  216. package/lib/component/panels/hooks/useMoleculeAnnotationCore.js.map +1 -0
  217. package/lib/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.d.ts.map +1 -1
  218. package/lib/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.js +0 -2
  219. package/lib/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.js.map +1 -1
  220. package/lib/component/reducer/IgnoreActions.d.ts.map +1 -1
  221. package/lib/component/reducer/IgnoreActions.js +2 -1
  222. package/lib/component/reducer/IgnoreActions.js.map +1 -1
  223. package/lib/component/reducer/Reducer.d.ts +13 -1
  224. package/lib/component/reducer/Reducer.d.ts.map +1 -1
  225. package/lib/component/reducer/Reducer.js +10 -3
  226. package/lib/component/reducer/Reducer.js.map +1 -1
  227. package/lib/component/reducer/actions/DatabaseActions.d.ts.map +1 -1
  228. package/lib/component/reducer/actions/DatabaseActions.js +2 -1
  229. package/lib/component/reducer/actions/DatabaseActions.js.map +1 -1
  230. package/lib/component/reducer/actions/IntegralsActions.js.map +1 -1
  231. package/lib/component/reducer/actions/{LoadActions.d.ts → LoadAction.d.ts} +16 -5
  232. package/lib/component/reducer/actions/LoadAction.d.ts.map +1 -0
  233. package/lib/component/reducer/actions/{LoadActions.js → LoadAction.js} +60 -16
  234. package/lib/component/reducer/actions/LoadAction.js.map +1 -0
  235. package/lib/component/reducer/actions/MoleculeActions.d.ts +22 -6
  236. package/lib/component/reducer/actions/MoleculeActions.d.ts.map +1 -1
  237. package/lib/component/reducer/actions/MoleculeActions.js +43 -29
  238. package/lib/component/reducer/actions/MoleculeActions.js.map +1 -1
  239. package/lib/component/reducer/actions/RangesActions.d.ts +12 -6
  240. package/lib/component/reducer/actions/RangesActions.d.ts.map +1 -1
  241. package/lib/component/reducer/actions/RangesActions.js +37 -16
  242. package/lib/component/reducer/actions/RangesActions.js.map +1 -1
  243. package/lib/component/reducer/actions/ZonesActions.d.ts +3 -3
  244. package/lib/component/reducer/actions/ZonesActions.d.ts.map +1 -1
  245. package/lib/component/reducer/actions/ZonesActions.js +9 -4
  246. package/lib/component/reducer/actions/ZonesActions.js.map +1 -1
  247. package/lib/component/reducer/preferences/actions/changeDefaultMoleculeSettings.d.ts +4 -0
  248. package/lib/component/reducer/preferences/actions/changeDefaultMoleculeSettings.d.ts.map +1 -0
  249. package/lib/component/reducer/preferences/actions/changeDefaultMoleculeSettings.js +7 -0
  250. package/lib/component/reducer/preferences/actions/changeDefaultMoleculeSettings.js.map +1 -0
  251. package/lib/component/reducer/preferences/actions/initPreferences.d.ts.map +1 -1
  252. package/lib/component/reducer/preferences/actions/initPreferences.js +1 -2
  253. package/lib/component/reducer/preferences/actions/initPreferences.js.map +1 -1
  254. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts.map +1 -1
  255. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +2 -1
  256. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js.map +1 -1
  257. package/lib/component/reducer/preferences/preferencesReducer.d.ts +9 -8
  258. package/lib/component/reducer/preferences/preferencesReducer.d.ts.map +1 -1
  259. package/lib/component/reducer/preferences/preferencesReducer.js +3 -1
  260. package/lib/component/reducer/preferences/preferencesReducer.js.map +1 -1
  261. package/lib/component/toolbar/ToolTypes.d.ts.map +1 -1
  262. package/lib/component/toolbar/ToolTypes.js +1 -0
  263. package/lib/component/toolbar/ToolTypes.js.map +1 -1
  264. package/lib/component/utility/export.d.ts +3 -3
  265. package/lib/component/utility/export.d.ts.map +1 -1
  266. package/lib/component/utility/export.js +13 -21
  267. package/lib/component/utility/export.js.map +1 -1
  268. package/lib/component/utility/getClosePeak.js +1 -1
  269. package/lib/component/utility/getClosePeak.js.map +1 -1
  270. package/lib/component/utility/save_as.d.ts +9 -0
  271. package/lib/component/utility/save_as.d.ts.map +1 -0
  272. package/lib/component/utility/save_as.js +7 -0
  273. package/lib/component/utility/save_as.js.map +1 -0
  274. package/lib/component/workspaces/assignment.d.ts.map +1 -1
  275. package/lib/component/workspaces/assignment.js +7 -0
  276. package/lib/component/workspaces/assignment.js.map +1 -1
  277. package/lib/component/workspaces/basic.d.ts.map +1 -1
  278. package/lib/component/workspaces/basic.js +5 -0
  279. package/lib/component/workspaces/basic.js.map +1 -1
  280. package/lib/component/workspaces/embedded.d.ts.map +1 -1
  281. package/lib/component/workspaces/embedded.js +5 -0
  282. package/lib/component/workspaces/embedded.js.map +1 -1
  283. package/lib/component/workspaces/exercise.d.ts.map +1 -1
  284. package/lib/component/workspaces/exercise.js +5 -0
  285. package/lib/component/workspaces/exercise.js.map +1 -1
  286. package/lib/component/workspaces/prediction.d.ts.map +1 -1
  287. package/lib/component/workspaces/prediction.js +5 -0
  288. package/lib/component/workspaces/prediction.js.map +1 -1
  289. package/lib/component/workspaces/process1D.d.ts.map +1 -1
  290. package/lib/component/workspaces/process1D.js +6 -0
  291. package/lib/component/workspaces/process1D.js.map +1 -1
  292. package/lib/component/workspaces/workspaceDefaultProperties.d.ts.map +1 -1
  293. package/lib/component/workspaces/workspaceDefaultProperties.js +18 -0
  294. package/lib/component/workspaces/workspaceDefaultProperties.js.map +1 -1
  295. package/lib/data/PredictionManager.d.ts.map +1 -1
  296. package/lib/data/PredictionManager.js +13 -9
  297. package/lib/data/PredictionManager.js.map +1 -1
  298. package/lib/data/SpectraManager.d.ts +45 -4
  299. package/lib/data/SpectraManager.d.ts.map +1 -1
  300. package/lib/data/SpectraManager.js +69 -12
  301. package/lib/data/SpectraManager.js.map +1 -1
  302. package/lib/data/constants/signalsKinds.d.ts +1 -6
  303. package/lib/data/constants/signalsKinds.d.ts.map +1 -1
  304. package/lib/data/constants/signalsKinds.js +2 -17
  305. package/lib/data/constants/signalsKinds.js.map +1 -1
  306. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +1 -1
  307. package/lib/data/data1d/Spectrum1D/generateJGraphData.js.map +1 -1
  308. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +16 -14
  309. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js.map +1 -1
  310. package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +1 -10
  311. package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts.map +1 -1
  312. package/lib/data/data1d/Spectrum1D/isRangeAssigned.d.ts.map +1 -1
  313. package/lib/data/data1d/Spectrum1D/isRangeAssigned.js.map +1 -1
  314. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.d.ts.map +1 -1
  315. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -4
  316. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js.map +1 -1
  317. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts.map +1 -1
  318. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.js +5 -1
  319. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.js.map +1 -1
  320. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +1 -1
  321. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +1 -1
  322. package/lib/data/data2d/Spectrum2D/contours.d.ts.map +1 -1
  323. package/lib/data/data2d/Spectrum2D/contours.js +1 -1
  324. package/lib/data/data2d/Spectrum2D/contours.js.map +1 -1
  325. package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts.map +1 -1
  326. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +6 -4
  327. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js.map +1 -1
  328. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +2 -2
  329. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts.map +1 -1
  330. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +2 -2
  331. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts.map +1 -1
  332. package/lib/data/molecules/Molecule.d.ts +2 -22
  333. package/lib/data/molecules/Molecule.d.ts.map +1 -1
  334. package/lib/data/molecules/Molecule.js +3 -1
  335. package/lib/data/molecules/Molecule.js.map +1 -1
  336. package/lib/data/molecules/MoleculeManager.d.ts +3 -2
  337. package/lib/data/molecules/MoleculeManager.d.ts.map +1 -1
  338. package/lib/data/molecules/MoleculeManager.js +4 -2
  339. package/lib/data/molecules/MoleculeManager.js.map +1 -1
  340. package/lib/data/utilities/RangeUtilities.d.ts +3 -2
  341. package/lib/data/utilities/RangeUtilities.d.ts.map +1 -1
  342. package/lib/data/utilities/RangeUtilities.js +9 -3
  343. package/lib/data/utilities/RangeUtilities.js.map +1 -1
  344. package/lib/data/utilities/ZoneUtilities.d.ts.map +1 -1
  345. package/lib/data/utilities/ZoneUtilities.js +1 -2
  346. package/lib/data/utilities/ZoneUtilities.js.map +1 -1
  347. package/lib/data/utilities/isProton.d.ts +2 -0
  348. package/lib/data/utilities/isProton.d.ts.map +1 -0
  349. package/lib/data/utilities/isProton.js +4 -0
  350. package/lib/data/utilities/isProton.js.map +1 -0
  351. package/lib/versionInfo.js +1 -1
  352. package/package.json +32 -32
  353. package/src/component/1d/FloatingRanges.tsx +5 -5
  354. package/src/component/1d/database/DatabaseSpectrum.tsx +1 -1
  355. package/src/component/1d/multiAnalysis/MultiAnalysisRanges.tsx +1 -1
  356. package/src/component/1d/multiplicityTree/MultiplicityTree.tsx +4 -2
  357. package/src/component/1d/peaks/PeakAnnotations.tsx +2 -1
  358. package/src/component/1d/peaks/PeakAnnotationsSpreadMode.tsx +11 -1
  359. package/src/component/1d/peaks/Peaks.tsx +9 -3
  360. package/src/component/1d/ranges/Atoms.tsx +36 -13
  361. package/src/component/1d/ranges/Range.tsx +4 -3
  362. package/src/component/1d/ranges/RangesIntegrals.tsx +6 -2
  363. package/src/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.tsx +38 -78
  364. package/src/component/1d-2d/components/FloatMoleculeStructures/FloatMolecules.tsx +5 -2
  365. package/src/component/2d/FooterBanner.tsx +2 -2
  366. package/src/component/2d/YAxis.tsx +31 -13
  367. package/src/component/2d/useTracesSpectra.ts +3 -0
  368. package/src/component/2d/utilities/extractSpectrumSignals.ts +6 -16
  369. package/src/component/2d/zones/SignalsGuideLines.tsx +11 -9
  370. package/src/component/2d/zones/ZonesAssignmentsLabels.tsx +2 -3
  371. package/src/component/context/DispatchContext.tsx +2 -2
  372. package/src/component/context/LoggerContext.tsx +8 -11
  373. package/src/component/context/PreferencesContext.tsx +8 -5
  374. package/src/component/elements/D3Axis.tsx +1 -2
  375. package/src/component/elements/Sections.tsx +1 -1
  376. package/src/component/hooks/useActiveSpectrumRangesViewState.ts +2 -2
  377. package/src/component/hooks/useExport.tsx +38 -6
  378. package/src/component/loader/Spinner.tsx +1 -1
  379. package/src/component/loader/useLoadFiles.ts +79 -30
  380. package/src/component/main/InnerNMRium.tsx +6 -2
  381. package/src/component/main/NMRiumStateProvider.tsx +18 -7
  382. package/src/component/modal/LoadJCAMPModal.tsx +10 -5
  383. package/src/component/modal/MoleculeStructureEditorModal.tsx +11 -3
  384. package/src/component/modal/MultipletAnalysisModal.tsx +0 -2
  385. package/src/component/modal/SaveAsModal.tsx +35 -6
  386. package/src/component/modal/changeSum/ChangeSumModalContents.tsx +0 -2
  387. package/src/component/modal/changeSum/SelectMolecule.tsx +0 -2
  388. package/src/component/modal/setting/settings-tabs/DatabasesTabContent.tsx +1 -3
  389. package/src/component/modal/setting/settings-tabs/ToolsTabContent.tsx +16 -0
  390. package/src/component/modal/setting/settingsValidation.ts +2 -2
  391. package/src/component/panels/IntegralsPanel/IntegralPanel.tsx +2 -6
  392. package/src/component/panels/IntegralsPanel/IntegralTable.tsx +4 -3
  393. package/src/component/panels/MoleculesPanel/MoleculeOptionsPanel.tsx +160 -0
  394. package/src/component/panels/MoleculesPanel/MoleculePanel.tsx +77 -102
  395. package/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx +54 -35
  396. package/src/component/panels/MoleculesPanel/MoleculeStructure.tsx +117 -0
  397. package/src/component/panels/MoleculesPanel/{useAtomAssignment.tsx → hooks/useAtomAssignment.tsx} +71 -30
  398. package/src/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.ts +74 -0
  399. package/src/component/panels/MoleculesPanel/utilities/AtomData.ts +4 -0
  400. package/src/component/panels/MoleculesPanel/utilities/extractFromAtom.ts +63 -0
  401. package/src/component/panels/MoleculesPanel/utilities/getAssignIds.ts +59 -0
  402. package/src/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.ts +12 -0
  403. package/src/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.ts +36 -0
  404. package/src/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.ts +20 -0
  405. package/src/component/panels/PeaksPanel/PeaksPanel.tsx +25 -35
  406. package/src/component/panels/PeaksPanel/PeaksTable.tsx +3 -2
  407. package/src/component/panels/RangesPanel/RangesHeader.tsx +3 -2
  408. package/src/component/panels/RangesPanel/RangesTable.tsx +10 -8
  409. package/src/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.tsx +3 -3
  410. package/src/component/panels/RangesPanel/TableColumns/RelativeColumn.tsx +2 -2
  411. package/src/component/panels/SpectraPanel/SpectraTable.tsx +3 -2
  412. package/src/component/panels/SummaryPanel/utilities/Utilities.ts +2 -2
  413. package/src/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.tsx +1 -1
  414. package/src/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.tsx +0 -4
  415. package/src/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.tsx +9 -9
  416. package/src/component/panels/ZonesPanel/ZonesPanel.tsx +15 -5
  417. package/src/component/panels/ZonesPanel/ZonesTable.tsx +9 -10
  418. package/src/component/panels/ZonesPanel/ZonesTableRow.tsx +0 -2
  419. package/src/component/panels/ZonesPanel/hooks/useMapZones.ts +11 -11
  420. package/src/component/panels/databasePanel/DatabasePanel.tsx +18 -14
  421. package/src/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.tsx +0 -2
  422. package/src/component/panels/hooks/useMoleculeAnnotationCore.ts +36 -0
  423. package/src/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.tsx +0 -2
  424. package/src/component/reducer/IgnoreActions.ts +2 -1
  425. package/src/component/reducer/Reducer.ts +28 -4
  426. package/src/component/reducer/actions/DatabaseActions.ts +3 -0
  427. package/src/component/reducer/actions/IntegralsActions.ts +1 -1
  428. package/src/component/reducer/actions/{LoadActions.ts → LoadAction.ts} +87 -25
  429. package/src/component/reducer/actions/MoleculeActions.ts +91 -44
  430. package/src/component/reducer/actions/RangesActions.ts +66 -30
  431. package/src/component/reducer/actions/ZonesActions.ts +18 -10
  432. package/src/component/reducer/preferences/actions/changeDefaultMoleculeSettings.ts +16 -0
  433. package/src/component/reducer/preferences/actions/initPreferences.ts +0 -3
  434. package/src/component/reducer/preferences/panelsPreferencesDefaultValues.ts +2 -1
  435. package/src/component/reducer/preferences/preferencesReducer.ts +20 -11
  436. package/src/component/toolbar/ToolTypes.ts +1 -0
  437. package/src/component/utility/export.ts +15 -20
  438. package/src/component/utility/getClosePeak.ts +1 -1
  439. package/src/component/utility/save_as.ts +16 -0
  440. package/src/component/workspaces/assignment.ts +7 -0
  441. package/src/component/workspaces/basic.ts +5 -0
  442. package/src/component/workspaces/embedded.ts +5 -0
  443. package/src/component/workspaces/exercise.ts +5 -0
  444. package/src/component/workspaces/prediction.ts +5 -0
  445. package/src/component/workspaces/process1D.ts +6 -0
  446. package/src/component/workspaces/workspaceDefaultProperties.ts +18 -0
  447. package/src/data/PredictionManager.ts +21 -14
  448. package/src/data/SpectraManager.ts +90 -19
  449. package/src/data/constants/signalsKinds.ts +5 -20
  450. package/src/data/data1d/Spectrum1D/generateJGraphData.ts +1 -1
  451. package/src/data/data1d/Spectrum1D/initiateDatum1D.ts +16 -16
  452. package/src/data/data1d/Spectrum1D/isRangeAssigned.ts +1 -0
  453. package/src/data/data1d/Spectrum1D/ranges/autoRangesDetection.ts +7 -4
  454. package/src/data/data1d/Spectrum1D/ranges/detectRanges.ts +8 -1
  455. package/src/data/data1d/Spectrum1D/ranges/detectSignals.ts +1 -1
  456. package/src/data/data2d/Spectrum2D/contours.ts +2 -3
  457. package/src/data/data2d/Spectrum2D/initiateDatum2D.ts +6 -7
  458. package/src/data/molecules/Molecule.ts +9 -23
  459. package/src/data/molecules/MoleculeManager.ts +10 -8
  460. package/src/data/utilities/RangeUtilities.ts +12 -4
  461. package/src/data/utilities/ZoneUtilities.ts +1 -3
  462. package/src/data/utilities/isProton.ts +3 -0
  463. package/src/index.tsx +0 -3
  464. package/src/versionInfo.ts +1 -1
  465. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +0 -43
  466. package/lib/component/panels/MoleculesPanel/Utilities.d.ts.map +0 -1
  467. package/lib/component/panels/MoleculesPanel/Utilities.js +0 -126
  468. package/lib/component/panels/MoleculesPanel/Utilities.js.map +0 -1
  469. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts.map +0 -1
  470. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js.map +0 -1
  471. package/lib/component/reducer/actions/LoadActions.d.ts.map +0 -1
  472. package/lib/component/reducer/actions/LoadActions.js.map +0 -1
  473. package/lib/component/utility/isHomoNuclear.d.ts +0 -2
  474. package/lib/component/utility/isHomoNuclear.d.ts.map +0 -1
  475. package/lib/component/utility/isHomoNuclear.js +0 -11
  476. package/lib/component/utility/isHomoNuclear.js.map +0 -1
  477. package/lib/data/types/common/SignalKind.d.ts +0 -2
  478. package/lib/data/types/common/SignalKind.d.ts.map +0 -1
  479. package/lib/data/types/common/SignalKind.js +0 -2
  480. package/lib/data/types/common/SignalKind.js.map +0 -1
  481. package/lib/utils/stringCapitalize.d.ts +0 -2
  482. package/lib/utils/stringCapitalize.d.ts.map +0 -1
  483. package/lib/utils/stringCapitalize.js +0 -4
  484. package/lib/utils/stringCapitalize.js.map +0 -1
  485. package/src/component/panels/MoleculesPanel/Utilities.ts +0 -186
  486. package/src/component/utility/isHomoNuclear.ts +0 -11
  487. package/src/data/types/common/SignalKind.ts +0 -10
  488. package/src/utils/stringCapitalize.ts +0 -3
@@ -3,26 +3,30 @@ import type { DiaIDAndInfo } from 'openchemlib-utils';
3
3
  import type { MouseEvent } from 'react';
4
4
  import { useMemo, useRef } from 'react';
5
5
 
6
- import { isSpectrum1D } from '../../../data/data1d/Spectrum1D/isSpectrum1D.js';
7
- import { ConcatenationString } from '../../../data/utilities/Concatenation.js';
8
- import checkModifierKeyActivated from '../../../data/utilities/checkModifierKeyActivated.js';
9
- import type { Assignments, Axis } from '../../assignment/AssignmentsContext.js';
10
- import { useAssignmentContext } from '../../assignment/AssignmentsContext.js';
11
- import { useChartData } from '../../context/ChartContext.js';
12
- import { useDispatch } from '../../context/DispatchContext.js';
13
- import { useToaster } from '../../context/ToasterContext.js';
14
- import type { HighlightEventSource } from '../../highlight/index.js';
15
- import { useHighlightData } from '../../highlight/index.js';
16
- import useSpectrum from '../../hooks/useSpectrum.js';
17
-
18
- import type { AtomData } from './Utilities.js';
19
- import {
20
- extractFromAtom,
21
- getAssignIds,
22
- getCurrentDiaIDsToHighlight,
23
- getHighlightsOnHover,
24
- getUniqueDiaIDs,
25
- } from './Utilities.js';
6
+ import { isSpectrum1D } from '../../../../data/data1d/Spectrum1D/isSpectrum1D.ts';
7
+ import { isSpectrum2D } from '../../../../data/data2d/Spectrum2D/isSpectrum2D.ts';
8
+ import { ConcatenationString } from '../../../../data/utilities/Concatenation.ts';
9
+ import checkModifierKeyActivated from '../../../../data/utilities/checkModifierKeyActivated.ts';
10
+ import { useTracesSpectra } from '../../../2d/useTracesSpectra.ts';
11
+ import type {
12
+ Assignments,
13
+ Axis,
14
+ } from '../../../assignment/AssignmentsContext.ts';
15
+ import { useAssignmentContext } from '../../../assignment/AssignmentsContext.ts';
16
+ import { useChartData } from '../../../context/ChartContext.tsx';
17
+ import { useDispatch } from '../../../context/DispatchContext.tsx';
18
+ import { useToaster } from '../../../context/ToasterContext.tsx';
19
+ import type { HighlightEventSource } from '../../../highlight/index.tsx';
20
+ import { useHighlightData } from '../../../highlight/index.tsx';
21
+ import useSpectrum from '../../../hooks/useSpectrum.ts';
22
+ import type { AtomData } from '../utilities/AtomData.ts';
23
+ import { extractFromAtom } from '../utilities/extractFromAtom.ts';
24
+ import { getAssignIds } from '../utilities/getAssignIds.ts';
25
+ import { getCurrentDiaIDsToHighlight } from '../utilities/getCurrentDiaIDsToHighlight.ts';
26
+ import { getHighlightsOnHover } from '../utilities/getHighlightsOnHover.ts';
27
+ import { getUniqueDiaIDs } from '../utilities/getUniqueDiaIDs.ts';
28
+
29
+ import { useExtractAtomAssignmentLabel } from './useExtractAtomAssignmentLabel.ts';
26
30
 
27
31
  function flattenAssignedDiaIDs(assignments: Assignments) {
28
32
  const assignedDiaIDs: string[] = [];
@@ -75,11 +79,14 @@ export default function useAtomAssignment() {
75
79
  },
76
80
  } = useChartData();
77
81
  const spectrum = useSpectrum();
82
+ const tracesSpectra = useTracesSpectra();
83
+
78
84
  const toaster = useToaster();
79
85
  const dispatch = useDispatch();
80
86
  const highlightData = useHighlightData();
81
87
  const highlightedIdDsRef = useRef<string[]>([]);
82
88
  const assignments = useAssignmentContext();
89
+ const { getAssignmentLabelById } = useExtractAtomAssignmentLabel();
83
90
  const { activated: activatedAssignment } = assignments;
84
91
 
85
92
  const activatedKey = activatedAssignment
@@ -94,23 +101,44 @@ export default function useAtomAssignment() {
94
101
 
95
102
  const currentDiaIDsToHighlight = useMemo(() => {
96
103
  const { highlighted, sourceData } = highlightData.highlight;
97
- const type = sourceData?.type;
104
+ const { type, extra } = sourceData || {};
105
+ const { spectrumID } = extra || {};
106
+
107
+ let currentSpectrum = spectrum;
98
108
 
99
- if (!type || !isValidHighlightEventSource(type)) return [];
109
+ if (isSpectrum2D(spectrum) && spectrumID) {
110
+ const traceSpectrum = tracesSpectra.find(
111
+ (traceSpectrum) => traceSpectrum.id === spectrumID,
112
+ );
113
+ if (traceSpectrum) {
114
+ currentSpectrum = traceSpectrum;
115
+ }
116
+ }
117
+
118
+ if (!type || !isValidHighlightEventSource(type) || !currentSpectrum) {
119
+ return [];
120
+ }
100
121
 
101
122
  const highlightedAssignmentsIDs = highlighted.filter((highlightID) => {
102
123
  return assignments.data[highlightID];
103
124
  });
104
125
 
105
126
  const highlights = highlightedAssignmentsIDs.flatMap((highlightID) =>
106
- getSignalsDiaIDs(spectrum, assignments.data, highlightID),
127
+ getSignalsDiaIDs(currentSpectrum, assignments.data, highlightID),
107
128
  );
108
-
109
129
  return getCurrentDiaIDsToHighlight(assignments).concat(highlights);
110
- }, [assignments, highlightData.highlight, spectrum]);
130
+ }, [assignments, highlightData.highlight, spectrum, tracesSpectra]);
111
131
 
112
- function assign1DAtom(spectrum: Spectrum1D, key: string, atom: AtomData) {
113
- const assignKeys = getAssignIds(spectrum, key);
132
+ interface Assign1DOptions {
133
+ spectrum: Spectrum1D;
134
+ assignId: string;
135
+ atom: AtomData;
136
+ assignmentLabel?: string;
137
+ }
138
+
139
+ function assign1DAtom(options: Assign1DOptions) {
140
+ const { spectrum, assignId, atom, assignmentLabel } = options;
141
+ const assignKeys = getAssignIds(spectrum, assignId);
114
142
 
115
143
  if (!assignKeys) return;
116
144
  const [{ index: rangeIndex }] = assignKeys;
@@ -137,6 +165,7 @@ export default function useAtomAssignment() {
137
165
  diaIDs: uniqueDiaIDs.diaIDs,
138
166
  keys: assignKeys,
139
167
  spectrumId,
168
+ assignment: assignmentLabel || '',
140
169
  },
141
170
  });
142
171
  }
@@ -176,6 +205,7 @@ export default function useAtomAssignment() {
176
205
  function handleOnClickAtom(
177
206
  diaIDAndInfo: DiaIDAndInfo | undefined,
178
207
  event: MouseEvent,
208
+ moleculeId: string,
179
209
  ) {
180
210
  if (checkModifierKeyActivated(event) || !activatedAssignment) return;
181
211
 
@@ -185,6 +215,10 @@ export default function useAtomAssignment() {
185
215
  if (!id || !axis) {
186
216
  return;
187
217
  }
218
+
219
+ const assignmentLabel = diaIDAndInfo?.idCode
220
+ ? getAssignmentLabelById(moleculeId, diaIDAndInfo.idCode)
221
+ : '';
188
222
  const atomInformation = extractFromAtom(diaIDAndInfo, nucleus, axis);
189
223
 
190
224
  if (atomInformation.nbAtoms === 0) {
@@ -209,7 +243,12 @@ export default function useAtomAssignment() {
209
243
  if (!currentSpectrum) return;
210
244
 
211
245
  if (isSpectrum1D(currentSpectrum)) {
212
- assign1DAtom(currentSpectrum, activatedAssignment.id, atomInformation);
246
+ assign1DAtom({
247
+ spectrum: currentSpectrum,
248
+ assignId: activatedAssignment.id,
249
+ atom: atomInformation,
250
+ assignmentLabel,
251
+ });
213
252
  } else {
214
253
  assign2DAtom(
215
254
  currentSpectrum,
@@ -223,11 +262,13 @@ export default function useAtomAssignment() {
223
262
 
224
263
  function handleOnAtomHover(diaIDAndInfo: DiaIDAndInfo | undefined) {
225
264
  const { oclIDs } = extractFromAtom(diaIDAndInfo, nucleus);
226
-
227
265
  // on enter the atom
228
266
  if (oclIDs.length > 0) {
229
267
  // set all IDs to highlight when hovering over an atom from assignment data
230
- const highlights = getHighlightsOnHover(assignments, oclIDs, spectrum);
268
+ const highlights = getHighlightsOnHover(assignments, oclIDs, [
269
+ spectrum,
270
+ ...tracesSpectra,
271
+ ]);
231
272
  highlightedIdDsRef.current = highlights;
232
273
  highlightData.dispatch({
233
274
  type: 'SHOW',
@@ -0,0 +1,74 @@
1
+ import { Molecule } from 'openchemlib';
2
+ import type { DiaIDAndInfo } from 'openchemlib-utils';
3
+ import { useRef } from 'react';
4
+
5
+ import { useTopicMolecule } from '../../../context/TopicMoleculeContext.tsx';
6
+
7
+ export function useExtractAtomAssignmentLabel() {
8
+ const topicMolecule = useTopicMolecule();
9
+ const lastHoverAtomIdRef = useRef<DiaIDAndInfo>();
10
+
11
+ function getLastHoverAtom() {
12
+ return lastHoverAtomIdRef.current;
13
+ }
14
+
15
+ function getTopicAtom(moleculeId: string, oclId: string, molfile?: string) {
16
+ const baseMolecule = topicMolecule?.[moleculeId];
17
+
18
+ if (!baseMolecule) return;
19
+
20
+ const molecule = molfile
21
+ ? baseMolecule.fromMolecule(Molecule.fromMolfile(molfile))
22
+ : baseMolecule;
23
+
24
+ const groupedDiaIdsMapping = molecule.getGroupedDiastereotopicAtomIDs();
25
+ if (!Array.isArray(groupedDiaIdsMapping)) return;
26
+
27
+ return groupedDiaIdsMapping.find((obj: any) => obj.oclID === oclId);
28
+ }
29
+
30
+ function getTopicAtomByHover(moleculeId: string, molfile?: string) {
31
+ if (!lastHoverAtomIdRef.current) return;
32
+
33
+ return getTopicAtom(moleculeId, lastHoverAtomIdRef.current.idCode, molfile);
34
+ }
35
+
36
+ function onAtomHover(atom: DiaIDAndInfo | undefined) {
37
+ lastHoverAtomIdRef.current = atom;
38
+ }
39
+
40
+ function getAssignmentLabelById(
41
+ moleculeId: string,
42
+ oclID: string,
43
+ molfile?: string,
44
+ ) {
45
+ const atomData = getTopicAtom(moleculeId, oclID, molfile);
46
+ if (!atomData) return;
47
+
48
+ const { customLabels = [], heavyAtomsCustomLabels = [] } = atomData;
49
+ const labels =
50
+ customLabels.length > 0 ? customLabels : heavyAtomsCustomLabels;
51
+
52
+ const uniqueLabels = [
53
+ ...new Set(labels.map((l: string) => l.trim()).filter(Boolean)),
54
+ ];
55
+ return uniqueLabels.join(',');
56
+ }
57
+
58
+ function getAssignmentLabelByHover(moleculeId: string, molfile?: string) {
59
+ const diaId = lastHoverAtomIdRef.current?.idCode;
60
+ if (!diaId) return;
61
+ return {
62
+ assignment: getAssignmentLabelById(moleculeId, diaId, molfile),
63
+ previousAssignment: getAssignmentLabelById(moleculeId, diaId),
64
+ };
65
+ }
66
+
67
+ return {
68
+ getAssignmentLabelByHover,
69
+ getAssignmentLabelById,
70
+ onAtomHover,
71
+ getLastHoverAtom,
72
+ getTopicAtomByHover,
73
+ };
74
+ }
@@ -0,0 +1,4 @@
1
+ export interface AtomData {
2
+ oclIDs: string[];
3
+ nbAtoms: number;
4
+ }
@@ -0,0 +1,63 @@
1
+ import type { DiaIDAndInfo } from 'openchemlib-utils';
2
+
3
+ import type { Axis } from '../../../assignment/AssignmentsContext.js';
4
+
5
+ import type { AtomData } from './AtomData.ts';
6
+
7
+ /**
8
+ * Returns the OCL id(s) and number of atoms of an atom when hovering over
9
+ * or clicking on it. This is depending on an optional given axis.
10
+ * In case of an heavy atom with bonded hydrogens the OCL id(s)
11
+ * and number of these hydrogens are added as well.
12
+ *
13
+ * @param {DiaIDAndInfo} diaIDAndInfo - atom returned by OCLnmr component
14
+ * @param {string} activeTab - active tab
15
+ * @param {Axis} axis - current axis
16
+ *
17
+ */
18
+ export function extractFromAtom(
19
+ diaIDAndInfo: DiaIDAndInfo | undefined,
20
+ activeTab: string,
21
+ axis?: Axis | null,
22
+ ): AtomData {
23
+ const elements = getElements(activeTab);
24
+
25
+ if (elements && elements.length > 0 && diaIDAndInfo) {
26
+ const dim = axis === 'x' ? 0 : axis === 'y' ? 1 : null;
27
+ switch (dim !== null && elements[dim]) {
28
+ case diaIDAndInfo.atomLabel: {
29
+ // take always oclID if atom type is same as element of activeTab)
30
+ return {
31
+ oclIDs: [diaIDAndInfo.idCode],
32
+ nbAtoms: diaIDAndInfo.nbEquivalentAtoms,
33
+ };
34
+ }
35
+ case 'H': {
36
+ // if we are in proton spectrum and use then the IDs of attached hydrogens of an atom
37
+ return {
38
+ oclIDs: diaIDAndInfo.attachedHydrogensIDCodes,
39
+ nbAtoms:
40
+ diaIDAndInfo.nbEquivalentAtoms * diaIDAndInfo.nbAttachedHydrogens,
41
+ };
42
+ }
43
+ default:
44
+ return {
45
+ oclIDs: [diaIDAndInfo.idCode].concat(
46
+ diaIDAndInfo.attachedHydrogensIDCodes,
47
+ ),
48
+ nbAtoms:
49
+ diaIDAndInfo.nbEquivalentAtoms +
50
+ diaIDAndInfo.nbEquivalentAtoms * diaIDAndInfo.nbAttachedHydrogens,
51
+ };
52
+ }
53
+ }
54
+
55
+ return { oclIDs: [], nbAtoms: 0 };
56
+ }
57
+
58
+ function getElements(activeTab: string) {
59
+ if (!activeTab) return;
60
+
61
+ const nuclei = activeTab.split(',');
62
+ return nuclei.map((nucleus) => nucleus.replaceAll(/\d/g, ''));
63
+ }
@@ -0,0 +1,59 @@
1
+ import type { Range, Zone } from '@zakodium/nmr-types';
2
+ import type { Spectrum } from '@zakodium/nmrium-core';
3
+
4
+ import { isSpectrum1D } from '../../../../data/data1d/Spectrum1D/isSpectrum1D.ts';
5
+
6
+ interface TargetAssignment {
7
+ key: string;
8
+ index: number;
9
+ }
10
+
11
+ interface RangeTargetAssignKey extends TargetAssignment {
12
+ target: 'range';
13
+ }
14
+ interface ZoneTargetAssignKey extends TargetAssignment {
15
+ target: 'zone';
16
+ }
17
+ interface SignalTargetAssignKey extends TargetAssignment {
18
+ target: 'signal';
19
+ }
20
+ export type TargetAssignKeys =
21
+ | [RangeTargetAssignKey | ZoneTargetAssignKey]
22
+ | [RangeTargetAssignKey | ZoneTargetAssignKey, SignalTargetAssignKey];
23
+
24
+ export function getAssignIds(
25
+ spectrum: Spectrum,
26
+ id: string,
27
+ ): TargetAssignKeys | null {
28
+ if (!spectrum) return null;
29
+
30
+ const data = getRangesOrZones(spectrum);
31
+ const target = isSpectrum1D(spectrum) ? 'range' : 'zone';
32
+
33
+ for (let i = 0; i < data.length; i++) {
34
+ const datum = data[i];
35
+
36
+ if (datum.id === id) {
37
+ return [{ target, index: i, key: datum.id }];
38
+ }
39
+
40
+ const signalIndex = datum.signals.findIndex((signal) => signal.id === id);
41
+ if (signalIndex !== -1) {
42
+ const { id } = datum.signals[signalIndex];
43
+ return [
44
+ { target, index: i, key: datum.id },
45
+ { target: 'signal', index: signalIndex, key: id },
46
+ ];
47
+ }
48
+ }
49
+
50
+ return null;
51
+ }
52
+
53
+ function getRangesOrZones(spectrum: Spectrum): Array<Range | Zone> {
54
+ if (isSpectrum1D(spectrum)) {
55
+ return spectrum.ranges.values;
56
+ } else {
57
+ return spectrum.zones.values;
58
+ }
59
+ }
@@ -0,0 +1,12 @@
1
+ import type { AssignmentContext } from '../../../assignment/AssignmentsContext.ts';
2
+
3
+ export function getCurrentDiaIDsToHighlight(assignmentData: AssignmentContext) {
4
+ const { highlighted, data } = assignmentData;
5
+ const assignment = highlighted ? data[highlighted.id] : null;
6
+ const axisHover = highlighted ? highlighted.axis : null;
7
+ if (axisHover && assignment?.[axisHover]) {
8
+ return assignment[axisHover];
9
+ } else {
10
+ return (assignment?.x || []).concat(assignment?.y || []);
11
+ }
12
+ }
@@ -0,0 +1,36 @@
1
+ import type { Spectrum } from '@zakodium/nmrium-core';
2
+
3
+ import { assignmentAxes } from '../../../assignment/AssignmentsContext.js';
4
+ import type { AssignmentContext } from '../../../assignment/AssignmentsContext.ts';
5
+
6
+ import { getAssignIds } from './getAssignIds.ts';
7
+
8
+ export function getHighlightsOnHover(
9
+ assignments: AssignmentContext,
10
+ oclIDs: string[],
11
+ spectra: Spectrum[],
12
+ ) {
13
+ // set all IDs to highlight when hovering over an atom from AssignKey data
14
+ let highlights: string[] = [];
15
+ const assignmentsByKey = assignments.data;
16
+
17
+ for (const key in assignmentsByKey) {
18
+ const assignments = assignmentsByKey[key];
19
+ for (const axis of assignmentAxes) {
20
+ if (assignments[axis]?.some((oclKey: any) => oclIDs.includes(oclKey))) {
21
+ highlights = highlights.concat(assignments[axis]);
22
+ for (const spectrum of spectra) {
23
+ const assignIds = getAssignIds(spectrum, key);
24
+ if (!assignIds) {
25
+ continue;
26
+ }
27
+
28
+ const ids = assignIds.map<string>((item) => item.key);
29
+ highlights.push(...ids);
30
+ }
31
+ }
32
+ }
33
+ }
34
+
35
+ return highlights;
36
+ }
@@ -0,0 +1,20 @@
1
+ import type { AtomData } from './AtomData.ts';
2
+
3
+ export function getUniqueDiaIDs(diaIDs: string[], atomInformation: AtomData) {
4
+ // a previous version of the code prevented to assign many time the same atom
5
+ // see revision cc13abc18f77b6787b923e3c4edaef51750d9e90
6
+ const { nbAtoms, oclIDs } = atomInformation;
7
+
8
+ const diaIDSet = new Set(diaIDs);
9
+ let tempNbAtoms: number = nbAtoms;
10
+
11
+ for (const oclID of oclIDs) {
12
+ if (diaIDSet.has(oclID)) {
13
+ tempNbAtoms *= -1;
14
+ diaIDSet.delete(oclID);
15
+ } else {
16
+ diaIDSet.add(oclID);
17
+ }
18
+ }
19
+ return { diaIDs: Array.from(diaIDSet), nbAtoms: tempNbAtoms };
20
+ }
@@ -38,13 +38,8 @@ export interface PeakRecord extends Peak1D {
38
38
  isConstantlyHighlighted: boolean;
39
39
  }
40
40
 
41
- function PeaksPanelInner({
42
- peaks,
43
- info,
44
- xDomain,
45
- activeTab,
46
- peaksViewState,
47
- }: PeaksPanelInnerProps) {
41
+ function PeaksPanelInner(props: PeaksPanelInnerProps) {
42
+ const { peaks, info, xDomain, activeTab, peaksViewState } = props;
48
43
  const [filterIsActive, setFilterIsActive] = useState(false);
49
44
  const [isFlipped, setFlipStatus] = useState(false);
50
45
  const format = useFormatNumberByNucleus(info.nucleus);
@@ -86,29 +81,25 @@ function PeaksPanelInner({
86
81
  }, [filterIsActive]);
87
82
 
88
83
  const filteredPeaks = useMemo<PeakRecord[]>(() => {
89
- if (peaks?.values) {
90
- const [from, to] = xDomain;
91
- const _peaks = filterIsActive
92
- ? peaks.values.filter((peak) => isInRange(peak.x, { from, to }))
93
- : peaks.values;
94
-
95
- const mappedPeaks = _peaks.map((peak) => {
96
- const { x, y, width, ...peakProperties } = peak;
97
- const value = Number(format(x));
98
- return {
99
- ...peakProperties,
100
- x,
101
- xHz: info?.originFrequency && value * info.originFrequency,
102
- y,
103
- width,
104
- isConstantlyHighlighted: isInRange(value, { from, to }),
105
- };
106
- });
107
- mappedPeaks.sort((prev, next) => prev.x - next.x);
108
- return mappedPeaks;
109
- }
110
-
111
- return [];
84
+ const [from, to] = xDomain;
85
+ const _peaks = filterIsActive
86
+ ? peaks.values.filter((peak) => isInRange(peak.x, { from, to }))
87
+ : peaks.values;
88
+
89
+ const mappedPeaks = _peaks.map((peak) => {
90
+ const { x, y, width, ...peakProperties } = peak;
91
+ const value = Number(format(x));
92
+ return {
93
+ ...peakProperties,
94
+ x,
95
+ xHz: info.originFrequency && value * info.originFrequency,
96
+ y,
97
+ width,
98
+ isConstantlyHighlighted: isInRange(value, { from, to }),
99
+ };
100
+ });
101
+ mappedPeaks.sort((prev, next) => prev.x - next.x);
102
+ return mappedPeaks;
112
103
  }, [filterIsActive, format, info, peaks, xDomain]);
113
104
 
114
105
  const optimizePeaksHandler = () => {
@@ -132,9 +123,8 @@ function PeaksPanelInner({
132
123
  function toggleDisplayingMode() {
133
124
  dispatch({ type: 'TOGGLE_PEAKS_DISPLAYING_MODE' });
134
125
  }
135
- const total = peaks?.values?.length || 0;
136
-
137
- const disabled = !peaks?.values || peaks.values.length === 0;
126
+ const total = peaks.values.length;
127
+ const disabled = total === 0;
138
128
  const { showPeaks, displayingMode, showPeaksShapes, showPeaksSum } =
139
129
  peaksViewState;
140
130
 
@@ -184,7 +174,7 @@ function PeaksPanelInner({
184
174
  {!isFlipped && (
185
175
  <DefaultPanelHeader
186
176
  total={total}
187
- counter={filteredPeaks?.length}
177
+ counter={filteredPeaks.length}
188
178
  onDelete={handleDeleteAll}
189
179
  deleteToolTip="Delete All Peaks"
190
180
  onFilter={handleOnFilter}
@@ -214,7 +204,7 @@ function PeaksPanelInner({
214
204
 
215
205
  const MemoizedPeaksPanel = memo(PeaksPanelInner);
216
206
 
217
- const emptyData = { peaks: null, info: {} };
207
+ const emptyData = { peaks: { values: [] }, info: {} };
218
208
 
219
209
  export default function PeaksPanel() {
220
210
  const {
@@ -29,7 +29,8 @@ function handleActiveRow(row: any) {
29
29
  return row.original.isConstantlyHighlighted;
30
30
  }
31
31
 
32
- function PeaksTable({ activeTab, data, info }: PeaksTableProps) {
32
+ function PeaksTable(props: PeaksTableProps) {
33
+ const { activeTab, data, info } = props;
33
34
  const dispatch = useDispatch();
34
35
  const peaksPreferences = usePanelPreferences('peaks', activeTab);
35
36
  const [peak, setEditedPeak] = useState<Peak1D | undefined>();
@@ -204,7 +205,7 @@ function PeaksTable({ activeTab, data, info }: PeaksTableProps) {
204
205
  return <NoDataForFid />;
205
206
  }
206
207
 
207
- if (!data || data.length === 0) {
208
+ if (data.length === 0) {
208
209
  return <EmptyText text="No data" />;
209
210
  }
210
211
 
@@ -5,7 +5,6 @@ import {
5
5
  SvgNmrPeaks,
6
6
  SvgNmrPeaksTopLabels,
7
7
  } from 'cheminfo-font';
8
- import saveAs from 'file-saver';
9
8
  import { rangesToTSV } from 'nmr-processing';
10
9
  import {
11
10
  FaChartBar,
@@ -31,6 +30,7 @@ import { PublicationStringModal } from '../../modal/PublicationStringModal.js';
31
30
  import ChangeSumModal from '../../modal/changeSum/ChangeSumModal.js';
32
31
  import { booleanToString } from '../../utility/booleanToString.js';
33
32
  import type { FilterType } from '../../utility/filterType.js';
33
+ import { saveAs } from '../../utility/save_as.ts';
34
34
  import DefaultPanelHeader from '../header/DefaultPanelHeader.js';
35
35
 
36
36
  type ExportRangesType = 'publicationString' | 'rangesToTSV';
@@ -205,7 +205,8 @@ function RangesHeader(props: RangesHeaderProps) {
205
205
  function handleRangesToTSV() {
206
206
  const tsv = rangesToTSV(ranges.values);
207
207
  const blob = new Blob([tsv], { type: 'text/plain' });
208
- saveAs(blob, `${info.name}.tsv`);
208
+ const name = info.name || 'experiment';
209
+ saveAs({ blob, name, extension: '.tsv' });
209
210
  }
210
211
 
211
212
  function exportHandler(data?: ExportData) {
@@ -67,14 +67,16 @@ interface RangesTableProps extends TableContextMenuProps {
67
67
 
68
68
  const EditRangeDialog = withDialog(EditRangeModal, { force: true });
69
69
 
70
- function RangesTable({
71
- tableData,
72
- contextMenu = [],
73
- onContextMenuSelect,
74
- activeTab,
75
- preferences,
76
- info,
77
- }: RangesTableProps) {
70
+ function RangesTable(props: RangesTableProps) {
71
+ const {
72
+ tableData,
73
+ contextMenu = [],
74
+ onContextMenuSelect,
75
+ activeTab,
76
+ preferences,
77
+ info,
78
+ } = props;
79
+
78
80
  const element = extractChemicalElement(activeTab);
79
81
  const { items: sortedData, isSortedDesc, onSort } = useTableSortBy(tableData);
80
82
  const data = useMapRanges(sortedData);
@@ -47,7 +47,7 @@ function RangeAssignmentsColumn({
47
47
  onHover,
48
48
  highlightData,
49
49
  }: RangAssignmentColumnProps) {
50
- const diaIDs = row.diaIDs || [];
50
+ const diaIDs = row.diaIDs ?? [];
51
51
  const flag =
52
52
  assignment.isActive ||
53
53
  assignment.isHighlighted ||
@@ -70,14 +70,14 @@ function RangeAssignmentsColumn({
70
70
  }}
71
71
  {...onHover}
72
72
  {...{ onClick: (e) => onLink?.(e, assignment) }}
73
- hideRemoveAssignmentButton={!diaIDs || diaIDs.length === 0}
73
+ hideRemoveAssignmentButton={diaIDs.length === 0}
74
74
  onRemove={(e) => onUnlink?.(e, true)}
75
75
  >
76
76
  {(totalNumberOfAtoms > 0 || assignment.isActive) && (
77
77
  <>
78
78
  {totalNumberOfAtoms} {' ( '}
79
79
  <span style={getStyle(flag, isCompletelyAssigned)}>
80
- {diaIDs?.length || 0}
80
+ {diaIDs.length}
81
81
  </span>
82
82
  {' ) '}
83
83
  </>
@@ -1,4 +1,4 @@
1
- import { checkRangeKind } from '../../../../data/utilities/RangeUtilities.js';
1
+ import { isSignalRange } from '../../../../data/utilities/RangeUtilities.js';
2
2
  import { useDispatch } from '../../../context/DispatchContext.js';
3
3
  import { EditableColumn } from '../../../elements/EditableColumn.js';
4
4
  import { formatNumber } from '../../../utility/formatNumber.js';
@@ -12,7 +12,7 @@ function RelativeColumn({
12
12
  }: RangeColumnProps) {
13
13
  const dispatch = useDispatch();
14
14
 
15
- const flag = checkRangeKind(row);
15
+ const flag = isSignalRange(row);
16
16
  const formattedValue = formatNumber(row.integration, format);
17
17
  const integralVal = flag ? formattedValue : `[ ${formattedValue} ]`;
18
18