nmrium 0.42.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 (217) 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/2d/SlicingView.js +1 -1
  21. package/lib/component/2d/ft/Contours.js +1 -1
  22. package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +5 -1
  23. package/lib/component/EventsTrackers/KeysListenerTracker.js +47 -6
  24. package/lib/component/assignment/index.d.ts +6 -1
  25. package/lib/component/assignment/index.js +5 -1
  26. package/lib/component/context/DispatchContext.d.ts +1 -2
  27. package/lib/component/context/KeyModifierContext.d.ts +13 -0
  28. package/lib/component/context/KeyModifierContext.js +39 -0
  29. package/lib/component/context/PreferencesContext.d.ts +39 -39
  30. package/lib/component/elements/Button.js +2 -0
  31. package/lib/component/elements/NumberInput.d.ts +1 -0
  32. package/lib/component/elements/NumberInput.js +10 -3
  33. package/lib/component/elements/formik/FormikOnChange.js +1 -1
  34. package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
  35. package/lib/component/header/ApodizationOptionsPanel.js +23 -14
  36. package/lib/component/header/BaseLineCorrectionPanel.js +31 -10
  37. package/lib/component/header/Header.d.ts +10 -3
  38. package/lib/component/header/Header.js +5 -5
  39. package/lib/component/header/ZeroFillingOptionsPanel.js +37 -31
  40. package/lib/component/highlight/index.d.ts +1 -0
  41. package/lib/component/highlight/index.js +1 -0
  42. package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
  43. package/lib/component/hooks/useCheckToolsVisibility.js +7 -3
  44. package/lib/component/hooks/useResizerStatus.d.ts +2 -0
  45. package/lib/component/hooks/useResizerStatus.js +7 -0
  46. package/lib/component/hooks/useSpectrum.js +1 -1
  47. package/lib/component/main/ErrorOverlay.js +20 -0
  48. package/lib/component/main/InnerNMRium.d.ts +7 -0
  49. package/lib/component/main/InnerNMRium.js +52 -0
  50. package/lib/component/main/InnerNMRiumContents.d.ts +14 -0
  51. package/lib/component/main/InnerNMRiumContents.js +89 -0
  52. package/lib/component/main/NMRium.d.ts +23 -0
  53. package/lib/component/main/NMRium.js +13 -0
  54. package/lib/component/main/NMRiumStateProvider.d.ts +9 -0
  55. package/lib/component/main/NMRiumStateProvider.js +74 -0
  56. package/lib/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
  57. package/lib/component/main/StateError.d.ts +4 -0
  58. package/lib/component/main/StateError.js +16 -0
  59. package/lib/component/main/index.d.ts +3 -0
  60. package/lib/component/main/index.js +3 -0
  61. package/lib/component/main/types.d.ts +18 -0
  62. package/lib/component/main/types.js +2 -0
  63. package/lib/component/modal/PredictSpectraModal.js +1 -1
  64. package/lib/component/modal/changeSum/ChangeSumModal.d.ts +5 -16
  65. package/lib/component/modal/changeSum/ChangeSumModal.js +6 -115
  66. package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +18 -0
  67. package/lib/component/modal/changeSum/ChangeSumModalContents.js +94 -0
  68. package/lib/component/modal/setting/GeneralSettings.js +2 -2
  69. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
  70. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -11
  71. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
  72. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +3 -9
  73. package/lib/component/panels/MoleculesPanel/Utilities.js +14 -10
  74. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +3 -3
  75. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
  76. package/lib/component/panels/PeaksPanel/PeaksPanel.js +11 -5
  77. package/lib/component/panels/RangesPanel/RangesHeader.js +6 -10
  78. package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
  79. package/lib/component/panels/SummaryPanel/SummaryPanel.js +4 -3
  80. package/lib/component/panels/ZonesPanel/ZonesPanel.js +3 -2
  81. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
  82. package/lib/component/panels/header/DefaultPanelHeader.d.ts +3 -4
  83. package/lib/component/panels/header/DefaultPanelHeader.js +9 -5
  84. package/lib/component/panels/predictionPanel/PredictionPanel.js +1 -1
  85. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
  86. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
  87. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
  88. package/lib/component/reducer/IgnoreActions.js +0 -1
  89. package/lib/component/reducer/Reducer.d.ts +1 -6
  90. package/lib/component/reducer/Reducer.js +30 -6
  91. package/lib/component/reducer/actions/FiltersActions.d.ts +32 -11
  92. package/lib/component/reducer/actions/FiltersActions.js +96 -28
  93. package/lib/component/reducer/actions/IntegralsActions.d.ts +6 -2
  94. package/lib/component/reducer/actions/IntegralsActions.js +44 -20
  95. package/lib/component/reducer/actions/MoleculeActions.js +1 -1
  96. package/lib/component/reducer/actions/PeaksActions.d.ts +6 -4
  97. package/lib/component/reducer/actions/PeaksActions.js +19 -1
  98. package/lib/component/reducer/actions/RangesActions.d.ts +6 -2
  99. package/lib/component/reducer/actions/RangesActions.js +31 -3
  100. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  101. package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.d.ts +1 -1
  102. package/lib/component/toolbar/FunctionToolBar.js +13 -3
  103. package/lib/component/toolbar/ToolTypes.d.ts +1 -0
  104. package/lib/component/toolbar/ToolTypes.js +36 -0
  105. package/lib/component/utility/export.js +7 -4
  106. package/lib/component/utility/filterType.d.ts +3 -0
  107. package/lib/component/utility/filterType.js +1 -0
  108. package/lib/component/workspaces/basic.js +2 -0
  109. package/lib/component/workspaces/embedded.js +2 -0
  110. package/lib/component/workspaces/exercise.js +2 -0
  111. package/lib/component/workspaces/prediction.js +9 -0
  112. package/lib/component/workspaces/process1D.js +2 -0
  113. package/lib/component/workspaces/workspaceDefaultProperties.js +2 -0
  114. package/lib/data/PredictionManager.d.ts +3 -3
  115. package/lib/data/PredictionManager.js +10 -10
  116. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -2
  117. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +2 -8
  118. package/lib/data/molecules/Molecule.js +2 -2
  119. package/lib/data/utilities/checkModifierKeyActivated.d.ts +1 -1
  120. package/lib/data/utilities/checkModifierKeyActivated.js +8 -13
  121. package/lib/versionInfo.js +1 -1
  122. package/lib-cjs/component/1d/ApodizationLine.js +1 -1
  123. package/lib-cjs/component/1d/Chart1D.js +3 -2
  124. package/lib-cjs/component/1d/Line.js +1 -1
  125. package/lib-cjs/component/1d/Viewer1D.js +15 -3
  126. package/lib-cjs/component/1d/integral/IntegralResizable.js +4 -3
  127. package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +3 -1
  128. package/lib-cjs/component/1d/peaks/PeakAnnotations.js +19 -24
  129. package/lib-cjs/component/1d/peaks/PeakAnnotationsSpreadMode.js +64 -0
  130. package/lib-cjs/component/1d/peaks/PeakEditionManager.js +129 -0
  131. package/lib-cjs/component/1d/peaks/Peaks.js +29 -0
  132. package/lib-cjs/component/1d/ranges/Range.js +3 -1
  133. package/lib-cjs/component/1d/tool/BaseLineZones.js +11 -34
  134. package/lib-cjs/component/1d/utilities/intersectionResolver.js +75 -0
  135. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
  136. package/lib-cjs/component/2d/SlicingView.js +1 -1
  137. package/lib-cjs/component/2d/ft/Contours.js +1 -1
  138. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +46 -5
  139. package/lib-cjs/component/assignment/index.js +5 -1
  140. package/lib-cjs/component/context/KeyModifierContext.js +44 -0
  141. package/lib-cjs/component/elements/Button.js +2 -0
  142. package/lib-cjs/component/elements/NumberInput.js +12 -2
  143. package/lib-cjs/component/elements/formik/FormikOnChange.js +1 -1
  144. package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
  145. package/lib-cjs/component/header/ApodizationOptionsPanel.js +23 -14
  146. package/lib-cjs/component/header/BaseLineCorrectionPanel.js +30 -9
  147. package/lib-cjs/component/header/Header.js +5 -5
  148. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +35 -29
  149. package/lib-cjs/component/highlight/index.js +1 -0
  150. package/lib-cjs/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
  151. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +7 -3
  152. package/lib-cjs/component/hooks/useResizerStatus.js +11 -0
  153. package/lib-cjs/component/hooks/useSpectrum.js +1 -1
  154. package/lib-cjs/component/main/ErrorOverlay.js +26 -0
  155. package/lib-cjs/component/main/InnerNMRium.js +82 -0
  156. package/lib-cjs/component/main/InnerNMRiumContents.js +96 -0
  157. package/lib-cjs/component/main/NMRium.js +19 -0
  158. package/lib-cjs/component/main/NMRiumStateProvider.js +80 -0
  159. package/lib-cjs/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
  160. package/lib-cjs/component/main/StateError.js +20 -0
  161. package/lib-cjs/component/main/index.js +21 -0
  162. package/lib-cjs/component/main/types.js +3 -0
  163. package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
  164. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +6 -141
  165. package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +124 -0
  166. package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -2
  167. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +29 -11
  168. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
  169. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +14 -10
  170. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
  171. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +32 -3
  172. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +29 -10
  173. package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
  174. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +27 -3
  175. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +26 -2
  176. package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
  177. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +11 -5
  178. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +1 -1
  179. package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
  180. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
  181. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
  182. package/lib-cjs/component/reducer/IgnoreActions.js +0 -1
  183. package/lib-cjs/component/reducer/Reducer.js +29 -5
  184. package/lib-cjs/component/reducer/actions/FiltersActions.js +98 -28
  185. package/lib-cjs/component/reducer/actions/IntegralsActions.js +45 -20
  186. package/lib-cjs/component/reducer/actions/MoleculeActions.js +1 -1
  187. package/lib-cjs/component/reducer/actions/PeaksActions.js +20 -1
  188. package/lib-cjs/component/reducer/actions/RangesActions.js +31 -2
  189. package/lib-cjs/component/toolbar/FunctionToolBar.js +13 -3
  190. package/lib-cjs/component/toolbar/ToolTypes.js +36 -0
  191. package/lib-cjs/component/utility/export.js +7 -4
  192. package/lib-cjs/component/utility/filterType.js +2 -0
  193. package/lib-cjs/component/workspaces/basic.js +2 -0
  194. package/lib-cjs/component/workspaces/embedded.js +2 -0
  195. package/lib-cjs/component/workspaces/exercise.js +2 -0
  196. package/lib-cjs/component/workspaces/prediction.js +9 -0
  197. package/lib-cjs/component/workspaces/process1D.js +2 -0
  198. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +2 -0
  199. package/lib-cjs/data/PredictionManager.js +9 -9
  200. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +1 -7
  201. package/lib-cjs/data/molecules/Molecule.js +2 -2
  202. package/lib-cjs/data/utilities/checkModifierKeyActivated.js +8 -13
  203. package/lib-cjs/versionInfo.js +1 -1
  204. package/package.json +26 -25
  205. package/lib/component/1d/peaks/PeakAnnotation.d.ts +0 -12
  206. package/lib/component/1d/peaks/PeakAnnotation.js +0 -116
  207. package/lib/component/ErrorOverlay.js +0 -27
  208. package/lib/component/NMRium.d.ts +0 -42
  209. package/lib/component/NMRium.js +0 -237
  210. package/lib/component/reducer/actions/GlobalActions.d.ts +0 -9
  211. package/lib/component/reducer/actions/GlobalActions.js +0 -4
  212. package/lib-cjs/component/1d/peaks/PeakAnnotation.js +0 -118
  213. package/lib-cjs/component/ErrorOverlay.js +0 -30
  214. package/lib-cjs/component/NMRium.js +0 -267
  215. package/lib-cjs/component/reducer/actions/GlobalActions.js +0 -7
  216. /package/lib/component/{ErrorOverlay.d.ts → main/ErrorOverlay.d.ts} +0 -0
  217. /package/lib/component/{SplitPaneWrapper.d.ts → main/SplitPaneWrapper.d.ts} +0 -0
