nmrium 1.6.0 → 1.7.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 (378) 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/Range.d.ts.map +1 -1
  21. package/lib/component/1d/ranges/Range.js +3 -3
  22. package/lib/component/1d/ranges/Range.js.map +1 -1
  23. package/lib/component/1d/ranges/RangesIntegrals.d.ts.map +1 -1
  24. package/lib/component/1d/ranges/RangesIntegrals.js +5 -3
  25. package/lib/component/1d/ranges/RangesIntegrals.js.map +1 -1
  26. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +1 -0
  27. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js.map +1 -1
  28. package/lib/component/2d/FooterBanner.js +2 -2
  29. package/lib/component/2d/FooterBanner.js.map +1 -1
  30. package/lib/component/2d/YAxis.d.ts +0 -1
  31. package/lib/component/2d/YAxis.d.ts.map +1 -1
  32. package/lib/component/2d/YAxis.js +11 -4
  33. package/lib/component/2d/YAxis.js.map +1 -1
  34. package/lib/component/2d/useTracesSpectra.d.ts.map +1 -1
  35. package/lib/component/2d/useTracesSpectra.js +2 -0
  36. package/lib/component/2d/useTracesSpectra.js.map +1 -1
  37. package/lib/component/2d/utilities/extractSpectrumSignals.d.ts +2 -9
  38. package/lib/component/2d/utilities/extractSpectrumSignals.d.ts.map +1 -1
  39. package/lib/component/2d/utilities/extractSpectrumSignals.js +4 -5
  40. package/lib/component/2d/utilities/extractSpectrumSignals.js.map +1 -1
  41. package/lib/component/2d/zones/SignalsGuideLines.d.ts.map +1 -1
  42. package/lib/component/2d/zones/SignalsGuideLines.js +7 -10
  43. package/lib/component/2d/zones/SignalsGuideLines.js.map +1 -1
  44. package/lib/component/2d/zones/ZonesAssignmentsLabels.d.ts.map +1 -1
  45. package/lib/component/2d/zones/ZonesAssignmentsLabels.js.map +1 -1
  46. package/lib/component/context/DispatchContext.d.ts +2 -2
  47. package/lib/component/context/DispatchContext.d.ts.map +1 -1
  48. package/lib/component/context/LoggerContext.d.ts.map +1 -1
  49. package/lib/component/context/LoggerContext.js +8 -9
  50. package/lib/component/context/LoggerContext.js.map +1 -1
  51. package/lib/component/context/PreferencesContext.d.ts +7 -3
  52. package/lib/component/context/PreferencesContext.d.ts.map +1 -1
  53. package/lib/component/context/PreferencesContext.js +1 -2
  54. package/lib/component/context/PreferencesContext.js.map +1 -1
  55. package/lib/component/elements/D3Axis.d.ts.map +1 -1
  56. package/lib/component/elements/D3Axis.js +1 -1
  57. package/lib/component/elements/D3Axis.js.map +1 -1
  58. package/lib/component/elements/Sections.js +1 -1
  59. package/lib/component/elements/Sections.js.map +1 -1
  60. package/lib/component/hooks/useActiveSpectrumRangesViewState.d.ts.map +1 -1
  61. package/lib/component/hooks/useActiveSpectrumRangesViewState.js +2 -2
  62. package/lib/component/hooks/useActiveSpectrumRangesViewState.js.map +1 -1
  63. package/lib/component/hooks/useExport.d.ts.map +1 -1
  64. package/lib/component/hooks/useExport.js +24 -6
  65. package/lib/component/hooks/useExport.js.map +1 -1
  66. package/lib/component/loader/Spinner.js +1 -1
  67. package/lib/component/loader/Spinner.js.map +1 -1
  68. package/lib/component/loader/useLoadFiles.d.ts.map +1 -1
  69. package/lib/component/loader/useLoadFiles.js +51 -26
  70. package/lib/component/loader/useLoadFiles.js.map +1 -1
  71. package/lib/component/main/InnerNMRium.d.ts.map +1 -1
  72. package/lib/component/main/InnerNMRium.js +4 -2
  73. package/lib/component/main/InnerNMRium.js.map +1 -1
  74. package/lib/component/main/NMRiumStateProvider.d.ts.map +1 -1
  75. package/lib/component/main/NMRiumStateProvider.js +18 -6
  76. package/lib/component/main/NMRiumStateProvider.js.map +1 -1
  77. package/lib/component/modal/LoadJCAMPModal.d.ts.map +1 -1
  78. package/lib/component/modal/LoadJCAMPModal.js +2 -3
  79. package/lib/component/modal/LoadJCAMPModal.js.map +1 -1
  80. package/lib/component/modal/MoleculeStructureEditorModal.d.ts.map +1 -1
  81. package/lib/component/modal/MoleculeStructureEditorModal.js.map +1 -1
  82. package/lib/component/modal/MultipletAnalysisModal.js +0 -2
  83. package/lib/component/modal/MultipletAnalysisModal.js.map +1 -1
  84. package/lib/component/modal/SaveAsModal.d.ts.map +1 -1
  85. package/lib/component/modal/SaveAsModal.js +6 -3
  86. package/lib/component/modal/SaveAsModal.js.map +1 -1
  87. package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts.map +1 -1
  88. package/lib/component/modal/changeSum/ChangeSumModalContents.js +0 -2
  89. package/lib/component/modal/changeSum/ChangeSumModalContents.js.map +1 -1
  90. package/lib/component/modal/changeSum/SelectMolecule.d.ts.map +1 -1
  91. package/lib/component/modal/changeSum/SelectMolecule.js +0 -2
  92. package/lib/component/modal/changeSum/SelectMolecule.js.map +1 -1
  93. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +2 -2
  94. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts.map +1 -1
  95. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js +1 -2
  96. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js.map +1 -1
  97. package/lib/component/modal/setting/settingsValidation.js +2 -2
  98. package/lib/component/modal/setting/settingsValidation.js.map +1 -1
  99. package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts.map +1 -1
  100. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +2 -1
  101. package/lib/component/panels/IntegralsPanel/IntegralPanel.js.map +1 -1
  102. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +1 -1
  103. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts.map +1 -1
  104. package/lib/component/panels/IntegralsPanel/IntegralTable.js +4 -3
  105. package/lib/component/panels/IntegralsPanel/IntegralTable.js.map +1 -1
  106. package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts.map +1 -1
  107. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +1 -3
  108. package/lib/component/panels/MoleculesPanel/MoleculePanel.js.map +1 -1
  109. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -1
  110. package/lib/component/panels/MoleculesPanel/Utilities.d.ts.map +1 -1
  111. package/lib/component/panels/MoleculesPanel/Utilities.js +6 -3
  112. package/lib/component/panels/MoleculesPanel/Utilities.js.map +1 -1
  113. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts.map +1 -1
  114. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +20 -5
  115. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js.map +1 -1
  116. package/lib/component/panels/PeaksPanel/PeaksPanel.d.ts.map +1 -1
  117. package/lib/component/panels/PeaksPanel/PeaksPanel.js +24 -26
  118. package/lib/component/panels/PeaksPanel/PeaksPanel.js.map +1 -1
  119. package/lib/component/panels/PeaksPanel/PeaksTable.d.ts +1 -1
  120. package/lib/component/panels/PeaksPanel/PeaksTable.d.ts.map +1 -1
  121. package/lib/component/panels/PeaksPanel/PeaksTable.js +3 -2
  122. package/lib/component/panels/PeaksPanel/PeaksTable.js.map +1 -1
  123. package/lib/component/panels/RangesPanel/RangesHeader.d.ts.map +1 -1
  124. package/lib/component/panels/RangesPanel/RangesHeader.js +3 -2
  125. package/lib/component/panels/RangesPanel/RangesHeader.js.map +1 -1
  126. package/lib/component/panels/RangesPanel/RangesTable.d.ts +1 -1
  127. package/lib/component/panels/RangesPanel/RangesTable.d.ts.map +1 -1
  128. package/lib/component/panels/RangesPanel/RangesTable.js +2 -1
  129. package/lib/component/panels/RangesPanel/RangesTable.js.map +1 -1
  130. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -2
  131. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js.map +1 -1
  132. package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +2 -2
  133. package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js.map +1 -1
  134. package/lib/component/panels/SpectraPanel/SpectraTable.d.ts.map +1 -1
  135. package/lib/component/panels/SpectraPanel/SpectraTable.js +3 -2
  136. package/lib/component/panels/SpectraPanel/SpectraTable.js.map +1 -1
  137. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +2 -2
  138. package/lib/component/panels/SummaryPanel/utilities/Utilities.js.map +1 -1
  139. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +1 -1
  140. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js.map +1 -1
  141. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.d.ts.map +1 -1
  142. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +0 -4
  143. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js.map +1 -1
  144. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +8 -8
  145. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js.map +1 -1
  146. package/lib/component/panels/ZonesPanel/ZonesPanel.d.ts.map +1 -1
  147. package/lib/component/panels/ZonesPanel/ZonesPanel.js +6 -1
  148. package/lib/component/panels/ZonesPanel/ZonesPanel.js.map +1 -1
  149. package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +8 -9
  150. package/lib/component/panels/ZonesPanel/ZonesTable.d.ts.map +1 -1
  151. package/lib/component/panels/ZonesPanel/ZonesTable.js +3 -2
  152. package/lib/component/panels/ZonesPanel/ZonesTable.js.map +1 -1
  153. package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts.map +1 -1
  154. package/lib/component/panels/ZonesPanel/ZonesTableRow.js +0 -2
  155. package/lib/component/panels/ZonesPanel/ZonesTableRow.js.map +1 -1
  156. package/lib/component/panels/ZonesPanel/hooks/useMapZones.d.ts +7 -7
  157. package/lib/component/panels/ZonesPanel/hooks/useMapZones.d.ts.map +1 -1
  158. package/lib/component/panels/ZonesPanel/hooks/useMapZones.js +3 -3
  159. package/lib/component/panels/ZonesPanel/hooks/useMapZones.js.map +1 -1
  160. package/lib/component/panels/databasePanel/DatabasePanel.d.ts.map +1 -1
  161. package/lib/component/panels/databasePanel/DatabasePanel.js +13 -10
  162. package/lib/component/panels/databasePanel/DatabasePanel.js.map +1 -1
  163. package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.d.ts.map +1 -1
  164. package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.js +0 -2
  165. package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.js.map +1 -1
  166. package/lib/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.d.ts.map +1 -1
  167. package/lib/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.js +0 -2
  168. package/lib/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.js.map +1 -1
  169. package/lib/component/reducer/Reducer.d.ts +8 -2
  170. package/lib/component/reducer/Reducer.d.ts.map +1 -1
  171. package/lib/component/reducer/Reducer.js +3 -1
  172. package/lib/component/reducer/Reducer.js.map +1 -1
  173. package/lib/component/reducer/actions/DatabaseActions.d.ts.map +1 -1
  174. package/lib/component/reducer/actions/DatabaseActions.js +2 -1
  175. package/lib/component/reducer/actions/DatabaseActions.js.map +1 -1
  176. package/lib/component/reducer/actions/IntegralsActions.js.map +1 -1
  177. package/lib/component/reducer/actions/{LoadActions.d.ts → LoadAction.d.ts} +11 -3
  178. package/lib/component/reducer/actions/LoadAction.d.ts.map +1 -0
  179. package/lib/component/reducer/actions/{LoadActions.js → LoadAction.js} +53 -18
  180. package/lib/component/reducer/actions/LoadAction.js.map +1 -0
  181. package/lib/component/reducer/actions/MoleculeActions.d.ts +3 -2
  182. package/lib/component/reducer/actions/MoleculeActions.d.ts.map +1 -1
  183. package/lib/component/reducer/actions/MoleculeActions.js +1 -1
  184. package/lib/component/reducer/actions/MoleculeActions.js.map +1 -1
  185. package/lib/component/reducer/actions/RangesActions.d.ts +2 -2
  186. package/lib/component/reducer/actions/RangesActions.d.ts.map +1 -1
  187. package/lib/component/reducer/actions/RangesActions.js +13 -13
  188. package/lib/component/reducer/actions/RangesActions.js.map +1 -1
  189. package/lib/component/reducer/actions/ZonesActions.d.ts +2 -2
  190. package/lib/component/reducer/actions/ZonesActions.d.ts.map +1 -1
  191. package/lib/component/reducer/actions/ZonesActions.js +9 -4
  192. package/lib/component/reducer/actions/ZonesActions.js.map +1 -1
  193. package/lib/component/reducer/preferences/actions/initPreferences.d.ts.map +1 -1
  194. package/lib/component/reducer/preferences/actions/initPreferences.js +1 -2
  195. package/lib/component/reducer/preferences/actions/initPreferences.js.map +1 -1
  196. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts.map +1 -1
  197. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +2 -1
  198. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js.map +1 -1
  199. package/lib/component/reducer/preferences/preferencesReducer.d.ts +8 -8
  200. package/lib/component/reducer/preferences/preferencesReducer.d.ts.map +1 -1
  201. package/lib/component/reducer/preferences/preferencesReducer.js +0 -1
  202. package/lib/component/reducer/preferences/preferencesReducer.js.map +1 -1
  203. package/lib/component/utility/export.d.ts +3 -3
  204. package/lib/component/utility/export.d.ts.map +1 -1
  205. package/lib/component/utility/export.js +13 -21
  206. package/lib/component/utility/export.js.map +1 -1
  207. package/lib/component/utility/getClosePeak.js +1 -1
  208. package/lib/component/utility/getClosePeak.js.map +1 -1
  209. package/lib/component/utility/save_as.d.ts +9 -0
  210. package/lib/component/utility/save_as.d.ts.map +1 -0
  211. package/lib/component/utility/save_as.js +7 -0
  212. package/lib/component/utility/save_as.js.map +1 -0
  213. package/lib/data/PredictionManager.d.ts.map +1 -1
  214. package/lib/data/PredictionManager.js +13 -9
  215. package/lib/data/PredictionManager.js.map +1 -1
  216. package/lib/data/SpectraManager.d.ts +45 -4
  217. package/lib/data/SpectraManager.d.ts.map +1 -1
  218. package/lib/data/SpectraManager.js +69 -12
  219. package/lib/data/SpectraManager.js.map +1 -1
  220. package/lib/data/constants/signalsKinds.d.ts +1 -6
  221. package/lib/data/constants/signalsKinds.d.ts.map +1 -1
  222. package/lib/data/constants/signalsKinds.js +2 -17
  223. package/lib/data/constants/signalsKinds.js.map +1 -1
  224. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +1 -1
  225. package/lib/data/data1d/Spectrum1D/generateJGraphData.js.map +1 -1
  226. package/lib/data/data1d/Spectrum1D/initiateDatum1D.d.ts +1 -0
  227. package/lib/data/data1d/Spectrum1D/initiateDatum1D.d.ts.map +1 -1
  228. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +2 -1
  229. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js.map +1 -1
  230. package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +1 -10
  231. package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts.map +1 -1
  232. package/lib/data/data1d/Spectrum1D/isRangeAssigned.d.ts.map +1 -1
  233. package/lib/data/data1d/Spectrum1D/isRangeAssigned.js.map +1 -1
  234. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.d.ts.map +1 -1
  235. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +7 -5
  236. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js.map +1 -1
  237. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts.map +1 -1
  238. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.js +5 -1
  239. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.js.map +1 -1
  240. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +1 -1
  241. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +1 -1
  242. package/lib/data/data2d/Spectrum2D/contours.d.ts.map +1 -1
  243. package/lib/data/data2d/Spectrum2D/contours.js +1 -1
  244. package/lib/data/data2d/Spectrum2D/contours.js.map +1 -1
  245. package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts +1 -0
  246. package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts.map +1 -1
  247. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +2 -1
  248. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js.map +1 -1
  249. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +2 -2
  250. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts.map +1 -1
  251. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +2 -2
  252. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts.map +1 -1
  253. package/lib/data/molecules/Molecule.d.ts +2 -6
  254. package/lib/data/molecules/Molecule.d.ts.map +1 -1
  255. package/lib/data/molecules/Molecule.js +7 -1
  256. package/lib/data/molecules/Molecule.js.map +1 -1
  257. package/lib/data/molecules/MoleculeManager.d.ts +4 -3
  258. package/lib/data/molecules/MoleculeManager.d.ts.map +1 -1
  259. package/lib/data/molecules/MoleculeManager.js +8 -3
  260. package/lib/data/molecules/MoleculeManager.js.map +1 -1
  261. package/lib/data/utilities/RangeUtilities.d.ts +3 -2
  262. package/lib/data/utilities/RangeUtilities.d.ts.map +1 -1
  263. package/lib/data/utilities/RangeUtilities.js +9 -3
  264. package/lib/data/utilities/RangeUtilities.js.map +1 -1
  265. package/lib/data/utilities/ZoneUtilities.d.ts.map +1 -1
  266. package/lib/data/utilities/ZoneUtilities.js +1 -2
  267. package/lib/data/utilities/ZoneUtilities.js.map +1 -1
  268. package/lib/data/utilities/isProton.d.ts +2 -0
  269. package/lib/data/utilities/isProton.d.ts.map +1 -0
  270. package/lib/data/utilities/isProton.js +4 -0
  271. package/lib/data/utilities/isProton.js.map +1 -0
  272. package/lib/versionInfo.js +1 -1
  273. package/package.json +27 -27
  274. package/src/component/1d/FloatingRanges.tsx +5 -5
  275. package/src/component/1d/database/DatabaseSpectrum.tsx +1 -1
  276. package/src/component/1d/multiAnalysis/MultiAnalysisRanges.tsx +1 -1
  277. package/src/component/1d/multiplicityTree/MultiplicityTree.tsx +4 -2
  278. package/src/component/1d/peaks/PeakAnnotations.tsx +2 -1
  279. package/src/component/1d/peaks/PeakAnnotationsSpreadMode.tsx +11 -1
  280. package/src/component/1d/peaks/Peaks.tsx +9 -3
  281. package/src/component/1d/ranges/Range.tsx +4 -3
  282. package/src/component/1d/ranges/RangesIntegrals.tsx +6 -2
  283. package/src/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.tsx +1 -0
  284. package/src/component/2d/FooterBanner.tsx +2 -2
  285. package/src/component/2d/YAxis.tsx +31 -13
  286. package/src/component/2d/useTracesSpectra.ts +3 -0
  287. package/src/component/2d/utilities/extractSpectrumSignals.ts +6 -16
  288. package/src/component/2d/zones/SignalsGuideLines.tsx +11 -9
  289. package/src/component/2d/zones/ZonesAssignmentsLabels.tsx +2 -3
  290. package/src/component/context/DispatchContext.tsx +2 -2
  291. package/src/component/context/LoggerContext.tsx +8 -11
  292. package/src/component/context/PreferencesContext.tsx +8 -5
  293. package/src/component/elements/D3Axis.tsx +1 -2
  294. package/src/component/elements/Sections.tsx +1 -1
  295. package/src/component/hooks/useActiveSpectrumRangesViewState.ts +2 -2
  296. package/src/component/hooks/useExport.tsx +38 -6
  297. package/src/component/loader/Spinner.tsx +1 -1
  298. package/src/component/loader/useLoadFiles.ts +67 -30
  299. package/src/component/main/InnerNMRium.tsx +6 -2
  300. package/src/component/main/NMRiumStateProvider.tsx +19 -7
  301. package/src/component/modal/LoadJCAMPModal.tsx +2 -3
  302. package/src/component/modal/MoleculeStructureEditorModal.tsx +1 -0
  303. package/src/component/modal/MultipletAnalysisModal.tsx +0 -2
  304. package/src/component/modal/SaveAsModal.tsx +29 -6
  305. package/src/component/modal/changeSum/ChangeSumModalContents.tsx +0 -2
  306. package/src/component/modal/changeSum/SelectMolecule.tsx +0 -2
  307. package/src/component/modal/setting/settings-tabs/DatabasesTabContent.tsx +1 -3
  308. package/src/component/modal/setting/settingsValidation.ts +2 -2
  309. package/src/component/panels/IntegralsPanel/IntegralPanel.tsx +2 -6
  310. package/src/component/panels/IntegralsPanel/IntegralTable.tsx +4 -3
  311. package/src/component/panels/MoleculesPanel/MoleculePanel.tsx +1 -2
  312. package/src/component/panels/MoleculesPanel/Utilities.ts +8 -6
  313. package/src/component/panels/MoleculesPanel/useAtomAssignment.tsx +26 -7
  314. package/src/component/panels/PeaksPanel/PeaksPanel.tsx +25 -35
  315. package/src/component/panels/PeaksPanel/PeaksTable.tsx +3 -2
  316. package/src/component/panels/RangesPanel/RangesHeader.tsx +3 -2
  317. package/src/component/panels/RangesPanel/RangesTable.tsx +10 -8
  318. package/src/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.tsx +3 -3
  319. package/src/component/panels/RangesPanel/TableColumns/RelativeColumn.tsx +2 -2
  320. package/src/component/panels/SpectraPanel/SpectraTable.tsx +3 -2
  321. package/src/component/panels/SummaryPanel/utilities/Utilities.ts +2 -2
  322. package/src/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.tsx +1 -1
  323. package/src/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.tsx +0 -4
  324. package/src/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.tsx +9 -9
  325. package/src/component/panels/ZonesPanel/ZonesPanel.tsx +15 -5
  326. package/src/component/panels/ZonesPanel/ZonesTable.tsx +9 -10
  327. package/src/component/panels/ZonesPanel/ZonesTableRow.tsx +0 -2
  328. package/src/component/panels/ZonesPanel/hooks/useMapZones.ts +11 -11
  329. package/src/component/panels/databasePanel/DatabasePanel.tsx +18 -14
  330. package/src/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.tsx +0 -2
  331. package/src/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.tsx +0 -2
  332. package/src/component/reducer/Reducer.ts +14 -3
  333. package/src/component/reducer/actions/DatabaseActions.ts +3 -0
  334. package/src/component/reducer/actions/IntegralsActions.ts +1 -1
  335. package/src/component/reducer/actions/{LoadActions.ts → LoadAction.ts} +74 -25
  336. package/src/component/reducer/actions/MoleculeActions.ts +7 -8
  337. package/src/component/reducer/actions/RangesActions.ts +16 -25
  338. package/src/component/reducer/actions/ZonesActions.ts +17 -9
  339. package/src/component/reducer/preferences/actions/initPreferences.ts +0 -3
  340. package/src/component/reducer/preferences/panelsPreferencesDefaultValues.ts +2 -1
  341. package/src/component/reducer/preferences/preferencesReducer.ts +9 -10
  342. package/src/component/utility/export.ts +15 -20
  343. package/src/component/utility/getClosePeak.ts +1 -1
  344. package/src/component/utility/save_as.ts +16 -0
  345. package/src/data/PredictionManager.ts +21 -14
  346. package/src/data/SpectraManager.ts +96 -19
  347. package/src/data/constants/signalsKinds.ts +5 -20
  348. package/src/data/data1d/Spectrum1D/generateJGraphData.ts +1 -1
  349. package/src/data/data1d/Spectrum1D/initiateDatum1D.ts +3 -1
  350. package/src/data/data1d/Spectrum1D/isRangeAssigned.ts +1 -0
  351. package/src/data/data1d/Spectrum1D/ranges/autoRangesDetection.ts +8 -5
  352. package/src/data/data1d/Spectrum1D/ranges/detectRanges.ts +8 -1
  353. package/src/data/data1d/Spectrum1D/ranges/detectSignals.ts +1 -1
  354. package/src/data/data2d/Spectrum2D/contours.ts +2 -3
  355. package/src/data/data2d/Spectrum2D/initiateDatum2D.ts +3 -1
  356. package/src/data/molecules/Molecule.ts +13 -7
  357. package/src/data/molecules/MoleculeManager.ts +14 -8
  358. package/src/data/utilities/RangeUtilities.ts +12 -4
  359. package/src/data/utilities/ZoneUtilities.ts +1 -3
  360. package/src/data/utilities/isProton.ts +3 -0
  361. package/src/versionInfo.ts +1 -1
  362. package/lib/component/reducer/actions/LoadActions.d.ts.map +0 -1
  363. package/lib/component/reducer/actions/LoadActions.js.map +0 -1
  364. package/lib/component/utility/isHomoNuclear.d.ts +0 -2
  365. package/lib/component/utility/isHomoNuclear.d.ts.map +0 -1
  366. package/lib/component/utility/isHomoNuclear.js +0 -11
  367. package/lib/component/utility/isHomoNuclear.js.map +0 -1
  368. package/lib/data/types/common/SignalKind.d.ts +0 -2
  369. package/lib/data/types/common/SignalKind.d.ts.map +0 -1
  370. package/lib/data/types/common/SignalKind.js +0 -2
  371. package/lib/data/types/common/SignalKind.js.map +0 -1
  372. package/lib/utils/stringCapitalize.d.ts +0 -2
  373. package/lib/utils/stringCapitalize.d.ts.map +0 -1
  374. package/lib/utils/stringCapitalize.js +0 -4
  375. package/lib/utils/stringCapitalize.js.map +0 -1
  376. package/src/component/utility/isHomoNuclear.ts +0 -11
  377. package/src/data/types/common/SignalKind.ts +0 -10
  378. package/src/utils/stringCapitalize.ts +0 -3
