nmrium 0.53.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 (178) hide show
  1. package/lib/component/1d/Viewer1D.js +48 -17
  2. package/lib/component/1d/XAxis.js +1 -1
  3. package/lib/component/1d/integral/IntegralsSeries.js +2 -2
  4. package/lib/component/1d/integral/Integration.d.ts +3 -1
  5. package/lib/component/1d/integral/Integration.js +3 -2
  6. package/lib/component/1d/peaks/PeakEditionManager.js +5 -3
  7. package/lib/component/1d/ranges/AssignmentActionsButtons.d.ts +1 -0
  8. package/lib/component/1d/ranges/AssignmentActionsButtons.js +3 -3
  9. package/lib/component/1d/ranges/AssignmentLabel.d.ts +1 -1
  10. package/lib/component/1d/ranges/AssignmentLabel.js +31 -4
  11. package/lib/component/1d/ranges/Atoms.js +4 -5
  12. package/lib/component/1d/ranges/Range.js +62 -12
  13. package/lib/component/1d/ranges/Ranges.js +2 -1
  14. package/lib/component/1d/ranges/RangesIntegrals.js +11 -4
  15. package/lib/component/1d/tool/XLabelPointer.js +4 -12
  16. package/lib/component/1d-2d/FieldEdition.d.ts +13 -0
  17. package/lib/component/1d-2d/FieldEdition.js +42 -0
  18. package/lib/component/2d/Chart2D.js +5 -3
  19. package/lib/component/2d/tools/XYLabelPointer.js +3 -9
  20. package/lib/component/2d/zones/Zone.js +18 -2
  21. package/lib/component/2d/zones/ZonesAssignmentsLabels.d.ts +7 -0
  22. package/lib/component/2d/zones/ZonesAssignmentsLabels.js +286 -0
  23. package/lib/component/EventsTrackers/KeysListenerTracker.js +14 -1
  24. package/lib/component/context/LoggerContext.js +11 -4
  25. package/lib/component/context/ShareDataContext.d.ts +10 -0
  26. package/lib/component/context/ShareDataContext.js +22 -0
  27. package/lib/component/elements/ActionsButtonsPopover.d.ts +10 -0
  28. package/lib/component/elements/ActionsButtonsPopover.js +22 -0
  29. package/lib/component/elements/CloseButton.d.ts +1 -1
  30. package/lib/component/elements/CustomToolTip.d.ts +8 -0
  31. package/lib/component/elements/CustomToolTip.js +107 -0
  32. package/lib/component/elements/EditableColumn.js +3 -2
  33. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +7 -5
  34. package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -2
  35. package/lib/component/elements/SVGButton.d.ts +14 -0
  36. package/lib/component/elements/SVGButton.js +6 -0
  37. package/lib/component/elements/SVGGroup.js +15 -13
  38. package/lib/component/elements/SVGText.d.ts +8 -0
  39. package/lib/component/elements/SVGText.js +24 -0
  40. package/lib/component/elements/SaveButton.d.ts +1 -1
  41. package/lib/component/elements/draggable/SVGDraggable.d.ts +2 -2
  42. package/lib/component/elements/formik/FormikError.js +2 -4
  43. package/lib/component/elements/formik/FormikInput.d.ts +2 -1
  44. package/lib/component/elements/formik/FormikInput.js +5 -4
  45. package/lib/component/header/Header.js +8 -11
  46. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +41 -10
  47. package/lib/component/hooks/useActiveSpectrumZonesViewState.js +1 -0
  48. package/lib/component/hooks/useCheckPointsNumberInWindowArea.d.ts +1 -1
  49. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
  50. package/lib/component/hooks/useFormatNumberByNucleus.js +8 -7
  51. package/lib/component/hooks/useIntegralPath.d.ts +2 -0
  52. package/lib/component/hooks/useIntegralPath.js +3 -1
  53. package/lib/component/hooks/usePanelPreferences.js +1 -2
  54. package/lib/component/hooks/useSaveSettings.js +7 -14
  55. package/lib/component/hooks/useTriggerNewAssignmentLabel.d.ts +4 -0
  56. package/lib/component/hooks/useTriggerNewAssignmentLabel.js +8 -0
  57. package/lib/component/hooks/useWorkspaceAction.d.ts +7 -0
  58. package/lib/component/hooks/useWorkspaceAction.js +89 -0
  59. package/lib/component/loader/DropZone.js +0 -3
  60. package/lib/component/main/InnerNMRium.js +3 -1
  61. package/lib/component/main/InnerNMRiumContents.js +14 -2
  62. package/lib/component/main/NMRiumStateProvider.js +15 -3
  63. package/lib/component/modal/AboutPredictionModal.js +1 -1
  64. package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
  65. package/lib/component/modal/CopyClipboardModal.js +1 -1
  66. package/lib/component/modal/EditPeakShapeModal.js +1 -1
  67. package/lib/component/modal/ImportPublicationStringModal.js +11 -5
  68. package/lib/component/modal/PredictSpectraModal.js +1 -1
  69. package/lib/component/modal/aboutUs/AboutUsModal.js +1 -1
  70. package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
  71. package/lib/component/modal/editRange/EditRangeModal.js +1 -1
  72. package/lib/component/modal/editRange/forms/components/DeltaInput.js +3 -3
  73. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +17 -12
  74. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +30 -13
  75. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +26 -16
  76. package/lib/component/modal/editZone/EditZoneModal.js +1 -1
  77. package/lib/component/modal/setting/GeneralSettings.js +18 -39
  78. package/lib/component/modal/setting/WorkspaceItem.js +1 -1
  79. package/lib/component/modal/setting/settings-tabs/NucleiTabContent.d.ts +2 -0
  80. package/lib/component/modal/setting/settings-tabs/NucleiTabContent.js +99 -0
  81. package/lib/component/modal/setting/settingsValidation.js +36 -40
  82. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +2 -2
  83. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +2 -2
  84. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +2 -2
  85. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
  86. package/lib/component/panels/PeaksPanel/PeaksPanel.js +5 -5
  87. package/lib/component/panels/RangesPanel/RangesHeader.js +11 -11
  88. package/lib/component/panels/RangesPanel/RangesPreferences.js +16 -16
  89. package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
  90. package/lib/component/panels/RangesPanel/RangesTableRow.js +2 -2
  91. package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +22 -8
  92. package/lib/component/panels/SpectraPanel/SpectraPreferences.js +13 -1
  93. package/lib/component/panels/SpectraPanel/base/setting/PlotChart.js +1 -1
  94. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DHistogram.js +1 -1
  95. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
  96. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.d.ts +5 -5
  97. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +79 -89
  98. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.d.ts +5 -4
  99. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +66 -98
  100. package/lib/component/panels/SummaryPanel/SummaryPanel.js +13 -32
  101. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.d.ts +6 -0
  102. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.js +16 -0
  103. package/lib/component/panels/ZonesPanel/ZonesPanel.js +22 -6
  104. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +15 -9
  105. package/lib/component/panels/ZonesPanel/ZonesTable.js +2 -2
  106. package/lib/component/panels/ZonesPanel/ZonesTableRow.js +3 -2
  107. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +2 -2
  108. package/lib/component/panels/header/DefaultPanelHeader.js +2 -2
  109. package/lib/component/panels/header/PreferencesHeader.js +1 -1
  110. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
  111. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
  112. package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +1 -1
  113. package/lib/component/reducer/IgnoreActions.js +1 -0
  114. package/lib/component/reducer/Reducer.js +8 -0
  115. package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
  116. package/lib/component/reducer/actions/DomainActions.js +29 -1
  117. package/lib/component/reducer/actions/FiltersActions.d.ts +3 -2
  118. package/lib/component/reducer/actions/FiltersActions.js +27 -1
  119. package/lib/component/reducer/actions/MoleculeActions.js +1 -1
  120. package/lib/component/reducer/actions/RangesActions.d.ts +2 -3
  121. package/lib/component/reducer/actions/RangesActions.js +28 -26
  122. package/lib/component/reducer/actions/SpectraActions.d.ts +5 -4
  123. package/lib/component/reducer/actions/SpectraActions.js +5 -1
  124. package/lib/component/reducer/actions/ZonesActions.d.ts +15 -2
  125. package/lib/component/reducer/actions/ZonesActions.js +47 -13
  126. package/lib/component/reducer/helper/setRangesViewProperty.d.ts +1 -0
  127. package/lib/component/reducer/helper/setRangesViewProperty.js +11 -11
  128. package/lib/component/reducer/preferences/actions/addWorkspace.js +4 -23
  129. package/lib/component/reducer/preferences/actions/analyzeSpectra.js +4 -4
  130. package/lib/component/reducer/preferences/actions/initPreferences.js +2 -4
  131. package/lib/component/reducer/preferences/actions/matrixGeneration.js +3 -3
  132. package/lib/component/reducer/preferences/actions/removeWorkspace.js +0 -5
  133. package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +0 -4
  134. package/lib/component/reducer/preferences/actions/setPanelsPreferences.js +1 -1
  135. package/lib/component/reducer/preferences/actions/setPreferences.js +2 -16
  136. package/lib/component/reducer/preferences/actions/setWorkspace.js +4 -3
  137. package/lib/component/reducer/preferences/preferencesReducer.d.ts +7 -0
  138. package/lib/component/reducer/preferences/preferencesReducer.js +21 -18
  139. package/lib/component/toolbar/ToolBar.js +115 -25
  140. package/lib/component/utility/PreferencesHelper.js +5 -4
  141. package/lib/component/utility/export.js +4 -0
  142. package/lib/component/workspaces/assignment.js +0 -1
  143. package/lib/component/workspaces/basic.js +0 -1
  144. package/lib/component/workspaces/embedded.js +0 -1
  145. package/lib/component/workspaces/exercise.js +26 -29
  146. package/lib/component/workspaces/prediction.js +171 -174
  147. package/lib/component/workspaces/process1D.js +0 -1
  148. package/lib/component/workspaces/simulation.js +35 -38
  149. package/lib/component/workspaces/workspaceDefaultProperties.js +16 -23
  150. package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +10 -3
  151. package/lib/data/data1d/Spectrum1D/get1DColor.js +28 -2
  152. package/lib/data/data1d/Spectrum1D/index.d.ts +2 -2
  153. package/lib/data/data1d/Spectrum1D/index.js +2 -2
  154. package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +50 -0
  155. package/lib/data/data1d/Spectrum1D/ranges/createRange.js +51 -0
  156. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +2 -1
  157. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +4 -2
  158. package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +52 -0
  159. package/lib/data/data1d/Spectrum1D/ranges/resizeRange.js +28 -0
  160. package/lib/data/data2d/Spectrum2D/get2DColor.d.ts +11 -3
  161. package/lib/data/data2d/Spectrum2D/get2DColor.js +20 -4
  162. package/lib/data/data2d/Spectrum2D/getSlice.js +1 -1
  163. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +1 -0
  164. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +1 -0
  165. package/lib/data/utilities/generateColor.d.ts +7 -3
  166. package/lib/data/utilities/generateColor.js +5 -17
  167. package/lib/versionInfo.js +1 -1
  168. package/package.json +35 -35
  169. package/lib/component/elements/MolecularFormulaInput.d.ts +0 -6
  170. package/lib/component/elements/MolecularFormulaInput.js +0 -63
  171. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.d.ts +0 -2
  172. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +0 -80
  173. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +0 -2
  174. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.js +0 -10
  175. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -7
  176. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +0 -31
  177. package/lib/data/data1d/Spectrum1D/ranges/changeRange.d.ts +0 -3
  178. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +0 -32
