nmrium 0.49.0 → 0.50.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 (121) hide show
  1. package/README.md +7 -7
  2. package/lib/component/1d/Chart1D.js +3 -1
  3. package/lib/component/1d/LinesSeries.js +1 -1
  4. package/lib/component/1d/SimilarityTree.d.ts +1 -0
  5. package/lib/component/1d/SimilarityTree.js +60 -0
  6. package/lib/component/1d/Viewer1D.js +9 -11
  7. package/lib/component/1d/multiplicityTree/MultiplicityTree.d.ts +1 -7
  8. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +114 -125
  9. package/lib/component/1d/multiplicityTree/MultiplicityTrees.d.ts +1 -0
  10. package/lib/component/1d/multiplicityTree/MultiplicityTrees.js +23 -0
  11. package/lib/component/1d/multiplicityTree/generateTreeNodes.d.ts +18 -0
  12. package/lib/component/1d/multiplicityTree/generateTreeNodes.js +66 -0
  13. package/lib/component/1d/ranges/Range.d.ts +1 -1
  14. package/lib/component/1d/ranges/Range.js +8 -9
  15. package/lib/component/elements/CloseButton.d.ts +2 -10
  16. package/lib/component/elements/CloseButton.js +3 -20
  17. package/lib/component/elements/CounterLabel.d.ts +3 -3
  18. package/lib/component/elements/CounterLabel.js +3 -4
  19. package/lib/component/elements/PreferencesButton.d.ts +2 -4
  20. package/lib/component/elements/PreferencesButton.js +3 -3
  21. package/lib/component/elements/ReactTable/ReactTable.js +5 -2
  22. package/lib/component/elements/SaveButton.d.ts +2 -11
  23. package/lib/component/elements/SaveButton.js +4 -19
  24. package/lib/component/elements/ToolBarButton.d.ts +2 -0
  25. package/lib/component/elements/ToolBarButton.js +5 -0
  26. package/lib/component/elements/ToolbarPopoverItem.d.ts +11 -0
  27. package/lib/component/elements/ToolbarPopoverItem.js +10 -0
  28. package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +2 -1
  29. package/lib/component/elements/popup/Modal/ConfirmDialog.js +11 -8
  30. package/lib/component/hooks/useSaveSettings.js +3 -2
  31. package/lib/component/main/InnerNMRiumContents.js +1 -1
  32. package/lib/component/modal/AboutPredictionModal.js +4 -8
  33. package/lib/component/modal/AboutSpectrumSimulationModal.js +4 -8
  34. package/lib/component/modal/CopyClipboardModal.js +2 -2
  35. package/lib/component/modal/EditPeakShapeModal.js +2 -2
  36. package/lib/component/modal/ExportAsJcampModal.d.ts +1 -1
  37. package/lib/component/modal/ExportAsJcampModal.js +7 -3
  38. package/lib/component/modal/ImportPublicationStringModal.js +15 -11
  39. package/lib/component/modal/LoadJCAMPModal.js +12 -9
  40. package/lib/component/modal/LogsHistoryModal.d.ts +1 -1
  41. package/lib/component/modal/LogsHistoryModal.js +9 -4
  42. package/lib/component/modal/MoleculeStructureEditorModal.js +10 -3
  43. package/lib/component/modal/MultipletAnalysisModal.js +8 -8
  44. package/lib/component/modal/PredictSpectraModal.js +6 -5
  45. package/lib/component/modal/SaveAsModal.js +2 -2
  46. package/lib/component/modal/aboutUs/AboutUsModal.js +11 -26
  47. package/lib/component/modal/changeSum/ChangeSumModal.d.ts +4 -3
  48. package/lib/component/modal/changeSum/ChangeSumModal.js +10 -3
  49. package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +1 -3
  50. package/lib/component/modal/changeSum/ChangeSumModalContents.js +9 -6
  51. package/lib/component/modal/editRange/EditRangeModal.js +8 -6
  52. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +1 -0
  53. package/lib/component/modal/editRange/forms/components/CouplingsTable.js +13 -10
  54. package/lib/component/modal/editRange/forms/components/SignalFormTab.js +1 -1
  55. package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -0
  56. package/lib/component/modal/editZone/EditZoneModal.js +3 -3
  57. package/lib/component/modal/metaImportation/MetaImportationModal.js +2 -2
  58. package/lib/component/modal/setting/GeneralSettings.js +17 -38
  59. package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +2 -4
  60. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +16 -2
  61. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +22 -25
  62. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +16 -3
  63. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +5 -5
  64. package/lib/component/panels/PeaksPanel/PeaksPanel.js +43 -13
  65. package/lib/component/panels/RangesPanel/RangesHeader.d.ts +1 -1
  66. package/lib/component/panels/RangesPanel/RangesHeader.js +71 -34
  67. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +46 -5
  68. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +40 -9
  69. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +2 -2
  70. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +2 -2
  71. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +2 -2
  72. package/lib/component/panels/SummaryPanel/SummaryPanel.js +30 -19
  73. package/lib/component/panels/ZonesPanel/ZonesPanel.js +28 -28
  74. package/lib/component/panels/databasePanel/DatabasePanel.js +6 -6
  75. package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +4 -6
  76. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +13 -14
  77. package/lib/component/panels/databasePanel/DatabaseStructureSearchModal.js +7 -8
  78. package/lib/component/panels/filtersPanel/FilterPanel.js +1 -1
  79. package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
  80. package/lib/component/panels/header/DefaultPanelHeader.d.ts +10 -6
  81. package/lib/component/panels/header/DefaultPanelHeader.js +30 -9
  82. package/lib/component/panels/header/PanelHeader.js +0 -1
  83. package/lib/component/panels/header/PreferencesHeader.d.ts +2 -4
  84. package/lib/component/panels/header/PreferencesHeader.js +9 -23
  85. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +2 -2
  86. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +39 -10
  87. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +5 -1
  88. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +3 -3
  89. package/lib/component/reducer/Reducer.js +3 -0
  90. package/lib/component/reducer/actions/DatabaseActions.d.ts +3 -2
  91. package/lib/component/reducer/actions/DatabaseActions.js +5 -1
  92. package/lib/component/reducer/actions/IntegralsActions.d.ts +1 -1
  93. package/lib/component/toolbar/ToolBar.js +237 -9
  94. package/lib/component/toolbar/toolbarMenu.d.ts +4 -0
  95. package/lib/component/toolbar/toolbarMenu.js +77 -0
  96. package/lib/component/utility/booleanToString.d.ts +6 -0
  97. package/lib/component/utility/booleanToString.js +4 -0
  98. package/lib/utils/clipboard/clipboardComponents.d.ts +2 -2
  99. package/lib/utils/clipboard/clipboardComponents.js +8 -3
  100. package/lib/versionInfo.js +1 -1
  101. package/package.json +17 -16
  102. package/lib/component/1d/multiplicityTree/LevelNode.d.ts +0 -8
  103. package/lib/component/1d/multiplicityTree/LevelNode.js +0 -8
  104. package/lib/component/1d/multiplicityTree/StringNode.d.ts +0 -11
  105. package/lib/component/1d/multiplicityTree/StringNode.js +0 -7
  106. package/lib/component/1d/multiplicityTree/TreeColors.d.ts +0 -1
  107. package/lib/component/1d/multiplicityTree/TreeColors.js +0 -1
  108. package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +0 -21
  109. package/lib/component/1d/multiplicityTree/TreeNodes.js +0 -23
  110. package/lib/component/1d/multiplicityTree/buildTreeNode.d.ts +0 -11
  111. package/lib/component/1d/multiplicityTree/buildTreeNode.js +0 -57
  112. package/lib/component/elements/DeleteButton.d.ts +0 -8
  113. package/lib/component/elements/DeleteButton.js +0 -6
  114. package/lib/component/elements/DropdownMenu.d.ts +0 -9
  115. package/lib/component/elements/DropdownMenu.js +0 -7
  116. package/lib/component/panels/PeaksPanel/PeaksToggleActions.d.ts +0 -10
  117. package/lib/component/panels/PeaksPanel/PeaksToggleActions.js +0 -10
  118. package/lib/component/toolbar/BasicToolBar.d.ts +0 -1
  119. package/lib/component/toolbar/BasicToolBar.js +0 -165
  120. package/lib/component/toolbar/FunctionToolBar.d.ts +0 -3
  121. package/lib/component/toolbar/FunctionToolBar.js +0 -148
