nmrium 0.42.0 → 0.43.1-pre.1692874523
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.
- package/lib/component/1d/ApodizationLine.js +1 -1
- package/lib/component/1d/Chart1D.js +3 -2
- package/lib/component/1d/ExclusionZonesAnnotations.js +1 -2
- package/lib/component/1d/Line.js +1 -1
- package/lib/component/1d/Viewer1D.js +15 -3
- package/lib/component/1d/integral/IntegralResizable.js +4 -3
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +3 -1
- package/lib/component/1d/peaks/PeakAnnotations.js +20 -25
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +2 -0
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +59 -0
- package/lib/component/1d/peaks/PeakEditionManager.d.ts +18 -0
- package/lib/component/1d/peaks/PeakEditionManager.js +98 -0
- package/lib/component/1d/peaks/Peaks.d.ts +1 -0
- package/lib/component/1d/peaks/Peaks.js +22 -0
- package/lib/component/1d/ranges/Range.js +3 -1
- package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
- package/lib/component/1d/tool/BaseLineZones.js +11 -31
- package/lib/component/1d/utilities/intersectionResolver.d.ts +25 -0
- package/lib/component/1d/utilities/intersectionResolver.js +71 -0
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts +2 -2
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +17 -16
- package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +2 -2
- package/lib/component/2d/SlicingView.js +1 -1
- package/lib/component/2d/Viewer2D.js +1 -3
- package/lib/component/2d/ft/Contours.js +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +5 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +48 -8
- package/lib/component/assignment/index.d.ts +6 -1
- package/lib/component/assignment/index.js +5 -1
- package/lib/component/context/DispatchContext.d.ts +3 -2
- package/lib/component/context/KeyModifierContext.d.ts +13 -0
- package/lib/component/context/KeyModifierContext.js +39 -0
- package/lib/component/context/PreferencesContext.d.ts +39 -39
- package/lib/component/elements/Button.js +2 -0
- package/lib/component/elements/CounterLabel.d.ts +7 -0
- package/lib/component/elements/CounterLabel.js +12 -0
- package/lib/component/elements/EditableColumn.js +12 -6
- package/lib/component/elements/Input.d.ts +3 -12
- package/lib/component/elements/Input.js +24 -76
- package/lib/component/elements/Message.js +0 -1
- package/lib/component/elements/NumberInput.d.ts +1 -0
- package/lib/component/elements/NumberInput.js +10 -3
- package/lib/component/elements/PreferencesButton.d.ts +4 -0
- package/lib/component/elements/PreferencesButton.js +6 -0
- package/lib/component/elements/formik/FormikInput.d.ts +2 -2
- package/lib/component/elements/formik/FormikInput.js +3 -6
- package/lib/component/elements/formik/FormikOnChange.js +1 -1
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib/component/header/ApodizationOptionsPanel.js +23 -14
- package/lib/component/header/BaseLineCorrectionPanel.js +31 -10
- package/lib/component/header/Header.d.ts +10 -3
- package/lib/component/header/Header.js +6 -6
- package/lib/component/header/ZeroFillingOptionsPanel.js +37 -31
- package/lib/component/highlight/index.d.ts +1 -0
- package/lib/component/highlight/index.js +1 -0
- package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
- package/lib/component/hooks/useCheckToolsVisibility.js +7 -3
- package/lib/component/hooks/useResizerStatus.d.ts +2 -0
- package/lib/component/hooks/useResizerStatus.js +7 -0
- package/lib/component/hooks/useSpectrum.js +1 -1
- package/lib/component/main/ErrorOverlay.js +20 -0
- package/lib/component/main/InnerNMRium.d.ts +7 -0
- package/lib/component/main/InnerNMRium.js +52 -0
- package/lib/component/main/InnerNMRiumContents.d.ts +14 -0
- package/lib/component/main/InnerNMRiumContents.js +88 -0
- package/lib/component/main/NMRium.d.ts +23 -0
- package/lib/component/main/NMRium.js +13 -0
- package/lib/component/main/NMRiumStateProvider.d.ts +9 -0
- package/lib/component/main/NMRiumStateProvider.js +74 -0
- package/lib/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
- package/lib/component/main/StateError.d.ts +4 -0
- package/lib/component/main/StateError.js +16 -0
- package/lib/component/main/index.d.ts +3 -0
- package/lib/component/main/index.js +3 -0
- package/lib/component/main/types.d.ts +18 -0
- package/lib/component/main/types.js +2 -0
- package/lib/component/modal/AlignSpectraModal.js +78 -29
- package/lib/component/modal/MoleculeStructureEditorModal.d.ts +5 -1
- package/lib/component/modal/MoleculeStructureEditorModal.js +12 -15
- package/lib/component/modal/MultipletAnalysisModal.js +1 -1
- package/lib/component/modal/PredictSpectraModal.js +1 -1
- package/lib/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
- package/lib/component/modal/aboutUs/AboutUsZakodium.d.ts +1 -0
- package/lib/component/modal/aboutUs/AboutUsZakodium.js +33 -0
- package/lib/component/modal/changeSum/ChangeSumModal.d.ts +5 -16
- package/lib/component/modal/changeSum/ChangeSumModal.js +6 -115
- package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +18 -0
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +94 -0
- package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +2 -2
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
- package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
- package/lib/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
- package/lib/component/modal/setting/settingsValidation.js +5 -1
- package/lib/component/panels/InformationPanel.js +9 -100
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -11
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +3 -9
- package/lib/component/panels/MoleculesPanel/Utilities.js +14 -10
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +13 -9
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +5 -5
- package/lib/component/panels/Panels.js +6 -7
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +11 -5
- package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +6 -10
- package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
- package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +6 -6
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -3
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +2 -3
- package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +8 -9
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +3 -2
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.d.ts +18 -1
- package/lib/component/panels/databasePanel/DatabasePanel.js +3 -40
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +18 -0
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +53 -0
- package/lib/component/panels/header/DefaultPanelHeader.d.ts +3 -4
- package/lib/component/panels/header/DefaultPanelHeader.js +11 -13
- package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -3
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
- package/lib/component/reducer/IgnoreActions.js +1 -1
- package/lib/component/reducer/Reducer.d.ts +3 -8
- package/lib/component/reducer/Reducer.js +34 -8
- package/lib/component/reducer/actions/DomainActions.js +2 -3
- package/lib/component/reducer/actions/FiltersActions.d.ts +32 -11
- package/lib/component/reducer/actions/FiltersActions.js +96 -28
- package/lib/component/reducer/actions/IntegralsActions.d.ts +6 -2
- package/lib/component/reducer/actions/IntegralsActions.js +44 -20
- package/lib/component/reducer/actions/MoleculeActions.js +4 -4
- package/lib/component/reducer/actions/PeaksActions.d.ts +6 -4
- package/lib/component/reducer/actions/PeaksActions.js +19 -1
- package/lib/component/reducer/actions/PreferencesActions.js +1 -2
- package/lib/component/reducer/actions/RangesActions.d.ts +6 -2
- package/lib/component/reducer/actions/RangesActions.js +31 -3
- package/lib/component/reducer/actions/ToolsActions.js +10 -10
- package/lib/component/reducer/core/Constants.d.ts +0 -4
- package/lib/component/reducer/core/Constants.js +0 -5
- package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -2
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
- package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.d.ts +1 -1
- package/lib/component/toolbar/FunctionToolBar.js +13 -3
- package/lib/component/toolbar/ToolTypes.d.ts +3 -2
- package/lib/component/toolbar/ToolTypes.js +57 -22
- package/lib/component/utility/export.js +7 -4
- package/lib/component/utility/filterType.d.ts +3 -0
- package/lib/component/utility/filterType.js +1 -0
- package/lib/component/workspaces/basic.js +2 -0
- package/lib/component/workspaces/embedded.js +2 -0
- package/lib/component/workspaces/exercise.js +2 -0
- package/lib/component/workspaces/prediction.js +9 -0
- package/lib/component/workspaces/process1D.js +2 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js +2 -0
- package/lib/data/PredictionManager.d.ts +3 -3
- package/lib/data/PredictionManager.js +10 -10
- package/lib/data/constants/References.d.ts +5 -3
- package/lib/data/data1d/Spectrum1D/getReferenceShift.d.ts +10 -1
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -2
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +2 -8
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
- package/lib/data/molecules/Molecule.js +2 -2
- package/lib/data/utilities/checkModifierKeyActivated.d.ts +1 -1
- package/lib/data/utilities/checkModifierKeyActivated.js +8 -13
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +3 -2
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
- package/lib-cjs/component/1d/Line.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +15 -3
- package/lib-cjs/component/1d/integral/IntegralResizable.js +4 -3
- package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +3 -1
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +19 -24
- package/lib-cjs/component/1d/peaks/PeakAnnotationsSpreadMode.js +64 -0
- package/lib-cjs/component/1d/peaks/PeakEditionManager.js +129 -0
- package/lib-cjs/component/1d/peaks/Peaks.js +29 -0
- package/lib-cjs/component/1d/ranges/Range.js +3 -1
- package/lib-cjs/component/1d/tool/BaseLineZones.js +11 -34
- package/lib-cjs/component/1d/utilities/intersectionResolver.js +75 -0
- package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +17 -16
- package/lib-cjs/component/2d/SlicingView.js +1 -1
- package/lib-cjs/component/2d/Viewer2D.js +1 -3
- package/lib-cjs/component/2d/ft/Contours.js +1 -1
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +47 -7
- package/lib-cjs/component/assignment/index.js +5 -1
- package/lib-cjs/component/context/KeyModifierContext.js +44 -0
- package/lib-cjs/component/elements/Button.js +2 -0
- package/lib-cjs/component/elements/CounterLabel.js +16 -0
- package/lib-cjs/component/elements/EditableColumn.js +12 -6
- package/lib-cjs/component/elements/Input.js +23 -75
- package/lib-cjs/component/elements/Message.js +0 -1
- package/lib-cjs/component/elements/NumberInput.js +12 -2
- package/lib-cjs/component/elements/PreferencesButton.js +13 -0
- package/lib-cjs/component/elements/formik/FormikInput.js +3 -6
- package/lib-cjs/component/elements/formik/FormikOnChange.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib-cjs/component/header/ApodizationOptionsPanel.js +23 -14
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +30 -9
- package/lib-cjs/component/header/Header.js +6 -6
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +35 -29
- package/lib-cjs/component/highlight/index.js +1 -0
- package/lib-cjs/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +7 -3
- package/lib-cjs/component/hooks/useResizerStatus.js +11 -0
- package/lib-cjs/component/hooks/useSpectrum.js +1 -1
- package/lib-cjs/component/main/ErrorOverlay.js +26 -0
- package/lib-cjs/component/main/InnerNMRium.js +82 -0
- package/lib-cjs/component/main/InnerNMRiumContents.js +95 -0
- package/lib-cjs/component/main/NMRium.js +19 -0
- package/lib-cjs/component/main/NMRiumStateProvider.js +80 -0
- package/lib-cjs/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
- package/lib-cjs/component/main/StateError.js +20 -0
- package/lib-cjs/component/main/index.js +21 -0
- package/lib-cjs/component/main/types.js +3 -0
- package/lib-cjs/component/modal/AlignSpectraModal.js +100 -28
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +11 -17
- package/lib-cjs/component/modal/MultipletAnalysisModal.js +1 -1
- package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
- package/lib-cjs/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
- package/lib-cjs/component/modal/aboutUs/AboutUsZakodium.js +39 -0
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +6 -141
- package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +124 -0
- package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -2
- package/lib-cjs/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/settingsValidation.js +4 -0
- package/lib-cjs/component/panels/InformationPanel.js +7 -98
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +29 -11
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +14 -10
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
- package/lib-cjs/component/panels/Panels.js +6 -7
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +32 -3
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +29 -10
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +29 -6
- package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +4 -5
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +7 -8
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +26 -2
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +3 -40
- package/lib-cjs/component/panels/databasePanel/DatabaseSearchOptions.js +60 -0
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +12 -12
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -3
- package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
- package/lib-cjs/component/reducer/IgnoreActions.js +1 -1
- package/lib-cjs/component/reducer/Reducer.js +33 -7
- package/lib-cjs/component/reducer/actions/DomainActions.js +2 -3
- package/lib-cjs/component/reducer/actions/FiltersActions.js +98 -28
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +45 -20
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +3 -3
- package/lib-cjs/component/reducer/actions/PeaksActions.js +20 -1
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +1 -2
- package/lib-cjs/component/reducer/actions/RangesActions.js +31 -2
- package/lib-cjs/component/reducer/actions/ToolsActions.js +9 -9
- package/lib-cjs/component/reducer/core/Constants.js +1 -6
- package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +1 -2
- package/lib-cjs/component/toolbar/FunctionToolBar.js +13 -3
- package/lib-cjs/component/toolbar/ToolTypes.js +57 -22
- package/lib-cjs/component/utility/export.js +7 -4
- package/lib-cjs/component/utility/filterType.js +2 -0
- package/lib-cjs/component/workspaces/basic.js +2 -0
- package/lib-cjs/component/workspaces/embedded.js +2 -0
- package/lib-cjs/component/workspaces/exercise.js +2 -0
- package/lib-cjs/component/workspaces/prediction.js +9 -0
- package/lib-cjs/component/workspaces/process1D.js +2 -0
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +2 -0
- package/lib-cjs/data/PredictionManager.js +9 -9
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +1 -7
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
- package/lib-cjs/data/molecules/Molecule.js +2 -2
- package/lib-cjs/data/utilities/checkModifierKeyActivated.js +8 -13
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +26 -25
- package/lib/component/1d/peaks/PeakAnnotation.d.ts +0 -12
- package/lib/component/1d/peaks/PeakAnnotation.js +0 -116
- package/lib/component/ErrorOverlay.js +0 -27
- package/lib/component/NMRium.d.ts +0 -42
- package/lib/component/NMRium.js +0 -237
- package/lib/component/reducer/actions/GlobalActions.d.ts +0 -9
- package/lib/component/reducer/actions/GlobalActions.js +0 -4
- package/lib-cjs/component/1d/peaks/PeakAnnotation.js +0 -118
- package/lib-cjs/component/ErrorOverlay.js +0 -30
- package/lib-cjs/component/NMRium.js +0 -267
- package/lib-cjs/component/reducer/actions/GlobalActions.js +0 -7
- /package/lib/component/{ErrorOverlay.d.ts → main/ErrorOverlay.d.ts} +0 -0
- /package/lib/component/{SplitPaneWrapper.d.ts → main/SplitPaneWrapper.d.ts} +0 -0
- /package/lib/component/modal/{AboutUsModal.d.ts → aboutUs/AboutUsModal.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nmrium",
|
|
3
3
|
"description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.43.1-pre.1692874523",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"main": "lib-cjs/component/
|
|
7
|
-
"module": "lib/component/
|
|
8
|
-
"types": "lib/component/
|
|
6
|
+
"main": "lib-cjs/component/main/index.js",
|
|
7
|
+
"module": "lib/component/main/index.js",
|
|
8
|
+
"types": "lib/component/main/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"lib",
|
|
11
11
|
"lib-cjs"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"url": "git+https://github.com/cheminfo/nmrium.git"
|
|
48
48
|
},
|
|
49
49
|
"volta": {
|
|
50
|
-
"node": "18.
|
|
50
|
+
"node": "18.17.0"
|
|
51
51
|
},
|
|
52
52
|
"overrides": {
|
|
53
53
|
"react": "$react",
|
|
@@ -59,8 +59,9 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@emotion/react": "^11.11.1",
|
|
62
|
+
"@emotion/styled": "^11.11.0",
|
|
62
63
|
"@lukeed/uuid": "^2.0.1",
|
|
63
|
-
"cheminfo-font": "^1.
|
|
64
|
+
"cheminfo-font": "^1.11.0",
|
|
64
65
|
"cheminfo-types": "^1.7.2",
|
|
65
66
|
"clipboard-polyfill": "^4.0.0",
|
|
66
67
|
"convert-to-jcamp": "^5.4.7",
|
|
@@ -68,8 +69,8 @@
|
|
|
68
69
|
"eventemitter3": "^5.0.1",
|
|
69
70
|
"fifo-logger": "^0.6.1",
|
|
70
71
|
"file-saver": "^2.0.5",
|
|
71
|
-
"filelist-utils": "^1.10.
|
|
72
|
-
"formik": "^2.4.
|
|
72
|
+
"filelist-utils": "^1.10.2",
|
|
73
|
+
"formik": "^2.4.3",
|
|
73
74
|
"immer": "^10.0.2",
|
|
74
75
|
"jszip": "^3.10.1",
|
|
75
76
|
"lodash": "^4.17.21",
|
|
@@ -86,25 +87,25 @@
|
|
|
86
87
|
"ml-stat": "^1.3.3",
|
|
87
88
|
"multiplet-analysis": "^2.1.2",
|
|
88
89
|
"nmr-correlation": "^2.3.3",
|
|
89
|
-
"nmr-load-save": "^0.
|
|
90
|
-
"nmr-processing": "^
|
|
90
|
+
"nmr-load-save": "^0.17.2",
|
|
91
|
+
"nmr-processing": "^10.0.6",
|
|
91
92
|
"nmredata": "^0.9.2",
|
|
92
93
|
"numeral": "^2.0.6",
|
|
93
94
|
"openchemlib": "^8.3.0",
|
|
94
|
-
"openchemlib-utils": "^
|
|
95
|
+
"openchemlib-utils": "^4.3.2",
|
|
95
96
|
"papaparse": "^5.4.1",
|
|
96
|
-
"re-resizable": "
|
|
97
|
+
"re-resizable": "6.9.6",
|
|
97
98
|
"react-d3-utils": "^1.0.0",
|
|
98
99
|
"react-dropzone": "^14.2.3",
|
|
99
100
|
"react-error-boundary": "^4.0.10",
|
|
100
101
|
"react-icons": "^4.10.1",
|
|
101
102
|
"react-inspector": "^6.0.2",
|
|
102
103
|
"react-mf": "^2.0.2",
|
|
103
|
-
"react-ocl": "^
|
|
104
|
-
"react-ocl-nmr": "^
|
|
104
|
+
"react-ocl": "^6.1.0",
|
|
105
|
+
"react-ocl-nmr": "^3.0.0",
|
|
105
106
|
"react-plot": "^1.4.2",
|
|
106
107
|
"react-rnd": "^10.4.1",
|
|
107
|
-
"react-science": "^0.
|
|
108
|
+
"react-science": "^0.26.2",
|
|
108
109
|
"react-slider": "^2.0.6",
|
|
109
110
|
"react-table": "^7.8.0",
|
|
110
111
|
"react-transition-group": "^4.4.5",
|
|
@@ -116,25 +117,25 @@
|
|
|
116
117
|
"@babel/plugin-transform-modules-commonjs": "^7.22.5",
|
|
117
118
|
"@babel/preset-react": "^7.22.5",
|
|
118
119
|
"@babel/preset-typescript": "^7.22.5",
|
|
119
|
-
"@playwright/test": "^1.36.
|
|
120
|
+
"@playwright/test": "^1.36.2",
|
|
120
121
|
"@simbathesailor/use-what-changed": "^2.0.0",
|
|
121
122
|
"@types/d3": "^7.4.0",
|
|
122
|
-
"@types/node": "^20.4.
|
|
123
|
+
"@types/node": "^20.4.8",
|
|
123
124
|
"@types/papaparse": "^5.3.7",
|
|
124
|
-
"@types/react": "^18.2.
|
|
125
|
+
"@types/react": "^18.2.19",
|
|
125
126
|
"@types/react-dom": "^18.2.7",
|
|
126
127
|
"@types/react-table": "^7.7.14",
|
|
127
128
|
"@vitejs/plugin-react-swc": "^3.3.2",
|
|
128
|
-
"@vitest/coverage-v8": "^0.
|
|
129
|
+
"@vitest/coverage-v8": "^0.34.1",
|
|
129
130
|
"cross-env": "^7.0.3",
|
|
130
131
|
"cspell": "^6.31.2",
|
|
131
|
-
"eslint": "^8.
|
|
132
|
+
"eslint": "^8.46.0",
|
|
132
133
|
"eslint-config-cheminfo-react": "^10.0.0",
|
|
133
|
-
"eslint-config-cheminfo-typescript": "^12.0.
|
|
134
|
+
"eslint-config-cheminfo-typescript": "^12.0.4",
|
|
134
135
|
"modern-normalize": "^2.0.0",
|
|
135
136
|
"postcss-styled-syntax": "^0.4.0",
|
|
136
|
-
"prettier": "^3.0.
|
|
137
|
-
"rc-menu": "^9.11.
|
|
137
|
+
"prettier": "^3.0.1",
|
|
138
|
+
"rc-menu": "^9.11.1",
|
|
138
139
|
"react": "^18.2.0",
|
|
139
140
|
"react-dom": "^18.2.0",
|
|
140
141
|
"react-router-dom": "^6.14.2",
|
|
@@ -144,7 +145,7 @@
|
|
|
144
145
|
"stylelint": "^15.10.2",
|
|
145
146
|
"stylelint-config-standard": "^34.0.0",
|
|
146
147
|
"typescript": "~5.1.6",
|
|
147
|
-
"vite": "^4.4.
|
|
148
|
-
"vitest": "^0.
|
|
148
|
+
"vite": "^4.4.9",
|
|
149
|
+
"vitest": "^0.34.1"
|
|
149
150
|
}
|
|
150
151
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
interface PeakAnnotationProps {
|
|
2
|
-
id: string;
|
|
3
|
-
x: number;
|
|
4
|
-
y: number;
|
|
5
|
-
sign: number;
|
|
6
|
-
color: string;
|
|
7
|
-
value: number;
|
|
8
|
-
nucleus: string;
|
|
9
|
-
}
|
|
10
|
-
declare function PeakAnnotation({ id, x, y, sign, // 1 positive -1 negative
|
|
11
|
-
value, color, nucleus, }: PeakAnnotationProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
-
export default PeakAnnotation;
|
|
@@ -1,116 +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 { useRef, useState, useCallback, useLayoutEffect, useEffect, useMemo, } from 'react';
|
|
5
|
-
import { useDispatch } from '../../context/DispatchContext';
|
|
6
|
-
import { HighlightEventSource, useHighlight } from '../../highlight';
|
|
7
|
-
import { usePanelPreferences } from '../../hooks/usePanelPreferences';
|
|
8
|
-
import { formatNumber } from '../../utility/formatNumber';
|
|
9
|
-
const styles = css `
|
|
10
|
-
input {
|
|
11
|
-
user-select: text;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
input[type='number']::-webkit-outer-spin-button,
|
|
15
|
-
input[type='number']::-webkit-inner-spin-button {
|
|
16
|
-
appearance: none;
|
|
17
|
-
margin: 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
input[type='number'] {
|
|
21
|
-
appearance: textfield;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.notification-input-normal {
|
|
25
|
-
opacity: 1;
|
|
26
|
-
left: 4px;
|
|
27
|
-
position: fixed;
|
|
28
|
-
font-size: 10px;
|
|
29
|
-
outline: none;
|
|
30
|
-
background-color: transparent;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.notification-input-normal input:focus {
|
|
34
|
-
outline: none;
|
|
35
|
-
background-color: white;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.input-over {
|
|
39
|
-
background-color: white;
|
|
40
|
-
outline: none;
|
|
41
|
-
}
|
|
42
|
-
`;
|
|
43
|
-
function PeakAnnotation({ id, x, y, sign, // 1 positive -1 negative
|
|
44
|
-
value, color, nucleus, }) {
|
|
45
|
-
const refText = useRef(null);
|
|
46
|
-
const [isSelected, setIsSelected] = useState(false);
|
|
47
|
-
const [_value, setValue] = useState(value);
|
|
48
|
-
const [containerSize, setContainerSize] = useState({ width: 0, height: 0 });
|
|
49
|
-
const { deltaPPM } = usePanelPreferences('peaks', nucleus);
|
|
50
|
-
const highlight = useHighlight([id], {
|
|
51
|
-
type: HighlightEventSource.PEAK,
|
|
52
|
-
extra: { id },
|
|
53
|
-
});
|
|
54
|
-
const dispatch = useDispatch();
|
|
55
|
-
const handleOnPeakChange = useCallback((e) => dispatch({ type: 'SHIFT_SPECTRUM', payload: { shift: e.shiftValue } }), [dispatch]);
|
|
56
|
-
useLayoutEffect(() => {
|
|
57
|
-
const textBox = refText.current?.getBBox();
|
|
58
|
-
setContainerSize({
|
|
59
|
-
width: textBox?.width || 0,
|
|
60
|
-
height: textBox?.height || 0,
|
|
61
|
-
});
|
|
62
|
-
}, [isSelected]);
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
setValue(value);
|
|
65
|
-
}, [value]);
|
|
66
|
-
const handleKeyDown = useCallback((event) => {
|
|
67
|
-
if (event.key === 'Enter') {
|
|
68
|
-
const newValue = event.currentTarget.valueAsNumber;
|
|
69
|
-
if (!Number.isNaN(newValue)) {
|
|
70
|
-
const shiftValue = newValue - value;
|
|
71
|
-
handleOnPeakChange({
|
|
72
|
-
id,
|
|
73
|
-
value: newValue,
|
|
74
|
-
oldValue: value,
|
|
75
|
-
shiftValue,
|
|
76
|
-
});
|
|
77
|
-
event.currentTarget.blur();
|
|
78
|
-
setIsSelected(false);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else if (event.key === 'Escape') {
|
|
82
|
-
setValue(value);
|
|
83
|
-
event.currentTarget.blur();
|
|
84
|
-
setIsSelected(false);
|
|
85
|
-
}
|
|
86
|
-
}, [value, handleOnPeakChange, id]);
|
|
87
|
-
const handleChange = useCallback((event) => {
|
|
88
|
-
setValue(event.target.value);
|
|
89
|
-
}, []);
|
|
90
|
-
const handleSelectPeakAnnotation = useCallback((e) => {
|
|
91
|
-
e.stopPropagation();
|
|
92
|
-
setIsSelected(true);
|
|
93
|
-
return false;
|
|
94
|
-
}, []);
|
|
95
|
-
const handleOnEnterNotation = useCallback(() => {
|
|
96
|
-
highlight.show();
|
|
97
|
-
}, [highlight]);
|
|
98
|
-
const handleOnMouseLeaveNotation = useCallback(() => {
|
|
99
|
-
highlight.hide();
|
|
100
|
-
}, [highlight]);
|
|
101
|
-
const newValue = useMemo(() => (isSelected ? value : formatNumber(value, deltaPPM.format)), [deltaPPM.format, isSelected, value]);
|
|
102
|
-
const oldValue = useMemo(() => (isSelected ? _value : formatNumber(_value, deltaPPM.format)), [_value, deltaPPM.format, isSelected]);
|
|
103
|
-
return (_jsxs("g", { css: styles, id: id, style: { outline: 'none' }, transform: `translate(${x}, ${y})`, onMouseEnter: handleOnEnterNotation, onMouseLeave: handleOnMouseLeaveNotation, children: [_jsx("line", { x1: "0", x2: "0", y1: sign === -1 ? 10 : 0, y2: sign === -1 ? 28 : -18, stroke: color, strokeWidth: highlight.isActive ? '7px' : '1px' }), _jsx("text", { ref: refText, className: "peaks-text", x: "0", y: sign === -1 ? 28 : -12, dy: "0", dx: "0.35em", fill: "transparent", fontSize: "10px", fontWeight: "100", style: {
|
|
104
|
-
position: 'absolute',
|
|
105
|
-
}, children: newValue }), _jsx("foreignObject", { x: "0", y: sign === -1 ? 16 : -22, dy: "0.1em", dx: "0.35em", width: containerSize.width + 20, height: "40px", "data-no-export": "true", children: _jsx("div", { style: {
|
|
106
|
-
width: containerSize.width + 20,
|
|
107
|
-
height: '100%',
|
|
108
|
-
paddingRight: 5,
|
|
109
|
-
}, children: _jsx("input", { onClick: handleSelectPeakAnnotation, className: isSelected ? 'input-over' : 'notification-input-normal', style: {
|
|
110
|
-
width: 'inherit',
|
|
111
|
-
border: isSelected ? `1px solid ${color}` : `0`,
|
|
112
|
-
userSelect: 'none',
|
|
113
|
-
color,
|
|
114
|
-
}, value: oldValue, onKeyDown: handleKeyDown, onChange: handleChange, type: "number" }) }) })] }));
|
|
115
|
-
}
|
|
116
|
-
export default PeakAnnotation;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
const styles = {
|
|
3
|
-
container: {
|
|
4
|
-
margin: '25px',
|
|
5
|
-
},
|
|
6
|
-
header: {
|
|
7
|
-
backgroundColor: '#ffffff',
|
|
8
|
-
padding: '20px',
|
|
9
|
-
borderRadius: '10px',
|
|
10
|
-
fontSize: '30px',
|
|
11
|
-
textAlign: 'center',
|
|
12
|
-
},
|
|
13
|
-
title: {
|
|
14
|
-
textDecoration: 'underline',
|
|
15
|
-
},
|
|
16
|
-
body: {
|
|
17
|
-
marginTop: '10px',
|
|
18
|
-
whiteSpace: 'pre-wrap',
|
|
19
|
-
backgroundColor: 'white',
|
|
20
|
-
padding: '20px',
|
|
21
|
-
borderRadius: '10px',
|
|
22
|
-
color: 'red',
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
export default function ErrorOverlay(props) {
|
|
26
|
-
return (_jsxs("div", { style: styles.container, children: [_jsx("p", { style: styles.header, children: "Something went wrong." }), _jsxs("details", { style: styles.body, children: [_jsx("p", { style: styles.title, children: props.error.message }), props.error.stack] })] }));
|
|
27
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/** @jsxImportSource @emotion/react */
|
|
2
|
-
import { WebSource } from 'filelist-utils';
|
|
3
|
-
import { CorrelationData } from 'nmr-correlation';
|
|
4
|
-
import { NmriumState, CustomWorkspaces, WorkspacePreferences as NMRiumPreferences, Spectrum } from 'nmr-load-save';
|
|
5
|
-
import { ReactElement, ReactNode } from 'react';
|
|
6
|
-
import { ErrorBoundaryPropsWithComponent } from 'react-error-boundary';
|
|
7
|
-
import { BlobObject } from './utility/export';
|
|
8
|
-
export { serializeNmriumState } from 'nmr-load-save';
|
|
9
|
-
export type { NmriumState, WorkspacePreferences as NMRiumPreferences, } from 'nmr-load-save';
|
|
10
|
-
export type NMRiumWorkspace = 'exercise' | 'process1D' | 'default' | 'prediction' | 'embedded' | 'assignment' | 'simulation' | (string & {});
|
|
11
|
-
export type OnNMRiumChange = (state: NmriumState, source: 'data' | 'view' | 'settings') => void;
|
|
12
|
-
export interface NMRiumProps {
|
|
13
|
-
data?: NMRiumData;
|
|
14
|
-
onChange?: OnNMRiumChange;
|
|
15
|
-
noErrorBoundary?: boolean;
|
|
16
|
-
onError?: ErrorBoundaryPropsWithComponent['onError'];
|
|
17
|
-
workspace?: NMRiumWorkspace;
|
|
18
|
-
customWorkspaces?: CustomWorkspaces;
|
|
19
|
-
preferences?: NMRiumPreferences;
|
|
20
|
-
emptyText?: ReactNode;
|
|
21
|
-
/**
|
|
22
|
-
* Returns a custom spinner that will be rendered while loading data.
|
|
23
|
-
*/
|
|
24
|
-
getSpinner?: () => ReactElement;
|
|
25
|
-
}
|
|
26
|
-
export type Molecules = Array<{
|
|
27
|
-
molfile: string;
|
|
28
|
-
}>;
|
|
29
|
-
type DeepPartial<T> = {
|
|
30
|
-
[P in keyof T]?: DeepPartial<T[P]>;
|
|
31
|
-
};
|
|
32
|
-
export interface NMRiumData {
|
|
33
|
-
source?: WebSource;
|
|
34
|
-
molecules?: Molecules;
|
|
35
|
-
spectra: Array<DeepPartial<Spectrum>>;
|
|
36
|
-
correlations?: CorrelationData;
|
|
37
|
-
}
|
|
38
|
-
export interface NMRiumRef {
|
|
39
|
-
getSpectraViewerAsBlob: () => BlobObject | null;
|
|
40
|
-
}
|
|
41
|
-
declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<NMRiumProps & import("react").RefAttributes<NMRiumRef>>>;
|
|
42
|
-
export default _default;
|
package/lib/component/NMRium.js
DELETED
|
@@ -1,237 +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 { readNMRiumObject, } from 'nmr-load-save';
|
|
5
|
-
import { useEffect, useCallback, useReducer, useRef, memo, forwardRef, useImperativeHandle, } from 'react';
|
|
6
|
-
import { ErrorBoundary, } from 'react-error-boundary';
|
|
7
|
-
import { RootLayout, useOnOff } from 'react-science/ui';
|
|
8
|
-
import { useFullscreen } from 'react-use';
|
|
9
|
-
import { toJSON } from '../data/SpectraManager';
|
|
10
|
-
import checkModifierKeyActivated from '../data/utilities/checkModifierKeyActivated';
|
|
11
|
-
import Viewer1D from './1d/Viewer1D';
|
|
12
|
-
import FloatMoleculeStructures from './1d-2d/components/FloatMoleculeStructures';
|
|
13
|
-
import Viewer2D from './2d/Viewer2D';
|
|
14
|
-
import ErrorOverlay from './ErrorOverlay';
|
|
15
|
-
import KeysListenerTracker from './EventsTrackers/KeysListenerTracker';
|
|
16
|
-
import { SplitPaneWrapper } from './SplitPaneWrapper';
|
|
17
|
-
import { AssignmentProvider } from './assignment';
|
|
18
|
-
import { ChartDataProvider, useChartData } from './context/ChartContext';
|
|
19
|
-
import { DispatchProvider } from './context/DispatchContext';
|
|
20
|
-
import { GlobalProvider } from './context/GlobalContext';
|
|
21
|
-
import { LoggerProvider, useLogger } from './context/LoggerContext';
|
|
22
|
-
import { PreferencesProvider } from './context/PreferencesContext';
|
|
23
|
-
import { AlertProvider } from './elements/popup/Alert';
|
|
24
|
-
import { ModalProvider } from './elements/popup/Modal';
|
|
25
|
-
import Header from './header/Header';
|
|
26
|
-
import { HighlightProvider } from './highlight';
|
|
27
|
-
import DropZone from './loader/DropZone';
|
|
28
|
-
import { defaultGetSpinner, SpinnerProvider } from './loader/SpinnerContext';
|
|
29
|
-
import Panels from './panels/Panels';
|
|
30
|
-
import checkActionType from './reducer/IgnoreActions';
|
|
31
|
-
import { spectrumReducer, initialState, initState } from './reducer/Reducer';
|
|
32
|
-
import { DISPLAYER_MODE } from './reducer/core/Constants';
|
|
33
|
-
import preferencesReducer, { preferencesInitialState, initPreferencesState, } from './reducer/preferences/preferencesReducer';
|
|
34
|
-
import ToolBar from './toolbar/ToolBar';
|
|
35
|
-
import { getBlob } from './utility/export';
|
|
36
|
-
const viewerContainerStyle = css `
|
|
37
|
-
border: 0.55px #e6e6e6 solid;
|
|
38
|
-
display: flex;
|
|
39
|
-
flex: 1;
|
|
40
|
-
flex-direction: column;
|
|
41
|
-
height: 100%;
|
|
42
|
-
margin-left: -1px;
|
|
43
|
-
`;
|
|
44
|
-
const containerStyles = css `
|
|
45
|
-
background-color: white;
|
|
46
|
-
width: 100%;
|
|
47
|
-
display: block;
|
|
48
|
-
height: 100%;
|
|
49
|
-
|
|
50
|
-
div:focus {
|
|
51
|
-
outline: none !important;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
button {
|
|
55
|
-
cursor: pointer;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
button,
|
|
59
|
-
button:active,
|
|
60
|
-
button:hover,
|
|
61
|
-
button:focus,
|
|
62
|
-
[type='button']:focus {
|
|
63
|
-
outline: none !important;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
button:disabled {
|
|
67
|
-
cursor: default;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
* {
|
|
71
|
-
-webkit-user-drag: none;
|
|
72
|
-
-moz-user-drag: none;
|
|
73
|
-
-o-user-drag: none;
|
|
74
|
-
user-select: none;
|
|
75
|
-
}
|
|
76
|
-
`;
|
|
77
|
-
export { serializeNmriumState } from 'nmr-load-save';
|
|
78
|
-
const defaultData = {
|
|
79
|
-
spectra: [],
|
|
80
|
-
};
|
|
81
|
-
const NMRium = forwardRef(function NMRium(props, ref) {
|
|
82
|
-
const { noErrorBoundary = false, onError, ...otherProps } = props;
|
|
83
|
-
const innerNmrium = _jsx(InnerNMRium, { ...otherProps, innerRef: ref });
|
|
84
|
-
const children = noErrorBoundary ? (innerNmrium) : (_jsx(ErrorBoundary, { FallbackComponent: ErrorOverlay, onError: onError, children: innerNmrium }));
|
|
85
|
-
return _jsx(RootLayout, { style: { width: '100%' }, children: children });
|
|
86
|
-
});
|
|
87
|
-
function InnerNMRium({ data: dataProp = defaultData, workspace, customWorkspaces, preferences, getSpinner = defaultGetSpinner, onChange, emptyText, innerRef, }) {
|
|
88
|
-
const rootRef = useRef(null);
|
|
89
|
-
const elementsWrapperRef = useRef(null);
|
|
90
|
-
const viewerRef = useRef(null);
|
|
91
|
-
const [show, , setOff, toggle] = useOnOff(false);
|
|
92
|
-
const mainDivRef = useRef(null);
|
|
93
|
-
const handleChange = useRef(onChange);
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
handleChange.current = onChange;
|
|
96
|
-
}, [onChange]);
|
|
97
|
-
const isFullscreen = useFullscreen(rootRef, show, {
|
|
98
|
-
onClose: setOff,
|
|
99
|
-
});
|
|
100
|
-
const [state, dispatch] = useReducer(spectrumReducer, initialState, initState);
|
|
101
|
-
const [preferencesState, dispatchPreferences] = useReducer(preferencesReducer, preferencesInitialState, initPreferencesState);
|
|
102
|
-
const { displayerMode, source, data: spectraData, molecules, correlations, actionType, view, } = state;
|
|
103
|
-
const stateRef = useRef();
|
|
104
|
-
useEffect(() => {
|
|
105
|
-
const { workspace, workspaces = {} } = preferencesState;
|
|
106
|
-
stateRef.current = toJSON({ data: spectraData, molecules, correlations, source, view, actionType }, { current: workspaces[workspace.current] }, { serialize: false, exportTarget: 'onChange' });
|
|
107
|
-
}, [
|
|
108
|
-
actionType,
|
|
109
|
-
correlations,
|
|
110
|
-
molecules,
|
|
111
|
-
preferencesState,
|
|
112
|
-
source,
|
|
113
|
-
spectraData,
|
|
114
|
-
view,
|
|
115
|
-
]);
|
|
116
|
-
useEffect(() => {
|
|
117
|
-
// trigger onChange callback if data object changed
|
|
118
|
-
if (checkActionType(actionType)) {
|
|
119
|
-
handleChange.current?.(stateRef.current, 'data');
|
|
120
|
-
}
|
|
121
|
-
}, [actionType, correlations, molecules, source, spectraData]);
|
|
122
|
-
useEffect(() => {
|
|
123
|
-
// trigger onChange callback if view object changed
|
|
124
|
-
handleChange.current?.(stateRef.current, 'view');
|
|
125
|
-
}, [view]);
|
|
126
|
-
useEffect(() => {
|
|
127
|
-
// trigger onChange callback if settings changed
|
|
128
|
-
handleChange.current?.(stateRef.current, 'settings');
|
|
129
|
-
}, [preferencesState]);
|
|
130
|
-
useEffect(() => {
|
|
131
|
-
rootRef.current?.focus();
|
|
132
|
-
}, [isFullscreen]);
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
dispatchPreferences({
|
|
135
|
-
type: 'INIT_PREFERENCES',
|
|
136
|
-
payload: {
|
|
137
|
-
preferences,
|
|
138
|
-
workspace,
|
|
139
|
-
customWorkspaces,
|
|
140
|
-
dispatch: dispatchPreferences,
|
|
141
|
-
},
|
|
142
|
-
});
|
|
143
|
-
}, [customWorkspaces, preferences, workspace]);
|
|
144
|
-
useImperativeHandle(innerRef, () => ({
|
|
145
|
-
getSpectraViewerAsBlob: () => {
|
|
146
|
-
return rootRef?.current ? getBlob(rootRef.current, 'nmrSVG') : null;
|
|
147
|
-
},
|
|
148
|
-
}), []);
|
|
149
|
-
useEffect(() => {
|
|
150
|
-
dispatch({
|
|
151
|
-
type: 'SET_LOADING_FLAG',
|
|
152
|
-
payload: { isLoading: true },
|
|
153
|
-
});
|
|
154
|
-
if (dataProp) {
|
|
155
|
-
void readNMRiumObject(dataProp)
|
|
156
|
-
.then((nmriumState) => {
|
|
157
|
-
dispatch({ type: 'INITIATE', payload: { nmriumState } });
|
|
158
|
-
})
|
|
159
|
-
.catch((error) => {
|
|
160
|
-
dispatch({ type: 'SET_LOADING_FLAG', payload: { isLoading: false } });
|
|
161
|
-
// eslint-disable-next-line no-alert
|
|
162
|
-
alert(error.message);
|
|
163
|
-
reportError(error);
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
}, [dataProp]);
|
|
167
|
-
const preventContextMenuHandler = useCallback((e) => {
|
|
168
|
-
if (!checkModifierKeyActivated(e)) {
|
|
169
|
-
e.preventDefault();
|
|
170
|
-
}
|
|
171
|
-
}, []);
|
|
172
|
-
useEffect(() => {
|
|
173
|
-
const div = mainDivRef.current;
|
|
174
|
-
if (!div) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
function mouseEnterHandler() {
|
|
178
|
-
dispatch({
|
|
179
|
-
type: 'SET_MOUSE_OVER_DISPLAYER',
|
|
180
|
-
payload: { isMouseOverDisplayer: true },
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
function mouseLeaveHandler() {
|
|
184
|
-
dispatch({
|
|
185
|
-
type: 'SET_MOUSE_OVER_DISPLAYER',
|
|
186
|
-
payload: { isMouseOverDisplayer: false },
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
div.addEventListener('mouseenter', mouseEnterHandler);
|
|
190
|
-
div.addEventListener('mouseleave', mouseLeaveHandler);
|
|
191
|
-
return () => {
|
|
192
|
-
div.removeEventListener('mouseenter', mouseEnterHandler);
|
|
193
|
-
div.removeEventListener('mouseleave', mouseLeaveHandler);
|
|
194
|
-
};
|
|
195
|
-
}, []);
|
|
196
|
-
return (_jsx(GlobalProvider, { value: {
|
|
197
|
-
rootRef: rootRef.current,
|
|
198
|
-
elementsWrapperRef: elementsWrapperRef.current,
|
|
199
|
-
viewerRef: viewerRef.current,
|
|
200
|
-
}, children: _jsx(PreferencesProvider, { value: preferencesState, children: _jsx("div", { ref: mainDivRef, style: { height: '100%', position: 'relative' }, children: _jsx(LoggerProvider, { children: _jsx(AlertProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(DispatchProvider, { value: dispatch, children: _jsx(ChartDataProvider, { value: state, children: _jsx(ModalProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(HighlightProvider, { children: _jsx(AssignmentProvider, { spectraData: spectraData, children: _jsxs(SpinnerProvider, { value: getSpinner, children: [_jsx(StateError, {}), _jsx("div", { className: "nmrium-container", ref: rootRef, css: containerStyles, onContextMenu: preventContextMenuHandler, style: { height: '100%', width: '100%' }, children: _jsx(DropZone, { children: _jsxs("div", { style: {
|
|
201
|
-
display: 'flex',
|
|
202
|
-
flexDirection: 'column',
|
|
203
|
-
backgroundColor: 'white',
|
|
204
|
-
width: '100%',
|
|
205
|
-
}, children: [_jsx(Header, { isFullscreen: isFullscreen, onMaximize: toggle }), _jsxs("div", { style: {
|
|
206
|
-
display: 'flex',
|
|
207
|
-
flexDirection: 'row',
|
|
208
|
-
height: '100%',
|
|
209
|
-
}, children: [_jsx(ToolBar, {}), _jsxs(SplitPaneWrapper, { children: [_jsxs("div", { css: viewerContainerStyle, children: [_jsx(KeysListenerTracker, {}), _jsxs("div", { id: "nmrium-viewer", "data-test-id": "viewer", ref: viewerRef, style: {
|
|
210
|
-
width: '100%',
|
|
211
|
-
height: '100%',
|
|
212
|
-
position: 'relative',
|
|
213
|
-
}, children: [_jsx(FloatMoleculeStructures, {}), displayerMode ===
|
|
214
|
-
DISPLAYER_MODE.DM_1D ? (_jsx(Viewer1D, { emptyText: emptyText })) : (_jsx(Viewer2D, { emptyText: emptyText }))] })] }), _jsx(Panels, {})] }), _jsx("div", { ref: elementsWrapperRef, id: "main-wrapper", style: {
|
|
215
|
-
position: 'absolute',
|
|
216
|
-
pointerEvents: 'none',
|
|
217
|
-
zIndex: 2,
|
|
218
|
-
left: 0,
|
|
219
|
-
right: 0,
|
|
220
|
-
top: 0,
|
|
221
|
-
bottom: 0,
|
|
222
|
-
} }, String(isFullscreen))] })] }) }) })] }) }) }) }) }) }) }) }) }) }) }));
|
|
223
|
-
}
|
|
224
|
-
export default memo(NMRium);
|
|
225
|
-
/**
|
|
226
|
-
* Alert user in UI when state have errorAction (error from reducer)
|
|
227
|
-
*/
|
|
228
|
-
function StateError() {
|
|
229
|
-
const { errorAction } = useChartData();
|
|
230
|
-
const { logger } = useLogger();
|
|
231
|
-
useEffect(() => {
|
|
232
|
-
if (!errorAction)
|
|
233
|
-
return;
|
|
234
|
-
logger.error(errorAction);
|
|
235
|
-
}, [errorAction, logger]);
|
|
236
|
-
return null;
|
|
237
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Draft } from 'immer';
|
|
2
|
-
import { State } from '../Reducer';
|
|
3
|
-
import { ActionType } from '../types/ActionType';
|
|
4
|
-
type SetIsOverDisplayerAction = ActionType<'SET_MOUSE_OVER_DISPLAYER', {
|
|
5
|
-
isMouseOverDisplayer: boolean;
|
|
6
|
-
}>;
|
|
7
|
-
export type GlobalActions = SetIsOverDisplayerAction;
|
|
8
|
-
declare function handleSetIsOverDisplayer(draft: Draft<State>, action: SetIsOverDisplayerAction): void;
|
|
9
|
-
export { handleSetIsOverDisplayer };
|