@@ -0,0 +1,50 @@
1
+ import { Logger } from 'cheminfo-types';
2
+ import { Spectrum1D } from 'nmr-load-save';
3
+ import { Range } from 'nmr-processing';
4
+ export declare function cutRange(spectrum: Spectrum1D, x: number): Record<string, Range[]>;
5
+ export declare function createRange(spectrum: Spectrum1D, options: Pick<Range, 'from' | 'to'> & {
6
+ logger?: Logger;
7
+ }): {
8
+ absolute: number;
9
+ signals: {
10
+ originalDelta: number | undefined;
11
+ delta: number;
12
+ multiplicity: string;
13
+ js: import("nmr-processing").Jcoupling[];
14
+ atoms?: number[] | undefined;
15
+ assignment?: string | undefined;
16
+ diaIDs?: string[] | undefined;
17
+ nbAtoms?: number | undefined;
18
+ integration?: number | undefined;
19
+ statistic?: {
20
+ mean: number;
21
+ sd: number;
22
+ min: number;
23
+ max: number;
24
+ nb: number;
25
+ } | undefined;
26
+ kind: string;
27
+ id: string;
28
+ peaks: {
29
+ originalX: number;
30
+ x: number;
31
+ id: string;
32
+ kind?: string | undefined;
33
+ shape?: import("ml-peak-shape-generator").Shape1D | undefined;
34
+ y: number;
35
+ width: number;
36
+ }[];
37
+ }[];
38
+ originalFrom: number | undefined;
39
+ originalTo: number | undefined;
40
+ from: number;
41
+ to: number;
42
+ id: string;
43
+ kind: string;
44
+ integration: number;
45
+ nbAtoms?: number | undefined;
46
+ multiplicity?: string | undefined;
47
+ assignment?: string | undefined;
48
+ diaIDs?: string[] | undefined;
49
+ pubIntegral?: number | undefined;
50
+ } | undefined;
@@ -0,0 +1,51 @@
1
+ import { xyIntegration } from 'ml-spectra-processing';
2
+ import { mapRanges } from 'nmr-processing';
3
+ import detectSignals from './detectSignals';
4
+ export function cutRange(spectrum, x) {
5
+ const cutRanges = {};
6
+ for (const range of spectrum?.ranges?.values || []) {
7
+ const { to, from, id } = range;
8
+ if (x > from && x < to) {
9
+ const leftRange = createRange(spectrum, { from, to: x });
10
+ const rightRange = createRange(spectrum, {
11
+ from: x,
12
+ to,
13
+ });
14
+ cutRanges[id] = [];
15
+ if (leftRange) {
16
+ cutRanges[id].push(leftRange);
17
+ }
18
+ if (rightRange) {
19
+ cutRanges[id].push(rightRange);
20
+ }
21
+ }
22
+ }
23
+ return cutRanges;
24
+ }
25
+ export function createRange(spectrum, options) {
26
+ const { from, to, logger } = options;
27
+ const { x, re: y } = spectrum.data;
28
+ const { nucleus, originFrequency: frequency } = spectrum.info;
29
+ const absolute = xyIntegration({ x, y }, { from, to });
30
+ const signals = detectSignals({ x, y }, {
31
+ logger,
32
+ from,
33
+ to,
34
+ nucleus,
35
+ frequency,
36
+ }) || [];
37
+ const range = {
38
+ from,
39
+ to,
40
+ absolute,
41
+ signals: signals,
42
+ };
43
+ try {
44
+ const [newRange] = mapRanges([range], spectrum);
45
+ return newRange;
46
+ }
47
+ catch (error) {
48
+ reportError(error);
49
+ logger?.error('Could not calculate the multiplicity');
50
+ }
51
+ }
@@ -1,7 +1,8 @@
1
- import { DataXY } from 'cheminfo-types';
1
+ import { DataXY, Logger } from 'cheminfo-types';
2
2
  export default function detectSignals(data: DataXY<Float64Array>, options: {
3
3
  from: number;
4
4
  to: number;
5
+ logger?: Logger;
5
6
  nucleus: string;
6
7
  frequency: number;
7
8
  }): {
@@ -3,10 +3,12 @@ import { xyAutoRangesPicking } from 'nmr-processing';
3
3
  import { detectSignalsByMultipletAnalysis } from './detectSignalsByMultipletAnalysis';
4
4
  const MAX_LENGTH = 4092;
5
5
  export default function detectSignals(data, options) {
6
- const { from, to, frequency, nucleus } = options;
6
+ const { from, to, frequency, nucleus, logger } = options;
7
7
  const { fromIndex, toIndex } = xGetFromToIndex(data.x, { from, to });
8
- if (toIndex - fromIndex >= MAX_LENGTH) {
8
+ const size = toIndex - fromIndex;
9
+ if (size <= 16 || size >= MAX_LENGTH) {
9
10
  const ranges = xyAutoRangesPicking(data, {
11
+ logger,
10
12
  peakPicking: {
11
13
  sgOptions: {
12
14
  windowSize: 7,
@@ -0,0 +1,52 @@
1
+ import { Logger } from 'cheminfo-types';
2
+ import { Spectrum1D } from 'nmr-load-save';
3
+ import { Range } from 'nmr-processing';
4
+ export declare function resizeRange(spectrum: Spectrum1D, options: {
5
+ range: Range;
6
+ from: number;
7
+ to: number;
8
+ logger?: Logger;
9
+ }): {
10
+ absolute: number;
11
+ signals: {
12
+ originalDelta: number | undefined;
13
+ delta: number;
14
+ multiplicity: string;
15
+ js: import("nmr-processing").Jcoupling[];
16
+ atoms?: number[] | undefined;
17
+ assignment?: string | undefined;
18
+ diaIDs?: string[] | undefined;
19
+ nbAtoms?: number | undefined;
20
+ integration?: number | undefined;
21
+ statistic?: {
22
+ mean: number;
23
+ sd: number;
24
+ min: number;
25
+ max: number;
26
+ nb: number;
27
+ } | undefined;
28
+ kind: string;
29
+ id: string;
30
+ peaks: {
31
+ originalX: number;
32
+ x: number;
33
+ id: string;
34
+ kind?: string | undefined;
35
+ shape?: import("ml-peak-shape-generator").Shape1D | undefined;
36
+ y: number;
37
+ width: number;
38
+ }[];
39
+ }[];
40
+ originalFrom: number | undefined;
41
+ originalTo: number | undefined;
42
+ from: number;
43
+ to: number;
44
+ id: string;
45
+ kind: string;
46
+ integration: number;
47
+ nbAtoms?: number | undefined;
48
+ multiplicity?: string | undefined;
49
+ assignment?: string | undefined;
50
+ diaIDs?: string[] | undefined;
51
+ pubIntegral?: number | undefined;
52
+ };
@@ -0,0 +1,28 @@
1
+ import { xyIntegration } from 'ml-spectra-processing';
2
+ import { mapRanges } from 'nmr-processing';
3
+ import detectSignals from './detectSignals';
4
+ export function resizeRange(spectrum, options) {
5
+ const { range, from, to, logger } = options;
6
+ const { x, re: y } = spectrum.data;
7
+ const { originFrequency: frequency, nucleus } = spectrum.info;
8
+ const absolute = xyIntegration({ x, y }, { from, to });
9
+ const signals = detectSignals({ x, y }, {
10
+ from,
11
+ to,
12
+ nucleus,
13
+ frequency,
14
+ logger,
15
+ });
16
+ const [newRange] = mapRanges([
17
+ {
18
+ ...range,
19
+ originalFrom: from,
20
+ originalTo: to,
21
+ from,
22
+ to,
23
+ absolute,
24
+ signals,
25
+ },
26
+ ], spectrum);
27
+ return newRange;
28
+ }
@@ -1,9 +1,17 @@
1
1
  import { Color2D, SpectrumTwoDimensionsColor } from 'nmr-load-save';
2
2
  import { UsedColors } from '../../../types/UsedColors';
3
- interface GetTwoDimensionsColorOption {
3
+ interface BaseColorOptions {
4
4
  usedColors?: UsedColors;
5
5
  colors?: SpectrumTwoDimensionsColor[];
6
- regenerate?: boolean;
7
6
  }
8
- export declare function get2DColor(spectrum: any, options: GetTwoDimensionsColorOption): Color2D;
7
+ interface ColorOptions extends BaseColorOptions {
8
+ regenerate?: false;
9
+ }
10
+ interface RandomColorOptions extends BaseColorOptions {
11
+ regenerate: true;
12
+ random?: boolean;
13
+ }
14
+ export declare function get2DColor(spectrum: any, options: ColorOptions | RandomColorOptions): Color2D;
15
+ type ExperimentType = 'cosy' | 'roesy' | 'noesy' | 'tocsy' | 'hsqc' | 'hmbc';
16
+ export declare const color2D: Readonly<Record<ExperimentType, Color2D>>;
9
17
  export {};
@@ -1,17 +1,25 @@
1
- import { generate2DColor } from '../../utilities/generateColor';
1
+ import { adjustAlpha, generateColor } from '../../utilities/generateColor';
2
2
  import { getCustomColor } from '../../utilities/getCustomColor';
3
+ function isRandomColorGeneration(options) {
4
+ return 'random' in options;
5
+ }
3
6
  export function get2DColor(spectrum, options) {
4
7
  const { regenerate = false, usedColors = {}, colors } = options;
5
8
  let color = {};
6
9
  if (spectrum?.display?.negativeColor === undefined ||
7
10
  spectrum?.display?.positiveColor === undefined ||
8
11
  regenerate) {
9
- const customColor = getCustomColor(spectrum, colors);
10
- if (customColor) {
12
+ const isRandom = isRandomColorGeneration(options) && options.random;
13
+ const customColor = getCustomColor(spectrum, colors) || color2D?.[spectrum.info.experiment];
14
+ if (customColor && !isRandom) {
11
15
  color = customColor;
12
16
  }
13
17
  else {
14
- color = generate2DColor(spectrum.info.experiment, usedColors?.['2d'] || []);
18
+ const positiveColor = generateColor({
19
+ usedColors: usedColors?.['2d'] || [],
20
+ });
21
+ const negativeColor = adjustAlpha(positiveColor, 50);
22
+ color = { positiveColor, negativeColor };
15
23
  }
16
24
  }
17
25
  else {
@@ -23,3 +31,11 @@ export function get2DColor(spectrum, options) {
23
31
  }
24
32
  return color;
25
33
  }
34
+ export const color2D = {
35
+ cosy: { positiveColor: 'darkblue', negativeColor: 'blue' },
36
+ roesy: { positiveColor: 'pink', negativeColor: 'yellow' },
37
+ noesy: { positiveColor: 'pink', negativeColor: 'yellow' },
38
+ tocsy: { positiveColor: 'green', negativeColor: 'yellow' },
39
+ hsqc: { positiveColor: 'black', negativeColor: 'yellow' },
40
+ hmbc: { positiveColor: 'darkviolet', negativeColor: 'yellow' },
41
+ };
@@ -50,8 +50,8 @@ export function getSlice(spectrum, position, options = {}) {
50
50
  });
51
51
  if (imaginaryVerticalData) {
52
52
  infoY.isComplex = true;
53
+ dataY.im = new Float64Array(yLength);
53
54
  for (let i = 0; i < yLength; i++) {
54
- dataY.im = new Float64Array(yLength);
55
55
  dataY.im[i] += imaginaryVerticalData.z[i][xIndex];
56
56
  }
57
57
  }
@@ -62,4 +62,5 @@ export declare function detectZonesManual(datum: any, options: DetectionZonesOpt
62
62
  originalTo?: number | undefined;
63
63
  };
64
64
  id: string;
65
+ assignment?: string | undefined;
65
66
  }[];
@@ -62,5 +62,6 @@ export declare function initiateZones(options: Partial<{
62
62
  originalTo?: number | undefined;
63
63
  };
64
64
  id: string;
65
+ assignment?: string | undefined;
65
66
  }[];
66
67
  };
@@ -1,5 +1,9 @@
1
- import { Color2D } from 'nmr-load-save';
2
1
  export declare const COLORS: string[];
3
- export declare function generate2DColor(experiment: string, colors?: never[]): Color2D;
4
2
  export declare function adjustAlpha(color: string, factor: number): string;
5
- export declare function generateColor(isRandom?: boolean, usedColors?: string[], opacity?: number): string;
3
+ interface Options {
4
+ isRandom?: boolean;
5
+ usedColors?: string[];
6
+ opacity?: number;
7
+ }
8
+ export declare function generateColor(options: Options): string;
9
+ export {};
@@ -20,22 +20,6 @@ export const COLORS = [
20
20
  '#593315',
21
21
  '#F13A13',
22
22
  ];
23
- const color2D = {
24
- cosy: { positiveColor: 'darkblue', negativeColor: 'blue' },
25
- roesy: { positiveColor: '#e75480', negativeColor: 'yellow' },
26
- noesy: { positiveColor: '#e75480', negativeColor: 'yellow' },
27
- tocsy: { positiveColor: 'green', negativeColor: 'yellow' },
28
- hsqc: { positiveColor: 'black', negativeColor: 'yellow' },
29
- hmbc: { positiveColor: 'darkviolet', negativeColor: 'yellow' },
30
- };
31
- export function generate2DColor(experiment, colors = []) {
32
- if (!color2D[experiment]) {
33
- const positiveColor = generateColor(false, colors);
34
- const negativeColor = adjustAlpha(positiveColor, 50);
35
- return { positiveColor, negativeColor };
36
- }
37
- return color2D[experiment];
38
- }
39
23
  function percentToHex(p) {
40
24
  const percent = Math.max(0, Math.min(100, p));
41
25
  const intValue = Math.round((percent / 100) * 255);
@@ -45,7 +29,11 @@ function percentToHex(p) {
45
29
  export function adjustAlpha(color, factor) {
46
30
  return color + percentToHex(factor);
47
31
  }
48
- export function generateColor(isRandom = false, usedColors = [], opacity = 100) {
32
+ export function generateColor(options) {
33
+ const { isRandom = false, usedColors = [], opacity = 100 } = options;
34
+ if (opacity > 100 || opacity < 0) {
35
+ throw new Error(`Opacity value must be within the range of 0 to 100`);
36
+ }
49
37
  const resetColors = COLORS.filter((c) => !usedColors.includes(c));
50
38
  if (resetColors.length > 0 && !isRandom) {
51
39
  return resetColors[0] + percentToHex(opacity);
@@ -1 +1 @@
1
- export default { version: 'v0.53.0' };
1
+ export default { version: 'v0.55.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.53.0",
4
+ "version": "0.55.0",
5
5
  "license": "MIT",
6
6
  "module": "lib/component/main/index.js",
7
7
  "types": "lib/component/main/index.d.ts",
@@ -57,58 +57,58 @@
57
57
  "react-dom": ">=18.0.0"
58
58
  },
59
59
  "dependencies": {
60
- "@blueprintjs/core": "^5.10.1",
60
+ "@blueprintjs/core": "^5.10.3",
61
61
  "@blueprintjs/icons": "^5.9.0",
62
- "@blueprintjs/select": "^5.1.3",
62
+ "@blueprintjs/select": "^5.1.5",
63
63
  "@emotion/react": "^11.11.4",
64
- "@emotion/styled": "^11.11.0",
64
+ "@emotion/styled": "^11.11.5",
65
65
  "@lukeed/uuid": "^2.0.1",
66
66
  "cheminfo-font": "^1.13.0",
67
67
  "cheminfo-types": "^1.7.3",
68
- "clipboard-polyfill": "^4.0.2",
68
+ "clipboard-polyfill": "^4.1.0",
69
69
  "convert-to-jcamp": "^5.4.10",
70
70
  "d3": "^7.9.0",
71
71
  "eventemitter3": "^5.0.1",
72
- "fifo-logger": "^0.6.1",
72
+ "fifo-logger": "^1.0.0",
73
73
  "file-saver": "^2.0.5",
74
74
  "filelist-utils": "^1.11.0",
75
- "formik": "^2.4.5",
76
- "immer": "^10.0.4",
75
+ "formik": "^2.4.6",
76
+ "immer": "^10.1.1",
77
77
  "jszip": "^3.10.1",
78
78
  "lodash": "^4.17.21",
79
79
  "ml-array-max": "^1.2.4",
80
80
  "ml-array-mean": "^1.1.6",
81
81
  "ml-array-median": "^1.1.6",
82
82
  "ml-array-xy-equally-spaced": "^1.2.1",
83
- "ml-baseline-correction-regression": "^1.0.2",
83
+ "ml-baseline-correction-regression": "^1.0.3",
84
84
  "ml-conrec": "^5.0.2",
85
85
  "ml-gsd": "^12.1.6",
86
86
  "ml-matrix": "^6.11.0",
87
87
  "ml-signal-processing": "^1.0.4",
88
- "ml-spectra-processing": "^14.2.2",
88
+ "ml-spectra-processing": "^14.5.0",
89
89
  "ml-stat": "^1.3.3",
90
90
  "ml-tree-similarity": "^2.2.0",
91
91
  "multiplet-analysis": "^2.1.2",
92
92
  "nmr-correlation": "^2.3.3",
93
- "nmr-load-save": "^0.29.1",
94
- "nmr-processing": "^12.0.1",
93
+ "nmr-load-save": "0.32.0",
94
+ "nmr-processing": "^12.3.1",
95
95
  "nmredata": "^0.9.9",
96
96
  "numeral": "^2.0.6",
97
- "openchemlib": "^8.9.0",
98
- "openchemlib-utils": "^5.12.1",
97
+ "openchemlib": "^8.10.0",
98
+ "openchemlib-utils": "^5.19.1",
99
99
  "papaparse": "^5.4.1",
100
- "re-resizable": "6.9.11",
100
+ "re-resizable": "6.9.16",
101
101
  "react-d3-utils": "^1.0.0",
102
102
  "react-dropzone": "^14.2.3",
103
103
  "react-error-boundary": "^4.0.13",
104
- "react-icons": "^5.0.1",
104
+ "react-icons": "^5.2.1",
105
105
  "react-inspector": "^6.0.2",
106
106
  "react-mf": "^2.0.2",
107
107
  "react-ocl": "^6.1.0",
108
108
  "react-ocl-nmr": "^3.0.1",
109
109
  "react-plot": "^1.4.2",
110
- "react-rnd": "^10.4.1",
111
- "react-science": "^1.0.2",
110
+ "react-rnd": "^10.4.10",
111
+ "react-science": "^3.1.0",
112
112
  "react-slider": "^2.0.6",
113
113
  "react-table": "^7.8.0",
114
114
  "react-transition-group": "^4.4.5",
@@ -120,36 +120,36 @@
120
120
  "@babel/plugin-transform-modules-commonjs": "^7.24.1",
121
121
  "@babel/preset-react": "^7.24.1",
122
122
  "@babel/preset-typescript": "^7.24.1",
123
- "@playwright/test": "^1.42.1",
123
+ "@playwright/test": "^1.44.0",
124
124
  "@simbathesailor/use-what-changed": "^2.0.0",
125
125
  "@types/d3": "^7.4.3",
126
- "@types/lodash": "^4.17.0",
127
- "@types/node": "^20.11.30",
126
+ "@types/lodash": "^4.17.3",
127
+ "@types/node": "^20.12.12",
128
128
  "@types/papaparse": "^5.3.14",
129
- "@types/react": "^18.2.67",
130
- "@types/react-dom": "^18.2.22",
129
+ "@types/react": "^18.3.2",
130
+ "@types/react-dom": "^18.3.0",
131
131
  "@types/react-table": "^7.7.20",
132
132
  "@vitejs/plugin-react-swc": "^3.6.0",
133
- "@vitest/coverage-v8": "^1.4.0",
133
+ "@vitest/coverage-v8": "^1.6.0",
134
134
  "cross-env": "^7.0.3",
135
- "cspell": "^8.6.0",
135
+ "cspell": "^8.8.1",
136
136
  "eslint": "^8.57.0",
137
137
  "eslint-config-cheminfo-react": "^11.0.1",
138
- "eslint-config-cheminfo-typescript": "^12.2.0",
138
+ "eslint-config-cheminfo-typescript": "^12.4.0",
139
139
  "modern-normalize": "^2.0.0",
140
140
  "postcss-styled-syntax": "^0.6.4",
141
141
  "prettier": "^3.2.5",
142
142
  "rc-menu": "^9.13.0",
143
- "react": "^18.2.0",
144
- "react-dom": "^18.2.0",
145
- "react-router-dom": "^6.22.3",
146
- "rimraf": "^5.0.5",
143
+ "react": "^18.3.1",
144
+ "react-dom": "^18.3.1",
145
+ "react-router-dom": "^6.23.1",
146
+ "rimraf": "^5.0.7",
147
147
  "rollup-plugin-analyzer": "^4.0.0",
148
- "serve": "^14.2.1",
149
- "stylelint": "^16.2.1",
148
+ "serve": "^14.2.3",
149
+ "stylelint": "^16.5.0",
150
150
  "stylelint-config-standard": "^36.0.0",
151
- "typescript": "^5.4.3",
152
- "vite": "^5.2.2",
153
- "vitest": "^1.4.0"
151
+ "typescript": "^5.4.5",
152
+ "vite": "^5.2.11",
153
+ "vitest": "^1.6.0"
154
154
  }
155
155
  }
@@ -1,6 +0,0 @@
1
- interface MolecularFormulaInputProps {
2
- onSave?: (element: string) => void;
3
- previousMF: string;
4
- }
5
- export default function MolecularFormulaInput({ onSave, previousMF, }: MolecularFormulaInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,63 +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 { useCallback, useState } from 'react';
5
- import getAtomsFromMF from '../../data/utilities/getAtomsFromMF';
6
- const inputStyle = css `
7
- text-align: center;
8
-
9
- input {
10
- height: 100%;
11
- width: 200px;
12
- border-radius: 5px;
13
- border: 0.55px solid #c7c7c7;
14
- margin: 0 5px;
15
- text-align: center;
16
- }
17
-
18
- button {
19
- flex: 2;
20
- padding: 5px;
21
- border: 1px solid gray;
22
- border-radius: 5px;
23
- height: 36px;
24
- margin: 0 auto;
25
- margin-top: 15px;
26
- display: block;
27
- width: 20%;
28
- color: white;
29
- background-color: gray;
30
- }
31
- `;
32
- function isValidMf(mf) {
33
- if (mf.trim().length === 0) {
34
- return false;
35
- }
36
- try {
37
- getAtomsFromMF(mf);
38
- return true;
39
- }
40
- catch {
41
- return false;
42
- }
43
- }
44
- export default function MolecularFormulaInput({ onSave = () => null, previousMF, }) {
45
- const [mf, setMF] = useState('');
46
- const [isValidMF, setIsValidMF] = useState(true);
47
- const [hasChanged, setHasChanged] = useState(false);
48
- const onChangeHandler = useCallback((e) => {
49
- setHasChanged(true);
50
- if (isValidMf(e.target.value)) {
51
- setIsValidMF(true);
52
- setMF(e.target.value);
53
- }
54
- else {
55
- setIsValidMF(false);
56
- setMF('');
57
- }
58
- }, []);
59
- const onSaveHandler = useCallback(() => {
60
- onSave(hasChanged ? mf.trim() : previousMF);
61
- }, [hasChanged, mf, onSave, previousMF]);
62
- return (_jsxs("div", { css: inputStyle, children: [_jsx("input", { type: "text", onChange: onChangeHandler, defaultValue: previousMF }), _jsx("button", { type: "button", onClick: onSaveHandler, disabled: !isValidMF, children: isValidMF ? 'Set' : 'Invalid' })] }));
63
- }
@@ -1,2 +0,0 @@
1
- declare function FormattingTabContent(): import("@emotion/react/jsx-runtime").JSX.Element;
2
- export default FormattingTabContent;
@@ -1,80 +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 { v4 } from '@lukeed/uuid';
5
- import { useFormikContext } from 'formik';
6
- import lodashGet from 'lodash/get';
7
- import { FaPlus, FaTimes } from 'react-icons/fa';
8
- import Button from '../../../elements/Button';
9
- import { GroupPane } from '../../../elements/GroupPane';
10
- import FormikInput from '../../../elements/formik/FormikInput';
11
- const styles = css `
12
- .counter-col {
13
- width: 30px;
14
- }
15
-
16
- .nucleus-label-col {
17
- display: flex;
18
- justify-content: center;
19
- width: 80px;
20
- }
21
-
22
- .input {
23
- width: 100% !important;
24
- margin: 0 !important;
25
- }
26
-
27
- .nucleus-format-input-col {
28
- text-align: center;
29
- width: 100px;
30
- }
31
-
32
- th {
33
- font-size: 11px;
34
- font-weight: 600;
35
- }
36
-
37
- .operation-container {
38
- display: flex;
39
- }
40
-
41
- .add {
42
- background-color: transparent;
43
- border: 0;
44
- outline: none;
45
-
46
- svg {
47
- font-size: 14px;
48
- fill: green;
49
- }
50
- }
51
- `;
52
- function FormattingTabContent() {
53
- const { values, setFieldValue } = useFormikContext();
54
- const nuclei = lodashGet(values, 'formatting.nuclei', {});
55
- function deleteHandler(key) {
56
- const _nuclei = {};
57
- for (const nucleus in nuclei) {
58
- if (nucleus !== key) {
59
- _nuclei[nucleus] = nuclei[nucleus];
60
- }
61
- }
62
- void setFieldValue('formatting.nuclei', _nuclei);
63
- }
64
- function addHandler() {
65
- const newFormat = {
66
- name: '',
67
- ppm: '0.00',
68
- hz: '0.00',
69
- };
70
- const key = v4();
71
- const newNuclei = { ...nuclei, [key]: newFormat };
72
- void setFieldValue('formatting.nuclei', newNuclei);
73
- }
74
- const nucleiList = Object.keys(nuclei);
75
- return (_jsx(GroupPane, { text: "Number formatting for crosshair and info line", children: _jsx("div", { css: styles, children: _jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { className: "counter-col", children: "#" }), _jsx("th", { className: "nucleus-label-col", children: "Nucleus " }), _jsx("th", { className: "nucleus-format-input-col", children: "\u03B4 (ppm)" }), _jsx("th", { className: "nucleus-format-input-col", children: "Coupling (Hz)" }), _jsx("th", { className: "nucleus-format-input-col" })] }) }), _jsx("tbody", { children: nucleiList?.map((key, index) => {
76
- const num = index + 1;
77
- return (_jsxs("tr", { children: [_jsxs("td", { className: "counter-col", children: [_jsxs("span", { children: [num, " - "] }), ' '] }), _jsx("td", { className: "nucleus-label-col", children: _jsx(FormikInput, { name: `formatting.nuclei.${key}.name`, className: "input", checkErrorAfterInputTouched: false }) }), _jsx("td", { className: "nucleus-format-input-col", children: _jsx(FormikInput, { name: `formatting.nuclei.${key}.ppm`, className: "input" }) }), _jsx("td", { className: "nucleus-format-input-col", children: _jsx(FormikInput, { name: `formatting.nuclei.${key}.hz`, className: "input" }) }), _jsxs("td", { className: "operation-container", children: [_jsx(Button.Danger, { style: { fontSize: '14px' }, fill: "clear", onClick: () => deleteHandler(key), children: _jsx(FaTimes, {}) }), nucleiList.length === index + 1 && (_jsx(Button.Done, { fill: "clear", style: { fontSize: '14px' }, onClick: addHandler, children: _jsx(FaPlus, {}) }))] })] }, key));
78
- }) })] }) }) }));
79
- }
80
- export default FormattingTabContent;
@@ -1,2 +0,0 @@
1
- import { Formatting } from 'nmr-load-save';
2
- export declare function mapNucleiFormatting(formatting: Formatting): Formatting;