@@ -47,7 +47,7 @@ function DatabaseSpectrum() {
47
47
  try {
48
48
  setLoading(true);
49
49
  const url = new URL(jcampRelativeURL, baseURL);
50
- const { data } = await core.readFromWebSource({
50
+ const [{ data }] = await core.readFromWebSource({
51
51
  entries: [{ relativePath: url.pathname, baseURL: url.origin }],
52
52
  });
53
53
  setLoading(false);
@@ -20,7 +20,7 @@ function MultiAnalysisRangesInner({
20
20
  (key) => columns[key].type !== ANALYSIS_COLUMN_TYPES.FORMULA,
21
21
  );
22
22
 
23
- if (!ranges || ranges.length === 0) {
23
+ if (ranges.length === 0) {
24
24
  return null;
25
25
  }
26
26
 
@@ -14,6 +14,7 @@ import { useScaleChecked } from '../../context/ScaleContext.js';
14
14
  import type { ActionsButtonsPopoverProps } from '../../elements/ActionsButtonsPopover.js';
15
15
  import { ActionsButtonsPopover } from '../../elements/ActionsButtonsPopover.js';
16
16
  import { useHighlight } from '../../highlight/index.js';
17
+ import { useActiveSpectrum } from '../../hooks/useActiveSpectrum.ts';
17
18
  import useSpectrum from '../../hooks/useSpectrum.js';
18
19
  import { useIsInset } from '../inset/InsetProvider.js';
19
20
 
@@ -79,11 +80,11 @@ function Tree(props: TreeProps) {
79
80
  } = props;
80
81
  const { from, to } = range;
81
82
  const { width } = useChartData();
82
- const { scaleX } = useScaleChecked();
83
+ const { scaleX, shiftY } = useScaleChecked();
83
84
  const dispatch = useDispatch();
84
85
  const isInset = useIsInset();
85
86
  const isAssignBtnTrigged = useRef(false);
86
-
87
+ const activeSpectrum = useActiveSpectrum();
87
88
  const assignment = useAssignment(signalKey);
88
89
  const highlight = useHighlight(extractID(signalKey, assignment), {
89
90
  type: 'SIGNAL',
@@ -172,6 +173,7 @@ function Tree(props: TreeProps) {
172
173
  }}
173
174
  >
174
175
  <Group
176
+ transform={`translate(0,-${(activeSpectrum?.index || 0) * shiftY})`}
175
177
  isActive={isAssignmentActive}
176
178
  isHighlighted={isHighlighted}
177
179
  onMouseEnter={() => {
@@ -166,7 +166,7 @@ function PeakAnnotation({
166
166
  format,
167
167
  isOverlap = false,
168
168
  }: PeakAnnotationProps) {
169
- const { id, parentKeys, x, y } = peak;
169
+ const { id, parentKeys, x, y, opacity } = peak;
170
170
  const sign = Math.sign(y);
171
171
  const highlight = useHighlight([id], {
172
172
  type: getHighlightSource(peaksSource),
@@ -188,6 +188,7 @@ function PeakAnnotation({
188
188
  transform={`translate(${sx}, ${sy})`}
189
189
  onMouseEnter={() => highlight.show()}
190
190
  onMouseLeave={() => highlight.hide()}
191
+ opacity={opacity}
191
192
  >
192
193
  <line
193
194
  x1="0"
@@ -144,7 +144,13 @@ function PeakAnnotationsSpreadMode(props: PeakAnnotationsSpreadModeProps) {
144
144
  transform={`translate(${group.meta.groupStartX},0)`}
145
145
  >
146
146
  {group.group.map((item, index) => {
147
- const { id, x: value, xInPixel, parentKeys } = item;
147
+ const {
148
+ id,
149
+ x: value,
150
+ xInPixel,
151
+ parentKeys,
152
+ opacity,
153
+ } = item;
148
154
  const startX = index * (notationWidth + notationMargin);
149
155
  const x = xInPixel - group.meta.groupStartX;
150
156
  return (
@@ -163,6 +169,7 @@ function PeakAnnotationsSpreadMode(props: PeakAnnotationsSpreadModeProps) {
163
169
  }}
164
170
  peaksSource={peaksSource}
165
171
  spectrumKey={spectrumKey}
172
+ opacity={opacity}
166
173
  />
167
174
  );
168
175
  })}
@@ -181,6 +188,7 @@ interface PeakAnnotationProps {
181
188
  x: number;
182
189
  format: string;
183
190
  color: string;
191
+ opacity: number;
184
192
  id: string;
185
193
  value: number;
186
194
  peakEditionFieldPosition: { x: number; y: number };
@@ -200,6 +208,7 @@ function PeakAnnotation(props: PeakAnnotationProps) {
200
208
  peaksSource,
201
209
  parentKeys,
202
210
  spectrumKey,
211
+ opacity,
203
212
  } = props;
204
213
  const highlight = useHighlight([id], {
205
214
  type: getHighlightSource(peaksSource),
@@ -212,6 +221,7 @@ function PeakAnnotation(props: PeakAnnotationProps) {
212
221
  <g
213
222
  onMouseEnter={() => highlight.show()}
214
223
  onMouseLeave={() => highlight.hide()}
224
+ opacity={opacity}
215
225
  >
216
226
  <PeakEditionListener {...{ ...peakEditionFieldPosition, id, value }}>
217
227
  <text
@@ -2,6 +2,7 @@ import type { NMRPeak1D, Peak1D, Range } from '@zakodium/nmr-types';
2
2
  import type { Spectrum1D } from '@zakodium/nmrium-core';
3
3
  import { memo, useMemo } from 'react';
4
4
 
5
+ import { getOpacityBasedOnSignalKind } from '../../../data/utilities/RangeUtilities.ts';
5
6
  import { useChartData } from '../../context/ChartContext.js';
6
7
  import { useScaleChecked } from '../../context/ScaleContext.tsx';
7
8
  import { useActiveSpectrumPeaksViewState } from '../../hooks/useActiveSpectrumPeaksViewState.js';
@@ -18,6 +19,7 @@ interface Peak1DWithParentKeys extends Peak1D {
18
19
  }
19
20
  interface NMRPeak1DWithParentKeys extends NMRPeak1D {
20
21
  parentKeys?: string[];
22
+ opacity: number;
21
23
  }
22
24
 
23
25
  interface SpreadPeak1D extends Peak1DWithParentKeys {
@@ -29,7 +31,9 @@ interface SpreadNMRPeak1D extends NMRPeak1DWithParentKeys {
29
31
  yInPixel: number;
30
32
  }
31
33
 
32
- export type Peak = Required<SpreadPeak1D | SpreadNMRPeak1D>;
34
+ export type Peak = Required<SpreadPeak1D | SpreadNMRPeak1D> & {
35
+ opacity: number;
36
+ };
33
37
  type PeaksMode = 'spread' | 'single';
34
38
  export type PeaksSource = 'peaks' | 'ranges';
35
39
 
@@ -61,9 +65,11 @@ export function getHighlightExtraId(
61
65
  function flatRangesPeaks(ranges: Range[]) {
62
66
  const results: NMRPeak1DWithParentKeys[] = [];
63
67
  for (const { signals = [], id: rangeID } of ranges) {
64
- for (const { peaks = [], id: signalID } of signals) {
68
+ for (const signal of signals) {
69
+ const { peaks = [], id: signalID } = signal;
70
+ const opacity = getOpacityBasedOnSignalKind(signal);
65
71
  for (const peak of peaks) {
66
- results.push({ ...peak, parentKeys: [rangeID, signalID] });
72
+ results.push({ ...peak, parentKeys: [rangeID, signalID], opacity });
67
73
  }
68
74
  }
69
75
  }
@@ -8,7 +8,7 @@ import {
8
8
  resizeRange,
9
9
  } from '../../../data/data1d/Spectrum1D/index.js';
10
10
  import { isRangeAssigned } from '../../../data/data1d/Spectrum1D/isRangeAssigned.js';
11
- import { checkRangeKind } from '../../../data/utilities/RangeUtilities.js';
11
+ import { getOpacityBasedOnSignalKind } from '../../../data/utilities/RangeUtilities.js';
12
12
  import {
13
13
  useAssignment,
14
14
  useAssignmentContext,
@@ -131,7 +131,8 @@ function Range(options: RangeProps) {
131
131
  });
132
132
  }
133
133
  const isAssignmentActive = assignmentRange.isActive;
134
- const isNotSignal = !checkRangeKind(range);
134
+ const opacity = getOpacityBasedOnSignalKind(range);
135
+
135
136
  const isHighlighted =
136
137
  isBlockedByEditing || highlightRange.isActive || isAssignmentActive;
137
138
 
@@ -248,7 +249,7 @@ function Range(options: RangeProps) {
248
249
  value={integration}
249
250
  format={relativeFormat}
250
251
  width={rangeWidth}
251
- opacity={isNotSignal ? 0.5 : 1}
252
+ opacity={opacity}
252
253
  />
253
254
  )}
254
255
  </g>
@@ -1,6 +1,7 @@
1
1
  import type { Spectrum1D } from '@zakodium/nmrium-core';
2
2
  import { xyIntegral, xyMaxY } from 'ml-spectra-processing';
3
3
 
4
+ import { getOpacityBasedOnSignalKind } from '../../../data/utilities/RangeUtilities.ts';
4
5
  import { useChartData } from '../../context/ChartContext.js';
5
6
  import { useActiveSpectrumRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState.js';
6
7
  import useIntegralPath from '../../hooks/useIntegralPath.js';
@@ -13,6 +14,7 @@ interface IntegralData {
13
14
  id: string;
14
15
  from: number;
15
16
  to: number;
17
+ opacity: number;
16
18
  }
17
19
 
18
20
  interface IntegralProps extends IntegralData {
@@ -20,7 +22,7 @@ interface IntegralProps extends IntegralData {
20
22
  }
21
23
 
22
24
  function Integral(props: IntegralProps) {
23
- const { x, y, max, from, to } = props;
25
+ const { x, y, max, from, to, opacity } = props;
24
26
  const { integralsScaleRatio } = useActiveSpectrumRangesViewState();
25
27
  const path = useIntegralPath({
26
28
  x,
@@ -37,6 +39,7 @@ function Integral(props: IntegralProps) {
37
39
  stroke="black"
38
40
  strokeWidth="1"
39
41
  fill="none"
42
+ opacity={opacity}
40
43
  d={path}
41
44
  />
42
45
  );
@@ -90,6 +93,7 @@ function useIntegrals() {
90
93
  } = spectrum;
91
94
  for (const range of ranges?.values || []) {
92
95
  const { from, to, id } = range;
96
+ const opacity = getOpacityBasedOnSignalKind(range);
93
97
  const integral = xyIntegral(
94
98
  { x, y: re },
95
99
  {
@@ -98,7 +102,7 @@ function useIntegrals() {
98
102
  reverse: true,
99
103
  },
100
104
  );
101
- values.push({ ...integral, id } as IntegralData);
105
+ values.push({ ...integral, id, opacity } as IntegralData);
102
106
  const value = xyMaxY(integral);
103
107
  if (value > max) max = value;
104
108
  }
@@ -218,6 +218,7 @@ function DraggableMolecule(props: DraggableMoleculeProps) {
218
218
  atomHighlightColor,
219
219
  atomHighlightOpacity: 1,
220
220
  showAtomNumber: moleculeView.showAtomNumber,
221
+ noCarbonLabelWithCustomLabel: true,
221
222
  };
222
223
 
223
224
  if (renderAsSVG) {
@@ -56,7 +56,7 @@ export default function FooterBanner(props: FooterBannerProps) {
56
56
  const [formatX, formatY] = useFormatNumberByNucleus(nuclei);
57
57
 
58
58
  const scaleX = useMemo(() => {
59
- if (!data1D || data1D.length === 0) {
59
+ if (data1D.length === 0) {
60
60
  return get2DXScale({ width, margin, xDomain, mode });
61
61
  }
62
62
  if (selectedTool !== options.slicing.id) {
@@ -86,7 +86,7 @@ export default function FooterBanner(props: FooterBannerProps) {
86
86
  ]);
87
87
 
88
88
  const scaleY = useMemo(() => {
89
- if (!data1D || data1D.length === 0) {
89
+ if (data1D.length === 0) {
90
90
  return get2DYScale({ height, margin, yDomain });
91
91
  }
92
92
  if (selectedTool !== options.slicing.id) {
@@ -3,13 +3,14 @@ import { useLinearPrimaryTicks } from 'react-d3-utils';
3
3
 
4
4
  import { useChartData } from '../context/ChartContext.js';
5
5
  import { D3Axis } from '../elements/D3Axis.js';
6
+ import { useActiveNucleusTab } from '../hooks/useActiveNucleusTab.ts';
7
+ import { useTextMetrics } from '../hooks/useTextMetrics.ts';
6
8
 
7
9
  import { useScale2DY } from './utilities/scale.js';
8
10
 
9
11
  const defaultMargin = { right: 50, top: 0, bottom: 0, left: 0 };
10
12
 
11
13
  interface YAxisProps {
12
- label?: string;
13
14
  margin?: {
14
15
  right: number;
15
16
  top: number;
@@ -19,9 +20,13 @@ interface YAxisProps {
19
20
  }
20
21
 
21
22
  function YAxis(props: YAxisProps) {
22
- const { label = '', margin: marginProps = defaultMargin } = props;
23
+ const { margin: marginProps = defaultMargin } = props;
24
+
25
+ const { width, height, margin } = useChartData();
26
+ const nucleusStr = useActiveNucleusTab();
27
+ const [, unit] = nucleusStr.split(',');
28
+ const { getTextWidth } = useTextMetrics(10);
23
29
 
24
- const { width, height } = useChartData();
25
30
  const scaleY = useScale2DY();
26
31
 
27
32
  const refAxis = useRef<SVGGElement>(null);
@@ -36,6 +41,9 @@ function YAxis(props: YAxisProps) {
36
41
  return null;
37
42
  }
38
43
 
44
+ const label = /^[0-9]+[A-Z][a-z]?$/.test(unit) ? 'δ [ppm]' : unit;
45
+ const labelHeight = getTextWidth(label);
46
+
39
47
  return (
40
48
  <D3Axis
41
49
  ref={refAxis}
@@ -44,16 +52,26 @@ function YAxis(props: YAxisProps) {
44
52
  axisPosition="right"
45
53
  ticks={ticks}
46
54
  >
47
- <text
48
- fill="#000"
49
- x={-marginProps.top}
50
- y={-(marginProps.right - 5)}
51
- dy="0.71em"
52
- transform="rotate(-90)"
53
- textAnchor="end"
54
- >
55
- {label}
56
- </text>
55
+ <g transform={`translate(${marginProps.right - 20}, ${margin.top})`}>
56
+ <rect
57
+ fill="white"
58
+ rx={5}
59
+ ry={5}
60
+ width={20}
61
+ height={labelHeight + 10}
62
+ x={-10}
63
+ y={-5}
64
+ opacity={0.8}
65
+ />
66
+ <text
67
+ fill="#000"
68
+ transform="rotate(-90)"
69
+ dominantBaseline="middle"
70
+ textAnchor="end"
71
+ >
72
+ {label}
73
+ </text>
74
+ </g>
57
75
  </D3Axis>
58
76
  );
59
77
  }
@@ -44,6 +44,9 @@ export function useTracesSpectra() {
44
44
 
45
45
  return useMemo(() => {
46
46
  const nuclei = activeTab.split(',');
47
+
48
+ if (nuclei.length !== 2) return [];
49
+
47
50
  return getTracesSpectra({ nuclei, spectra, activeSpectra });
48
51
  }, [activeTab, spectra, activeSpectra]);
49
52
  }
@@ -1,17 +1,8 @@
1
- import type { Range } from '@zakodium/nmr-types';
1
+ import type { Range, Signal1D } from '@zakodium/nmr-types';
2
2
  import type { Spectrum1D } from '@zakodium/nmrium-core';
3
+ import { signalKindsToInclude } from 'nmr-processing';
3
4
 
4
- import { SIGNAL_INCLUDED_KINDS } from '../../../data/constants/signalsKinds.js';
5
-
6
- export interface BaseSignal {
7
- nbAtoms?: number;
8
- diaIDs?: string[];
9
- assignment?: string;
10
- delta: number;
11
- id: string;
12
- }
13
-
14
- export type ExtractedSignal<T> = BaseSignal & T;
5
+ export type ExtractedSignal<T> = Signal1D & T;
15
6
 
16
7
  interface ExtractSpectrumSignalsOptions<T> {
17
8
  from?: number;
@@ -48,12 +39,11 @@ export function extractSpectrumSignals<T extends object = object>(
48
39
  const { assignment, signals = [] } = range;
49
40
  let index = 0;
50
41
  for (const signal of signals) {
51
- const { id, delta, kind } = signal;
52
- if (SIGNAL_INCLUDED_KINDS.includes(kind as string)) {
42
+ const { kind } = signal;
43
+ if (kind && signalKindsToInclude.has(kind)) {
53
44
  result.push({
45
+ ...signal,
54
46
  assignment: index === 0 ? assignment : '',
55
- delta,
56
- id,
57
47
  ...include?.(range),
58
48
  } as ExtractedSignal<T>);
59
49
  index++;
@@ -21,11 +21,9 @@ import {
21
21
  import type { ActionsButtonsPopoverProps } from '../../elements/ActionsButtonsPopover.js';
22
22
  import { ActionsButtonsPopover } from '../../elements/ActionsButtonsPopover.js';
23
23
  import { useHighlight } from '../../highlight/index.js';
24
- import { useActiveNucleusTab } from '../../hooks/useActiveNucleusTab.ts';
25
24
  import { useHighlightColor } from '../../hooks/useHighlightColor.ts';
26
25
  import { useTextMetrics } from '../../hooks/useTextMetrics.ts';
27
26
  import { useTriggerNewAssignmentLabel } from '../../hooks/useTriggerNewAssignmentLabel.js';
28
- import { isHomoNuclear } from '../../utility/isHomoNuclear.ts';
29
27
  import { stackOverlappingLabelsArray } from '../../utility/stackOverlappingLabels.js';
30
28
  import { useTracesSpectra } from '../useTracesSpectra.js';
31
29
  import type { ExtractedSignal } from '../utilities/extractSpectrumSignals.js';
@@ -138,6 +136,7 @@ interface IndicationLineProps extends ExtraExtractProperties {
138
136
  axis: IndicationLinesAxis;
139
137
  diaIDs?: string[];
140
138
  nbAtoms?: number;
139
+ id: string;
141
140
  }
142
141
 
143
142
  interface GetAxisRangeIdOptions {
@@ -154,6 +153,7 @@ interface UseRangeAssignmentOptions {
154
153
  rangeId: string;
155
154
  signalsIds: string[];
156
155
  spectrumId: string;
156
+ signalId: string;
157
157
  }
158
158
 
159
159
  function useRangeAssignment(options: UseRangeAssignmentOptions) {
@@ -169,10 +169,11 @@ function useRangeAssignment(options: UseRangeAssignmentOptions) {
169
169
  type: 'RANGE',
170
170
  extra: { id: rangeId, spectrumID: spectrumId },
171
171
  });
172
+
172
173
  return { highlightContext, assignmentContext };
173
174
  }
174
175
 
175
- function isSignalAssigned(
176
+ function isRangeSignalAssigned(
176
177
  options: Pick<IndicationLineProps, 'range' | 'nbAtoms' | 'diaIDs'>,
177
178
  ) {
178
179
  const { range, ...otherProps } = options;
@@ -194,23 +195,24 @@ function IndicationLine(props: IndicationLineProps) {
194
195
  range,
195
196
  diaIDs,
196
197
  nbAtoms,
198
+ id: signalId,
197
199
  } = props;
198
200
  const { id: rangeId, diaIDs: rangeDiaIDs = [], signals } = range;
199
201
  const highlightColor = useHighlightColor();
200
- const isAssigned = isSignalAssigned({ range, diaIDs, nbAtoms });
202
+ const isSignalAssigned = isRangeSignalAssigned({ range, diaIDs, nbAtoms });
201
203
 
202
204
  const signalsIds = signals.map(({ id }) => id);
203
205
  const { margin, width, height } = useChartData();
204
206
  const { setData: addNewAssignmentLabel } = useShareData();
205
- const nuclei = useActiveNucleusTab();
206
- const isHomoNuclei = isHomoNuclear(nuclei);
207
207
 
208
208
  const dispatch = useDispatch();
209
209
  const { assignmentContext, highlightContext } = useRangeAssignment({
210
210
  rangeId,
211
211
  spectrumId,
212
212
  signalsIds,
213
+ signalId,
213
214
  });
215
+
214
216
  const hasDiaIDs = rangeDiaIDs.length > 0;
215
217
  const isAssignmentActive = assignmentContext.isActive;
216
218
  const isHighlighted = highlightContext.isActive || isAssignmentActive;
@@ -245,7 +247,7 @@ function IndicationLine(props: IndicationLineProps) {
245
247
  }
246
248
 
247
249
  function mouseEnterHandler() {
248
- assignmentContext.highlight(isHomoNuclei ? 'x' : axis);
250
+ assignmentContext.highlight('x');
249
251
  highlightContext.show();
250
252
  }
251
253
 
@@ -256,7 +258,7 @@ function IndicationLine(props: IndicationLineProps) {
256
258
 
257
259
  function assignHandler() {
258
260
  isAssignBtnTrigged.current = true;
259
- assignmentContext.activate(isHomoNuclei ? 'x' : axis);
261
+ assignmentContext.activate('x');
260
262
  }
261
263
 
262
264
  function unAssignHandler() {
@@ -318,7 +320,7 @@ function IndicationLine(props: IndicationLineProps) {
318
320
  onMouseLeave={mouseLeaveHandler}
319
321
  >
320
322
  <line
321
- stroke={isAssigned ? highlightColor : 'lightgrey'}
323
+ stroke={isSignalAssigned ? highlightColor : 'lightgrey'}
322
324
  x1={0}
323
325
  x2={x2}
324
326
  y1={0}
@@ -1,5 +1,5 @@
1
1
  import styled from '@emotion/styled';
2
- import type { Zone, Zones as ZonesType } from '@zakodium/nmr-types';
2
+ import type { Signal1D, Zone, Zones as ZonesType } from '@zakodium/nmr-types';
3
3
  import type { Spectrum2D } from '@zakodium/nmrium-core';
4
4
  import { useEffect, useLayoutEffect, useRef, useState } from 'react';
5
5
  import { PiTextTSlash } from 'react-icons/pi';
@@ -18,7 +18,6 @@ import { useActiveSpectrumZonesViewState } from '../../hooks/useActiveSpectrumZo
18
18
  import useSpectrum from '../../hooks/useSpectrum.js';
19
19
  import type { GetTracesSpectraOptions } from '../useTracesSpectra.js';
20
20
  import { getTracesSpectra } from '../useTracesSpectra.js';
21
- import type { BaseSignal } from '../utilities/extractSpectrumSignals.js';
22
21
  import { extractSpectrumSignals } from '../utilities/extractSpectrumSignals.js';
23
22
  import { useScale2DX, useScale2DY } from '../utilities/scale.js';
24
23
 
@@ -232,7 +231,7 @@ interface GetDefaultAssignmentOptions extends GetTracesSpectraOptions {
232
231
  zone: Zone;
233
232
  }
234
233
 
235
- function findClosestAssignment(signals: BaseSignal[], target: number) {
234
+ function findClosestAssignment(signals: Signal1D[], target: number) {
236
235
  if (signals.length === 0) return '';
237
236
  let closest = signals[0];
238
237
  let minDiff = Math.abs(closest.delta - target);
@@ -8,7 +8,7 @@ import type { DomainActions } from '../reducer/actions/DomainActions.js';
8
8
  import type { FiltersActions } from '../reducer/actions/FiltersActions.js';
9
9
  import type { InsetsActions } from '../reducer/actions/InsetActions.js';
10
10
  import type { IntegralsActions } from '../reducer/actions/IntegralsActions.js';
11
- import type { LoadActions } from '../reducer/actions/LoadActions.js';
11
+ import type { LoadAction } from '../reducer/actions/LoadAction.js';
12
12
  import type { MoleculeActions } from '../reducer/actions/MoleculeActions.js';
13
13
  import type { PeaksActions } from '../reducer/actions/PeaksActions.js';
14
14
  import type { PreferencesActions } from '../reducer/actions/PreferencesActions.js';
@@ -21,7 +21,7 @@ import type { ActionType } from '../reducer/types/ActionType.js';
21
21
  export type Action =
22
22
  | ToolsActions
23
23
  | SpectrumActions
24
- | LoadActions
24
+ | LoadAction
25
25
  | IntegralsActions
26
26
  | RangesActions
27
27
  | DatabaseActions
@@ -55,8 +55,7 @@ export function LoggerProvider({ children }: LoggerProviderProps) {
55
55
  const [logsHistory, setLogsHistory] = useState<LogEntry[]>([]);
56
56
  const [isLogHistoryOpened, openLogHistory] = useState(false);
57
57
  const popupLoggingLevelRef = useRef<LogEntry['levelLabel']>();
58
-
59
- const loggerRef = useRef<FifoLogger>(new FifoLogger());
58
+ const [logger] = useState(() => new FifoLogger());
60
59
 
61
60
  useEffect(() => {
62
61
  function handleLogger({ detail: { logs } }: ChangeEvent) {
@@ -74,20 +73,18 @@ export function LoggerProvider({ children }: LoggerProviderProps) {
74
73
  }
75
74
  setLogsHistory(logs.slice());
76
75
  }
77
- const loggerInstance = loggerRef.current;
78
-
79
- loggerInstance.addEventListener('change', handleLogger);
80
76
 
77
+ logger.addEventListener('change', handleLogger);
81
78
  return () => {
82
- loggerInstance.removeEventListener('change', handleLogger);
79
+ logger.removeEventListener('change', handleLogger);
83
80
  };
84
- }, []);
81
+ }, [logger]);
85
82
 
86
83
  useEffect(() => {
87
84
  if (loggingLevel) {
88
- loggerRef.current.setLevel(loggingLevel);
85
+ logger.setLevel(loggingLevel);
89
86
  }
90
- }, [loggingLevel]);
87
+ }, [logger, loggingLevel]);
91
88
 
92
89
  const markAsRead = useCallback(() => {
93
90
  if (logsHistory.length > 0) {
@@ -98,12 +95,12 @@ export function LoggerProvider({ children }: LoggerProviderProps) {
98
95
 
99
96
  const loggerState = useMemo(() => {
100
97
  return {
101
- logger: loggerRef.current,
98
+ logger,
102
99
  logsHistory,
103
100
  markAsRead,
104
101
  lastReadLogId,
105
102
  };
106
- }, [lastReadLogId, logsHistory, markAsRead]);
103
+ }, [logger, lastReadLogId, logsHistory, markAsRead]);
107
104
 
108
105
  useEffect(() => {
109
106
  popupLoggingLevelRef.current = popupLoggingLevel;
@@ -1,20 +1,23 @@
1
+ import type { Dispatch } from 'react';
1
2
  import { createContext, useContext, useMemo } from 'react';
2
3
 
3
4
  import type {
5
+ PreferencesActions,
4
6
  PreferencesState,
5
7
  WorkspaceWithSource,
6
8
  } from '../reducer/preferences/preferencesReducer.js';
7
- import { preferencesInitialState } from '../reducer/preferences/preferencesReducer.js';
8
9
  import { isReadOnlyWorkspace } from '../reducer/preferences/utilities/isReadOnlyWorkspace.js';
9
10
 
10
- interface PreferencesContextData extends PreferencesState {
11
+ export interface PreferencesStateContext extends PreferencesState {
12
+ dispatch: Dispatch<PreferencesActions>;
13
+ }
14
+
15
+ interface PreferencesContextData extends PreferencesStateContext {
11
16
  isCurrentWorkspaceReadOnly: boolean;
12
17
  current: WorkspaceWithSource;
13
18
  }
14
19
 
15
- const PreferencesContext = createContext<PreferencesState>(
16
- preferencesInitialState,
17
- );
20
+ const PreferencesContext = createContext<PreferencesStateContext | null>(null);
18
21
  export const PreferencesProvider = PreferencesContext.Provider;
19
22
 
20
23
  export function usePreferences(): PreferencesContextData {
@@ -181,8 +181,6 @@ export const D3Axis = forwardRef<SVGGElement | null, D3AxisProps>(
181
181
  {...otherProps}
182
182
  >
183
183
  <g className="axis">
184
- {children}
185
-
186
184
  <BaseLine
187
185
  axisPosition={axisPosition}
188
186
  scale={scale}
@@ -194,6 +192,7 @@ export const D3Axis = forwardRef<SVGGElement | null, D3AxisProps>(
194
192
  scale={scale}
195
193
  tickLength={tickLength}
196
194
  />
195
+ {children}
197
196
  </g>
198
197
  {showGrid && (
199
198
  <g className="grid">
@@ -385,7 +385,7 @@ function SectionItem(props: SectionItemProps) {
385
385
  <div
386
386
  style={{
387
387
  position: 'relative',
388
- opacity: state && state.type === 'dragging' ? 0.3 : 1,
388
+ opacity: state.type === 'dragging' ? 0.3 : 1,
389
389
  }}
390
390
  ref={wrapperRef}
391
391
  >
@@ -1,19 +1,19 @@
1
1
  import type { RangesViewState } from '@zakodium/nmrium-core';
2
2
 
3
+ import { isProton } from '../../data/utilities/isProton.ts';
3
4
  import { useInsetOptions } from '../1d/inset/InsetProvider.js';
4
5
  import { useChartData } from '../context/ChartContext.js';
5
6
 
6
7
  import { useActiveSpectrum } from './useActiveSpectrum.js';
7
8
 
8
9
  export function getDefaultRangesViewState(nucleus: string): RangesViewState {
9
- const isProton = nucleus === '1H';
10
10
  const isCarbon = nucleus === '13C';
11
11
 
12
12
  return {
13
13
  showPeaks: isCarbon,
14
14
  showMultiplicityTrees: false,
15
15
  showIntegrals: false,
16
- showIntegralsValues: isProton,
16
+ showIntegralsValues: isProton(nucleus),
17
17
  showJGraph: false,
18
18
  displayingMode: 'spread',
19
19
  integralsScaleRatio: 1,