nmrium 0.54.0 → 0.55.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 (106) hide show
  1. package/lib/component/1d/XAxis.js +1 -1
  2. package/lib/component/1d/integral/IntegralsSeries.js +2 -2
  3. package/lib/component/1d/integral/Integration.d.ts +3 -1
  4. package/lib/component/1d/integral/Integration.js +3 -2
  5. package/lib/component/1d/peaks/PeakEditionManager.js +5 -3
  6. package/lib/component/1d/ranges/AssignmentActionsButtons.d.ts +1 -0
  7. package/lib/component/1d/ranges/AssignmentActionsButtons.js +3 -3
  8. package/lib/component/1d/ranges/AssignmentLabel.d.ts +1 -1
  9. package/lib/component/1d/ranges/AssignmentLabel.js +31 -4
  10. package/lib/component/1d/ranges/Atoms.js +4 -5
  11. package/lib/component/1d/ranges/Range.js +48 -6
  12. package/lib/component/1d/ranges/Ranges.js +2 -1
  13. package/lib/component/1d/ranges/RangesIntegrals.js +11 -4
  14. package/lib/component/1d-2d/FieldEdition.d.ts +13 -0
  15. package/lib/component/1d-2d/FieldEdition.js +42 -0
  16. package/lib/component/2d/Chart2D.js +5 -3
  17. package/lib/component/2d/zones/Zone.js +18 -2
  18. package/lib/component/2d/zones/ZonesAssignmentsLabels.d.ts +7 -0
  19. package/lib/component/2d/zones/ZonesAssignmentsLabels.js +286 -0
  20. package/lib/component/EventsTrackers/KeysListenerTracker.js +14 -1
  21. package/lib/component/context/ShareDataContext.d.ts +10 -0
  22. package/lib/component/context/ShareDataContext.js +22 -0
  23. package/lib/component/elements/ActionsButtonsPopover.d.ts +10 -0
  24. package/lib/component/elements/ActionsButtonsPopover.js +22 -0
  25. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +7 -5
  26. package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -2
  27. package/lib/component/elements/SVGButton.d.ts +14 -0
  28. package/lib/component/elements/SVGButton.js +6 -0
  29. package/lib/component/elements/SVGGroup.js +15 -13
  30. package/lib/component/elements/SVGText.d.ts +8 -0
  31. package/lib/component/elements/SVGText.js +24 -0
  32. package/lib/component/elements/draggable/SVGDraggable.d.ts +2 -2
  33. package/lib/component/elements/formik/FormikInput.d.ts +2 -1
  34. package/lib/component/elements/formik/FormikInput.js +4 -3
  35. package/lib/component/header/Header.js +7 -10
  36. package/lib/component/hooks/useActiveSpectrumZonesViewState.js +1 -0
  37. package/lib/component/hooks/useCheckPointsNumberInWindowArea.d.ts +1 -1
  38. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
  39. package/lib/component/hooks/useFormatNumberByNucleus.js +8 -7
  40. package/lib/component/hooks/useIntegralPath.d.ts +2 -0
  41. package/lib/component/hooks/useIntegralPath.js +3 -1
  42. package/lib/component/hooks/usePanelPreferences.js +1 -2
  43. package/lib/component/hooks/useSaveSettings.js +7 -14
  44. package/lib/component/hooks/useTriggerNewAssignmentLabel.d.ts +4 -0
  45. package/lib/component/hooks/useTriggerNewAssignmentLabel.js +8 -0
  46. package/lib/component/hooks/useWorkspaceAction.d.ts +7 -0
  47. package/lib/component/hooks/useWorkspaceAction.js +89 -0
  48. package/lib/component/loader/DropZone.js +0 -3
  49. package/lib/component/main/InnerNMRium.js +3 -1
  50. package/lib/component/main/InnerNMRiumContents.js +14 -2
  51. package/lib/component/main/NMRiumStateProvider.js +4 -2
  52. package/lib/component/modal/editRange/forms/components/DeltaInput.js +3 -3
  53. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +17 -12
  54. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +30 -13
  55. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +26 -16
  56. package/lib/component/modal/setting/GeneralSettings.js +7 -21
  57. package/lib/component/modal/setting/WorkspaceItem.js +1 -1
  58. package/lib/component/modal/setting/settings-tabs/NucleiTabContent.d.ts +2 -0
  59. package/lib/component/modal/setting/settings-tabs/NucleiTabContent.js +99 -0
  60. package/lib/component/modal/setting/settingsValidation.js +36 -40
  61. package/lib/component/panels/SpectraPanel/SpectraPreferences.js +13 -1
  62. package/lib/component/panels/SpectraPanel/base/setting/PlotChart.js +1 -1
  63. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DHistogram.js +1 -1
  64. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.d.ts +6 -0
  65. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.js +16 -0
  66. package/lib/component/panels/ZonesPanel/ZonesPanel.js +18 -2
  67. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +15 -9
  68. package/lib/component/panels/ZonesPanel/ZonesTable.js +2 -2
  69. package/lib/component/panels/ZonesPanel/ZonesTableRow.js +3 -2
  70. package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +1 -1
  71. package/lib/component/reducer/IgnoreActions.js +1 -0
  72. package/lib/component/reducer/Reducer.js +6 -0
  73. package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
  74. package/lib/component/reducer/actions/DomainActions.js +29 -1
  75. package/lib/component/reducer/actions/RangesActions.js +12 -6
  76. package/lib/component/reducer/actions/ZonesActions.d.ts +15 -2
  77. package/lib/component/reducer/actions/ZonesActions.js +47 -13
  78. package/lib/component/reducer/helper/setRangesViewProperty.d.ts +1 -0
  79. package/lib/component/reducer/helper/setRangesViewProperty.js +11 -11
  80. package/lib/component/reducer/preferences/actions/addWorkspace.js +4 -23
  81. package/lib/component/reducer/preferences/actions/analyzeSpectra.js +4 -4
  82. package/lib/component/reducer/preferences/actions/initPreferences.js +2 -4
  83. package/lib/component/reducer/preferences/actions/matrixGeneration.js +3 -3
  84. package/lib/component/reducer/preferences/actions/removeWorkspace.js +0 -5
  85. package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +0 -4
  86. package/lib/component/reducer/preferences/actions/setPanelsPreferences.js +1 -1
  87. package/lib/component/reducer/preferences/actions/setPreferences.js +2 -16
  88. package/lib/component/reducer/preferences/preferencesReducer.d.ts +7 -0
  89. package/lib/component/reducer/preferences/preferencesReducer.js +21 -18
  90. package/lib/component/toolbar/ToolBar.js +18 -14
  91. package/lib/component/utility/PreferencesHelper.js +5 -4
  92. package/lib/component/utility/export.js +4 -0
  93. package/lib/component/workspaces/assignment.js +0 -1
  94. package/lib/component/workspaces/basic.js +0 -1
  95. package/lib/component/workspaces/embedded.js +0 -1
  96. package/lib/component/workspaces/exercise.js +26 -29
  97. package/lib/component/workspaces/prediction.js +171 -174
  98. package/lib/component/workspaces/process1D.js +0 -1
  99. package/lib/component/workspaces/simulation.js +35 -38
  100. package/lib/component/workspaces/workspaceDefaultProperties.js +9 -11
  101. package/lib/versionInfo.js +1 -1
  102. package/package.json +31 -31
  103. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.d.ts +0 -2
  104. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +0 -80
  105. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +0 -2
  106. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.js +0 -10
