react-cheminfo 0.69.0 → 0.71.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.
- package/README.md +70 -2
- package/lib/about/core/providers.d.ts +6 -0
- package/lib/about/core/providers.d.ts.map +1 -1
- package/lib/about/core/providers.js +7 -0
- package/lib/about/core/providers.js.map +1 -1
- package/lib/about/ui/AboutProvidedBy.js +34 -0
- package/lib/about/ui/AboutProvidedBy.js.map +1 -1
- package/lib/chart/ui/useChartPointer.d.ts +9 -1
- package/lib/chart/ui/useChartPointer.d.ts.map +1 -1
- package/lib/chart/ui/useChartPointer.js +11 -3
- package/lib/chart/ui/useChartPointer.js.map +1 -1
- package/lib/credits/core/credits.d.ts +41 -0
- package/lib/credits/core/credits.d.ts.map +1 -1
- package/lib/credits/core/credits.js +50 -0
- package/lib/credits/core/credits.js.map +1 -1
- package/lib/download/core/drawingMarkup.d.ts +8 -1
- package/lib/download/core/drawingMarkup.d.ts.map +1 -1
- package/lib/download/core/drawingMarkup.js +13 -1
- package/lib/download/core/drawingMarkup.js.map +1 -1
- package/lib/download/core/figurePng.d.ts +14 -0
- package/lib/download/core/figurePng.d.ts.map +1 -1
- package/lib/download/core/figurePng.js +21 -6
- package/lib/download/core/figurePng.js.map +1 -1
- package/lib/download/core/figureSvg.d.ts.map +1 -1
- package/lib/download/core/figureSvg.js +5 -3
- package/lib/download/core/figureSvg.js.map +1 -1
- package/lib/download/core/figureTarget.d.ts +13 -0
- package/lib/download/core/figureTarget.d.ts.map +1 -1
- package/lib/download/core/figureTarget.js +25 -5
- package/lib/download/core/figureTarget.js.map +1 -1
- package/lib/download/core/svgBounds.d.ts +15 -0
- package/lib/download/core/svgBounds.d.ts.map +1 -1
- package/lib/download/core/svgBounds.js +20 -0
- package/lib/download/core/svgBounds.js.map +1 -1
- package/lib/download/core/svgToPng.d.ts.map +1 -1
- package/lib/download/core/svgToPng.js +4 -2
- package/lib/download/core/svgToPng.js.map +1 -1
- package/lib/format/core/relativeTime.d.ts +8 -3
- package/lib/format/core/relativeTime.d.ts.map +1 -1
- package/lib/format/core/relativeTime.js +19 -7
- package/lib/format/core/relativeTime.js.map +1 -1
- package/lib/host/core/connectHost.d.ts +25 -34
- package/lib/host/core/connectHost.d.ts.map +1 -1
- package/lib/host/core/connectHost.js +43 -89
- package/lib/host/core/connectHost.js.map +1 -1
- package/lib/host/core/hostOutputs.d.ts +58 -0
- package/lib/host/core/hostOutputs.d.ts.map +1 -0
- package/lib/host/core/hostOutputs.js +151 -0
- package/lib/host/core/hostOutputs.js.map +1 -0
- package/lib/host/core/index.d.ts +9 -3
- package/lib/host/core/index.d.ts.map +1 -1
- package/lib/host/core/index.js +4 -1
- package/lib/host/core/index.js.map +1 -1
- package/lib/host/core/irKinds.d.ts +124 -0
- package/lib/host/core/irKinds.d.ts.map +1 -0
- package/lib/host/core/irKinds.js +46 -0
- package/lib/host/core/irKinds.js.map +1 -0
- package/lib/host/core/kinds.d.ts +13 -5
- package/lib/host/core/kinds.d.ts.map +1 -1
- package/lib/host/core/kinds.js +11 -5
- package/lib/host/core/kinds.js.map +1 -1
- package/lib/host/core/protocol.d.ts +50 -7
- package/lib/host/core/protocol.d.ts.map +1 -1
- package/lib/host/core/protocol.js +10 -6
- package/lib/host/core/protocol.js.map +1 -1
- package/lib/host/core/selectInputs.d.ts +37 -0
- package/lib/host/core/selectInputs.d.ts.map +1 -0
- package/lib/host/core/selectInputs.js +110 -0
- package/lib/host/core/selectInputs.js.map +1 -0
- package/lib/host/testing/sciPeaks.d.ts +31 -0
- package/lib/host/testing/sciPeaks.d.ts.map +1 -1
- package/lib/host/testing/sciPeaks.js +73 -0
- package/lib/host/testing/sciPeaks.js.map +1 -1
- package/lib/host/testing/standInHost.d.ts +9 -1
- package/lib/host/testing/standInHost.d.ts.map +1 -1
- package/lib/host/testing/standInHost.js +19 -1
- package/lib/host/testing/standInHost.js.map +1 -1
- package/lib/host/ui/useHostConnection.d.ts +13 -5
- package/lib/host/ui/useHostConnection.d.ts.map +1 -1
- package/lib/host/ui/useHostConnection.js +4 -3
- package/lib/host/ui/useHostConnection.js.map +1 -1
- package/lib/host-testing.d.ts +2 -2
- package/lib/host-testing.d.ts.map +1 -1
- package/lib/host-testing.js +2 -2
- package/lib/host-testing.js.map +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/ir/core/handPicking.d.ts +58 -0
- package/lib/ir/core/handPicking.d.ts.map +1 -0
- package/lib/ir/core/handPicking.js +130 -0
- package/lib/ir/core/handPicking.js.map +1 -0
- package/lib/ir/core/index.d.ts +3 -0
- package/lib/ir/core/index.d.ts.map +1 -1
- package/lib/ir/core/index.js +3 -0
- package/lib/ir/core/index.js.map +1 -1
- package/lib/ir/core/irBandState.d.ts +57 -0
- package/lib/ir/core/irBandState.d.ts.map +1 -0
- package/lib/ir/core/irBandState.js +119 -0
- package/lib/ir/core/irBandState.js.map +1 -0
- package/lib/ir/core/irCommands.d.ts +11 -0
- package/lib/ir/core/irCommands.d.ts.map +1 -1
- package/lib/ir/core/irCommands.js +6 -0
- package/lib/ir/core/irCommands.js.map +1 -1
- package/lib/ir/core/irPeaks.d.ts +28 -0
- package/lib/ir/core/irPeaks.d.ts.map +1 -0
- package/lib/ir/core/irPeaks.js +66 -0
- package/lib/ir/core/irPeaks.js.map +1 -0
- package/lib/ir/core/irReducer.d.ts +8 -0
- package/lib/ir/core/irReducer.d.ts.map +1 -1
- package/lib/ir/core/irReducer.js +15 -32
- package/lib/ir/core/irReducer.js.map +1 -1
- package/lib/ir/core/irSpectrum.d.ts +15 -0
- package/lib/ir/core/irSpectrum.d.ts.map +1 -1
- package/lib/ir/core/irSpectrum.js.map +1 -1
- package/lib/ir/core/irState.d.ts +9 -6
- package/lib/ir/core/irState.d.ts.map +1 -1
- package/lib/ir/core/irState.js +10 -6
- package/lib/ir/core/irState.js.map +1 -1
- package/lib/ir/core/pickBands.d.ts +14 -0
- package/lib/ir/core/pickBands.d.ts.map +1 -1
- package/lib/ir/core/pickBands.js +39 -33
- package/lib/ir/core/pickBands.js.map +1 -1
- package/lib/ir/core/ramanBands.d.ts +9 -1
- package/lib/ir/core/ramanBands.d.ts.map +1 -1
- package/lib/ir/core/ramanBands.js +2 -2
- package/lib/ir/core/ramanBands.js.map +1 -1
- package/lib/ir/core/spectrumBands.d.ts +46 -0
- package/lib/ir/core/spectrumBands.d.ts.map +1 -0
- package/lib/ir/core/spectrumBands.js +98 -0
- package/lib/ir/core/spectrumBands.js.map +1 -0
- package/lib/ir/ui/BandRow.d.ts +5 -0
- package/lib/ir/ui/BandRow.d.ts.map +1 -1
- package/lib/ir/ui/BandRow.js +4 -3
- package/lib/ir/ui/BandRow.js.map +1 -1
- package/lib/ir/ui/BandsPanel.d.ts +5 -0
- package/lib/ir/ui/BandsPanel.d.ts.map +1 -1
- package/lib/ir/ui/BandsPanel.js +36 -16
- package/lib/ir/ui/BandsPanel.js.map +1 -1
- package/lib/ir/ui/BandsToolbar.d.ts +9 -0
- package/lib/ir/ui/BandsToolbar.d.ts.map +1 -0
- package/lib/ir/ui/BandsToolbar.js +61 -0
- package/lib/ir/ui/BandsToolbar.js.map +1 -0
- package/lib/ir/ui/IrCanvas.d.ts +2 -1
- package/lib/ir/ui/IrCanvas.d.ts.map +1 -1
- package/lib/ir/ui/IrCanvas.js +19 -5
- package/lib/ir/ui/IrCanvas.js.map +1 -1
- package/lib/ir/ui/IrChart.d.ts.map +1 -1
- package/lib/ir/ui/IrChart.js +8 -1
- package/lib/ir/ui/IrChart.js.map +1 -1
- package/lib/ir/ui/IrDocumentationDialog.js +1 -1
- package/lib/ir/ui/IrDocumentationDialog.js.map +1 -1
- package/lib/ir/ui/IrEditor.d.ts +4 -2
- package/lib/ir/ui/IrEditor.d.ts.map +1 -1
- package/lib/ir/ui/IrEditor.js.map +1 -1
- package/lib/ir/ui/IrShell.d.ts.map +1 -1
- package/lib/ir/ui/IrShell.js +6 -0
- package/lib/ir/ui/IrShell.js.map +1 -1
- package/lib/ir/ui/IrStatusBar.d.ts.map +1 -1
- package/lib/ir/ui/IrStatusBar.js +1 -1
- package/lib/ir/ui/IrStatusBar.js.map +1 -1
- package/lib/ir/ui/IrToolbar.d.ts +4 -3
- package/lib/ir/ui/IrToolbar.d.ts.map +1 -1
- package/lib/ir/ui/IrToolbar.js +5 -4
- package/lib/ir/ui/IrToolbar.js.map +1 -1
- package/lib/ir/ui/VibrationalEditor.d.ts +2 -1
- package/lib/ir/ui/VibrationalEditor.d.ts.map +1 -1
- package/lib/ir/ui/VibrationalEditor.js.map +1 -1
- package/lib/ir/ui/irActions.d.ts +5 -0
- package/lib/ir/ui/irActions.d.ts.map +1 -1
- package/lib/ir/ui/irActions.js +6 -0
- package/lib/ir/ui/irActions.js.map +1 -1
- package/lib/ir/ui/irChartProps.d.ts +4 -1
- package/lib/ir/ui/irChartProps.d.ts.map +1 -1
- package/lib/ir/ui/useIrEditor.d.ts +5 -11
- package/lib/ir/ui/useIrEditor.d.ts.map +1 -1
- package/lib/ir/ui/useIrEditor.js +17 -18
- package/lib/ir/ui/useIrEditor.js.map +1 -1
- package/lib/locales/de.json +63 -0
- package/lib/locales/en.json +63 -0
- package/lib/locales/es.json +63 -0
- package/lib/locales/fr.json +63 -0
- package/lib/locales/it.json +63 -0
- package/lib/mass/core/analyseSpectrum.d.ts +85 -0
- package/lib/mass/core/analyseSpectrum.d.ts.map +1 -0
- package/lib/mass/core/analyseSpectrum.js +101 -0
- package/lib/mass/core/analyseSpectrum.js.map +1 -0
- package/lib/mass/core/ascendingTrace.d.ts +24 -0
- package/lib/mass/core/ascendingTrace.d.ts.map +1 -0
- package/lib/mass/core/ascendingTrace.js +57 -0
- package/lib/mass/core/ascendingTrace.js.map +1 -0
- package/lib/mass/core/centroidPeaks.d.ts +77 -0
- package/lib/mass/core/centroidPeaks.d.ts.map +1 -0
- package/lib/mass/core/centroidPeaks.js +62 -0
- package/lib/mass/core/centroidPeaks.js.map +1 -0
- package/lib/mass/core/detectMassFormat.d.ts +24 -0
- package/lib/mass/core/detectMassFormat.d.ts.map +1 -0
- package/lib/mass/core/detectMassFormat.js +105 -0
- package/lib/mass/core/detectMassFormat.js.map +1 -0
- package/lib/mass/core/downloadSpectra.d.ts +24 -0
- package/lib/mass/core/downloadSpectra.d.ts.map +1 -0
- package/lib/mass/core/downloadSpectra.js +35 -0
- package/lib/mass/core/downloadSpectra.js.map +1 -0
- package/lib/mass/core/fromJcamp.d.ts +46 -0
- package/lib/mass/core/fromJcamp.d.ts.map +1 -0
- package/lib/mass/core/fromJcamp.js +123 -0
- package/lib/mass/core/fromJcamp.js.map +1 -0
- package/lib/mass/core/fromText.d.ts +30 -0
- package/lib/mass/core/fromText.d.ts.map +1 -0
- package/lib/mass/core/fromText.js +39 -0
- package/lib/mass/core/fromText.js.map +1 -0
- package/lib/mass/core/index.d.ts +70 -0
- package/lib/mass/core/index.d.ts.map +1 -0
- package/lib/mass/core/index.js +42 -0
- package/lib/mass/core/index.js.map +1 -0
- package/lib/mass/core/jcampTechnique.d.ts +38 -0
- package/lib/mass/core/jcampTechnique.d.ts.map +1 -0
- package/lib/mass/core/jcampTechnique.js +70 -0
- package/lib/mass/core/jcampTechnique.js.map +1 -0
- package/lib/mass/core/labelStackBox.d.ts +49 -0
- package/lib/mass/core/labelStackBox.d.ts.map +1 -0
- package/lib/mass/core/labelStackBox.js +44 -0
- package/lib/mass/core/labelStackBox.js.map +1 -0
- package/lib/mass/core/labelledPeaks.d.ts +79 -0
- package/lib/mass/core/labelledPeaks.d.ts.map +1 -0
- package/lib/mass/core/labelledPeaks.js +74 -0
- package/lib/mass/core/labelledPeaks.js.map +1 -0
- package/lib/mass/core/loadMassSpectra.d.ts +57 -0
- package/lib/mass/core/loadMassSpectra.d.ts.map +1 -0
- package/lib/mass/core/loadMassSpectra.js +45 -0
- package/lib/mass/core/loadMassSpectra.js.map +1 -0
- package/lib/mass/core/loadedMassSpectrum.d.ts +42 -0
- package/lib/mass/core/loadedMassSpectrum.d.ts.map +1 -0
- package/lib/mass/core/loadedMassSpectrum.js +15 -0
- package/lib/mass/core/loadedMassSpectrum.js.map +1 -0
- package/lib/mass/core/massCommands.d.ts +170 -0
- package/lib/mass/core/massCommands.d.ts.map +1 -0
- package/lib/mass/core/massCommands.js +95 -0
- package/lib/mass/core/massCommands.js.map +1 -0
- package/lib/mass/core/massDomain.d.ts +121 -0
- package/lib/mass/core/massDomain.d.ts.map +1 -0
- package/lib/mass/core/massDomain.js +179 -0
- package/lib/mass/core/massDomain.js.map +1 -0
- package/lib/mass/core/massEditorApi.d.ts +65 -0
- package/lib/mass/core/massEditorApi.d.ts.map +1 -0
- package/lib/mass/core/massEditorApi.js +10 -0
- package/lib/mass/core/massEditorApi.js.map +1 -0
- package/lib/mass/core/massFormat.d.ts +78 -0
- package/lib/mass/core/massFormat.d.ts.map +1 -0
- package/lib/mass/core/massFormat.js +168 -0
- package/lib/mass/core/massFormat.js.map +1 -0
- package/lib/mass/core/massMeta.d.ts +85 -0
- package/lib/mass/core/massMeta.d.ts.map +1 -0
- package/lib/mass/core/massMeta.js +182 -0
- package/lib/mass/core/massMeta.js.map +1 -0
- package/lib/mass/core/massReducer.d.ts +82 -0
- package/lib/mass/core/massReducer.d.ts.map +1 -0
- package/lib/mass/core/massReducer.js +163 -0
- package/lib/mass/core/massReducer.js.map +1 -0
- package/lib/mass/core/massResolution.d.ts +92 -0
- package/lib/mass/core/massResolution.d.ts.map +1 -0
- package/lib/mass/core/massResolution.js +126 -0
- package/lib/mass/core/massResolution.js.map +1 -0
- package/lib/mass/core/massSidePanels.d.ts +28 -0
- package/lib/mass/core/massSidePanels.d.ts.map +1 -0
- package/lib/mass/core/massSidePanels.js +12 -0
- package/lib/mass/core/massSidePanels.js.map +1 -0
- package/lib/mass/core/massSpectrum.d.ts +206 -0
- package/lib/mass/core/massSpectrum.d.ts.map +1 -0
- package/lib/mass/core/massSpectrum.js +41 -0
- package/lib/mass/core/massSpectrum.js.map +1 -0
- package/lib/mass/core/massState.d.ts +145 -0
- package/lib/mass/core/massState.d.ts.map +1 -0
- package/lib/mass/core/massState.js +102 -0
- package/lib/mass/core/massState.js.map +1 -0
- package/lib/mass/core/massStateEdits.d.ts +51 -0
- package/lib/mass/core/massStateEdits.d.ts.map +1 -0
- package/lib/mass/core/massStateEdits.js +90 -0
- package/lib/mass/core/massStateEdits.js.map +1 -0
- package/lib/mass/core/massSummary.d.ts +77 -0
- package/lib/mass/core/massSummary.d.ts.map +1 -0
- package/lib/mass/core/massSummary.js +174 -0
- package/lib/mass/core/massSummary.js.map +1 -0
- package/lib/mass/core/mzDecimalsSetting.d.ts +36 -0
- package/lib/mass/core/mzDecimalsSetting.d.ts.map +1 -0
- package/lib/mass/core/mzDecimalsSetting.js +42 -0
- package/lib/mass/core/mzDecimalsSetting.js.map +1 -0
- package/lib/mass/core/nearestPeak.d.ts +75 -0
- package/lib/mass/core/nearestPeak.d.ts.map +1 -0
- package/lib/mass/core/nearestPeak.js +99 -0
- package/lib/mass/core/nearestPeak.js.map +1 -0
- package/lib/mass/core/peakLabelLines.d.ts +77 -0
- package/lib/mass/core/peakLabelLines.d.ts.map +1 -0
- package/lib/mass/core/peakLabelLines.js +54 -0
- package/lib/mass/core/peakLabelLines.js.map +1 -0
- package/lib/mass/core/peakLabelPlan.d.ts +109 -0
- package/lib/mass/core/peakLabelPlan.d.ts.map +1 -0
- package/lib/mass/core/peakLabelPlan.js +143 -0
- package/lib/mass/core/peakLabelPlan.js.map +1 -0
- package/lib/mass/core/peakTable.d.ts +54 -0
- package/lib/mass/core/peakTable.d.ts.map +1 -0
- package/lib/mass/core/peakTable.js +53 -0
- package/lib/mass/core/peakTable.js.map +1 -0
- package/lib/mass/core/resolutionOf.d.ts +60 -0
- package/lib/mass/core/resolutionOf.d.ts.map +1 -0
- package/lib/mass/core/resolutionOf.js +84 -0
- package/lib/mass/core/resolutionOf.js.map +1 -0
- package/lib/mass/core/scanFilter.d.ts +25 -0
- package/lib/mass/core/scanFilter.d.ts.map +1 -0
- package/lib/mass/core/scanFilter.js +107 -0
- package/lib/mass/core/scanFilter.js.map +1 -0
- package/lib/mass/core/spectrumJcamp.d.ts +47 -0
- package/lib/mass/core/spectrumJcamp.d.ts.map +1 -0
- package/lib/mass/core/spectrumJcamp.js +167 -0
- package/lib/mass/core/spectrumJcamp.js.map +1 -0
- package/lib/mass/core/toMassSpectrum.d.ts +67 -0
- package/lib/mass/core/toMassSpectrum.d.ts.map +1 -0
- package/lib/mass/core/toMassSpectrum.js +78 -0
- package/lib/mass/core/toMassSpectrum.js.map +1 -0
- package/lib/mass/core/traceIcon.d.ts +82 -0
- package/lib/mass/core/traceIcon.d.ts.map +1 -0
- package/lib/mass/core/traceIcon.js +66 -0
- package/lib/mass/core/traceIcon.js.map +1 -0
- package/lib/mass/core/writtenResolution.d.ts +40 -0
- package/lib/mass/core/writtenResolution.d.ts.map +1 -0
- package/lib/mass/core/writtenResolution.js +77 -0
- package/lib/mass/core/writtenResolution.js.map +1 -0
- package/lib/mass/ui/MassAboutDialog.d.ts +16 -0
- package/lib/mass/ui/MassAboutDialog.d.ts.map +1 -0
- package/lib/mass/ui/MassAboutDialog.js +44 -0
- package/lib/mass/ui/MassAboutDialog.js.map +1 -0
- package/lib/mass/ui/MassCanvas.d.ts +46 -0
- package/lib/mass/ui/MassCanvas.d.ts.map +1 -0
- package/lib/mass/ui/MassCanvas.js +84 -0
- package/lib/mass/ui/MassCanvas.js.map +1 -0
- package/lib/mass/ui/MassChart.d.ts +21 -0
- package/lib/mass/ui/MassChart.d.ts.map +1 -0
- package/lib/mass/ui/MassChart.js +139 -0
- package/lib/mass/ui/MassChart.js.map +1 -0
- package/lib/mass/ui/MassCommandProvider.d.ts +15 -0
- package/lib/mass/ui/MassCommandProvider.d.ts.map +1 -0
- package/lib/mass/ui/MassCommandProvider.js +14 -0
- package/lib/mass/ui/MassCommandProvider.js.map +1 -0
- package/lib/mass/ui/MassCommandTooltip.d.ts +16 -0
- package/lib/mass/ui/MassCommandTooltip.d.ts.map +1 -0
- package/lib/mass/ui/MassCommandTooltip.js +22 -0
- package/lib/mass/ui/MassCommandTooltip.js.map +1 -0
- package/lib/mass/ui/MassDocumentationDialog.d.ts +18 -0
- package/lib/mass/ui/MassDocumentationDialog.d.ts.map +1 -0
- package/lib/mass/ui/MassDocumentationDialog.js +70 -0
- package/lib/mass/ui/MassDocumentationDialog.js.map +1 -0
- package/lib/mass/ui/MassEditor.d.ts +78 -0
- package/lib/mass/ui/MassEditor.d.ts.map +1 -0
- package/lib/mass/ui/MassEditor.js +42 -0
- package/lib/mass/ui/MassEditor.js.map +1 -0
- package/lib/mass/ui/MassHeader.d.ts +12 -0
- package/lib/mass/ui/MassHeader.d.ts.map +1 -0
- package/lib/mass/ui/MassHeader.js +20 -0
- package/lib/mass/ui/MassHeader.js.map +1 -0
- package/lib/mass/ui/MassLogo.d.ts +21 -0
- package/lib/mass/ui/MassLogo.d.ts.map +1 -0
- package/lib/mass/ui/MassLogo.js +36 -0
- package/lib/mass/ui/MassLogo.js.map +1 -0
- package/lib/mass/ui/MassPointerTracker.d.ts +44 -0
- package/lib/mass/ui/MassPointerTracker.d.ts.map +1 -0
- package/lib/mass/ui/MassPointerTracker.js +29 -0
- package/lib/mass/ui/MassPointerTracker.js.map +1 -0
- package/lib/mass/ui/MassShell.d.ts +29 -0
- package/lib/mass/ui/MassShell.d.ts.map +1 -0
- package/lib/mass/ui/MassShell.js +133 -0
- package/lib/mass/ui/MassShell.js.map +1 -0
- package/lib/mass/ui/MassSidePanel.d.ts +32 -0
- package/lib/mass/ui/MassSidePanel.d.ts.map +1 -0
- package/lib/mass/ui/MassSidePanel.js +44 -0
- package/lib/mass/ui/MassSidePanel.js.map +1 -0
- package/lib/mass/ui/MassStateProvider.d.ts +19 -0
- package/lib/mass/ui/MassStateProvider.d.ts.map +1 -0
- package/lib/mass/ui/MassStateProvider.js +16 -0
- package/lib/mass/ui/MassStateProvider.js.map +1 -0
- package/lib/mass/ui/MassStatusBar.d.ts +15 -0
- package/lib/mass/ui/MassStatusBar.d.ts.map +1 -0
- package/lib/mass/ui/MassStatusBar.js +50 -0
- package/lib/mass/ui/MassStatusBar.js.map +1 -0
- package/lib/mass/ui/MassToolbar.d.ts +24 -0
- package/lib/mass/ui/MassToolbar.d.ts.map +1 -0
- package/lib/mass/ui/MassToolbar.js +36 -0
- package/lib/mass/ui/MassToolbar.js.map +1 -0
- package/lib/mass/ui/MetadataPanel.d.ts +35 -0
- package/lib/mass/ui/MetadataPanel.d.ts.map +1 -0
- package/lib/mass/ui/MetadataPanel.js +100 -0
- package/lib/mass/ui/MetadataPanel.js.map +1 -0
- package/lib/mass/ui/MzDecimalsMenu.d.ts +28 -0
- package/lib/mass/ui/MzDecimalsMenu.d.ts.map +1 -0
- package/lib/mass/ui/MzDecimalsMenu.js +40 -0
- package/lib/mass/ui/MzDecimalsMenu.js.map +1 -0
- package/lib/mass/ui/PeakLabels.d.ts +93 -0
- package/lib/mass/ui/PeakLabels.d.ts.map +1 -0
- package/lib/mass/ui/PeakLabels.js +91 -0
- package/lib/mass/ui/PeakLabels.js.map +1 -0
- package/lib/mass/ui/PeakTable.d.ts +34 -0
- package/lib/mass/ui/PeakTable.d.ts.map +1 -0
- package/lib/mass/ui/PeakTable.js +49 -0
- package/lib/mass/ui/PeakTable.js.map +1 -0
- package/lib/mass/ui/PeaksPanel.d.ts +31 -0
- package/lib/mass/ui/PeaksPanel.d.ts.map +1 -0
- package/lib/mass/ui/PeaksPanel.js +53 -0
- package/lib/mass/ui/PeaksPanel.js.map +1 -0
- package/lib/mass/ui/SpectraPanel.d.ts +17 -0
- package/lib/mass/ui/SpectraPanel.d.ts.map +1 -0
- package/lib/mass/ui/SpectraPanel.js +76 -0
- package/lib/mass/ui/SpectraPanel.js.map +1 -0
- package/lib/mass/ui/SpectrumRow.d.ts +26 -0
- package/lib/mass/ui/SpectrumRow.d.ts.map +1 -0
- package/lib/mass/ui/SpectrumRow.js +141 -0
- package/lib/mass/ui/SpectrumRow.js.map +1 -0
- package/lib/mass/ui/SpectrumTrace.d.ts +46 -0
- package/lib/mass/ui/SpectrumTrace.d.ts.map +1 -0
- package/lib/mass/ui/SpectrumTrace.js +68 -0
- package/lib/mass/ui/SpectrumTrace.js.map +1 -0
- package/lib/mass/ui/index.d.ts +69 -0
- package/lib/mass/ui/index.d.ts.map +1 -0
- package/lib/mass/ui/index.js +42 -0
- package/lib/mass/ui/index.js.map +1 -0
- package/lib/mass/ui/massActions.d.ts +52 -0
- package/lib/mass/ui/massActions.d.ts.map +1 -0
- package/lib/mass/ui/massActions.js +62 -0
- package/lib/mass/ui/massActions.js.map +1 -0
- package/lib/mass/ui/massChartProps.d.ts +128 -0
- package/lib/mass/ui/massChartProps.d.ts.map +1 -0
- package/lib/mass/ui/massChartProps.js +14 -0
- package/lib/mass/ui/massChartProps.js.map +1 -0
- package/lib/mass/ui/massCommandContext.d.ts +36 -0
- package/lib/mass/ui/massCommandContext.d.ts.map +1 -0
- package/lib/mass/ui/massCommandContext.js +45 -0
- package/lib/mass/ui/massCommandContext.js.map +1 -0
- package/lib/mass/ui/massHostPanels.d.ts +48 -0
- package/lib/mass/ui/massHostPanels.d.ts.map +1 -0
- package/lib/mass/ui/massHostPanels.js +41 -0
- package/lib/mass/ui/massHostPanels.js.map +1 -0
- package/lib/mass/ui/massStateContext.d.ts +26 -0
- package/lib/mass/ui/massStateContext.d.ts.map +1 -0
- package/lib/mass/ui/massStateContext.js +37 -0
- package/lib/mass/ui/massStateContext.js.map +1 -0
- package/lib/mass/ui/useIntensityZoom.d.ts +20 -0
- package/lib/mass/ui/useIntensityZoom.d.ts.map +1 -0
- package/lib/mass/ui/useIntensityZoom.js +42 -0
- package/lib/mass/ui/useIntensityZoom.js.map +1 -0
- package/lib/mass/ui/useMassEditor.d.ts +52 -0
- package/lib/mass/ui/useMassEditor.d.ts.map +1 -0
- package/lib/mass/ui/useMassEditor.js +93 -0
- package/lib/mass/ui/useMassEditor.js.map +1 -0
- package/lib/mass/ui/useMassFiles.d.ts +22 -0
- package/lib/mass/ui/useMassFiles.d.ts.map +1 -0
- package/lib/mass/ui/useMassFiles.js +71 -0
- package/lib/mass/ui/useMassFiles.js.map +1 -0
- package/lib/mass/ui/useMassHandle.d.ts +15 -0
- package/lib/mass/ui/useMassHandle.d.ts.map +1 -0
- package/lib/mass/ui/useMassHandle.js +35 -0
- package/lib/mass/ui/useMassHandle.js.map +1 -0
- package/lib/mass/ui/useMassPointer.d.ts +70 -0
- package/lib/mass/ui/useMassPointer.d.ts.map +1 -0
- package/lib/mass/ui/useMassPointer.js +57 -0
- package/lib/mass/ui/useMassPointer.js.map +1 -0
- package/lib/mass/ui/useMassShortcuts.d.ts +21 -0
- package/lib/mass/ui/useMassShortcuts.d.ts.map +1 -0
- package/lib/mass/ui/useMassShortcuts.js +66 -0
- package/lib/mass/ui/useMassShortcuts.js.map +1 -0
- package/lib/mass/ui/useMassSide.d.ts +27 -0
- package/lib/mass/ui/useMassSide.d.ts.map +1 -0
- package/lib/mass/ui/useMassSide.js +45 -0
- package/lib/mass/ui/useMassSide.js.map +1 -0
- package/lib/mass/ui/useMassZoom.d.ts +92 -0
- package/lib/mass/ui/useMassZoom.d.ts.map +1 -0
- package/lib/mass/ui/useMassZoom.js +65 -0
- package/lib/mass/ui/useMassZoom.js.map +1 -0
- package/lib/mass.d.ts +16 -0
- package/lib/mass.d.ts.map +1 -0
- package/lib/mass.js +16 -0
- package/lib/mass.js.map +1 -0
- package/lib/panel/ui/PanelRail.d.ts.map +1 -1
- package/lib/panel/ui/PanelRail.js +6 -1
- package/lib/panel/ui/PanelRail.js.map +1 -1
- package/lib/slides/ui/slideSanitizeSchema.d.ts +3 -2
- package/lib/slides/ui/slideSanitizeSchema.d.ts.map +1 -1
- package/lib/slides/ui/slideSanitizeSchema.js +82 -2
- package/lib/slides/ui/slideSanitizeSchema.js.map +1 -1
- package/package.json +6 -1
- package/src/about/core/providers.ts +7 -0
- package/src/about/ui/AboutProvidedBy.tsx +49 -0
- package/src/chart/ui/useChartPointer.ts +18 -4
- package/src/credits/core/credits.ts +53 -0
- package/src/download/core/drawingMarkup.ts +18 -1
- package/src/download/core/figurePng.ts +21 -8
- package/src/download/core/figureSvg.ts +5 -2
- package/src/download/core/figureTarget.ts +28 -3
- package/src/download/core/svgBounds.ts +21 -0
- package/src/download/core/svgToPng.ts +3 -4
- package/src/format/core/relativeTime.ts +29 -7
- package/src/host/core/connectHost.ts +77 -120
- package/src/host/core/hostOutputs.ts +197 -0
- package/src/host/core/index.ts +13 -7
- package/src/host/core/irKinds.ts +92 -0
- package/src/host/core/kinds.ts +16 -6
- package/src/host/core/protocol.ts +50 -8
- package/src/host/core/selectInputs.ts +145 -0
- package/src/host/testing/sciPeaks.ts +140 -0
- package/src/host/testing/standInHost.ts +30 -5
- package/src/host/ui/useHostConnection.ts +17 -8
- package/src/host-testing.ts +4 -0
- package/src/ir/core/handPicking.ts +154 -0
- package/src/ir/core/index.ts +14 -0
- package/src/ir/core/irBandState.ts +155 -0
- package/src/ir/core/irCommands.ts +7 -0
- package/src/ir/core/irPeaks.ts +79 -0
- package/src/ir/core/irReducer.ts +27 -34
- package/src/ir/core/irSpectrum.ts +16 -0
- package/src/ir/core/irState.ts +15 -8
- package/src/ir/core/pickBands.ts +46 -39
- package/src/ir/core/ramanBands.ts +2 -2
- package/src/ir/core/spectrumBands.ts +113 -0
- package/src/ir/ui/BandRow.tsx +20 -2
- package/src/ir/ui/BandsPanel.tsx +46 -88
- package/src/ir/ui/BandsToolbar.tsx +152 -0
- package/src/ir/ui/IrCanvas.tsx +22 -11
- package/src/ir/ui/IrChart.tsx +10 -1
- package/src/ir/ui/IrDocumentationDialog.tsx +7 -0
- package/src/ir/ui/IrEditor.tsx +4 -2
- package/src/ir/ui/IrShell.tsx +5 -0
- package/src/ir/ui/IrStatusBar.tsx +4 -1
- package/src/ir/ui/IrToolbar.tsx +14 -5
- package/src/ir/ui/VibrationalEditor.tsx +2 -1
- package/src/ir/ui/irActions.ts +11 -0
- package/src/ir/ui/irChartProps.ts +4 -1
- package/src/ir/ui/useIrEditor.ts +21 -21
- package/src/locales/de.json +63 -0
- package/src/locales/en.json +63 -0
- package/src/locales/es.json +63 -0
- package/src/locales/fr.json +63 -0
- package/src/locales/it.json +63 -0
- package/src/mass/core/analyseSpectrum.ts +191 -0
- package/src/mass/core/ascendingTrace.ts +62 -0
- package/src/mass/core/centroidPeaks.ts +114 -0
- package/src/mass/core/detectMassFormat.ts +113 -0
- package/src/mass/core/downloadSpectra.ts +52 -0
- package/src/mass/core/fromJcamp.ts +151 -0
- package/src/mass/core/fromText.ts +58 -0
- package/src/mass/core/index.ts +194 -0
- package/src/mass/core/jcampTechnique.ts +87 -0
- package/src/mass/core/labelStackBox.ts +75 -0
- package/src/mass/core/labelledPeaks.ts +135 -0
- package/src/mass/core/loadMassSpectra.ts +86 -0
- package/src/mass/core/loadedMassSpectrum.ts +43 -0
- package/src/mass/core/massCommands.ts +156 -0
- package/src/mass/core/massDomain.ts +229 -0
- package/src/mass/core/massEditorApi.ts +68 -0
- package/src/mass/core/massFormat.ts +187 -0
- package/src/mass/core/massMeta.ts +239 -0
- package/src/mass/core/massReducer.ts +232 -0
- package/src/mass/core/massResolution.ts +169 -0
- package/src/mass/core/massSidePanels.ts +27 -0
- package/src/mass/core/massSpectrum.ts +220 -0
- package/src/mass/core/massState.ts +206 -0
- package/src/mass/core/massStateEdits.ts +104 -0
- package/src/mass/core/massSummary.ts +213 -0
- package/src/mass/core/mzDecimalsSetting.ts +52 -0
- package/src/mass/core/nearestPeak.ts +130 -0
- package/src/mass/core/peakLabelLines.ts +112 -0
- package/src/mass/core/peakLabelPlan.ts +246 -0
- package/src/mass/core/peakTable.ts +82 -0
- package/src/mass/core/resolutionOf.ts +100 -0
- package/src/mass/core/scanFilter.ts +119 -0
- package/src/mass/core/spectrumJcamp.ts +186 -0
- package/src/mass/core/toMassSpectrum.ts +126 -0
- package/src/mass/core/traceIcon.ts +105 -0
- package/src/mass/core/writtenResolution.ts +81 -0
- package/src/mass/ui/MassAboutDialog.tsx +89 -0
- package/src/mass/ui/MassCanvas.tsx +170 -0
- package/src/mass/ui/MassChart.tsx +266 -0
- package/src/mass/ui/MassCommandProvider.tsx +34 -0
- package/src/mass/ui/MassCommandTooltip.tsx +36 -0
- package/src/mass/ui/MassDocumentationDialog.tsx +136 -0
- package/src/mass/ui/MassEditor.tsx +130 -0
- package/src/mass/ui/MassHeader.tsx +38 -0
- package/src/mass/ui/MassLogo.tsx +84 -0
- package/src/mass/ui/MassPointerTracker.tsx +72 -0
- package/src/mass/ui/MassShell.tsx +237 -0
- package/src/mass/ui/MassSidePanel.tsx +107 -0
- package/src/mass/ui/MassStateProvider.tsx +32 -0
- package/src/mass/ui/MassStatusBar.tsx +108 -0
- package/src/mass/ui/MassToolbar.tsx +120 -0
- package/src/mass/ui/MetadataPanel.tsx +201 -0
- package/src/mass/ui/MzDecimalsMenu.tsx +86 -0
- package/src/mass/ui/PeakLabels.tsx +242 -0
- package/src/mass/ui/PeakTable.tsx +199 -0
- package/src/mass/ui/PeaksPanel.tsx +182 -0
- package/src/mass/ui/SpectraPanel.tsx +153 -0
- package/src/mass/ui/SpectrumRow.tsx +246 -0
- package/src/mass/ui/SpectrumTrace.tsx +119 -0
- package/src/mass/ui/index.ts +69 -0
- package/src/mass/ui/massActions.ts +109 -0
- package/src/mass/ui/massChartProps.ts +130 -0
- package/src/mass/ui/massCommandContext.tsx +65 -0
- package/src/mass/ui/massHostPanels.ts +71 -0
- package/src/mass/ui/massStateContext.ts +48 -0
- package/src/mass/ui/useIntensityZoom.ts +55 -0
- package/src/mass/ui/useMassEditor.ts +156 -0
- package/src/mass/ui/useMassFiles.ts +91 -0
- package/src/mass/ui/useMassHandle.ts +58 -0
- package/src/mass/ui/useMassPointer.ts +120 -0
- package/src/mass/ui/useMassShortcuts.ts +85 -0
- package/src/mass/ui/useMassSide.ts +63 -0
- package/src/mass/ui/useMassZoom.ts +157 -0
- package/src/mass.ts +16 -0
- package/src/panel/ui/PanelRail.tsx +5 -1
- package/src/slides/ui/slideSanitizeSchema.ts +86 -2
- package/styles/chrome.css +7 -0
- package/styles/slides.css +47 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One viewer's state, and everything derived from it.
|
|
3
|
+
*
|
|
4
|
+
* What is derived here is what three panels and the chart read alike — which
|
|
5
|
+
* spectra are drawn, which one is selected, and how many decimals every mass on
|
|
6
|
+
* screen is written with — so it is worked out once per change rather than once
|
|
7
|
+
* per reader.
|
|
8
|
+
*/
|
|
9
|
+
import { useEffect, useMemo, useReducer, useRef } from 'react';
|
|
10
|
+
import { massReducer } from "../core/massReducer.js";
|
|
11
|
+
import { isSpectrumDrawn } from "../core/massSpectrum.js";
|
|
12
|
+
import { createMassState } from "../core/massState.js";
|
|
13
|
+
import { mzDecimalsFor } from "../core/mzDecimalsSetting.js";
|
|
14
|
+
import { mzDecimalsOf } from "../core/resolutionOf.js";
|
|
15
|
+
import { createMassActions } from "./massActions.js";
|
|
16
|
+
/**
|
|
17
|
+
* Hold one viewer's state.
|
|
18
|
+
* @param options - What it opens on.
|
|
19
|
+
* @returns The state, what follows from it, and everything to do.
|
|
20
|
+
*/
|
|
21
|
+
export function useMassEditor(options = {}) {
|
|
22
|
+
const { onChange, ...initial } = options;
|
|
23
|
+
const [state, dispatch] = useReducer(massReducer, initial, createMassState);
|
|
24
|
+
const actions = useMemo(() => createMassActions(dispatch), [dispatch]);
|
|
25
|
+
const { spectra } = state.data;
|
|
26
|
+
const { selectedId } = state.view;
|
|
27
|
+
const visibleSpectra = useMemo(() => {
|
|
28
|
+
const visible = [];
|
|
29
|
+
for (const spectrum of spectra) {
|
|
30
|
+
if (isSpectrumDrawn(spectrum))
|
|
31
|
+
visible.push(spectrum);
|
|
32
|
+
}
|
|
33
|
+
return visible;
|
|
34
|
+
}, [spectra]);
|
|
35
|
+
const selectedSpectrum = useMemo(() => {
|
|
36
|
+
if (selectedId === null)
|
|
37
|
+
return null;
|
|
38
|
+
for (const spectrum of spectra) {
|
|
39
|
+
if (spectrum.id === selectedId)
|
|
40
|
+
return spectrum;
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}, [spectra, selectedId]);
|
|
44
|
+
const decimalsSetting = state.settings.mzDecimals;
|
|
45
|
+
const shownSpectra = useMemo(() => (selectedSpectrum === null ? visibleSpectra : [selectedSpectrum]), [visibleSpectra, selectedSpectrum]);
|
|
46
|
+
const autoMzDecimals = useMemo(() => mzDecimalsOf(shownSpectra), [shownSpectra]);
|
|
47
|
+
const mzDecimals = useMemo(() => mzDecimalsFor(decimalsSetting, shownSpectra), [decimalsSetting, shownSpectra]);
|
|
48
|
+
// What was reported last, so a host passing a fresh callback on every render
|
|
49
|
+
// is not told about spectra that did not change. The identities are compared
|
|
50
|
+
// rather than the array: a rename or a colour builds a new spectrum around
|
|
51
|
+
// the same peaks, and that is not a change of what is loaded.
|
|
52
|
+
const reported = useRef(spectra);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (sameSpectra(reported.current, spectra))
|
|
55
|
+
return;
|
|
56
|
+
reported.current = spectra;
|
|
57
|
+
onChange?.(spectra);
|
|
58
|
+
}, [spectra, onChange]);
|
|
59
|
+
return useMemo(() => ({
|
|
60
|
+
state,
|
|
61
|
+
visibleSpectra,
|
|
62
|
+
selectedSpectrum,
|
|
63
|
+
mzDecimals,
|
|
64
|
+
autoMzDecimals,
|
|
65
|
+
actions,
|
|
66
|
+
}), [
|
|
67
|
+
state,
|
|
68
|
+
visibleSpectra,
|
|
69
|
+
selectedSpectrum,
|
|
70
|
+
mzDecimals,
|
|
71
|
+
autoMzDecimals,
|
|
72
|
+
actions,
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Whether two lists hold the same spectra, in order.
|
|
77
|
+
* @param current - What was reported last.
|
|
78
|
+
* @param next - What is open now.
|
|
79
|
+
* @returns Whether the report can be skipped.
|
|
80
|
+
*/
|
|
81
|
+
function sameSpectra(current, next) {
|
|
82
|
+
if (current === next)
|
|
83
|
+
return true;
|
|
84
|
+
if (current.length !== next.length)
|
|
85
|
+
return false;
|
|
86
|
+
for (let index = 0; index < current.length; index++) {
|
|
87
|
+
if (current[index].id !== next[index].id) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=useMassEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMassEditor.js","sourceRoot":"","sources":["../../../src/mass/ui/useMassEditor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAsCrD;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,UAAgC,EAAE;IAElC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,GAAG,OAAO,CAAC;IAEzC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,WAAW,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;IAC5E,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEvE,MAAM,EAAE,OAAO,EAAE,G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EF,6EAA6E;IAC7E,6EAA6E;IAC7E,2EAA2E;IAC3E,8DAA8D;IAC9D,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;YAAE,OAAO;QACnD,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC;QAC3B,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAExB,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,KAAK;QACL,cAAc;QACd,gBAAgB;QAChB,UAAU;QACV,cAAc;QACd,OAAO;KACR,CAAC,EACF;QACE,KAAK;QACL,cAAc;QACd,gBAAgB;QAChB,UAAU;QACV,cAAc;QACd,OAAO;KACR,CACF,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAClB,OAAgC,EAChC,IAA6B;IAE7B,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAClC,IAAI,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACjD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACpD,IACG,OAAO,CAAC,KAAK,CAAkB,CAAC,EAAE,KAAM,IAAI,CAAC,KAAK,CAAkB,CAAC,EAAE,EACxE,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the files a chemist drops on the chart or picks from a dialog.
|
|
3
|
+
*
|
|
4
|
+
* Every file is read on its own, and one that cannot be read is said rather
|
|
5
|
+
* than stopping the others: a drop of eleven files with one infrared JCAMP among
|
|
6
|
+
* them draws the ten mass spectra and names the eleventh in the status bar.
|
|
7
|
+
*/
|
|
8
|
+
/** How files reach the viewer. */
|
|
9
|
+
export interface MassFiles {
|
|
10
|
+
/**
|
|
11
|
+
* Read these files and add what they hold.
|
|
12
|
+
* @param files - What was dropped or chosen.
|
|
13
|
+
* @returns Once every file has been read.
|
|
14
|
+
*/
|
|
15
|
+
readFiles: (files: readonly File[]) => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Read files into the viewer this is called inside.
|
|
19
|
+
* @returns How to read them.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useMassFiles(): MassFiles;
|
|
22
|
+
//# sourceMappingURL=useMassFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMassFiles.d.ts","sourceRoot":"","sources":["../../../src/mass/ui/useMassFiles.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,kCAAkC;AAClC,MAAM,WAAW,SAAS;IACxB;;;;OAIG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,SAAS,CA4CxC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the files a chemist drops on the chart or picks from a dialog.
|
|
3
|
+
*
|
|
4
|
+
* Every file is read on its own, and one that cannot be read is said rather
|
|
5
|
+
* than stopping the others: a drop of eleven files with one infrared JCAMP among
|
|
6
|
+
* them draws the ten mass spectra and names the eleventh in the status bar.
|
|
7
|
+
*/
|
|
8
|
+
import { useCallback, useMemo } from 'react';
|
|
9
|
+
import { errorMessage } from "../../error/core/index.js";
|
|
10
|
+
import { loadMassSpectra } from "../core/loadMassSpectra.js";
|
|
11
|
+
import { toMassSpectra } from "../core/toMassSpectrum.js";
|
|
12
|
+
import { useMassActions, useMassEditorState } from "./massStateContext.js";
|
|
13
|
+
/**
|
|
14
|
+
* Read files into the viewer this is called inside.
|
|
15
|
+
* @returns How to read them.
|
|
16
|
+
*/
|
|
17
|
+
export function useMassFiles() {
|
|
18
|
+
const { state } = useMassEditorState();
|
|
19
|
+
const actions = useMassActions();
|
|
20
|
+
const { spectra: open } = state.data;
|
|
21
|
+
const readFiles = useCallback(async (files) => {
|
|
22
|
+
// Read together, since each read is the browser's work rather than ours,
|
|
23
|
+
// and then dressed in the order the files were given, so the colours are
|
|
24
|
+
// handed out in that order too.
|
|
25
|
+
const results = await Promise.all(files.map(readFile));
|
|
26
|
+
const colors = open.map((spectrum) => spectrum.color);
|
|
27
|
+
const read = [];
|
|
28
|
+
const problems = [];
|
|
29
|
+
for (const [index, result] of results.entries()) {
|
|
30
|
+
const name = files[index]?.name ?? 'A file';
|
|
31
|
+
if (typeof result === 'string') {
|
|
32
|
+
problems.push(result);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
const spectra = toMassSpectra(result.spectra, { taken: colors });
|
|
37
|
+
for (const spectrum of spectra)
|
|
38
|
+
colors.push(spectrum.color);
|
|
39
|
+
read.push(...spectra);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
problems.push(`${name} could not be peak picked — ${errorMessage(error)}`);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (result.dropped > 0) {
|
|
46
|
+
problems.push(`${name} holds ${result.spectra.length + result.dropped} spectra and only the first ${result.spectra.length} were read.`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (read.length > 0)
|
|
50
|
+
actions.addSpectra(read);
|
|
51
|
+
// After the spectra, which clear any error standing from before.
|
|
52
|
+
if (problems.length > 0)
|
|
53
|
+
actions.setError(problems.join(' '));
|
|
54
|
+
}, [actions, open]);
|
|
55
|
+
return useMemo(() => ({ readFiles }), [readFiles]);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Read one file, saying why when it cannot be.
|
|
59
|
+
* @param file - The file.
|
|
60
|
+
* @returns What it held, or the sentence its refusal came with.
|
|
61
|
+
*/
|
|
62
|
+
async function readFile(file) {
|
|
63
|
+
try {
|
|
64
|
+
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
65
|
+
return await loadMassSpectra(bytes, { fileName: file.name });
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
return errorMessage(error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=useMassFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMassFiles.js","sourceRoot":"","sources":["../../../src/mass/ui/useMassFiles.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAY3E;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,EAAE,KAAK,EAAE,GAAG,kBAAkB,EAAE,CAAC;IACvC,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;IACjC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;IAErC,MAAM,SAAS,GAAG,WAAW,CAC3B,KAAK,EAAE,KAAsB,EAAE,EAAE;QAC/B,yEAAyE;QACzE,yEAAyE;QACzE,gCAAgC;QAChC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG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iE;QACjE,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,CAAC,EACD,CAAC,OAAO,EAAE,IAAI,CAAC,CAChB,CAAC;IAEF,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;AACrD,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,QAAQ,CAAC,IAAU;IAChC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACvD,OAAO,MAAM,eAAe,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The handle a host drives the viewer through, filled in from its state.
|
|
3
|
+
*
|
|
4
|
+
* A hook of its own beside the shell, because every gesture on the handle reads
|
|
5
|
+
* the state the shell already reads — and the shell is long enough without it.
|
|
6
|
+
*/
|
|
7
|
+
import type { Ref } from 'react';
|
|
8
|
+
import type { MassEditorHandle } from '../core/massEditorApi.ts';
|
|
9
|
+
/**
|
|
10
|
+
* Fill in a host's handle on the viewer this is called inside.
|
|
11
|
+
* @param handle - The handle to fill in, if the host asked for one.
|
|
12
|
+
* @param readFiles - How a file is read into the viewer, as a drop reads it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useMassHandle(handle: Ref<MassEditorHandle> | undefined, readFiles: (files: readonly File[]) => Promise<void>): void;
|
|
15
|
+
//# sourceMappingURL=useMassHandle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMassHandle.d.ts","sourceRoot":"","sources":["../../../src/mass/ui/useMassHandle.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAIjC,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,0BAA0B,CAAC;AAIlC;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,GAAG,CAAC,gBAAgB,CAAC,GAAG,SAAS,EACzC,SAAS,EAAE,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GACnD,IAAI,CA+BN"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The handle a host drives the viewer through, filled in from its state.
|
|
3
|
+
*
|
|
4
|
+
* A hook of its own beside the shell, because every gesture on the handle reads
|
|
5
|
+
* the state the shell already reads — and the shell is long enough without it.
|
|
6
|
+
*/
|
|
7
|
+
import { useImperativeHandle } from 'react';
|
|
8
|
+
import { mzFrame } from "../core/massDomain.js";
|
|
9
|
+
import { useMassActions, useMassEditorState } from "./massStateContext.js";
|
|
10
|
+
/**
|
|
11
|
+
* Fill in a host's handle on the viewer this is called inside.
|
|
12
|
+
* @param handle - The handle to fill in, if the host asked for one.
|
|
13
|
+
* @param readFiles - How a file is read into the viewer, as a drop reads it.
|
|
14
|
+
*/
|
|
15
|
+
export function useMassHandle(handle, readFiles) {
|
|
16
|
+
const { state, visibleSpectra } = useMassEditorState();
|
|
17
|
+
const actions = useMassActions();
|
|
18
|
+
const { domain } = state.view;
|
|
19
|
+
useImperativeHandle(handle, () => ({
|
|
20
|
+
getSpectra: () => state.data.spectra,
|
|
21
|
+
setSpectra: (spectra) => actions.setSpectra(spectra),
|
|
22
|
+
addSpectra: (spectra) => actions.addSpectra(spectra),
|
|
23
|
+
openFiles: (files) => readFiles(files),
|
|
24
|
+
clear: () => actions.clear(),
|
|
25
|
+
setDomain: (next) => actions.setDomain(next),
|
|
26
|
+
resetDomain: () => actions.resetDomain(),
|
|
27
|
+
zoomToMz: (mz, options = {}) => {
|
|
28
|
+
actions.setDomain(mzFrame(mz, visibleSpectra, domain, options.halfWidth === undefined
|
|
29
|
+
? {}
|
|
30
|
+
: { halfWidth: options.halfWidth }));
|
|
31
|
+
},
|
|
32
|
+
selectSpectrum: (id) => actions.selectSpectrum(id),
|
|
33
|
+
}), [state.data.spectra, actions, readFiles, domain, visibleSpectra]);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=useMassHandle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMassHandle.js","sourceRoot":"","sources":["../../../src/mass/ui/useMassHandle.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAMhD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3E;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAyC,EACzC,SAAoD;IAEpD,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,kBAAkB,EAAE,CAAC;IACvD,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;IACjC,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;IAE9B,mBAAmB,CACjB,MAAM,EACN,GAAqB,EAAE,CAAC,CAAC;QACvB,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO;QACpC,UAAU,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;QACpD,UAAU,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;QACpD,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC;QACtC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE;QAC5B,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;QAC5C,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE;QACxC,QAAQ,EAAE,CAAC,EAAE,EAAE,UAA2B,EAAE,EAAE,EAAE;YAC9C,OAAO,CAAC,SAAS,CACf,OAAO,CACL,EAAE,EACF,cAAc,EACd,MAAM,EACN,OAAO,CAAC,SAAS,KAAK,SAAS;gBAC7B,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CACrC,CACF,CAAC;QACJ,CAAC;QACD,cAAc,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;KACnD,CAAC,EACF,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,CAAC,CACjE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a mass chart reads under the pointer, and which peak it is asking about.
|
|
3
|
+
*
|
|
4
|
+
* Following the pointer at all is `useChartPointer` in the shared chart:
|
|
5
|
+
* placing it in user units, refusing the margins, and reporting only when the
|
|
6
|
+
* answer changed. What it *reads* there is the part that is about mass, and is
|
|
7
|
+
* the whole of this file — the m/z, the intensity, and the peak within reach.
|
|
8
|
+
*/
|
|
9
|
+
import type { RefObject } from 'react';
|
|
10
|
+
import type { PlotRect } from '../../chart/core/chartGeometry.ts';
|
|
11
|
+
import type { ChartScale } from '../../chart/core/chartScale.ts';
|
|
12
|
+
import type { ChartPointer } from '../../chart/ui/useChartPointer.ts';
|
|
13
|
+
import type { MassSpectrum } from '../core/massSpectrum.ts';
|
|
14
|
+
import type { NearestPeak } from '../core/nearestPeak.ts';
|
|
15
|
+
/** What the axes say under the pointer, which is what a readout prints. */
|
|
16
|
+
export interface MassReadout {
|
|
17
|
+
/** What the m/z axis reads there. */
|
|
18
|
+
mz: number;
|
|
19
|
+
/** What the intensity axis reads there. */
|
|
20
|
+
intensity: number;
|
|
21
|
+
/** The peak within reach of the pointer, `null` when none is. */
|
|
22
|
+
peak: NearestPeak | null;
|
|
23
|
+
}
|
|
24
|
+
export interface MassPointerOptions {
|
|
25
|
+
/** The SVG the chart is drawn on, as it was handed to its `ref`. */
|
|
26
|
+
svgRef: RefObject<SVGSVGElement | null>;
|
|
27
|
+
/** Where the plot sits inside that SVG. */
|
|
28
|
+
plot: PlotRect;
|
|
29
|
+
/** The m/z axis as it is currently zoomed. */
|
|
30
|
+
xScale: ChartScale;
|
|
31
|
+
/** The intensity axis as it is currently zoomed. */
|
|
32
|
+
yScale: ChartScale;
|
|
33
|
+
/** What the chart draws, for the peak under the pointer to be found. */
|
|
34
|
+
spectra: readonly MassSpectrum[];
|
|
35
|
+
/**
|
|
36
|
+
* Told which peak the pointer has come to rest on, and told `null` when it
|
|
37
|
+
* leaves one — called only when the answer changes, so it is safe to hang a
|
|
38
|
+
* highlight that redraws half the page on it.
|
|
39
|
+
* @default undefined
|
|
40
|
+
*/
|
|
41
|
+
onPeak?: (peak: NearestPeak | null) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Told when the pointer leaves the plot, and only then.
|
|
44
|
+
*
|
|
45
|
+
* `onPeak` says `null` for the gap between two sticks as well, so it cannot
|
|
46
|
+
* be read as the reading being over — which is the one thing a host drawing a
|
|
47
|
+
* picture of whatever is crossed has to know.
|
|
48
|
+
* @default undefined
|
|
49
|
+
*/
|
|
50
|
+
onAway?: () => void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Follow the pointer over a mass chart.
|
|
54
|
+
* @param options - The chart, its axes and what it holds.
|
|
55
|
+
* @returns Where the pointer is and what it reads, both `null` while it is
|
|
56
|
+
* anywhere but over the plot.
|
|
57
|
+
*/
|
|
58
|
+
export declare function useMassPointer(options: MassPointerOptions): ChartPointer<MassReadout>;
|
|
59
|
+
/**
|
|
60
|
+
* Whether two readings are about the same peak.
|
|
61
|
+
*
|
|
62
|
+
* The peak alone, and never the m/z under the crosshair: that fractional value
|
|
63
|
+
* changes on every pixel the pointer moves, and comparing it would report a new
|
|
64
|
+
* answer for every tremor of a hand resting on one stick.
|
|
65
|
+
* @param current - What was last read.
|
|
66
|
+
* @param next - What has just been read.
|
|
67
|
+
* @returns Whether both are about the same peak.
|
|
68
|
+
*/
|
|
69
|
+
export declare function sameMassReadout(current: MassReadout, next: MassReadout): boolean;
|
|
70
|
+
//# sourceMappingURL=useMassPointer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMassPointer.d.ts","sourceRoot":"","sources":["../../../src/mass/ui/useMassPointer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAGjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,qCAAqC;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,MAAM,EAAE,SAAS,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IACxC,2CAA2C;IAC3C,IAAI,EAAE,QAAQ,CAAC;IACf,8CAA8C;IAC9C,MAAM,EAAE,UAAU,CAAC;IACnB,oDAAoD;IACpD,MAAM,EAAE,UAAU,CAAC;IACnB,wEAAwE;IACxE,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IACjC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5C;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,kBAAkB,GAC1B,YAAY,CAAC,WAAW,CAAC,CAiC3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,WAAW,GAChB,OAAO,CAET"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a mass chart reads under the pointer, and which peak it is asking about.
|
|
3
|
+
*
|
|
4
|
+
* Following the pointer at all is `useChartPointer` in the shared chart:
|
|
5
|
+
* placing it in user units, refusing the margins, and reporting only when the
|
|
6
|
+
* answer changed. What it *reads* there is the part that is about mass, and is
|
|
7
|
+
* the whole of this file — the m/z, the intensity, and the peak within reach.
|
|
8
|
+
*/
|
|
9
|
+
import { useCallback, useMemo } from 'react';
|
|
10
|
+
import { chartValue } from "../../chart/core/chartScale.js";
|
|
11
|
+
import { useChartPointer } from "../../chart/ui/useChartPointer.js";
|
|
12
|
+
import { nearestPeakMz, sameNearestPeak } from "../core/nearestPeak.js";
|
|
13
|
+
/**
|
|
14
|
+
* Follow the pointer over a mass chart.
|
|
15
|
+
* @param options - The chart, its axes and what it holds.
|
|
16
|
+
* @returns Where the pointer is and what it reads, both `null` while it is
|
|
17
|
+
* anywhere but over the plot.
|
|
18
|
+
*/
|
|
19
|
+
export function useMassPointer(options) {
|
|
20
|
+
const { svgRef, plot, xScale, yScale, spectra, onPeak, onAway } = options;
|
|
21
|
+
const read = useCallback((point) => ({
|
|
22
|
+
mz: chartValue(xScale, point.x),
|
|
23
|
+
intensity: chartValue(yScale, point.y),
|
|
24
|
+
peak: nearestPeakMz(spectra, xScale, point.x),
|
|
25
|
+
}), [xScale, yScale, spectra]);
|
|
26
|
+
const onReadout = useMemo(() => onPeak === undefined && onAway === undefined
|
|
27
|
+
? undefined
|
|
28
|
+
: (readout) => {
|
|
29
|
+
onPeak?.(readout?.peak ?? null);
|
|
30
|
+
// Only the whole reading is absent off the plot: inside it there is
|
|
31
|
+
// always an m/z and an intensity, whether or not a stick is within
|
|
32
|
+
// reach. So this is the leave, and the `null` peak above is not.
|
|
33
|
+
if (readout === null)
|
|
34
|
+
onAway?.();
|
|
35
|
+
}, [onPeak, onAway]);
|
|
36
|
+
return useChartPointer({
|
|
37
|
+
svgRef,
|
|
38
|
+
plot,
|
|
39
|
+
read,
|
|
40
|
+
sameReadout: sameMassReadout,
|
|
41
|
+
onReadout,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Whether two readings are about the same peak.
|
|
46
|
+
*
|
|
47
|
+
* The peak alone, and never the m/z under the crosshair: that fractional value
|
|
48
|
+
* changes on every pixel the pointer moves, and comparing it would report a new
|
|
49
|
+
* answer for every tremor of a hand resting on one stick.
|
|
50
|
+
* @param current - What was last read.
|
|
51
|
+
* @param next - What has just been read.
|
|
52
|
+
* @returns Whether both are about the same peak.
|
|
53
|
+
*/
|
|
54
|
+
export function sameMassReadout(current, next) {
|
|
55
|
+
return sameNearestPeak(current.peak, next.peak);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=useMassPointer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMassPointer.js","sourceRoot":"","sources":["../../../src/mass/ui/useMassPointer.ts"],"names":[],"mappings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,IAAI;QACJ,WAAW,EAAE,eAAe;QAC5B,SAAS;KACV,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAoB,EACpB,IAAiB;IAEjB,OAAO,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The keys, heard on the viewer's own root rather than on the document.
|
|
3
|
+
*
|
|
4
|
+
* Two viewers on one page must not both answer `f`, and a page that holds this
|
|
5
|
+
* beside an infrared viewer must not have its own keys eaten. So the viewer
|
|
6
|
+
* hears a key only while it holds the caret — the root carries `tabIndex={-1}`
|
|
7
|
+
* so a click anywhere in it does — and a key it acted on goes no further.
|
|
8
|
+
*/
|
|
9
|
+
import type { MassCommandHandlers } from '../core/massCommands.ts';
|
|
10
|
+
/**
|
|
11
|
+
* Fire the viewer's commands from the keyboard.
|
|
12
|
+
*
|
|
13
|
+
* The handlers are read live through a ref rather than closed over, so the
|
|
14
|
+
* listener is attached once for the life of the viewer instead of being torn
|
|
15
|
+
* down and rebuilt on every render — and the chart re-renders on every move of
|
|
16
|
+
* the pointer across it.
|
|
17
|
+
* @param root - The viewer's root, `null` until it is mounted.
|
|
18
|
+
* @param handlers - What each command does.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useMassShortcuts(root: HTMLElement | null, handlers: MassCommandHandlers): void;
|
|
21
|
+
//# sourceMappingURL=useMassShortcuts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMassShortcuts.d.ts","sourceRoot":"","sources":["../../../src/mass/ui/useMassShortcuts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAEV,mBAAmB,EAEpB,MAAM,yBAAyB,CAAC;AAGjC;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,GAAG,IAAI,EACxB,QAAQ,EAAE,mBAAmB,GAC5B,IAAI,CAsCN"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The keys, heard on the viewer's own root rather than on the document.
|
|
3
|
+
*
|
|
4
|
+
* Two viewers on one page must not both answer `f`, and a page that holds this
|
|
5
|
+
* beside an infrared viewer must not have its own keys eaten. So the viewer
|
|
6
|
+
* hears a key only while it holds the caret — the root carries `tabIndex={-1}`
|
|
7
|
+
* so a click anywhere in it does — and a key it acted on goes no further.
|
|
8
|
+
*/
|
|
9
|
+
import { useEffect, useLayoutEffect, useRef } from 'react';
|
|
10
|
+
import { isEditingField } from "../../panel/core/isEditingField.js";
|
|
11
|
+
import { massCommands } from "../core/massCommands.js";
|
|
12
|
+
/**
|
|
13
|
+
* Fire the viewer's commands from the keyboard.
|
|
14
|
+
*
|
|
15
|
+
* The handlers are read live through a ref rather than closed over, so the
|
|
16
|
+
* listener is attached once for the life of the viewer instead of being torn
|
|
17
|
+
* down and rebuilt on every render — and the chart re-renders on every move of
|
|
18
|
+
* the pointer across it.
|
|
19
|
+
* @param root - The viewer's root, `null` until it is mounted.
|
|
20
|
+
* @param handlers - What each command does.
|
|
21
|
+
*/
|
|
22
|
+
export function useMassShortcuts(root, handlers) {
|
|
23
|
+
const latest = useRef(handlers);
|
|
24
|
+
useLayoutEffect(() => {
|
|
25
|
+
latest.current = handlers;
|
|
26
|
+
});
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (root === null)
|
|
29
|
+
return;
|
|
30
|
+
/**
|
|
31
|
+
* Run the command a key names, if it names one.
|
|
32
|
+
* @param event - The key that arrived.
|
|
33
|
+
*/
|
|
34
|
+
function onKeyDown(event) {
|
|
35
|
+
// A key pressed with a modifier belongs to the browser or to the page:
|
|
36
|
+
// Ctrl+F is a search, and a viewer that swallowed it to fit its chart
|
|
37
|
+
// would be a viewer people stop typing in.
|
|
38
|
+
if (event.ctrlKey || event.metaKey || event.altKey)
|
|
39
|
+
return;
|
|
40
|
+
// Never while a name is being typed into the spectra panel.
|
|
41
|
+
if (isEditingField(event.target))
|
|
42
|
+
return;
|
|
43
|
+
const id = KEYS.get(event.key.toLowerCase());
|
|
44
|
+
if (id === undefined)
|
|
45
|
+
return;
|
|
46
|
+
const handler = latest.current[id];
|
|
47
|
+
if (handler === undefined)
|
|
48
|
+
return;
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
// So the same key does not also reach a viewer mounted beside this one.
|
|
51
|
+
event.stopPropagation();
|
|
52
|
+
handler();
|
|
53
|
+
}
|
|
54
|
+
root.addEventListener('keydown', onKeyDown);
|
|
55
|
+
return () => {
|
|
56
|
+
root.removeEventListener('keydown', onKeyDown);
|
|
57
|
+
};
|
|
58
|
+
}, [root]);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Every key the viewer answers to, against the command it runs — built once
|
|
62
|
+
* from the command table, lower-cased so a capital arriving from a held shift
|
|
63
|
+
* still reaches the command a lowercase key names.
|
|
64
|
+
*/
|
|
65
|
+
const KEYS = new Map(Object.entries(massCommands).flatMap(([id, command]) => (command.shortcut?.keys ?? []).map((key) => [key.toLowerCase(), id])));
|
|
66
|
+
//# sourceMappingURL=useMassShortcuts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMassShortcuts.js","sourceRoot":"","sources":["../../../src/mass/ui/useMassShortcuts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAMpE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAwB,EACxB,QAA6B;IAE7B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEhC,eAA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E,CAAC,CAAC,GAAG,CAChC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,EAAmB,CAAU,CAC3D,CACJ,CACF,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The side of the viewer: the panels it offers, whether any of them is open,
|
|
3
|
+
* and what dragging the splitter shut and back open does to them.
|
|
4
|
+
*
|
|
5
|
+
* A hook of its own beside the shell, because the shell lays the side out and
|
|
6
|
+
* this decides what is on it.
|
|
7
|
+
*/
|
|
8
|
+
import type { MassHostPanel, MassStackPanel } from './massHostPanels.ts';
|
|
9
|
+
/** The side, as the shell lays it out. */
|
|
10
|
+
export interface MassSide {
|
|
11
|
+
/** Every panel on offer, in the order their icons are stacked. */
|
|
12
|
+
panels: readonly MassStackPanel[];
|
|
13
|
+
/** Whether a panel on offer is open, which is whether the side is. */
|
|
14
|
+
isOpen: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Open or close the side, as the splitter is dragged shut and back open.
|
|
17
|
+
* @param open - Whether the side is now open.
|
|
18
|
+
*/
|
|
19
|
+
setOpen: (open: boolean) => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The side of the viewer this is called inside.
|
|
23
|
+
* @param hostPanels - The panels the host adds to the viewer's own.
|
|
24
|
+
* @returns The panels on offer, whether the side is open, and how to open it.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useMassSide(hostPanels: readonly MassHostPanel[]): MassSide;
|
|
27
|
+
//# sourceMappingURL=useMassSide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMassSide.d.ts","sourceRoot":"","sources":["../../../src/mass/ui/useMassSide.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIzE,0CAA0C;AAC1C,MAAM,WAAW,QAAQ;IACvB,kEAAkE;IAClE,MAAM,EAAE,SAAS,cAAc,EAAE,CAAC;IAClC,sEAAsE;IACtE,MAAM,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAClC;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,GAAG,QAAQ,CA4B1E"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The side of the viewer: the panels it offers, whether any of them is open,
|
|
3
|
+
* and what dragging the splitter shut and back open does to them.
|
|
4
|
+
*
|
|
5
|
+
* A hook of its own beside the shell, because the shell lays the side out and
|
|
6
|
+
* this decides what is on it.
|
|
7
|
+
*/
|
|
8
|
+
import { useMemo } from 'react';
|
|
9
|
+
import { DEFAULT_SIDE_PANEL } from "../core/massState.js";
|
|
10
|
+
import { massStackPanels } from "./massHostPanels.js";
|
|
11
|
+
import { useMassActions, useMassEditorState } from "./massStateContext.js";
|
|
12
|
+
/**
|
|
13
|
+
* The side of the viewer this is called inside.
|
|
14
|
+
* @param hostPanels - The panels the host adds to the viewer's own.
|
|
15
|
+
* @returns The panels on offer, whether the side is open, and how to open it.
|
|
16
|
+
*/
|
|
17
|
+
export function useMassSide(hostPanels) {
|
|
18
|
+
const { state } = useMassEditorState();
|
|
19
|
+
const actions = useMassActions();
|
|
20
|
+
const { openPanelIds } = state.view;
|
|
21
|
+
const panels = useMemo(() => massStackPanels(hostPanels), [hostPanels]);
|
|
22
|
+
// Read off the panels on offer rather than off the ids: an id no panel
|
|
23
|
+
// answers to opens nothing, and a side open on it alone is an empty column.
|
|
24
|
+
const isOpen = useMemo(() => {
|
|
25
|
+
const open = new Set(openPanelIds);
|
|
26
|
+
return panels.some((panel) => open.has(panel.id));
|
|
27
|
+
}, [panels, openPanelIds]);
|
|
28
|
+
/**
|
|
29
|
+
* Open or close the side.
|
|
30
|
+
* @param open - Whether the side is now open.
|
|
31
|
+
*/
|
|
32
|
+
function setOpen(open) {
|
|
33
|
+
if (!open) {
|
|
34
|
+
for (const panelId of openPanelIds)
|
|
35
|
+
actions.togglePanel(panelId);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
// Dragging the splitter back open must land on something, or it opens on an
|
|
39
|
+
// empty column and reads as broken.
|
|
40
|
+
if (!isOpen)
|
|
41
|
+
actions.togglePanel(DEFAULT_SIDE_PANEL);
|
|
42
|
+
}
|
|
43
|
+
return { panels, isOpen, setOpen };
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=useMassSide.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMassSide.js","sourceRoot":"","sources":["../../../src/mass/ui/useMassSide.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAe3E;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,UAAoC;IAC9D,MAAM,EAAE,KAAK,EAAE,GAAG,kBAAkB,EAAE,CAAC;IACvC,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;IACjC,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;IAEpC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IACxE,uEAAuE;IACvE,4EAA4E;IAC5E,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QAC1B,MAAM,IAAI,GAAG,IAAI,GAAG,CAAS,YAAY,CAAC,CAAC;QAC3C,OAAO,MAAM,CAAC,IAAI,CAAC,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