nmrium 0.41.0 → 0.43.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 (247) hide show
  1. package/lib/component/1d/ApodizationLine.js +1 -1
  2. package/lib/component/1d/Chart1D.js +3 -2
  3. package/lib/component/1d/Line.js +1 -1
  4. package/lib/component/1d/Viewer1D.js +15 -3
  5. package/lib/component/1d/integral/IntegralResizable.js +4 -3
  6. package/lib/component/1d/multiAnalysis/AnalysisRange.js +3 -1
  7. package/lib/component/1d/peaks/PeakAnnotations.js +20 -25
  8. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +2 -0
  9. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +59 -0
  10. package/lib/component/1d/peaks/PeakEditionManager.d.ts +18 -0
  11. package/lib/component/1d/peaks/PeakEditionManager.js +98 -0
  12. package/lib/component/1d/peaks/Peaks.d.ts +1 -0
  13. package/lib/component/1d/peaks/Peaks.js +22 -0
  14. package/lib/component/1d/ranges/Range.js +3 -1
  15. package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
  16. package/lib/component/1d/tool/BaseLineZones.js +11 -31
  17. package/lib/component/1d/utilities/intersectionResolver.d.ts +25 -0
  18. package/lib/component/1d/utilities/intersectionResolver.js +71 -0
  19. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
  20. package/lib/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
  21. package/lib/component/2d/SlicingView.js +1 -1
  22. package/lib/component/2d/ft/Contours.js +1 -1
  23. package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +5 -1
  24. package/lib/component/EventsTrackers/KeysListenerTracker.js +47 -6
  25. package/lib/component/assignment/index.d.ts +6 -1
  26. package/lib/component/assignment/index.js +5 -1
  27. package/lib/component/context/DispatchContext.d.ts +1 -2
  28. package/lib/component/context/KeyModifierContext.d.ts +13 -0
  29. package/lib/component/context/KeyModifierContext.js +39 -0
  30. package/lib/component/context/PreferencesContext.d.ts +39 -39
  31. package/lib/component/elements/Button.js +2 -0
  32. package/lib/component/elements/Input.js +1 -0
  33. package/lib/component/elements/NumberInput.d.ts +1 -0
  34. package/lib/component/elements/NumberInput.js +10 -3
  35. package/lib/component/elements/Scroller.d.ts +15 -0
  36. package/lib/component/elements/Scroller.js +31 -0
  37. package/lib/component/elements/formik/FormikOnChange.js +1 -1
  38. package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
  39. package/lib/component/header/ApodizationOptionsPanel.js +23 -14
  40. package/lib/component/header/BaseLineCorrectionPanel.js +31 -10
  41. package/lib/component/header/Header.d.ts +10 -3
  42. package/lib/component/header/Header.js +5 -5
  43. package/lib/component/header/ZeroFillingOptionsPanel.js +37 -31
  44. package/lib/component/highlight/index.d.ts +1 -0
  45. package/lib/component/highlight/index.js +1 -0
  46. package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
  47. package/lib/component/hooks/useCheckToolsVisibility.js +7 -3
  48. package/lib/component/hooks/useResizerStatus.d.ts +2 -0
  49. package/lib/component/hooks/useResizerStatus.js +7 -0
  50. package/lib/component/hooks/useSaveSettings.js +9 -11
  51. package/lib/component/hooks/useSpectrum.js +1 -1
  52. package/lib/component/main/ErrorOverlay.js +20 -0
  53. package/lib/component/main/InnerNMRium.d.ts +7 -0
  54. package/lib/component/main/InnerNMRium.js +52 -0
  55. package/lib/component/main/InnerNMRiumContents.d.ts +14 -0
  56. package/lib/component/main/InnerNMRiumContents.js +89 -0
  57. package/lib/component/main/NMRium.d.ts +23 -0
  58. package/lib/component/main/NMRium.js +13 -0
  59. package/lib/component/main/NMRiumStateProvider.d.ts +9 -0
  60. package/lib/component/main/NMRiumStateProvider.js +74 -0
  61. package/lib/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
  62. package/lib/component/main/StateError.d.ts +4 -0
  63. package/lib/component/main/StateError.js +16 -0
  64. package/lib/component/main/index.d.ts +3 -0
  65. package/lib/component/main/index.js +3 -0
  66. package/lib/component/main/types.d.ts +18 -0
  67. package/lib/component/main/types.js +2 -0
  68. package/lib/component/modal/AboutPredictionModal.js +1 -1
  69. package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
  70. package/lib/component/modal/PredictSpectraModal.js +1 -1
  71. package/lib/component/modal/changeSum/ChangeSumModal.d.ts +5 -16
  72. package/lib/component/modal/changeSum/ChangeSumModal.js +6 -115
  73. package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +18 -0
  74. package/lib/component/modal/changeSum/ChangeSumModalContents.js +94 -0
  75. package/lib/component/modal/setting/GeneralSettings.js +2 -2
  76. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
  77. package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
  78. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -11
  79. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
  80. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +3 -9
  81. package/lib/component/panels/MoleculesPanel/Utilities.js +14 -10
  82. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +3 -3
  83. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
  84. package/lib/component/panels/PeaksPanel/PeaksPanel.js +11 -5
  85. package/lib/component/panels/RangesPanel/RangesHeader.js +6 -10
  86. package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +4 -3
  87. package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
  88. package/lib/component/panels/SummaryPanel/SummaryPanel.js +4 -3
  89. package/lib/component/panels/ZonesPanel/ZonesPanel.js +3 -2
  90. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
  91. package/lib/component/panels/databasePanel/DatabasePanel.js +33 -26
  92. package/lib/component/panels/header/DefaultPanelHeader.d.ts +3 -4
  93. package/lib/component/panels/header/DefaultPanelHeader.js +9 -5
  94. package/lib/component/panels/predictionPanel/PredictionPanel.js +1 -1
  95. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
  96. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
  97. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
  98. package/lib/component/reducer/IgnoreActions.js +0 -1
  99. package/lib/component/reducer/Reducer.d.ts +1 -6
  100. package/lib/component/reducer/Reducer.js +32 -6
  101. package/lib/component/reducer/actions/FiltersActions.d.ts +32 -11
  102. package/lib/component/reducer/actions/FiltersActions.js +96 -28
  103. package/lib/component/reducer/actions/IntegralsActions.d.ts +6 -2
  104. package/lib/component/reducer/actions/IntegralsActions.js +44 -20
  105. package/lib/component/reducer/actions/MoleculeActions.d.ts +6 -2
  106. package/lib/component/reducer/actions/MoleculeActions.js +8 -2
  107. package/lib/component/reducer/actions/PeaksActions.d.ts +6 -4
  108. package/lib/component/reducer/actions/PeaksActions.js +19 -1
  109. package/lib/component/reducer/actions/RangesActions.d.ts +6 -2
  110. package/lib/component/reducer/actions/RangesActions.js +31 -3
  111. package/lib/component/reducer/preferences/actions/addWorkspace.js +19 -15
  112. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  113. package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.d.ts +1 -1
  114. package/lib/component/toolbar/FunctionToolBar.js +13 -3
  115. package/lib/component/toolbar/ToolTypes.d.ts +1 -0
  116. package/lib/component/toolbar/ToolTypes.js +36 -0
  117. package/lib/component/utility/PathBuilder.js +11 -0
  118. package/lib/component/utility/export.js +7 -4
  119. package/lib/component/utility/filterType.d.ts +3 -0
  120. package/lib/component/utility/filterType.js +1 -0
  121. package/lib/component/workspaces/basic.js +2 -0
  122. package/lib/component/workspaces/embedded.js +2 -0
  123. package/lib/component/workspaces/exercise.js +2 -0
  124. package/lib/component/workspaces/prediction.js +9 -0
  125. package/lib/component/workspaces/process1D.js +2 -0
  126. package/lib/component/workspaces/workspaceDefaultProperties.js +10 -5
  127. package/lib/data/PredictionManager.d.ts +3 -3
  128. package/lib/data/PredictionManager.js +10 -10
  129. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -2
  130. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +2 -8
  131. package/lib/data/data1d/database.d.ts +4 -2
  132. package/lib/data/data1d/database.js +10 -3
  133. package/lib/data/molecules/Molecule.js +2 -2
  134. package/lib/data/molecules/MoleculeManager.d.ts +1 -0
  135. package/lib/data/molecules/MoleculeManager.js +14 -0
  136. package/lib/data/utilities/checkModifierKeyActivated.d.ts +1 -1
  137. package/lib/data/utilities/checkModifierKeyActivated.js +8 -13
  138. package/lib/versionInfo.js +1 -1
  139. package/lib-cjs/component/1d/ApodizationLine.js +1 -1
  140. package/lib-cjs/component/1d/Chart1D.js +3 -2
  141. package/lib-cjs/component/1d/Line.js +1 -1
  142. package/lib-cjs/component/1d/Viewer1D.js +15 -3
  143. package/lib-cjs/component/1d/integral/IntegralResizable.js +4 -3
  144. package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +3 -1
  145. package/lib-cjs/component/1d/peaks/PeakAnnotations.js +19 -24
  146. package/lib-cjs/component/1d/peaks/PeakAnnotationsSpreadMode.js +64 -0
  147. package/lib-cjs/component/1d/peaks/PeakEditionManager.js +129 -0
  148. package/lib-cjs/component/1d/peaks/Peaks.js +29 -0
  149. package/lib-cjs/component/1d/ranges/Range.js +3 -1
  150. package/lib-cjs/component/1d/tool/BaseLineZones.js +11 -34
  151. package/lib-cjs/component/1d/utilities/intersectionResolver.js +75 -0
  152. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
  153. package/lib-cjs/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
  154. package/lib-cjs/component/2d/SlicingView.js +1 -1
  155. package/lib-cjs/component/2d/ft/Contours.js +1 -1
  156. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +46 -5
  157. package/lib-cjs/component/assignment/index.js +5 -1
  158. package/lib-cjs/component/context/KeyModifierContext.js +44 -0
  159. package/lib-cjs/component/elements/Button.js +2 -0
  160. package/lib-cjs/component/elements/Input.js +1 -0
  161. package/lib-cjs/component/elements/NumberInput.js +12 -2
  162. package/lib-cjs/component/elements/Scroller.js +35 -0
  163. package/lib-cjs/component/elements/formik/FormikOnChange.js +1 -1
  164. package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
  165. package/lib-cjs/component/header/ApodizationOptionsPanel.js +23 -14
  166. package/lib-cjs/component/header/BaseLineCorrectionPanel.js +30 -9
  167. package/lib-cjs/component/header/Header.js +5 -5
  168. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +35 -29
  169. package/lib-cjs/component/highlight/index.js +1 -0
  170. package/lib-cjs/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
  171. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +7 -3
  172. package/lib-cjs/component/hooks/useResizerStatus.js +11 -0
  173. package/lib-cjs/component/hooks/useSaveSettings.js +9 -11
  174. package/lib-cjs/component/hooks/useSpectrum.js +1 -1
  175. package/lib-cjs/component/main/ErrorOverlay.js +26 -0
  176. package/lib-cjs/component/main/InnerNMRium.js +82 -0
  177. package/lib-cjs/component/main/InnerNMRiumContents.js +96 -0
  178. package/lib-cjs/component/main/NMRium.js +19 -0
  179. package/lib-cjs/component/main/NMRiumStateProvider.js +80 -0
  180. package/lib-cjs/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
  181. package/lib-cjs/component/main/StateError.js +20 -0
  182. package/lib-cjs/component/main/index.js +21 -0
  183. package/lib-cjs/component/main/types.js +3 -0
  184. package/lib-cjs/component/modal/AboutPredictionModal.js +1 -1
  185. package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +1 -1
  186. package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
  187. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +6 -141
  188. package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +124 -0
  189. package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -2
  190. package/lib-cjs/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
  191. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +29 -11
  192. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
  193. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +14 -10
  194. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
  195. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +32 -3
  196. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +29 -10
  197. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPreferences.js +3 -2
  198. package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
  199. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +27 -3
  200. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +26 -2
  201. package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
  202. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +33 -26
  203. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +11 -5
  204. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +1 -1
  205. package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
  206. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
  207. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
  208. package/lib-cjs/component/reducer/IgnoreActions.js +0 -1
  209. package/lib-cjs/component/reducer/Reducer.js +31 -5
  210. package/lib-cjs/component/reducer/actions/FiltersActions.js +98 -28
  211. package/lib-cjs/component/reducer/actions/IntegralsActions.js +45 -20
  212. package/lib-cjs/component/reducer/actions/MoleculeActions.js +9 -2
  213. package/lib-cjs/component/reducer/actions/PeaksActions.js +20 -1
  214. package/lib-cjs/component/reducer/actions/RangesActions.js +31 -2
  215. package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +19 -15
  216. package/lib-cjs/component/toolbar/FunctionToolBar.js +13 -3
  217. package/lib-cjs/component/toolbar/ToolTypes.js +36 -0
  218. package/lib-cjs/component/utility/PathBuilder.js +11 -0
  219. package/lib-cjs/component/utility/export.js +7 -4
  220. package/lib-cjs/component/utility/filterType.js +2 -0
  221. package/lib-cjs/component/workspaces/basic.js +2 -0
  222. package/lib-cjs/component/workspaces/embedded.js +2 -0
  223. package/lib-cjs/component/workspaces/exercise.js +2 -0
  224. package/lib-cjs/component/workspaces/prediction.js +9 -0
  225. package/lib-cjs/component/workspaces/process1D.js +2 -0
  226. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +10 -5
  227. package/lib-cjs/data/PredictionManager.js +9 -9
  228. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +1 -7
  229. package/lib-cjs/data/data1d/database.js +10 -3
  230. package/lib-cjs/data/molecules/Molecule.js +2 -2
  231. package/lib-cjs/data/molecules/MoleculeManager.js +16 -1
  232. package/lib-cjs/data/utilities/checkModifierKeyActivated.js +8 -13
  233. package/lib-cjs/versionInfo.js +1 -1
  234. package/package.json +26 -25
  235. package/lib/component/1d/peaks/PeakAnnotation.d.ts +0 -12
  236. package/lib/component/1d/peaks/PeakAnnotation.js +0 -116
  237. package/lib/component/ErrorOverlay.js +0 -27
  238. package/lib/component/NMRium.d.ts +0 -42
  239. package/lib/component/NMRium.js +0 -237
  240. package/lib/component/reducer/actions/GlobalActions.d.ts +0 -9
  241. package/lib/component/reducer/actions/GlobalActions.js +0 -4
  242. package/lib-cjs/component/1d/peaks/PeakAnnotation.js +0 -118
  243. package/lib-cjs/component/ErrorOverlay.js +0 -30
  244. package/lib-cjs/component/NMRium.js +0 -267
  245. package/lib-cjs/component/reducer/actions/GlobalActions.js +0 -7
  246. /package/lib/component/{ErrorOverlay.d.ts → main/ErrorOverlay.d.ts} +0 -0
  247. /package/lib/component/{SplitPaneWrapper.d.ts → main/SplitPaneWrapper.d.ts} +0 -0