@@ -5,6 +5,7 @@ import { updateIntegralsRelativeValues, changeIntegralsRelative, getShiftX, } fr
5
5
  import { initSumOptions, setSumOptions, } from '../../../data/data1d/Spectrum1D/SumManager';
6
6
  import { getActiveSpectrum } from '../helper/getActiveSpectrum';
7
7
  import getRange from '../helper/getRange';
8
+ import { getSpectrum } from '../helper/getSpectrum';
8
9
  import { setIntegralsYDomain } from './DomainActions';
9
10
  function handleChangeIntegralSum(draft, action) {
10
11
  const { options } = action.payload;
@@ -17,31 +18,39 @@ function handleChangeIntegralSum(draft, action) {
17
18
  updateIntegralsRelativeValues(datum, true);
18
19
  }
19
20
  }
21
+ function initiateIntergalSumOptions(datum, options) {
22
+ const { molecules, nucleus } = options;
23
+ datum.integrals.options = initSumOptions(datum.integrals.options, {
24
+ molecules,
25
+ nucleus,
26
+ });
27
+ }
28
+ function addIntegral(datum, options) {
29
+ const { from, to } = options;
30
+ const { x, re } = datum.data;
31
+ const shiftX = getShiftX(datum);
32
+ const integration = xyIntegration({ x, y: re }, { from, to, reverse: true });
33
+ const integral = {
34
+ id: v4(),
35
+ originFrom: from - shiftX,
36
+ originTo: to - shiftX,
37
+ from,
38
+ to,
39
+ integral: integration,
40
+ absolute: integration,
41
+ kind: 'signal',
42
+ };
43
+ datum.integrals.values.push(integral);
44
+ }
20
45
  function handleAddIntegral(draft, action) {
21
46
  const { startX, endX } = action.payload;
22
47
  const { data, molecules, view: { spectra: { activeTab: nucleus }, }, } = draft;
23
48
  const activeSpectrum = getActiveSpectrum(draft);
24
- const [from, to] = getRange(draft, { startX, endX });
25
49
  if (activeSpectrum?.id) {
50
+ const [from, to] = getRange(draft, { startX, endX });
26
51
  const datum = data[activeSpectrum.index];
27
- const { x, re } = datum.data;
28
- const shiftX = getShiftX(datum);
29
- const integration = xyIntegration({ x, y: re }, { from, to, reverse: true });
30
- const integral = {
31
- id: v4(),
32
- originFrom: from - shiftX,
33
- originTo: to - shiftX,
34
- from,
35
- to,
36
- integral: integration,
37
- absolute: integration,
38
- kind: 'signal',
39
- };
40
- datum.integrals.values.push(integral);
41
- datum.integrals.options = initSumOptions(datum.integrals.options, {
42
- molecules,
43
- nucleus,
44
- });
52
+ addIntegral(datum, { from, to });
53
+ initiateIntergalSumOptions(datum, { molecules, nucleus });
45
54
  updateIntegralsRelativeValues(datum);
46
55
  setIntegralsYDomain(draft, datum);
47
56
  }
@@ -100,4 +109,19 @@ function handleChangeIntegralsSumFlag(draft) {
100
109
  integralOptions.isSumConstant = !integralOptions.isSumConstant;
101
110
  }
102
111
  }
