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
@@ -11,6 +11,7 @@ import ToggleButtonGroup from '../elements/toggle/ToggleButtonGroup';
11
11
  import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
12
12
  import useDatumWithSpectraStatistics from '../hooks/useDatumWithSpectraStatistics';
13
13
  import useToolsFunctions from '../hooks/useToolsFunctions';
14
+ import { useActiveSpectrum } from '../reducer/Reducer';
14
15
  import { APPLY_FFT_FILTER, SET_SELECTED_FILTER } from '../reducer/types/Types';
15
16
  import { options } from './ToolTypes';
16
17
  function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, ftCounter, }) {
@@ -47,7 +48,8 @@ function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, ftCou
47
48
  }
48
49
  const MemoizedFunctionToolBar = memo(FunctionToolBarInner);
49
50
  export default function FunctionToolBar({ defaultValue = options.zoom.id, }) {
50
- const { activeSpectrum, displayerMode, activeTab } = useChartData();
51
+ const { displayerMode, view: { spectra: { activeTab }, }, } = useChartData();
52
+ const activeSpectrum = useActiveSpectrum();
51
53
  const data = useDatumWithSpectraStatistics();
52
54
  return (_jsx(MemoizedFunctionToolBar, { ...{
53
55
  ...data,
@@ -43,7 +43,13 @@ async function copyHTMLToClipboard(data) {
43
43
  }
44
44
  async function copyTextToClipboard(data) {
45
45
  try {
46
- await navigator.clipboard.writeText(data);
46
+ void navigator.clipboard.write([
47
+ new ClipboardItem({
48
+ 'text/plain': new Promise((resolve) => {
49
+ resolve(new Blob([data], { type: 'text/plain' }));
50
+ }),
51
+ }),
52
+ ]);
47
53
  return true;
48
54
  }
49
55
  catch (err) {
@@ -0,0 +1 @@
1
+ export declare function assert(value: unknown, message?: string): asserts value;
@@ -0,0 +1,5 @@
1
+ export function assert(value, message) {
2
+ if (!value) {
3
+ throw new Error(`unreachable${message ? `: ${message}` : ''}`);
4
+ }
5
+ }
@@ -5,7 +5,7 @@ interface NucleusFormat {
5
5
  hz: string;
6
6
  }
7
7
  interface GeneralPreferences {
8
- dimmedSpectraTransparency: number;
8
+ dimmedSpectraOpacity: number;
9
9
  }
10
10
  interface ColumnPreferences {
11
11
  show: boolean;
@@ -1,5 +1,5 @@
1
1
  export const exercise = {
2
- version: 1,
2
+ version: 2,
3
3
  label: 'Exercise',
4
4
  display: {
5
5
  general: {
@@ -10,11 +10,17 @@ export const exercise = {
10
10
  integralsPanel: { display: true },
11
11
  },
12
12
  toolBarButtons: {
13
+ zoom: true,
14
+ zoomOut: true,
15
+ apodization: true,
16
+ zeroFilling: true,
17
+ fastFourierTransform: true,
18
+ phaseCorrection: true,
19
+ baselineCorrection: true,
20
+ peakPicking: true,
13
21
  integral: true,
14
22
  spectraCenterAlignments: true,
15
23
  spectraStackAlignments: true,
16
- zoomOut: true,
17
- zoom: true,
18
24
  },
19
25
  },
20
26
  };
@@ -43,7 +43,7 @@ export const workspaceDefaultProperties = {
43
43
  },
44
44
  },
45
45
  general: {
46
- dimmedSpectraTransparency: 0.1,
46
+ dimmedSpectraOpacity: 0.1,
47
47
  },
48
48
  formatting: {
49
49
  nuclei: {
@@ -1,4 +1,3 @@
1
- import * as absolute from './data1d/filter1d/absolute';
2
1
  import * as apodization from './data1d/filter1d/apodization';
3
2
  import * as autoPhaseCorrection from './data1d/filter1d/autoPhaseCorrection';
4
3
  import * as baselineCorrection from './data1d/filter1d/baselineCorrection';
@@ -15,4 +14,4 @@ import * as standardDeviation from './data1d/filter1d/standardDeviation';
15
14
  import * as zeroFilling from './data1d/filter1d/zeroFilling';
16
15
  import * as shift2DX from './data2d/filter2d/shiftX';
17
16
  import * as shift2DY from './data2d/filter2d/shiftY';
18
- export { absolute, baselineCorrection, apodization, fft, phaseCorrection, autoPhaseCorrection, shiftX, zeroFilling, digitalFilter, fromTo, equallySpaced, standardDeviation, centerMean, pareto, exclusionZones, shift2DX, shift2DY, };
17
+ export { baselineCorrection, apodization, fft, phaseCorrection, autoPhaseCorrection, shiftX, zeroFilling, digitalFilter, fromTo, equallySpaced, standardDeviation, centerMean, pareto, exclusionZones, shift2DX, shift2DY, };
@@ -1,4 +1,3 @@
1
- import * as absolute from './data1d/filter1d/absolute';
2
1
  import * as apodization from './data1d/filter1d/apodization';
3
2
  import * as autoPhaseCorrection from './data1d/filter1d/autoPhaseCorrection';
4
3
  import * as baselineCorrection from './data1d/filter1d/baselineCorrection';
@@ -15,4 +14,4 @@ import * as standardDeviation from './data1d/filter1d/standardDeviation';
15
14
  import * as zeroFilling from './data1d/filter1d/zeroFilling';
16
15
  import * as shift2DX from './data2d/filter2d/shiftX';
17
16
  import * as shift2DY from './data2d/filter2d/shiftY';
18
- export { absolute, baselineCorrection, apodization, fft, phaseCorrection, autoPhaseCorrection, shiftX, zeroFilling, digitalFilter, fromTo, equallySpaced, standardDeviation, centerMean, pareto, exclusionZones, shift2DX, shift2DY, };
17
+ export { baselineCorrection, apodization, fft, phaseCorrection, autoPhaseCorrection, shiftX, zeroFilling, digitalFilter, fromTo, equallySpaced, standardDeviation, centerMean, pareto, exclusionZones, shift2DX, shift2DY, };
@@ -7,11 +7,7 @@ export declare enum DataExportOptions {
7
7
  export declare type DataExportOptionsType = keyof typeof DataExportOptions;
8
8
  export declare function addJcampFromURL(spectra: any, jcampURL: any, options: any, usedColors: any): Promise<void>;
9
9
  export declare function addJcamp(spectra: any, jcamp: any, options: any, usedColors: any): void;
10
- export declare function addJDF(spectra: any, jdf: any, options?: any, usedColors?: any): void;
11
10
  export declare function fromJSON(data?: any[], usedColors?: any): Promise<any[]>;
12
- export declare function addBruker(options: any, data: any, usedColors: any): Promise<any[]>;
13
- export declare function fromZip(zipFiles: any): Promise<never[]>;
14
- export declare function addJDFs(files: any, usedColors: any): never[];
15
11
  export declare function addJcamps(files: any, usedColors: any): never[];
16
12
  /**
17
13
  *
@@ -1,10 +1,10 @@
1
- import { fromJEOL, fromJCAMP, fromBruker } from 'nmr-parser';
1
+ import { CURRENT_EXPORT_VERSION } from 'nmr-load-save';
2
+ import { fromJCAMP } from 'nmr-parser';
2
3
  import { DISPLAYER_MODE } from '../component/reducer/core/Constants';
3
4
  import * as Data1DManager from './data1d/Data1DManager';
4
5
  import * as Datum1D from './data1d/Spectrum1D';
5
6
  import * as Data2DManager from './data2d/Data2DManager';
6
7
  import * as Datum2D from './data2d/Spectrum2D';
7
- import { CURRENT_EXPORT_VERSION } from './migration/MigrationManager';
8
8
  import * as Molecule from './molecules/Molecule';
9
9
  export var DataExportOptions;
10
10
  (function (DataExportOptions) {
@@ -60,40 +60,6 @@ function addData(spectra, datum, usedColors) {
60
60
  spectra.push(Datum2D.initiateDatum2D(datum, usedColors));
61
61
  }
62
62
  }
63
- export function addJDF(spectra, jdf, options = {}, usedColors = {}) {
64
- // need to parse the jcamp
65
- let converted = fromJEOL(jdf, {});
66
- converted = converted[0];
67
- let info = converted.description;
68
- let metadata = info.metadata;
69
- delete info.metadata;
70
- info.acquisitionMode = 0;
71
- info.experiment = info.dimension === 1 ? '1d' : '2d';
72
- info.type = 'NMR SPECTRUM';
73
- info.nucleus = info.nucleus[0];
74
- info.numberOfPoints = info.numberOfPoints[0];
75
- info.acquisitionTime = info.acquisitionTime[0];
76
- info.baseFrequency = info.baseFrequency[0];
77
- info.frequencyOffset = info.frequencyOffset[0];
78
- info.spectralWidthClipped = converted.application.spectralWidthClipped;
79
- if (info.dimension === 1) {
80
- if (converted.dependentVariables) {
81
- spectra.push(Data1DManager.fromCSD(converted, {
82
- ...options,
83
- display: { ...options.display },
84
- info,
85
- meta: metadata,
86
- }, usedColors));
87
- }
88
- }
89
- if (info.dimension === 2 && info.isFt) {
90
- spectra.push(Data2DManager.fromCSD(converted, {
91
- ...options,
92
- display: { ...options.display },
93
- info,
94
- }, usedColors));
95
- }
96
- }
97
63
  export async function fromJSON(data = [], usedColors = {}) {
98
64
  const spectra = [];
99
65
  let promises = [];
@@ -112,57 +78,6 @@ export async function fromJSON(data = [], usedColors = {}) {
112
78
  await Promise.all(promises);
113
79
  return spectra;
114
80
  }
115
- export async function addBruker(options, data, usedColors) {
116
- const spectra = [];
117
- let result = await fromBruker(data, {
118
- converter: {
119
- xy: true,
120
- },
121
- });
122
- let entries = result;
123
- for (let entry of entries) {
124
- let { info, dependentVariables } = entry;
125
- if (info.dimension === 1) {
126
- if (dependentVariables[0].components) {
127
- spectra.push(Data1DManager.fromBruker(entry, {
128
- ...options,
129
- display: { ...options.display },
130
- }, usedColors));
131
- }
132
- }
133
- else if (info.dimension === 2) {
134
- spectra.push(Data2DManager.fromBruker(entry, {
135
- ...options,
136
- info,
137
- display: { ...options.display },
138
- }, usedColors));
139
- }
140
- }
141
- return spectra;
142
- }
143
- // handle zip files
144
- export async function fromZip(zipFiles) {
145
- const spectra = [];
146
- for (let zipFile of zipFiles) {
147
- await addBruker(spectra, { display: { name: zipFile.name } }, zipFile.binary);
148
- }
149
- return spectra;
150
- }
151
- export function addJDFs(files, usedColors) {
152
- const spectra = [];
153
- for (const file of files) {
154
- addJDF(spectra, file.binary, {
155
- display: {
156
- name: file.name,
157
- },
158
- source: {
159
- jcampURL: file.jcampURL ? file.jcampURL : null,
160
- file,
161
- },
162
- }, usedColors);
163
- }
164
- return spectra;
165
- }
166
81
  export function addJcamps(files, usedColors) {
167
82
  const spectra = [];
168
83
  for (const file of files) {
@@ -14,6 +14,7 @@ export function autoPeakPicking(datum1D, options) {
14
14
  let peaks = xyAutoPeaksPicking({ x, y: re }, {
15
15
  frequency,
16
16
  direction,
17
+ shape: { kind: 'lorentzian' },
17
18
  noiseLevel: noise * noiseFactor,
18
19
  minMaxRatio,
19
20
  realTopDetection: true,
@@ -1,6 +1,7 @@
1
1
  import { xyAutoRangesPicking } from 'nmr-processing';
2
2
  const defaultPeakPickingOptions = {
3
3
  minMaxRatio: 1,
4
+ shape: { kind: 'lorentzian' },
4
5
  realTopDetection: true,
5
6
  maxCriteria: true,
6
7
  smoothY: false,
@@ -1,4 +1,5 @@
1
1
  import { reimFFT, reimPhaseCorrection } from 'ml-spectra-processing';
2
+ import { padDataToNextPowerOfTwo } from './utils/padDataToNextPowerOfTwo';
2
3
  export const id = 'fft';
3
4
  export const name = 'FFT';
4
5
  /**
@@ -10,6 +11,13 @@ export function apply(datum1D) {
10
11
  throw new Error('fft not applicable on this data');
11
12
  }
12
13
  let digitalFilterApplied = datum1D.filters.some((e) => e.name === 'digitalFilter' && e.flag);
14
+ const { data } = datum1D;
15
+ if (data.x.length !== data.re.length || data.x.length !== data.im.length) {
16
+ throw new Error('The length of data should be equal');
17
+ }
18
+ else if (!isPowerOfTwo(datum1D.data.x.length)) {
19
+ padDataToNextPowerOfTwo(datum1D, digitalFilterApplied);
20
+ }
13
21
  Object.assign(datum1D.data, reimFFT(datum1D.data, { applyZeroShift: true }));
14
22
  if (digitalFilterApplied) {
15
23
  let { digitalFilter = 0 } = datum1D.info;
@@ -47,3 +55,6 @@ function generateXAxis(datum1D) {
47
55
  }
48
56
  return xAxis;
49
57
  }
58
+ function isPowerOfTwo(n) {
59
+ return n !== 0 && (n & (n - 1)) === 0;
60
+ }
@@ -1,4 +1,4 @@
1
- import { reimPhaseCorrection } from 'ml-spectra-processing';
1
+ import { reimAbsolute, reimPhaseCorrection } from 'ml-spectra-processing';
2
2
  export const id = 'phaseCorrection';
3
3
  export const name = 'Phase correction';
4
4
  /**
@@ -12,10 +12,16 @@ export function apply(datum1D, options = {}) {
12
12
  if (!isApplicable(datum1D)) {
13
13
  throw new Error('phaseCorrection not applicable on this data');
14
14
  }
15
- let { ph0, ph1 } = options;
16
- ph0 *= Math.PI / 180.0;
17
- ph1 *= Math.PI / 180.0;
18
- Object.assign(datum1D.data, reimPhaseCorrection(datum1D.data, ph0, ph1));
15
+ let { ph0, ph1, absolute } = options;
16
+ if (absolute) {
17
+ datum1D.data.re = reimAbsolute(datum1D.data);
18
+ datum1D.data.im = new Float64Array(0);
19
+ }
20
+ else {
21
+ ph0 *= Math.PI / 180.0;
22
+ ph1 *= Math.PI / 180.0;
23
+ Object.assign(datum1D.data, reimPhaseCorrection(datum1D.data, ph0, ph1));
24
+ }
19
25
  }
20
26
  export function isApplicable(datum1D) {
21
27
  if (datum1D.info.isComplex && !datum1D.info.isFid)
@@ -0,0 +1,2 @@
1
+ import { Datum1D } from '../../../types/data1d';
2
+ export declare function padDataToNextPowerOfTwo(datum1D: Datum1D, digitalFilterApplied: boolean): void;
@@ -0,0 +1,35 @@
1
+ import { xSequentialFill } from 'ml-spectra-processing';
2
+ export function padDataToNextPowerOfTwo(datum1D, digitalFilterApplied) {
3
+ const { x, re, im } = datum1D.data;
4
+ const size = nextPowerOfTwo(x.length);
5
+ let newRE = new Float64Array(size);
6
+ let newIM = new Float64Array(size);
7
+ const pointsToShift = getPointsToShift(datum1D);
8
+ newRE.set(re.slice(0, length - pointsToShift));
9
+ newIM.set(im.slice(0, length - pointsToShift));
10
+ if (pointsToShift > 0 && digitalFilterApplied) {
11
+ newRE.set(re.slice(re.length - pointsToShift), size - pointsToShift);
12
+ newIM.set(im.slice(re.length - pointsToShift), size - pointsToShift);
13
+ }
14
+ const newX = xSequentialFill({
15
+ from: x[0],
16
+ size,
17
+ step: x[1] - x[0],
18
+ });
19
+ datum1D.data = { ...datum1D.data, ...{ re: newRE, im: newIM, x: newX } };
20
+ }
21
+ function getPointsToShift(datum1D) {
22
+ let grpdly = datum1D.info?.digitalFilter || 0;
23
+ return grpdly > 0 ? Math.floor(grpdly) : 0;
24
+ }
25
+ function nextPowerOfTwo(n) {
26
+ if (n === 0)
27
+ return 1;
28
+ n--;
29
+ n |= n >> 1;
30
+ n |= n >> 2;
31
+ n |= n >> 4;
32
+ n |= n >> 8;
33
+ n |= n >> 16;
34
+ return n + 1;
35
+ }
@@ -1,5 +1,5 @@
1
1
  import { Conrec } from 'ml-conrec';
2
- import { matrixAbsoluteMedian } from 'ml-spectra-processing';
2
+ import { calculateSanPlot } from '../utilities/calculateSanPlot';
3
3
  export const defaultContourOptions = {
4
4
  positive: {
5
5
  contourLevels: [0, 21],
@@ -22,7 +22,8 @@ export default class Processing2D {
22
22
  const xs = getRange(minMax.minX, minMax.maxX, minMax.z[0].length);
23
23
  const ys = getRange(minMax.minY, minMax.maxY, minMax.z.length);
24
24
  this.conrec = new Conrec(minMax.z, { xs, ys, swapAxes: false });
25
- this.median = matrixAbsoluteMedian(minMax.z);
25
+ const sanResult = calculateSanPlot('2D', minMax);
26
+ this.median = sanResult.positive;
26
27
  this.minMax = minMax;
27
28
  }
28
29
  getLevel() {
@@ -21,4 +21,4 @@ export interface DetectionZonesOptions {
21
21
  * @param {number} options.thresholdFactor
22
22
  * @param {boolean} options.convolutionByFFT
23
23
  */
24
- export declare function getDetectionZones(datum: Datum2D, options: DetectionZonesOptions): import("nmr-processing").NMRZone[];
24
+ export declare function getDetectionZones(datum: Datum2D, options: DetectionZonesOptions): import("nmr-processing").NMRZoneWithID[];
@@ -1,3 +1,4 @@
1
+ import { Position } from '../../component/elements/draggble/useDraggable';
1
2
  export interface StateMolecule {
2
3
  id: string;
3
4
  molfile: string;
@@ -19,6 +20,10 @@ export interface FloatingMolecules {
19
20
  * If the floating molecule is shown.
20
21
  */
21
22
  visible: boolean;
23
+ /**
24
+ * Floating molecule position.
25
+ */
26
+ position: Position;
22
27
  }
23
28
  export declare function initMolecule(options?: Partial<StateMolecule>): StateMoleculeExtended;
24
29
  export declare function toJSON(molecule: StateMoleculeExtended): StateMolecule;
@@ -0,0 +1,8 @@
1
+ import { Data1D } from '../types/data1d';
2
+ import { Data2D } from '../types/data2d';
3
+ export declare function calculateSanPlot<T extends '1D' | '2D'>(dimension: T, data: T extends '1D' ? Data1D : Data2D): {
4
+ positive: number;
5
+ negative: number;
6
+ snr: number;
7
+ sanplot: Record<string, import("cheminfo-types").DataXY<import("cheminfo-types").DoubleArray>>;
8
+ };
@@ -0,0 +1,31 @@
1
+ import { xNoiseSanPlot } from 'ml-spectra-processing';
2
+ export function calculateSanPlot(dimension, data) {
3
+ const input = dimension === '1D'
4
+ ? prepare1DData(data)
5
+ : prepare2DData(data);
6
+ return xNoiseSanPlot(input);
7
+ }
8
+ function prepare1DData(data) {
9
+ const length = data.re.length;
10
+ const jump = Math.floor(length / 307200) || 1;
11
+ const array = new Float64Array((length / jump) >> 0);
12
+ let index = 0;
13
+ for (let i = 0; i < array.length; i += jump) {
14
+ array[index++] = data.re[i];
15
+ }
16
+ return array;
17
+ }
18
+ function prepare2DData(data) {
19
+ let cols = data.z[0].length;
20
+ let rows = data.z.length;
21
+ let jump = Math.floor((cols * rows) / 204800) || 1;
22
+ const array = new Float64Array(((cols * rows) / jump) >> 0);
23
+ let index = 0;
24
+ // console.log('jump', jump, cols * rows);
25
+ for (let r = 0; r < rows; r += 1) {
26
+ for (let c = 0; c < cols; c += jump) {
27
+ array[index++] = data.z[r][c];
28
+ }
29
+ }
30
+ return array;
31
+ }
@@ -1,8 +1,8 @@
1
- import { InitialSeparation } from 'analysis-ui-components/lib-esm/components/SplitPane';
1
+ import { SplitPaneSize } from 'analysis-ui-components';
2
2
  import { PanelPreferencesType } from './PanelPreferencesType';
3
3
  export interface NMRiumGeneralPreferences {
4
4
  hideGeneralSettings: boolean;
5
5
  experimentalFeatures: PanelPreferencesType;
6
6
  hidePanelOnLoad: boolean;
7
- initialPanelWidth?: InitialSeparation;
7
+ initialPanelWidth?: SplitPaneSize;
8
8
  }
@@ -1 +1 @@
1
- export default { version: 'v0.30.0' };
1
+ export default { version: 'v0.32.0' };
@@ -33,6 +33,7 @@ const ChartContext_1 = require("../context/ChartContext");
33
33
  const ScaleContext_1 = require("../context/ScaleContext");
34
34
  const useSpectrum_1 = __importDefault(require("../hooks/useSpectrum"));
35
35
  const useXYReduce_1 = __importStar(require("../hooks/useXYReduce"));
36
+ const Reducer_1 = require("../reducer/Reducer");
36
37
  const PathBuilder_1 = require("../utility/PathBuilder");
37
38
  const scale_1 = require("./utilities/scale");
38
39
  const emptyData = { data: {}, info: {} };
@@ -46,7 +47,8 @@ function useWindowYScale() {
46
47
  });
47
48
  }
48
49
  function ApdoizationLine() {
49
- const { activeSpectrum, toolOptions: { selectedTool, data: { apodizationOptions }, }, } = (0, ChartContext_1.useChartData)();
50
+ const { toolOptions: { selectedTool, data: { apodizationOptions }, }, } = (0, ChartContext_1.useChartData)();
51
+ const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
50
52
  const { scaleX } = (0, ScaleContext_1.useScaleChecked)();
51
53
  const spectrum = (0, useSpectrum_1.default)({ emptyData });
52
54
  const xyReduce = (0, useXYReduce_1.default)(useXYReduce_1.XYReducerDomainAxis.XAxis);
@@ -17,6 +17,7 @@ const ChartContext_1 = require("../context/ChartContext");
17
17
  const ScaleContext_1 = require("../context/ScaleContext");
18
18
  const useFormatNumberByNucleus_1 = require("../hooks/useFormatNumberByNucleus");
19
19
  const useSpectrum_1 = __importDefault(require("../hooks/useSpectrum"));
20
+ const Reducer_1 = require("../reducer/Reducer");
20
21
  const styles = (0, react_1.css) `
21
22
  display: flex;
22
23
  flex-firection: row;
@@ -71,14 +72,6 @@ function FooterBannerInner({ margin, width, height, activeSpectrum, spectrum, ac
71
72
  const { startX, endX, step } = (0, react_2.useContext)(BrushTracker_1.BrushContext);
72
73
  const { scaleX } = (0, ScaleContext_1.useScaleChecked)();
73
74
  const format = (0, useFormatNumberByNucleus_1.useFormatNumberByNucleus)(activeTab);
74
- const getYValue = (0, react_2.useCallback)((xPosition) => {
75
- if (spectrum) {
76
- const data = (0, get1DDataXY_1.get1DDataXY)(spectrum);
77
- const xIndex = (0, ml_spectra_processing_1.xFindClosestIndex)(data.x, scaleX().invert(xPosition));
78
- return data.y[xIndex];
79
- }
80
- return 1;
81
- }, [spectrum, scaleX]);
82
75
  if (!position ||
83
76
  position.y < margin.top ||
84
77
  position.x < margin.left ||
@@ -86,13 +79,29 @@ function FooterBannerInner({ margin, width, height, activeSpectrum, spectrum, ac
86
79
  position.y > height - margin.bottom) {
87
80
  return (0, jsx_runtime_1.jsx)("div", { css: styles });
88
81
  }
89
- return ((0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsx)(bs_1.BsCursor, {}), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: " \uD835\uDEC5: " }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: format(scaleX().invert(position.x)) }), (0, jsx_runtime_1.jsx)("span", { className: "unit", children: "ppm" }), activeSpectrum && spectrum?.info?.originFrequency && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("span", { className: "value", children: ["\u00A0(", format(scaleX().invert(position.x) * spectrum?.info?.originFrequency, 'hz')] }), (0, jsx_runtime_1.jsx)("span", { className: "unit", children: "Hz" }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: ") " })] }))] }), step === 'brushing' && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: " \u0394ppm: " }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: (scaleX().invert(startX) - scaleX().invert(endX)).toPrecision(6) })] })), activeSpectrum && ((0, jsx_runtime_1.jsxs)(react_2.Fragment, { children: [spectrum?.info?.originFrequency && step === 'brushing' && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: " \u0394Hz: " }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: ((scaleX().invert(startX) - scaleX().invert(endX)) *
82
+ function getXIndex(xPosition) {
83
+ if (spectrum) {
84
+ const data = (0, get1DDataXY_1.get1DDataXY)(spectrum);
85
+ return (0, ml_spectra_processing_1.xFindClosestIndex)(data.x, scaleX().invert(xPosition));
86
+ }
87
+ return 0;
88
+ }
89
+ function getYValue(xPosition) {
90
+ if (spectrum) {
91
+ const data = (0, get1DDataXY_1.get1DDataXY)(spectrum);
92
+ const xIndex = getXIndex(xPosition);
93
+ return data.y[xIndex];
94
+ }
95
+ return 1;
96
+ }
97
+ return ((0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsx)(bs_1.BsCursor, {}), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: " \uD835\uDEC5: " }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: format(scaleX().invert(position.x)) }), (0, jsx_runtime_1.jsx)("span", { className: "unit", children: "ppm" }), activeSpectrum && spectrum?.info?.originFrequency && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("span", { className: "value", children: ["\u00A0(", format(scaleX().invert(position.x) * spectrum?.info?.originFrequency, 'hz')] }), (0, jsx_runtime_1.jsx)("span", { className: "unit", children: "Hz" }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: ") " }), (0, jsx_runtime_1.jsx)("span", { children: "," }), (0, jsx_runtime_1.jsx)("span", { className: "label", children: " Index: " }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: getXIndex(position.x) })] }))] }), step === 'brushing' && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: " \u0394ppm: " }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: (scaleX().invert(startX) - scaleX().invert(endX)).toPrecision(6) })] })), activeSpectrum && ((0, jsx_runtime_1.jsxs)(react_2.Fragment, { children: [spectrum?.info?.originFrequency && step === 'brushing' && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: " \u0394Hz: " }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: ((scaleX().invert(startX) - scaleX().invert(endX)) *
90
98
  spectrum?.info?.originFrequency).toPrecision(5) })] })), step === 'brushing' && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: " ratio :" }), (0, jsx_runtime_1.jsxs)("span", { className: "value", children: [((getYValue(startX) / (getYValue(endX) || Number.MIN_VALUE)) *
91
99
  100).toFixed(2), "%"] })] }))] })), activeSpectrum && ((0, jsx_runtime_1.jsxs)(react_2.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "separator" }), (0, jsx_runtime_1.jsx)(io5_1.IoPulseSharp, {}), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: "Intensity: " }), (0, jsx_runtime_1.jsx)("span", { className: "value yvalue", children: format(getYValue(position.x)) })] })] }))] }));
92
100
  }
93
101
  const MemoizedFooterBanner = (0, react_2.memo)(FooterBannerInner);
94
102
  function FooterBanner() {
95
- const { margin, width, height, activeSpectrum, activeTab } = (0, ChartContext_1.useChartData)();
103
+ const { margin, width, height, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
104
+ const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
96
105
  const spectrum = (0, useSpectrum_1.default)(null);
97
106
  return ((0, jsx_runtime_1.jsx)(MemoizedFooterBanner, { ...{ margin, width, height, activeSpectrum, spectrum, activeTab } }));
98
107
  }
@@ -7,9 +7,11 @@ const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const react_1 = require("react");
8
8
  const Spectrum1D_1 = require("../../data/data1d/Spectrum1D");
9
9
  const ChartContext_1 = require("../context/ChartContext");
10
+ const Reducer_1 = require("../reducer/Reducer");
10
11
  const Integral_1 = __importDefault(require("./Integral"));
11
12
  function IntegralsSeries() {
12
- const { xDomains, activeSpectrum, data, displayerKey, activeTab: nucleus, } = (0, ChartContext_1.useChartData)();
13
+ const { xDomains, data, displayerKey, view: { spectra: { activeTab: nucleus }, }, } = (0, ChartContext_1.useChartData)();
14
+ const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
13
15
  const Integrals = (0, react_1.useMemo)(() => {
14
16
  const isActive = (id) => {
15
17
  return activeSpectrum === null ? true : id === activeSpectrum.id;
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const get1DDataXY_1 = require("../../data/data1d/Spectrum1D/get1DDataXY");
8
8
  const ChartContext_1 = require("../context/ChartContext");
9
+ const Reducer_1 = require("../reducer/Reducer");
9
10
  const Line_1 = __importDefault(require("./Line"));
10
11
  function LinesSeries() {
11
- const { data, tempData, displayerKey, xDomains, activeSpectrum } = (0, ChartContext_1.useChartData)();
12
+ const { data, tempData, displayerKey, xDomains } = (0, ChartContext_1.useChartData)();
13
+ const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
12
14
  let _data = tempData ? tempData : data;
13
15
  return ((0, jsx_runtime_1.jsxs)("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, className: "spectrums", children: [_data
14
16
  ?.filter((d) => d.display.isVisible === true && xDomains[d.id])
@@ -44,7 +44,7 @@ function YTracker({ datum }) {
44
44
  return (0, jsx_runtime_1.jsx)("span", { style: styles.value, children: datum.y[xIndex] });
45
45
  }
46
46
  function SpectraTracker() {
47
- const { data, activeTab, xDomains } = (0, ChartContext_1.useChartData)();
47
+ const { data, view: { spectra: { activeTab }, }, xDomains, } = (0, ChartContext_1.useChartData)();
48
48
  const [isVisible, toggleVisibility] = (0, react_1.useState)(false);
49
49
  (0, react_1.useEffect)(() => {
50
50
  function handler(flag) {
@@ -41,6 +41,7 @@ const Alert_1 = require("../elements/popup/Alert");
41
41
  const Modal_1 = require("../elements/popup/Modal");
42
42
  const Spinner_1 = __importDefault(require("../loader/Spinner"));
43
43
  const MultipletAnalysisModal_1 = __importDefault(require("../modal/MultipletAnalysisModal"));
44
+ const Reducer_1 = require("../reducer/Reducer");
44
45
  const Zoom1DManager_1 = require("../reducer/helper/Zoom1DManager");
45
46
  const getRange_1 = __importDefault(require("../reducer/helper/getRange"));
46
47
  const scaleReducer_1 = __importStar(require("../reducer/scaleReducer"));
@@ -57,7 +58,8 @@ const VerticalIndicator_1 = __importDefault(require("./tool/VerticalIndicator"))
57
58
  const XLabelPointer_1 = __importDefault(require("./tool/XLabelPointer"));
58
59
  function Viewer1D({ emptyText = undefined }) {
59
60
  const state = (0, ChartContext_1.useChartData)();
60
- const { toolOptions: { selectedTool }, isLoading, data, mode, width: widthProp, height: heightProp, margin, activeSpectrum, xDomain, xDomains, yDomain, yDomains, verticalAlign, displayerKey, } = state;
61
+ const { toolOptions: { selectedTool }, isLoading, data, mode, width: widthProp, height: heightProp, margin, xDomain, xDomains, yDomain, yDomains, verticalAlign, displayerKey, } = state;
62
+ const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
61
63
  const dispatch = (0, DispatchContext_1.useDispatch)();
62
64
  const modal = (0, Modal_1.useModal)();
63
65
  const alert = (0, Alert_1.useAlert)();
@@ -10,6 +10,7 @@ const generateJGraphData_1 = __importDefault(require("../../../data/data1d/Spect
10
10
  const ChartContext_1 = require("../../context/ChartContext");
11
11
  const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
12
12
  const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
13
+ const Reducer_1 = require("../../reducer/Reducer");
13
14
  const JGraphContext_1 = require("./JGraphContext");
14
15
  const JGraphVerticalAxis_1 = require("./JGraphVerticalAxis");
15
16
  const JsCouplingLinks_1 = __importDefault(require("./JsCouplingLinks"));
@@ -22,7 +23,10 @@ function InnerJGraph(props) {
22
23
  const emptyData = { ranges: {} };
23
24
  const MemoizedJGraph = (0, react_1.memo)(InnerJGraph);
24
25
  function JGraph() {
25
- const { height, toolOptions: { data: { showJGraph }, }, activeTab, } = (0, ChartContext_1.useChartData)();
26
+ const { height, view: { ranges: rangeState, spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
27
+ const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
28
+ const { showJGraph } = rangeState.find((r) => r.spectrumID === activeSpectrum?.id) ||
29
+ Reducer_1.rangeStateInit;
26
30
  const rangesPreferences = (0, usePanelPreferences_1.usePanelPreferences)('ranges', activeTab);
27
31
  const graphHeight = height / 4;
28
32
  const { ranges } = (0, useSpectrum_1.default)(emptyData);
@@ -24,7 +24,7 @@ function MultiAnalysisRangesInner({ activeTab, spectraAnalysis, displayerKey, })
24
24
  }
25
25
  const MemoizedMultiAnalysisRanges = (0, react_1.memo)(MultiAnalysisRangesInner);
26
26
  function MultiAnalysisRanges() {
27
- const { activeTab, spectraAnalysis, displayerKey } = (0, ChartContext_1.useChartData)();
27
+ const { view: { spectra: { activeTab }, }, spectraAnalysis, displayerKey, } = (0, ChartContext_1.useChartData)();
28
28
  return ((0, jsx_runtime_1.jsx)(MemoizedMultiAnalysisRanges, { ...{ activeTab, spectraAnalysis, displayerKey } }));
29
29
  }
30
30
  exports.default = MultiAnalysisRanges;