nmrium 0.33.0-pre.1674059608 → 0.33.0-pre.1675786508

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 (274) hide show
  1. package/lib/component/1d/ApodizationLine.js +1 -1
  2. package/lib/component/1d/Chart1D.js +1 -2
  3. package/lib/component/1d/FooterBanner.js +1 -1
  4. package/lib/component/1d/LinesSeries.js +3 -3
  5. package/lib/component/1d/SpectraLegends.js +3 -3
  6. package/lib/component/1d/Viewer1D.js +1 -1
  7. package/lib/component/1d/integral/IntegralsSeries.js +1 -1
  8. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +1 -1
  9. package/lib/component/1d/peaks/PeakAnnotations.js +1 -1
  10. package/lib/component/1d/peaks/PeaksShapes.js +1 -1
  11. package/lib/component/1d/ranges/Ranges.js +2 -1
  12. package/lib/component/1d/tool/PeakPointer.js +1 -1
  13. package/lib/component/1d/tool/XLabelPointer.js +1 -1
  14. package/lib/component/1d-2d/components/FloatMoleculeStructures/ActionsButton.js +1 -1
  15. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts +1 -5
  16. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +36 -20
  17. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.js +4 -3
  18. package/lib/component/1d-2d/components/SpectrumInfoBlock.js +1 -2
  19. package/lib/component/2d/Chart2D.js +1 -2
  20. package/lib/component/2d/FooterBanner.js +1 -1
  21. package/lib/component/2d/SlicingView.js +1 -1
  22. package/lib/component/2d/Viewer2D.js +10 -9
  23. package/lib/component/2d/ft/Contours.js +1 -1
  24. package/lib/component/2d/tools/XYLabelPointer.js +1 -1
  25. package/lib/component/EventsTrackers/KeysListenerTracker.js +11 -7
  26. package/lib/component/NMRium.d.ts +5 -13
  27. package/lib/component/NMRium.js +6 -4
  28. package/lib/component/context/PreferencesContext.d.ts +2 -10
  29. package/lib/component/elements/Button.d.ts +1 -0
  30. package/lib/component/elements/Button.js +14 -1
  31. package/lib/component/elements/ButtonToolTip.js +1 -1
  32. package/lib/component/elements/ColumnWrapper.d.ts +6 -0
  33. package/lib/component/elements/ColumnWrapper.js +8 -0
  34. package/lib/component/elements/formik/FormikColorPicker.js +1 -1
  35. package/lib/component/elements/formik/FormikInput.d.ts +5 -1
  36. package/lib/component/elements/formik/FormikInput.js +12 -6
  37. package/lib/component/elements/popup/Alert/Provider.js +21 -10
  38. package/lib/component/header/ZeroFillingOptionsPanel.js +4 -4
  39. package/lib/component/hooks/useActiveSpectra.d.ts +1 -0
  40. package/lib/component/hooks/useActiveSpectra.js +6 -0
  41. package/lib/component/hooks/useActiveSpectrum.d.ts +1 -0
  42. package/lib/component/hooks/useActiveSpectrum.js +6 -0
  43. package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +1 -1
  44. package/lib/component/hooks/useActiveSpectrumStyleOptions.js +5 -4
  45. package/lib/component/hooks/useDatumWithSpectraStatistics.js +1 -1
  46. package/lib/component/hooks/useExport.js +20 -24
  47. package/lib/component/hooks/useIntegralPath.js +1 -1
  48. package/lib/component/hooks/useSpectrum.js +1 -1
  49. package/lib/component/loader/DropZone.js +8 -5
  50. package/lib/component/modal/SaveAsModal.js +6 -1
  51. package/lib/component/modal/metaImportation/MetaImportationModal.js +5 -5
  52. package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +5 -4
  53. package/lib/component/modal/setting/settingsValidation.d.ts +24 -24
  54. package/lib/component/modal/setting/settingsValidation.js +1 -1
  55. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +14 -2
  56. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +1 -2
  57. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +6 -10
  58. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -1
  59. package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/LegendsPreferences.js +6 -6
  60. package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/index.js +3 -0
  61. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +16 -5
  62. package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +6 -3
  63. package/lib/component/panels/SpectrumsPanel/SpectraTable.d.ts +1 -1
  64. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +51 -10
  65. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +10 -13
  66. package/lib/component/panels/SpectrumsPanel/base/SpectraColumnsManager.d.ts +3 -2
  67. package/lib/component/panels/SpectrumsPanel/base/SpectraColumnsManager.js +4 -4
  68. package/lib/component/panels/SummaryPanel/utilities/useInView.js +1 -1
  69. package/lib/component/panels/filtersPanel/FilterPanel.d.ts +1 -5
  70. package/lib/component/panels/filtersPanel/FilterPanel.js +27 -60
  71. package/lib/component/panels/filtersPanel/FiltersTable.js +87 -36
  72. package/lib/component/panels/header/DefaultPanelHeader.d.ts +2 -1
  73. package/lib/component/panels/header/DefaultPanelHeader.js +2 -2
  74. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +2 -2
  75. package/lib/component/reducer/Reducer.d.ts +57 -17
  76. package/lib/component/reducer/Reducer.js +23 -16
  77. package/lib/component/reducer/actions/DomainActions.js +7 -1
  78. package/lib/component/reducer/actions/FiltersActions.d.ts +1 -1
  79. package/lib/component/reducer/actions/FiltersActions.js +225 -200
  80. package/lib/component/reducer/actions/LoadActions.d.ts +1 -1
  81. package/lib/component/reducer/actions/LoadActions.js +33 -20
  82. package/lib/component/reducer/actions/MoleculeActions.js +12 -10
  83. package/lib/component/reducer/actions/RangesActions.js +1 -1
  84. package/lib/component/reducer/actions/SpectrumsActions.d.ts +9 -2
  85. package/lib/component/reducer/actions/SpectrumsActions.js +205 -38
  86. package/lib/component/reducer/actions/ToolsActions.js +59 -35
  87. package/lib/component/reducer/actions/ZonesActions.js +2 -2
  88. package/lib/component/reducer/helper/Zoom1DManager.js +3 -2
  89. package/lib/component/reducer/helper/getActiveSpectra.d.ts +3 -0
  90. package/lib/component/reducer/helper/getActiveSpectra.js +4 -0
  91. package/lib/component/reducer/helper/getActiveSpectraAsObject.d.ts +4 -0
  92. package/lib/component/reducer/helper/getActiveSpectraAsObject.js +14 -0
  93. package/lib/component/reducer/helper/getActiveSpectrum.js +5 -1
  94. package/lib/component/reducer/helper/getSpectrum.js +2 -1
  95. package/lib/component/reducer/helper/getStrongestPeak.js +2 -1
  96. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +4 -2
  97. package/lib/component/reducer/preferences/preferencesReducer.d.ts +82 -42
  98. package/lib/component/reducer/types/Types.d.ts +2 -0
  99. package/lib/component/reducer/types/Types.js +2 -0
  100. package/lib/component/utility/convertPathArrayToString.d.ts +1 -0
  101. package/lib/component/utility/convertPathArrayToString.js +3 -0
  102. package/lib/component/utility/export.js +22 -4
  103. package/lib/component/utility/getSpectraObjectPaths.d.ts +4 -1
  104. package/lib/component/utility/getSpectraObjectPaths.js +4 -3
  105. package/lib/component/workspaces/Workspace.d.ts +14 -6
  106. package/lib/component/workspaces/workspaceDefaultProperties.d.ts +2 -2
  107. package/lib/component/workspaces/workspaceDefaultProperties.js +12 -4
  108. package/lib/data/FiltersManager.d.ts +1 -1
  109. package/lib/data/FiltersManager.js +4 -2
  110. package/lib/data/PredictionManager.js +1 -1
  111. package/lib/data/SpectraManager.d.ts +1 -2
  112. package/lib/data/SpectraManager.js +16 -14
  113. package/lib/data/data1d/Spectrum1D/SumManager.js +1 -1
  114. package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +3 -0
  115. package/lib/data/data1d/Spectrum1D/get1DColor.js +14 -0
  116. package/lib/data/data1d/Spectrum1D/get1DDataXY.js +1 -1
  117. package/lib/data/data1d/Spectrum1D/getShiftX.js +1 -1
  118. package/lib/data/data1d/Spectrum1D/index.d.ts +1 -0
  119. package/lib/data/data1d/Spectrum1D/index.js +1 -0
  120. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +3 -24
  121. package/lib/data/data1d/Spectrum1D/toJSON.d.ts +1 -1
  122. package/lib/data/data1d/Spectrum1D/toJSON.js +1 -1
  123. package/lib/data/data1d/filter1d/apodization.js +4 -3
  124. package/lib/data/data1d/filter1d/autoPhaseCorrection.d.ts +4 -1
  125. package/lib/data/data1d/filter1d/digitalFilter.d.ts +4 -1
  126. package/lib/data/data1d/filter1d/digitalFilter.js +2 -1
  127. package/lib/data/data1d/filter1d/fft.d.ts +4 -1
  128. package/lib/data/data1d/filter1d/fft.js +7 -2
  129. package/lib/data/data1d/filter1d/phaseCorrection.d.ts +4 -1
  130. package/lib/data/data1d/filter1d/shiftX.d.ts +7 -3
  131. package/lib/data/data1d/filter1d/shiftX.js +7 -4
  132. package/lib/data/data1d/filter1d/signalProcessing.d.ts +1 -1
  133. package/lib/data/data1d/filter1d/zeroFilling.d.ts +9 -4
  134. package/lib/data/data1d/filter1d/zeroFilling.js +13 -11
  135. package/lib/data/data1d/filter1d/zeroFillingAndApodization.js +1 -2
  136. package/lib/data/data2d/Spectrum2D/get2DColor.d.ts +2 -0
  137. package/lib/data/data2d/Spectrum2D/get2DColor.js +17 -0
  138. package/lib/data/data2d/Spectrum2D/getShift.js +2 -2
  139. package/lib/data/data2d/Spectrum2D/index.d.ts +1 -0
  140. package/lib/data/data2d/Spectrum2D/index.js +1 -0
  141. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -17
  142. package/lib/data/data2d/Spectrum2D/toJSON.d.ts +1 -1
  143. package/lib/data/data2d/Spectrum2D/toJSON.js +1 -1
  144. package/lib/data/data2d/filter2d/shiftX.d.ts +3 -1
  145. package/lib/data/data2d/filter2d/shiftX.js +4 -3
  146. package/lib/data/data2d/filter2d/shiftY.d.ts +3 -1
  147. package/lib/data/data2d/filter2d/shiftY.js +4 -3
  148. package/lib/data/molecules/Molecule.d.ts +8 -2
  149. package/lib/data/molecules/Molecule.js +6 -0
  150. package/lib/data/types/common/Info.d.ts +1 -0
  151. package/lib/data/types/data1d/ComplexData1D.d.ts +2 -0
  152. package/lib/data/types/data1d/ComplexData1D.js +1 -0
  153. package/lib/data/types/data1d/Data1D.d.ts +1 -1
  154. package/lib/data/types/data1d/Datum1D.d.ts +1 -1
  155. package/lib/data/types/data1d/Info1D.d.ts +2 -0
  156. package/lib/data/types/data2d/Datum2D.d.ts +1 -1
  157. package/lib/data/types/data2d/Display2D.d.ts +4 -2
  158. package/lib/data/types/data2d/Info2D.d.ts +1 -0
  159. package/lib/data/utilities/generateColor.d.ts +5 -0
  160. package/lib/data/utilities/{getColor.js → generateColor.js} +3 -3
  161. package/lib/types/NMRiumDataReturn.d.ts +2 -2
  162. package/lib-cjs/component/1d/ApodizationLine.js +2 -2
  163. package/lib-cjs/component/1d/Chart1D.js +1 -2
  164. package/lib-cjs/component/1d/FooterBanner.js +2 -2
  165. package/lib-cjs/component/1d/LinesSeries.js +3 -3
  166. package/lib-cjs/component/1d/SpectraLegends.js +3 -3
  167. package/lib-cjs/component/1d/Viewer1D.js +2 -2
  168. package/lib-cjs/component/1d/integral/IntegralsSeries.js +2 -2
  169. package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +2 -2
  170. package/lib-cjs/component/1d/peaks/PeakAnnotations.js +2 -2
  171. package/lib-cjs/component/1d/peaks/PeaksShapes.js +2 -2
  172. package/lib-cjs/component/1d/ranges/Ranges.js +2 -1
  173. package/lib-cjs/component/1d/tool/PeakPointer.js +2 -2
  174. package/lib-cjs/component/1d/tool/XLabelPointer.js +2 -2
  175. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/ActionsButton.js +1 -1
  176. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +37 -21
  177. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/index.js +3 -2
  178. package/lib-cjs/component/1d-2d/components/SpectrumInfoBlock.js +1 -2
  179. package/lib-cjs/component/2d/Chart2D.js +1 -2
  180. package/lib-cjs/component/2d/FooterBanner.js +2 -2
  181. package/lib-cjs/component/2d/SlicingView.js +2 -2
  182. package/lib-cjs/component/2d/Viewer2D.js +10 -9
  183. package/lib-cjs/component/2d/ft/Contours.js +2 -2
  184. package/lib-cjs/component/2d/tools/XYLabelPointer.js +2 -2
  185. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +10 -6
  186. package/lib-cjs/component/NMRium.js +6 -4
  187. package/lib-cjs/component/elements/Button.js +14 -1
  188. package/lib-cjs/component/elements/ButtonToolTip.js +1 -1
  189. package/lib-cjs/component/elements/ColumnWrapper.js +12 -0
  190. package/lib-cjs/component/elements/formik/FormikColorPicker.js +2 -2
  191. package/lib-cjs/component/elements/formik/FormikInput.js +12 -6
  192. package/lib-cjs/component/elements/popup/Alert/Provider.js +21 -10
  193. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +4 -4
  194. package/lib-cjs/component/hooks/useActiveSpectra.js +10 -0
  195. package/lib-cjs/component/hooks/useActiveSpectrum.js +10 -0
  196. package/lib-cjs/component/hooks/useActiveSpectrumPeaksViewState.js +2 -2
  197. package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +5 -4
  198. package/lib-cjs/component/hooks/useDatumWithSpectraStatistics.js +2 -2
  199. package/lib-cjs/component/hooks/useExport.js +20 -24
  200. package/lib-cjs/component/hooks/useIntegralPath.js +3 -3
  201. package/lib-cjs/component/hooks/useSpectrum.js +2 -2
  202. package/lib-cjs/component/loader/DropZone.js +8 -5
  203. package/lib-cjs/component/modal/SaveAsModal.js +6 -1
  204. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +5 -5
  205. package/lib-cjs/component/modal/setting/settings-tabs/InfoBlockTabContent.js +5 -4
  206. package/lib-cjs/component/modal/setting/settingsValidation.js +1 -1
  207. package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +14 -2
  208. package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +1 -2
  209. package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +5 -9
  210. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -1
  211. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/LegendsPreferences.js +6 -6
  212. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/index.js +3 -0
  213. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +15 -4
  214. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPreferences.js +6 -3
  215. package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +50 -9
  216. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +10 -13
  217. package/lib-cjs/component/panels/SpectrumsPanel/base/SpectraColumnsManager.js +4 -4
  218. package/lib-cjs/component/panels/SummaryPanel/utilities/useInView.js +2 -2
  219. package/lib-cjs/component/panels/filtersPanel/FilterPanel.js +28 -61
  220. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +86 -35
  221. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +2 -2
  222. package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +2 -2
  223. package/lib-cjs/component/reducer/Reducer.js +25 -18
  224. package/lib-cjs/component/reducer/actions/DomainActions.js +7 -1
  225. package/lib-cjs/component/reducer/actions/FiltersActions.js +226 -201
  226. package/lib-cjs/component/reducer/actions/LoadActions.js +35 -19
  227. package/lib-cjs/component/reducer/actions/MoleculeActions.js +12 -10
  228. package/lib-cjs/component/reducer/actions/RangesActions.js +1 -1
  229. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +205 -36
  230. package/lib-cjs/component/reducer/actions/ToolsActions.js +59 -35
  231. package/lib-cjs/component/reducer/actions/ZonesActions.js +2 -2
  232. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +3 -2
  233. package/lib-cjs/component/reducer/helper/getActiveSpectra.js +8 -0
  234. package/lib-cjs/component/reducer/helper/getActiveSpectraAsObject.js +19 -0
  235. package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +5 -1
  236. package/lib-cjs/component/reducer/helper/getSpectrum.js +2 -1
  237. package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -1
  238. package/lib-cjs/component/reducer/preferences/panelsPreferencesDefaultValues.js +4 -2
  239. package/lib-cjs/component/reducer/types/Types.js +3 -1
  240. package/lib-cjs/component/utility/convertPathArrayToString.js +7 -0
  241. package/lib-cjs/component/utility/export.js +22 -4
  242. package/lib-cjs/component/utility/getSpectraObjectPaths.js +4 -3
  243. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +12 -4
  244. package/lib-cjs/data/FiltersManager.js +4 -2
  245. package/lib-cjs/data/PredictionManager.js +2 -2
  246. package/lib-cjs/data/SpectraManager.js +15 -13
  247. package/lib-cjs/data/data1d/Spectrum1D/SumManager.js +1 -1
  248. package/lib-cjs/data/data1d/Spectrum1D/get1DColor.js +18 -0
  249. package/lib-cjs/data/data1d/Spectrum1D/get1DDataXY.js +1 -1
  250. package/lib-cjs/data/data1d/Spectrum1D/getShiftX.js +1 -1
  251. package/lib-cjs/data/data1d/Spectrum1D/index.js +3 -1
  252. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +3 -27
  253. package/lib-cjs/data/data1d/Spectrum1D/toJSON.js +1 -1
  254. package/lib-cjs/data/data1d/filter1d/apodization.js +4 -3
  255. package/lib-cjs/data/data1d/filter1d/digitalFilter.js +2 -1
  256. package/lib-cjs/data/data1d/filter1d/fft.js +7 -2
  257. package/lib-cjs/data/data1d/filter1d/shiftX.js +7 -4
  258. package/lib-cjs/data/data1d/filter1d/zeroFilling.js +13 -11
  259. package/lib-cjs/data/data1d/filter1d/zeroFillingAndApodization.js +1 -2
  260. package/lib-cjs/data/data2d/Spectrum2D/get2DColor.js +21 -0
  261. package/lib-cjs/data/data2d/Spectrum2D/getShift.js +2 -2
  262. package/lib-cjs/data/data2d/Spectrum2D/index.js +3 -1
  263. package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +3 -17
  264. package/lib-cjs/data/data2d/Spectrum2D/toJSON.js +1 -1
  265. package/lib-cjs/data/data2d/filter2d/shiftX.js +4 -3
  266. package/lib-cjs/data/data2d/filter2d/shiftY.js +4 -3
  267. package/lib-cjs/data/molecules/Molecule.js +7 -1
  268. package/lib-cjs/data/types/data1d/ComplexData1D.js +2 -0
  269. package/lib-cjs/data/utilities/{getColor.js → generateColor.js} +6 -6
  270. package/package.json +4 -4
  271. package/lib/component/reducer/helper/getActiveSpectrumOrFail.d.ts +0 -3
  272. package/lib/component/reducer/helper/getActiveSpectrumOrFail.js +0 -6
  273. package/lib/data/utilities/getColor.d.ts +0 -9
  274. package/lib-cjs/component/reducer/helper/getActiveSpectrumOrFail.js +0 -10