@@ -7,6 +7,7 @@ import { Toolbar } from 'react-science/ui';
7
7
  import { useChartData } from '../context/ChartContext';
8
8
  import { useDispatch } from '../context/DispatchContext';
9
9
  import { useLoader } from '../context/LoaderContext';
10
+ import { usePreferences } from '../context/PreferencesContext';
10
11
  import { CustomToolTip } from '../elements/CustomToolTip';
11
12
  import { ToolbarPopoverItem, } from '../elements/ToolbarPopoverItem';
12
13
  import useCheckExperimentalFeature from '../hooks/useCheckExperimentalFeature';
@@ -49,6 +50,7 @@ export default function ToolBar() {
49
50
  const exportMenu = isExperimentalFeature
50
51
  ? EXPORT_MENU
51
52
  : EXPORT_MENU.filter((item) => item.id !== 'nmre');
53
+ const { current: { general: { invert }, }, } = usePreferences();
52
54
  const handleOnFFTFilter = useCallback(() => {
53
55
  dispatch({
54
56
  type: 'APPLY_FFT_FILTER',
@@ -110,7 +112,7 @@ export default function ToolBar() {
110
112
  title: options.zoom.label,
111
113
  subTitles: [
112
114
  { title: 'Vertical', shortcuts: ['Scroll wheel'] },
113
- { title: 'Horizontal', shortcuts: ['Shift', 'Scroll wheel'] },
115
+ { title: 'Horizontal', shortcuts: ['SHIFT', 'Scroll wheel'] },
114
116
  { title: 'Pan', shortcuts: ['Right mouse'] },
115
117
  ],
116
118
  },
@@ -124,7 +126,7 @@ export default function ToolBar() {
124
126
  { title: 'Horizontal', shortcuts: ['f'] },
125
127
  { title: 'Horizontal and Vertical', shortcuts: ['f', 'f'] },
126
128
  ],
127
- description: 'You can zoom out by double click on the left mouse button and full zoom out by press key "f" or press key "f" twice to fit the spectra in the window.',
129
+ description: 'Zoom out by double-clicking the left mouse button, and fully zoom out horizontally by pressing the key "f". Alternatively, press the key "ff" to fit the spectra horizontally and vertically.',
128
130
  link: 'https://docs.nmrium.org/help/zoom-and-scale',
129
131
  },
130
132
  onClick: handleFullZoomOut,
@@ -135,7 +137,7 @@ export default function ToolBar() {
135
137
  tooltip: {
136
138
  title: options.peakPicking.label,
137
139
  shortcuts: ['p'],
138
- description: 'You can detect peaks manually or automatically in the spectrum.',
140
+ description: 'Detect peaks manually or automatically in the spectrum.',
139
141
  link: 'https://docs.nmrium.org/20_1d-spectra/peaks/peaks',
140
142
  },
141
143
  icon: _jsx(SvgNmrPeakPicking, {}),
@@ -145,7 +147,7 @@ export default function ToolBar() {
145
147
  tooltip: {
146
148
  title: options.integral.label,
147
149
  shortcuts: ['i'],
148
- description: 'To calculate the integration, hold Shift and left-click, then drag over the signal range.',
150
+ description: `Manually integrate the spectrum. Click, drag, and release ${!invert ? 'while holding SHIFT' : ''} to draw the integral. Resize the integrals by moving the edges. Cut an integral with ${!invert ? 'SHIFT +' : ''} click.`,
149
151
  link: 'https://docs.nmrium.org/help/integrations',
150
152
  },
151
153
  icon: _jsx(SvgNmrIntegrate, {}),
@@ -155,7 +157,7 @@ export default function ToolBar() {
155
157
  tooltip: {
156
158
  title: options.zonePicking.label,
157
159
  shortcuts: ['r'],
158
- description: 'You can detect zones manually by selecting, holding Shift,left-click, dragging, and then releasing. Alternatively, detect zones automatically.',
160
+ description: `Draw 2D zones by clicking, dragging, and releasing${!invert ? 'while holding SHIFT' : ''}. Alternatively, detect zones automatically.`,
159
161
  link: 'https://docs.nmrium.org/30_2d-spectra/zones/zones',
160
162
  },
161
163
  icon: _jsx(FaDiceFour, {}),
@@ -164,7 +166,7 @@ export default function ToolBar() {
164
166
  id: 'slicing',
165
167
  tooltip: {
166
168
  title: options.slicing.label,
167
- description: 'You can display the shift on the x-axis and the y-axis for each point of a 2D spectrum.',
169
+ description: 'Display the horizontal and vertical slices of the selected 2D spectrum at the level of the pointer.',
168
170
  link: 'https://docs.nmrium.org/30_2d-spectra/slicing/slicing',
169
171
  },
170
172
  icon: _jsx(PiKnifeBold, {}),
@@ -174,7 +176,7 @@ export default function ToolBar() {
174
176
  tooltip: {
175
177
  title: options.rangePicking.label,
176
178
  shortcuts: ['r'],
177
- description: 'You can detect ranges manually by selecting, holding Shift,left-click, dragging, and then releasing. Alternatively, detect ranges automatically.',
179
+ description: `Define ranges and analyse multiplet automatically or manually. Click, drag, and release ${!invert ? 'while holding SHIFT' : ''} to draw the range. Ranges can be resized by moving the edges.`,
178
180
  link: 'https://docs.nmrium.org/20_1d-spectra/ranges/ranges',
179
181
  },
180
182
  icon: _jsx(SvgNmrRangePicking, {}),
@@ -191,6 +193,7 @@ export default function ToolBar() {
191
193
  tooltip: {
192
194
  title: options.apodization.label,
193
195
  shortcuts: ['a'],
196
+ description: 'Apply mathematical function that the FID is multiplied by before Fourier Transform.',
194
197
  },
195
198
  icon: _jsx(SvgNmrApodization, {}),
196
199
  },
@@ -199,7 +202,7 @@ export default function ToolBar() {
199
202
  tooltip: {
200
203
  title: options.zeroFilling.label,
201
204
  shortcuts: ['z'],
202
- description: 'To improve spectrum quality by increasing the number of points per ppm, by default, the number of points is twice as many points as in the original FID.',
205
+ description: 'Improve spectrum quality by increasing the number of points. By default, the number of points is twice as many as in the original FID.',
203
206
  link: 'https://docs.nmrium.org/20_1d-spectra/preprocessing/preprocessing#zero-filling',
204
207
  },
205
208
  icon: _jsx(SvgNmrZeroFilling, {}),
@@ -209,7 +212,7 @@ export default function ToolBar() {
209
212
  tooltip: {
210
213
  title: options.phaseCorrection.label,
211
214
  shortcuts: ['a'],
212
- description: 'To phase the spectrum after the FFT.',
215
+ description: `Correct the spectrum phase manually or automatically. For manual phase correction, define the pivot${!invert ? ' using SHIFT +' : ''} click, then press the PH0 and PH1 button, and move the mouse horizontally.`,
213
216
  link: 'https://docs.nmrium.org/20_1d-spectra/phase/phase',
214
217
  },
215
218
  icon: _jsx(SvgNmrPhaseCorrection, {}),
@@ -228,7 +231,7 @@ export default function ToolBar() {
228
231
  tooltip: {
229
232
  title: options.baselineCorrection.label,
230
233
  shortcuts: ['b'],
231
- description: 'To process the spectrum to be a straight line at zero absorbance.',
234
+ description: `Correct the baseline of the spectrum. You should draw zones corresponding to the noise using click, drag, release${!invert ? 'while holding SHIFT' : ''}.`,
232
235
  link: 'https://docs.nmrium.org/20_1d-spectra/baseline/baseline',
233
236
  },
234
237
  icon: _jsx(SvgNmrBaselineCorrection, {}),
@@ -238,6 +241,7 @@ export default function ToolBar() {
238
241
  tooltip: {
239
242
  title: options.exclusionZones.label,
240
243
  shortcuts: ['e'],
244
+ description: `Define exclusion zones by clicking, dragging, releasing${!invert ? ' while holding SHIFT' : ''}. This option is practical for excluding large peaks like solvents.`,
241
245
  },
242
246
  icon: _jsx(SvgNmrMultipleAnalysis, {}),
243
247
  checkOptions: { checkSpectrumType: false },
@@ -248,7 +252,7 @@ export default function ToolBar() {
248
252
  tooltip: {
249
253
  title: options.fft.label,
250
254
  shortcuts: ['t'],
251
- description: 'To process the FID to FT spectrum.',
255
+ description: 'Perform a Fourier transform on the FID.',
252
256
  link: 'https://docs.nmrium.org/20_1d-spectra/ft/ft/',
253
257
  },
254
258
  onClick: handleOnFFTFilter,
@@ -285,7 +289,7 @@ export default function ToolBar() {
285
289
  tooltip: {
286
290
  title: options.spectraStackAlignments.label,
287
291
  shortcuts: ['s'],
288
- description: 'To display the spectra in a stack mode.',
292
+ description: 'Toggle between stack mode and all the spectra aligned at the bottom.',
289
293
  },
290
294
  icon: verticalAlign === 'stack' ? (_jsx(SvgNmrOverlay3Aligned, {})) : (_jsx(SvgNmrOverlay3, {})),
291
295
  condition: ftCounter > 1,
@@ -295,7 +299,7 @@ export default function ToolBar() {
295
299
  id: 'realImaginary',
296
300
  tooltip: {
297
301
  title: `Display ${isRealSpectrumShown ? 'real' : 'imaginary'}`,
298
- description: 'To switch between imaginary and real part of the spectrum.',
302
+ description: 'Toggle between the imaginary and real parts of the spectrum.',
299
303
  link: 'https://docs.nmrium.org/20_1d-spectra/views/views',
300
304
  },
301
305
  icon: _jsx(SvgNmrRealImag, {}),
@@ -306,7 +310,7 @@ export default function ToolBar() {
306
310
  tooltip: {
307
311
  title: `Baseline ${verticalAlign === 'bottom' ? 'center' : 'bottom'}`,
308
312
  shortcuts: ['c'],
309
- description: 'To align the spectra in the centre or at the bottom of the displayer.',
313
+ description: 'Toggle between alignment of the spectra in the center or at the bottom of the display.',
310
314
  },
311
315
  icon: verticalAlign === 'bottom' ? (_jsx(SvgNmrAlignCenter, {})) : (_jsx(SvgNmrAlignBottom, {})),
312
316
  condition: ftCounter > 0 || fidCounter > 0,
@@ -1,8 +1,9 @@
1
- import { getLocalStorage, getValue } from './LocalStorage';
1
+ import { readSettings } from '../reducer/preferences/preferencesReducer';
2
+ import { getValue } from './LocalStorage';
2
3
  function GetPreference(preferences, key) {
3
- const localData = getLocalStorage('nmr-general-settings');
4
- const val = getValue(preferences, `formatting.panels.[${key}]`) ||
5
- getValue(localData, `formatting.panels.[${key}]`);
4
+ const localData = readSettings() || {};
5
+ const val = getValue(preferences, `panels.[${key}]`) ||
6
+ getValue(localData, `panels.[${key}]`);
6
7
  return val;
7
8
  }
8
9
  export { GetPreference };
@@ -107,6 +107,8 @@ function exportAsPng(rootRef, elementID, fileName = 'experiment') {
107
107
  }
108
108
  }
109
109
  // hack way to copy the image to the clipboard
110
+ // TODO: remove when Firefox widely supports ClipboardItem
111
+ // https://caniuse.com/mdn-api_clipboarditem
110
112
  function copyDataURLClipboardFireFox(image) {
111
113
  const img = document.createElement('img');
112
114
  img.src = image;
@@ -117,6 +119,7 @@ function copyDataURLClipboardFireFox(image) {
117
119
  const range = document.createRange();
118
120
  range.selectNode(img);
119
121
  window.getSelection()?.addRange(range);
122
+ // eslint-disable-next-line deprecation/deprecation
120
123
  document.execCommand('Copy');
121
124
  img.remove();
122
125
  }
@@ -136,6 +139,7 @@ async function copyBlobToClipboard(canvas) {
136
139
  return;
137
140
  const isSafari = /^(?<safari>(?!chrome|android).)*safari/i.test(navigator.userAgent);
138
141
  if (typeof ClipboardItem !== 'undefined') {
142
+ // eslint-disable-next-line @typescript-eslint/use-unknown-in-catch-callback-variable
139
143
  await writeImageToClipboard(b, isSafari).catch(reportError);
140
144
  }
141
145
  else {
@@ -1,5 +1,4 @@
1
1
  export const assignment = {
2
- version: 2,
3
2
  label: 'NMR spectra assignment',
4
3
  visible: true,
5
4
  display: {
@@ -1,5 +1,4 @@
1
1
  export const basic = {
2
- version: 2,
3
2
  label: 'Simple NMR analysis',
4
3
  visible: true,
5
4
  display: {
@@ -1,5 +1,4 @@
1
1
  export const embedded = {
2
- version: 1,
3
2
  label: 'Embedded',
4
3
  display: {
5
4
  general: {
@@ -1,5 +1,4 @@
1
1
  export const exercise = {
2
- version: 2,
3
2
  label: 'Exercise',
4
3
  display: {
5
4
  general: {
@@ -34,35 +33,33 @@ export const exercise = {
34
33
  spectraRendering: 'auto',
35
34
  loggingLevel: 'info',
36
35
  popupLoggingLevel: 'error',
37
- invert: false,
36
+ invert: true,
38
37
  },
39
- formatting: {
40
- nuclei: {},
41
- panels: {
42
- integrals: {
43
- nuclei: {
44
- '1H': {
45
- showSerialNumber: true,
46
- relative: { show: true, format: '0.00' },
47
- absolute: { show: false, format: '0.00' },
48
- from: { show: true, format: '0.00' },
49
- to: { show: true, format: '0.00' },
50
- color: 'black',
51
- strokeWidth: 1,
52
- showKind: false,
53
- showDeleteAction: true,
54
- },
55
- '13C': {
56
- showSerialNumber: true,
57
- relative: { show: true, format: '0.00' },
58
- absolute: { show: false, format: '0.00' },
59
- from: { show: true, format: '0.00' },
60
- to: { show: true, format: '0.00' },
61
- color: 'black',
62
- strokeWidth: 1,
63
- showKind: false,
64
- showDeleteAction: true,
65
- },
38
+ nuclei: [],
39
+ panels: {
40
+ integrals: {
41
+ nuclei: {
42
+ '1H': {
43
+ showSerialNumber: true,
44
+ relative: { show: true, format: '0.00' },
45
+ absolute: { show: false, format: '0.00' },
46
+ from: { show: true, format: '0.00' },
47
+ to: { show: true, format: '0.00' },
48
+ color: 'black',
49
+ strokeWidth: 1,
50
+ showKind: false,
51
+ showDeleteAction: true,
52
+ },
53
+ '13C': {
54
+ showSerialNumber: true,
55
+ relative: { show: true, format: '0.00' },
56
+ absolute: { show: false, format: '0.00' },
57
+ from: { show: true, format: '0.00' },
58
+ to: { show: true, format: '0.00' },
59
+ color: 'black',
60
+ strokeWidth: 1,
61
+ showKind: false,
62
+ showDeleteAction: true,
66
63
  },
67
64
  },
68
65
  },