nmrium 0.19.1 → 0.20.1

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 (118) hide show
  1. package/lib/component/1d/Chart1D.js +3 -3
  2. package/lib/component/1d/ExclusionZoneAnnotation.d.ts +11 -0
  3. package/lib/component/1d/ExclusionZoneAnnotation.js +18 -0
  4. package/lib/component/1d/ExclusionZonesAnnotations.d.ts +3 -0
  5. package/lib/component/1d/ExclusionZonesAnnotations.js +28 -0
  6. package/lib/component/1d/Line.js +11 -23
  7. package/lib/component/1d/Viewer1D.js +36 -5
  8. package/lib/component/1d/ranges/Ranges.js +3 -3
  9. package/lib/component/1d/{BaseLineZones.d.ts → tool/BaseLineZones.d.ts} +0 -0
  10. package/lib/component/1d/{BaseLineZones.js → tool/BaseLineZones.js} +5 -5
  11. package/lib/component/1d/utilities/useIntegralPath.js +9 -10
  12. package/lib/component/2d/Contours.js +12 -11
  13. package/lib/component/2d/Left1DChart.js +7 -9
  14. package/lib/component/2d/Top1DChart.js +7 -7
  15. package/lib/component/2d/tools/slicing/HorizontalSliceChart.js +7 -7
  16. package/lib/component/2d/tools/slicing/VerticalSliceChart.js +7 -9
  17. package/lib/component/EventsTrackers/BrushTracker.js +2 -2
  18. package/lib/component/EventsTrackers/KeysListenerTracker.js +12 -3
  19. package/lib/component/NMRium.d.ts +1 -1
  20. package/lib/component/NMRium.js +28 -25
  21. package/lib/component/hooks/useActiveSpectrumStyleOptions.d.ts +6 -0
  22. package/lib/component/hooks/useActiveSpectrumStyleOptions.js +15 -0
  23. package/lib/component/hooks/useXYReduce.d.ts +2 -1
  24. package/lib/component/loader/DropZone.js +1 -1
  25. package/lib/component/modal/ModalStyle.js +5 -2
  26. package/lib/component/modal/MoleculeStructureEditorModal.js +3 -2
  27. package/lib/component/modal/MultipleSpectraFiltersModal/index.js +10 -1
  28. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.d.ts +2 -0
  29. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +35 -0
  30. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +49 -67
  31. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -8
  32. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -23
  33. package/lib/component/panels/Panels.js +10 -0
  34. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +1 -1
  35. package/lib/component/panels/ZonesPanel/ZonesTable.js +9 -2
  36. package/lib/component/reducer/Reducer.d.ts +0 -16
  37. package/lib/component/reducer/Reducer.js +4 -5
  38. package/lib/component/reducer/actions/FiltersActions.d.ts +3 -1
  39. package/lib/component/reducer/actions/FiltersActions.js +60 -18
  40. package/lib/component/reducer/actions/LoadActions.js +2 -3
  41. package/lib/component/reducer/actions/MoleculeActions.js +2 -2
  42. package/lib/component/reducer/actions/PreferencesActions.js +4 -7
  43. package/lib/component/reducer/actions/RangesActions.js +1 -1
  44. package/lib/component/reducer/actions/ToolsActions.d.ts +1 -3
  45. package/lib/component/reducer/actions/ToolsActions.js +1 -30
  46. package/lib/component/reducer/helper/getRange.d.ts +6 -1
  47. package/lib/component/reducer/helper/getRange.js +1 -1
  48. package/lib/component/toolbar/FunctionToolBar.js +2 -5
  49. package/lib/component/utility/PathBuilder.d.ts +7 -0
  50. package/lib/component/utility/PathBuilder.js +17 -0
  51. package/lib/component/utility/getSpectraByNucleus.d.ts +3 -0
  52. package/lib/component/utility/getSpectraByNucleus.js +4 -0
  53. package/lib/data/Filters.d.ts +2 -1
  54. package/lib/data/Filters.js +2 -1
  55. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -2
  56. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -1
  57. package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +0 -1
  58. package/lib/data/data1d/Spectrum1D/ranges/detectSignal.d.ts +3 -2
  59. package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +23 -15
  60. package/lib/data/data1d/filter1d/exclusionZones.d.ts +16 -0
  61. package/lib/data/data1d/filter1d/exclusionZones.js +28 -0
  62. package/lib/data/types/data1d/ExclusionZone.d.ts +5 -0
  63. package/lib/data/types/data1d/ExclusionZone.js +1 -0
  64. package/lib/versionInfo.js +1 -1
  65. package/lib-cjs/component/1d/Chart1D.js +3 -3
  66. package/lib-cjs/component/1d/ExclusionZoneAnnotation.js +23 -0
  67. package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +52 -0
  68. package/lib-cjs/component/1d/Line.js +11 -23
  69. package/lib-cjs/component/1d/Viewer1D.js +36 -5
  70. package/lib-cjs/component/1d/ranges/Ranges.js +1 -1
  71. package/lib-cjs/component/1d/{BaseLineZones.js → tool/BaseLineZones.js} +5 -5
  72. package/lib-cjs/component/1d/utilities/useIntegralPath.js +9 -10
  73. package/lib-cjs/component/2d/Contours.js +12 -11
  74. package/lib-cjs/component/2d/Left1DChart.js +7 -9
  75. package/lib-cjs/component/2d/Top1DChart.js +7 -7
  76. package/lib-cjs/component/2d/tools/slicing/HorizontalSliceChart.js +7 -7
  77. package/lib-cjs/component/2d/tools/slicing/VerticalSliceChart.js +7 -9
  78. package/lib-cjs/component/EventsTrackers/BrushTracker.js +2 -2
  79. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +12 -3
  80. package/lib-cjs/component/NMRium.js +28 -25
  81. package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +21 -0
  82. package/lib-cjs/component/loader/DropZone.js +1 -1
  83. package/lib-cjs/component/modal/ModalStyle.js +5 -2
  84. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +3 -2
  85. package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +10 -1
  86. package/lib-cjs/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +40 -0
  87. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +48 -66
  88. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -8
  89. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -22
  90. package/lib-cjs/component/panels/Panels.js +10 -0
  91. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +1 -1
  92. package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +8 -1
  93. package/lib-cjs/component/reducer/Reducer.js +4 -5
  94. package/lib-cjs/component/reducer/actions/FiltersActions.js +62 -18
  95. package/lib-cjs/component/reducer/actions/LoadActions.js +2 -3
  96. package/lib-cjs/component/reducer/actions/MoleculeActions.js +2 -2
  97. package/lib-cjs/component/reducer/actions/PreferencesActions.js +4 -7
  98. package/lib-cjs/component/reducer/actions/RangesActions.js +1 -1
  99. package/lib-cjs/component/reducer/actions/ToolsActions.js +1 -32
  100. package/lib-cjs/component/reducer/helper/getRange.js +1 -1
  101. package/lib-cjs/component/toolbar/FunctionToolBar.js +2 -5
  102. package/lib-cjs/component/utility/PathBuilder.js +21 -0
  103. package/lib-cjs/component/utility/getSpectraByNucleus.js +11 -0
  104. package/lib-cjs/data/Filters.js +3 -1
  105. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +5 -2
  106. package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -1
  107. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectRange.js +0 -1
  108. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +24 -15
  109. package/lib-cjs/data/data1d/filter1d/exclusionZones.js +34 -0
  110. package/lib-cjs/data/types/data1d/ExclusionZone.js +2 -0
  111. package/lib-cjs/versionInfo.js +1 -1
  112. package/package.json +21 -21
  113. package/lib/component/1d/ExclusionZone.d.ts +0 -8
  114. package/lib/component/1d/ExclusionZone.js +0 -30
  115. package/lib/component/1d/ExclusionZones.d.ts +0 -2
  116. package/lib/component/1d/ExclusionZones.js +0 -10
  117. package/lib-cjs/component/1d/ExclusionZone.js +0 -32
  118. package/lib-cjs/component/1d/ExclusionZones.js +0 -16