@@ -3,9 +3,9 @@ import * as Filters from '../../data/Filters';
3
3
  import { apodizationFilter, defaultApodizationOptions, } from '../../data/data1d/filter1d/apodization';
4
4
  import { useChartData } from '../context/ChartContext';
5
5
  import { useScaleChecked } from '../context/ScaleContext';
6
+ import { useActiveSpectrum } from '../hooks/useActiveSpectrum';
6
7
  import useSpectrum from '../hooks/useSpectrum';
7
8
  import useXYReduce, { XYReducerDomainAxis } from '../hooks/useXYReduce';
8
- import { useActiveSpectrum } from '../reducer/Reducer';
9
9
  import { PathBuilder } from '../utility/PathBuilder';
10
10
  import { getYScale } from './utilities/scale';
11
11
  const emptyData = { data: {}, info: {} };
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import FloatMoleculeStructures from '../1d-2d/components/FloatMoleculeStructures/index';
3
2
  import SpectrumInfoBlock from '../1d-2d/components/SpectrumInfoBlock';
4
3
  import ApodizationLine from './ApodizationLine';
5
4
  import ExclusionZonesAnnotations from './ExclusionZonesAnnotations';
@@ -15,6 +14,6 @@ import PeaksShapes from './peaks/PeaksShapes';
15
14
  import Ranges from './ranges/Ranges';
