nmrium 0.30.0 → 0.32.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 (273) hide show
  1. package/lib/component/1d/ApodizationLine.js +3 -1
  2. package/lib/component/1d/FooterBanner.js +20 -11
  3. package/lib/component/1d/IntegralsSeries.js +3 -1
  4. package/lib/component/1d/LinesSeries.js +3 -1
  5. package/lib/component/1d/SpectraTracker.js +1 -1
  6. package/lib/component/1d/Viewer1D.js +3 -1
  7. package/lib/component/1d/jCouplingGraph/JGraph.js +5 -1
  8. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  9. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
  10. package/lib/component/1d/peaks/PeakAnnotations.js +3 -1
  11. package/lib/component/1d/peaks/PeaksShapes.js +4 -2
  12. package/lib/component/1d/peaks/usePeakShapesPath.js +7 -3
  13. package/lib/component/1d/ranges/Ranges.js +8 -2
  14. package/lib/component/1d/tool/PeakPointer.js +3 -1
  15. package/lib/component/1d/tool/XLabelPointer.js +3 -1
  16. package/lib/component/2d/Contours.js +4 -2
  17. package/lib/component/2d/FooterBanner.js +3 -1
  18. package/lib/component/2d/Left1DChart.js +1 -1
  19. package/lib/component/2d/Top1DChart.js +1 -1
  20. package/lib/component/2d/Viewer2D.js +4 -4
  21. package/lib/component/2d/XAxis.js +2 -2
  22. package/lib/component/2d/YAxis.js +2 -2
  23. package/lib/component/2d/tools/XYLabelPointer.js +3 -1
  24. package/lib/component/2d/tools/slicing/SlicingView.js +3 -1
  25. package/lib/component/2d/zones/IndicationLines.js +1 -1
  26. package/lib/component/2d/zones/Zones.js +14 -19
  27. package/lib/component/EventsTrackers/BrushTracker.js +30 -21
  28. package/lib/component/NMRium.d.ts +2 -0
  29. package/lib/component/NMRium.js +14 -3
  30. package/lib/component/SplitPaneWrapper.js +1 -1
  31. package/lib/component/elements/EditableColumn.d.ts +3 -1
  32. package/lib/component/elements/EditableColumn.js +18 -3
  33. package/lib/component/elements/popup/Modal/Provider.d.ts +3 -3
  34. package/lib/component/elements/popup/Modal/Provider.js +8 -11
  35. package/lib/component/header/ZeroFillingOptionsPanel.js +3 -1
  36. package/lib/component/hooks/useActiveSpectrumStyleOptions.js +3 -3
  37. package/lib/component/hooks/useDatumWithSpectraStatistics.js +3 -1
  38. package/lib/component/hooks/useExport.d.ts +0 -1
  39. package/lib/component/hooks/useExport.js +1 -17
  40. package/lib/component/hooks/useIntegralPath.js +5 -2
  41. package/lib/component/hooks/useNucleus.js +4 -4
  42. package/lib/component/hooks/useSpectraPerNucleus.js +1 -1
  43. package/lib/component/hooks/useSpectrum.js +3 -1
  44. package/lib/component/loader/DropZone.js +15 -147
  45. package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
  46. package/lib/component/modal/editRange/EditRangeModal.js +1 -1
  47. package/lib/component/modal/setting/GeneralTabContent.js +1 -1
  48. package/lib/component/modal/setting/ToolsTabContent.js +4 -0
  49. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
  50. package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
  51. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
  52. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
  53. package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  54. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  55. package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
  56. package/lib/component/panels/RangesPanel/RangesHeader.js +10 -9
  57. package/lib/component/panels/RangesPanel/RangesPanel.js +7 -3
  58. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
  59. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
  60. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +3 -26
  61. package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
  62. package/lib/component/panels/SummaryPanel/utilities/useInView.js +3 -1
  63. package/lib/component/panels/ZonesPanel/ZonesPanel.js +19 -10
  64. package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
  65. package/lib/component/reducer/IgnoreActions.js +1 -0
  66. package/lib/component/reducer/Reducer.d.ts +110 -96
  67. package/lib/component/reducer/Reducer.js +45 -41
  68. package/lib/component/reducer/actions/DomainActions.d.ts +1 -1
  69. package/lib/component/reducer/actions/DomainActions.js +12 -9
  70. package/lib/component/reducer/actions/FiltersActions.d.ts +1 -1
  71. package/lib/component/reducer/actions/FiltersActions.js +227 -232
  72. package/lib/component/reducer/actions/IntegralsActions.js +14 -8
  73. package/lib/component/reducer/actions/LoadActions.d.ts +2 -5
  74. package/lib/component/reducer/actions/LoadActions.js +19 -34
  75. package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -1
  76. package/lib/component/reducer/actions/MoleculeActions.js +22 -6
  77. package/lib/component/reducer/actions/PeaksActions.js +19 -12
  78. package/lib/component/reducer/actions/PreferencesActions.js +9 -10
  79. package/lib/component/reducer/actions/RangesActions.d.ts +4 -4
  80. package/lib/component/reducer/actions/RangesActions.js +89 -29
  81. package/lib/component/reducer/actions/SpectraAnalysisAction.js +5 -5
  82. package/lib/component/reducer/actions/SpectrumsActions.js +14 -10
  83. package/lib/component/reducer/actions/ToolsActions.d.ts +1 -1
  84. package/lib/component/reducer/actions/ToolsActions.js +44 -27
  85. package/lib/component/reducer/actions/ZonesActions.d.ts +4 -1
  86. package/lib/component/reducer/actions/ZonesActions.js +69 -17
  87. package/lib/component/reducer/helper/Zoom1DManager.js +2 -1
  88. package/lib/component/reducer/helper/getActiveSpectrum.d.ts +3 -0
  89. package/lib/component/reducer/helper/getActiveSpectrum.js +4 -0
  90. package/lib/component/reducer/helper/getActiveSpectrumOrFail.d.ts +3 -0
  91. package/lib/component/reducer/helper/getActiveSpectrumOrFail.js +6 -0
  92. package/lib/component/reducer/helper/getSpectrum.js +3 -2
  93. package/lib/component/reducer/helper/getStrongestPeak.js +2 -1
  94. package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
  95. package/lib/component/reducer/types/Types.d.ts +5 -0
  96. package/lib/component/reducer/types/Types.js +5 -0
  97. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +6 -0
  98. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
  99. package/lib/component/tool/FloatMoleculeStructures/index.js +14 -8
  100. package/lib/component/toolbar/BasicToolBar.js +12 -13
  101. package/lib/component/toolbar/FunctionToolBar.js +3 -1
  102. package/lib/component/utility/Export.js +7 -1
  103. package/lib/component/utility/assert.d.ts +1 -0
  104. package/lib/component/utility/assert.js +5 -0
  105. package/lib/component/workspaces/Workspace.d.ts +1 -1
  106. package/lib/component/workspaces/exercise.js +9 -3
  107. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
  108. package/lib/data/Filters.d.ts +1 -2
  109. package/lib/data/Filters.js +1 -2
  110. package/lib/data/SpectraManager.d.ts +0 -4
  111. package/lib/data/SpectraManager.js +2 -87
  112. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
  113. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
  114. package/lib/data/data1d/filter1d/fft.js +11 -0
  115. package/lib/data/data1d/filter1d/phaseCorrection.js +11 -5
  116. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +2 -0
  117. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +35 -0
  118. package/lib/data/data2d/Processing2D.js +3 -2
  119. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -1
  120. package/lib/data/molecules/Molecule.d.ts +5 -0
  121. package/lib/data/utilities/calculateSanPlot.d.ts +8 -0
  122. package/lib/data/utilities/calculateSanPlot.js +31 -0
  123. package/lib/types/NMRiumGeneralPreferences.d.ts +2 -2
  124. package/lib/versionInfo.js +1 -1
  125. package/lib-cjs/component/1d/ApodizationLine.js +3 -1
  126. package/lib-cjs/component/1d/FooterBanner.js +19 -10
  127. package/lib-cjs/component/1d/IntegralsSeries.js +3 -1
  128. package/lib-cjs/component/1d/LinesSeries.js +3 -1
  129. package/lib-cjs/component/1d/SpectraTracker.js +1 -1
  130. package/lib-cjs/component/1d/Viewer1D.js +3 -1
  131. package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +5 -1
  132. package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  133. package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
  134. package/lib-cjs/component/1d/peaks/PeakAnnotations.js +3 -1
  135. package/lib-cjs/component/1d/peaks/PeaksShapes.js +4 -2
  136. package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +7 -3
  137. package/lib-cjs/component/1d/ranges/Ranges.js +7 -1
  138. package/lib-cjs/component/1d/tool/PeakPointer.js +3 -1
  139. package/lib-cjs/component/1d/tool/XLabelPointer.js +3 -1
  140. package/lib-cjs/component/2d/Contours.js +4 -2
  141. package/lib-cjs/component/2d/FooterBanner.js +3 -1
  142. package/lib-cjs/component/2d/Left1DChart.js +1 -1
  143. package/lib-cjs/component/2d/Top1DChart.js +1 -1
  144. package/lib-cjs/component/2d/Viewer2D.js +4 -4
  145. package/lib-cjs/component/2d/XAxis.js +2 -2
  146. package/lib-cjs/component/2d/YAxis.js +2 -2
  147. package/lib-cjs/component/2d/tools/XYLabelPointer.js +3 -1
  148. package/lib-cjs/component/2d/tools/slicing/SlicingView.js +3 -1
  149. package/lib-cjs/component/2d/zones/IndicationLines.js +1 -1
  150. package/lib-cjs/component/2d/zones/Zones.js +13 -18
  151. package/lib-cjs/component/EventsTrackers/BrushTracker.js +30 -21
  152. package/lib-cjs/component/NMRium.js +14 -3
  153. package/lib-cjs/component/SplitPaneWrapper.js +1 -1
  154. package/lib-cjs/component/elements/EditableColumn.js +18 -3
  155. package/lib-cjs/component/elements/popup/Modal/Provider.js +8 -11
  156. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -1
  157. package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +3 -3
  158. package/lib-cjs/component/hooks/useDatumWithSpectraStatistics.js +3 -1
  159. package/lib-cjs/component/hooks/useExport.js +0 -16
  160. package/lib-cjs/component/hooks/useIntegralPath.js +5 -2
  161. package/lib-cjs/component/hooks/useNucleus.js +4 -4
  162. package/lib-cjs/component/hooks/useSpectraPerNucleus.js +1 -1
  163. package/lib-cjs/component/hooks/useSpectrum.js +3 -1
  164. package/lib-cjs/component/loader/DropZone.js +14 -149
  165. package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
  166. package/lib-cjs/component/modal/editRange/EditRangeModal.js +1 -1
  167. package/lib-cjs/component/modal/setting/GeneralTabContent.js +1 -1
  168. package/lib-cjs/component/modal/setting/ToolsTabContent.js +4 -0
  169. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
  170. package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
  171. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
  172. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
  173. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  174. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  175. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -9
  176. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -3
  177. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
  178. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
  179. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -25
  180. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +1 -1
  181. package/lib-cjs/component/panels/SummaryPanel/utilities/useInView.js +3 -1
  182. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +18 -9
  183. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
  184. package/lib-cjs/component/reducer/IgnoreActions.js +1 -0
  185. package/lib-cjs/component/reducer/Reducer.js +48 -43
  186. package/lib-cjs/component/reducer/actions/DomainActions.js +12 -9
  187. package/lib-cjs/component/reducer/actions/FiltersActions.js +228 -233
  188. package/lib-cjs/component/reducer/actions/IntegralsActions.js +14 -8
  189. package/lib-cjs/component/reducer/actions/LoadActions.js +18 -36
  190. package/lib-cjs/component/reducer/actions/MoleculeActions.js +23 -6
  191. package/lib-cjs/component/reducer/actions/PeaksActions.js +19 -12
  192. package/lib-cjs/component/reducer/actions/PreferencesActions.js +9 -10
  193. package/lib-cjs/component/reducer/actions/RangesActions.js +89 -29
  194. package/lib-cjs/component/reducer/actions/SpectraAnalysisAction.js +5 -5
  195. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +14 -10
  196. package/lib-cjs/component/reducer/actions/ToolsActions.js +44 -27
  197. package/lib-cjs/component/reducer/actions/ZonesActions.js +72 -17
  198. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -1
  199. package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +8 -0
  200. package/lib-cjs/component/reducer/helper/getActiveSpectrumOrFail.js +10 -0
  201. package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -2
  202. package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -1
  203. package/lib-cjs/component/reducer/types/Types.js +8 -3
  204. package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
  205. package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +14 -8
  206. package/lib-cjs/component/toolbar/BasicToolBar.js +11 -12
  207. package/lib-cjs/component/toolbar/FunctionToolBar.js +3 -1
  208. package/lib-cjs/component/utility/Export.js +7 -1
  209. package/lib-cjs/component/utility/assert.js +9 -0
  210. package/lib-cjs/component/workspaces/exercise.js +9 -3
  211. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -1
  212. package/lib-cjs/data/Filters.js +1 -3
  213. package/lib-cjs/data/SpectraManager.js +3 -92
  214. package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
  215. package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
  216. package/lib-cjs/data/data1d/filter1d/fft.js +11 -0
  217. package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +10 -4
  218. package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +39 -0
  219. package/lib-cjs/data/data2d/Processing2D.js +3 -2
  220. package/lib-cjs/data/utilities/calculateSanPlot.js +35 -0
  221. package/lib-cjs/versionInfo.js +1 -1
  222. package/package.json +26 -25
  223. package/lib/component/utility/nmredataToNmrium.d.ts +0 -4
  224. package/lib/component/utility/nmredataToNmrium.js +0 -66
  225. package/lib/component/utility/nmriumToNmredata.d.ts +0 -2
  226. package/lib/component/utility/nmriumToNmredata.js +0 -80
  227. package/lib/component/utility/util/nmredata/addRanges.d.ts +0 -1
  228. package/lib/component/utility/util/nmredata/addRanges.js +0 -52
  229. package/lib/component/utility/util/nmredata/addSource.d.ts +0 -6
  230. package/lib/component/utility/util/nmredata/addSource.js +0 -54
  231. package/lib/component/utility/util/nmredata/addZones.d.ts +0 -1
  232. package/lib/component/utility/util/nmredata/addZones.js +0 -41
  233. package/lib/component/utility/util/nmredata/flat2DSignals.d.ts +0 -1
  234. package/lib/component/utility/util/nmredata/flat2DSignals.js +0 -7
  235. package/lib/component/utility/util/nmredata/get1DSignals.d.ts +0 -10
  236. package/lib/component/utility/util/nmredata/get1DSignals.js +0 -96
  237. package/lib/component/utility/util/nmredata/get2DSignals.d.ts +0 -8
  238. package/lib/component/utility/util/nmredata/get2DSignals.js +0 -59
  239. package/lib/component/utility/util/nmredata/getCouplingObserved.d.ts +0 -1
  240. package/lib/component/utility/util/nmredata/getCouplingObserved.js +0 -11
  241. package/lib/component/utility/util/nmredata/getLabels.d.ts +0 -9
  242. package/lib/component/utility/util/nmredata/getLabels.js +0 -66
  243. package/lib/component/utility/util/nmredata/getToFix.d.ts +0 -1
  244. package/lib/component/utility/util/nmredata/getToFix.js +0 -19
  245. package/lib/data/data1d/filter1d/absolute.d.ts +0 -13
  246. package/lib/data/data1d/filter1d/absolute.js +0 -26
  247. package/lib/data/migration/MigrationManager.d.ts +0 -2
  248. package/lib/data/migration/MigrationManager.js +0 -19
  249. package/lib/data/migration/changeKeys.d.ts +0 -1
  250. package/lib/data/migration/changeKeys.js +0 -9
  251. package/lib/data/migration/migrateToVersion1.d.ts +0 -11
  252. package/lib/data/migration/migrateToVersion1.js +0 -32
  253. package/lib/data/migration/migrateToVersion2.d.ts +0 -1
  254. package/lib/data/migration/migrateToVersion2.js +0 -111
  255. package/lib/data/migration/migrateToVersion3.d.ts +0 -1
  256. package/lib/data/migration/migrateToVersion3.js +0 -55
  257. package/lib-cjs/component/utility/nmredataToNmrium.js +0 -73
  258. package/lib-cjs/component/utility/nmriumToNmredata.js +0 -87
  259. package/lib-cjs/component/utility/util/nmredata/addRanges.js +0 -56
  260. package/lib-cjs/component/utility/util/nmredata/addSource.js +0 -61
  261. package/lib-cjs/component/utility/util/nmredata/addZones.js +0 -45
  262. package/lib-cjs/component/utility/util/nmredata/flat2DSignals.js +0 -11
  263. package/lib-cjs/component/utility/util/nmredata/get1DSignals.js +0 -100
  264. package/lib-cjs/component/utility/util/nmredata/get2DSignals.js +0 -63
  265. package/lib-cjs/component/utility/util/nmredata/getCouplingObserved.js +0 -15
  266. package/lib-cjs/component/utility/util/nmredata/getLabels.js +0 -70
  267. package/lib-cjs/component/utility/util/nmredata/getToFix.js +0 -23
  268. package/lib-cjs/data/data1d/filter1d/absolute.js +0 -32
  269. package/lib-cjs/data/migration/MigrationManager.js +0 -26
  270. package/lib-cjs/data/migration/changeKeys.js +0 -13
  271. package/lib-cjs/data/migration/migrateToVersion1.js +0 -35
  272. package/lib-cjs/data/migration/migrateToVersion2.js +0 -114
  273. package/lib-cjs/data/migration/migrateToVersion3.js +0 -58