@@ -90,7 +90,11 @@ export default function SpectrumSimulation() {
90
90
  }
91
91
  }
92
92
  `,
93
- ], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { showSettingButton: true, onSettingClick: settingsPanelHandler, canDelete: false, children: [_jsx(AboutSpectrumSimulationModal, {}), _jsx(SpectrumSimulationSimpleOptions, { onSpinSystemChange: spinSystemChangeHandler, spinSystem: spinSystem })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsxs("div", { style: {
93
+ ], children: [!isFlipped && (_jsx(DefaultPanelHeader, { onSettingClick: settingsPanelHandler, leftButtons: [
94
+ {
95
+ component: _jsx(AboutSpectrumSimulationModal, {}),
96
+ },
97
+ ], children: _jsx(SpectrumSimulationSimpleOptions, { onSpinSystemChange: spinSystemChangeHandler, spinSystem: spinSystem }) })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsxs("div", { style: {
94
98
  display: 'flex',
95
99
  flexDirection: 'column',
96
100
  height: '100%',
@@ -11,10 +11,10 @@ const SPIN_SYSTEMS = getSpinSystems().map((key) => ({
11
11
  }));
12
12
  const labelStyle = {
13
13
  label: { fontSize: '10px' },
14
- wrapper: { display: 'flex', alignItems: 'center', height: '100%' },
15
- container: { padding: '0 5px', height: '100%' },
14
+ wrapper: { display: 'flex', alignItems: 'center' },
15
+ container: { padding: '0 5px' },
16
16
  };
17
- const selectStyles = { width: '100%', minWidth: '75px', fontSize: '10px' };
17
+ const selectStyles = { width: '100%', minWidth: '80px', fontSize: '10px' };
18
18
  export default function SpectrumSimulationSimpleOptions({ onSpinSystemChange, spinSystem, }) {
19
19
  return (_jsxs("div", { style: {
20
20
  display: 'flex',
@@ -29,6 +29,7 @@ export function getDefaultViewState() {
29
29
  activeSpectra: {},
30
30
  activeTab: '',
31
31
  showLegend: false,
32
+ showSimilarityTree: false,
32
33
  selectReferences: {},
33
34
  },
34
35
  zoom: {
@@ -395,6 +396,8 @@ function innerSpectrumReducer(draft, action) {
395
396
  return DatabaseActions.handleResurrectSpectrumFromRanges(draft, action);
396
397
  case 'RESURRECTING_SPECTRUM_FROM_JCAMP':
397
398
  return DatabaseActions.handleResurrectSpectrumFromJcamp(draft, action);
399
+ case 'TOGGLE_SIMILARITY_TREE':
400
+ return DatabaseActions.handleToggleSimilarityTree(draft);
398
401
  case 'SET_AUTOMATIC_ASSIGNMENTS':
399
402
  return AssignmentsActions.handleSetAutomaticAssignments(draft, action);
400
403
  case 'SECRET_THROW_ERROR': {
@@ -12,7 +12,8 @@ type ResurrectSpectrumFromRangesAction = ActionType<'RESURRECTING_SPECTRUM_FROM_
12
12
  ranges: NMRRange[];
13
13
  info: ResurrectSpectrumInfo;
14
14
  }>;
15
- export type DatabaseActions = ResurrectSpectrumFromJcampAction | ResurrectSpectrumFromRangesAction;
15
+ export type DatabaseActions = ActionType<'TOGGLE_SIMILARITY_TREE'> | ResurrectSpectrumFromJcampAction | ResurrectSpectrumFromRangesAction;
16
16
  declare function handleResurrectSpectrumFromJcamp(draft: Draft<State>, action: ResurrectSpectrumFromJcampAction): void;
17
17
  declare function handleResurrectSpectrumFromRanges(draft: Draft<State>, action: ResurrectSpectrumFromRangesAction): void;
18
- export { handleResurrectSpectrumFromRanges, handleResurrectSpectrumFromJcamp };
18
+ declare function handleToggleSimilarityTree(draft: Draft<State>): void;
19
+ export { handleResurrectSpectrumFromRanges, handleResurrectSpectrumFromJcamp, handleToggleSimilarityTree, };
@@ -29,4 +29,8 @@ function handleResurrectSpectrumFromRanges(draft, action) {
29
29
  setZoom(draft, { scale: 0.8, spectrumID: datum.id });
30
30
  }
31
31
  }
32
- export { handleResurrectSpectrumFromRanges, handleResurrectSpectrumFromJcamp };
32
+ function handleToggleSimilarityTree(draft) {
33
+ draft.view.spectra.showSimilarityTree =
34
+ !draft.view.spectra.showSimilarityTree;
35
+ }
36
+ export { handleResurrectSpectrumFromRanges, handleResurrectSpectrumFromJcamp, handleToggleSimilarityTree, };
@@ -2,9 +2,9 @@ import { Draft } from 'immer';
2
2
  import { IntegralsViewState } from 'nmr-load-save';
3
3
  import { Integral } from 'nmr-processing';
4
4
  import { SetSumOptions } from '../../../data/data1d/Spectrum1D/SumManager';
5
+ import { FilterType } from '../../utility/filterType';
5
6
  import { State } from '../Reducer';
6
7
  import { ActionType } from '../types/ActionType';
7
- import { FilterType } from '../../utility/filterType';
8
8
  type ChangeIntegralSumAction = ActionType<'CHANGE_INTEGRAL_SUM', {
9
9
  options: SetSumOptions;
10
10
  }>;
@@ -1,14 +1,242 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo } from 'react';
3
- import { Toolbar } from 'react-science/ui';
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { SvgNmrAlignBottom, SvgNmrAlignCenter, SvgNmrApodization, SvgNmrBaselineCorrection, SvgNmrFourierTransform, SvgNmrIntegrate, SvgNmrMultipleAnalysis, SvgNmrOverlay3, SvgNmrOverlay3Aligned, SvgNmrPeakPicking, SvgNmrPhaseCorrection, SvgNmrRangePicking, SvgNmrRealImag, SvgNmrZeroFilling, } from 'cheminfo-font';
3
+ import { useCallback } from 'react';
4
+ import { FaSearchPlus, FaExpand, FaDiceFour, FaFileImport, FaFileExport, } from 'react-icons/fa';
5
+ import { PiKnifeBold } from 'react-icons/pi';
6
+ import { Toolbar, useOnOff } from 'react-science/ui';
4
7
  import { useChartData } from '../context/ChartContext';
5
- import BasicToolBar from './BasicToolBar';
6
- import FunctionToolBar from './FunctionToolBar';
7
- function ToolBarInner({ selectedTool }) {
8
- return (_jsxs(Toolbar, { vertical: true, children: [_jsx(FunctionToolBar, { defaultValue: selectedTool }), _jsx(BasicToolBar, {})] }));
8
+ import { useDispatch } from '../context/DispatchContext';
9
+ import { useLoader } from '../context/LoaderContext';
10
+ import { ToolbarPopoverItem, } from '../elements/ToolbarPopoverItem';
11
+ import useCheckExperimentalFeature from '../hooks/useCheckExperimentalFeature';
12
+ import { useCheckToolsVisibility, } from '../hooks/useCheckToolsVisibility';
13
+ import useDatumWithSpectraStatistics from '../hooks/useDatumWithSpectraStatistics';
14
+ import useExport from '../hooks/useExport';
15
+ import useToolsFunctions from '../hooks/useToolsFunctions';
16
+ import { useVerticalAlign } from '../hooks/useVerticalAlign';
17
+ import ImportPublicationStringModal from '../modal/ImportPublicationStringModal';
18
+ import { LoadJCAMPModal } from '../modal/LoadJCAMPModal';
19
+ import { useMetaInformationImportationModal } from '../modal/metaImportation';
20
+ import { options } from './ToolTypes';
21
+ import { EXPORT_MENU, IMPORT_MENU } from './toolbarMenu';
22
+ function isPopoverToolItem(item) {
23
+ return !!item?.menuItems;
9
24
  }
10
- const MemoizedToolBar = memo(ToolBarInner);
11
25
  export default function ToolBar() {
12
26
  const { toolOptions: { selectedTool }, } = useChartData();
13
- return _jsx(MemoizedToolBar, { selectedTool });
27
+ const isButtonVisible = useCheckToolsVisibility();
28
+ const dispatch = useDispatch();
29
+ const { isRealSpectrumShown, changeSpectrumViewHandler, changeDisplayViewModeHandler, alignSpectrumsVerticallyHandler, handleChangeOption, handleFullZoomOut, } = useToolsFunctions();
30
+ const handleChange = useCallback((selectedOption) => {
31
+ handleChangeOption(selectedOption);
32
+ }, [handleChangeOption]);
33
+ const openLoader = useLoader();
34
+ const openMetaInformationModal = useMetaInformationImportationModal();
35
+ const isExperimentalFeature = useCheckExperimentalFeature();
36
+ const [isLoadJCAMPModalOpened, openLoadJCAMPModal, closeLoadJCAMPModal] = useOnOff(false);
37
+ const [isPublicationStringModalOpened, openPublicationStringModal, closePublicationStringModal,] = useOnOff(false);
38
+ const verticalAlign = useVerticalAlign();
39
+ const { fidCounter, ftCounter } = useDatumWithSpectraStatistics();
40
+ const importMenu = isExperimentalFeature
41
+ ? IMPORT_MENU
42
+ : IMPORT_MENU.filter((item) => item.id !== 'importPublicationString');
43
+ const exportMenu = isExperimentalFeature
44
+ ? EXPORT_MENU
45
+ : EXPORT_MENU.filter((item) => item.id !== 'nmre');
46
+ const handleOnFFTFilter = useCallback(() => {
47
+ dispatch({
48
+ type: 'APPLY_FFT_FILTER',
49
+ });
50
+ }, [dispatch]);
51
+ const handleFFtDimension1Filter = useCallback(() => {
52
+ dispatch({
53
+ type: 'APPLY_FFT_DIMENSION_1_FILTER',
54
+ });
55
+ }, [dispatch]);
56
+ const handleFFtDimension2Filter = useCallback(() => {
57
+ dispatch({
58
+ type: 'APPLY_FFT_DIMENSION_2_FILTER',
59
+ });
60
+ }, [dispatch]);
61
+ const { saveAsSVGHandler, saveAsPNGHandler, saveAsJSONHandler, saveToClipboardHandler, saveAsHandler, } = useExport();
62
+ function importHandler(data) {
63
+ switch (data?.id) {
64
+ case 'importFile':
65
+ openLoader();
66
+ break;
67
+ case 'importJDX':
68
+ openLoadJCAMPModal();
69
+ break;
70
+ case 'importPublicationString':
71
+ openPublicationStringModal();
72
+ break;
73
+ case 'importMetaInformation':
74
+ openMetaInformationModal();
75
+ break;
76
+ default:
77
+ }
78
+ }
79
+ function exportHandler(data) {
80
+ switch (data?.id) {
81
+ case 'svg':
82
+ void saveAsSVGHandler();
83
+ break;
84
+ case 'png':
85
+ void saveAsPNGHandler();
86
+ break;
87
+ case 'json':
88
+ saveAsJSONHandler();
89
+ break;
90
+ case 'advance_save':
91
+ void saveAsHandler();
92
+ break;
93
+ case 'copy':
94
+ void saveToClipboardHandler();
95
+ break;
96
+ default:
97
+ break;
98
+ }
99
+ }
100
+ const toolItems = [
101
+ {
102
+ id: 'zoom',
103
+ title: options.zoom.label,
104
+ icon: _jsx(FaSearchPlus, {}),
105
+ },
106
+ {
107
+ id: 'zoomOut',
108
+ title: 'Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )',
109
+ onClick: handleFullZoomOut,
110
+ icon: _jsx(FaExpand, {}),
111
+ },
112
+ {
113
+ id: 'peakPicking',
114
+ title: `${options.peakPicking.label} ( Press p )`,
115
+ icon: _jsx(SvgNmrPeakPicking, {}),
116
+ },
117
+ {
118
+ id: 'integral',
119
+ title: `${options.integral.label} ( Press i )`,
120
+ icon: _jsx(SvgNmrIntegrate, {}),
121
+ },
122
+ {
123
+ id: 'zonePicking',
124
+ title: `${options.zonePicking.label} ( Press r )`,
125
+ icon: _jsx(FaDiceFour, {}),
126
+ },
127
+ {
128
+ id: 'slicing',
129
+ title: options.slicing.label,
130
+ icon: _jsx(PiKnifeBold, {}),
131
+ },
132
+ {
133
+ id: 'rangePicking',
134
+ title: `${options.rangePicking.label} ( Press r )`,
135
+ icon: _jsx(SvgNmrRangePicking, {}),
136
+ },
137
+ {
138
+ id: 'multipleSpectraAnalysis',
139
+ title: options.multipleSpectraAnalysis.label,
140
+ icon: _jsx(SvgNmrMultipleAnalysis, {}),
141
+ checkOptions: { checkSpectrumType: false },
142
+ condition: ftCounter > 1,
143
+ },
144
+ {
145
+ id: 'apodization',
146
+ title: `${options.apodization.label} (Press a)`,
147
+ icon: _jsx(SvgNmrApodization, {}),
148
+ },
149
+ {
150
+ id: 'zeroFilling',
151
+ title: `${options.zeroFilling.label} ( Press z )`,
152
+ icon: _jsx(SvgNmrZeroFilling, {}),
153
+ },
154
+ {
155
+ id: 'phaseCorrection',
156
+ title: `${options.phaseCorrection.label} ( Press a )`,
157
+ icon: _jsx(SvgNmrPhaseCorrection, {}),
158
+ },
159
+ {
160
+ id: 'phaseCorrectionTwoDimensions',
161
+ title: `${options.phaseCorrectionTwoDimensions.label} ( Press a )`,
162
+ icon: _jsx(SvgNmrPhaseCorrection, {}),
163
+ },
164
+ {
165
+ id: 'baselineCorrection',
166
+ title: `${options.baselineCorrection.label} ( Press b )`,
167
+ icon: _jsx(SvgNmrBaselineCorrection, {}),
168
+ },
169
+ {
170
+ id: 'exclusionZones',
171
+ title: `${options.exclusionZones.label} ( Press e )`,
172
+ icon: _jsx(SvgNmrMultipleAnalysis, {}),
173
+ checkOptions: { checkSpectrumType: false },
174
+ condition: ftCounter > 0,
175
+ },
176
+ {
177
+ id: 'fft',
178
+ title: `${options.fft.label} ( Press t )`,
179
+ onClick: handleOnFFTFilter,
180
+ icon: _jsx(SvgNmrFourierTransform, {}),
181
+ },
182
+ {
183
+ id: 'fftDimension1',
184
+ title: options.fftDimension1.label,
185
+ onClick: handleFFtDimension1Filter,
186
+ icon: _jsx(SvgNmrFourierTransform, {}),
187
+ },
188
+ {
189
+ id: 'fftDimension2',
190
+ title: options.fftDimension2.label,
191
+ onClick: handleFFtDimension2Filter,
192
+ icon: _jsx(SvgNmrFourierTransform, {}),
193
+ },
194
+ {
195
+ id: 'import',
196
+ title: options.import.label,
197
+ icon: _jsx(FaFileImport, {}),
198
+ menuItems: importMenu,
199
+ onClick: importHandler,
200
+ },
201
+ {
202
+ id: 'exportAs',
203
+ title: options.exportAs.label,
204
+ icon: _jsx(FaFileExport, {}),
205
+ menuItems: exportMenu,
206
+ onClick: exportHandler,
207
+ },
208
+ {
209
+ id: 'spectraStackAlignments',
210
+ title: `${options.spectraStackAlignments.label} ( Press s )`,
211
+ icon: verticalAlign === 'stack' ? (_jsx(SvgNmrOverlay3Aligned, {})) : (_jsx(SvgNmrOverlay3, {})),
212
+ condition: ftCounter > 1,
213
+ onClick: changeDisplayViewModeHandler,
214
+ },
215
+ {
216
+ id: 'realImaginary',
217
+ title: isRealSpectrumShown ? 'Display real ' : 'Display imaginary',
218
+ icon: _jsx(SvgNmrRealImag, {}),
219
+ onClick: changeSpectrumViewHandler,
220
+ },
221
+ {
222
+ id: 'spectraCenterAlignments',
223
+ title: `Baseline ${verticalAlign === 'bottom' ? 'center' : 'bottom'} ( Press c )`,
224
+ icon: verticalAlign === 'bottom' ? (_jsx(SvgNmrAlignCenter, {})) : (_jsx(SvgNmrAlignBottom, {})),
225
+ condition: ftCounter > 0 || fidCounter > 0,
226
+ onClick: alignSpectrumsVerticallyHandler,
227
+ },
228
+ ];
229
+ return (_jsxs(_Fragment, { children: [_jsx(LoadJCAMPModal, { isOpen: isLoadJCAMPModalOpened, onCloseDialog: closeLoadJCAMPModal }), _jsx(ImportPublicationStringModal, { isOpen: isPublicationStringModalOpened, onClose: closePublicationStringModal }), _jsx(Toolbar, { vertical: true, children: toolItems.map((item) => {
230
+ const { id, icon, title, checkOptions, condition } = item;
231
+ const show = isButtonVisible(id, checkOptions) &&
232
+ (condition === undefined || condition);
233
+ if (!show)
234
+ return null;
235
+ if (isPopoverToolItem(item)) {
236
+ const { menuItems, onClick } = item;
237
+ return (_jsx(ToolbarPopoverItem, { options: menuItems, title: title, id: id, active: selectedTool === id, icon: icon, onClick: onClick }, id));
238
+ }
239
+ const { onClick } = item;
240
+ return (_jsx(Toolbar.Item, { onClick: onClick || (() => handleChange(id)), title: title, id: id, active: selectedTool === id, icon: icon }, id));
241
+ }) })] }));
14
242
  }
@@ -0,0 +1,4 @@
1
+ import { ToolbarPopoverMenuItem } from '../elements/ToolbarPopoverItem';
2
+ declare const IMPORT_MENU: ToolbarPopoverMenuItem[];
3
+ declare const EXPORT_MENU: ToolbarPopoverMenuItem[];
4
+ export { EXPORT_MENU, IMPORT_MENU };
@@ -0,0 +1,77 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FaCopy, FaDownload, FaFile, FaFileDownload, FaFileImage, } from 'react-icons/fa';
3
+ const IMPORT_MENU = [
4
+ {
5
+ icon: _jsx(FaFile, {}),
6
+ text: 'Import from file system (Press Ctrl + O)',
7
+ data: {
8
+ id: 'importFile',
9
+ },
10
+ },
11
+ {
12
+ icon: _jsx(FaFile, {}),
13
+ text: 'Add JCAMP-DX from URL',
14
+ data: {
15
+ id: 'importJDX',
16
+ },
17
+ },
18
+ {
19
+ icon: _jsx(FaFile, {}),
20
+ text: 'Generate spectrum from publication string',
21
+ data: {
22
+ id: 'importPublicationString',
23
+ },
24
+ },
25
+ {
26
+ icon: _jsx(FaFile, {}),
27
+ text: 'Import meta information',
28
+ data: {
29
+ id: 'importMetaInformation',
30
+ },
31
+ },
32
+ ];
33
+ const EXPORT_MENU = [
34
+ {
35
+ icon: _jsx(FaDownload, {}),
36
+ text: 'Export as SVG',
37
+ data: {
38
+ id: 'svg',
39
+ },
40
+ },
41
+ {
42
+ icon: _jsx(FaFileImage, {}),
43
+ text: 'Export as PNG',
44
+ data: {
45
+ id: 'png',
46
+ },
47
+ },
48
+ {
49
+ icon: _jsx(FaFileDownload, {}),
50
+ text: 'Save data ( Press Ctrl + S )',
51
+ data: {
52
+ id: 'json',
53
+ },
54
+ },
55
+ {
56
+ icon: _jsx(FaFileDownload, {}),
57
+ text: 'Save data as ( Press Ctrl + Shift + S )',
58
+ data: {
59
+ id: 'advance_save',
60
+ },
61
+ },
62
+ {
63
+ icon: _jsx(FaFileDownload, {}),
64
+ text: 'Save NMRE data',
65
+ data: {
66
+ id: 'nmre',
67
+ },
68
+ },
69
+ {
70
+ icon: _jsx(FaCopy, {}),
71
+ text: 'Copy image to Clipboard ( Press Ctrl + C )',
72
+ data: {
73
+ id: 'copy',
74
+ },
75
+ },
76
+ ];
77
+ export { EXPORT_MENU, IMPORT_MENU };
@@ -0,0 +1,6 @@
1
+ interface ToStringOptions {
2
+ trueLabel?: string;
3
+ falseLabel?: string;
4
+ }
5
+ export declare function booleanToString(flag: boolean, options?: ToStringOptions): string;
6
+ export {};
@@ -0,0 +1,4 @@
1
+ export function booleanToString(flag, options = {}) {
2
+ const { trueLabel = 'Show', falseLabel = 'Hide' } = options;
3
+ return flag ? trueLabel : falseLabel;
4
+ }
@@ -18,14 +18,14 @@ export interface ClipboardFallbackProps extends CFBP, Partial<Omit<ClipboardFall
18
18
  *
19
19
  * @param props
20
20
  */
21
- export declare function ClipboardFallback(props: ClipboardFallbackProps): import("react/jsx-runtime").JSX.Element | null;
21
+ export declare function ClipboardFallback(props: ClipboardFallbackProps): import("@emotion/react/jsx-runtime").JSX.Element | null;
22
22
  /**
23
23
  * return null if !props.mode
24
24
  *
25
25
  * @param props
26
26
  * @see ClipboardFallback
27
27
  */
28
- export declare function ClipboardFallbackModal(props: ClipboardFallbackProps): import("react/jsx-runtime").JSX.Element | null;
28
+ export declare function ClipboardFallbackModal(props: ClipboardFallbackProps): import("@emotion/react/jsx-runtime").JSX.Element | null;
29
29
  interface ClipboardFallbackReadProps extends CFBP {
30
30
  onRead: (file: File) => void;
31
31
  mode: 'read';
@@ -1,7 +1,9 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ /** @jsxImportSource @emotion/react */
3
+ import { Dialog, DialogBody } from '@blueprintjs/core';
4
+ import { css } from '@emotion/react';
2
5
  import styled from '@emotion/styled';
3
6
  import { useCallback, useEffect, useMemo, useRef } from 'react';
4
- import { Modal } from 'react-science/ui';
5
7
  import Button from '../../component/elements/Button';
6
8
  const ClipboardForm = styled.form `