16
15
  import BaseLineZones from './tool/BaseLineZones';
17
16
  function Chart1D({ mode, width, height, margin, displayerKey }) {
18
- return (_jsxs("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, id: "nmrSVG", children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-chart-1d`, children: _jsx("rect", { width: `${width - margin.left - margin.right}`, height: `${height}`, x: `${margin.left}`, y: `${0}` }) }) }), _jsx(LinesSeries, {}), _jsx(ApodizationLine, {}), _jsx(IntegralsSeries, {}), _jsx(PeakAnnotations, {}), _jsx(Ranges, {}), _jsx(JGraph, {}), _jsx(MultiAnalysisRanges, {}), _jsx(BaseLineZones, {}), _jsx(ExclusionZonesAnnotations, {}), _jsx(DatabaseElements, {}), _jsx(PeaksShapes, {}), _jsx(SpectraTracker, {}), _jsx(SpectrumInfoBlock, {}), _jsx("g", { className: "container", style: { pointerEvents: 'none' }, children: _jsx(XAxis, { showGrid: true, mode: mode }) }), _jsx(FloatMoleculeStructures, {})] }));
17
+ return (_jsxs("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, id: "nmrSVG", children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-chart-1d`, children: _jsx("rect", { width: `${width - margin.left - margin.right}`, height: `${height}`, x: `${margin.left}`, y: `${0}` }) }) }), _jsx(LinesSeries, {}), _jsx(ApodizationLine, {}), _jsx(IntegralsSeries, {}), _jsx(PeakAnnotations, {}), _jsx(Ranges, {}), _jsx(JGraph, {}), _jsx(MultiAnalysisRanges, {}), _jsx(BaseLineZones, {}), _jsx(ExclusionZonesAnnotations, {}), _jsx(DatabaseElements, {}), _jsx(PeaksShapes, {}), _jsx(SpectraTracker, {}), _jsx(SpectrumInfoBlock, {}), _jsx("g", { className: "container", style: { pointerEvents: 'none' }, children: _jsx(XAxis, { showGrid: true, mode: mode }) })] }));
19
18
  }
20
19
  export default Chart1D;
@@ -10,9 +10,9 @@ import { BrushContext } from '../EventsTrackers/BrushTracker';
10
10
  import { MouseContext } from '../EventsTrackers/MouseTracker';
11
11
  import { useChartData } from '../context/ChartContext';
12
12
  import { useScaleChecked } from '../context/ScaleContext';
13
+ import { useActiveSpectrum } from '../hooks/useActiveSpectrum';
13
14
  import { useFormatNumberByNucleus } from '../hooks/useFormatNumberByNucleus';
14
15
  import useSpectrum from '../hooks/useSpectrum';
15
- import { useActiveSpectrum } from '../reducer/Reducer';
16
16
  const styles = css `
17
17
  display: flex;
18
18
  align-items: center;
@@ -1,14 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { get1DDataXY } from '../../data/data1d/Spectrum1D/get1DDataXY';
3
3
  import { useChartData } from '../context/ChartContext';
4
- import { useActiveSpectrum } from '../reducer/Reducer';
4
+ import { useActiveSpectra } from '../hooks/useActiveSpectra';
5
5
  import Line from './Line';
6
6
  function LinesSeries() {
7
7
  const { data, tempData, displayerKey, xDomains } = useChartData();
8
- const activeSpectrum = useActiveSpectrum();
8
+ const activeSpectra = useActiveSpectra();
9
9
  let _data = tempData || data;
10
10
  return (_jsxs("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, className: "spectrums", children: [_data
11
11
  ?.filter((d) => d.display.isVisible === true && xDomains[d.id])
12
- .map((d, i) => (_jsx("g", { id: d.id, children: _jsx(Line, { display: d.display, id: d.id, data: get1DDataXY(d), index: i }) }, d.id))), activeSpectrum?.id && _jsx("use", { href: `#${activeSpectrum?.id}` })] }));
12
+ .map((d, i) => (_jsx("g", { id: d.id, children: _jsx(Line, { display: d.display, id: d.id, data: get1DDataXY(d), index: i }) }, d.id))), activeSpectra?.map((activeSpectrum) => (_jsx("use", { href: `#${activeSpectrum.id}` }, activeSpectrum.id)))] }));
13
13
  }