@@ -1,16 +1,18 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Filters } from 'nmr-processing';
3
- import { useEffect, useState, memo } from 'react';
4
- import { Checkbox } from 'react-science/ui';
3
+ import { memo, useRef } from 'react';
5
4
  import generateNumbersPowerOfX from '../../data/utilities/generateNumbersPowerOfX';
6
5
  import { useDispatch } from '../context/DispatchContext';
7
6
  import ActionButtons from '../elements/ActionButtons';
8
7
  import Label from '../elements/Label';
9
- import Select from '../elements/Select';
10
8
  import { useFilter } from '../hooks/useFilter';
11
9
  import useSpectrum from '../hooks/useSpectrum';
12
10
  import { headerLabelStyle } from './Header';
13
11
  import { HeaderContainer } from './HeaderContainer';
12
+ import { Formik } from 'formik';
13
+ import FormikSelect from '../elements/formik/FormikSelect';
14
+ import FormikCheckBox from '../elements/formik/FormikCheckBox';
15
+ import FormikOnChange from '../elements/formik/FormikOnChange';
14
16
  const Sizes = generateNumbersPowerOfX(8, 21);
15
17
  function useInitZeroFillingSize() {
16
18
  const filter = useFilter(Filters.zeroFilling.id);
@@ -24,40 +26,44 @@ function useInitZeroFillingSize() {
24
26
  return 0;
25
27
  }
26
28
  function ZeroFillingOptionsInnerPanel(props) {
29
+ const { size } = props;
27
30
  const dispatch = useDispatch();
28
- const [livePreview, setLivePreview] = useState(true);
29
- const [size, setSize] = useState(props.size);
30
- function handleApplyFilter() {
31
- dispatch({
32
- type: 'APPLY_ZERO_FILLING_FILTER',
33
- payload: {
34
- nbPoints: size,
35
- },
36
- });
31
+ const previousPreviewRef = useRef(true);
32
+ function handleApplyFilter(values, triggerSource = 'apply') {
33
+ const { livePreview, ...options } = values;
34
+ switch (triggerSource) {
35
+ case 'onChange': {
36
+ if (livePreview || previousPreviewRef !== livePreview) {
37
+ dispatch({
38
+ type: 'CALCULATE_ZERO_FILLING_FILTER',
39
+ payload: {
40
+ options,
41
+ livePreview,
42
+ },
43
+ });
44
+ }
45
+ break;
46
+ }
47
+ case 'apply': {
48
+ dispatch({
49
+ type: 'APPLY_ZERO_FILLING_FILTER',
50
+ payload: {
51
+ options,
52
+ },
53
+ });
54
+ break;
55
+ }
56
+ default:
57
+ break;
58
+ }
59
+ previousPreviewRef.current = livePreview;
37
60
  }
38
61
  function handleCancelFilter() {
39
62
  dispatch({
40
63
  type: 'RESET_SELECTED_TOOL',
41
64
  });
42
65
  }
43
- function dispatchLiveChanges(nbPoints) {
44
- dispatch({
45
- type: 'CALCULATE_ZERO_FILLING_FILTER',
46
- payload: {
47
- nbPoints,
48
- },
49
- });
50
- }
51
- function handleChangeSizeHandler(value) {
52
- setSize(value);
53
- }
54
- useEffect(() => {
55
- if (livePreview && size) {
56
- dispatchLiveChanges(size);
57
- }
58
- // eslint-disable-next-line react-hooks/exhaustive-deps
59
- }, [size, livePreview]);
60
- return (_jsxs(HeaderContainer, { children: [_jsx(Label, { title: "Size: ", style: headerLabelStyle, children: _jsx(Select, { items: Sizes, style: { marginLeft: 10, marginRight: 10 }, value: size, onChange: handleChangeSizeHandler }) }), _jsx(Checkbox, { label: "Live preview", checked: livePreview, onChange: setLivePreview }), _jsx(ActionButtons, { onDone: handleApplyFilter, onCancel: handleCancelFilter })] }));
66
+ return (_jsx(HeaderContainer, { children: _jsx(Formik, { onSubmit: (values) => handleApplyFilter(values), initialValues: { nbPoints: size, livePreview: true }, children: ({ submitForm }) => (_jsxs(_Fragment, { children: [_jsx(Label, { title: "Size: ", style: headerLabelStyle, children: _jsx(FormikSelect, { items: Sizes, style: { marginLeft: 10, marginRight: 10 }, name: "nbPoints" }) }), _jsx(Label, { title: "Live preview ", htmlFor: "livePreview", style: { label: { padding: '0 5px' } }, children: _jsx(FormikCheckBox, { name: "livePreview" }) }), _jsx(FormikOnChange, { onChange: (values) => handleApplyFilter(values, 'onChange'), enableOnload: true }), _jsx(ActionButtons, { onDone: submitForm, onCancel: handleCancelFilter })] })) }) }));
61
67
  }
62
68
  const MemoizedZeroFillingOptionsPanel = memo(ZeroFillingOptionsInnerPanel);
63
69
  export default function ZeroFillingOptionsPanel() {
@@ -7,6 +7,7 @@ export declare enum HighlightEventSource {
7
7
  SIGNAL = "SIGNAL",
8
8
  RANGE = "RANGE",
9
9
  ZONE = "ZONE",
10
+ BASELINE_ZONE = "BASELINE_ZONE",
10
11
  EXCLUSION_ZONE = "EXCLUSION_ZONE",
11
12
  MATRIX_GENERATION_EXCLUSION_ZONE = "MATRIX_GENERATION_EXCLUSION_ZONE",
12
13
  MULTIPLE_ANALYSIS_ZONE = "MULTIPLE_ANALYSIS_ZONE",
@@ -7,6 +7,7 @@ export var HighlightEventSource;
7
7
  HighlightEventSource["SIGNAL"] = "SIGNAL";
8
8
  HighlightEventSource["RANGE"] = "RANGE";
9
9
  HighlightEventSource["ZONE"] = "ZONE";
10
+ HighlightEventSource["BASELINE_ZONE"] = "BASELINE_ZONE";
10
11
  HighlightEventSource["EXCLUSION_ZONE"] = "EXCLUSION_ZONE";
11
12
  HighlightEventSource["MATRIX_GENERATION_EXCLUSION_ZONE"] = "MATRIX_GENERATION_EXCLUSION_ZONE";
12
13
  HighlightEventSource["MULTIPLE_ANALYSIS_ZONE"] = "MULTIPLE_ANALYSIS_ZONE";
@@ -4,6 +4,7 @@ export const defaultPeaksViewState = {
4
4
  isPeaksVisible: true,
5
5
  showPeaksShapes: false,
6
6
  showPeaksSum: false,
7
+ displayingMode: 'spread',
7
8
  };
8
9
  export function useActiveSpectrumPeaksViewState() {
9
10
  const activeSpectrum = useActiveSpectrum();
@@ -3,24 +3,28 @@ import { useCallback } from 'react';
3
3
  import { useChartData } from '../context/ChartContext';
4
4
  import { usePreferences } from '../context/PreferencesContext';
5
5
  import { options } from '../toolbar/ToolTypes';
6
+ import useCheckExperimentalFeature from './useCheckExperimentalFeature';
6
7
  import useSpectrum from './useSpectrum';
7
8
  export function useCheckToolsVisibility() {
8
9
  const { displayerMode } = useChartData();
9
10
  const preferences = usePreferences();
10
11
  const spectrum = useSpectrum(null);
12
+ const isExperimentalFeatureActivated = useCheckExperimentalFeature();
11
13
  return useCallback((toolKey, checkOptions = {}) => {
12
14
  const { checkMode = true, checkSpectrumType = true, extraInfoCheckParameters, } = checkOptions;
15
+ const { spectraOptions, mode, isExperimental } = options[toolKey];
13
16
  const flag = lodashGet(preferences.current, `display.toolBarButtons.${toolKey}`, false);
14
- const { spectraOptions, mode } = options[toolKey];
15
17
  const modeFlag = !checkMode || (checkMode && (!mode || displayerMode === mode));
16
18
  const spectrumCheckFlag = !checkSpectrumType ||
17
19
  (checkSpectrumType && checkSpectrum(spectrum, spectraOptions));
18
- return (flag &&
20
+ const isToolActivated = (flag && !isExperimental) ||
21
+ (isExperimental && isExperimentalFeatureActivated);
22
+ return (isToolActivated &&
19
23
  modeFlag &&
20
24
  spectrumCheckFlag &&
21
25
  (!extraInfoCheckParameters ||
22
26
  checkInfo(extraInfoCheckParameters, spectrum?.info)));
23
- }, [displayerMode, preferences, spectrum]);
27
+ }, [displayerMode, isExperimentalFeatureActivated, preferences, spectrum]);
24
28
  }
25
29
  function checkSpectrum(spectrum, options) {
26
30
  let outerConditionResult = false;
@@ -0,0 +1,2 @@
1
+ import { NMRiumToolBarPreferences } from 'nmr-load-save';
2
+ export declare function useResizerStatus(toolKey: keyof NMRiumToolBarPreferences): boolean;
@@ -0,0 +1,7 @@
1
+ import { useChartData } from '../context/ChartContext';
2
+ import { useKeyModifiers } from '../context/KeyModifierContext';
3
+ export function useResizerStatus(toolKey) {
4
+ const { toolOptions: { selectedTool }, } = useChartData();
5
+ const { shiftKey } = useKeyModifiers();
6
+ return !shiftKey && selectedTool === toolKey;
7
+ }
@@ -27,17 +27,15 @@ export function useSaveSettings() {
27
27
  const { dispatch, current } = usePreferences();
28
28
  const formRef = useRef(null);
29
29
  function addNewWorkspace({ workspaceName }) {
30
- if (settingsRef.current) {
31
- dispatch({
32
- type: 'ADD_WORKSPACE',
33
- payload: {
34
- workspaceKey: workspaceName,
35
- data: settingsRef.current,
36
- },
37
- });
38
- closeDialog();
39
- alert.success('Preferences saved successfully');
40
- }
30
+ dispatch({
31
+ type: 'ADD_WORKSPACE',
32
+ payload: {
33
+ workspaceKey: workspaceName,
34
+ data: settingsRef.current,
35
+ },
36
+ });
37
+ closeDialog();
38
+ alert.success('Preferences saved successfully');
41
39
  }
42
40
  return {
43
41
  saveSettings: (values) => {
@@ -5,7 +5,7 @@ export default function useSpectrum(defaultValue = null) {
5
5
  const { data } = useChartData();
6
6
  const activeSpectrum = useActiveSpectrum();
7
7
  return useMemo(() => {
8
- if (data && activeSpectrum && activeSpectrum.id) {
8
+ if (data && activeSpectrum?.id) {
9
9
  const datum = data.find((datum) => datum.id === activeSpectrum.id) || defaultValue;
10
10
  return datum;
11
11
  }
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styled from '@emotion/styled';
3
+ const WrongP = styled.p `
4
+ background-color: white;
5
+ padding: 20px;
6
+ border-radius: 10px;
7
+ font-size: 30px;
8
+ text-align: center;
9
+ `;
10
+ const Details = styled.details `
11
+ margin-top: 10px;
12
+ white-space: pre-wrap;
13
+ background-color: white;
14
+ padding: 20px;
15
+ border-radius: 10px;
16
+ color: red;
17
+ `;
18
+ export default function ErrorOverlay(props) {
19
+ return (_jsxs("div", { style: { margin: 25 }, children: [_jsx(WrongP, { children: "Something went wrong." }), _jsxs(Details, { children: [_jsx("p", { style: { textDecoration: 'underline' }, children: props.error.message }), props.error.stack] })] }));
20
+ }
@@ -0,0 +1,7 @@
1
+ import { ForwardedRef } from 'react';
2
+ import type { NMRiumProps, NMRiumRef } from './NMRium';
3
+ type InnerNMRiumProps = Omit<NMRiumProps, 'onError'> & {
4
+ innerRef: ForwardedRef<NMRiumRef>;
5
+ };
6
+ export declare function InnerNMRium({ data: nmriumData, workspace, customWorkspaces, preferences, getSpinner, onChange, emptyText, innerRef, }: InnerNMRiumProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useReducer, useRef, useImperativeHandle, } from 'react';
3
+ import { useOnOff } from 'react-science/ui';
4
+ import { useFullscreen } from 'react-use';
5
+ import { AssignmentProvider } from '../assignment';
6
+ import { GlobalProvider } from '../context/GlobalContext';
7
+ import { KeyModifiersProvider } from '../context/KeyModifierContext';
8
+ import { LoggerProvider } from '../context/LoggerContext';
9
+ import { PreferencesProvider } from '../context/PreferencesContext';
10
+ import { AlertProvider } from '../elements/popup/Alert';
11
+ import { ModalProvider } from '../elements/popup/Modal';
12
+ import { HighlightProvider } from '../highlight';
13
+ import { defaultGetSpinner, SpinnerProvider } from '../loader/SpinnerContext';
14
+ import preferencesReducer, { preferencesInitialState, initPreferencesState, } from '../reducer/preferences/preferencesReducer';
15
+ import { getBlob } from '../utility/export';
16
+ import { InnerNMRiumContents } from './InnerNMRiumContents';
17
+ import NMRiumStateProvider from './NMRiumStateProvider';
18
+ export function InnerNMRium({ data: nmriumData, workspace, customWorkspaces, preferences, getSpinner = defaultGetSpinner, onChange, emptyText, innerRef, }) {
19
+ const rootRef = useRef(null);
20
+ const elementsWrapperRef = useRef(null);
21
+ const viewerRef = useRef(null);
22
+ const [enableFullscreen, , disableFullscreen, toggleFullscreen] = useOnOff(false);
23
+ const mainDivRef = useRef(null);
24
+ const isFullscreenEnabled = useFullscreen(rootRef, enableFullscreen, {
25
+ onClose: disableFullscreen,
26
+ });
27
+ const [preferencesState, dispatchPreferences] = useReducer(preferencesReducer, preferencesInitialState, initPreferencesState);
28
+ useEffect(() => {
29
+ rootRef.current?.focus();
30
+ }, [isFullscreenEnabled]);
31
+ useEffect(() => {
32
+ dispatchPreferences({
33
+ type: 'INIT_PREFERENCES',
34
+ payload: {
35
+ preferences,
36
+ workspace,
37
+ customWorkspaces,
38
+ dispatch: dispatchPreferences,
39
+ },
40
+ });
41
+ }, [customWorkspaces, preferences, workspace]);
42
+ useImperativeHandle(innerRef, () => ({
43
+ getSpectraViewerAsBlob: () => {
44
+ return rootRef?.current ? getBlob(rootRef.current, 'nmrSVG') : null;
45
+ },
46
+ }), []);
47
+ return (_jsx("div", { ref: mainDivRef, style: { height: '100%', position: 'relative' }, children: _jsx(GlobalProvider, { value: {
48
+ rootRef: rootRef.current,
49
+ elementsWrapperRef: elementsWrapperRef.current,
50
+ viewerRef: viewerRef.current,
51
+ }, children: _jsx(PreferencesProvider, { value: preferencesState, children: _jsx(LoggerProvider, { children: _jsx(KeyModifiersProvider, { children: _jsx(AlertProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(NMRiumStateProvider, { onChange: onChange, nmriumData: nmriumData, children: _jsx(ModalProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(HighlightProvider, { children: _jsx(AssignmentProvider, { children: _jsx(SpinnerProvider, { value: getSpinner, children: _jsx(InnerNMRiumContents, { isFullscreenEnabled: isFullscreenEnabled, toggleFullscreen: toggleFullscreen, emptyText: emptyText, mainDivRef: mainDivRef, elementsWrapperRef: elementsWrapperRef, rootRef: rootRef, viewerRef: viewerRef }) }) }) }) }) }) }) }) }) }) }) }));
52
+ }
@@ -0,0 +1,14 @@
1
+ /** @jsxImportSource @emotion/react */
2
+ import { RefObject } from 'react';
3
+ import { NMRiumProps } from '.';
4
+ interface InnerNMRiumContentsProps {
5
+ isFullscreenEnabled: boolean;
6
+ toggleFullscreen: () => void;
7
+ emptyText: NMRiumProps['emptyText'];
8
+ mainDivRef: RefObject<HTMLDivElement>;
9
+ elementsWrapperRef: RefObject<HTMLDivElement>;
10
+ rootRef: RefObject<HTMLDivElement>;
11
+ viewerRef: RefObject<HTMLDivElement>;
12
+ }
13
+ export declare function InnerNMRiumContents(props: InnerNMRiumContentsProps): import("@emotion/react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,89 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
2
+ /** @jsxImportSource @emotion/react */
3
+ import { css } from '@emotion/react';
4
+ import { useCallback } from 'react';
5
+ import checkModifierKeyActivated from '../../data/utilities/checkModifierKeyActivated';
6
+ import Viewer1D from '../1d/Viewer1D';
7
+ import FloatMoleculeStructures from '../1d-2d/components/FloatMoleculeStructures';
8
+ import Viewer2D from '../2d/Viewer2D';
9
+ import KeysListenerTracker from '../EventsTrackers/KeysListenerTracker';
10
+ import { useChartData } from '../context/ChartContext';
11
+ import Header from '../header/Header';
12
+ import DropZone from '../loader/DropZone';
13
+ import Panels from '../panels/Panels';
14
+ import { DISPLAYER_MODE } from '../reducer/core/Constants';
15
+ import ToolBar from '../toolbar/ToolBar';
16
+ import { SplitPaneWrapper } from './SplitPaneWrapper';
17
+ import { StateError } from './StateError';
18
+ const viewerContainerStyle = css `
19
+ border: 0.55px #e6e6e6 solid;
20
+ display: flex;
21
+ flex: 1;
22
+ flex-direction: column;
23
+ height: 100%;
24
+ margin-left: -1px;
25
+ `;
26
+ const containerStyles = css `
27
+ background-color: white;
28
+ width: 100%;
29
+ display: block;
30
+ height: 100%;
31
+
32
+ div:focus {
33
+ outline: none !important;
34
+ }
35
+
36
+ button {
37
+ cursor: pointer;
38
+ }
39
+
40
+ button,
41
+ button:active,
42
+ button:hover,
43
+ button:focus,
44
+ [type='button']:focus {
45
+ outline: none !important;
46
+ }
47
+
48
+ button:disabled {
49
+ cursor: default;
50
+ }
51
+
52
+ * {
53
+ -webkit-user-drag: none;
54
+ -moz-user-drag: none;
55
+ -o-user-drag: none;
56
+ user-select: none;
57
+ }
58
+ `;
59
+ export function InnerNMRiumContents(props) {
60
+ const { isFullscreenEnabled, toggleFullscreen, emptyText, mainDivRef, elementsWrapperRef, rootRef, viewerRef, } = props;
61
+ const { displayerMode } = useChartData();
62
+ const preventContextMenuHandler = useCallback((e) => {
63
+ if (!checkModifierKeyActivated(e)) {
64
+ e.preventDefault();
65
+ }
66
+ }, []);
67
+ return (_jsxs(_Fragment, { children: [_jsx(StateError, {}), _jsx("div", { className: "nmrium-container", ref: rootRef, css: containerStyles, onContextMenu: preventContextMenuHandler, style: { height: '100%', width: '100%' }, children: _jsx(DropZone, { children: _jsxs("div", { style: {
68
+ display: 'flex',
69
+ flexDirection: 'column',
70
+ backgroundColor: 'white',
71
+ width: '100%',
72
+ }, children: [_jsx(Header, { isFullscreenEnabled: isFullscreenEnabled, onEnableFullscreen: toggleFullscreen }), _jsxs("div", { style: {
73
+ display: 'flex',
74
+ flexDirection: 'row',
75
+ height: '100%',
76
+ }, children: [_jsx(ToolBar, {}), _jsxs(SplitPaneWrapper, { children: [_jsxs("div", { css: viewerContainerStyle, children: [_jsx(KeysListenerTracker, { mainDivRef: mainDivRef }), _jsxs("div", { id: "nmrium-viewer", "data-testid": "viewer", ref: viewerRef, style: {
77
+ width: '100%',
78
+ height: '100%',
79
+ position: 'relative',
80
+ }, children: [_jsx(FloatMoleculeStructures, {}), displayerMode === DISPLAYER_MODE.DM_1D ? (_jsx(Viewer1D, { emptyText: emptyText })) : (_jsx(Viewer2D, { emptyText: emptyText }))] })] }), _jsx(Panels, {})] }), _jsx("div", { ref: elementsWrapperRef, id: "main-wrapper", style: {
81
+ position: 'absolute',
82
+ pointerEvents: 'none',
83
+ zIndex: 2,
84
+ left: 0,
85
+ right: 0,
86
+ top: 0,
87
+ bottom: 0,
88
+ } }, String(isFullscreenEnabled))] })] }) }) })] }));
89
+ }
@@ -0,0 +1,23 @@
1
+ import type { CustomWorkspaces, WorkspacePreferences as NMRiumPreferences } from 'nmr-load-save';
2
+ import { ReactElement, ReactNode } from 'react';
3
+ import { ErrorBoundaryPropsWithComponent } from 'react-error-boundary';
4
+ import { BlobObject } from '../utility/export';
5
+ import { NMRiumChangeCb, NMRiumData, NMRiumWorkspace } from './types';
6
+ export interface NMRiumProps {
7
+ data?: NMRiumData;
8
+ onChange?: NMRiumChangeCb;
9
+ noErrorBoundary?: boolean;
10
+ onError?: ErrorBoundaryPropsWithComponent['onError'];
11
+ workspace?: NMRiumWorkspace;
12
+ customWorkspaces?: CustomWorkspaces;
13
+ preferences?: NMRiumPreferences;
14
+ emptyText?: ReactNode;
15
+ /**
16
+ * Returns a custom spinner that will be rendered while loading data.
17
+ */
18
+ getSpinner?: () => ReactElement;
19
+ }
20
+ export interface NMRiumRef {
21
+ getSpectraViewerAsBlob: () => BlobObject | null;
22
+ }
23
+ export declare const NMRium: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<NMRiumProps & import("react").RefAttributes<NMRiumRef>>>;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo, forwardRef } from 'react';
3
+ import { ErrorBoundary, } from 'react-error-boundary';
4
+ import { RootLayout } from 'react-science/ui';
5
+ import ErrorOverlay from './ErrorOverlay';
6
+ import { InnerNMRium } from './InnerNMRium';
7
+ const NMRiumBase = forwardRef(function NMRium(props, ref) {
8
+ const { noErrorBoundary = false, onError, ...otherProps } = props;
9
+ const innerNmrium = _jsx(InnerNMRium, { ...otherProps, innerRef: ref });
10
+ const children = noErrorBoundary ? (innerNmrium) : (_jsx(ErrorBoundary, { FallbackComponent: ErrorOverlay, onError: onError, children: innerNmrium }));
11
+ return _jsx(RootLayout, { style: { width: '100%' }, children: children });
12
+ });
13
+ export const NMRium = memo(NMRiumBase);
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { NMRiumChangeCb, NMRiumData } from './types';
3
+ interface NMRiumStateProviderProps {
4
+ children: ReactNode;
5
+ onChange: NMRiumChangeCb | undefined;
6
+ nmriumData: NMRiumData | undefined;
7
+ }
8
+ export default function NMRiumStateProvider(props: NMRiumStateProviderProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,74 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { readNMRiumObject } from 'nmr-load-save';
3
+ import { useCallback, useEffect, useReducer, useRef } from 'react';
4
+ import { toJSON } from '../../data/SpectraManager';
5
+ import { ChartDataProvider } from '../context/ChartContext';
6
+ import { DispatchProvider } from '../context/DispatchContext';
7
+ import { useLogger } from '../context/LoggerContext';
8
+ import { usePreferences } from '../context/PreferencesContext';
9
+ import checkActionType from '../reducer/IgnoreActions';
10
+ import { spectrumReducer, initialState, initState } from '../reducer/Reducer';
11
+ const defaultData = {
12
+ spectra: [],
13
+ };
14
+ export default function NMRiumStateProvider(props) {
15
+ const { children, onChange, nmriumData = defaultData } = props;
16
+ const { logger } = useLogger();
17
+ const preferencesState = usePreferences();
18
+ const [state, dispatchRaw] = useReducer(spectrumReducer, initialState, initState);
19
+ const dispatch = useCallback((action) => {
20
+ logger.trace({ action }, `Dispatch main reducer action: ${action.type}`);
21
+ dispatchRaw(action);
22
+ }, [logger]);
23
+ const { source, data: spectraData, molecules, correlations, actionType, view, } = state;
24
+ const stateRef = useRef();
25
+ const handleChange = useRef(onChange);
26
+ useEffect(() => {
27
+ handleChange.current = onChange;
28
+ }, [onChange]);
29
+ useEffect(() => {
30
+ const { workspace, workspaces = {} } = preferencesState;
31
+ stateRef.current = toJSON({ data: spectraData, molecules, correlations, source, view, actionType }, { current: workspaces[workspace.current] }, { serialize: false, exportTarget: 'onChange' });
32
+ }, [
33
+ actionType,
34
+ correlations,
35
+ molecules,
36
+ preferencesState,
37
+ source,
38
+ spectraData,
39
+ view,
40
+ ]);
41
+ useEffect(() => {
42
+ // trigger onChange callback if data object changed
43
+ if (checkActionType(actionType)) {
44
+ handleChange.current?.(stateRef.current, 'data');
45
+ }
46
+ }, [actionType, correlations, molecules, source, spectraData]);
47
+ useEffect(() => {
48
+ // trigger onChange callback if view object changed
49
+ handleChange.current?.(stateRef.current, 'view');
50
+ }, [view]);
51
+ useEffect(() => {
52
+ // trigger onChange callback if settings changed
53
+ handleChange.current?.(stateRef.current, 'settings');
54
+ }, [preferencesState]);
55
+ useEffect(() => {
56
+ dispatch({
57
+ type: 'SET_LOADING_FLAG',
58
+ payload: { isLoading: true },
59
+ });
60
+ if (nmriumData) {
61
+ void readNMRiumObject(nmriumData)
62
+ .then((nmriumState) => {
63
+ dispatch({ type: 'INITIATE', payload: { nmriumState } });
64
+ })
65
+ .catch((error) => {
66
+ dispatch({ type: 'SET_LOADING_FLAG', payload: { isLoading: false } });
67
+ // eslint-disable-next-line no-alert
68
+ alert(error.message);
69
+ reportError(error);
70
+ });
71
+ }
72
+ }, [nmriumData, dispatch]);
73
+ return (_jsx(DispatchProvider, { value: dispatch, children: _jsx(ChartDataProvider, { value: state, children: children }) }));
74
+ }
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { SplitPane } from 'react-science/ui';
3
- import { usePreferences } from './context/PreferencesContext';
3
+ import { usePreferences } from '../context/PreferencesContext';
4
4
  export function SplitPaneWrapper({ children }) {
5
5
  const { current, dispatch } = usePreferences();
6
6
  const { general: { verticalSplitterPosition, verticalSplitterCloseThreshold }, display: { general = {} }, } = current;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Alert user in UI when state have errorAction (error from reducer)
3
+ */
4
+ export declare function StateError(): null;
@@ -0,0 +1,16 @@
1
+ import { useEffect } from 'react';
2
+ import { useChartData } from '../context/ChartContext';
3
+ import { useLogger } from '../context/LoggerContext';
4
+ /**
5
+ * Alert user in UI when state have errorAction (error from reducer)
6
+ */
7
+ export function StateError() {
8
+ const { errorAction } = useChartData();
9
+ const { logger } = useLogger();
10
+ useEffect(() => {
11
+ if (!errorAction)
12
+ return;
13
+ logger.error(errorAction);
14
+ }, [errorAction, logger]);
15
+ return null;
16
+ }
@@ -0,0 +1,3 @@
1
+ export * from './types';
2
+ export { serializeNmriumState as serializeNMRiumState } from 'nmr-load-save';
3
+ export * from './NMRium';
@@ -0,0 +1,3 @@
1
+ export * from './types';
2
+ export { serializeNmriumState as serializeNMRiumState } from 'nmr-load-save';
3
+ export * from './NMRium';
@@ -0,0 +1,18 @@
1
+ import { WebSource } from 'filelist-utils';
2
+ import { CorrelationData } from 'nmr-correlation';
3
+ import type { NmriumState as NMRiumState, WorkspacePreferences as NMRiumPreferences, Spectrum } from 'nmr-load-save';
4
+ type DeepPartial<T> = {
5
+ [P in keyof T]?: DeepPartial<T[P]>;
6
+ };
7
+ interface NMRiumData {
8
+ source?: WebSource;
9
+ molecules?: NMRiumMolecules;
10
+ spectra: Array<DeepPartial<Spectrum>>;
11
+ correlations?: CorrelationData;
12
+ }
13
+ type NMRiumWorkspace = 'exercise' | 'process1D' | 'default' | 'prediction' | 'embedded' | 'assignment' | 'simulation' | (string & {});
14
+ type NMRiumChangeCb = (state: NMRiumState, source: 'data' | 'view' | 'settings') => void;
15
+ type NMRiumMolecules = Array<{
16
+ molfile: string;
17
+ }>;
18
+ export type { NMRiumChangeCb, NMRiumData, NMRiumMolecules, NMRiumPreferences, NMRiumState, NMRiumWorkspace, };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ /* eslint-enable unicorn/prefer-export-from */
@@ -44,6 +44,6 @@ const styles = css `
44
44
  `;
45
45
  function AboutPredictionModal() {
46
46
  const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
47
- return (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: openDialog, tooltipOrientation: "horizontal", toolTip: "About Prediction", children: _jsx(FaInfo, {}) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, children: _jsxs("div", { css: styles, children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header", children: _jsx("span", { children: "About Prediction" }) }) }), _jsx(Modal.Body, { children: _jsxs("div", { className: "content", children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsxs("ul", { children: [_jsxs("li", { children: ["Banfi, D.; Patiny, L.", ' ', _jsx("a", { href: "http://dx.doi.org/10.2533/chimia.2008.280", target: "_blank", rel: "noreferrer", children: "www.nmrdb.org: Resurrecting and processing NMR spectra on-line" }), ' ', "Chimia, 2008, 62(4), 280-281."] }), _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist.", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ". Journal of Magnetic Resonance 2011."] })] }), _jsx("p", { children: "1H NMR prediction was possible thanks to the tool of the FCT-Universidade NOVA de Lisboa developed by Yuri Binev and Joao Aires-de-Sousa:" }), _jsxs("ul", { children: [_jsxs("li", { children: ["Y. Binev, M.M. Marques, J. Aires-de-Sousa,", ' ', _jsx("a", { href: "http://dx.doi.org/10.1021/ci700172n", target: "_blank", rel: "noreferrer", children: "Prediction of 1H NMR coupling constants with associative neural networks trained for chemical shifts" }), ' ', "J. Chem. Inf. Model. 2007, 47/(6), 2089-2097."] }), _jsxs("li", { children: ["Aires-de-Sousa, M. Hemmer, J. Gasteiger,", ' ', _jsx("a", { href: "http://dx.doi.org/10.1021/ac010737m", target: "_blank", rel: "noreferrer", children: "\u201C Prediction of 1H NMR Chemical Shifts Using Neural Networks\u201D" }), ", Analytical Chemistry, 2002, 74(1), 80-90."] })] }), _jsx("p", { children: "13 NMR prediction was possible thanks to NMRshiftDB:" }), _jsx("ul", { children: _jsxs("li", { children: ["Steinbeck, Christoph, Stefan Krause, and Stefan Kuhn.", ' ', _jsx("a", { href: "http://dx.doi.org/10.1021/ci0341363", target: "_blank", rel: "noreferrer", children: "NMRShiftDB Constructing a Free Chemical Information System with Open-Source Components." }), ' ', "Journal of chemical information and computer sciences, 2003, 43(6): 1733-1739."] }) })] }) })] }) })] }));
47
+ return (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: openDialog, tooltipOrientation: "horizontal", toolTip: "About Prediction", children: _jsx(FaInfo, {}) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, children: _jsxs("div", { css: styles, children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header", children: _jsx("span", { children: "About Prediction" }) }) }), _jsx(Modal.Body, { children: _jsxs("div", { className: "content", children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsxs("ul", { children: [_jsxs("li", { children: ["Damiano Banfi and Luc Patiny", ' ', _jsx("a", { href: "http://dx.doi.org/10.2533/chimia.2008.280", target: "_blank", rel: "noreferrer", children: "www.nmrdb.org: Resurrecting and processing NMR spectra on-line" }), ' ', _jsx("i", { children: "Chimia" }), ", ", _jsx("b", { children: "2008" }), ", 62(4), 280-281."] }), _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ' ', _jsx("i", { children: "Journal of Magnetic Resonance" }), " ", _jsx("b", { children: "2011" }), ", 209(2), 123-130."] })] }), _jsxs("p", { children: [_jsx("sup", { children: "1" }), "H NMR prediction is possible thanks to the tool of the FCT-Universidade NOVA de Lisboa developed by Yuri Binev and Joao Aires-de-Sousa:"] }), _jsxs("ul", { children: [_jsxs("li", { children: ["Yuri Binev, Maria M. B. Marques and Jo\u00E3o Aires-de-Sousa", ' ', _jsxs("a", { href: "http://dx.doi.org/10.1021/ci700172n", target: "_blank", rel: "noreferrer", children: ["Prediction of ", _jsx("sup", { children: "1" }), "H NMR coupling constants with associative neural networks trained for chemical shifts"] }), ' ', _jsx("i", { children: "J. Chem. Inf. Model." }), " ", _jsx("b", { children: "2007" }), ", 47(6), 2089-2097."] }), _jsxs("li", { children: ["Jo\u00E3o Aires-de-Sousa, Markus C. Hemmer and Johann Gasteiger", ' ', _jsxs("a", { href: "http://dx.doi.org/10.1021/ac010737m", target: "_blank", rel: "noreferrer", children: ["Prediction of ", _jsx("sup", { children: "1" }), "H NMR Chemical Shifts Using Neural Networks"] }), ", ", _jsx("i", { children: "Analytical Chemistry" }), ", ", _jsx("b", { children: "2002" }), ", 74(1), 80-90."] })] }), _jsxs("p", { children: [_jsx("sup", { children: "13" }), "C NMR prediction was possible thanks to NMRshiftDB:"] }), _jsx("ul", { children: _jsxs("li", { children: ["Steinbeck, Christoph, Stefan Krause, and Stefan Kuhn", ' ', _jsx("a", { href: "http://dx.doi.org/10.1021/ci0341363", target: "_blank", rel: "noreferrer", children: "NMRShiftDB Constructing a Free Chemical Information System with Open-Source Components" }), ' ', _jsx("i", { children: "Journal of chemical information and computer sciences" }), ",", ' ', _jsx("b", { children: "2003" }), ", 43(6): 1733-1739."] }) })] }) })] }) })] }));
48
48
  }
49
49
  export default AboutPredictionModal;
@@ -44,6 +44,6 @@ const styles = css `
44
44
  `;
45
45
  function AboutSpectrumSimulationModal() {
46
46
  const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
47
- return (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: openDialog, tooltipOrientation: "horizontal", toolTip: "About Prediction", children: _jsx(FaInfo, {}) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, children: _jsxs("div", { css: styles, children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header", children: _jsx("span", { children: "About spectrum simulation" }) }) }), _jsx(Modal.Body, { children: _jsxs("div", { className: "content", children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsx("ul", { children: _jsxs("li", { children: ["Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems. Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist Journal of Magnetic Resonance 2011.", _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "10.1016/j.jmr.2010.12.008" })] }) })] }) })] }) })] }));
47
+ return (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: openDialog, tooltipOrientation: "horizontal", toolTip: "About Prediction", children: _jsx(FaInfo, {}) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, children: _jsxs("div", { css: styles, children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header", children: _jsx("span", { children: "About spectrum simulation" }) }) }), _jsx(Modal.Body, { children: _jsxs("div", { className: "content", children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsx("ul", { children: _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ' ', _jsx("i", { children: "Journal of Magnetic Resonance" }), " ", _jsx("b", { children: "2011" }), ", 209(2), 123-130."] }) })] }) })] }) })] }));
48
48
  }
49
49
  export default AboutSpectrumSimulationModal;
@@ -74,7 +74,7 @@ export function PredictSpectraModal({ onClose = () => null, molecule, }) {
74
74
  closeDialog();
75
75
  const hideLoading = await alert.showLoading(`Predict ${predictedSpectra.join(',')} in progress`);
76
76
  try {
77
- const data = await predictSpectra(molfile);
77
+ const data = await predictSpectra(molfile, values.spectra);
78
78
  dispatch({
79
79
  type: 'PREDICT_SPECTRA',
80
80
  payload: {