7
9
  padding: 0.5rem;
@@ -90,7 +92,10 @@ export function ClipboardFallbackModal(props) {
90
92
  write: `Export data to file`,
91
93
  writeText: `Copy text from text area`,
92
94
  };
93
- return (_jsxs(Modal, { hasCloseButton: true, isOpen: true, onRequestClose: props.onDismiss, children: [_jsx(Modal.Header, { children: _jsx("h2", { children: titles[props.mode] }) }), _jsx(Modal.Body, { children: _jsx(ClipboardFallback, { ...props }) })] }));
95
+ return (_jsx(Dialog, { isOpen: true, onClose: props.onDismiss, title: titles[props.mode], children: _jsx(DialogBody, { css: css `
96
+ padding: 0;
97
+ background-color: white;
98
+ `, children: _jsx(ClipboardFallback, { ...props }) }) }));
94
99
  }
95
100
  function ClipboardFallbackRead(props) {
96
101
  const onFileRef = useRef(props.onRead);
@@ -1 +1 @@
1
- export default { version: 'v0.49.0' };
1
+ export default { version: 'v0.50.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.49.0",
4
+ "version": "0.50.1",
5
5
  "license": "MIT",
6
6
  "module": "lib/component/main/index.js",
7
7
  "types": "lib/component/main/index.d.ts",
@@ -83,16 +83,17 @@
83
83
  "ml-conrec": "^5.0.2",
84
84
  "ml-gsd": "^12.1.3",
85
85
  "ml-matrix": "^6.11.0",
86
- "ml-spectra-processing": "^12.10.1",
86
+ "ml-spectra-processing": "^12.10.2",
87
87
  "ml-stat": "^1.3.3",
88
+ "ml-tree-similarity": "^2.2.0",
88
89
  "multiplet-analysis": "^2.1.2",
89
90
  "nmr-correlation": "^2.3.3",
90
- "nmr-load-save": "^0.26.0",
91
- "nmr-processing": "^11.10.0",
91
+ "nmr-load-save": "^0.27.3",
92
+ "nmr-processing": "^11.10.1",
92
93
  "nmredata": "^0.9.9",
93
94
  "numeral": "^2.0.6",
94
95
  "openchemlib": "^8.8.1",
95
- "openchemlib-utils": "^5.8.0",
96
+ "openchemlib-utils": "^5.9.0",
96
97
  "papaparse": "^5.4.1",
97
98
  "re-resizable": "6.9.11",
98
99
  "react-d3-utils": "^1.0.0",
@@ -105,7 +106,7 @@
105
106
  "react-ocl-nmr": "^3.0.1",
106
107
  "react-plot": "^1.4.2",
107
108
  "react-rnd": "^10.4.1",
108
- "react-science": "^0.32.2",
109
+ "react-science": "^0.36.0",
109
110
  "react-slider": "^2.0.6",
110
111
  "react-table": "^7.8.0",
111
112
  "react-transition-group": "^4.4.5",
@@ -121,32 +122,32 @@
121
122
  "@simbathesailor/use-what-changed": "^2.0.0",
122
123
  "@types/d3": "^7.4.3",
123
124
  "@types/lodash": "^4.14.202",
124
- "@types/node": "^20.11.16",
125
+ "@types/node": "^20.11.19",
125
126
  "@types/papaparse": "^5.3.14",
126
- "@types/react": "^18.2.51",
127
- "@types/react-dom": "^18.2.18",
127
+ "@types/react": "^18.2.57",
128
+ "@types/react-dom": "^18.2.19",
128
129
  "@types/react-table": "^7.7.19",
129
130
  "@vitejs/plugin-react-swc": "^3.6.0",
130
- "@vitest/coverage-v8": "^1.2.2",
131
+ "@vitest/coverage-v8": "^1.3.1",
131
132
  "cross-env": "^7.0.3",
132
- "cspell": "^8.3.2",
133
+ "cspell": "^8.4.1",
133
134
  "eslint": "^8.56.0",
134
135
  "eslint-config-cheminfo-react": "^10.1.0",
135
- "eslint-config-cheminfo-typescript": "^12.1.0",
136
+ "eslint-config-cheminfo-typescript": "^12.2.0",
136
137
  "modern-normalize": "^2.0.0",
137
138
  "postcss-styled-syntax": "^0.6.4",
138
- "prettier": "^3.2.4",
139
+ "prettier": "^3.2.5",
139
140
  "rc-menu": "^9.12.4",
140
141
  "react": "^18.2.0",
141
142
  "react-dom": "^18.2.0",
142
- "react-router-dom": "^6.22.0",
143
+ "react-router-dom": "^6.22.1",
143
144
  "rimraf": "^5.0.5",
144
145
  "rollup-plugin-analyzer": "^4.0.0",
145
146
  "serve": "^14.2.1",
146
147
  "stylelint": "^16.2.1",
147
148
  "stylelint-config-standard": "^36.0.0",
148
149
  "typescript": "^5.3.3",
149
- "vite": "^5.0.12",
150
- "vitest": "^1.2.2"
150
+ "vite": "^5.1.3",
151
+ "vitest": "^1.3.1"
151
152
  }
152
153
  }
