nmrium 0.54.0 → 0.56.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 (142) hide show
  1. package/lib/component/1d/Chart1D.js +3 -1
  2. package/lib/component/1d/Viewer1D.js +36 -11
  3. package/lib/component/1d/XAxis.js +1 -1
  4. package/lib/component/1d/integral/IntegralsSeries.js +2 -2
  5. package/lib/component/1d/integral/Integration.d.ts +3 -1
  6. package/lib/component/1d/integral/Integration.js +3 -2
  7. package/lib/component/1d/matrix/Boxplot.d.ts +6 -0
  8. package/lib/component/1d/matrix/Boxplot.js +97 -0
  9. package/lib/component/1d/matrix/Stocsy.d.ts +5 -0
  10. package/lib/component/1d/matrix/Stocsy.js +101 -0
  11. package/lib/component/1d/matrix/useMatrix.d.ts +29 -0
  12. package/lib/component/1d/matrix/useMatrix.js +93 -0
  13. package/lib/component/1d/peaks/PeakEditionManager.js +5 -3
  14. package/lib/component/1d/ranges/AssignmentActionsButtons.d.ts +1 -0
  15. package/lib/component/1d/ranges/AssignmentActionsButtons.js +3 -3
  16. package/lib/component/1d/ranges/AssignmentLabel.d.ts +1 -1
  17. package/lib/component/1d/ranges/AssignmentLabel.js +31 -4
  18. package/lib/component/1d/ranges/Atoms.js +4 -5
  19. package/lib/component/1d/ranges/Range.js +48 -6
  20. package/lib/component/1d/ranges/Ranges.js +2 -1
  21. package/lib/component/1d/ranges/RangesIntegrals.js +11 -4
  22. package/lib/component/1d/utilities/scale.d.ts +2 -1
  23. package/lib/component/1d/utilities/scale.js +6 -1
  24. package/lib/component/1d-2d/FieldEdition.d.ts +13 -0
  25. package/lib/component/1d-2d/FieldEdition.js +42 -0
  26. package/lib/component/2d/Chart2D.js +5 -3
  27. package/lib/component/2d/zones/Zone.js +18 -2
  28. package/lib/component/2d/zones/ZonesAssignmentsLabels.d.ts +7 -0
  29. package/lib/component/2d/zones/ZonesAssignmentsLabels.js +286 -0
  30. package/lib/component/EventsTrackers/KeysListenerTracker.js +14 -1
  31. package/lib/component/context/PrepareExportContext.d.ts +21 -0
  32. package/lib/component/context/PrepareExportContext.js +124 -0
  33. package/lib/component/context/ShareDataContext.d.ts +10 -0
  34. package/lib/component/context/ShareDataContext.js +22 -0
  35. package/lib/component/elements/ActionsButtonsPopover.d.ts +10 -0
  36. package/lib/component/elements/ActionsButtonsPopover.js +22 -0
  37. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +7 -5
  38. package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -2
  39. package/lib/component/elements/SVGButton.d.ts +14 -0
  40. package/lib/component/elements/SVGButton.js +6 -0
  41. package/lib/component/elements/SVGGroup.js +15 -13
  42. package/lib/component/elements/SVGText.d.ts +8 -0
  43. package/lib/component/elements/SVGText.js +24 -0
  44. package/lib/component/elements/draggable/SVGDraggable.d.ts +2 -2
  45. package/lib/component/elements/formik/FormikInput.d.ts +2 -1
  46. package/lib/component/elements/formik/FormikInput.js +4 -3
  47. package/lib/component/header/Header.js +7 -10
  48. package/lib/component/hooks/useActiveSpectrumZonesViewState.js +1 -0
  49. package/lib/component/hooks/useCheckPointsNumberInWindowArea.d.ts +1 -1
  50. package/lib/component/hooks/useExport.d.ts +1 -1
  51. package/lib/component/hooks/useExport.js +4 -4
  52. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
  53. package/lib/component/hooks/useFormatNumberByNucleus.js +8 -7
  54. package/lib/component/hooks/useIntegralPath.d.ts +2 -0
  55. package/lib/component/hooks/useIntegralPath.js +3 -1
  56. package/lib/component/hooks/usePanelPreferences.d.ts +2 -3
  57. package/lib/component/hooks/usePanelPreferences.js +4 -3
  58. package/lib/component/hooks/useSaveSettings.js +7 -14
  59. package/lib/component/hooks/useToggleSpectraVisibility.d.ts +10 -0
  60. package/lib/component/hooks/useToggleSpectraVisibility.js +41 -0
  61. package/lib/component/hooks/useTriggerNewAssignmentLabel.d.ts +4 -0
  62. package/lib/component/hooks/useTriggerNewAssignmentLabel.js +8 -0
  63. package/lib/component/hooks/useWorkspaceAction.d.ts +7 -0
  64. package/lib/component/hooks/useWorkspaceAction.js +89 -0
  65. package/lib/component/loader/DropZone.js +0 -3
  66. package/lib/component/main/InnerNMRium.js +3 -1
  67. package/lib/component/main/InnerNMRiumContents.js +14 -2
  68. package/lib/component/main/NMRiumStateProvider.js +4 -2
  69. package/lib/component/modal/editRange/forms/components/DeltaInput.js +3 -3
  70. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +17 -12
  71. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +30 -13
  72. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +26 -16
  73. package/lib/component/modal/setting/GeneralSettings.js +7 -21
  74. package/lib/component/modal/setting/WorkspaceItem.js +1 -1
  75. package/lib/component/modal/setting/settings-tabs/NucleiTabContent.d.ts +2 -0
  76. package/lib/component/modal/setting/settings-tabs/NucleiTabContent.js +99 -0
  77. package/lib/component/modal/setting/settingsValidation.js +36 -40
  78. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.d.ts +2 -2
  79. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +121 -36
  80. package/lib/component/panels/Panels.js +1 -1
  81. package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +4 -27
  82. package/lib/component/panels/SpectraPanel/SpectraPreferences.js +13 -1
  83. package/lib/component/panels/SpectraPanel/base/setting/PlotChart.js +1 -1
  84. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DHistogram.js +1 -1
  85. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.d.ts +6 -0
  86. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.js +16 -0
  87. package/lib/component/panels/ZonesPanel/ZonesPanel.js +18 -2
  88. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +15 -9
  89. package/lib/component/panels/ZonesPanel/ZonesTable.js +2 -2
  90. package/lib/component/panels/ZonesPanel/ZonesTableRow.js +3 -2
  91. package/lib/component/panels/databasePanel/DatabaseTable.js +2 -2
  92. package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +1 -1
  93. package/lib/component/reducer/IgnoreActions.js +1 -0
  94. package/lib/component/reducer/Reducer.d.ts +6 -0
  95. package/lib/component/reducer/Reducer.js +6 -0
  96. package/lib/component/reducer/actions/DomainActions.d.ts +12 -4
  97. package/lib/component/reducer/actions/DomainActions.js +35 -5
  98. package/lib/component/reducer/actions/FiltersActions.js +2 -2
  99. package/lib/component/reducer/actions/LoadActions.js +5 -2
  100. package/lib/component/reducer/actions/RangesActions.js +12 -6
  101. package/lib/component/reducer/actions/SpectraActions.d.ts +1 -0
  102. package/lib/component/reducer/actions/SpectraActions.js +7 -2
  103. package/lib/component/reducer/actions/ZonesActions.d.ts +15 -2
  104. package/lib/component/reducer/actions/ZonesActions.js +47 -13
  105. package/lib/component/reducer/helper/setRangesViewProperty.d.ts +1 -0
  106. package/lib/component/reducer/helper/setRangesViewProperty.js +11 -11
  107. package/lib/component/reducer/preferences/actions/addWorkspace.js +4 -23
  108. package/lib/component/reducer/preferences/actions/analyzeSpectra.js +4 -4
  109. package/lib/component/reducer/preferences/actions/initPreferences.js +2 -4
  110. package/lib/component/reducer/preferences/actions/matrixGeneration.d.ts +47 -2
  111. package/lib/component/reducer/preferences/actions/matrixGeneration.js +63 -26
  112. package/lib/component/reducer/preferences/actions/removeWorkspace.js +0 -5
  113. package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +0 -4
  114. package/lib/component/reducer/preferences/actions/setPanelsPreferences.js +1 -1
  115. package/lib/component/reducer/preferences/actions/setPreferences.js +2 -16
  116. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts +5 -2
  117. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +17 -1
  118. package/lib/component/reducer/preferences/preferencesReducer.d.ts +9 -25
  119. package/lib/component/reducer/preferences/preferencesReducer.js +28 -19
  120. package/lib/component/toolbar/ToolBar.js +23 -20
  121. package/lib/component/utility/PathBuilder.d.ts +1 -0
  122. package/lib/component/utility/PathBuilder.js +8 -1
  123. package/lib/component/utility/PreferencesHelper.js +5 -4
  124. package/lib/component/utility/export.js +4 -0
  125. package/lib/component/workspaces/assignment.js +0 -1
  126. package/lib/component/workspaces/basic.js +0 -1
  127. package/lib/component/workspaces/embedded.js +0 -1
  128. package/lib/component/workspaces/exercise.js +26 -29
  129. package/lib/component/workspaces/prediction.js +171 -174
  130. package/lib/component/workspaces/process1D.js +0 -1
  131. package/lib/component/workspaces/simulation.js +35 -38
  132. package/lib/component/workspaces/workspaceDefaultProperties.js +9 -11
  133. package/lib/data/types/common/DeepPartial.d.ts +3 -0
  134. package/lib/data/types/common/DeepPartial.js +1 -0
  135. package/lib/versionInfo.js +1 -1
  136. package/package.json +39 -39
  137. package/lib/component/elements/CustomToolTip.d.ts +0 -8
  138. package/lib/component/elements/CustomToolTip.js +0 -107
  139. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.d.ts +0 -2
  140. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +0 -80
  141. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +0 -2
  142. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.js +0 -10