103
- export { handleChangeIntegralSum, handleAddIntegral, handleDeleteIntegral, handleChangeIntegral, handleChangeIntegralsRelativeValue, handleChangeIntegralsSumFlag, };
112
+ function handleCutIntegral(draft, action) {
113
+ const { cutValue } = action.payload;
114
+ const spectrum = getSpectrum(draft);
115
+ const integrals = spectrum.integrals.values;
116
+ for (let i = 0; i < integrals.length; i++) {
117
+ const { to, from } = integrals[i];
118
+ if (cutValue > from && cutValue < to) {
119
+ integrals.splice(i, 1);
120
+ addIntegral(spectrum, { from, to: cutValue });
121
+ addIntegral(spectrum, { from: cutValue, to });
122
+ }
123
+ }
124
+ updateIntegralsRelativeValues(spectrum);
125
+ setIntegralsYDomain(draft, spectrum);
126
+ }
127
+ export { handleCutIntegral, handleChangeIntegralSum, handleAddIntegral, handleDeleteIntegral, handleChangeIntegral, handleChangeIntegralsRelativeValue, handleChangeIntegralsSumFlag, };
@@ -113,7 +113,7 @@ function checkPredictions(predictedSpectra, inputOptions, molfile, logger) {
113
113
  const { spectra } = inputOptions;
114
114
  const missing2DPrediction = [];
115
115
  const molecule = OCL.Molecule.fromMolfile(molfile);
116
- molecule.addImplicitHydrogens();
116
+ //@ts-expect-error Will be fixed once OCL-utils is typed correctly
117
117
  const { atoms } = getAtoms(molecule);
118
118
  for (const [experiment, required] of Object.entries(spectra)) {
119
119
  if (!required || predictedSpectra[experiment])
@@ -1,6 +1,7 @@
1
1
  import { Draft } from 'immer';
2
+ import { PeaksViewState } from 'nmr-load-save';
2
3
  import { Peak1D, OptionsXYAutoPeaksPicking } from 'nmr-processing';
3
- import { defaultPeaksViewState } from '../../hooks/useActiveSpectrumPeaksViewState';
4
+ import { FilterType } from '../../utility/filterType';
4
5
  import { State } from '../Reducer';
5
6
  import { ActionType } from '../types/ActionType';
6
7
  type AddPeakAction = ActionType<'ADD_PEAK', {
@@ -27,9 +28,9 @@ type ChangePeaksShapeAction = ActionType<'CHANGE_PEAK_SHAPE', {
27
28
  shape: Peak1D['shape'];
28
29
  }>;
29
30
  type TogglePeaksViewAction = ActionType<'TOGGLE_PEAKS_VIEW_PROPERTY', {
30
- key: keyof typeof defaultPeaksViewState;
31
+ key: keyof FilterType<PeaksViewState, boolean>;
31
32
  }>;
32
- export type PeaksActions = AddPeakAction | AddPeaksAction | DeletePeakAction | OptimizePeaksAction | AutoPeaksPickingAction | ChangePeaksShapeAction | TogglePeaksViewAction;
33
+ export type PeaksActions = AddPeakAction | AddPeaksAction | DeletePeakAction | OptimizePeaksAction | AutoPeaksPickingAction | ChangePeaksShapeAction | TogglePeaksViewAction | ActionType<'TOGGLE_PEAKS_DISPLAYING_MODE'>;
33
34
  declare function handleAddPeak(draft: Draft<State>, action: AddPeakAction): void;
34
35
  declare function handleAddPeaks(draft: Draft<State>, action: AddPeaksAction): void;
35
36
  declare function handleDeletePeak(draft: Draft<State>, action: DeletePeakAction): void;
@@ -37,4 +38,5 @@ declare function handleOptimizePeaks(draft: Draft<State>, action: OptimizePeaksA
37
38
  declare function handleAutoPeakPicking(draft: Draft<State>, action: AutoPeaksPickingAction): void;
38
39
  declare function handleChangePeakShape(draft: Draft<State>, action: ChangePeaksShapeAction): void;
39
40
  declare function handleTogglePeaksViewProperty(draft: Draft<State>, action: TogglePeaksViewAction): void;
40
- export { handleAddPeak, handleAddPeaks, handleDeletePeak, handleAutoPeakPicking, handleOptimizePeaks, handleChangePeakShape, handleTogglePeaksViewProperty, };
41
+ declare function handleChangePeaksDisplayingMode(draft: Draft<State>): void;
42
+ export { handleAddPeak, handleAddPeaks, handleDeletePeak, handleAutoPeakPicking, handleOptimizePeaks, handleChangePeakShape, handleTogglePeaksViewProperty, handleChangePeaksDisplayingMode, };
@@ -145,4 +145,22 @@ function togglePeaksViewProperty(draft, key) {
145
145
  }
146
146
  }
147
147
  }
148
- export { handleAddPeak, handleAddPeaks, handleDeletePeak, handleAutoPeakPicking, handleOptimizePeaks, handleChangePeakShape, handleTogglePeaksViewProperty, };
148
+ function handleChangePeaksDisplayingMode(draft) {
149
+ const activeSpectrum = getActiveSpectrum(draft);
150
+ if (activeSpectrum?.id) {
151
+ const peaksView = draft.view.peaks;
152
+ if (peaksView[activeSpectrum.id]) {
153
+ peaksView[activeSpectrum.id].displayingMode =
154
+ peaksView[activeSpectrum.id].displayingMode === 'single'
155
+ ? 'spread'
156
+ : 'single';
157
+ }
158
+ else {
159
+ const defaultPeaksView = { ...defaultPeaksViewState };
160
+ defaultPeaksView.displayingMode =
161
+ defaultPeaksView.displayingMode === 'single' ? 'spread' : 'single';
162
+ peaksView[activeSpectrum.id] = defaultPeaksView;
163
+ }
164
+ }
165
+ }
166
+ export { handleAddPeak, handleAddPeaks, handleDeletePeak, handleAutoPeakPicking, handleOptimizePeaks, handleChangePeakShape, handleTogglePeaksViewProperty, handleChangePeaksDisplayingMode, };
@@ -63,7 +63,10 @@ type UpdateRangAction = ActionType<'UPDATE_RANGE', {
63
63
  type ToggleAction = ActionType<'SHOW_MULTIPLICITY_TREES' | 'SHOW_RANGES_INTEGRALS' | 'SHOW_J_GRAPH', {
64
64
  id: string;
65
65
  }>;
66
- export type RangesActions = AutoRangesDetectionAction | DeleteRangeAction | ChangeRangeSignalKindAction | SaveEditedRangeAction | DeleteSignalAction | UnlinkRangeAction | SetDiaIDRangeAction | ResizeRangeAction | ChangeRangeSumAction | AddRangeAction | ChangeRangeRelativeValueAction | ChangeRangeSignalValueAction | UpdateRangAction | ToggleAction | ActionType<'AUTO_RANGES_SPECTRA_PICKING' | 'CHANGE_RANGES_SUM_FLAG'>;
66
+ type CutRangAction = ActionType<'CUT_RANGE', {
67
+ cutValue: number;
68
+ }>;
69
+ export type RangesActions = AutoRangesDetectionAction | DeleteRangeAction | ChangeRangeSignalKindAction | SaveEditedRangeAction | DeleteSignalAction | UnlinkRangeAction | SetDiaIDRangeAction | ResizeRangeAction | ChangeRangeSumAction | AddRangeAction | ChangeRangeRelativeValueAction | ChangeRangeSignalValueAction | UpdateRangAction | ToggleAction | CutRangAction | ActionType<'AUTO_RANGES_SPECTRA_PICKING' | 'CHANGE_RANGES_SUM_FLAG'>;
67
70
  declare function handleAutoRangesDetection(draft: Draft<State>, action: AutoRangesDetectionAction): void;
68
71
  declare function handleAutoSpectraRangesDetection(draft: Draft<State>): void;
69
72
  declare function handleDeleteRange(draft: Draft<State>, action: DeleteRangeAction): void;
@@ -84,4 +87,5 @@ declare function handleUpdateRange(draft: Draft<State>, action: UpdateRangAction
84
87
  declare function handleShowMultiplicityTrees(draft: Draft<State>, action: ToggleAction): void;
85
88
  declare function handleShowRangesIntegrals(draft: Draft<State>, action: ToggleAction): void;
86
89
  declare function handleShowJGraph(draft: Draft<State>, action: ToggleAction): void;
87
- export { handleAutoRangesDetection, handleDeleteRange, deleteSignal1D, handleDeleteSignal, handleChangeRangeSum, handleAddRange, handleResizeRange, handleChangeRangeRelativeValue, handleChangeRangeSignalValue, handleChangeRangeSignalKind, handleSaveEditedRange, handleUnlinkRange, unlinkRange, handleSetDiaIDRange, handleChangeRangesSumFlag, handleUpdateRange, handleShowMultiplicityTrees, handleShowRangesIntegrals, handleAutoSpectraRangesDetection, handleShowJGraph, };
90
+ declare function handleCutRange(draft: Draft<State>, action: CutRangAction): void;
91
+ export { handleCutRange, handleAutoRangesDetection, handleDeleteRange, deleteSignal1D, handleDeleteSignal, handleChangeRangeSum, handleAddRange, handleResizeRange, handleChangeRangeRelativeValue, handleChangeRangeSignalValue, handleChangeRangeSignalKind, handleSaveEditedRange, handleUnlinkRange, unlinkRange, handleSetDiaIDRange, handleChangeRangesSumFlag, handleUpdateRange, handleShowMultiplicityTrees, handleShowRangesIntegrals, handleAutoSpectraRangesDetection, handleShowJGraph, };
@@ -5,11 +5,12 @@ import { xFindClosestIndex } from 'ml-spectra-processing';
5
5
  import { Filters, FiltersManager } from 'nmr-processing';
6
6
  import { DatumKind, SignalKindsToInclude, } from '../../../data/constants/SignalsKinds';
7
7
  import { addRange, changeRangeSignal, detectRanges, updateRangesRelativeValues, changeRange, changeRangeRelativeValue, } from '../../../data/data1d/Spectrum1D';
8
- import { setSumOptions, } from '../../../data/data1d/Spectrum1D/SumManager';
8
+ import { initSumOptions, setSumOptions, } from '../../../data/data1d/Spectrum1D/SumManager';
9
9
  import { unlink, unlinkInAssignmentData, } from '../../../data/utilities/RangeUtilities';
10
10
  import { rangeStateInit } from '../Reducer';
11
11
  import { getActiveSpectrum } from '../helper/getActiveSpectrum';
12
12
  import getRange from '../helper/getRange';
13
+ import { getSpectrum } from '../helper/getSpectrum';
13
14
  import { handleUpdateCorrelations } from './CorrelationsActions';
14
15
  import { setDomain, setIntegralsYDomain } from './DomainActions';
15
16
  import { resetSelectedTool } from './ToolsActions';
@@ -248,6 +249,13 @@ function handleChangeRangeSum(draft, action) {
248
249
  updateRangesRelativeValues(datum, true);
249
250
  }
250
251
  }
252
+ function initiateRangeSumOptions(datum, options) {
253
+ const { nucleus, molecules } = options;
254
+ datum.ranges.options = initSumOptions(datum.ranges.options, {
255
+ molecules,
256
+ nucleus,
257
+ });
258
+ }
251
259
  //action
252
260
  function handleAddRange(draft, action) {
253
261
  const { startX, endX } = action.payload;
@@ -257,12 +265,16 @@ function handleAddRange(draft, action) {
257
265
  if (activeSpectrum?.id) {
258
266
  const { index } = activeSpectrum;
259
267
  const [from, to] = range;
260
- addRange(data[index], {
268
+ const datum = data[index];
269
+ addRange(datum, {
261
270
  from,
262
271
  to,
272
+ });
273
+ initiateRangeSumOptions(datum, {
263
274
  nucleus,
264
275
  molecules,
265
276
  });
277
+ updateRangesRelativeValues(datum);
266
278
  handleUpdateCorrelations(draft);
267
279
  setIntegralsYDomain(draft, data[index]);
268
280
  }
@@ -358,4 +370,20 @@ function handleShowJGraph(draft, action) {
358
370
  });
359
371
  }
360
372
  }
361
- export { handleAutoRangesDetection, handleDeleteRange, deleteSignal1D, handleDeleteSignal, handleChangeRangeSum, handleAddRange, handleResizeRange, handleChangeRangeRelativeValue, handleChangeRangeSignalValue, handleChangeRangeSignalKind, handleSaveEditedRange, handleUnlinkRange, unlinkRange, handleSetDiaIDRange, handleChangeRangesSumFlag, handleUpdateRange, handleShowMultiplicityTrees, handleShowRangesIntegrals, handleAutoSpectraRangesDetection, handleShowJGraph, };
373
+ function handleCutRange(draft, action) {
374
+ const { cutValue } = action.payload;
375
+ const spectrum = getSpectrum(draft);
376
+ const ranges = spectrum.ranges.values;
377
+ for (let i = 0; i < ranges.length; i++) {
378
+ const { to, from } = ranges[i];
379
+ if (cutValue > from && cutValue < to) {
380
+ ranges.splice(i, 1);
381
+ addRange(spectrum, { from, to: cutValue });
382
+ addRange(spectrum, { from: cutValue, to });
383
+ }
384
+ }
385
+ updateRangesRelativeValues(spectrum);
386
+ setIntegralsYDomain(draft, spectrum);
387
+ handleUpdateCorrelations(draft);
388
+ }
389
+ export { handleCutRange, handleAutoRangesDetection, handleDeleteRange, deleteSignal1D, handleDeleteSignal, handleChangeRangeSum, handleAddRange, handleResizeRange, handleChangeRangeRelativeValue, handleChangeRangeSignalValue, handleChangeRangeSignalKind, handleSaveEditedRange, handleUnlinkRange, unlinkRange, handleSetDiaIDRange, handleChangeRangesSumFlag, handleUpdateRange, handleShowMultiplicityTrees, handleShowRangesIntegrals, handleAutoSpectraRangesDetection, handleShowJGraph, };
@@ -2,7 +2,7 @@ import { MultipleSpectraAnalysisPreferences, Workspace, WorkSpaceSource } from '
2
2
  import { Reducer } from 'react';
3
3
  import { SplitPaneSize } from 'react-science/ui';
4
4
  import { MatrixOptions } from '../../../data/types/data1d/MatrixOptions';
5
- import { NMRiumWorkspace, NMRiumPreferences } from '../../NMRium';
5
+ import type { NMRiumWorkspace, NMRiumPreferences } from '../../main';
6
6
  import { ActionType } from '../types/ActionType';
7
7
  export declare const WORKSPACES_KEYS: {
8
8
  componentKey: string;
@@ -1,3 +1,3 @@
1
1
  import { CustomWorkspaces } from 'nmr-load-save';
2
- import { NMRiumWorkspace } from '../../../NMRium';
2
+ import type { NMRiumWorkspace } from '../../../main';
3
3
  export declare function getPreferencesByWorkspace(workspace: NMRiumWorkspace, originalWorkspaces: CustomWorkspaces): Required<import("nmr-load-save").WorkspacePreferences> & import("nmr-load-save/lib/types/WorkSpace").WorkspaceMeta & import("nmr-load-save").WorkspacePreferences;
@@ -28,11 +28,21 @@ function FunctionToolBarInner({ defaultValue, ftCounter, }) {
28
28
  type: 'APPLY_FFT_FILTER',
29
29
  });
30
30
  }, [dispatch]);
31
- return (_jsxs(_Fragment, { children: [_jsxs(ToggleButtonGroup, { value: option, onChange: handleChange, children: [isButtonVisible('zoom') && (_jsx(ToggleButton, { value: options.zoom.id, id: options.zoom.id, title: `${options.zoom.label} ( Press z )`, children: _jsx(FaSearchPlus, {}) }, options.zoom.id)), isButtonVisible('zoomOut') && (_jsx(Toolbar.Item, { id: "zoom-out", onClick: handleFullZoomOut, title: "Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )", children: _jsx(FaExpand, {}) })), isButtonVisible('peakPicking') && (_jsx(ToggleButton, { value: options.peakPicking.id, title: `${options.peakPicking.label} ( Press p )`, id: options.peakPicking.id, children: _jsx(SvgNmrPeakPicking, {}) }, options.peakPicking.id)), isButtonVisible('integral') && (_jsx(ToggleButton, { value: options.integral.id, id: options.integral.id, title: `${options.integral.label} ( Press i )`, children: _jsx(SvgNmrIntegrate, {}) }, options.integral.id)), isButtonVisible('zonePicking') && (_jsx(ToggleButton, { value: options.zonePicking.id, id: options.zonePicking.id, title: `${options.zonePicking.label} ( Press r )`, children: _jsx(FaDiceFour, {}) }, options.zonePicking.id)), isButtonVisible('slicing') && (_jsx(ToggleButton, { value: options.slicing.id, id: options.slicing.id, title: `${options.slicing.label}`, children: _jsx("p", { children: "Slic" }) }, options.slicing.id)), isButtonVisible('rangePicking') && (_jsx(ToggleButton, { value: options.rangePicking.id, title: `${options.rangePicking.label} ( Press r )`, id: options.rangePicking.id, children: _jsx(SvgNmrRangePicking, {}) }, options.rangePicking.id)), isButtonVisible('multipleSpectraAnalysis', {
31
+ const handleFFtDimension1Filter = useCallback(() => {
32
+ dispatch({
33
+ type: 'APPLY_FFT_DIMENSION_1_FILTER',
34
+ });
35
+ }, [dispatch]);
36
+ const handleFFtDimension2Filter = useCallback(() => {
37
+ dispatch({
38
+ type: 'APPLY_FFT_DIMENSION_2_FILTER',
39
+ });
40
+ }, [dispatch]);
41
+ return (_jsxs(_Fragment, { children: [_jsxs(ToggleButtonGroup, { value: option, onChange: handleChange, children: [isButtonVisible('zoom') && (_jsx(ToggleButton, { value: options.zoom.id, id: options.zoom.id, title: `${options.zoom.label}`, children: _jsx(FaSearchPlus, {}) }, options.zoom.id)), isButtonVisible('zoomOut') && (_jsx(Toolbar.Item, { id: "zoom-out", onClick: handleFullZoomOut, title: "Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )", children: _jsx(FaExpand, {}) })), isButtonVisible('peakPicking') && (_jsx(ToggleButton, { value: options.peakPicking.id, title: `${options.peakPicking.label} ( Press p )`, id: options.peakPicking.id, children: _jsx(SvgNmrPeakPicking, {}) }, options.peakPicking.id)), isButtonVisible('integral') && (_jsx(ToggleButton, { value: options.integral.id, id: options.integral.id, title: `${options.integral.label} ( Press i )`, children: _jsx(SvgNmrIntegrate, {}) }, options.integral.id)), isButtonVisible('zonePicking') && (_jsx(ToggleButton, { value: options.zonePicking.id, id: options.zonePicking.id, title: `${options.zonePicking.label} ( Press r )`, children: _jsx(FaDiceFour, {}) }, options.zonePicking.id)), isButtonVisible('slicing') && (_jsx(ToggleButton, { value: options.slicing.id, id: options.slicing.id, title: `${options.slicing.label}`, children: _jsx("p", { children: "Slic" }) }, options.slicing.id)), isButtonVisible('rangePicking') && (_jsx(ToggleButton, { value: options.rangePicking.id, title: `${options.rangePicking.label} ( Press r )`, id: options.rangePicking.id, children: _jsx(SvgNmrRangePicking, {}) }, options.rangePicking.id)), isButtonVisible('multipleSpectraAnalysis', {
32
42
  checkSpectrumType: false,
33
43
  }) &&
34
- ftCounter > 1 && (_jsx(ToggleButton, { value: options.multipleSpectraAnalysis.id, id: options.multipleSpectraAnalysis.id, title: options.multipleSpectraAnalysis.label, children: _jsx(SvgNmrMultipleAnalysis, {}) }, options.multipleSpectraAnalysis.id)), isButtonVisible('apodization') && (_jsx(ToggleButton, { value: options.apodization.id, id: options.apodization.id, title: `${options.apodization.label} (Press a)`, children: _jsx(SvgNmrApodization, {}) }, options.apodization.id)), isButtonVisible('zeroFilling') && (_jsx(ToggleButton, { value: options.zeroFilling.id, id: options.zeroFilling.id, title: options.zeroFilling.label, children: _jsx(SvgNmrZeroFilling, {}) }, options.zeroFilling.id)), isButtonVisible('phaseCorrection') && (_jsx(ToggleButton, { value: options.phaseCorrection.id, id: options.phaseCorrection.id, title: `${options.phaseCorrection.label} ( Press a )`, children: _jsx(SvgNmrPhaseCorrection, {}) }, options.phaseCorrection.id)), isButtonVisible('baselineCorrection') && (_jsx(ToggleButton, { value: options.baselineCorrection.id, id: options.baselineCorrection.id, title: `${options.baselineCorrection.label} ( Press b )`, children: _jsx(SvgNmrBaselineCorrection, {}) }, options.baselineCorrection.id)), isButtonVisible('exclusionZones', { checkSpectrumType: false }) &&
35
- ftCounter > 0 && (_jsx(ToggleButton, { value: options.exclusionZones.id, title: `${options.exclusionZones.label} ( Press e )`, id: options.exclusionZones.id, children: _jsx("div", { style: { fontSize: 18 }, children: _jsx(SvgNmrMultipleAnalysis, {}) }) }, options.exclusionZones.id))] }), isButtonVisible('fft') && (_jsx(Toolbar.Item, { id: options.fft.id, className: "cheminfo", title: options.fft.label, onClick: handleOnFFTFilter, children: _jsx(SvgNmrFourierTransform, {}) }))] }));
44
+ ftCounter > 1 && (_jsx(ToggleButton, { value: options.multipleSpectraAnalysis.id, id: options.multipleSpectraAnalysis.id, title: options.multipleSpectraAnalysis.label, children: _jsx(SvgNmrMultipleAnalysis, {}) }, options.multipleSpectraAnalysis.id)), isButtonVisible('apodization') && (_jsx(ToggleButton, { value: options.apodization.id, id: options.apodization.id, title: `${options.apodization.label} (Press a)`, children: _jsx(SvgNmrApodization, {}) }, options.apodization.id)), isButtonVisible('zeroFilling') && (_jsx(ToggleButton, { value: options.zeroFilling.id, id: options.zeroFilling.id, title: `${options.zeroFilling.label} ( Press z )`, children: _jsx(SvgNmrZeroFilling, {}) }, options.zeroFilling.id)), isButtonVisible('phaseCorrection') && (_jsx(ToggleButton, { value: options.phaseCorrection.id, id: options.phaseCorrection.id, title: `${options.phaseCorrection.label} ( Press a )`, children: _jsx(SvgNmrPhaseCorrection, {}) }, options.phaseCorrection.id)), isButtonVisible('baselineCorrection') && (_jsx(ToggleButton, { value: options.baselineCorrection.id, id: options.baselineCorrection.id, title: `${options.baselineCorrection.label} ( Press b )`, children: _jsx(SvgNmrBaselineCorrection, {}) }, options.baselineCorrection.id)), isButtonVisible('exclusionZones', { checkSpectrumType: false }) &&
45
+ ftCounter > 0 && (_jsx(ToggleButton, { value: options.exclusionZones.id, title: `${options.exclusionZones.label} ( Press e )`, id: options.exclusionZones.id, children: _jsx("div", { style: { fontSize: 18 }, children: _jsx(SvgNmrMultipleAnalysis, {}) }) }, options.exclusionZones.id))] }), isButtonVisible('fft') && (_jsx(Toolbar.Item, { id: options.fft.id, className: "cheminfo", title: `${options.fft.label} ( Press t )`, onClick: handleOnFFTFilter, children: _jsx(SvgNmrFourierTransform, {}) })), isButtonVisible('fftDimension1') && (_jsx(Toolbar.Item, { id: options.fftDimension1.id, className: "cheminfo", title: options.fftDimension1.label, onClick: handleFFtDimension1Filter, children: _jsx(SvgNmrFourierTransform, {}) })), isButtonVisible('fftDimension2') && (_jsx(Toolbar.Item, { id: options.fftDimension2.id, className: "cheminfo", title: options.fftDimension2.label, onClick: handleFFtDimension2Filter, children: _jsx(SvgNmrFourierTransform, {}) }))] }));
36
46
  }
37
47
  const MemoizedFunctionToolBar = memo(FunctionToolBarInner);
38
48
  export default function FunctionToolBar({ defaultValue = options.zoom.id, }) {
@@ -18,6 +18,7 @@ export interface ToolOptionItem {
18
18
  isToggle: boolean;
19
19
  hasOptionPanel: boolean;
20
20
  isFilter: boolean;
21
+ isExperimental?: true;
21
22
  }
22
23
  export type Tool = keyof NMRiumToolBarPreferences | 'HMove' | 'equalizer' | 'generalSelector' | 'editRange' | 'databaseRangesSelection' | 'matrixGenerationExclusionZones';
23
24
  type RecordOptions = Record<Tool, ToolOptionItem>;
@@ -288,6 +288,42 @@ export const options = {
288
288
  ],
289
289
  isToggle: false,
290
290
  },
291
+ fftDimension1: {
292
+ id: 'fftDimension1',
293
+ label: 'Fourier transform dimension 1',
294
+ hasOptionPanel: false,
295
+ isFilter: true,
296
+ mode: DISPLAYER_MODE.DM_2D,
297
+ spectraOptions: [
298
+ {
299
+ info: [
300
+ { key: 'isFid', value: true },
301
+ { key: 'isComplex', value: true },
302
+ ],
303
+ active: true,
304
+ },
305
+ ],
306
+ isToggle: false,
307
+ isExperimental: true,
308
+ },
309
+ fftDimension2: {
310
+ id: 'fftDimension2',
311
+ label: 'Fourier transform dimension 2',
312
+ hasOptionPanel: false,
313
+ isFilter: true,
314
+ mode: DISPLAYER_MODE.DM_2D,
315
+ spectraOptions: [
316
+ {
317
+ info: [
318
+ { key: 'isFid', value: true },
319
+ { key: 'isComplex', value: true },
320
+ ],
321
+ active: true,
322
+ },
323
+ ],
324
+ isToggle: false,
325
+ isExperimental: true,
326
+ },
291
327
  import: {
292
328
  id: 'import',
293
329
  label: 'Import',
@@ -187,14 +187,17 @@ function getBlob(rootRef, elementID) {
187
187
  const blob = new Blob([svg], { type: 'image/svg+xml' });
188
188
  return { blob, width, height };
189
189
  }
190
+ function getMatrix(element) {
191
+ const transform = window
192
+ .getComputedStyle(element)
193
+ .getPropertyValue('transform');
194
+ return new DOMMatrix(transform);
195
+ }
190
196
  function getMoleculesElement(rootRef) {
191
197
  const nmriumViewer = rootRef.getRootNode().querySelector(`#nmrium-viewer`);
192
198
  const floatingMoleculesGroup = document.createElement('g');
193
199
  for (const element of nmriumViewer.querySelectorAll('.draggable-molecule')) {
194
- const transform = window
195
- .getComputedStyle(element)
196
- .getPropertyValue('transform');
197
- const matrix = new DOMMatrix(transform);
200
+ const matrix = getMatrix(element);
198
201
  const actionHeaderElement = element.querySelector('.float-molecule-actions');
199
202
  const molElement = element
200
203
  .cloneNode(true)
@@ -0,0 +1,3 @@
1
+ export type FilterType<SourceType, Type> = Pick<SourceType, {
2
+ [K in keyof SourceType]: SourceType[K] extends Type ? K : never;
3
+ }[keyof SourceType]>;
@@ -0,0 +1 @@
1
+ export {};
@@ -32,6 +32,8 @@ export const basic = {
32
32
  phaseCorrection: true,
33
33
  baselineCorrection: true,
34
34
  autoRangeAndZonePicking: true,
35
+ fftDimension1: true,
36
+ fftDimension2: true,
35
37
  },
36
38
  },
37
39
  };
@@ -36,6 +36,8 @@ export const embedded = {
36
36
  zoomOut: true,
37
37
  zoom: true,
38
38
  autoRangeAndZonePicking: true,
39
+ fftDimension1: true,
40
+ fftDimension2: true,
39
41
  },
40
42
  },
41
43
  };
@@ -22,6 +22,8 @@ export const exercise = {
22
22
  integral: true,
23
23
  spectraCenterAlignments: true,
24
24
  spectraStackAlignments: true,
25
+ fftDimension1: true,
26
+ fftDimension2: true,
25
27
  },
26
28
  },
27
29
  general: {
@@ -1,6 +1,13 @@
1
1
  export const prediction = {
2
2
  version: 1,
3
3
  label: 'Prediction',
4
+ general: {
5
+ dimmedSpectraOpacity: 0.5,
6
+ verticalSplitterPosition: '440px',
7
+ verticalSplitterCloseThreshold: 600,
8
+ spectraRendering: 'auto',
9
+ loggingLevel: 'info',
10
+ },
4
11
  display: {
5
12
  panels: {
6
13
  spectraPanel: { display: true },
@@ -28,6 +35,8 @@ export const prediction = {
28
35
  zoomOut: true,
29
36
  zoom: true,
30
37
  autoRangeAndZonePicking: true,
38
+ fftDimension1: true,
39
+ fftDimension2: true,
31
40
  },
32
41
  },
33
42
  formatting: {
@@ -28,6 +28,8 @@ export const process1D = {
28
28
  exclusionZones: true,
29
29
  multipleSpectraAnalysis: true,
30
30
  autoRangeAndZonePicking: true,
31
+ fftDimension1: true,
32
+ fftDimension2: true,
31
33
  },
32
34
  },
33
35
  };
@@ -44,6 +44,8 @@ export const workspaceDefaultProperties = {
44
44
  zoom: false,
45
45
  peakPicking: false,
46
46
  autoRangeAndZonePicking: false,
47
+ fftDimension1: false,
48
+ fftDimension2: false,
47
49
  },
48
50
  },
49
51
  general: {
@@ -1,9 +1,9 @@
1
1
  import { Logger } from 'cheminfo-types';
2
2
  import { Spectrum } from 'nmr-load-save';
3
- import { PredictedAll, Prediction1D, Prediction2D } from 'nmr-processing';
3
+ import { Predicted, PredictionBase1D, PredictionBase2D } from 'nmr-processing';
4
4
  export type Experiment = 'proton' | 'carbon' | 'cosy' | 'hsqc' | 'hmbc';
5
5
  export type SpectraPredictionOptions = Record<Experiment, boolean>;
6
- export type PredictedSpectraResult = Partial<Record<Experiment, Prediction1D | Prediction2D>>;
6
+ export type PredictedSpectraResult = Partial<Record<Experiment, PredictionBase1D | PredictionBase2D>>;
7
7
  export interface PredictionOptions {
8
8
  name: string;
9
9
  frequency: number;
@@ -34,5 +34,5 @@ export declare const FREQUENCIES: Array<{
34
34
  value: number;
35
35
  label: string;
36
36
  }>;
37
- export declare function predictSpectra(molfile: string): Promise<PredictedAll>;
37
+ export declare function predictSpectra(molfile: string, options: any): Promise<Predicted>;
38
38
  export declare function generateSpectra(predictedSpectra: PredictedSpectraResult, inputOptions: PredictionOptions, color: string, logger: Logger): Spectrum[];
@@ -1,6 +1,6 @@
1
1
  import { v4 } from '@lukeed/uuid';
2
2
  import { xMinMaxValues } from 'ml-spectra-processing';
3
- import { predictAll, signalsToXY, signals2DToZ, getFrequency, signalsToRanges, } from 'nmr-processing';
3
+ import { predict, signalsToXY, signals2DToZ, getFrequency, signalsToRanges, } from 'nmr-processing';
4
4
  import OCL from 'openchemlib/full';
5
5
  import { DatumKind } from './constants/SignalsKinds';
6
6
  import { initiateDatum1D, mapRanges, updateIntegralsRelativeValues, } from './data1d/Spectrum1D';
@@ -42,16 +42,16 @@ export const FREQUENCIES = [
42
42
  { value: 1000, label: '1000 MHz' },
43
43
  { value: 1200, label: '1200 MHz' },
44
44
  ];
45
- const baseURL = 'https://nmr-prediction.service.zakodium.com';
46
- export async function predictSpectra(molfile) {
45
+ export async function predictSpectra(molfile, options) {
47
46
  const molecule = OCL.Molecule.fromMolfile(molfile);
48
- return predictAll(molecule, {
49
- predictOptions: {
50
- C: {
51
- webserviceURL: `${baseURL}/v1/predict/carbon`,
52
- },
53
- },
54
- });
47
+ const predictOptions = {};
48
+ for (const key in options) {
49
+ if (!options[key])
50
+ continue;
51
+ const experiment = key === 'proton' ? 'H' : key === 'carbon' ? 'C' : key;
52
+ predictOptions[experiment] = {};
53
+ }
54
+ return predict(molecule, { predictOptions });
55
55
  }
56
56
  function generateName(name, options) {
57
57
  const { frequency, experiment } = options;
@@ -1,6 +1,5 @@
1
1
  import { Spectrum1D } from 'nmr-load-save';
2
2
  import { Signal1D } from 'nmr-processing';
3
- import { SumParams } from '../SumManager';
4
3
  interface RangeOptions {
5
4
  from: number;
6
5
  to: number;
@@ -37,5 +36,5 @@ export declare function createRangeObj({ from, to, absolute, signal, }: RangeOpt
37
36
  kind: string;
38
37
  integration: number;
39
38
  };
40
- export declare function addRange(spectrum: Spectrum1D, options: RangeOptions & SumParams): void;
39
+ export declare function addRange(spectrum: Spectrum1D, options: RangeOptions): void;
41
40
  export {};
@@ -1,8 +1,7 @@
1
1
  import { v4 } from '@lukeed/uuid';
2
2
  import { xyIntegration } from 'ml-spectra-processing';
3
- import { updateRangesRelativeValues, mapRanges, } from 'nmr-processing';
3
+ import { mapRanges } from 'nmr-processing';
4
4
  import { DatumKind } from '../../../constants/SignalsKinds';
5
- import { initSumOptions } from '../SumManager';
6
5
  import detectSignal from './detectSignal';
7
6
  export function createRangeObj({ from, to, absolute, signal, }) {
8
7
  return {
@@ -16,7 +15,7 @@ export function createRangeObj({ from, to, absolute, signal, }) {
16
15
  };
17
16
  }
18
17
  export function addRange(spectrum, options) {
19
- const { from, to, molecules, nucleus } = options;
18
+ const { from, to } = options;
20
19
  const { x, re } = spectrum.data;
21
20
  const absolute = xyIntegration({ x, y: re }, { from, to, reverse: true });
22
21
  // detectSignal use the advance multiplet-analysis that can crash if too many points
@@ -36,12 +35,7 @@ export function addRange(spectrum, options) {
36
35
  }
37
36
  try {
38
37
  if (range) {
39
- spectrum.ranges.options = initSumOptions(spectrum.ranges.options, {
40
- molecules,
41
- nucleus,
42
- });
43
38
  spectrum.ranges.values = spectrum.ranges.values.concat(mapRanges([range], spectrum));
44
- updateRangesRelativeValues(spectrum);
45
39
  }
46
40
  }
47
41
  catch (error) {
@@ -4,8 +4,8 @@ import getAtomsFromMF from '../utilities/getAtomsFromMF';
4
4
  export const DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT = {
5
5
  x: 100,
6
6
  y: 50,
7
- width: 100,
8
- height: 100,
7
+ width: 190,
8
+ height: 200,
9
9
  };
10
10
  export function initMolecule(options = {}) {
11
11
  const id = options.id || v4();
@@ -1,2 +1,2 @@
1
1
  import { KeyboardEvent, MouseEvent } from 'react';
2
- export default function checkModifierKeyActivated(event: KeyboardEvent | MouseEvent): boolean;
2
+ export default function checkModifierKeyActivated<E = HTMLDivElement>(event: KeyboardEvent<E> | MouseEvent<E>): boolean;
@@ -1,15 +1,10 @@
1
+ const modifiersKeys = [
2
+ 'Alt',
3
+ 'AltGraph',
4
+ 'Control',
5
+ 'Meta',
6
+ 'Shift',
7
+ ];
1
8
  export default function checkModifierKeyActivated(event) {
2
- const modifiersKeys = [
3
- 'Alt',
4
- 'AltGraph',
5
- 'Control',
6
- 'Meta',
7
- 'Shift',
8
- ];
9
- for (const key of modifiersKeys) {
10
- if (event.getModifierState(key)) {
11
- return true;
12
- }
13
- }
14
- return false;
9
+ return modifiersKeys.some((key) => event.getModifierState(key));
15
10
  }
@@ -1 +1 @@
1
- export default { version: 'v0.42.0' };
1
+ export default { version: 'v0.43.0' };
@@ -97,6 +97,6 @@ function ApodizationLine() {
97
97
  return '';
98
98
  }
99
99
  };
100
- return ((0, jsx_runtime_1.jsx)("path", { "data-test-id": "apodization-line", stroke: "green", fill: "none", strokeWidth: "2", d: paths() }));
100
+ return ((0, jsx_runtime_1.jsx)("path", { "data-testid": "apodization-line", stroke: "green", fill: "none", strokeWidth: "2", d: paths() }));
101
101
  }
102
102
  exports.default = ApodizationLine;
@@ -15,12 +15,13 @@ const DatabaseElements_1 = __importDefault(require("./database/DatabaseElements"
15
15
  const IntegralsSeries_1 = __importDefault(require("./integral/IntegralsSeries"));
16
16
  const JGraph_1 = __importDefault(require("./jCouplingGraph/JGraph"));
17
17
  const MultiAnalysisRanges_1 = __importDefault(require("./multiAnalysis/MultiAnalysisRanges"));
18
- const PeakAnnotations_1 = __importDefault(require("./peaks/PeakAnnotations"));
18
+ const PeakEditionManager_1 = require("./peaks/PeakEditionManager");
19
+ const Peaks_1 = require("./peaks/Peaks");
19
20
  const PeaksShapes_1 = __importDefault(require("./peaks/PeaksShapes"));
20
21
  const Ranges_1 = __importDefault(require("./ranges/Ranges"));
21
22
  const BaseLineZones_1 = __importDefault(require("./tool/BaseLineZones"));
22
23
  function Chart1D({ mode, width, height, margin, displayerKey }) {
23
24
  const { current: { general: { spectraRendering }, }, } = (0, PreferencesContext_1.usePreferences)();
24
- return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, id: "nmrSVG", shapeRendering: spectraRendering, children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", { id: `${displayerKey}clip-chart-1d`, children: (0, jsx_runtime_1.jsx)("rect", { width: `${width - margin.left - margin.right}`, height: `${height}`, x: `${margin.left}`, y: `${0}` }) }) }), (0, jsx_runtime_1.jsx)(LinesSeries_1.default, {}), (0, jsx_runtime_1.jsx)(ApodizationLine_1.default, {}), (0, jsx_runtime_1.jsx)(IntegralsSeries_1.default, {}), (0, jsx_runtime_1.jsx)(PeakAnnotations_1.default, {}), (0, jsx_runtime_1.jsx)(Ranges_1.default, {}), (0, jsx_runtime_1.jsx)(JGraph_1.default, {}), (0, jsx_runtime_1.jsx)(MultiAnalysisRanges_1.default, {}), (0, jsx_runtime_1.jsx)(BaseLineZones_1.default, {}), (0, jsx_runtime_1.jsx)(ExclusionZonesAnnotations_1.default, {}), (0, jsx_runtime_1.jsx)(DatabaseElements_1.default, {}), (0, jsx_runtime_1.jsx)(PeaksShapes_1.default, {}), (0, jsx_runtime_1.jsx)(SpectraLegends_1.default, {}), (0, jsx_runtime_1.jsx)(SpectrumInfoBlock_1.default, {}), (0, jsx_runtime_1.jsx)("g", { className: "container", style: { pointerEvents: 'none' }, children: (0, jsx_runtime_1.jsx)(XAxis_1.default, { showGrid: true, mode: mode }) })] }));
25
+ return ((0, jsx_runtime_1.jsx)(PeakEditionManager_1.PeakEditionProvider, { children: (0, jsx_runtime_1.jsxs)("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, id: "nmrSVG", shapeRendering: spectraRendering, children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", { id: `${displayerKey}clip-chart-1d`, children: (0, jsx_runtime_1.jsx)("rect", { width: `${width - margin.left - margin.right}`, height: `${height}`, x: `${margin.left}`, y: `${0}` }) }) }), (0, jsx_runtime_1.jsx)(LinesSeries_1.default, {}), (0, jsx_runtime_1.jsx)(ApodizationLine_1.default, {}), (0, jsx_runtime_1.jsx)(IntegralsSeries_1.default, {}), (0, jsx_runtime_1.jsx)(Peaks_1.Peaks, {}), (0, jsx_runtime_1.jsx)(Ranges_1.default, {}), (0, jsx_runtime_1.jsx)(JGraph_1.default, {}), (0, jsx_runtime_1.jsx)(MultiAnalysisRanges_1.default, {}), (0, jsx_runtime_1.jsx)(BaseLineZones_1.default, {}), (0, jsx_runtime_1.jsx)(ExclusionZonesAnnotations_1.default, {}), (0, jsx_runtime_1.jsx)(DatabaseElements_1.default, {}), (0, jsx_runtime_1.jsx)(PeaksShapes_1.default, {}), (0, jsx_runtime_1.jsx)(SpectraLegends_1.default, {}), (0, jsx_runtime_1.jsx)(SpectrumInfoBlock_1.default, {}), (0, jsx_runtime_1.jsx)("g", { className: "container", style: { pointerEvents: 'none' }, children: (0, jsx_runtime_1.jsx)(XAxis_1.default, { showGrid: true, mode: mode }) })] }) }));
25
26
  }
26
27
  exports.default = Chart1D;