@@ -1,8 +0,0 @@
1
- import { Signal1D } from 'nmr-processing';
2
- interface LevelNodeProps {
3
- signal: Signal1D;
4
- startY: number;
5
- levelHeight: number;
6
- }
7
- declare function LevelNode({ signal, startY, levelHeight }: LevelNodeProps): import("react/jsx-runtime").JSX.Element;
8
- export default LevelNode;
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useScaleChecked } from '../../context/ScaleContext';
3
- import { TREE_LEVEL_COLORS } from './TreeColors';
4
- function LevelNode({ signal, startY, levelHeight }) {
5
- const { scaleX } = useScaleChecked();
6
- return (_jsx("line", { x1: scaleX()(signal.delta), y1: startY, x2: scaleX()(signal.delta), y2: startY + levelHeight, stroke: TREE_LEVEL_COLORS[0] }, `startLevelNode_${signal.id}`));
7
- }
8
- export default LevelNode;
@@ -1,11 +0,0 @@
1
- import { CSSProperties } from 'react';
2
- import { Signal1D } from 'nmr-processing';
3
- interface StringNodeProps {
4
- signal: Signal1D;
5
- startY: number;
6
- levelHeight: number;
7
- fontSize: CSSProperties['fontSize'];
8
- showLabels: boolean;
9
- }
10
- declare function StringNode({ signal, startY, levelHeight, fontSize, showLabels, }: StringNodeProps): import("react/jsx-runtime").JSX.Element;
11
- export default StringNode;
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useScaleChecked } from '../../context/ScaleContext';
3
- function StringNode({ signal, startY, levelHeight, fontSize, showLabels, }) {
4
- const { scaleX } = useScaleChecked();
5
- return (_jsx("text", { textAnchor: "middle", x: scaleX()(signal.delta), y: startY + levelHeight / 2, fontSize: fontSize, lengthAdjust: "spacing", fill: "black", visibility: showLabels ? 'visible' : 'hidden', children: signal.multiplicity }, `multiplicityString_${signal.id}`));
6
- }
7
- export default StringNode;
@@ -1 +0,0 @@
1
- export declare const TREE_LEVEL_COLORS: string[];
@@ -1 +0,0 @@
1
- export const TREE_LEVEL_COLORS = ['red', 'green', 'blue', 'magenta'];
@@ -1,21 +0,0 @@
1
- import { CSSProperties } from 'react';
2
- interface NodeData {
3
- startX: number;
4
- _startX: number;
5
- ratio: number;
6
- multiplicityIndex: number;
7
- color: string;
8
- }
9
- interface TreeNodesProps {
10
- showLabels: boolean;
11
- startY: number;
12
- signalID: string;
13
- levelHeight: number;
14
- nodesData: NodeData[];
15
- labelOptions: {
16
- distance: number;
17
- fontSize: CSSProperties['fontSize'];
18
- };
19
- }
20
- declare function TreeNodes({ nodesData, levelHeight, startY, signalID, labelOptions, showLabels, }: TreeNodesProps): import("react/jsx-runtime").JSX.Element;
21
- export default TreeNodes;
@@ -1,23 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- /* eslint-disable react/no-unused-prop-types */
3
- import { useCallback } from 'react';
4
- import { useScaleChecked } from '../../context/ScaleContext';
5
- function TreeNodes({ nodesData, levelHeight, startY, signalID, labelOptions, showLabels, }) {
6
- const { scaleX } = useScaleChecked();
7
- const buildTreeNodeAndEdge = useCallback(({ startX, _startX, ratio, multiplicityIndex, color }) => {
8
- const edgeLevel = 2 * multiplicityIndex + 2;
9
- const _startYEdge = startY + edgeLevel * levelHeight;
10
- const _startYNode = startY + (edgeLevel + 1) * levelHeight;
11
- return (_jsxs("g", { children: [_jsx("text", { textAnchor: "middle", x: scaleX()(_startX) + labelOptions.distance, y: _startYNode + 2 * (levelHeight / 3), fontSize: labelOptions.fontSize, fill: color, visibility: showLabels ? 'visible' : 'hidden', children: ratio }), _jsx("line", { x1: scaleX()(startX), y1: _startYEdge, x2: scaleX()(_startX), y2: _startYNode, stroke: color }), _jsx("line", { x1: scaleX()(_startX), y1: _startYNode, x2: scaleX()(_startX), y2: _startYNode + levelHeight, stroke: color })] }, `${multiplicityIndex}_${signalID}_${startX}_${_startX}_${ratio}`));
12
- }, [
13
- signalID,
14
- labelOptions.distance,
15
- labelOptions.fontSize,
16
- scaleX,
17
- showLabels,
18
- startY,
19
- levelHeight,
20
- ]);
21
- return _jsx(_Fragment, { children: nodesData?.map((node) => buildTreeNodeAndEdge(node)) });
22
- }
23
- export default TreeNodes;