@@ -3,11 +3,11 @@ import { SvgNmrAlignBottom, SvgNmrAlignCenter, SvgNmrApodization, SvgNmrBaseline
3
3
  import { useCallback } from 'react';
4
4
  import { FaSearchPlus, FaExpand, FaDiceFour, FaFileImport, FaFileExport, } from 'react-icons/fa';
5
5
  import { PiKnifeBold } from 'react-icons/pi';
6
- import { Toolbar } from 'react-science/ui';
6
+ import { Toolbar, TooltipHelpContent, } 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 { CustomToolTip } from '../elements/CustomToolTip';
10
+ import { usePreferences } from '../context/PreferencesContext';
11
11
  import { ToolbarPopoverItem, } from '../elements/ToolbarPopoverItem';
12
12
  import useCheckExperimentalFeature from '../hooks/useCheckExperimentalFeature';
13
13
  import { useCheckToolsVisibility, } from '../hooks/useCheckToolsVisibility';
@@ -49,6 +49,7 @@ export default function ToolBar() {
49
49
  const exportMenu = isExperimentalFeature
50
50
  ? EXPORT_MENU
51
51
  : EXPORT_MENU.filter((item) => item.id !== 'nmre');
52
+ const { current: { general: { invert }, }, } = usePreferences();
52
53
  const handleOnFFTFilter = useCallback(() => {
53
54
  dispatch({
54
55
  type: 'APPLY_FFT_FILTER',
@@ -85,7 +86,7 @@ export default function ToolBar() {
85
86
  function exportHandler(data) {
86
87
  switch (data?.id) {
87
88
  case 'svg':
88
- void saveAsSVGHandler();
89
+ saveAsSVGHandler();
89
90
  break;
90
91
  case 'png':
91
92
  void saveAsPNGHandler();
@@ -110,8 +111,8 @@ export default function ToolBar() {
110
111
  title: options.zoom.label,
111
112
  subTitles: [
112
113
  { title: 'Vertical', shortcuts: ['Scroll wheel'] },
113
- { title: 'Horizontal', shortcuts: ['Shift', 'Scroll wheel'] },
114
- { title: 'Pan', shortcuts: ['Right mouse'] },
114
+ { title: 'Horizontal', shortcuts: ['⇧', 'Scroll wheel'] },
115
+ { title: 'Pan', shortcuts: ['Right button'] },
115
116
  ],
116
117
  },
117
118
  icon: _jsx(FaSearchPlus, {}),
@@ -124,7 +125,7 @@ export default function ToolBar() {
124
125
  { title: 'Horizontal', shortcuts: ['f'] },
125
126
  { title: 'Horizontal and Vertical', shortcuts: ['f', 'f'] },
126
127
  ],
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.',
128
+ 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
129
  link: 'https://docs.nmrium.org/help/zoom-and-scale',
129
130
  },
130
131
  onClick: handleFullZoomOut,
@@ -135,7 +136,7 @@ export default function ToolBar() {
135
136
  tooltip: {
136
137
  title: options.peakPicking.label,
137
138
  shortcuts: ['p'],
138
- description: 'You can detect peaks manually or automatically in the spectrum.',
139
+ description: 'Detect peaks manually or automatically in the spectrum.',
139
140
  link: 'https://docs.nmrium.org/20_1d-spectra/peaks/peaks',
140
141
  },
141
142
  icon: _jsx(SvgNmrPeakPicking, {}),
@@ -145,7 +146,7 @@ export default function ToolBar() {
145
146
  tooltip: {
146
147
  title: options.integral.label,
147
148
  shortcuts: ['i'],
148
- description: 'To calculate the integration, hold Shift and left-click, then drag over the signal range.',
149
+ 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
150
  link: 'https://docs.nmrium.org/help/integrations',
150
151
  },
151
152
  icon: _jsx(SvgNmrIntegrate, {}),
@@ -155,7 +156,7 @@ export default function ToolBar() {
155
156
  tooltip: {
156
157
  title: options.zonePicking.label,
157
158
  shortcuts: ['r'],
158
- description: 'You can detect zones manually by selecting, holding Shift,left-click, dragging, and then releasing. Alternatively, detect zones automatically.',
159
+ description: `Draw 2D zones by clicking, dragging, and releasing${!invert ? 'while holding SHIFT' : ''}. Alternatively, detect zones automatically.`,
159
160
  link: 'https://docs.nmrium.org/30_2d-spectra/zones/zones',
160
161
  },
161
162
  icon: _jsx(FaDiceFour, {}),
@@ -164,7 +165,7 @@ export default function ToolBar() {
164
165
  id: 'slicing',
165
166
  tooltip: {
166
167
  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.',
168
+ description: 'Display the horizontal and vertical slices of the selected 2D spectrum at the level of the pointer.',
168
169
  link: 'https://docs.nmrium.org/30_2d-spectra/slicing/slicing',
169
170
  },
170
171
  icon: _jsx(PiKnifeBold, {}),
@@ -174,7 +175,7 @@ export default function ToolBar() {
174
175
  tooltip: {
175
176
  title: options.rangePicking.label,
176
177
  shortcuts: ['r'],
177
- description: 'You can detect ranges manually by selecting, holding Shift,left-click, dragging, and then releasing. Alternatively, detect ranges automatically.',
178
+ 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
179
  link: 'https://docs.nmrium.org/20_1d-spectra/ranges/ranges',
179
180
  },
180
181
  icon: _jsx(SvgNmrRangePicking, {}),
@@ -191,6 +192,7 @@ export default function ToolBar() {
191
192
  tooltip: {
192
193
  title: options.apodization.label,
193
194
  shortcuts: ['a'],
195
+ description: 'Apply mathematical function that the FID is multiplied by before Fourier Transform.',
194
196
  },
195
197
  icon: _jsx(SvgNmrApodization, {}),
196
198
  },
@@ -199,7 +201,7 @@ export default function ToolBar() {
199
201
  tooltip: {
200
202
  title: options.zeroFilling.label,
201
203
  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.',
204
+ 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
205
  link: 'https://docs.nmrium.org/20_1d-spectra/preprocessing/preprocessing#zero-filling',
204
206
  },
205
207
  icon: _jsx(SvgNmrZeroFilling, {}),
@@ -209,7 +211,7 @@ export default function ToolBar() {
209
211
  tooltip: {
210
212
  title: options.phaseCorrection.label,
211
213
  shortcuts: ['a'],
212
- description: 'To phase the spectrum after the FFT.',
214
+ 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
215
  link: 'https://docs.nmrium.org/20_1d-spectra/phase/phase',
214
216
  },
215
217
  icon: _jsx(SvgNmrPhaseCorrection, {}),
@@ -228,7 +230,7 @@ export default function ToolBar() {
228
230
  tooltip: {
229
231
  title: options.baselineCorrection.label,
230
232
  shortcuts: ['b'],
231
- description: 'To process the spectrum to be a straight line at zero absorbance.',
233
+ description: `Correct the baseline of the spectrum. You should draw zones corresponding to the noise using click, drag, release${!invert ? 'while holding SHIFT' : ''}.`,
232
234
  link: 'https://docs.nmrium.org/20_1d-spectra/baseline/baseline',
233
235
  },
234
236
  icon: _jsx(SvgNmrBaselineCorrection, {}),
@@ -238,6 +240,7 @@ export default function ToolBar() {
238
240
  tooltip: {
239
241
  title: options.exclusionZones.label,
240
242
  shortcuts: ['e'],
243
+ description: `Define exclusion zones by clicking, dragging, releasing${!invert ? ' while holding SHIFT' : ''}. This option is practical for excluding large peaks like solvents.`,
241
244
  },
242
245
  icon: _jsx(SvgNmrMultipleAnalysis, {}),
243
246
  checkOptions: { checkSpectrumType: false },
@@ -248,7 +251,7 @@ export default function ToolBar() {
248
251
  tooltip: {
249
252
  title: options.fft.label,
250
253
  shortcuts: ['t'],
251
- description: 'To process the FID to FT spectrum.',
254
+ description: 'Perform a Fourier transform on the FID.',
252
255
  link: 'https://docs.nmrium.org/20_1d-spectra/ft/ft/',
253
256
  },
254
257
  onClick: handleOnFFTFilter,
@@ -285,7 +288,7 @@ export default function ToolBar() {
285
288
  tooltip: {
286
289
  title: options.spectraStackAlignments.label,
287
290
  shortcuts: ['s'],
288
- description: 'To display the spectra in a stack mode.',
291
+ description: 'Toggle between stack mode and all the spectra aligned at the bottom.',
289
292
  },
290
293
  icon: verticalAlign === 'stack' ? (_jsx(SvgNmrOverlay3Aligned, {})) : (_jsx(SvgNmrOverlay3, {})),
291
294
  condition: ftCounter > 1,
@@ -295,7 +298,7 @@ export default function ToolBar() {
295
298
  id: 'realImaginary',
296
299
  tooltip: {
297
300
  title: `Display ${isRealSpectrumShown ? 'real' : 'imaginary'}`,
298
- description: 'To switch between imaginary and real part of the spectrum.',
301
+ description: 'Toggle between the imaginary and real parts of the spectrum.',
299
302
  link: 'https://docs.nmrium.org/20_1d-spectra/views/views',
300
303
  },
301
304
  icon: _jsx(SvgNmrRealImag, {}),
@@ -306,7 +309,7 @@ export default function ToolBar() {
306
309
  tooltip: {
307
310
  title: `Baseline ${verticalAlign === 'bottom' ? 'center' : 'bottom'}`,
308
311
  shortcuts: ['c'],
309
- description: 'To align the spectra in the centre or at the bottom of the displayer.',
312
+ description: 'Toggle between alignment of the spectra in the center or at the bottom of the display.',
310
313
  },
311
314
  icon: verticalAlign === 'bottom' ? (_jsx(SvgNmrAlignCenter, {})) : (_jsx(SvgNmrAlignBottom, {})),
312
315
  condition: ftCounter > 0 || fidCounter > 0,
@@ -321,12 +324,12 @@ export default function ToolBar() {
321
324
  return null;
322
325
  if (isPopoverToolItem(item)) {
323
326
  const { menuItems, onClick } = item;
324
- return (_jsx(ToolbarPopoverItem, { options: menuItems, tooltip: typeof tooltip === 'string' ? (tooltip) : (_jsx(CustomToolTip, { ...tooltip })), tooltipProps: {
327
+ return (_jsx(ToolbarPopoverItem, { options: menuItems, tooltip: typeof tooltip === 'string' ? (tooltip) : (_jsx(TooltipHelpContent, { ...tooltip })), tooltipProps: {
325
328
  minimal: true,
326
329
  }, id: id, active: selectedTool === id, icon: icon, onClick: onClick }, id));
327
330
  }
328
331
  const { onClick } = item;
329
- return (_jsx(Toolbar.Item, { onClick: onClick || (() => handleChange(id)), tooltip: typeof tooltip === 'string' ? (tooltip) : (_jsx(CustomToolTip, { ...tooltip })), tooltipProps: {
332
+ return (_jsx(Toolbar.Item, { onClick: onClick || (() => handleChange(id)), tooltip: typeof tooltip === 'string' ? (tooltip) : (_jsx(TooltipHelpContent, { ...tooltip })), tooltipProps: {
330
333
  minimal: true,
331
334
  }, id: id, active: selectedTool === id, icon: icon }, id));
332
335
  }) })] }));
@@ -4,4 +4,5 @@ export declare class PathBuilder {
4
4
  lineTo(x: number, y: number): void;
5
5
  closePath(): void;
6
6
  toString(): string;
7
+ concatPath(pathBuilder: PathBuilder): string;
7
8
  }
@@ -19,11 +19,18 @@ export class PathBuilder {
19
19
  toString() {
20
20
  return this.array.join(' ');
21
21
  }
22
+ concatPath(pathBuilder) {
23
+ return this.array.concat(pathBuilder.array).join(' ');
24
+ }
22
25
  }
23
26
  /**
24
27
  * Clamp values to avoid rendering issues of the SVG.
25
28
  * This assumes that the viewport has pixel coordinates (so the max values are outside of the visible area)
26
29
  */
27
30
  function clamp(value) {
28
- return Math.max(-1e5, Math.min(1e5, value));
31
+ if (value < -1e5)
32
+ return -1e5;
33
+ if (value > 1e5)
34
+ return 1e5;
35
+ return value;
29
36
  }
@@ -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
  },