14
14
  export default LinesSeries;
@@ -8,7 +8,7 @@ import { useChartData } from '../context/ChartContext';
8
8
  import { useScale } from '../context/ScaleContext';
9
9
  import { SVGGroup } from '../elements/SVGGroup';
10
10
  import { usePanelPreferences } from '../hooks/usePanelPreferences';
11
- import { jpathToArray } from '../utility/jpathToArray';
11
+ import { convertPathArrayToString } from '../utility/convertPathArrayToString';
12
12
  const styles = {
13
13
  text: {
14
14
  fontSize: '12px',
@@ -41,8 +41,8 @@ function InnerSpectraLegends({ spectra, legendsFields, }) {
41
41
  return (_jsx("text", { alignmentBaseline: "middle", style: styles.text, children: spectrum.display.name }, "name"));
42
42
  default: {
43
43
  const jpath = field.jpath;
44
- const value = lodashGet(spectrum, jpathToArray(jpath), '');
45
- return (_jsx("text", { alignmentBaseline: "middle", style: styles.text, children: value }, jpath));
44
+ const value = lodashGet(spectrum, jpath, '');
45
+ return (_jsx("text", { alignmentBaseline: "middle", style: styles.text, children: value }, convertPathArrayToString(jpath)));
46
46
  }
47
47
  }
48
48
  }) })] }, spectrum.id))) }));
@@ -14,9 +14,9 @@ import { usePreferences } from '../context/PreferencesContext';
14
14
  import { ScaleProvider } from '../context/ScaleContext';
15
15
  import { useAlert } from '../elements/popup/Alert';
16
16
  import { useModal } from '../elements/popup/Modal';
17
+ import { useActiveSpectrum } from '../hooks/useActiveSpectrum';
17
18
  import Spinner from '../loader/Spinner';
18
19
  import MultipletAnalysisModal from '../modal/MultipletAnalysisModal';
19
- import { useActiveSpectrum } from '../reducer/Reducer';
20
20
  import { ZoomType } from '../reducer/helper/Zoom1DManager';
21
21
  import getRange from '../reducer/helper/getRange';
22
22
  import scaleReducer, { scaleInitialState, SET_SCALE, } from '../reducer/scaleReducer';
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useMemo } from 'react';
3
3
  import { isSpectrum1D } from '../../../data/data1d/Spectrum1D';
4
4
  import { useChartData } from '../../context/ChartContext';
5
- import { useActiveSpectrum } from '../../reducer/Reducer';
5
+ import { useActiveSpectrum } from '../../hooks/useActiveSpectrum';
6
6
  import Integral from './Integral';
7
7
  function IntegralsSeries() {
8
8
  const { xDomains, data, displayerKey, view: { spectra: { activeTab: nucleus }, }, } = useChartData();
@@ -6,8 +6,8 @@ import { useAssignment, } from '../../assignment/AssignmentsContext';
6
6
  import { useChartData } from '../../context/ChartContext';
7
7
  import { useScaleChecked } from '../../context/ScaleContext';
8
8
  import { HighlightEventSource, useHighlight } from '../../highlight';
9
+ import { useActiveSpectrum } from '../../hooks/useActiveSpectrum';
9
10
  import { hasCouplingConstant, checkMultiplicity, } from '../../panels/extra/utilities/MultiplicityUtilities';
10
- import { useActiveSpectrum } from '../../reducer/Reducer';
11
11
  import { options } from '../../toolbar/ToolTypes';
12
12
  import { assert } from '../../utility/assert';
13
13
  import LevelNode from './LevelNode';
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useMemo } from 'react';
3
3
  import { useChartData } from '../../context/ChartContext';
4
4
  import { useScaleChecked } from '../../context/ScaleContext';
5
+ import { useActiveSpectrum } from '../../hooks/useActiveSpectrum';
5
6
  import { useActiveSpectrumPeaksViewState } from '../../hooks/useActiveSpectrumPeaksViewState';
6
7
  import useSpectrum from '../../hooks/useSpectrum';
7
- import { useActiveSpectrum } from '../../reducer/Reducer';
8
8
  import getVerticalShift from '../utilities/getVerticalShift';
9
9
  import PeakAnnotation from './PeakAnnotation';
10
10
  const emptyData = { peaks: {}, info: {}, display: {} };
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useChartData } from '../../context/ChartContext';
3
+ import { useActiveSpectrum } from '../../hooks/useActiveSpectrum';
3
4
  import { useActiveSpectrumPeaksViewState } from '../../hooks/useActiveSpectrumPeaksViewState';
4
5
  import useSpectrum from '../../hooks/useSpectrum';
5
- import { useActiveSpectrum } from '../../reducer/Reducer';
6
6
  import getVerticalShift from '../utilities/getVerticalShift';
7
7
  import { usePeakShapesPath } from './usePeakShapesPath';
8
8
  const emptyData = { peaks: {}, display: {} };
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Fragment, memo, useMemo } from 'react';
3
3
  import { useChartData } from '../../context/ChartContext';
4
+ import { useActiveSpectrum } from '../../hooks/useActiveSpectrum';
4
5
  import { usePanelPreferences } from '../../hooks/usePanelPreferences';
5
6
  import useSpectrum from '../../hooks/useSpectrum';
6
- import { rangeStateInit, useActiveSpectrum } from '../../reducer/Reducer';
7
+ import { rangeStateInit } from '../../reducer/Reducer';
7
8
  import Range from './Range';
8
9
  import RangeIntegral from './RangeIntegral';