@@ -61,9 +61,6 @@ function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, displ
61
61
  const isButtonVisible = (0, react_1.useCallback)((toolKey) => {
62
62
  return !(0, get_1.default)(preferences, `display.toolBarButtons.${toolKey}`);
63
63
  }, [preferences]);
64
- const isPanelVisible = (0, react_1.useCallback)((panelKey) => {
65
- return !(0, get_1.default)(preferences, `display.panels.${panelKey}`);
66
- }, [preferences]);
67
64
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(ToggleButtonGroup_1.default, { value: option, onChange: handleChange, children: [isButtonVisible('hideZoomTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zoom.id, id: "zoomIn", title: `${ToolTypes_1.options.zoom.label} ( Press z )`, children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 14 }, children: (0, jsx_runtime_1.jsx)(fa_1.FaSearchPlus, {}, void 0) }, void 0) }, ToolTypes_1.options.zoom.id)), isButtonVisible('hideZoomOutTool') && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "zoom-out", onClick: handleFullZoomOut, title: "Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )", children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 14 }, children: (0, jsx_runtime_1.jsx)(fa_1.FaExpand, {}, void 0) }, void 0) }, void 0)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
68
65
  isButtonVisible('hidePeakTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.peakPicking.id, title: `${ToolTypes_1.options.peakPicking.label} ( Press p )`, isVisible: activeSpectrum && !info?.isFid ? true : false, id: "peakPicking", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrPeakPicking, {}, void 0) }, ToolTypes_1.options.peakPicking.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
69
66
  isButtonVisible('hideIntegralTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.integral.id, isVisible: activeSpectrum && !info?.isFid ? true : false, id: "integralPicking", title: `${ToolTypes_1.options.integral.label} ( Press i )`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrIntegrate, {}, void 0) }, ToolTypes_1.options.integral.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_2D &&
@@ -85,8 +82,8 @@ function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, displ
85
82
  ? true
86
83
  : false, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrBaselineCorrection, {}, void 0) }, ToolTypes_1.options.baseLineCorrection.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
87
84
  isButtonVisible('hideExclusionZonesTool') &&
88
- isPanelVisible('hideMultipleSpectraAnalysisPanel') &&
89
- !info?.isFid && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.exclusionZones.id, title: ToolTypes_1.options.exclusionZones.label, id: "exclusionZones", children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 18 }, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrMultipleAnalysis, {}, void 0) }, void 0) }, ToolTypes_1.options.exclusionZones.id))] }, void 0), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
85
+ !info?.isFid &&
86
+ ftCounter > 0 && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.exclusionZones.id, title: `${ToolTypes_1.options.exclusionZones.label} ( Press e )`, id: "exclusionZones", children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 18 }, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrMultipleAnalysis, {}, void 0) }, void 0) }, ToolTypes_1.options.exclusionZones.id))] }, void 0), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
90
87
  isButtonVisible('hideFFTTool') &&