@@ -12,9 +12,12 @@ const DimensionLayout_1 = require("../../2d/utilities/DimensionLayout");
12
12
  const scale_2 = require("../../2d/utilities/scale");
13
13
  const ToolTypes_1 = require("../../toolbar/ToolTypes");
14
14
  const GroupByInfoKey_1 = __importDefault(require("../../utility/GroupByInfoKey"));
15
+ const Reducer_1 = require("../Reducer");
15
16
  const Constants_1 = require("../core/Constants");
16
17
  const Zoom1DManager_1 = require("../helper/Zoom1DManager");
17
18
  const ZoomHistoryManager_1 = __importDefault(require("../helper/ZoomHistoryManager"));
19
+ const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
20
+ const getActiveSpectrumOrFail_1 = require("../helper/getActiveSpectrumOrFail");
18
21
  const DomainActions_1 = require("./DomainActions");
19
22
  const FiltersActions_1 = require("./FiltersActions");
20
23
  const PreferencesActions_1 = require("./PreferencesActions");
@@ -47,7 +50,18 @@ function setSelectedTool(draft, action) {
47
50
  if (selectedTool) {
48
51
  // start Range edit mode
49
52
  if (selectedTool === ToolTypes_1.options.editRange.id) {
50
- draft.toolOptions.data.showMultiplicityTrees = true;
53
+ const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
54
+ const range = draft.view.ranges.find((r) => r.spectrumID === activeSpectrum?.id);
55
+ if (range) {
56
+ range.showMultiplicityTrees = true;
57
+ }
58
+ else {
59
+ draft.view.ranges.push({
60
+ spectrumID: activeSpectrum.id,
61
+ ...Reducer_1.rangeStateInit,
62
+ showMultiplicityTrees: true,
63
+ });
64
+ }
51
65
  }
52
66
  if (selectedTool !== draft.toolOptions.selectedTool) {
53
67
  resetTool(draft, false);
@@ -112,10 +126,11 @@ function handleDeleteBaseLineZone(draft, id) {
112
126
  }
113
127
  exports.handleDeleteBaseLineZone = handleDeleteBaseLineZone;
114
128
  function handleToggleRealImaginaryVisibility(draft) {
115
- if (draft.activeSpectrum != null) {
116
- const { index } = draft.activeSpectrum;
117
- draft.data[index].display.isRealSpectrumVisible =
118
- !draft.data[index].display.isRealSpectrumVisible;
129
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
130
+ if (activeSpectrum != null) {
131
+ const { index } = activeSpectrum;
132
+ const datum = draft.data[index];
133
+ datum.display.isRealSpectrumVisible = !datum.display.isRealSpectrumVisible;
119
134
  (0, DomainActions_1.setDomain)(draft);
120
135
  }
121
136
  }
@@ -130,7 +145,7 @@ function handleBrushEnd(draft, action) {
130
145
  const endY = yScale.invert(action.endY);
131
146
  const domainX = startX > endX ? [endX, startX] : [startX, endX];
132
147
  const domainY = startY > endY ? [endY, startY] : [startY, endY];
133
- const brushHistory = (0, ZoomHistoryManager_1.default)(draft.zoom.history, draft.activeTab);
148
+ const brushHistory = (0, ZoomHistoryManager_1.default)(draft.zoom.history, draft.view.spectra.activeTab);
134
149
  if (draft.displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
135
150
  switch (action.trackID) {
136
151
  case DimensionLayout_1.LAYOUT.CENTER_2D:
@@ -159,22 +174,26 @@ function handleBrushEnd(draft, action) {
159
174
  }
160
175
  exports.handleBrushEnd = handleBrushEnd;
161
176
  function setVerticalIndicatorXPosition(draft, position) {
162
- if (draft.activeSpectrum?.id) {
177
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
178
+ if (activeSpectrum?.id) {
163
179
  const scaleX = (0, scale_1.getXScale)(draft);
164
180
  const value = scaleX.invert(position);
165
- const datum = draft.data[draft.activeSpectrum.index];
181
+ const datum = draft.data[activeSpectrum.index];
166
182
  const index = (0, ml_spectra_processing_1.xFindClosestIndex)(datum.data.x, value);
167
183
  draft.toolOptions.data.pivot = { value, index };
168
184
  }
169
185
  }
170
186
  exports.setVerticalIndicatorXPosition = setVerticalIndicatorXPosition;
171
187
  function getSpectrumID(draft, index) {
172
- const spectrum = draft.tabActiveSpectrum[draft.activeTab.split(',')[index]];
173
- return spectrum?.id ? spectrum.id : null;
188
+ const spectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab.split(',')[index]];
189
+ return spectrum?.id || null;
174
190
  }
175
191
  function handleZoom(draft, action) {
176
192
  const { event, trackID, selectedTool } = action;
177
- const { activeSpectrum, toolOptions: { data: { showRangesIntegrals }, }, displayerMode, } = draft;
193
+ const { view: { ranges: rangeState }, displayerMode, } = draft;
194
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
195
+ const { showRangesIntegrals } = rangeState.find((r) => r.spectrumID === activeSpectrum?.id) ||
196
+ Reducer_1.rangeStateInit;
178
197
  if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
179
198
  const index = trackID === DimensionLayout_1.LAYOUT.TOP_1D ? 0 : trackID === DimensionLayout_1.LAYOUT.LEFT_1D ? 1 : null;
180
199
  if (index !== null) {
@@ -207,7 +226,7 @@ exports.handleZoom = handleZoom;
207
226
  function zoomOut(draft, action) {
208
227
  if (draft?.data.length > 0) {
209
228
  const { zoomType, trackID } = action;
210
- const zoomHistory = (0, ZoomHistoryManager_1.default)(draft.zoom.history, draft.activeTab);
229
+ const zoomHistory = (0, ZoomHistoryManager_1.default)(draft.zoom.history, draft.view.spectra.activeTab);
211
230
  if (draft.displayerMode === Constants_1.DISPLAYER_MODE.DM_1D) {
212
231
  switch (zoomType) {
213
232
  case Zoom1DManager_1.ZoomType.HORIZONTAL: {
@@ -251,8 +270,8 @@ function zoomOut(draft, action) {
251
270
  }
252
271
  exports.zoomOut = zoomOut;
253
272
  function hasAcceptedSpectrum(draft, index) {
254
- const nucleuses = draft.activeTab.split(',');
255
- const activeSpectrum = draft.tabActiveSpectrum[nucleuses[index]];
273
+ const nucleuses = draft.view.spectra.activeTab.split(',');
274
+ const activeSpectrum = draft.view.spectra.activeSpectra[nucleuses[index]];
256
275
  return (activeSpectrum?.id &&
257
276
  !draft.data[activeSpectrum.index].info.isFid);
258
277
  }
@@ -277,7 +296,7 @@ function setMargin(draft) {
277
296
  function processing2DData(draft, data) {
278
297
  if (draft.displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
279
298
  let _data = {};
280
- for (const datum of data[draft.activeTab]) {
299
+ for (const datum of data[draft.view.spectra.activeTab]) {
281
300
  _data[datum.id] = datum.processingController.drawContours();
282
301
  }
283
302
  draft.contours = _data;
@@ -323,29 +342,26 @@ function setTabActiveSpectrum(draft, dataGroupByTab) {
323
342
  }
324
343
  }
325
344
  }
326
- draft.tabActiveSpectrum = tabActiveSpectrum;
345
+ draft.view.spectra.activeSpectra = tabActiveSpectrum;
327
346
  return tabs2D;
328
347
  }
329
348
  function setTab(draft, dataGroupByTab, tab, refresh = false) {
330
349
  const groupByTab = Object.keys(dataGroupByTab).sort((a, b) => a.split(',').length > b.split(',').length ? -1 : 1);
331
350
  if (JSON.stringify(groupByTab) !==
332
- JSON.stringify(Object.keys(draft.tabActiveSpectrum)) ||
351
+ JSON.stringify(Object.keys(draft.view.spectra.activeSpectra)) ||
333
352
  refresh) {
334
353
  const tabs2D = setTabActiveSpectrum(draft, dataGroupByTab);
335
354
  if (tabs2D.length > 0 && tab == null) {
336
- draft.activeSpectrum = draft.tabActiveSpectrum[tabs2D[0]];
337
- draft.activeTab = tabs2D[0];
355
+ draft.view.spectra.activeTab = tabs2D[0];
338
356
  }
339
357
  else {
340
- draft.activeSpectrum = tab ? draft.tabActiveSpectrum[tab] : tab;
341
- draft.activeTab = tab;
358
+ draft.view.spectra.activeTab = tab;
342
359
  }
343
360
  }
344
361
  else {
345
- draft.activeTab = tab;
346
- draft.activeSpectrum = draft.tabActiveSpectrum[tab];
362
+ draft.view.spectra.activeTab = tab;
347
363
  }
348
- setDisplayerMode(draft, dataGroupByTab[draft.activeTab]);
364
+ setDisplayerMode(draft, dataGroupByTab[draft.view.spectra.activeTab]);
349
365
  setMargin(draft);
350
366
  }
351
367
  exports.setTab = setTab;
@@ -360,7 +376,7 @@ function setActiveTab(draft, options) {
360
376
  processing2DData(draft, dataGroupByNucleus);
361
377
  (0, DomainActions_1.setDomain)(draft, domainOptions);
362
378
  (0, DomainActions_1.setIntegralsYDomain)(draft, dataGroupByNucleus[currentTab]);
363
- const zoomHistory = (0, ZoomHistoryManager_1.default)(draft.zoom.history, draft.activeTab);
379
+ const zoomHistory = (0, ZoomHistoryManager_1.default)(draft.zoom.history, draft.view.spectra.activeTab);
364
380
  const zoomValue = zoomHistory.getLast();
365
381
  if (zoomValue) {
366
382
  draft.xDomain = zoomValue.xDomain;
@@ -376,9 +392,10 @@ function handelSetActiveTab(draft, tab) {
376
392
  }
377
393
  exports.handelSetActiveTab = handelSetActiveTab;
378
394
  function levelChangeHandler(draft, { deltaY, shiftKey }) {
395
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
379
396
  try {
380
- if (draft.activeSpectrum?.id) {
381
- const { index, id } = draft.activeSpectrum;
397
+ if (activeSpectrum?.id) {
398
+ const { index, id } = activeSpectrum;
382
399
  const processingController = draft.data[index]
383
400
  .processingController;
384
401
  if (shiftKey) {
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.handleAutoSpectraZonesDetection = exports.changeZonesFactorHandler = exports.handleSetSignalPathLength = exports.handleSetDiaIDZone = exports.handleSaveEditedZone = exports.handleUnlinkZone = exports.handleChangeZoneSignalKind = exports.changeZoneSignalDelta = exports.handleDeleteZone = exports.handleDeleteSignal = exports.handleAutoZonesDetection = exports.add2dZoneHandler = void 0;
29
+ exports.handleShowPeaks = exports.handleShowSignals = exports.handleShowZones = exports.handleAutoSpectraZonesDetection = exports.changeZonesFactorHandler = exports.handleSetSignalPathLength = exports.handleSetDiaIDZone = exports.handleSaveEditedZone = exports.handleUnlinkZone = exports.handleChangeZoneSignalKind = exports.changeZoneSignalDelta = exports.handleDeleteZone = exports.handleDeleteSignal = exports.handleAutoZonesDetection = exports.add2dZoneHandler = void 0;
30
30
  const immer_1 = require("immer");
31
31
  const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
32
32
  const nmr_correlation_1 = require("nmr-correlation");
@@ -35,7 +35,9 @@ const FiltersManager = __importStar(require("../../../data/FiltersManager"));
35
35
  const SignalsKinds_1 = require("../../../data/constants/SignalsKinds");
36
36
  const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
37
37
  const ZoneUtilities_1 = require("../../../data/utilities/ZoneUtilities");
38
+ const Reducer_1 = require("../Reducer");
38
39
  const get2DRange_1 = __importDefault(require("../helper/get2DRange"));
40
+ const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
39
41
  const CorrelationsActions_1 = require("./CorrelationsActions");
40
42
  const DomainActions_1 = require("./DomainActions");
41
43
  function changeZonesFactorHandler(draft, action) {
@@ -43,8 +45,9 @@ function changeZonesFactorHandler(draft, action) {
43
45
  }
44
46
  exports.changeZonesFactorHandler = changeZonesFactorHandler;
45
47
  function add2dZoneHandler(draft, action) {
46
- if (draft.activeSpectrum?.id) {
47
- const { index } = draft.activeSpectrum;
48
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
49
+ if (activeSpectrum?.id) {
50
+ const { index } = activeSpectrum;
48
51
  const drawnZone = (0, get2DRange_1.default)(draft, action);
49
52
  const datum = draft.data[index];
50
53
  const zones = (0, Spectrum2D_1.detectZonesManual)((0, immer_1.original)(datum), {
@@ -58,8 +61,9 @@ function add2dZoneHandler(draft, action) {
58
61
  }
59
62
  exports.add2dZoneHandler = add2dZoneHandler;
60
63
  function handleAutoZonesDetection(draft, detectionOptions) {
61
- if (draft.activeSpectrum?.id) {
62
- const { index } = draft.activeSpectrum;
64
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
65
+ if (activeSpectrum?.id) {
66
+ const { index } = activeSpectrum;
63
67
  const [fromX, toX] = draft.xDomain;
64
68
  const [fromY, toY] = draft.yDomain;
65
69
  detectionOptions.selectedZone = { fromX, toX, fromY, toY };
@@ -87,8 +91,9 @@ function handleAutoSpectraZonesDetection(draft) {
87
91
  exports.handleAutoSpectraZonesDetection = handleAutoSpectraZonesDetection;
88
92
  function changeZoneSignalDelta(draft, action) {
89
93
  const { zoneID, signal } = action.payload;
90
- if (draft.activeSpectrum?.id) {
91
- const { index } = draft.activeSpectrum;
94
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
95
+ if (activeSpectrum?.id) {
96
+ const { index } = activeSpectrum;
92
97
  const { xShift, yShift } = (0, Spectrum2D_1.changeZoneSignal)(draft.data[index], zoneID, signal);
93
98
  let filters = [];
94
99
  if (xShift !== 0) {
@@ -109,8 +114,9 @@ function getZoneIndex(state, spectrumIndex, zoneID) {
109
114
  }
110
115
  function handleChangeZoneSignalKind(draft, action) {
111
116
  const state = (0, immer_1.original)(draft);
112
- if (state.activeSpectrum?.id) {
113
- const { index } = state.activeSpectrum;
117
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(state);
118
+ if (activeSpectrum?.id) {
119
+ const { index } = activeSpectrum;
114
120
  const { rowData, value } = action.payload;
115
121
  const zoneIndex = getZoneIndex(state, index, rowData.id);
116
122
  const _zone = draft.data[index].zones.values[zoneIndex];
@@ -124,8 +130,9 @@ function handleChangeZoneSignalKind(draft, action) {
124
130
  exports.handleChangeZoneSignalKind = handleChangeZoneSignalKind;
125
131
  function handleDeleteZone(draft, action) {
126
132
  const state = (0, immer_1.original)(draft);
127
- if (state.activeSpectrum?.id) {
128
- const { index } = state.activeSpectrum;
133
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(state);
134
+ if (activeSpectrum?.id) {
135
+ const { index } = activeSpectrum;
129
136
  const { id, assignmentData } = action.payload;
130
137
  if (id) {
131
138
  const zone = draft.data[index].zones.values.find((zone) => zone.id === id);
@@ -181,8 +188,9 @@ function handleSetSignalPathLength(draft, action) {
181
188
  exports.handleSetSignalPathLength = handleSetSignalPathLength;
182
189
  function handleUnlinkZone(draft, action) {
183
190
  const state = (0, immer_1.original)(draft);
184
- if (state.activeSpectrum?.id) {
185
- const { index } = state.activeSpectrum;
191
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(state);
192
+ if (activeSpectrum?.id) {
193
+ const { index } = activeSpectrum;
186
194
  const { zoneData = null, assignmentData, isOnZoneLevel = undefined, signalIndex = -1, axis = undefined, } = action.payload;
187
195
  if (zoneData) {
188
196
  // remove assignments in global state
@@ -204,8 +212,9 @@ function handleUnlinkZone(draft, action) {
204
212
  exports.handleUnlinkZone = handleUnlinkZone;
205
213
  function handleSetDiaIDZone(draft, action) {
206
214
  const state = (0, immer_1.original)(draft);
207
- if (state.activeSpectrum?.id) {
208
- const { index } = state.activeSpectrum;
215
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(state);
216
+ if (activeSpectrum?.id) {
217
+ const { index } = activeSpectrum;
209
218
  const { zoneData, diaIDs, axis, signalIndex, nbAtoms } = action.payload;
210
219
  const getNbAtoms = (input, current = 0) => input + current;
211
220
  const zoneIndex = getZoneIndex(state, index, zoneData.id);
@@ -223,8 +232,9 @@ function handleSetDiaIDZone(draft, action) {
223
232
  exports.handleSetDiaIDZone = handleSetDiaIDZone;
224
233
  function handleSaveEditedZone(draft, action) {
225
234
  const state = (0, immer_1.original)(draft);
226
- if (state.activeSpectrum?.id) {
227
- const { index } = state.activeSpectrum;
235
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(state);
236
+ if (activeSpectrum?.id) {
237
+ const { index } = activeSpectrum;
228
238
  const { editedRowData } = action.payload;
229
239
  delete editedRowData.tableMetaInfo;
230
240
  const zoneIndex = getZoneIndex(state, index, editedRowData.id);
@@ -238,6 +248,51 @@ function handleSaveEditedZone(draft, action) {
238
248
  }
239
249
  }
240
250
  exports.handleSaveEditedZone = handleSaveEditedZone;
251
+ function handleShowZones(draft, action) {
252
+ const { id } = action.payload;
253
+ const zone = draft.view.zones.find((r) => r.spectrumID === id);
254
+ if (zone) {
255
+ zone.showZones = !zone.showZones;
256
+ }
257
+ else {
258
+ draft.view.zones.push({
259
+ spectrumID: id,
260
+ ...Reducer_1.zoneStateInit,
261
+ showZones: !Reducer_1.zoneStateInit.showZones,
262
+ });
263
+ }
264
+ }
265
+ exports.handleShowZones = handleShowZones;
266
+ function handleShowSignals(draft, action) {
267
+ const { id } = action.payload;
268
+ const zone = draft.view.zones.find((r) => r.spectrumID === id);
269
+ if (zone) {
270
+ zone.showSignals = !zone.showSignals;
271
+ }
272
+ else {
273
+ draft.view.zones.push({
274
+ spectrumID: id,
275
+ ...Reducer_1.zoneStateInit,
276
+ showSignals: !Reducer_1.zoneStateInit.showSignals,
277
+ });
278
+ }
279
+ }
280
+ exports.handleShowSignals = handleShowSignals;
281
+ function handleShowPeaks(draft, action) {
282
+ const { id } = action.payload;
283
+ const zone = draft.view.zones.find((r) => r.spectrumID === id);
284
+ if (zone) {
285
+ zone.showPeaks = !zone.showPeaks;
286
+ }
287
+ else {
288
+ draft.view.zones.push({
289
+ spectrumID: id,
290
+ ...Reducer_1.zoneStateInit,
291
+ showPeaks: !Reducer_1.zoneStateInit.showPeaks,
292
+ });
293
+ }
294
+ }
295
+ exports.handleShowPeaks = handleShowPeaks;
241
296
  function handleOnChangeZonesData(draft) {
242
297
  (0, CorrelationsActions_1.handleUpdateCorrelations)(draft);
243
298
  }
@@ -18,7 +18,8 @@ function wheelZoom(event, domain, zoomOptions = {}) {
18
18
  }
19
19
  exports.wheelZoom = wheelZoom;
20
20
  function setZoom(draft, options = {}) {
21
- const { height, margin, activeSpectrum } = draft;
21
+ const { height, margin } = draft;
22
+ const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
22
23
  const { scale = 1, spectrumID = null } = options;
23
24
  if (activeSpectrum === null && spectrumID === null) {
24
25
  const { shareYDomain, yDomain, yDomains } = draft.originDomain;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getActiveSpectrum = void 0;
4
+ function getActiveSpectrum(state) {
5
+ const { activeSpectra, activeTab } = state.view.spectra;
6
+ return activeSpectra[activeTab] || null;
7
+ }
8
+ exports.getActiveSpectrum = getActiveSpectrum;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getActiveSpectrumOrFail = void 0;
4
+ const assert_1 = require("../../utility/assert");
5
+ function getActiveSpectrumOrFail(draft) {
6
+ const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
7
+ (0, assert_1.assert)(activeSpectrum !== null, 'Active spectrum must have id');
8
+ return activeSpectrum;
9
+ }
10
+ exports.getActiveSpectrumOrFail = getActiveSpectrumOrFail;
@@ -2,9 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSpectrum = void 0;
4
4
  function getSpectrum(state, value) {
5
+ const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
5
6
  if (value === undefined) {
6
- if (state.activeSpectrum?.id) {
7
- const index = state.activeSpectrum.index;
7
+ if (activeSpectrum?.id) {
8
+ const index = activeSpectrum.index;
8
9
  return state.data[index];
9
10
  }
10
11
  }
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getStrongestPeak = void 0;
4
4
  const d3_1 = require("d3");
5
5
  function getStrongestPeak(draft) {
6
- const { activeSpectrum, data } = draft;
6
+ const { data } = draft;
7
+ const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
7
8
  if (activeSpectrum) {
8
9
  const activeData = data[activeSpectrum?.index].data;
9
10
  const strongestPeakValue = (0, d3_1.max)(activeData.re);
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.APPLY_ZERO_FILLING_FILTER = exports.DELETE_SPECTRA_FILTER = exports.DELETE_FILTER = exports.ENABLE_FILTER = exports.RESET_DOMAIN = exports.BRUSH_END = exports.RESIZE_INTEGRAL = exports.CHANGE_SPECTRUM_DISPLAY_VIEW_MODE = exports.DELETE_SPECTRA = exports.SET_CORRELATIONS_TOLERANCE = exports.SET_CORRELATIONS_MF = exports.DELETE_CORRELATION = exports.SET_CORRELATIONS = exports.SET_CORRELATION = exports.CHANGE_MOLECULE_LABEL = exports.FLOAT_MOLECULE_OVER_SPECTRUM = exports.DELETE_MOLECULE = exports.SET_MOLECULE = exports.ADD_MOLECULE = exports.SET_ZOOM = exports.TOGGLE_REAL_IMAGINARY_VISIBILITY = exports.DELETE_INTEGRAL = exports.ADD_INTEGRAL = exports.CHANGE_SPECTRUM_COLOR = exports.CHANGE_ACTIVE_SPECTRUM = exports.CHANGE_PEAKS_MARKERS_VISIBILITY = exports.CHANGE_VISIBILITY = exports.FULL_ZOOM_OUT = exports.CHANGE_SPECTRUM_TYPE = exports.CHANGE_SPECTRUM_SETTING = exports.SET_SELECTED_FILTER = exports.SET_SELECTED_TOOL = exports.SET_DIMENSIONS = exports.SET_WIDTH = exports.SET_ORIGINAL_DOMAIN = exports.SET_Y_DOMAIN = exports.SET_X_DOMAIN = exports.SHIFT_SPECTRUM = exports.DELETE_PEAK_NOTATION = exports.CHANGE_PEAK_SHAPE = exports.ADD_PEAKS = exports.ADD_PEAK = exports.LOAD_JDF_FILE = exports.LOAD_ZIP_FILE = exports.LOAD_MOL_FILE = exports.LOAD_NMREDATA_FILE = exports.LOAD_JCAMP_FILE = exports.LOAD_JSON_FILE = exports.SAVE_DATA_AS_JSON = exports.INITIATE = void 0;
4
- exports.RESIZE_ANALYZE_SPECTRA_RANGE = exports.DELETE_ANALYZE_SPECTRA_RANGE = exports.ANALYZE_SPECTRA = exports.CHANGE_INTEGRAL_RELATIVE = exports.SET_DIAID_RANGE = exports.UNLINK_RANGE = exports.SAVE_EDITED_RANGE = exports.CHANGE_RANGE_SIGNAL_KIND = exports.CHANGE_RANGE_SIGNAL_VALUE = exports.CHANGE_RANGE_RELATIVE = exports.SET_FILTER_SNAPSHOT = exports.ADD_MISSING_PROJECTION = exports.SET_2D_SIGNAL_PATH_LENGTH = exports.DELETE_2D_SIGNAL = exports.DELETE_2D_ZONE = exports.ADD_2D_ZONE = exports.SET_2D_LEVEL = exports.ADD_RANGE = exports.CHANGE_RANGE_SUM = exports.RESIZE_RANGE = exports.APPLY_KEY_PREFERENCES = exports.SET_KEY_PREFERENCES = exports.APPLY_BASE_LINE_CORRECTION_FILTER = exports.DELETE_BASE_LINE_ZONE = exports.ADD_BASE_LINE_ZONE = exports.CHANGE_INTEGRAL_SUM = exports.SET_ACTIVE_TAB = exports.CHANGE_INTEGRAL_DATA = exports.SAVE_AS_SVG = exports.SET_SPECTRUMS_VERTICAL_ALIGN = exports.RESET_SELECTED_TOOL = exports.SET_LOADING_FLAG = exports.SET_SELECTED_OPTIONS_PANEL = exports.DELETE_1D_SIGNAL = exports.DELETE_RANGE = exports.AUTO_ZONES_DETECTION = exports.AUTO_RANGES_DETECTION = exports.OPTIMIZE_PEAKS = exports.AUTO_PEAK_PICKING = exports.SET_VERTICAL_INDICATOR_X_POSITION = exports.DISABLE_FILTER_LIVE_PREVIEW = exports.APPLY_ABSOLUTE_FILTER = exports.APPLY_AUTO_PHASE_CORRECTION_FILTER = exports.APPLY_MANUAL_PHASE_CORRECTION_FILTER = exports.CALCULATE_ZERO_FILLING_FILTER = exports.CALCULATE_APODIZATION_FILTER = exports.CALCULATE_BASE_LINE_CORRECTION_FILTER = exports.CALCULATE_MANUAL_PHASE_CORRECTION_FILTER = exports.APPLY_FFT_FILTER = exports.APPLY_APODIZATION_FILTER = void 0;
5
- exports.TOGGLE_PEAKS_SHAPES = exports.SET_AUTOMATIC_ASSIGNMENTS = exports.SHOW_J_GRAPH = exports.RESURRECTING_SPECTRUM_FROM_JCAMP = exports.RESURRECTING_SPECTRUM_FROM_RANGES = exports.GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = exports.AUTO_ZONES_SPECTRA_PICKING = exports.AUTO_RANGES_SPECTRA_PICKING = exports.SHOW_RANGES_INTEGRALS = exports.SHOW_MULTIPLICTY_TREES = exports.UPDATE_RANGE = exports.CHANGE_ZONES_NOISE_FACTOR = exports.CHANGE_INTEGRALS_SUM_FLAG = exports.CHANGE_RANGES_SUM_FLAG = exports.DELETE_EXCLUSION_ZONE = exports.ADD_EXCLUSION_ZONE = exports.APPLY_MULTIPLE_SPECTRA_FILTER = exports.SET_MOUSE_OVER_DISPLAYER = exports.RESET_SPECTRA_SCALE = exports.SET_SPECTRA_SAME_TOP = exports.PREDICT_SPECTRA = exports.SET_DIAID_ZONE = exports.UNLINK_ZONE = exports.SAVE_EDITED_ZONE = exports.CHANGE_ZONE_SIGNAL_KIND = exports.CHANGE_ZONE_SIGNAL_VALUE = exports.ALIGN_SPECTRA = exports.FILTER_SPECTRA_COLUMN = exports.SET_ANALYZE_SPECTRA_COLUMNS = void 0;
3
+ exports.DELETE_FILTER = exports.ENABLE_FILTER = exports.RESET_DOMAIN = exports.BRUSH_END = exports.RESIZE_INTEGRAL = exports.CHANGE_SPECTRUM_DISPLAY_VIEW_MODE = exports.DELETE_SPECTRA = exports.SET_CORRELATIONS_TOLERANCE = exports.SET_CORRELATIONS_MF = exports.DELETE_CORRELATION = exports.SET_CORRELATIONS = exports.SET_CORRELATION = exports.CHANGE_MOLECULE_LABEL = exports.CHANGE_FLOAT_MOLECULE_POSITION = exports.FLOAT_MOLECULE_OVER_SPECTRUM = exports.DELETE_MOLECULE = exports.SET_MOLECULE = exports.ADD_MOLECULE = exports.SET_ZOOM = exports.TOGGLE_REAL_IMAGINARY_VISIBILITY = exports.DELETE_INTEGRAL = exports.ADD_INTEGRAL = exports.CHANGE_SPECTRUM_COLOR = exports.CHANGE_ACTIVE_SPECTRUM = exports.CHANGE_PEAKS_MARKERS_VISIBILITY = exports.CHANGE_VISIBILITY = exports.FULL_ZOOM_OUT = exports.CHANGE_SPECTRUM_TYPE = exports.CHANGE_SPECTRUM_SETTING = exports.SET_SELECTED_FILTER = exports.SET_SELECTED_TOOL = exports.SET_DIMENSIONS = exports.SET_WIDTH = exports.SET_ORIGINAL_DOMAIN = exports.SET_Y_DOMAIN = exports.SET_X_DOMAIN = exports.SHIFT_SPECTRUM = exports.DELETE_PEAK_NOTATION = exports.CHANGE_PEAK_SHAPE = exports.ADD_PEAKS = exports.ADD_PEAK = exports.LOAD_DROP_FILES = exports.LOAD_JDF_FILE = exports.LOAD_ZIP_FILE = exports.LOAD_MOL_FILE = exports.LOAD_NMREDATA_FILE = exports.LOAD_JCAMP_FILE = exports.LOAD_JSON_FILE = exports.SAVE_DATA_AS_JSON = exports.INITIATE = void 0;
4
+ exports.ANALYZE_SPECTRA = exports.CHANGE_INTEGRAL_RELATIVE = exports.SET_DIAID_RANGE = exports.UNLINK_RANGE = exports.SAVE_EDITED_RANGE = exports.CHANGE_RANGE_SIGNAL_KIND = exports.CHANGE_RANGE_SIGNAL_VALUE = exports.CHANGE_RANGE_RELATIVE = exports.SET_FILTER_SNAPSHOT = exports.ADD_MISSING_PROJECTION = exports.SET_2D_SIGNAL_PATH_LENGTH = exports.DELETE_2D_SIGNAL = exports.DELETE_2D_ZONE = exports.ADD_2D_ZONE = exports.SET_2D_LEVEL = exports.ADD_RANGE = exports.CHANGE_RANGE_SUM = exports.RESIZE_RANGE = exports.APPLY_KEY_PREFERENCES = exports.SET_KEY_PREFERENCES = exports.APPLY_BASE_LINE_CORRECTION_FILTER = exports.DELETE_BASE_LINE_ZONE = exports.ADD_BASE_LINE_ZONE = exports.CHANGE_INTEGRAL_SUM = exports.SET_ACTIVE_TAB = exports.CHANGE_INTEGRAL_DATA = exports.SAVE_AS_SVG = exports.SET_SPECTRUMS_VERTICAL_ALIGN = exports.RESET_SELECTED_TOOL = exports.SET_LOADING_FLAG = exports.SET_SELECTED_OPTIONS_PANEL = exports.DELETE_1D_SIGNAL = exports.DELETE_RANGE = exports.AUTO_ZONES_DETECTION = exports.AUTO_RANGES_DETECTION = exports.OPTIMIZE_PEAKS = exports.AUTO_PEAK_PICKING = exports.SET_VERTICAL_INDICATOR_X_POSITION = exports.DISABLE_FILTER_LIVE_PREVIEW = exports.APPLY_ABSOLUTE_FILTER = exports.APPLY_AUTO_PHASE_CORRECTION_FILTER = exports.APPLY_MANUAL_PHASE_CORRECTION_FILTER = exports.CALCULATE_ZERO_FILLING_FILTER = exports.CALCULATE_APODIZATION_FILTER = exports.CALCULATE_BASE_LINE_CORRECTION_FILTER = exports.CALCULATE_MANUAL_PHASE_CORRECTION_FILTER = exports.APPLY_FFT_FILTER = exports.APPLY_APODIZATION_FILTER = exports.APPLY_ZERO_FILLING_FILTER = exports.DELETE_SPECTRA_FILTER = void 0;
5
+ exports.TOGGLE_PEAKS_SHAPES = exports.SET_AUTOMATIC_ASSIGNMENTS = exports.SHOW_J_GRAPH = exports.RESURRECTING_SPECTRUM_FROM_JCAMP = exports.RESURRECTING_SPECTRUM_FROM_RANGES = exports.GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = exports.SHOW_ZONES_PEAKS = exports.SHOW_ZONES_SIGNALS = exports.SHOW_ZONES = exports.AUTO_ZONES_SPECTRA_PICKING = exports.AUTO_RANGES_SPECTRA_PICKING = exports.SHOW_RANGES_INTEGRALS = exports.SHOW_MULTIPLICTY_TREES = exports.UPDATE_RANGE = exports.CHANGE_ZONES_NOISE_FACTOR = exports.CHANGE_INTEGRALS_SUM_FLAG = exports.CHANGE_RANGES_SUM_FLAG = exports.DELETE_EXCLUSION_ZONE = exports.ADD_EXCLUSION_ZONE = exports.APPLY_MULTIPLE_SPECTRA_FILTER = exports.SET_MOUSE_OVER_DISPLAYER = exports.RESET_SPECTRA_SCALE = exports.SET_SPECTRA_SAME_TOP = exports.PREDICT_SPECTRA = exports.SET_DIAID_ZONE = exports.UNLINK_ZONE = exports.SAVE_EDITED_ZONE = exports.CHANGE_ZONE_SIGNAL_KIND = exports.CHANGE_ZONE_SIGNAL_VALUE = exports.ALIGN_SPECTRA = exports.FILTER_SPECTRA_COLUMN = exports.SET_ANALYZE_SPECTRA_COLUMNS = exports.RESIZE_ANALYZE_SPECTRA_RANGE = exports.DELETE_ANALYZE_SPECTRA_RANGE = void 0;
6
6
  exports.INITIATE = 'INITIATE';
7
7
  exports.SAVE_DATA_AS_JSON = 'SAVE_DATA_AS_JSON';
8
8
  exports.LOAD_JSON_FILE = 'LOAD_JSON_FILE';
@@ -11,6 +11,7 @@ exports.LOAD_NMREDATA_FILE = 'LOAD_NMREDATA_FILE';
11
11
  exports.LOAD_MOL_FILE = 'LOAD_MOL_FILE';
12
12
  exports.LOAD_ZIP_FILE = 'LOAD_ZIP_FILE';
13
13
  exports.LOAD_JDF_FILE = 'LOAD_JDF_FILE';
14
+ exports.LOAD_DROP_FILES = 'LOAD_DROP_FILES';
14
15
  exports.ADD_PEAK = 'ADD_PEAK';
15
16
  exports.ADD_PEAKS = 'ADD_PEAKS';
16
17
  exports.CHANGE_PEAK_SHAPE = 'CHANGE_PEAK_SHAPE';
@@ -38,6 +39,7 @@ exports.ADD_MOLECULE = 'ADD_MOLECULE';
38
39
  exports.SET_MOLECULE = 'SET_MOLECULE';
39
40
  exports.DELETE_MOLECULE = 'DELETE_MOLECULE';
40
41
  exports.FLOAT_MOLECULE_OVER_SPECTRUM = 'FLOAT_MOLECULE_OVER_SPECTRUM';
42
+ exports.CHANGE_FLOAT_MOLECULE_POSITION = 'CHANGE_FLOAT_MOLECULE_POSITION';
41
43
  exports.CHANGE_MOLECULE_LABEL = 'CHANGE_MOLECULE_LABEL';
42
44
  exports.SET_CORRELATION = 'SET_CORRELATION';
43
45
  exports.SET_CORRELATIONS = 'SET_CORRELATIONS';
@@ -126,6 +128,9 @@ exports.SHOW_MULTIPLICTY_TREES = 'SHOW_MULTIPLICTY_TREES';
126
128
  exports.SHOW_RANGES_INTEGRALS = 'SHOW_RANGES_INTEGRALS';
127
129
  exports.AUTO_RANGES_SPECTRA_PICKING = 'AUTO_RANGES_SPECTRA_PICKING';
128
130
  exports.AUTO_ZONES_SPECTRA_PICKING = 'AUTO_ZONES_SPECTRA_PICKING';
131
+ exports.SHOW_ZONES = 'SHOW_ZONES';
132
+ exports.SHOW_ZONES_SIGNALS = 'SHOW_ZONES_SIGNALS';
133
+ exports.SHOW_ZONES_PEAKS = 'SHOW_ZONES_PEAKS';
129
134
  exports.GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = 'GENERATE_SPECTRUM_FROM_PUBLICATION_STRING';
130
135
  exports.RESURRECTING_SPECTRUM_FROM_RANGES = 'RESURRECTING_SPECTRUM_FROM_RANGES';
131
136
  exports.RESURRECTING_SPECTRUM_FROM_JCAMP = 'RESURRECTING_SPECTRUM_FROM_JCAMP';
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DraggableStructure = void 0;
6
+ exports.DraggableStructure = exports.DRAGGABLE_STRUCTURE_INITIAL_POSITION = void 0;
7
7
  const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
8
8
  /** @jsxImportSource @emotion/react */
9
9
  const react_1 = require("@emotion/react");
@@ -31,8 +31,9 @@ const style = (0, react_1.css) `
31
31
  }
32
32
  }
33
33
  `;
34
+ exports.DRAGGABLE_STRUCTURE_INITIAL_POSITION = { x: 100, y: 50 };
34
35
  function DraggableStructure(props) {
35
- const { zones, ranges, molecule, activeTab, displayerMode, index } = props;
36
+ const { zones, ranges, molecule, activeTab, displayerMode, index, position = exports.DRAGGABLE_STRUCTURE_INITIAL_POSITION, } = props;
36
37
  const { viewerRef } = (0, GlobalContext_1.useGlobal)();
37
38
  const dispatch = (0, DispatchContext_1.useDispatch)();
38
39
  const openMoleculeEditor = (0, MoleculeStructureEditorModal_1.useMoleculeEditor)();
@@ -43,7 +44,13 @@ function DraggableStructure(props) {
43
44
  payload: { id: molecule.id },
44
45
  });
45
46
  }, [dispatch, molecule]);
46
- return ((0, jsx_runtime_1.jsx)(SVGDraggable_1.default, { width: 150, height: 100, initialPosition: { x: 100, y: 50 }, dragHandleClassName: "handle", parentElement: viewerRef, children: (width, height) => ((0, jsx_runtime_1.jsxs)("foreignObject", { width: width, height: height + 30, "data-replace-float-structure": "true", css: style, onDoubleClick: () => openMoleculeEditor(molecule), children: [(0, jsx_runtime_1.jsx)(ActionsButton_1.default, { onFloatBtnClick: floatMoleculeHandler }), (0, jsx_runtime_1.jsx)(react_ocl_nmr_1.default, { OCL: full_1.default, 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
47
+ const dragFloatMoleculeHandler = (0, react_2.useCallback)((position) => {
48
+ dispatch({
49
+ type: Types_1.CHANGE_FLOAT_MOLECULE_POSITION,
50
+ payload: { id: molecule.id, position },
51
+ });
52
+ }, [dispatch, molecule]);
53
+ return ((0, jsx_runtime_1.jsx)(SVGDraggable_1.default, { width: 150, height: 100, initialPosition: position, dragHandleClassName: "handle", parentElement: viewerRef, onEnd: dragFloatMoleculeHandler, children: (width, height) => ((0, jsx_runtime_1.jsxs)("foreignObject", { width: width, height: height + 30, "data-replace-float-structure": "true", css: style, onDoubleClick: () => openMoleculeEditor(molecule), children: [(0, jsx_runtime_1.jsx)(ActionsButton_1.default, { onFloatBtnClick: floatMoleculeHandler }), (0, jsx_runtime_1.jsx)(react_ocl_nmr_1.default, { OCL: full_1.default, 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
47
54
  ? currentDiaIDsToHighlight
48
55
  : assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover, setMolfile: (molfile) => {
49
56
  dispatch({
@@ -8,6 +8,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = require("react");
9
9
  const ChartContext_1 = require("../../context/ChartContext");
10
10
  const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
11
+ const assert_1 = require("../../utility/assert");
11
12
  const DraggableStructure_1 = require("./DraggableStructure");
12
13
  function FloatMoleculeStructuresInner(props) {
13
14
  const { zones, ranges, floatingMolecules, molecules, activeTab, displayerMode, } = props;
@@ -15,19 +16,24 @@ function FloatMoleculeStructuresInner(props) {
15
16
  return null;
16
17
  return ((0, jsx_runtime_1.jsx)("g", { children: floatingMolecules
17
18
  .filter((molecule) => molecule.visible)
18
- .map((molecule) => ((0, jsx_runtime_1.jsx)(DraggableStructure_1.DraggableStructure, { ...{
19
- zones,
20
- ranges,
21
- activeTab,
22
- displayerMode,
23
- molecule: molecules.find((m) => m.id === molecule.id),
24
- } }, molecule.id))) }));
19
+ .map(({ id, position }) => {
20
+ const molecule = molecules.find((m) => m.id === id);
21
+ (0, assert_1.assert)(molecule !== undefined, 'molecule should be defined');
22
+ return ((0, jsx_runtime_1.jsx)(DraggableStructure_1.DraggableStructure, { ...{
23
+ zones,
24
+ ranges,
25
+ activeTab,
26
+ displayerMode,
27
+ position,
28
+ molecule,
29
+ } }, id));
30
+ }) }));
25
31
  }
26
32
  exports.FloatMoleculeStructuresInner = FloatMoleculeStructuresInner;
27
33
  const MemoizedFloatMoleculeStructures = (0, react_1.memo)(FloatMoleculeStructuresInner);
28
34
  const emptyData = { ranges: {}, zones: {} };
29
35
  function FloatMoleculeStructures() {
30
- const { molecules, displayerMode, activeTab, view: { floatingMolecules }, } = (0, ChartContext_1.useChartData)();
36
+ const { molecules, displayerMode, view: { floatingMolecules, spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
31
37
  const data = (0, useSpectrum_1.default)(emptyData);
32
38
  const ranges = data?.ranges || {};
33
39
  const zones = data?.zones || {};
@@ -21,6 +21,7 @@ const useExport_1 = __importDefault(require("../hooks/useExport"));
21
21
  const useToolsFunctions_1 = __importDefault(require("../hooks/useToolsFunctions"));
22
22
  const ImportPublicationStringModal_1 = __importDefault(require("../modal/ImportPublicationStringModal"));
23
23
  const LoadJCAMPModal_1 = __importDefault(require("../modal/LoadJCAMPModal"));
24
+ const Reducer_1 = require("../reducer/Reducer");
24
25
  const Types_1 = require("../reducer/types/Types");
25
26
  const IMPORT_MENU = [
26
27
  {
@@ -78,13 +79,14 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
78
79
  const openLoader = (0, LoaderContext_1.useLoader)();
79
80
  const isExperimentalFeature = (0, useCheckExperimentalFeature_1.default)();
80
81
  const isButtonVisible = (0, useCheckToolsVisibility_1.useCheckToolsVisibility)();
81
- const importMenu = (0, react_1.useMemo)(() => {
82
- return isExperimentalFeature
83
- ? IMPORT_MENU
84
- : IMPORT_MENU.filter((item) => item.id !== 'importPublicationString');
85
- }, [isExperimentalFeature]);
82
+ const importMenu = isExperimentalFeature
83
+ ? IMPORT_MENU
84
+ : IMPORT_MENU.filter((item) => item.id !== 'importPublicationString');
85
+ const exportMenu = isExperimentalFeature
86
+ ? EXPORT_MENU
87
+ : EXPORT_MENU.filter((item) => item.id !== 'nmre');
86
88
  const { isRealSpectrumShown, changeSpectrumViewHandler, changeDisplayViewModeHandler, alignSpectrumsVerticallyHandler, } = (0, useToolsFunctions_1.default)();
87
- const { saveAsSVGHandler, saveAsPNGHandler, saveAsJSONHandler, saveAsNMREHandler, saveToClipboardHandler, saveAsHandler, } = (0, useExport_1.default)();
89
+ const { saveAsSVGHandler, saveAsPNGHandler, saveAsJSONHandler, saveToClipboardHandler, saveAsHandler, } = (0, useExport_1.default)();
88
90
  const LoadJacmpHandler = (0, react_1.useCallback)((file) => {
89
91
  if (file) {
90
92
  dispatch({ type: Types_1.LOAD_JCAMP_FILE, files: [file] });
@@ -132,9 +134,6 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
132
134
  case 'advance_save':
133
135
  void saveAsHandler();
134
136
  break;
135
- case 'nmre':
136
- void saveAsNMREHandler();
137
- break;
138
137
  case 'copy':
139
138
  void saveToClipboardHandler();
140
139
  break;
@@ -146,7 +145,6 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
146
145
  saveAsPNGHandler,
147
146
  saveAsJSONHandler,
148
147
  saveAsHandler,
149
- saveAsNMREHandler,
150
148
  saveToClipboardHandler,
151
149
  ]);
152
150
  return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [isButtonVisible('import') && ((0, jsx_runtime_1.jsx)(ToolbarMenu_1.default, { component: (0, jsx_runtime_1.jsx)(fa_1.FaFileImport, {}), toolTip: "Import", onClick: (element) => {
@@ -155,7 +153,7 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
155
153
  }, items: importMenu })), isButtonVisible('exportAs') && ((0, jsx_runtime_1.jsx)(ToolbarMenu_1.default, { component: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}), toolTip: "Export As", onClick: (element) => {
156
154
  exportHandler(element);
157
155
  return null;
158
- }, items: EXPORT_MENU })), isButtonVisible('spectraStackAlignments') &&
156
+ }, items: exportMenu })), isButtonVisible('spectraStackAlignments') &&
159
157
  ftCounter > 1 &&
160
158
  (info?.isFt || !activeSpectrum) && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "spectra-alignment", className: "cheminfo", title: "Spectra alignment ( Press s )", onClick: changeDisplayViewModeHandler, children: verticalAlign.align === 'stack' ? ((0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrOverlay3Aligned, {})) : ((0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrOverlay3, {})) })), isButtonVisible('realImaginary') && info.isComplex && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "display", title: isRealSpectrumShown ? 'Display Real ' : 'Display Imaginary', onClick: changeSpectrumViewHandler, className: "cheminfo", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrRealImag, {}) })), isButtonVisible('spectraCenterAlignments') &&
161
159
  (ftCounter > 0 || fidCounter > 0) && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "baseline-position", title: verticalAlign.align === 'bottom'
@@ -164,7 +162,8 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
164
162
  }
165
163
  const MemoizedBasicToolBar = (0, react_1.memo)(BasicToolBarInner);
166
164
  function BasicToolBar() {
167
- const { activeSpectrum, verticalAlign, displayerMode, activeTab } = (0, ChartContext_1.useChartData)();
165
+ const { verticalAlign, displayerMode, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
166
+ const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
168
167
  const { info, fidCounter, ftCounter } = (0, useDatumWithSpectraStatistics_1.default)();
169
168
  return ((0, jsx_runtime_1.jsx)(MemoizedBasicToolBar, { ...{
170
169
  info,
@@ -39,6 +39,7 @@ const ToggleButtonGroup_1 = __importDefault(require("../elements/toggle/ToggleBu
39
39
  const useCheckToolsVisibility_1 = require("../hooks/useCheckToolsVisibility");
40
40
  const useDatumWithSpectraStatistics_1 = __importDefault(require("../hooks/useDatumWithSpectraStatistics"));
41
41
  const useToolsFunctions_1 = __importDefault(require("../hooks/useToolsFunctions"));
42
+ const Reducer_1 = require("../reducer/Reducer");
42
43
  const Types_1 = require("../reducer/types/Types");
43
44
  const ToolTypes_1 = require("./ToolTypes");
44
45
  function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, ftCounter, }) {
@@ -75,7 +76,8 @@ function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, ftCou
75
76
  }
76
77
  const MemoizedFunctionToolBar = (0, react_1.memo)(FunctionToolBarInner);
77
78
  function FunctionToolBar({ defaultValue = ToolTypes_1.options.zoom.id, }) {
78
- const { activeSpectrum, displayerMode, activeTab } = (0, ChartContext_1.useChartData)();
79
+ const { displayerMode, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
80
+ const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
79
81
  const data = (0, useDatumWithSpectraStatistics_1.default)();
80
82
  return ((0, jsx_runtime_1.jsx)(MemoizedFunctionToolBar, { ...{
81
83
  ...data,
@@ -50,7 +50,13 @@ async function copyHTMLToClipboard(data) {
50
50
  exports.copyHTMLToClipboard = copyHTMLToClipboard;
51
51
  async function copyTextToClipboard(data) {
52
52
  try {
53
- await navigator.clipboard.writeText(data);
53
+ void navigator.clipboard.write([
54
+ new ClipboardItem({
55
+ 'text/plain': new Promise((resolve) => {
56
+ resolve(new Blob([data], { type: 'text/plain' }));
57
+ }),
58
+ }),
59
+ ]);
54
60
  return true;
55
61
  }
56
62
  catch (err) {
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assert = void 0;
4
+ function assert(value, message) {
5
+ if (!value) {
6
+ throw new Error(`unreachable${message ? `: ${message}` : ''}`);
7
+ }
8
+ }
9
+ exports.assert = assert;