9
10
  function RangesInner({ ranges, displayerKey, selectedTool, showMultiplicityTrees, showRangesIntegrals, relativeFormat, }) {
@@ -6,7 +6,7 @@ import { BrushContext } from '../../EventsTrackers/BrushTracker';
6
6
  import { MouseContext } from '../../EventsTrackers/MouseTracker';
7
7
  import { useChartData } from '../../context/ChartContext';
8
8
  import { useScaleChecked } from '../../context/ScaleContext';
9
- import { useActiveSpectrum } from '../../reducer/Reducer';
9
+ import { useActiveSpectrum } from '../../hooks/useActiveSpectrum';
10
10
  import { options } from '../../toolbar/ToolTypes';
11
11
  import getVerticalShift from '../utilities/getVerticalShift';
12
12
  const styles = {
@@ -4,8 +4,8 @@ import { BrushContext } from '../../EventsTrackers/BrushTracker';
4
4
  import { MouseContext } from '../../EventsTrackers/MouseTracker';
5
5
  import { useChartData } from '../../context/ChartContext';
6
6
  import { useScaleChecked } from '../../context/ScaleContext';
7
+ import { useActiveSpectrum } from '../../hooks/useActiveSpectrum';
7
8
  import { useFormatNumberByNucleus } from '../../hooks/useFormatNumberByNucleus';
8
- import { useActiveSpectrum } from '../../reducer/Reducer';
9
9
  const style = {
10
10
  cursor: 'crosshair',
11
11
  transformOrigin: 'bottom right',
@@ -3,5 +3,5 @@ import { BsArrowsMove } from 'react-icons/bs';
3
3
  import { FaTimes } from 'react-icons/fa';
4
4
  import Button from '../../../elements/Button';
5
5
  export default function ActionsButton({ onFloatBtnClick }) {
6
- return (_jsxs("div", { "data-no-export": "true", style: { display: 'flex', zIndex: 0 }, children: [_jsx(Button.Action, { style: { fontSize: '14px' }, fill: "clear", className: "handle", children: _jsx(BsArrowsMove, {}) }), _jsx(Button.Danger, { style: { fontSize: '14px' }, fill: "clear", onClick: onFloatBtnClick, children: _jsx(FaTimes, {}) })] }));
6
+ return (_jsxs("div", { className: "float-molecule-actions", style: { display: 'flex', zIndex: 0 }, children: [_jsx(Button.Action, { style: { fontSize: '14px' }, fill: "clear", className: "handle", children: _jsx(BsArrowsMove, {}) }), _jsx(Button.Danger, { style: { fontSize: '14px' }, fill: "clear", onClick: onFloatBtnClick, children: _jsx(FaTimes, {}) })] }));
7
7
  }
@@ -11,9 +11,5 @@ interface DraggableStructureProps {
11
11
  displayerMode: DISPLAYER_MODE;
12
12
  index?: number;
13
13
  }
14
- export declare const DRAGGABLE_STRUCTURE_INITIAL_POSITION: {
15
- x: number;
16
- y: number;
17
- };
18
- export declare function DraggableStructure(props: DraggableStructureProps): import("@emotion/react/jsx-runtime").JSX.Element;
14
+ export declare function DraggableStructure(props: DraggableStructureProps): import("@emotion/react/jsx-runtime").JSX.Element | null;
19
15
  export {};
@@ -2,11 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
4
  import OCL from 'openchemlib/full';
5
- import { useCallback } from 'react';
5
+ import { ResponsiveChart } from 'react-d3-utils';
6
6
  import OCLnmr from 'react-ocl-nmr';
7
+ import { Rnd } from 'react-rnd';
7
8
  import { useDispatch } from '../../../context/DispatchContext';
8
9
  import { useGlobal } from '../../../context/GlobalContext';
9
- import SVGDraggable from '../../../elements/draggable/SVGDraggable';
10
10
  import { useMoleculeEditor } from '../../../modal/MoleculeStructureEditorModal';
11
11
  import useAtomAssignment from '../../../panels/MoleculesPanel/useAtomAssignment';
12
12
  import { CHANGE_FLOAT_MOLECULE_POSITION, FLOAT_MOLECULE_OVER_SPECTRUM, SET_MOLECULE, } from '../../../reducer/types/Types';
@@ -17,6 +17,11 @@ const style = css `
17
17
  visibility: hidden;
18
18
  }
19
19
 
20
+ .content {
21
+ width: 100%;
22
+ height: 100%;
23
+ }
24
+
20
25
  &:hover {
21
26
  border: 1px solid #ebecf1;
22
27
  background-color: white;
@@ -25,35 +30,46 @@ const style = css `
25
30
  }
26
31
  }
27
32
  `;
28
- export const DRAGGABLE_STRUCTURE_INITIAL_POSITION = { x: 100, y: 50 };
29
33
  export function DraggableStructure(props) {
30
34
  const { zones, ranges, molecule, activeTab, displayerMode, index, moleculeView, } = props;
31
35
  const { viewerRef } = useGlobal();
32
36
  const dispatch = useDispatch();
33
37
  const openMoleculeEditor = useMoleculeEditor();
34
38
  const { currentDiaIDsToHighlight, handleOnAtomHover, handleOnClickAtom, assignedDiaIDsMerged, } = useAtomAssignment({ zones, ranges, activeTab, displayerMode });
35
- const floatMoleculeHandler = useCallback(() => {
39
+ function floatMoleculeHandler() {
36
40
  dispatch({
37
41
  type: FLOAT_MOLECULE_OVER_SPECTRUM,
38
42
  payload: { id: molecule.id },
39
43
  });
40
- }, [dispatch, molecule]);
41
- const dragFloatMoleculeHandler = useCallback((position) => {
44
+ }
45
+ function dragFloatMoleculeHandler(bounding) {
46
+ if (typeof bounding?.width === 'number' &&
47
+ typeof bounding?.height === 'number') {
48
+ const { width, height } = moleculeView.floating.bounding;
49
+ bounding.width += width;
50
+ bounding.height += height;
51
+ }
42
52
  dispatch({
43
53
  type: CHANGE_FLOAT_MOLECULE_POSITION,
44
- payload: { id: molecule.id, position },
54
+ payload: { id: molecule.id, bounding },
45
55
  });
46
- }, [dispatch, molecule]);
47
- return (_jsx(SVGDraggable, { width: 150, height: 100, initialPosition: moleculeView.floating.position, dragHandleClassName: "handle", parentElement: viewerRef, onEnd: dragFloatMoleculeHandler, children: (width, height) => (_jsxs("foreignObject", { width: width, height: height + 30, "data-replace-float-structure": "true", css: style, onDoubleClick: () => openMoleculeEditor(molecule), children: [_jsx(ActionsButton, { onFloatBtnClick: floatMoleculeHandler }), _jsx(OCLnmr, { OCL: OCL, autoCrop: true, id: `molSVG${index || ''}`, width: width - 20, height: height, molfile: molecule.molfile, setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight?.length > 0 ? 'red' : '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight?.length > 0
48
- ? currentDiaIDsToHighlight
49
- : assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover, setMolfile: (molfile) => {
50
- dispatch({
51
- type: SET_MOLECULE,
52
- payload: {
53
- molfile,
54
- id: molecule.id,
55
- label: molecule.label,
56
- },
57
- });
58
- }, showAtomNumber: moleculeView.showAtomNumber })] })) }, molecule.id));
56
+ }
57
+ if (!viewerRef)
58
+ return null;
59
+ return (_jsx(Rnd, { default: moleculeView.floating.bounding, minWidth: 100, minHeight: 100, dragHandleClassName: "handle", enableUserSelectHack: false, bounds: viewerRef, style: { zIndex: 1 }, className: "draggable-molecule", onResizeStop: (e, dir, eRef, { width, height }) => dragFloatMoleculeHandler({ width, height }), onDragStop: (e, { x, y }) => {
60
+ dragFloatMoleculeHandler({ x, y });
61
+ }, resizeHandleWrapperStyle: { backgroundColor: 'white' }, css: style, children: _jsxs("div", { className: "content", onDoubleClick: () => openMoleculeEditor(molecule), children: [_jsx(ActionsButton, { onFloatBtnClick: floatMoleculeHandler }), _jsx(ResponsiveChart, { children: ({ width, height }) => {
62
+ return (_jsx(OCLnmr, { OCL: OCL, autoCrop: true, id: `molSVG${index || ''}`, width: width, height: height, molfile: molecule.molfile, setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight?.length > 0 ? 'red' : '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight?.length > 0
63
+ ? currentDiaIDsToHighlight
64
+ : assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover, setMolfile: (molfile) => {
65
+ dispatch({
66
+ type: SET_MOLECULE,
67
+ payload: {
68
+ molfile,
69
+ id: molecule.id,
70
+ label: molecule.label,
71
+ },
72
+ });
73
+ }, showAtomNumber: moleculeView.showAtomNumber }));
74
+ } })] }) }));
59
75
  }
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
3
  import { useChartData } from '../../../context/ChartContext';
4
4
  import useSpectrum from '../../../hooks/useSpectrum';
@@ -9,9 +9,9 @@ export function FloatMoleculeStructuresInner(props) {
9
9
  const floatingMolecules = Object.entries(moleculesView);
10
10
  if (floatingMolecules.length === 0)
11
11
  return null;
12
- return (_jsx("g", { children: floatingMolecules
12
+ return (_jsx(_Fragment, { children: floatingMolecules
13
13
  .filter(([, view]) => view.floating.visible)
14
- .map(([id, moleculeView]) => {
14
+ .map(([id, moleculeView], index) => {
15
15
  const molecule = molecules.find((m) => m.id === id);
16
16
  assert(molecule !== undefined, 'molecule should be defined');
17
17
  return (_jsx(DraggableStructure, { ...{
@@ -21,6 +21,7 @@ export function FloatMoleculeStructuresInner(props) {
21
21
  displayerMode,
22
22
  moleculeView,
23
23
  molecule,
24
+ index,
24
25
  } }, id));
25
26
  }) }));
26
27
  }
@@ -4,7 +4,6 @@ import { useChartData } from '../../context/ChartContext';
4
4
  import { usePreferences } from '../../context/PreferencesContext';
5
5
  import { SVGGroup } from '../../elements/SVGGroup';
6
6
  import useSpectrum from '../../hooks/useSpectrum';
7
- import { jpathToArray } from '../../utility/jpathToArray';
8
7
  const styles = {
9
8
  label: {
10
9
  fontSize: '11px',
@@ -29,7 +28,7 @@ function SpectrumInfoBlock() {
29
28
  return (_jsx("g", { className: "spectra-info-block", transform: `translate(${margin.left + 5} ${margin.top})`, children: fields
30
29
  .filter((field) => field.visible)
31
30
  .map((field, index) => {
32
- const value = lodashGet(spectrum, jpathToArray(field.jpath), '');
31
+ const value = lodashGet(spectrum, field.jpath, '');
33
32
  return (_jsxs(SVGGroup, { transform: `translate(0,${20 * (index + 1)})`, space: 5, children: [_jsxs("text", { alignmentBaseline: "middle", style: styles.label, children: [field.label, " :"] }), _jsx("text", { alignmentBaseline: "middle", style: styles.value, children: value })] }, field.jpath + field.label));
34
33
  }) }));
35
34
  }
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
- import FloatMoleculeStructures from '../1d-2d/components/FloatMoleculeStructures/index';
4
3
  import SpectrumInfoBlock from '../1d-2d/components/SpectrumInfoBlock';
5
4
  import { useChartData } from '../context/ChartContext';
6
5
  import XAxis from './XAxis';
@@ -10,7 +9,7 @@ import { FTContainer } from './ft/FTContainer';
10
9
  import IndicationLines from './zones/IndicationLines';
11
10
  import Zones from './zones/Zones';
12
11
  function chart2DInner({ spectra, width, height, margin, displayerKey, }) {
13
- return (_jsxs("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, id: "nmrSVG", children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-chart-2d`, children: _jsx("rect", { width: width - margin.left - margin.right, height: height - margin.top - margin.bottom, x: margin.left, y: margin.top }) }) }), _jsx("rect", { width: width - margin.left - margin.right, height: height - margin.top - margin.bottom, x: margin.left, y: margin.top, stroke: "black", strokeWidth: "1", fill: "transparent" }), _jsx(FTContainer, { spectra: spectra }), _jsx(FidContainer, {}), _jsx(Zones, {}), _jsx(IndicationLines, { axis: "X", show: true }), _jsx(IndicationLines, { axis: "Y", show: true }), _jsx(SpectrumInfoBlock, {}), _jsxs("g", { className: "container", style: { pointerEvents: 'none' }, children: [_jsx(XAxis, {}), _jsx(YAxis, {})] }), _jsx(FloatMoleculeStructures, {})] }));
12
+ return (_jsxs("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, id: "nmrSVG", children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-chart-2d`, children: _jsx("rect", { width: width - margin.left - margin.right, height: height - margin.top - margin.bottom, x: margin.left, y: margin.top }) }) }), _jsx("rect", { width: width - margin.left - margin.right, height: height - margin.top - margin.bottom, x: margin.left, y: margin.top, stroke: "black", strokeWidth: "1", fill: "transparent" }), _jsx(FTContainer, { spectra: spectra }), _jsx(FidContainer, {}), _jsx(Zones, {}), _jsx(IndicationLines, { axis: "X", show: true }), _jsx(IndicationLines, { axis: "Y", show: true }), _jsx(SpectrumInfoBlock, {}), _jsxs("g", { className: "container", style: { pointerEvents: 'none' }, children: [_jsx(XAxis, {}), _jsx(YAxis, {})] })] }));
14
13
  }
15
14
  const MemoizedChart2D = memo(chart2DInner);
16
15
  export default function Chart2D({ spectra }) {
@@ -8,8 +8,8 @@ import { get1DDataXY } from '../../data/data1d/Spectrum1D/get1DDataXY';
8
8
  import { BrushContext } from '../EventsTrackers/BrushTracker';
9
9
  import { MouseContext } from '../EventsTrackers/MouseTracker';
10
10
  import { useChartData } from '../context/ChartContext';
11
+ import { useActiveSpectrum } from '../hooks/useActiveSpectrum';
11
12
  import { useFormatNumberByNucleus } from '../hooks/useFormatNumberByNucleus';
12
- import { useActiveSpectrum } from '../reducer/Reducer';
13
13
  import { options } from '../toolbar/ToolTypes';
14
14
  import { getLayoutID, LAYOUT } from './utilities/DimensionLayout';
15
15
  import { get2DXScale, get1DYScale, get2DYScale } from './utilities/scale';
@@ -3,7 +3,7 @@ import { useMemo } from 'react';
3
3
  import { getSlice } from '../../data/data2d/Spectrum2D';
4
4
  import { useMouseTracker } from '../EventsTrackers/MouseTracker';
5
5
  import { useChartData } from '../context/ChartContext';
6
- import { useActiveSpectrum } from '../reducer/Reducer';
6
+ import { useActiveSpectrum } from '../hooks/useActiveSpectrum';
7
7
  import HorizontalSliceChart from './1d-tracer/HorizontalSliceChart';
8
8
  import VerticalSliceChart from './1d-tracer/VerticalSliceChart';
9
9
  import { get2DXScale, get2DYScale } from './utilities/scale';
@@ -22,14 +22,15 @@ function Viewer2D({ emptyText = undefined }) {
22
22
  const dispatch = useDispatch();
23
23
  const spectrumData = useMemo(() => {
24
24
  const nuclei = activeTab.split(',');
25
- return nuclei
26
- .filter((n) => activeSpectra[n]?.id)
27
- .map((nucleus) => {
28
- const id = activeSpectra[nucleus]?.id;
29
- assert(id, `Error in Viewer2D: id is not defined`);
30
- const spectrum = data.find((datum) => datum.id === id && !datum.info.isFid);
31
- assert(spectrum, `Spectrum with id ${id} not found`);
32
- return spectrum;
25
+ return nuclei.map((nucleus) => {
26
+ const spectra = activeSpectra[nucleus];
27
+ if (spectra?.length === 1) {
28
+ const id = spectra[0].id;
29
+ const spectrum = data.find((datum) => datum.id === id && !datum.info.isFid);
30
+ assert(spectrum, `Spectrum with id ${id} not found`);
31
+ return spectrum;
32
+ }
33
+ return null;
33
34
  });
34
35
  }, [activeTab, data, activeSpectra]);
35
36
  const DIMENSION = get2DDimensionLayout(state);
@@ -98,7 +99,7 @@ function Viewer2D({ emptyText = undefined }) {
98
99
  margin: 'auto',
99
100
  position: 'relative',
100
101
  overflow: 'hidden',
101
- }, children: _jsxs(MouseTracker, { style: { width: '100%', height: `100%`, position: 'absolute' }, children: [selectedTool && selectedTool === options.slicing.id && (_jsx(SlicingView, {})), _jsx(CrossLinePointer, {}), spectrumData && (_jsx(XYLabelPointer, { data1D: spectrumData, layout: DIMENSION })), _jsx(BrushXY, { brushType: BRUSH_TYPE.XY, dimensionBorder: DIMENSION.CENTER_2D }), _jsxs(_Fragment, { children: [spectrumData?.[0] && (_jsx(BrushXY, { brushType: BRUSH_TYPE.X, dimensionBorder: DIMENSION.TOP_1D, height: margin.top })), spectrumData?.[1] && (_jsx(BrushXY, { brushType: BRUSH_TYPE.Y, dimensionBorder: DIMENSION.LEFT_1D, width: margin.left }))] }), spectrumData && (_jsx(FooterBanner, { data1D: spectrumData, layout: DIMENSION })), _jsx(Chart2D, { spectra: spectrumData })] }) }))] })) }));
102
+ }, children: _jsxs(MouseTracker, { style: { width: '100%', height: `100%`, position: 'absolute' }, children: [selectedTool && selectedTool === options.slicing.id && (_jsx(SlicingView, {})), _jsx(CrossLinePointer, {}), spectrumData && (_jsx(XYLabelPointer, { data1D: spectrumData, layout: DIMENSION })), _jsx(BrushXY, { brushType: BRUSH_TYPE.XY, dimensionBorder: DIMENSION.CENTER_2D }), _jsxs(_Fragment, { children: [spectrumData[0] && (_jsx(BrushXY, { brushType: BRUSH_TYPE.X, dimensionBorder: DIMENSION.TOP_1D, height: margin.top })), spectrumData[1] && (_jsx(BrushXY, { brushType: BRUSH_TYPE.Y, dimensionBorder: DIMENSION.LEFT_1D, width: margin.left }))] }), spectrumData && (_jsx(FooterBanner, { data1D: spectrumData, layout: DIMENSION })), _jsx(Chart2D, { spectra: spectrumData })] }) }))] })) }));
102
103
  }