91
88
  info &&
92
89
  Filters.fft.isApplicable({ info }) && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "fft-filter", className: "cheminfo", title: "FFT Filter", onClick: handleOnFFTFilter, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFourierTransform, {}, void 0) }, void 0))] }, void 0));
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PathBuilder = void 0;
4
+ class PathBuilder {
5
+ constructor() {
6
+ this.array = [];
7
+ }
8
+ moveTo(x, y) {
9
+ this.array.push(`M ${x} ${y}`);
10
+ }
11
+ lineTo(x, y) {
12
+ this.array.push(`L ${x} ${y}`);
13
+ }
14
+ closePath() {
15
+ this.array.push('Z');
16
+ }
17
+ toString() {
18
+ return this.array.join(' ');
19
+ }
20
+ }
21
+ exports.PathBuilder = PathBuilder;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getSpectraByNucleus = void 0;
7
+ const nucleusToString_1 = __importDefault(require("./nucleusToString"));
8
+ function getSpectraByNucleus(nucleus, data) {
9
+ return data.filter((spectrum) => (0, nucleusToString_1.default)(spectrum.info.nucleus) === nucleus);
10
+ }
11
+ exports.getSpectraByNucleus = getSpectraByNucleus;
@@ -19,7 +19,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
19
  return result;
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.shift2DY = exports.shift2DX = exports.pareto = exports.centerMean = exports.standardDeviation = exports.equallySpaced = exports.fromTo = exports.digitalFilter = exports.zeroFilling = exports.shiftX = exports.autoPhaseCorrection = exports.phaseCorrection = exports.fft = exports.lineBroadening = exports.baselineCorrection = exports.absolute = void 0;
22
+ exports.shift2DY = exports.shift2DX = exports.exclusionZones = exports.pareto = exports.centerMean = exports.standardDeviation = exports.equallySpaced = exports.fromTo = exports.digitalFilter = exports.zeroFilling = exports.shiftX = exports.autoPhaseCorrection = exports.phaseCorrection = exports.fft = exports.lineBroadening = exports.baselineCorrection = exports.absolute = void 0;
23
23
  const absolute = __importStar(require("./data1d/filter1d/absolute"));
