nmrium 0.50.1 → 0.51.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 (151) hide show
  1. package/lib/component/1d/Chart1D.js +1 -1
  2. package/lib/component/1d/LinesSeries.js +2 -2
  3. package/lib/component/1d/Viewer1D.js +6 -11
  4. package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
  5. package/lib/component/2d/1d-tracer/HorizontalSliceChart.js +6 -2
  6. package/lib/component/2d/1d-tracer/VerticalSliceChart.js +8 -1
  7. package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraceWithMouse.js +2 -21
  8. package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraces.js +1 -1
  9. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.d.ts +1 -1
  10. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.js +6 -17
  11. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.d.ts +6 -10
  12. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js +62 -13
  13. package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.d.ts +1 -0
  14. package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.js +2 -1
  15. package/lib/component/2d/Viewer2D.js +16 -15
  16. package/lib/component/2d/ft/Contours.js +6 -3
  17. package/lib/component/2d/utilities/scale.d.ts +2 -1
  18. package/lib/component/2d/utilities/scale.js +12 -2
  19. package/lib/component/EventsTrackers/BrushTracker.d.ts +5 -3
  20. package/lib/component/EventsTrackers/BrushTracker.js +2 -2
  21. package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +1 -1
  22. package/lib/component/EventsTrackers/KeysListenerTracker.js +29 -15
  23. package/lib/component/context/ToasterContext.d.ts +13 -0
  24. package/lib/component/context/ToasterContext.js +34 -0
  25. package/lib/component/elements/Select.js +2 -2
  26. package/lib/component/elements/ToolbarPopoverItem.js +1 -1
  27. package/lib/component/header/AutoPeakPickingOptionPanel.js +6 -3
  28. package/lib/component/header/Header.d.ts +1 -11
  29. package/lib/component/header/Header.js +5 -6
  30. package/lib/component/header/PhaseCorrectionPanel.js +24 -33
  31. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.d.ts +1 -1
  32. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +96 -42
  33. package/lib/component/header/RangesPickingOptionPanel.js +6 -3
  34. package/lib/component/hooks/useDialogToggle.d.ts +5 -0
  35. package/lib/component/hooks/useDialogToggle.js +16 -0
  36. package/lib/component/hooks/useExport.d.ts +9 -1
  37. package/lib/component/hooks/useExport.js +34 -36
  38. package/lib/component/hooks/useSaveSettings.js +6 -3
  39. package/lib/component/hooks/useToolsFunctions.js +6 -4
  40. package/lib/component/loader/DropZone.js +14 -14
  41. package/lib/component/main/InnerNMRium.js +5 -9
  42. package/lib/component/main/InnerNMRiumContents.d.ts +0 -2
  43. package/lib/component/main/InnerNMRiumContents.js +5 -3
  44. package/lib/component/main/NMRium.js +2 -2
  45. package/lib/component/modal/AboutPredictionModal.js +1 -1
  46. package/lib/component/modal/ExportAsJcampModal.js +15 -15
  47. package/lib/component/modal/ImportPublicationStringModal.js +5 -3
  48. package/lib/component/modal/LoadJCAMPModal.js +6 -4
  49. package/lib/component/modal/PredictSpectraModal.js +11 -9
  50. package/lib/component/modal/SaveAsModal.d.ts +3 -4
  51. package/lib/component/modal/SaveAsModal.js +27 -27
  52. package/lib/component/modal/editRange/EditRangeModal.js +2 -2
  53. package/lib/component/modal/editRange/forms/components/DeltaInput.d.ts +2 -3
  54. package/lib/component/modal/editRange/forms/components/DeltaInput.js +2 -3
  55. package/lib/component/modal/editRange/forms/components/InfoBlock.d.ts +1 -0
  56. package/lib/component/modal/editRange/forms/components/{SignalFormInfo.js → InfoBlock.js} +2 -2
  57. package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts +5 -0
  58. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +85 -0
  59. package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +7 -0
  60. package/lib/component/modal/editRange/forms/components/SignalTab.js +24 -0
  61. package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +8 -0
  62. package/lib/component/modal/editRange/forms/components/SignalsContent.js +57 -0
  63. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.d.ts +5 -0
  64. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +133 -0
  65. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.d.ts +5 -0
  66. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +141 -0
  67. package/lib/component/modal/metaImportation/MetaImportationModal.d.ts +7 -4
  68. package/lib/component/modal/metaImportation/MetaImportationModal.js +23 -13
  69. package/lib/component/modal/metaImportation/utils/mapColumnToSelectItems.js +1 -1
  70. package/lib/component/modal/setting/GeneralSettings.js +7 -4
  71. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -4
  72. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +13 -7
  73. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +6 -4
  74. package/lib/component/panels/PeaksPanel/PeaksPanel.js +6 -3
  75. package/lib/component/panels/RangesPanel/RangesHeader.js +3 -3
  76. package/lib/component/panels/RangesPanel/RangesPanel.js +4 -4
  77. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -3
  78. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +11 -5
  79. package/lib/component/panels/databasePanel/DatabasePanel.js +37 -19
  80. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +1 -1
  81. package/lib/component/panels/filtersPanel/FilterPanel.js +5 -3
  82. package/lib/component/panels/filtersPanel/FiltersTable.js +27 -23
  83. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +6 -4
  84. package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +2 -2
  85. package/lib/component/panels/multipleAnalysisPanel/AnalysisChart.js +3 -3
  86. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +5 -5
  87. package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +4 -2
  88. package/lib/component/panels/predictionPanel/PredictionPanel.js +7 -5
  89. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -0
  90. package/lib/component/reducer/Reducer.d.ts +2 -2
  91. package/lib/component/reducer/Reducer.js +23 -16
  92. package/lib/component/reducer/actions/FiltersActions.d.ts +11 -4
  93. package/lib/component/reducer/actions/FiltersActions.js +243 -91
  94. package/lib/component/reducer/actions/IntegralsActions.js +2 -2
  95. package/lib/component/reducer/actions/MoleculeActions.js +0 -1
  96. package/lib/component/reducer/actions/RangesActions.js +16 -6
  97. package/lib/component/reducer/actions/ToolsActions.d.ts +3 -3
  98. package/lib/component/reducer/actions/ToolsActions.js +75 -14
  99. package/lib/component/reducer/helper/Zoom1DManager.d.ts +4 -3
  100. package/lib/component/reducer/helper/Zoom1DManager.js +4 -4
  101. package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -5
  102. package/lib/component/reducer/helper/findStrongestPeak.d.ts +6 -0
  103. package/lib/component/reducer/helper/findStrongestPeak.js +13 -0
  104. package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.d.ts +2 -1
  105. package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.js +7 -1
  106. package/lib/component/toolbar/ToolBar.js +17 -12
  107. package/lib/component/utility/Events.d.ts +11 -0
  108. package/lib/component/utility/Events.js +22 -0
  109. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -33
  110. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -15
  111. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -4
  112. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +1 -1
  113. package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
  114. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts +6 -4
  115. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +13 -3
  116. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +6 -0
  117. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts +13 -3
  118. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +78 -18
  119. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +2 -2
  120. package/lib/data/data1d/spectrumSimulation.d.ts +1 -1
  121. package/lib/data/data2d/Spectrum2D/contours.js +3 -3
  122. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +2 -2
  123. package/lib/data/data2d/Spectrum2D/getSlice.js +3 -3
  124. package/lib/data/getDefaultMatrixFilters.js +2 -2
  125. package/lib/data/matrixGeneration.js +1 -1
  126. package/lib/data/utilities/calculateSanPlot.d.ts +1 -6
  127. package/lib/versionInfo.js +1 -1
  128. package/package.json +31 -30
  129. package/lib/component/elements/popup/Alert/AlertBlock.d.ts +0 -8
  130. package/lib/component/elements/popup/Alert/AlertBlock.js +0 -30
  131. package/lib/component/elements/popup/Alert/Context.d.ts +0 -27
  132. package/lib/component/elements/popup/Alert/Context.js +0 -10
  133. package/lib/component/elements/popup/Alert/ProgressIndicator.d.ts +0 -1
  134. package/lib/component/elements/popup/Alert/ProgressIndicator.js +0 -33
  135. package/lib/component/elements/popup/Alert/Provider.d.ts +0 -19
  136. package/lib/component/elements/popup/Alert/Provider.js +0 -127
  137. package/lib/component/elements/popup/Alert/index.d.ts +0 -3
  138. package/lib/component/elements/popup/Alert/index.js +0 -3
  139. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +0 -10
  140. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +0 -81
  141. package/lib/component/modal/editRange/forms/components/CouplingsTable.d.ts +0 -13
  142. package/lib/component/modal/editRange/forms/components/CouplingsTable.js +0 -63
  143. package/lib/component/modal/editRange/forms/components/SignalFormInfo.d.ts +0 -1
  144. package/lib/component/modal/editRange/forms/components/SignalFormTab.d.ts +0 -8
  145. package/lib/component/modal/editRange/forms/components/SignalFormTab.js +0 -18
  146. package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +0 -10
  147. package/lib/component/modal/editRange/forms/components/SignalsForm.js +0 -114
  148. package/lib/component/modal/metaImportation/index.d.ts +0 -2
  149. package/lib/component/modal/metaImportation/index.js +0 -17
  150. package/lib/component/reducer/helper/getStrongestPeak.d.ts +0 -7
  151. package/lib/component/reducer/helper/getStrongestPeak.js +0 -15