103
104
  export function ViewerResponsiveWrapper(props) {
104
105
  const dispatch = useDispatch();
@@ -7,7 +7,7 @@ import { drawContours, getDefaultContoursLevel, } from '../../../data/data2d/Spe
7
7
  import { useChartData } from '../../context/ChartContext';
8
8
  import { usePreferences } from '../../context/PreferencesContext';
9
9
  import { useAlert } from '../../elements/popup/Alert';
10
- import { useActiveSpectrum } from '../../reducer/Reducer';
10
+ import { useActiveSpectrum } from '../../hooks/useActiveSpectrum';
11
11
  import { PathBuilder } from '../../utility/PathBuilder';
12
12
  import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
13
13
  import { get2DXScale, get2DYScale } from '../utilities/scale';
@@ -3,9 +3,9 @@ import { useContext, useMemo } from 'react';
3
3
  import { BrushContext } from '../../EventsTrackers/BrushTracker';
4
4
  import { MouseContext } from '../../EventsTrackers/MouseTracker';
5
5
  import { useChartData } from '../../context/ChartContext';
6
+ import { useActiveSpectrum } from '../../hooks/useActiveSpectrum';
6
7
  import { useFormatNumberByNucleus } from '../../hooks/useFormatNumberByNucleus';
7
8
  import useSpectrum from '../../hooks/useSpectrum';
8
- import { useActiveSpectrum } from '../../reducer/Reducer';
9
9
  import { getLayoutID, LAYOUT } from '../utilities/DimensionLayout';
10
10
  import { get2DXScale, get2DYScale, get1DYScale } from '../utilities/scale';
11
11
  const style = {
@@ -12,7 +12,7 @@ import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
12
12
  import useExport from '../hooks/useExport';
13
13
  import useToolsFunctions from '../hooks/useToolsFunctions';
14
14
  import { DISPLAYER_MODE } from '../reducer/core/Constants';
15
- import { SET_KEY_PREFERENCES, APPLY_KEY_PREFERENCES, DELETE_INTEGRAL, DELETE_PEAK_NOTATION, DELETE_RANGE, DELETE_2D_ZONE, DELETE_EXCLUSION_ZONE, } from '../reducer/types/Types';
15
+ import { SET_KEY_PREFERENCES, APPLY_KEY_PREFERENCES, DELETE_INTEGRAL, DELETE_PEAK_NOTATION, DELETE_RANGE, DELETE_2D_ZONE, DELETE_EXCLUSION_ZONE, CHANGE_ACTIVE_SPECTRUM, } from '../reducer/types/Types';
16
16
  import { options } from '../toolbar/ToolTypes';
17
17
  function KeysListenerTracker() {
18
18
  const { keysPreferences, displayerMode, overDisplayer, data, view: { spectra: { activeTab }, }, } = useChartData();
@@ -186,7 +186,7 @@ function KeysListenerTracker() {
186
186
  }, [alert, data, dispatch, keysPreferences]);
187
187
  const toolsListenerHandler = useCallback((e) => {
188
188
  try {
189
- if (!e.shiftKey && !e.metaKey) {
189
+ if (!e.shiftKey && !e.metaKey && !e.ctrlKey) {
190
190
  switch (e.key) {
191
191
  case 'f':
192
192
  if (isToolVisible('zoomOut')) {
@@ -241,11 +241,6 @@ function KeysListenerTracker() {
241
241
  }
242
242
  break;
243
243
  }
244
- default:
245
- }
246
- }
247
- if (!e.shiftKey && !e.metaKey && !e.ctrlKey) {
248
- switch (e.key) {
249
244
  case 'c': {
250
245
  if (allow1DTool && isToolVisible('spectraCenterAlignments')) {
251
246
  alignSpectrumsVerticallyHandler();
@@ -277,6 +272,14 @@ function KeysListenerTracker() {
277
272
  openLoader();
278
273
  e.preventDefault();
279
274
  break;
275
+ case 'a': {
276
+ dispatch({
277
+ type: CHANGE_ACTIVE_SPECTRUM,
278
+ payload: {},
279
+ });
280
+ e.preventDefault();
281
+ break;
282
+ }
280
283
  default:
281
284
  }
282
285
  }
@@ -300,6 +303,7 @@ function KeysListenerTracker() {
300
303
  alignSpectrumsVerticallyHandler,
301
304
  allow1DTool,
302
305
  changeDisplayViewModeHandler,
306
+ dispatch,
303
307
  handleChangeOption,
304
308
  handleFullZoomOut,
305
309
  isToolVisible,
@@ -1,35 +1,27 @@
1
1
  /** @jsxImportSource @emotion/react */
2
2
  import { CorrelationData } from 'nmr-correlation';
3
+ import { SerializedNmriumState } from 'nmr-load-save';
3
4
  import { ReactElement, ReactNode } from 'react';
4
5
  import { Datum1D } from '../data/types/data1d';
5
6
  import { Datum2D } from '../data/types/data2d';
6
- import { NMRiumDataReturn } from '../types/NMRiumDataReturn';
7
- import { NMRiumGeneralPreferences } from '../types/NMRiumGeneralPreferences';
8
- import { NMRiumPanelPreferences } from '../types/NMRiumPanelPreferences';
9
- import { NMRiumToolBarPreferences } from '../types/NMRiumToolBarPreferences';
10
7
  import { ViewState } from './reducer/Reducer';
11
8
  import { BlobObject } from './utility/export';
12
- import { CustomWorkspaces, WorkspaceData } from './workspaces/Workspace';
13
- export type { NMRiumDataReturn } from '../types/NMRiumDataReturn';
9
+ import { CustomWorkspaces, WorkspacePreferences as NMRiumPreferences } from './workspaces/Workspace';
10
+ export type { WorkspacePreferences as NMRiumPreferences } from './workspaces/Workspace';
14
11
  export type NMRiumWorkspace = 'exercise' | 'process1D' | 'default' | 'prediction' | 'embedded' | 'assignment' | (string & {});
15
12
  export interface NMRiumProps {
16
13
  data?: NMRiumData;
17
- onDataChange?: (data: NMRiumDataReturn) => void;
14
+ onDataChange?: (data: SerializedNmriumState) => void;
18
15
  onViewChange?: (view: ViewState) => void;
19
16
  workspace?: NMRiumWorkspace;
20
17
  customWorkspaces?: CustomWorkspaces;
21
- preferences?: WorkspaceData;
18
+ preferences?: NMRiumPreferences;
22
19
  emptyText?: ReactNode;
23
20
  /**
24
21
  * Returns a custom spinner that will be rendered while loading data.
25
22
  */
26
23
  getSpinner?: () => ReactElement;
27
24
  }
28
- export type NMRiumPreferences = Partial<{
29
- general: Partial<NMRiumGeneralPreferences>;
30
- panels: Partial<NMRiumPanelPreferences>;
31
- toolBarButtons: Partial<NMRiumToolBarPreferences>;
32
- }>;
33
25
  export type Molecules = Array<{
34
26
  molfile: string;
35
27
  }>;
@@ -9,6 +9,7 @@ import { useToggle, useFullscreen } from 'react-use';
9
9
  import { toJSON } from '../data/SpectraManager';
10
10
  import checkModifierKeyActivated from '../data/utilities/checkModifierKeyActivated';
11
11
  import Viewer1D from './1d/Viewer1D';
12
+ import FloatMoleculeStructures from './1d-2d/components/FloatMoleculeStructures';
12
13
  import Viewer2D from './2d/Viewer2D';
13
14
  import ErrorOverlay from './ErrorOverlay';
14
15
  import KeysListenerTracker from './EventsTrackers/KeysListenerTracker';
@@ -189,14 +190,15 @@ function InnerNMRium({ data: dataProp = defaultData, workspace, customWorkspaces
189
190
  display: 'flex',
190
191
  flexDirection: 'row',
191
192
  height: '100%',
192
- }, children: [_jsx(ToolBar, {}), _jsxs(SplitPaneWrapper, { children: [_jsxs("div", { css: viewerContainerStyle, children: [_jsx(KeysListenerTracker, {}), _jsx("div", { "data-test-id": "viewer", ref: viewerRef, style: {
193
+ }, children: [_jsx(ToolBar, {}), _jsxs(SplitPaneWrapper, { children: [_jsxs("div", { css: viewerContainerStyle, children: [_jsx(KeysListenerTracker, {}), _jsxs("div", { id: "nmrium-viewer", "data-test-id": "viewer", ref: viewerRef, style: {
193
194
  width: '100%',
194
195
  height: '100%',
195
- }, children: displayerMode ===
196
- DISPLAYER_MODE.DM_1D ? (_jsx(Viewer1D, { emptyText: emptyText })) : (_jsx(Viewer2D, { emptyText: emptyText })) })] }), _jsx(Panels, {})] }), _jsx("div", { ref: elementsWrapperRef, id: "main-wrapper", style: {
196
+ position: 'relative',
197
+ }, children: [_jsx(FloatMoleculeStructures, {}), displayerMode ===
198
+ DISPLAYER_MODE.DM_1D ? (_jsx(Viewer1D, { emptyText: emptyText })) : (_jsx(Viewer2D, { emptyText: emptyText }))] })] }), _jsx(Panels, {})] }), _jsx("div", { ref: elementsWrapperRef, id: "main-wrapper", style: {
197
199
  position: 'absolute',
198
200
  pointerEvents: 'none',
199
- zIndex: 0,
201
+ zIndex: 2,
200
202
  left: 0,
201
203
  right: 0,
202
204
  top: 0,
@@ -67,11 +67,7 @@ export declare function usePreferences(): {
67
67
  } | import("../reducer/preferences/preferencesReducer").SetWorkspaceAction | {
68
68
  type: "INIT_PREFERENCES";
69
69
  payload: {
70
- display: Partial<{
71
- general: Partial<import("../../types/NMRiumGeneralPreferences").NMRiumGeneralPreferences>;
72
- panels: Partial<import("../../types/NMRiumPanelPreferences").NMRiumPanelPreferences>;
73
- toolBarButtons: Partial<import("../../types/NMRiumToolBarPreferences").NMRiumToolBarPreferences>;
74
- }>;
70
+ display: import("../NMRium").NMRiumPreferences;
75
71
  workspace: import("../NMRium").NMRiumWorkspace;
76
72
  customWorkspaces: Record<string, import("../workspaces/Workspace").Workspace>;
77
73
  dispatch: any;
@@ -107,11 +103,7 @@ export declare function usePreferences(): {
107
103
  export declare function useWorkspacesList(): {
108
104
  version: number;
109
105
  label: string;
110
- display: Partial<{
111
- general: Partial<import("../../types/NMRiumGeneralPreferences").NMRiumGeneralPreferences>;
112
- panels: Partial<import("../../types/NMRiumPanelPreferences").NMRiumPanelPreferences>;
113
- toolBarButtons: Partial<import("../../types/NMRiumToolBarPreferences").NMRiumToolBarPreferences>;
114
- }>;
106
+ display: import("../workspaces/Workspace").DisplayPreferences;
115
107
  general: import("../workspaces/Workspace").GeneralPreferences;
116
108
  formatting: import("../workspaces/Workspace").Formatting;
117
109
  databases: import("../workspaces/Workspace").Databases;
@@ -31,5 +31,6 @@ declare namespace Button {
31
31
  var Danger: (props: ButtonProps) => import("@emotion/react/jsx-runtime").JSX.Element;
32
32
  var Action: (props: ButtonProps) => import("@emotion/react/jsx-runtime").JSX.Element;
33
33
  var Info: (props: Omit<ButtonProps, "children">) => import("@emotion/react/jsx-runtime").JSX.Element;
34
+ var BarButton: (props: ButtonProps) => import("@emotion/react/jsx-runtime").JSX.Element;
34
35
  }
35
36
  export default Button;