24
24
  exports.absolute = absolute;
25
25
  const autoPhaseCorrection = __importStar(require("./data1d/filter1d/autoPhaseCorrection"));
@@ -32,6 +32,8 @@ const digitalFilter = __importStar(require("./data1d/filter1d/digitalFilter"));
32
32
  exports.digitalFilter = digitalFilter;
33
33
  const equallySpaced = __importStar(require("./data1d/filter1d/equallySpaced"));
34
34
  exports.equallySpaced = equallySpaced;
35
+ const exclusionZones = __importStar(require("./data1d/filter1d/exclusionZones"));
36
+ exports.exclusionZones = exclusionZones;
35
37
  const fft = __importStar(require("./data1d/filter1d/fft"));
36
38
  exports.fft = fft;
37
39
  const fromTo = __importStar(require("./data1d/filter1d/fromTo"));
@@ -15,14 +15,17 @@ function addRange(datum, options) {
15
15
  const { from, to, molecules, nucleus } = options;
16
16
  const { x, re } = datum.data;
17
17
  const absolute = (0, ml_spectra_processing_1.xyIntegration)({ x, y: re }, { from, to, reverse: true });
18
- const signals = (0, detectSignal_1.default)(x, re, from, to, datum.info.originFrequency);
18
+ // detectSignal use the advance multiplet-analysis that can crash if too many points
19
+ const signal = (0, detectSignal_1.default)(x, re, from, to, datum.info.originFrequency);
20
+ if (!signal)
21
+ return;
19
22
  try {
20
23
  const range = {
21
24
  id: (0, generateID_1.default)(),
22
25
  from,
23
26
  to,
24
27
  absolute,
25
- signals: [{ id: (0, generateID_1.default)(), ...signals }],
28
+ signals: [{ id: (0, generateID_1.default)(), ...signal }],
26
29
  kind: SignalsKinds_1.DatumKind.signal,
27
30
  integration: 0,
28
31
  };
@@ -32,12 +32,17 @@ function autoRangesDetection(datum1D, options = {}) {
32
32
  re = re.slice(windowFromIndex, windowToIndex);
33
33
  }
34
34
  if (originFrequency) {
35
- let ws = Math.max(Math.round(1 / originFrequency / (x[1] - x[0])), 5);
35
+ // we calculate the number of points per Hz
36
+ let pointsPerHz = 1 / originFrequency / (x[1] - x[0]);
37
+ // we can consider a peak with of 0.5 Hz for the windowSize
38
+ let ws = Math.max(Math.round(pointsPerHz / 2), 5);
36
39
  peakPickingOptions.sgOptions = {
37
40
  windowSize: ws - (ws % 2) + 1,
38
41
  polynomial: 3,
39
42
  };
40
43
  }
44
+ peakPickingOptions.smoothY = undefined;
45
+ peakPickingOptions.sgOptions = undefined;
41
46
  const ranges = (0, nmr_processing_1.xyAutoRangesPicking)({ x, y: re }, {
42
47
  peakPicking: peakPickingOptions,
43
48
  ranges: rangesOptions,
@@ -11,7 +11,6 @@ function detectRange(datum, options) {
11
11
  const { from, to } = options;
12
12
  const { x, re: y } = datum.data;
13
13
  const absolute = (0, ml_spectra_processing_1.xyIntegration)({ x, y }, { from, to, reverse: true });
14
- // @ts-expect-error Types will be fixed in ml-spectra-processing.
15
14
  const min = (0, ml_spectra_processing_1.xyMinYPoint)({ x, y }, { from, to }).y;
16
15
  const max = (0, ml_spectra_processing_1.xyMaxYPoint)({ x, y }, { from, to }).y;
17
16
  const shiftX = (0, getShiftX_1.getShiftX)(datum);
@@ -1,26 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAX_LENGTH = void 0;
3
4
  const ml_spectra_processing_1 = require("ml-spectra-processing");
4
5
  const multiplet_analysis_1 = require("multiplet-analysis");
6
+ exports.MAX_LENGTH = 2048;
5
7
  function detectSignal(x, re, from, to, frequency) {
6
8
  const { fromIndex, toIndex } = (0, ml_spectra_processing_1.xGetFromToIndex)(x, {
7
9
  from: from,
8
10
  to: to,
9
11
  });
10
- const data = {
11
- x: x.slice(fromIndex, toIndex),
12
- y: re.slice(fromIndex, toIndex),
13
- };
14
- const result = (0, multiplet_analysis_1.analyseMultiplet)(data, {
15
- frequency: frequency,
16
- takeBestPartMultiplet: true,
17
- symmetrizeEachStep: true,
18
- });
19
- return {
20
- multiplicity: result.js.map((j) => j.multiplicity).join(''),
21
- kind: 'signal',
22
- delta: result.chemShift,
23
- js: result.js,
24
- };
12
+ if (toIndex - fromIndex <= exports.MAX_LENGTH) {
13
+ const data = {
14
+ x: x.subarray(fromIndex, toIndex),
15
+ y: re.subarray(fromIndex, toIndex),
16
+ };
17
+ const result = (0, multiplet_analysis_1.analyseMultiplet)(data, {
18
+ frequency: frequency,
19
+ takeBestPartMultiplet: true,
20
+ symmetrizeEachStep: true,
21
+ });
22
+ if (result && result.chemShift === undefined)
23
+ return;
24
+ return {
25
+ multiplicity: result.js.map((j) => j.multiplicity).join(''),
26
+ kind: 'signal',
27
+ delta: result.chemShift,
28
+ js: result.js,
29
+ };
30
+ }
31
+ else {
32
+ throw new Error(`length of signal should not exceed ${exports.MAX_LENGTH} points`);
33
+ }
25
34
  }
26
35
  exports.default = detectSignal;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reduce = exports.isApplicable = exports.apply = exports.name = exports.id = void 0;
4
+ const ml_spectra_processing_1 = require("ml-spectra-processing");
5
+ exports.id = 'exclusionZones';
6
+ exports.name = 'Exclusion Zones';
7
+ /**
8
+ *
9
+ * @param {Datum1d} datum1d
10
+ */
11
+ function apply(datum1D, zones = []) {
12
+ if (!isApplicable(datum1D)) {
13
+ throw new Error('Exclusion Zones filter not applicable on this data');
14
+ }
15
+ const { x, re, im } = datum1D.data;
16
+ datum1D.data.re = (0, ml_spectra_processing_1.xySetYValue)({ x, y: re }, { zones }).y;
17
+ datum1D.data.im = (im
18
+ ? (0, ml_spectra_processing_1.xySetYValue)({ x, y: re }, { zones })
19
+ : im);
20
+ }
21
+ exports.apply = apply;
22
+ function isApplicable(datum1D) {
23
+ if (datum1D.info.isComplex && datum1D.info.isFt)
24
+ return true;
25
+ return false;
26
+ }
27
+ exports.isApplicable = isApplicable;
28
+ function reduce(previousValue, newValue) {
29
+ return {
30
+ once: true,
31
+ reduce: (0, ml_spectra_processing_1.zonesNormalize)(previousValue.concat(newValue)),
32
+ };
33
+ }
34
+ exports.reduce = reduce;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = { version: 'v0.19.1' };
3
+ exports.default = { version: 'v0.20.1' };
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.19.1",
4
+ "version": "0.20.1",
5
5
  "license": "MIT",
6
6
  "main": "lib-cjs/component/NMRium.js",
7
7
  "module": "lib/component/NMRium.js",
@@ -14,10 +14,10 @@
14
14
  "build": "vite build --outDir build",
15
15
  "build-no-minify": "cross-env NO_MINIFY=true npm run build",
16
16
  "build-with-profiling": "cross-env WITH_PROFILING=true npm run build",
17
- "check-types": "tsc --noEmit",
17
+ "check-types": "tsc --project tsconfig.esm.json",
18
18
  "compile": "tsc --project tsconfig.esm.json && tsc --project tsconfig.cjs.json",
19
19
  "clean-lib": "rimraf lib lib-cjs",
20
- "dev": "vite --host localhost --strictPort --open",
20
+ "dev": "vite --host localhost --port 3000 --strictPort --open",
21
21
  "eslint": "eslint . --cache",
22
22
  "eslint-fix": "npm run eslint -- --fix",
23
23
  "install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start",
@@ -38,7 +38,7 @@
38
38
  "url": "git+https://github.com/cheminfo/nmrium.git"
39
39
  },
40
40
  "volta": {
41
- "node": "16.13.2"
41
+ "node": "16.14.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "react": ">=16.0.0",
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@emotion/react": "^11.7.1",
49
- "analysis-ui-components": "^0.9.2",
49
+ "analysis-ui-components": "^0.10.1",
50
50
  "cheminfo-font": "^1.8.1",
51
51
  "cheminfo-types": "^0.9.1",
52
52
  "d3": "^7.3.0",
@@ -56,7 +56,7 @@
56
56
  "immer": "^9.0.12",
57
57
  "jszip": "^3.7.1",
58
58
  "lodash": "^4.17.21",
59
- "mf-parser": "^1.4.0",
59
+ "mf-parser": "^1.4.4",
60
60
  "ml-airpls": "^1.0.0",
61
61
  "ml-array-max": "^1.2.4",
62
62
  "ml-array-mean": "^1.1.6",
@@ -65,28 +65,28 @@
65
65
  "ml-baseline-correction-regression": "^1.0.0",
66
66
  "ml-conrec": "^3.2.1",
67
67
  "ml-gsd": "^9.1.0",
68
- "ml-spectra-processing": "^8.1.0",
68
+ "ml-spectra-processing": "^10.1.2",
69
69
  "ml-stat": "^1.3.3",
70
70
  "multiplet-analysis": "^2.0.0",
71
71
  "nmr-correlation": "^2.2.0",
72
72
  "nmr-parser": "^1.7.2",
73
- "nmr-processing": "^6.0.4",
73
+ "nmr-processing": "^6.0.8",
74
74
  "nmredata": "^0.6.1",
75
75
  "numeral": "^2.0.6",
76
76
  "openchemlib": "^7.4.3",
77
- "openchemlib-utils": "^1.8.0",
77
+ "openchemlib-utils": "^1.9.0",
78
78
  "re-resizable": "^6.9.1",
79
79
  "react-color": "2.17.2",
80
- "react-d3-utils": "^0.4.0",
80
+ "react-d3-utils": "^0.5.0",
81
81
  "react-draggable": "^4.4.4",
82
- "react-dropzone": "^11.5.1",
82
+ "react-dropzone": "^11.5.3",
83
83
  "react-error-boundary": "^3.1.4",
84
84
  "react-icons": "^4.3.1",
85
85
  "react-inspector": "^5.1.1",
86
86
  "react-mf": "^2.0.1",
87
- "react-ocl": "^4.3.3",
87
+ "react-ocl": "^4.3.4",
88
88
  "react-ocl-nmr": "^1.1.0",
89
- "react-plot": "^0.14.0",
89
+ "react-plot": "^0.16.0",
90
90
  "react-rnd": "^10.3.5",
91
91
  "react-slider": "^1.3.1",
92
92
  "react-table": "^7.7.0",
@@ -99,22 +99,22 @@
99
99
  "@babel/plugin-transform-modules-commonjs": "^7.16.8",
100
100
  "@babel/preset-react": "^7.16.7",
101
101
  "@babel/preset-typescript": "^7.16.7",
102
- "@playwright/test": "^1.18.0",
102
+ "@playwright/test": "^1.19.1",
103
103
  "@simbathesailor/use-what-changed": "^2.0.0",
104
104
  "@types/d3": "^7.1.0",
105
105
  "@types/jest": "^27.4.0",
106
- "@types/node": "^17.0.10",
107
- "@types/react": "^17.0.38",
106
+ "@types/node": "^17.0.18",
107
+ "@types/react": "^17.0.39",
108
108
  "@types/react-dom": "^17.0.11",
109
109
  "@types/react-router-dom": "^5.3.3",
110
- "@vitejs/plugin-react": "^1.1.4",
110
+ "@vitejs/plugin-react": "^1.2.0",
111
111
  "@zakodium/eslint-config": "^5.1.0",
112
112
  "cross-env": "^7.0.3",
113
- "eslint": "^8.7.0",
114
- "jest": "^27.4.7",
113
+ "eslint": "^8.9.0",
114
+ "jest": "^27.5.1",
115
115
  "modern-normalize": "^1.1.0",
116
116
  "prettier": "^2.5.1",
117
- "rc-menu": "^9.3.1",
117
+ "rc-menu": "^9.3.2",
118
118
  "react": "^17.0.2",
119
119
  "react-dom": "^17.0.2",
120
120
  "react-router-dom": "^5.3.0",
@@ -123,6 +123,6 @@
123
123
  "rollup-plugin-analyzer": "^4.0.0",
124
124
  "serve": "^13.0.2",
125
125
  "typescript": "~4.5.5",
126
- "vite": "^2.7.13"
126
+ "vite": "^2.8.4"
127
127
  }
128
128
  }
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- import { ExclusionZoneState } from '../reducer/Reducer';
3
- interface ExclusionZoneProps {
4
- zone: ExclusionZoneState;
5
- }
6
- declare function ExclusionZone({ zone }: ExclusionZoneProps): import("@emotion/react/jsx-runtime").JSX.Element;
7
- declare const _default: import("react").MemoExoticComponent<typeof ExclusionZone>;
8
- export default _default;
@@ -1,30 +0,0 @@
1
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
- /** @jsxImportSource @emotion/react */
3
- import { css } from '@emotion/react';
4
- import { memo } from 'react';
5
- import { useScaleChecked } from '../context/ScaleContext';
6
- import { HighlightedSource, useHighlight } from '../highlight';
7
- const styles = css `
8
- pointer-events: bounding-box;
9
- user-select: 'none';
10
- -webkit-user-select: none; /* Chrome all / Safari all */
11
- -moz-user-select: none; /* Firefox all */
12
-
13
- .zone-area {
14
- height: 100%;
15
- fill: #dddddd;
16
- cursor: pointer;
17
- }
18
- .zone-area.active {
19
- fill: #ff6f0057;
20
- }
21
- `;
22
- function ExclusionZone({ zone }) {
23
- const { scaleX } = useScaleChecked();
24
- const highlight = useHighlight([zone.id], {
25
- type: HighlightedSource.EXCLUSION_ZONE,
26
- extra: { id: zone.id },
27
- });
28
- return (_jsx("g", { transform: `translate(${scaleX()(zone.to)},0)`, css: styles, ...highlight.onHover, children: _jsx("rect", { x: "0", width: `${scaleX()(zone.from) - scaleX()(zone.to)}`, className: `zone-area ${highlight.isActive ? 'active' : ''}` }, void 0) }, zone.id));
29
- }
30
- export default memo(ExclusionZone);
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export default function ExclusionZones(): JSX.Element | null;
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useChartData } from '../context/ChartContext';
3
- import ExclusionZone from './ExclusionZone';
4
- export default function ExclusionZones() {
5
- const { toolOptions: { data: { exclusionZones }, }, activeTab, } = useChartData();
6
- const exclusionZonesForNucleus = exclusionZones[activeTab];
7
- if (!exclusionZonesForNucleus)
8
- return null;
9
- return (_jsx("g", { className: "exclusionZones", children: exclusionZonesForNucleus.map((zone) => (_jsx(ExclusionZone, { zone: zone }, zone.id))) }, void 0));
10
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
4
- /** @jsxImportSource @emotion/react */
5
- const react_1 = require("@emotion/react");
6
- const react_2 = require("react");
7
- const ScaleContext_1 = require("../context/ScaleContext");
8
- const highlight_1 = require("../highlight");
9
- const styles = (0, react_1.css) `
10
- pointer-events: bounding-box;
11
- user-select: 'none';
12
- -webkit-user-select: none; /* Chrome all / Safari all */
13
- -moz-user-select: none; /* Firefox all */
14
-
15
- .zone-area {
16
- height: 100%;
17
- fill: #dddddd;
18
- cursor: pointer;
19
- }
20
- .zone-area.active {
21
- fill: #ff6f0057;
22
- }
23
- `;
24
- function ExclusionZone({ zone }) {
25
- const { scaleX } = (0, ScaleContext_1.useScaleChecked)();
26
- const highlight = (0, highlight_1.useHighlight)([zone.id], {
27
- type: highlight_1.HighlightedSource.EXCLUSION_ZONE,
28
- extra: { id: zone.id },
29
- });
30
- return ((0, jsx_runtime_1.jsx)("g", { transform: `translate(${scaleX()(zone.to)},0)`, css: styles, ...highlight.onHover, children: (0, jsx_runtime_1.jsx)("rect", { x: "0", width: `${scaleX()(zone.from) - scaleX()(zone.to)}`, className: `zone-area ${highlight.isActive ? 'active' : ''}` }, void 0) }, zone.id));
31
- }
32
- exports.default = (0, react_2.memo)(ExclusionZone);
@@ -1,16 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- const ChartContext_1 = require("../context/ChartContext");
8
- const ExclusionZone_1 = __importDefault(require("./ExclusionZone"));
9
- function ExclusionZones() {
10
- const { toolOptions: { data: { exclusionZones }, }, activeTab, } = (0, ChartContext_1.useChartData)();
11
- const exclusionZonesForNucleus = exclusionZones[activeTab];
12
- if (!exclusionZonesForNucleus)
13
- return null;
14
- return ((0, jsx_runtime_1.jsx)("g", { className: "exclusionZones", children: exclusionZonesForNucleus.map((zone) => ((0, jsx_runtime_1.jsx)(ExclusionZone_1.default, { zone: zone }, zone.id))) }, void 0));
15
- }
16
- exports.default = ExclusionZones;