@@ -1,3 +1,5 @@
1
+ import { optimizePeaksWithLogs } from 'ml-gsd';
2
+ import { xMaxValue } from 'ml-spectra-processing';
1
3
  import { analyseMultiplet } from 'multiplet-analysis';
2
4
  import { signalJoinCouplings, xyAutoPeaksPicking, } from 'nmr-processing';
3
5
  export function detectSignalsByMultipletAnalysis(data, options) {
@@ -6,6 +8,55 @@ export function detectSignalsByMultipletAnalysis(data, options) {
6
8
  x: data.x.slice(fromIndex, toIndex),
7
9
  y: data.y.slice(fromIndex, toIndex),
8
10
  };
11
+ const from = data.x[fromIndex];
12
+ const to = data.x[toIndex];
13
+ const peaks = xyAutoPeaksPicking(data, {
14
+ from,
15
+ to,
16
+ frequency,
17
+ minMaxRatio: 0.1,
18
+ broadWidth: 0.25,
19
+ broadRatio: 0.0025,
20
+ optimize: true,
21
+ smoothY: true,
22
+ });
23
+ if (peaks.length === 0) {
24
+ return [];
25
+ }
26
+ let cs = 0;
27
+ let area = 0;
28
+ for (const peak of peaks) {
29
+ cs += peak.x * peak.y;
30
+ area += peak.y;
31
+ }
32
+ cs /= area;
33
+ const initialWidth = Math.abs(peaks[0].x - (peaks.at(-1) || peaks[0]).x);
34
+ const { logs, optimizedPeaks } = optimizePeaksWithLogs(dataRoi, [
35
+ {
36
+ x: cs,
37
+ y: xMaxValue(dataRoi.y),
38
+ width: initialWidth,
39
+ parameters: {
40
+ width: { max: initialWidth * 4, min: initialWidth * 0.8 },
41
+ },
42
+ },
43
+ ], { shape: { kind: 'pseudoVoigt' }, optimization: { kind: 'lm' } });
44
+ const log = logs.find((l) => l.message === 'optimization successful');
45
+ if (log) {
46
+ const { error } = log;
47
+ if (error < 0.2) {
48
+ return [
49
+ {
50
+ multiplicity: 's',
51
+ kind: 'signal',
52
+ delta: cs,
53
+ js: [],
54
+ peaks: optimizedPeaks,
55
+ diaIDs: [],
56
+ },
57
+ ];
58
+ }
59
+ }
9
60
  const result = analyseMultiplet(dataRoi, {
10
61
  frequency,
11
62
  minimalResolution: 0.1,
@@ -20,34 +71,43 @@ export function detectSignalsByMultipletAnalysis(data, options) {
20
71
  if (result && result.chemShift === undefined)
21
72
  return [];
22
73
  const { delta, js } = joinCouplings(result);
23
- let cs = 0;
24
- let area = 0;
25
- for (let i = 0; i < dataRoi.x.length; i++) {
26
- cs += dataRoi.x[i] * dataRoi.y[i];
27
- area += dataRoi.y[i];
28
- }
29
- cs /= area;
30
- const peaks = xyAutoPeaksPicking(dataRoi, { frequency });
31
- const multiplicity = getMultiplicity(js, { cs, delta, peaks });
74
+ const { jCouplings, multiplicity } = getMultiplicity(js, peaks);
32
75
  return [
33
76
  {
34
77
  multiplicity,
35
78
  kind: 'signal',
36
- delta: cs,
37
- js,
79
+ delta,
80
+ js: jCouplings,
38
81
  peaks,
39
82
  diaIDs: [],
40
83
  },
41
84
  ];
42
85
  }
43
- function getMultiplicity(js, options) {
44
- const { cs, delta, peaks } = options;
45
- if (js?.length > 0) {
46
- return js.map((j) => j.multiplicity).join('');
86
+ function getMultiplicity(js, peaks) {
87
+ if (peaks.length > 1) {
88
+ if (js?.length > 0) {
89
+ return {
90
+ jCouplings: js,
91
+ multiplicity: js.map((j) => j.multiplicity).join(''),
92
+ };
93
+ }
94
+ return {
95
+ jCouplings: [],
96
+ multiplicity: 'm',
97
+ };
98
+ }
99
+ if (peaks.length === 1) {
100
+ return {
101
+ jCouplings: [],
102
+ multiplicity: js.length > 0 ? 'br s' : 's',
103
+ };
104
+ }
105
+ else {
106
+ return {
107
+ jCouplings: [],
108
+ multiplicity: 'm',
109
+ };
47
110
  }
48
- //check if the massive center is closer to the shift from multiplet-analysis,
49
- //if true, is it possibly a singlet.
50
- return peaks.length === 1 && Math.abs(cs - delta) / cs < 1e-3 ? 's' : 'm';
51
111
  }
52
112
  function joinCouplings(result) {
53
113
  const { chemShift: delta, js } = result;
@@ -11,9 +11,9 @@ export declare function initiateRanges(inputSpectrum: Partial<Spectrum1D>, spect
11
11
  delta: number;
12
12
  multiplicity: string;
13
13
  js: import("nmr-processing").Jcoupling[];
14
- diaIDs?: string[] | undefined;
15
14
  atoms?: number[] | undefined;
16
15
  assignment?: string | undefined;
16
+ diaIDs?: string[] | undefined;
17
17
  nbAtoms?: number | undefined;
18
18
  integration?: number | undefined;
19
19
  statistic?: {
@@ -44,8 +44,8 @@ export declare function initiateRanges(inputSpectrum: Partial<Spectrum1D>, spect
44
44
  integration: number;
45
45
  nbAtoms?: number | undefined;
46
46
  multiplicity?: string | undefined;
47
- diaIDs?: string[] | undefined;
48
47
  assignment?: string | undefined;
48
+ diaIDs?: string[] | undefined;
49
49
  pubIntegral?: number | undefined;
50
50
  }[];
51
51
  };
@@ -11,4 +11,4 @@ export interface SpectrumSimulationOptions {
11
11
  }
12
12
  export declare const defaultSimulationOptions: SpectrumSimulationOptions;
13
13
  export declare function getSpinSystems(): string[];
14
- export declare function simulateSpectrum(spinSystem: string, options: SpectrumSimulationOptions): import("cheminfo-types").DataXY<import("cheminfo-types").DoubleArray>;
14
+ export declare function simulateSpectrum(spinSystem: string, options: SpectrumSimulationOptions): import("cheminfo-types").DataXY<Float64Array>;
@@ -27,17 +27,17 @@ function contoursManager(spectrumID, state, options) {
27
27
  spectraLevels[spectrumID] = defaultLevel;
28
28
  }
29
29
  const currentLevel = spectraLevels[spectrumID];
30
- const wheel = (value, shiftKey) => prepareWheel(value, { shiftKey, contourOptions, currentLevel });
30
+ const wheel = (value, altKey) => prepareWheel(value, { altKey, contourOptions, currentLevel });
31
31
  const getLevel = () => currentLevel;
32
32
  const checkLevel = () => prepareCheckLevel(currentLevel, contourOptions);
33
33
  return { wheel, getLevel, checkLevel };
34
34
  }
35
35
  function prepareWheel(value, options) {
36
- const { shiftKey, currentLevel, contourOptions } = options;
36
+ const { altKey, currentLevel, contourOptions } = options;
37
37
  const sign = Math.sign(value);
38
38
  const positiveBoundary = contourOptions.positive.contourLevels;
39
39
  const negativeBoundary = contourOptions.negative.contourLevels;
40
- if (shiftKey) {
40
+ if (altKey) {
41
41
  if ((currentLevel.positive === positiveBoundary[0] && sign === -1) ||
42
42
  (currentLevel.positive >= positiveBoundary[1] && sign === 1)) {
43
43
  return currentLevel;
@@ -1,4 +1,4 @@
1
- import { zoneToX } from 'ml-spectra-processing';
1
+ import { xSequentialFillFromTo } from 'ml-spectra-processing';
2
2
  import { initiateDatum1D } from '../../data1d/Spectrum1D';
3
3
  /**
4
4
  * calculate the missing projection
@@ -23,7 +23,7 @@ export function getProjection(datum, index) {
23
23
  }
24
24
  }
25
25
  return {
26
- x: zoneToX({ from, to }, nbPoints),
26
+ x: xSequentialFillFromTo({ from, to, size: nbPoints }),
27
27
  re: projection,
28
28
  };
29
29
  }
@@ -1,4 +1,4 @@
1
- import { zoneToX } from 'ml-spectra-processing';
1
+ import { xSequentialFillFromTo } from 'ml-spectra-processing';
2
2
  import { initiateDatum1D } from '../../data1d/Spectrum1D';
3
3
  const BASE_INFO = {
4
4
  isFid: false,
@@ -60,9 +60,9 @@ export function getSlice(spectrum, position, options = {}) {
60
60
  const vertical = initiateDatum1D({ info: infoY, data: dataY });
61
61
  return { horizontal, vertical };
62
62
  }
63
- function initiateData(from, to, length) {
63
+ function initiateData(from, to, size) {
64
64
  return {
65
- x: zoneToX({ from, to }, length),
65
+ x: xSequentialFillFromTo({ from, to, size }),
66
66
  re: new Float64Array(length),
67
67
  };
68
68
  }
@@ -2,7 +2,7 @@ import filterXY from 'ml-signal-processing/FilterXYSchema.json';
2
2
  export function getDefaultMatrixFilters() {
3
3
  // get filters information & default options values
4
4
  return filterXY.anyOf
5
- .filter(({ properties }) => properties.name.enum[0] !== 'equallySpaced')
5
+ .filter(({ properties }) => properties.name.const !== 'equallySpaced')
6
6
  .map(({ properties }) => {
7
7
  const options = {};
8
8
  for (const [key, value] of Object.entries(properties?.options?.properties || {})) {
@@ -13,7 +13,7 @@ export function getDefaultMatrixFilters() {
13
13
  };
14
14
  }
15
15
  return {
16
- name: properties.name.enum[0],
16
+ name: properties.name.const,
17
17
  options,
18
18
  };
19
19
  });
@@ -78,7 +78,7 @@ export function getMatrixFilters() {
78
78
  for (const filter of filterXY.anyOf) {
79
79
  const filterData = filter.properties;
80
80
  const filterProperties = filterData?.options;
81
- const name = filterData.name.enum[0];
81
+ const name = filterData.name.const;
82
82
  if (!IGNORED_FILERS.has(name)) {
83
83
  const properties = flattenFields(name, filterProperties?.properties, {}, [], null, 0);
84
84
  result.push({
@@ -1,7 +1,2 @@
1
1
  import { NmrData2DFt, NmrData1D } from 'cheminfo-types';
2
- export declare function calculateSanPlot<T extends '1D' | '2D'>(dimension: T, data: T extends '1D' ? NmrData1D : NmrData2DFt['rr']): {
3
- positive: number;
4
- negative: number;
5
- snr: number;
6
- sanplot: Record<string, import("cheminfo-types").DataXY<import("cheminfo-types").DoubleArray>>;
7
- };
2
+ export declare function calculateSanPlot<T extends '1D' | '2D'>(dimension: T, data: T extends '1D' ? NmrData1D : NmrData2DFt['rr']): import("ml-spectra-processing").XNoiseSanPlotResult;
@@ -1 +1 @@
1
- export default { version: 'v0.50.1' };
1
+ export default { version: 'v0.51.0' };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nmrium",
3
3
  "description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
4
- "version": "0.50.1",
4
+ "version": "0.51.0",
5
5
  "license": "MIT",
6
6
  "module": "lib/component/main/index.js",
7
7
  "types": "lib/component/main/index.d.ts",
@@ -57,22 +57,23 @@
57
57
  "react-dom": ">=18.0.0"
58
58
  },
59
59
  "dependencies": {
60
- "@blueprintjs/core": "^5.9.1",
61
- "@blueprintjs/icons": "^5.7.1",
62
- "@emotion/react": "^11.11.3",
60
+ "@blueprintjs/core": "^5.10.0",
61
+ "@blueprintjs/icons": "^5.8.0",
62
+ "@blueprintjs/select": "^5.1.2",
63
+ "@emotion/react": "^11.11.4",
63
64
  "@emotion/styled": "^11.11.0",
64
65
  "@lukeed/uuid": "^2.0.1",
65
66
  "cheminfo-font": "^1.13.0",
66
- "cheminfo-types": "^1.7.2",
67
+ "cheminfo-types": "^1.7.3",
67
68
  "clipboard-polyfill": "^4.0.2",
68
- "convert-to-jcamp": "^5.4.9",
69
- "d3": "^7.8.5",
69
+ "convert-to-jcamp": "^5.4.10",
70
+ "d3": "^7.9.0",
70
71
  "eventemitter3": "^5.0.1",
71
72
  "fifo-logger": "^0.6.1",
72
73
  "file-saver": "^2.0.5",
73
74
  "filelist-utils": "^1.11.0",
74
75
  "formik": "^2.4.5",
75
- "immer": "^10.0.3",
76
+ "immer": "^10.0.4",
76
77
  "jszip": "^3.10.1",
77
78
  "lodash": "^4.17.21",
78
79
  "ml-array-max": "^1.2.4",
@@ -81,24 +82,24 @@
81
82
  "ml-array-xy-equally-spaced": "^1.2.1",
82
83
  "ml-baseline-correction-regression": "^1.0.2",
83
84
  "ml-conrec": "^5.0.2",
84
- "ml-gsd": "^12.1.3",
85
+ "ml-gsd": "^12.1.6",
85
86
  "ml-matrix": "^6.11.0",
86
- "ml-spectra-processing": "^12.10.2",
87
+ "ml-spectra-processing": "^14.2.2",
87
88
  "ml-stat": "^1.3.3",
88
89
  "ml-tree-similarity": "^2.2.0",
89
90
  "multiplet-analysis": "^2.1.2",
90
91
  "nmr-correlation": "^2.3.3",
91
- "nmr-load-save": "^0.27.3",
92
- "nmr-processing": "^11.10.1",
92
+ "nmr-load-save": "^0.28.0",
93
+ "nmr-processing": "^12.0.1",
93
94
  "nmredata": "^0.9.9",
94
95
  "numeral": "^2.0.6",
95
- "openchemlib": "^8.8.1",
96
- "openchemlib-utils": "^5.9.0",
96
+ "openchemlib": "^8.9.0",
97
+ "openchemlib-utils": "^5.12.1",
97
98
  "papaparse": "^5.4.1",
98
99
  "re-resizable": "6.9.11",
99
100
  "react-d3-utils": "^1.0.0",
100
101
  "react-dropzone": "^14.2.3",
101
- "react-error-boundary": "^4.0.12",
102
+ "react-error-boundary": "^4.0.13",
102
103
  "react-icons": "^5.0.1",
103
104
  "react-inspector": "^6.0.2",
104
105
  "react-mf": "^2.0.2",
@@ -106,48 +107,48 @@
106
107
  "react-ocl-nmr": "^3.0.1",
107
108
  "react-plot": "^1.4.2",
108
109
  "react-rnd": "^10.4.1",
109
- "react-science": "^0.36.0",
110
+ "react-science": "^1.0.2",
110
111
  "react-slider": "^2.0.6",
111
112
  "react-table": "^7.8.0",
112
113
  "react-transition-group": "^4.4.5",
113
114
  "react-use": "^17.5.0",
114
115
  "smart-array-filter": "^4.0.2",
115
- "yup": "^1.3.3"
116
+ "yup": "^1.4.0"
116
117
  },
117
118
  "devDependencies": {
118
119
  "@babel/plugin-transform-modules-commonjs": "^7.23.3",
119
120
  "@babel/preset-react": "^7.23.3",
120
121
  "@babel/preset-typescript": "^7.23.3",
121
- "@playwright/test": "^1.41.2",
122
+ "@playwright/test": "^1.42.1",
122
123
  "@simbathesailor/use-what-changed": "^2.0.0",
123
124
  "@types/d3": "^7.4.3",
124
- "@types/lodash": "^4.14.202",
125
- "@types/node": "^20.11.19",
125
+ "@types/lodash": "^4.17.0",
126
+ "@types/node": "^20.11.28",
126
127
  "@types/papaparse": "^5.3.14",
127
- "@types/react": "^18.2.57",
128
- "@types/react-dom": "^18.2.19",
128
+ "@types/react": "^18.2.66",
129
+ "@types/react-dom": "^18.2.22",
129
130
  "@types/react-table": "^7.7.19",
130
131
  "@vitejs/plugin-react-swc": "^3.6.0",
131
- "@vitest/coverage-v8": "^1.3.1",
132
+ "@vitest/coverage-v8": "^1.4.0",
132
133
  "cross-env": "^7.0.3",
133
- "cspell": "^8.4.1",
134
- "eslint": "^8.56.0",
134
+ "cspell": "^8.6.0",
135
+ "eslint": "^8.57.0",
135
136
  "eslint-config-cheminfo-react": "^10.1.0",
136
137
  "eslint-config-cheminfo-typescript": "^12.2.0",
137
138
  "modern-normalize": "^2.0.0",
138
139
  "postcss-styled-syntax": "^0.6.4",
139
140
  "prettier": "^3.2.5",
140
- "rc-menu": "^9.12.4",
141
+ "rc-menu": "^9.13.0",
141
142
  "react": "^18.2.0",
142
143
  "react-dom": "^18.2.0",
143
- "react-router-dom": "^6.22.1",
144
+ "react-router-dom": "^6.22.3",
144
145
  "rimraf": "^5.0.5",
145
146
  "rollup-plugin-analyzer": "^4.0.0",
146
147
  "serve": "^14.2.1",
147
148
  "stylelint": "^16.2.1",
148
149
  "stylelint-config-standard": "^36.0.0",
149
- "typescript": "^5.3.3",
150
- "vite": "^5.1.3",
151
- "vitest": "^1.3.1"
150
+ "typescript": "^5.4.2",
151
+ "vite": "^5.1.6",
152
+ "vitest": "^1.4.0"
152
153
  }
153
154
  }
@@ -1,8 +0,0 @@
1
- import { Alert } from './Context';
2
- interface AlertBlockProps {
3
- offset: string;
4
- alert: Alert;
5
- onClose: () => void;
6
- }
7
- export default function AlertBlock(props: AlertBlockProps): import("@emotion/react/jsx-runtime").JSX.Element;
8
- export {};
@@ -1,30 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
- /** @jsxImportSource @emotion/react */
3
- import { css } from '@emotion/react';
4
- import { FaTimes } from 'react-icons/fa';
5
- import { types } from '../options';
6
- import ProgressIndicator from './ProgressIndicator';
7
- const style = css `
8
- padding: 25px;
9
- border-radius: 10px;
10
- pointer-events: all;
11
- min-height: 60px;
12
- position: relative;
13
-
14
- > button {
15
- position: absolute;
16
- right: 5px;
17
- top: 5px;
18
- border: none;
19
- background-color: transparent;
20
- color: white;
21
- }
22
- `;
23
- export default function AlertBlock(props) {
24
- const { offset, alert, onClose } = props;
25
- return (_jsxs("div", { css: style, style: {
26
- margin: offset,
27
- backgroundColor: alert.options.backgroundColor,
28
- color: alert.options.color,
29
- }, children: [_jsx("button", { type: "button", onClick: onClose, children: _jsx(FaTimes, {}) }), _jsx("span", { children: alert.message }), alert.options.type === types.PROGRESS_INDICATOR && _jsx(ProgressIndicator, {})] }, alert.id));
30
- }
@@ -1,27 +0,0 @@
1
- /// <reference types="react" />
2
- import { Position, Type } from '../options';
3
- export interface AlertOption {
4
- position?: Position;
5
- timeout?: number;
6
- type?: Type;
7
- /** CSS string color */
8
- backgroundColor?: string;
9
- /** CSS string color */
10
- color?: string;
11
- onOpen?: () => void;
12
- }
13
- export interface Alert {
14
- id: string;
15
- message?: string;
16
- options: AlertOption;
17
- close: () => void;
18
- }
19
- export interface AlertAPI {
20
- show: (message?: string, options?: AlertOption) => Alert;
21
- success: (message?: string, options?: AlertOption) => Alert;
22
- error: (message?: string, options?: AlertOption) => Alert;
23
- info: (message?: string, options?: AlertOption) => Alert;
24
- showLoading: (message?: string, options?: AlertOption) => Promise<() => void>;
25
- }
26
- export declare const AlertProvider: import("react").Provider<AlertAPI | null>;
27
- export declare function useAlert(): AlertAPI;
@@ -1,10 +0,0 @@
1
- import { createContext, useContext } from 'react';
2
- const AlertContext = createContext(null);
3
- export const AlertProvider = AlertContext.Provider;
4
- export function useAlert() {
5
- const context = useContext(AlertContext);
6
- if (!context) {
7
- throw new Error('useAlert should be mount into an AlertProvider');
8
- }
9
- return context;
10
- }
@@ -1 +0,0 @@
1
- export default function ProgressIndicator(): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,33 +0,0 @@
1
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
- /** @jsxImportSource @emotion/react */
3
- import { css } from '@emotion/react';
4
- const styles = css `
5
- width: 40px;
6
- height: 40px;
7
- margin: 0 auto;
8
-
9
- ::after {
10
- content: ' ';
11
- display: block;
12
- width: 30px;
13
- height: 30px;
14
- margin-top: 10px;
15
- border-radius: 50%;
16
- border: 4px solid;
17
- border-color: #fff transparent;
18
- animation: ring-animation 1s linear infinite;
19
- }
20
-
21
- @keyframes ring-animation {
22
- 0% {
23
- transform: rotate(0deg);
24
- }
25
-
26
- 100% {
27
- transform: rotate(360deg);
28
- }
29
- }
30
- `;
31
- export default function ProgressIndicator() {
32
- return _jsx("div", { css: styles });
33
- }
@@ -1,19 +0,0 @@
1
- import { CSSProperties, ReactNode } from 'react';
2
- import { Position, Type, Transition as TransitionOption } from '../options';
3
- interface ProviderProps {
4
- children: ReactNode;
5
- offset?: string;
6
- position?: Position;
7
- timeout?: number;
8
- type?: Type;
9
- transition?: TransitionOption;
10
- containerStyle?: CSSProperties;
11
- wrapperRef?: any;
12
- context?: {
13
- Provider?: any;
14
- Consumer?: any;
15
- };
16
- }
17
- declare function Provider({ children, wrapperRef, offset, position, timeout, type, transition, ...props }: ProviderProps): import("react/jsx-runtime").JSX.Element;
18
- declare const _default: import("react").MemoExoticComponent<typeof Provider>;
19
- export default _default;
@@ -1,127 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import groupBy from 'lodash/groupBy';
3
- import { Fragment, useState, useRef, useEffect, useCallback, useMemo, memo, } from 'react';
4
- import { createPortal } from 'react-dom';
5
- import { TransitionGroup } from 'react-transition-group';
6
- import Transition from '../Transition';
7
- import Wrapper from '../Wrapper';
8
- import { positions, transitions, types, } from '../options';
9
- import AlertBlock from './AlertBlock';
10
- import { AlertProvider } from './Context';
11
- function Provider({ children, wrapperRef = null, offset = '5px', position = positions.BOTTOM_CENTER, timeout = 3000, type, transition = transitions.FADE, ...props }) {
12
- const root = useRef(null);
13
- const timersId = useRef([]);
14
- const [alerts, setAlerts] = useState([]);
15
- useEffect(() => {
16
- root.current = document.createElement('div');
17
- const ref = root.current;
18
- const timersIdRef = timersId.current;
19
- if (wrapperRef) {
20
- wrapperRef.append(ref);
21
- }
22
- return () => {
23
- if (ref && wrapperRef) {
24
- for (const id of timersIdRef) {
25
- clearTimeout(id);
26
- }
27
- ref.remove();
28
- }
29
- };
30
- }, [wrapperRef]);
31
- const remove = useCallback((alert) => {
32
- setAlerts((currentAlerts) => {
33
- const lengthBeforeRemove = currentAlerts.length;
34
- const filteredAlerts = currentAlerts.filter((a) => a.id !== alert.id);
35
- if (lengthBeforeRemove > filteredAlerts.length && alert.options.onClose) {
36
- alert.options.onClose();
37
- }
38
- return filteredAlerts;
39
- });
40
- }, []);
41
- const show = useCallback((message = '', options = {}) => {
42
- const id = Math.random().toString(36).slice(2, 9);
43
- const alertOptions = {
44
- position: options.position || position,
45
- timeout,
46
- type,
47
- backgroundColor: 'black',
48
- color: 'white',
49
- ...options,
50
- };
51
- const alert = {
52
- id,
53
- message,
54
- options: alertOptions,
55
- close: () => remove(alert),
56
- };
57
- if (alert.options.timeout) {
58
- const timerId = window.setTimeout(() => {
59
- remove(alert);
60
- timersId.current.splice(timersId.current.indexOf(timerId), 1);
61
- }, alert.options.timeout);
62
- timersId.current.push(timerId);
63
- }
64
- setAlerts((state) => state.concat(alert));
65
- if (alert.options.onOpen)
66
- alert.options.onOpen();
67
- return alert;
68
- }, [position, remove, timeout, type]);
69
- const success = useCallback((message = '', options = {}) => {
70
- options.type = types.SUCCESS;
71
- options = { backgroundColor: '#28ba62', color: 'white', ...options };
72
- return show(message, options);
73
- }, [show]);
74
- const error = useCallback((message = '', options = {}) => {
75
- const alertOptions = {
76
- type: types.ERROR,
77
- backgroundColor: '#cf3c4f',
78
- color: 'white',
79
- timeout: 0,
80
- ...options,
81
- };
82
- return show(message, alertOptions);
83
- }, [show]);
84
- const info = useCallback((message = '', options = {}) => {
85
- const alertOptions = {
86
- type: types.INFO,
87
- backgroundColor: '#28ba62',
88
- ...options,
89
- };
90
- return show(message, alertOptions);
91
- }, [show]);
92
- const showLoading = useCallback((message = 'Process in progress', options = {}) => {
93
- const alertOptions = {
94
- type: types.PROGRESS_INDICATOR,
95
- backgroundColor: '#232323',
96
- timeout: 0,
97
- ...options,
98
- };
99
- return new Promise((resolve) => {
100
- const alert = show(message, alertOptions);
101
- setTimeout(() => {
102
- resolve(() => remove(alert));
103
- }, 500);
104
- });
105
- }, [remove, show]);
106
- const closeHandler = useCallback((alert) => {
107
- remove(alert);
108
- }, [remove]);
109
- const alertsByPosition = groupBy(alerts, (alert) => alert.options.position);
110
- const parentStyle = wrapperRef
111
- ? wrapperRef.getBoundingClientRect()
112
- : {
113
- top: 0,
114
- left: 0,
115
- width: window.innerWidth,
116
- height: window.innerHeight,
117
- };
118
- const alertContextValue = useMemo(() => ({ show, success, error, info, showLoading }), [show, success, error, info, showLoading]);
119
- return (_jsxs(AlertProvider, { value: alertContextValue, children: [children, root.current &&
120
- createPortal(_jsx(Fragment, { children: Object.keys(positions).map((key) => {
121
- const position = positions[key];
122
- return (_jsx(TransitionGroup, { appear: true, options: { position, zIndex: 999999 }, component: Wrapper, containerStyle: parentStyle, ...props, children: alertsByPosition[position]
123
- ? alertsByPosition[position].map((alert) => (_jsx(Transition, { type: transition, children: _jsx(AlertBlock, { offset: offset, alert: alert, onClose: () => closeHandler(alert) }) }, alert.id)))
124
- : null }, position));
125
- }) }), root.current)] }));
126
- }
127
- export default memo(Provider);
@@ -1,3 +0,0 @@
1
- export { positions, types, transitions } from '../options';
2
- export { useAlert } from './Context';
3
- export { default as AlertProvider } from './Provider';
@@ -1,3 +0,0 @@
1
- export { positions, types, transitions } from '../options';
2
- export { useAlert } from './Context';
3
- export { default as AlertProvider } from './Provider';