react-cheminfo 0.27.0 → 0.29.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 +38 -25
- package/lib/chart/core/axisLabels.d.ts +82 -0
- package/lib/chart/core/axisLabels.d.ts.map +1 -0
- package/lib/chart/core/axisLabels.js +111 -0
- package/lib/chart/core/axisLabels.js.map +1 -0
- package/lib/chart/core/boxLayout.d.ts +53 -0
- package/lib/chart/core/boxLayout.d.ts.map +1 -0
- package/lib/chart/core/boxLayout.js +112 -0
- package/lib/chart/core/boxLayout.js.map +1 -0
- package/lib/chart/core/chartAxisScale.d.ts +23 -2
- package/lib/chart/core/chartAxisScale.d.ts.map +1 -1
- package/lib/chart/core/chartAxisScale.js +64 -13
- package/lib/chart/core/chartAxisScale.js.map +1 -1
- package/lib/chart/core/chartDomain.d.ts +160 -0
- package/lib/chart/core/chartDomain.d.ts.map +1 -0
- package/lib/chart/core/chartDomain.js +46 -0
- package/lib/chart/core/chartDomain.js.map +1 -0
- package/lib/chart/core/chartGeometry.d.ts +131 -0
- package/lib/chart/core/chartGeometry.d.ts.map +1 -0
- package/lib/chart/core/chartGeometry.js +101 -0
- package/lib/chart/core/chartGeometry.js.map +1 -0
- package/lib/chart/core/chartPane.d.ts +11 -0
- package/lib/chart/core/chartPane.d.ts.map +1 -0
- package/lib/chart/core/chartPane.js +11 -0
- package/lib/chart/core/chartPane.js.map +1 -0
- package/lib/chart/core/chartScale.d.ts +4 -1
- package/lib/chart/core/chartScale.d.ts.map +1 -1
- package/lib/chart/core/chartScale.js +8 -4
- package/lib/chart/core/chartScale.js.map +1 -1
- package/lib/chart/core/chartTheme.d.ts +156 -0
- package/lib/chart/core/chartTheme.d.ts.map +1 -0
- package/lib/chart/core/chartTheme.js +156 -0
- package/lib/chart/core/chartTheme.js.map +1 -0
- package/lib/chart/core/chartViewport.d.ts +32 -5
- package/lib/chart/core/chartViewport.d.ts.map +1 -1
- package/lib/chart/core/chartViewport.js +40 -11
- package/lib/chart/core/chartViewport.js.map +1 -1
- package/lib/chart/core/guidePlacement.d.ts +52 -0
- package/lib/chart/core/guidePlacement.d.ts.map +1 -0
- package/lib/chart/core/guidePlacement.js +52 -0
- package/lib/chart/core/guidePlacement.js.map +1 -0
- package/lib/chart/core/index.d.ts +29 -2
- package/lib/chart/core/index.d.ts.map +1 -1
- package/lib/chart/core/index.js +19 -2
- package/lib/chart/core/index.js.map +1 -1
- package/lib/chart/core/labelStack.d.ts +27 -0
- package/lib/chart/core/labelStack.d.ts.map +1 -0
- package/lib/chart/core/labelStack.js +62 -0
- package/lib/chart/core/labelStack.js.map +1 -0
- package/lib/chart/core/legendBox.d.ts +152 -0
- package/lib/chart/core/legendBox.d.ts.map +1 -0
- package/lib/chart/core/legendBox.js +169 -0
- package/lib/chart/core/legendBox.js.map +1 -0
- package/lib/chart/core/selectionGeometry.d.ts +45 -0
- package/lib/chart/core/selectionGeometry.d.ts.map +1 -0
- package/lib/chart/core/selectionGeometry.js +49 -0
- package/lib/chart/core/selectionGeometry.js.map +1 -0
- package/lib/chart/core/spectrumColor.d.ts +80 -0
- package/lib/chart/core/spectrumColor.d.ts.map +1 -0
- package/lib/chart/core/spectrumColor.js +120 -0
- package/lib/chart/core/spectrumColor.js.map +1 -0
- package/lib/chart/core/stackCapacity.d.ts +136 -0
- package/lib/chart/core/stackCapacity.d.ts.map +1 -0
- package/lib/chart/core/stackCapacity.js +153 -0
- package/lib/chart/core/stackCapacity.js.map +1 -0
- package/lib/chart/core/svgPoint.d.ts +62 -0
- package/lib/chart/core/svgPoint.d.ts.map +1 -0
- package/lib/chart/core/svgPoint.js +43 -0
- package/lib/chart/core/svgPoint.js.map +1 -0
- package/lib/chart/core/tracePath.d.ts +94 -0
- package/lib/chart/core/tracePath.d.ts.map +1 -0
- package/lib/chart/core/tracePath.js +191 -0
- package/lib/chart/core/tracePath.js.map +1 -0
- package/lib/chart/core/trackerReadout.d.ts +55 -0
- package/lib/chart/core/trackerReadout.d.ts.map +1 -0
- package/lib/chart/core/trackerReadout.js +53 -0
- package/lib/chart/core/trackerReadout.js.map +1 -0
- package/lib/chart/core/viewTransform.d.ts +167 -0
- package/lib/chart/core/viewTransform.d.ts.map +1 -0
- package/lib/chart/core/viewTransform.js +188 -0
- package/lib/chart/core/viewTransform.js.map +1 -0
- package/lib/chart/core/zoomDomain.d.ts +127 -0
- package/lib/chart/core/zoomDomain.d.ts.map +1 -0
- package/lib/chart/core/zoomDomain.js +175 -0
- package/lib/chart/core/zoomDomain.js.map +1 -0
- package/lib/chart/ui/Axes.d.ts +104 -0
- package/lib/chart/ui/Axes.d.ts.map +1 -0
- package/lib/chart/ui/Axes.js +155 -0
- package/lib/chart/ui/Axes.js.map +1 -0
- package/lib/chart/ui/AxisGuide.d.ts +60 -0
- package/lib/chart/ui/AxisGuide.d.ts.map +1 -0
- package/lib/chart/ui/AxisGuide.js +111 -0
- package/lib/chart/ui/AxisGuide.js.map +1 -0
- package/lib/chart/ui/ChartStack.d.ts +81 -0
- package/lib/chart/ui/ChartStack.d.ts.map +1 -0
- package/lib/chart/ui/ChartStack.js +42 -0
- package/lib/chart/ui/ChartStack.js.map +1 -0
- package/lib/chart/ui/ChartTracker.d.ts +36 -0
- package/lib/chart/ui/ChartTracker.d.ts.map +1 -0
- package/lib/chart/ui/ChartTracker.js +27 -0
- package/lib/chart/ui/ChartTracker.js.map +1 -0
- package/lib/chart/ui/PlotCaption.d.ts +44 -0
- package/lib/chart/ui/PlotCaption.d.ts.map +1 -0
- package/lib/chart/ui/PlotCaption.js +68 -0
- package/lib/chart/ui/PlotCaption.js.map +1 -0
- package/lib/chart/ui/SelectionRect.d.ts +27 -0
- package/lib/chart/ui/SelectionRect.d.ts.map +1 -0
- package/lib/chart/ui/SelectionRect.js +31 -0
- package/lib/chart/ui/SelectionRect.js.map +1 -0
- package/lib/chart/ui/TraceLegend.d.ts +99 -0
- package/lib/chart/ui/TraceLegend.d.ts.map +1 -0
- package/lib/chart/ui/TraceLegend.js +45 -0
- package/lib/chart/ui/TraceLegend.js.map +1 -0
- package/lib/chart/ui/chartGestures.d.ts +158 -0
- package/lib/chart/ui/chartGestures.d.ts.map +1 -0
- package/lib/chart/ui/chartGestures.js +145 -0
- package/lib/chart/ui/chartGestures.js.map +1 -0
- package/lib/chart/ui/chartStackLevel.d.ts +115 -0
- package/lib/chart/ui/chartStackLevel.d.ts.map +1 -0
- package/lib/chart/ui/chartStackLevel.js +96 -0
- package/lib/chart/ui/chartStackLevel.js.map +1 -0
- package/lib/chart/ui/chartSurface.d.ts +35 -0
- package/lib/chart/ui/chartSurface.d.ts.map +1 -0
- package/lib/chart/ui/chartSurface.js +58 -0
- package/lib/chart/ui/chartSurface.js.map +1 -0
- package/lib/chart/ui/index.d.ts +24 -0
- package/lib/chart/ui/index.d.ts.map +1 -1
- package/lib/chart/ui/index.js +13 -0
- package/lib/chart/ui/index.js.map +1 -1
- package/lib/chart/ui/useChartPointer.d.ts +124 -0
- package/lib/chart/ui/useChartPointer.d.ts.map +1 -0
- package/lib/chart/ui/useChartPointer.js +152 -0
- package/lib/chart/ui/useChartPointer.js.map +1 -0
- package/lib/chart/ui/useChartSize.d.ts +49 -0
- package/lib/chart/ui/useChartSize.d.ts.map +1 -0
- package/lib/chart/ui/useChartSize.js +91 -0
- package/lib/chart/ui/useChartSize.js.map +1 -0
- package/lib/chart/ui/useChartWindow.d.ts +147 -0
- package/lib/chart/ui/useChartWindow.d.ts.map +1 -0
- package/lib/chart/ui/useChartWindow.js +135 -0
- package/lib/chart/ui/useChartWindow.js.map +1 -0
- package/lib/chart/ui/useChartZoom.d.ts +88 -0
- package/lib/chart/ui/useChartZoom.d.ts.map +1 -0
- package/lib/chart/ui/useChartZoom.js +142 -0
- package/lib/chart/ui/useChartZoom.js.map +1 -0
- package/lib/chart/ui/useWheelListener.d.ts +30 -0
- package/lib/chart/ui/useWheelListener.d.ts.map +1 -0
- package/lib/chart/ui/useWheelListener.js +57 -0
- package/lib/chart/ui/useWheelListener.js.map +1 -0
- package/lib/clipboard/core/copyPng.d.ts +13 -0
- package/lib/clipboard/core/copyPng.d.ts.map +1 -0
- package/lib/clipboard/core/copyPng.js +19 -0
- package/lib/clipboard/core/copyPng.js.map +1 -0
- package/lib/clipboard/core/index.d.ts +1 -0
- package/lib/clipboard/core/index.d.ts.map +1 -1
- package/lib/clipboard/core/index.js +1 -0
- package/lib/clipboard/core/index.js.map +1 -1
- package/lib/clipboard/ui/CopyableValue.d.ts +12 -9
- package/lib/clipboard/ui/CopyableValue.d.ts.map +1 -1
- package/lib/clipboard/ui/CopyableValue.js +11 -15
- package/lib/clipboard/ui/CopyableValue.js.map +1 -1
- package/lib/core.d.ts +1 -0
- package/lib/core.d.ts.map +1 -1
- package/lib/core.js +1 -0
- package/lib/core.js.map +1 -1
- package/lib/download/core/exportStyles.d.ts +22 -0
- package/lib/download/core/exportStyles.d.ts.map +1 -0
- package/lib/download/core/exportStyles.js +19 -0
- package/lib/download/core/exportStyles.js.map +1 -0
- package/lib/download/core/imageResolution.d.ts +88 -0
- package/lib/download/core/imageResolution.d.ts.map +1 -0
- package/lib/download/core/imageResolution.js +77 -0
- package/lib/download/core/imageResolution.js.map +1 -0
- package/lib/download/core/index.d.ts +13 -0
- package/lib/download/core/index.d.ts.map +1 -1
- package/lib/download/core/index.js +8 -0
- package/lib/download/core/index.js.map +1 -1
- package/lib/download/core/pictureExport.d.ts +93 -0
- package/lib/download/core/pictureExport.d.ts.map +1 -0
- package/lib/download/core/pictureExport.js +116 -0
- package/lib/download/core/pictureExport.js.map +1 -0
- package/lib/download/core/stackedDrawing.d.ts +36 -0
- package/lib/download/core/stackedDrawing.d.ts.map +1 -0
- package/lib/download/core/stackedDrawing.js +98 -0
- package/lib/download/core/stackedDrawing.js.map +1 -0
- package/lib/download/core/svgBounds.d.ts +44 -0
- package/lib/download/core/svgBounds.d.ts.map +1 -0
- package/lib/download/core/svgBounds.js +69 -0
- package/lib/download/core/svgBounds.js.map +1 -0
- package/lib/download/core/svgNamespace.d.ts +9 -0
- package/lib/download/core/svgNamespace.d.ts.map +1 -0
- package/lib/download/core/svgNamespace.js +10 -0
- package/lib/download/core/svgNamespace.js.map +1 -0
- package/lib/download/core/svgToPng.d.ts +43 -0
- package/lib/download/core/svgToPng.d.ts.map +1 -0
- package/lib/download/core/svgToPng.js +79 -0
- package/lib/download/core/svgToPng.js.map +1 -0
- package/lib/download/core/svgToString.d.ts +45 -0
- package/lib/download/core/svgToString.d.ts.map +1 -0
- package/lib/download/core/svgToString.js +58 -0
- package/lib/download/core/svgToString.js.map +1 -0
- package/lib/download/ui/ExportDialogFrame.d.ts +46 -0
- package/lib/download/ui/ExportDialogFrame.d.ts.map +1 -0
- package/lib/download/ui/ExportDialogFrame.js +24 -0
- package/lib/download/ui/ExportDialogFrame.js.map +1 -0
- package/lib/download/ui/ExportImageDialog.d.ts +47 -0
- package/lib/download/ui/ExportImageDialog.d.ts.map +1 -0
- package/lib/download/ui/ExportImageDialog.js +25 -0
- package/lib/download/ui/ExportImageDialog.js.map +1 -0
- package/lib/download/ui/ExportNameField.d.ts +29 -0
- package/lib/download/ui/ExportNameField.d.ts.map +1 -0
- package/lib/download/ui/ExportNameField.js +99 -0
- package/lib/download/ui/ExportNameField.js.map +1 -0
- package/lib/download/ui/ExportPictureSection.d.ts +38 -0
- package/lib/download/ui/ExportPictureSection.d.ts.map +1 -0
- package/lib/download/ui/ExportPictureSection.js +48 -0
- package/lib/download/ui/ExportPictureSection.js.map +1 -0
- package/lib/download/ui/index.d.ts +10 -0
- package/lib/download/ui/index.d.ts.map +1 -1
- package/lib/download/ui/index.js +5 -0
- package/lib/download/ui/index.js.map +1 -1
- package/lib/download/ui/useDrawingBox.d.ts +23 -0
- package/lib/download/ui/useDrawingBox.d.ts.map +1 -0
- package/lib/download/ui/useDrawingBox.js +21 -0
- package/lib/download/ui/useDrawingBox.js.map +1 -0
- package/lib/error/core/describeSource.d.ts +17 -0
- package/lib/error/core/describeSource.d.ts.map +1 -0
- package/lib/error/core/describeSource.js +19 -0
- package/lib/error/core/describeSource.js.map +1 -0
- package/lib/error/core/index.d.ts +1 -0
- package/lib/error/core/index.d.ts.map +1 -1
- package/lib/error/core/index.js +1 -0
- package/lib/error/core/index.js.map +1 -1
- package/lib/help/ui/HelpBody.d.ts +10 -1
- package/lib/help/ui/HelpBody.d.ts.map +1 -1
- package/lib/help/ui/HelpBody.js +24 -1
- package/lib/help/ui/HelpBody.js.map +1 -1
- package/lib/help/ui/index.d.ts +1 -1
- package/lib/help/ui/index.d.ts.map +1 -1
- package/lib/help/ui/index.js.map +1 -1
- package/lib/ir/core/analysisSpectra.d.ts +46 -0
- package/lib/ir/core/analysisSpectra.d.ts.map +1 -0
- package/lib/ir/core/analysisSpectra.js +187 -0
- package/lib/ir/core/analysisSpectra.js.map +1 -0
- package/lib/ir/core/assignBands.d.ts +83 -0
- package/lib/ir/core/assignBands.d.ts.map +1 -0
- package/lib/ir/core/assignBands.js +83 -0
- package/lib/ir/core/assignBands.js.map +1 -0
- package/lib/ir/core/bandAssignments.d.ts +47 -0
- package/lib/ir/core/bandAssignments.d.ts.map +1 -0
- package/lib/ir/core/bandAssignments.js +305 -0
- package/lib/ir/core/bandAssignments.js.map +1 -0
- package/lib/ir/core/bandLabelPlan.d.ts +93 -0
- package/lib/ir/core/bandLabelPlan.d.ts.map +1 -0
- package/lib/ir/core/bandLabelPlan.js +104 -0
- package/lib/ir/core/bandLabelPlan.js.map +1 -0
- package/lib/ir/core/detectIrFormat.d.ts +23 -0
- package/lib/ir/core/detectIrFormat.d.ts.map +1 -0
- package/lib/ir/core/detectIrFormat.js +133 -0
- package/lib/ir/core/detectIrFormat.js.map +1 -0
- package/lib/ir/core/downloadSpectra.d.ts +26 -0
- package/lib/ir/core/downloadSpectra.d.ts.map +1 -0
- package/lib/ir/core/downloadSpectra.js +37 -0
- package/lib/ir/core/downloadSpectra.js.map +1 -0
- package/lib/ir/core/fromJcamp.d.ts +35 -0
- package/lib/ir/core/fromJcamp.d.ts.map +1 -0
- package/lib/ir/core/fromJcamp.js +48 -0
- package/lib/ir/core/fromJcamp.js.map +1 -0
- package/lib/ir/core/fromSpc.d.ts +30 -0
- package/lib/ir/core/fromSpc.d.ts.map +1 -0
- package/lib/ir/core/fromSpc.js +40 -0
- package/lib/ir/core/fromSpc.js.map +1 -0
- package/lib/ir/core/index.d.ts +51 -0
- package/lib/ir/core/index.d.ts.map +1 -0
- package/lib/ir/core/index.js +35 -0
- package/lib/ir/core/index.js.map +1 -0
- package/lib/ir/core/irBand.d.ts +45 -0
- package/lib/ir/core/irBand.d.ts.map +1 -0
- package/lib/ir/core/irBand.js +30 -0
- package/lib/ir/core/irBand.js.map +1 -0
- package/lib/ir/core/irCommands.d.ts +168 -0
- package/lib/ir/core/irCommands.d.ts.map +1 -0
- package/lib/ir/core/irCommands.js +94 -0
- package/lib/ir/core/irCommands.js.map +1 -0
- package/lib/ir/core/irDomain.d.ts +63 -0
- package/lib/ir/core/irDomain.d.ts.map +1 -0
- package/lib/ir/core/irDomain.js +136 -0
- package/lib/ir/core/irDomain.js.map +1 -0
- package/lib/ir/core/irEditorApi.d.ts +42 -0
- package/lib/ir/core/irEditorApi.d.ts.map +1 -0
- package/lib/ir/core/irEditorApi.js +10 -0
- package/lib/ir/core/irEditorApi.js.map +1 -0
- package/lib/ir/core/irFormat.d.ts +42 -0
- package/lib/ir/core/irFormat.d.ts.map +1 -0
- package/lib/ir/core/irFormat.js +51 -0
- package/lib/ir/core/irFormat.js.map +1 -0
- package/lib/ir/core/irMode.d.ts +160 -0
- package/lib/ir/core/irMode.d.ts.map +1 -0
- package/lib/ir/core/irMode.js +175 -0
- package/lib/ir/core/irMode.js.map +1 -0
- package/lib/ir/core/irReducer.d.ts +101 -0
- package/lib/ir/core/irReducer.d.ts.map +1 -0
- package/lib/ir/core/irReducer.js +207 -0
- package/lib/ir/core/irReducer.js.map +1 -0
- package/lib/ir/core/irSidePanels.d.ts +22 -0
- package/lib/ir/core/irSidePanels.d.ts.map +1 -0
- package/lib/ir/core/irSidePanels.js +12 -0
- package/lib/ir/core/irSidePanels.js.map +1 -0
- package/lib/ir/core/irSpectrum.d.ts +140 -0
- package/lib/ir/core/irSpectrum.d.ts.map +1 -0
- package/lib/ir/core/irSpectrum.js +34 -0
- package/lib/ir/core/irSpectrum.js.map +1 -0
- package/lib/ir/core/irState.d.ts +119 -0
- package/lib/ir/core/irState.d.ts.map +1 -0
- package/lib/ir/core/irState.js +92 -0
- package/lib/ir/core/irState.js.map +1 -0
- package/lib/ir/core/loadIrSpectra.d.ts +36 -0
- package/lib/ir/core/loadIrSpectra.d.ts.map +1 -0
- package/lib/ir/core/loadIrSpectra.js +44 -0
- package/lib/ir/core/loadIrSpectra.js.map +1 -0
- package/lib/ir/core/nearestBand.d.ts +35 -0
- package/lib/ir/core/nearestBand.d.ts.map +1 -0
- package/lib/ir/core/nearestBand.js +47 -0
- package/lib/ir/core/nearestBand.js.map +1 -0
- package/lib/ir/core/pickBands.d.ts +70 -0
- package/lib/ir/core/pickBands.d.ts.map +1 -0
- package/lib/ir/core/pickBands.js +125 -0
- package/lib/ir/core/pickBands.js.map +1 -0
- package/lib/ir/core/spectrumJcamp.d.ts +58 -0
- package/lib/ir/core/spectrumJcamp.d.ts.map +1 -0
- package/lib/ir/core/spectrumJcamp.js +156 -0
- package/lib/ir/core/spectrumJcamp.js.map +1 -0
- package/lib/ir/core/toIrSpectrum.d.ts +59 -0
- package/lib/ir/core/toIrSpectrum.d.ts.map +1 -0
- package/lib/ir/core/toIrSpectrum.js +56 -0
- package/lib/ir/core/toIrSpectrum.js.map +1 -0
- package/lib/ir/ui/BandMarks.d.ts +52 -0
- package/lib/ir/ui/BandMarks.d.ts.map +1 -0
- package/lib/ir/ui/BandMarks.js +71 -0
- package/lib/ir/ui/BandMarks.js.map +1 -0
- package/lib/ir/ui/BandsPanel.d.ts +31 -0
- package/lib/ir/ui/BandsPanel.d.ts.map +1 -0
- package/lib/ir/ui/BandsPanel.js +94 -0
- package/lib/ir/ui/BandsPanel.js.map +1 -0
- package/lib/ir/ui/IrAboutDialog.d.ts +18 -0
- package/lib/ir/ui/IrAboutDialog.d.ts.map +1 -0
- package/lib/ir/ui/IrAboutDialog.js +32 -0
- package/lib/ir/ui/IrAboutDialog.js.map +1 -0
- package/lib/ir/ui/IrCanvas.d.ts +38 -0
- package/lib/ir/ui/IrCanvas.d.ts.map +1 -0
- package/lib/ir/ui/IrCanvas.js +41 -0
- package/lib/ir/ui/IrCanvas.js.map +1 -0
- package/lib/ir/ui/IrChart.d.ts +28 -0
- package/lib/ir/ui/IrChart.d.ts.map +1 -0
- package/lib/ir/ui/IrChart.js +114 -0
- package/lib/ir/ui/IrChart.js.map +1 -0
- package/lib/ir/ui/IrCommandProvider.d.ts +15 -0
- package/lib/ir/ui/IrCommandProvider.d.ts.map +1 -0
- package/lib/ir/ui/IrCommandProvider.js +14 -0
- package/lib/ir/ui/IrCommandProvider.js.map +1 -0
- package/lib/ir/ui/IrCommandTooltip.d.ts +16 -0
- package/lib/ir/ui/IrCommandTooltip.d.ts.map +1 -0
- package/lib/ir/ui/IrCommandTooltip.js +22 -0
- package/lib/ir/ui/IrCommandTooltip.js.map +1 -0
- package/lib/ir/ui/IrDocumentationDialog.d.ts +18 -0
- package/lib/ir/ui/IrDocumentationDialog.d.ts.map +1 -0
- package/lib/ir/ui/IrDocumentationDialog.js +68 -0
- package/lib/ir/ui/IrDocumentationDialog.js.map +1 -0
- package/lib/ir/ui/IrEditor.d.ts +60 -0
- package/lib/ir/ui/IrEditor.d.ts.map +1 -0
- package/lib/ir/ui/IrEditor.js +42 -0
- package/lib/ir/ui/IrEditor.js.map +1 -0
- package/lib/ir/ui/IrHeader.d.ts +13 -0
- package/lib/ir/ui/IrHeader.d.ts.map +1 -0
- package/lib/ir/ui/IrHeader.js +21 -0
- package/lib/ir/ui/IrHeader.js.map +1 -0
- package/lib/ir/ui/IrLogo.d.ts +20 -0
- package/lib/ir/ui/IrLogo.d.ts.map +1 -0
- package/lib/ir/ui/IrLogo.js +17 -0
- package/lib/ir/ui/IrLogo.js.map +1 -0
- package/lib/ir/ui/IrPointerTracker.d.ts +29 -0
- package/lib/ir/ui/IrPointerTracker.d.ts.map +1 -0
- package/lib/ir/ui/IrPointerTracker.js +47 -0
- package/lib/ir/ui/IrPointerTracker.js.map +1 -0
- package/lib/ir/ui/IrShell.d.ts +25 -0
- package/lib/ir/ui/IrShell.d.ts.map +1 -0
- package/lib/ir/ui/IrShell.js +178 -0
- package/lib/ir/ui/IrShell.js.map +1 -0
- package/lib/ir/ui/IrSidePanel.d.ts +26 -0
- package/lib/ir/ui/IrSidePanel.d.ts.map +1 -0
- package/lib/ir/ui/IrSidePanel.js +39 -0
- package/lib/ir/ui/IrSidePanel.js.map +1 -0
- package/lib/ir/ui/IrStateProvider.d.ts +19 -0
- package/lib/ir/ui/IrStateProvider.d.ts.map +1 -0
- package/lib/ir/ui/IrStateProvider.js +16 -0
- package/lib/ir/ui/IrStateProvider.js.map +1 -0
- package/lib/ir/ui/IrStatusBar.d.ts +14 -0
- package/lib/ir/ui/IrStatusBar.d.ts.map +1 -0
- package/lib/ir/ui/IrStatusBar.js +48 -0
- package/lib/ir/ui/IrStatusBar.js.map +1 -0
- package/lib/ir/ui/IrToolbar.d.ts +18 -0
- package/lib/ir/ui/IrToolbar.d.ts.map +1 -0
- package/lib/ir/ui/IrToolbar.js +32 -0
- package/lib/ir/ui/IrToolbar.js.map +1 -0
- package/lib/ir/ui/IrTraces.d.ts +63 -0
- package/lib/ir/ui/IrTraces.d.ts.map +1 -0
- package/lib/ir/ui/IrTraces.js +72 -0
- package/lib/ir/ui/IrTraces.js.map +1 -0
- package/lib/ir/ui/MetadataPanel.d.ts +15 -0
- package/lib/ir/ui/MetadataPanel.d.ts.map +1 -0
- package/lib/ir/ui/MetadataPanel.js +49 -0
- package/lib/ir/ui/MetadataPanel.js.map +1 -0
- package/lib/ir/ui/SpectraPanel.d.ts +20 -0
- package/lib/ir/ui/SpectraPanel.d.ts.map +1 -0
- package/lib/ir/ui/SpectraPanel.js +42 -0
- package/lib/ir/ui/SpectraPanel.js.map +1 -0
- package/lib/ir/ui/SpectrumRow.d.ts +26 -0
- package/lib/ir/ui/SpectrumRow.d.ts.map +1 -0
- package/lib/ir/ui/SpectrumRow.js +41 -0
- package/lib/ir/ui/SpectrumRow.js.map +1 -0
- package/lib/ir/ui/index.d.ts +56 -0
- package/lib/ir/ui/index.d.ts.map +1 -0
- package/lib/ir/ui/index.js +36 -0
- package/lib/ir/ui/index.js.map +1 -0
- package/lib/ir/ui/irActions.d.ts +52 -0
- package/lib/ir/ui/irActions.d.ts.map +1 -0
- package/lib/ir/ui/irActions.js +62 -0
- package/lib/ir/ui/irActions.js.map +1 -0
- package/lib/ir/ui/irChartProps.d.ts +116 -0
- package/lib/ir/ui/irChartProps.d.ts.map +1 -0
- package/lib/ir/ui/irChartProps.js +14 -0
- package/lib/ir/ui/irChartProps.js.map +1 -0
- package/lib/ir/ui/irCommandContext.d.ts +35 -0
- package/lib/ir/ui/irCommandContext.d.ts.map +1 -0
- package/lib/ir/ui/irCommandContext.js +44 -0
- package/lib/ir/ui/irCommandContext.js.map +1 -0
- package/lib/ir/ui/irStateContext.d.ts +26 -0
- package/lib/ir/ui/irStateContext.d.ts.map +1 -0
- package/lib/ir/ui/irStateContext.js +37 -0
- package/lib/ir/ui/irStateContext.js.map +1 -0
- package/lib/ir/ui/useIrEditor.d.ts +51 -0
- package/lib/ir/ui/useIrEditor.d.ts.map +1 -0
- package/lib/ir/ui/useIrEditor.js +88 -0
- package/lib/ir/ui/useIrEditor.js.map +1 -0
- package/lib/ir/ui/useIrPointer.d.ts +66 -0
- package/lib/ir/ui/useIrPointer.d.ts.map +1 -0
- package/lib/ir/ui/useIrPointer.js +53 -0
- package/lib/ir/ui/useIrPointer.js.map +1 -0
- package/lib/ir/ui/useIrShortcuts.d.ts +24 -0
- package/lib/ir/ui/useIrShortcuts.d.ts.map +1 -0
- package/lib/ir/ui/useIrShortcuts.js +73 -0
- package/lib/ir/ui/useIrShortcuts.js.map +1 -0
- package/lib/ir/ui/useIrZoom.d.ts +51 -0
- package/lib/ir/ui/useIrZoom.d.ts.map +1 -0
- package/lib/ir/ui/useIrZoom.js +46 -0
- package/lib/ir/ui/useIrZoom.js.map +1 -0
- package/lib/ir.d.ts +13 -0
- package/lib/ir.d.ts.map +1 -0
- package/lib/ir.js +13 -0
- package/lib/ir.js.map +1 -0
- package/lib/panel/core/dialogStyles.d.ts +13 -0
- package/lib/panel/core/dialogStyles.d.ts.map +1 -0
- package/lib/panel/core/dialogStyles.js +11 -0
- package/lib/panel/core/dialogStyles.js.map +1 -0
- package/lib/panel/core/index.d.ts +19 -0
- package/lib/panel/core/index.d.ts.map +1 -0
- package/lib/panel/core/index.js +18 -0
- package/lib/panel/core/index.js.map +1 -0
- package/lib/panel/core/isEditingField.d.ts +17 -0
- package/lib/panel/core/isEditingField.d.ts.map +1 -0
- package/lib/panel/core/isEditingField.js +25 -0
- package/lib/panel/core/isEditingField.js.map +1 -0
- package/lib/panel/core/panelStyles.d.ts +242 -0
- package/lib/panel/core/panelStyles.d.ts.map +1 -0
- package/lib/panel/core/panelStyles.js +228 -0
- package/lib/panel/core/panelStyles.js.map +1 -0
- package/lib/panel/core/rowSpacers.d.ts +38 -0
- package/lib/panel/core/rowSpacers.d.ts.map +1 -0
- package/lib/panel/core/rowSpacers.js +31 -0
- package/lib/panel/core/rowSpacers.js.map +1 -0
- package/lib/panel/core/statusBar.d.ts +44 -0
- package/lib/panel/core/statusBar.d.ts.map +1 -0
- package/lib/panel/core/statusBar.js +40 -0
- package/lib/panel/core/statusBar.js.map +1 -0
- package/lib/panel/core/textFilter.d.ts +22 -0
- package/lib/panel/core/textFilter.d.ts.map +1 -0
- package/lib/panel/core/textFilter.js +32 -0
- package/lib/panel/core/textFilter.js.map +1 -0
- package/lib/panel/core/yieldToPainting.d.ts +17 -0
- package/lib/panel/core/yieldToPainting.d.ts.map +1 -0
- package/lib/panel/core/yieldToPainting.js +21 -0
- package/lib/panel/core/yieldToPainting.js.map +1 -0
- package/lib/panel/ui/AboutDialogFrame.d.ts +36 -0
- package/lib/panel/ui/AboutDialogFrame.d.ts.map +1 -0
- package/lib/panel/ui/AboutDialogFrame.js +43 -0
- package/lib/panel/ui/AboutDialogFrame.js.map +1 -0
- package/lib/panel/ui/ClearButton.d.ts +28 -0
- package/lib/panel/ui/ClearButton.d.ts.map +1 -0
- package/lib/panel/ui/ClearButton.js +23 -0
- package/lib/panel/ui/ClearButton.js.map +1 -0
- package/lib/panel/ui/DocumentationDialogFrame.d.ts +39 -0
- package/lib/panel/ui/DocumentationDialogFrame.d.ts.map +1 -0
- package/lib/panel/ui/DocumentationDialogFrame.js +29 -0
- package/lib/panel/ui/DocumentationDialogFrame.js.map +1 -0
- package/lib/panel/ui/FilterInput.d.ts +31 -0
- package/lib/panel/ui/FilterInput.d.ts.map +1 -0
- package/lib/panel/ui/FilterInput.js +23 -0
- package/lib/panel/ui/FilterInput.js.map +1 -0
- package/lib/panel/ui/HelpLabel.d.ts +24 -0
- package/lib/panel/ui/HelpLabel.d.ts.map +1 -0
- package/lib/panel/ui/HelpLabel.js +23 -0
- package/lib/panel/ui/HelpLabel.js.map +1 -0
- package/lib/panel/ui/PanelMessage.d.ts +41 -0
- package/lib/panel/ui/PanelMessage.d.ts.map +1 -0
- package/lib/panel/ui/PanelMessage.js +30 -0
- package/lib/panel/ui/PanelMessage.js.map +1 -0
- package/lib/panel/ui/PanelRail.d.ts +41 -0
- package/lib/panel/ui/PanelRail.d.ts.map +1 -0
- package/lib/panel/ui/PanelRail.js +12 -0
- package/lib/panel/ui/PanelRail.js.map +1 -0
- package/lib/panel/ui/Section.d.ts +25 -0
- package/lib/panel/ui/Section.d.ts.map +1 -0
- package/lib/panel/ui/Section.js +41 -0
- package/lib/panel/ui/Section.js.map +1 -0
- package/lib/panel/ui/SidePanelStack.d.ts +62 -0
- package/lib/panel/ui/SidePanelStack.d.ts.map +1 -0
- package/lib/panel/ui/SidePanelStack.js +40 -0
- package/lib/panel/ui/SidePanelStack.js.map +1 -0
- package/lib/panel/ui/SpectrumColorSwatch.d.ts +33 -0
- package/lib/panel/ui/SpectrumColorSwatch.d.ts.map +1 -0
- package/lib/panel/ui/SpectrumColorSwatch.js +76 -0
- package/lib/panel/ui/SpectrumColorSwatch.js.map +1 -0
- package/lib/panel/ui/index.d.ts +37 -0
- package/lib/panel/ui/index.d.ts.map +1 -0
- package/lib/panel/ui/index.js +24 -0
- package/lib/panel/ui/index.js.map +1 -0
- package/lib/panel/ui/useConfirmOnEnter.d.ts +19 -0
- package/lib/panel/ui/useConfirmOnEnter.d.ts.map +1 -0
- package/lib/panel/ui/useConfirmOnEnter.js +64 -0
- package/lib/panel/ui/useConfirmOnEnter.js.map +1 -0
- package/lib/panel/ui/useFilterBox.d.ts +23 -0
- package/lib/panel/ui/useFilterBox.d.ts.map +1 -0
- package/lib/panel/ui/useFilterBox.js +22 -0
- package/lib/panel/ui/useFilterBox.js.map +1 -0
- package/lib/panel/ui/useVirtualRows.d.ts +46 -0
- package/lib/panel/ui/useVirtualRows.d.ts.map +1 -0
- package/lib/panel/ui/useVirtualRows.js +56 -0
- package/lib/panel/ui/useVirtualRows.js.map +1 -0
- package/lib/panel/ui/useVirtualWindowRows.d.ts +40 -0
- package/lib/panel/ui/useVirtualWindowRows.d.ts.map +1 -0
- package/lib/panel/ui/useVirtualWindowRows.js +65 -0
- package/lib/panel/ui/useVirtualWindowRows.js.map +1 -0
- package/lib/ui.d.ts +1 -0
- package/lib/ui.d.ts.map +1 -1
- package/lib/ui.js +1 -0
- package/lib/ui.js.map +1 -1
- package/package.json +8 -1
- package/src/chart/core/axisLabels.ts +117 -0
- package/src/chart/core/boxLayout.ts +126 -0
- package/src/chart/core/chartAxisScale.ts +92 -10
- package/src/chart/core/chartDomain.ts +185 -0
- package/src/chart/core/chartGeometry.ts +159 -0
- package/src/chart/core/chartPane.ts +10 -0
- package/src/chart/core/chartScale.ts +7 -4
- package/src/chart/core/chartTheme.ts +161 -0
- package/src/chart/core/chartViewport.ts +40 -13
- package/src/chart/core/guidePlacement.ts +66 -0
- package/src/chart/core/index.ts +121 -2
- package/src/chart/core/labelStack.ts +72 -0
- package/src/chart/core/legendBox.ts +263 -0
- package/src/chart/core/selectionGeometry.ts +68 -0
- package/src/chart/core/spectrumColor.ts +129 -0
- package/src/chart/core/stackCapacity.ts +162 -0
- package/src/chart/core/svgPoint.ts +77 -0
- package/src/chart/core/tracePath.ts +228 -0
- package/src/chart/core/trackerReadout.ts +78 -0
- package/src/chart/core/viewTransform.ts +287 -0
- package/src/chart/core/zoomDomain.ts +235 -0
- package/src/chart/ui/Axes.tsx +361 -0
- package/src/chart/ui/AxisGuide.tsx +187 -0
- package/src/chart/ui/ChartStack.tsx +130 -0
- package/src/chart/ui/ChartTracker.tsx +101 -0
- package/src/chart/ui/PlotCaption.tsx +108 -0
- package/src/chart/ui/SelectionRect.tsx +52 -0
- package/src/chart/ui/TraceLegend.tsx +193 -0
- package/src/chart/ui/chartGestures.ts +270 -0
- package/src/chart/ui/chartStackLevel.tsx +210 -0
- package/src/chart/ui/chartSurface.ts +66 -0
- package/src/chart/ui/index.ts +35 -0
- package/src/chart/ui/useChartPointer.ts +223 -0
- package/src/chart/ui/useChartSize.ts +115 -0
- package/src/chart/ui/useChartWindow.ts +240 -0
- package/src/chart/ui/useChartZoom.ts +255 -0
- package/src/chart/ui/useWheelListener.ts +62 -0
- package/src/clipboard/core/copyPng.ts +20 -0
- package/src/clipboard/core/index.ts +1 -0
- package/src/clipboard/ui/CopyableValue.tsx +22 -35
- package/src/core.ts +1 -0
- package/src/download/core/exportStyles.ts +20 -0
- package/src/download/core/imageResolution.ts +118 -0
- package/src/download/core/index.ts +34 -0
- package/src/download/core/pictureExport.ts +207 -0
- package/src/download/core/stackedDrawing.ts +108 -0
- package/src/download/core/svgBounds.ts +80 -0
- package/src/download/core/svgNamespace.ts +9 -0
- package/src/download/core/svgToPng.ts +121 -0
- package/src/download/core/svgToString.ts +95 -0
- package/src/download/ui/ExportDialogFrame.tsx +86 -0
- package/src/download/ui/ExportImageDialog.tsx +91 -0
- package/src/download/ui/ExportNameField.tsx +148 -0
- package/src/download/ui/ExportPictureSection.tsx +142 -0
- package/src/download/ui/index.ts +11 -0
- package/src/download/ui/useDrawingBox.ts +37 -0
- package/src/error/core/describeSource.ts +18 -0
- package/src/error/core/index.ts +1 -0
- package/src/help/ui/HelpBody.tsx +41 -2
- package/src/help/ui/index.ts +6 -1
- package/src/ir/core/analysisSpectra.ts +231 -0
- package/src/ir/core/assignBands.ts +144 -0
- package/src/ir/core/bandAssignments.ts +329 -0
- package/src/ir/core/bandLabelPlan.ts +194 -0
- package/src/ir/core/detectIrFormat.ts +139 -0
- package/src/ir/core/downloadSpectra.ts +57 -0
- package/src/ir/core/fromJcamp.ts +70 -0
- package/src/ir/core/fromSpc.ts +61 -0
- package/src/ir/core/index.ts +113 -0
- package/src/ir/core/irBand.ts +57 -0
- package/src/ir/core/irCommands.ts +154 -0
- package/src/ir/core/irDomain.ts +163 -0
- package/src/ir/core/irEditorApi.ts +44 -0
- package/src/ir/core/irFormat.ts +57 -0
- package/src/ir/core/irMode.ts +203 -0
- package/src/ir/core/irReducer.ts +273 -0
- package/src/ir/core/irSidePanels.ts +20 -0
- package/src/ir/core/irSpectrum.ts +155 -0
- package/src/ir/core/irState.ts +173 -0
- package/src/ir/core/loadIrSpectra.ts +79 -0
- package/src/ir/core/nearestBand.ts +57 -0
- package/src/ir/core/pickBands.ts +181 -0
- package/src/ir/core/spectrumJcamp.ts +178 -0
- package/src/ir/core/toIrSpectrum.ts +102 -0
- package/src/ir/ui/BandMarks.tsx +166 -0
- package/src/ir/ui/BandsPanel.tsx +271 -0
- package/src/ir/ui/IrAboutDialog.tsx +121 -0
- package/src/ir/ui/IrCanvas.tsx +91 -0
- package/src/ir/ui/IrChart.tsx +215 -0
- package/src/ir/ui/IrCommandProvider.tsx +32 -0
- package/src/ir/ui/IrCommandTooltip.tsx +36 -0
- package/src/ir/ui/IrDocumentationDialog.tsx +174 -0
- package/src/ir/ui/IrEditor.tsx +99 -0
- package/src/ir/ui/IrHeader.tsx +39 -0
- package/src/ir/ui/IrLogo.tsx +49 -0
- package/src/ir/ui/IrPointerTracker.tsx +102 -0
- package/src/ir/ui/IrShell.tsx +285 -0
- package/src/ir/ui/IrSidePanel.tsx +78 -0
- package/src/ir/ui/IrStateProvider.tsx +32 -0
- package/src/ir/ui/IrStatusBar.tsx +97 -0
- package/src/ir/ui/IrToolbar.tsx +102 -0
- package/src/ir/ui/IrTraces.tsx +134 -0
- package/src/ir/ui/MetadataPanel.tsx +88 -0
- package/src/ir/ui/SpectraPanel.tsx +114 -0
- package/src/ir/ui/SpectrumRow.tsx +127 -0
- package/src/ir/ui/index.ts +56 -0
- package/src/ir/ui/irActions.ts +103 -0
- package/src/ir/ui/irChartProps.ts +118 -0
- package/src/ir/ui/irCommandContext.tsx +62 -0
- package/src/ir/ui/irStateContext.ts +48 -0
- package/src/ir/ui/useIrEditor.ts +139 -0
- package/src/ir/ui/useIrPointer.ts +109 -0
- package/src/ir/ui/useIrShortcuts.ts +95 -0
- package/src/ir/ui/useIrZoom.ts +86 -0
- package/src/ir.ts +13 -0
- package/src/panel/core/dialogStyles.ts +11 -0
- package/src/panel/core/index.ts +47 -0
- package/src/panel/core/isEditingField.ts +23 -0
- package/src/panel/core/panelStyles.ts +248 -0
- package/src/panel/core/rowSpacers.ts +50 -0
- package/src/panel/core/statusBar.ts +48 -0
- package/src/panel/core/textFilter.ts +33 -0
- package/src/panel/core/yieldToPainting.ts +20 -0
- package/src/panel/ui/AboutDialogFrame.tsx +100 -0
- package/src/panel/ui/ClearButton.tsx +42 -0
- package/src/panel/ui/DocumentationDialogFrame.tsx +86 -0
- package/src/panel/ui/FilterInput.tsx +60 -0
- package/src/panel/ui/HelpLabel.tsx +43 -0
- package/src/panel/ui/PanelMessage.tsx +64 -0
- package/src/panel/ui/PanelRail.tsx +64 -0
- package/src/panel/ui/Section.tsx +66 -0
- package/src/panel/ui/SidePanelStack.tsx +109 -0
- package/src/panel/ui/SpectrumColorSwatch.tsx +119 -0
- package/src/panel/ui/index.ts +47 -0
- package/src/panel/ui/useConfirmOnEnter.ts +68 -0
- package/src/panel/ui/useFilterBox.ts +35 -0
- package/src/panel/ui/useVirtualRows.ts +82 -0
- package/src/panel/ui/useVirtualWindowRows.ts +86 -0
- package/src/ui.ts +1 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One viewer's state, and everything derived from it.
|
|
3
|
+
*
|
|
4
|
+
* The bands are derived here rather than held, and that is the one structural
|
|
5
|
+
* decision in this file. Picking is a pure function of a spectrum and the
|
|
6
|
+
* picking settings, so a band held in state would be an answer that has to be
|
|
7
|
+
* invalidated by hand every time either changes — and the version that is wrong
|
|
8
|
+
* is the one drawn on the chart. Derived, a stale band cannot exist.
|
|
9
|
+
*
|
|
10
|
+
* It is memoised on the selected spectrum rather than on all of them: picking
|
|
11
|
+
* runs a peak detection over a few thousand points, and doing it for six loaded
|
|
12
|
+
* spectra when the panels only ever show one would cost six times what it needs
|
|
13
|
+
* to on every change of a threshold.
|
|
14
|
+
*/
|
|
15
|
+
import { useEffect, useMemo, useReducer, useRef } from 'react';
|
|
16
|
+
import { assignBands } from "../core/assignBands.js";
|
|
17
|
+
import { createIrState, irReducer } from "../core/irReducer.js";
|
|
18
|
+
import { pickBands } from "../core/pickBands.js";
|
|
19
|
+
import { createIrActions } from "./irActions.js";
|
|
20
|
+
/**
|
|
21
|
+
* Hold one viewer's state.
|
|
22
|
+
* @param options - What it opens on.
|
|
23
|
+
* @returns The state, what follows from it, and everything to do.
|
|
24
|
+
*/
|
|
25
|
+
export function useIrEditor(options = {}) {
|
|
26
|
+
const { onChange, ...initial } = options;
|
|
27
|
+
const [state, dispatch] = useReducer(irReducer, initial, createIrState);
|
|
28
|
+
const actions = useMemo(() => createIrActions(dispatch), [dispatch]);
|
|
29
|
+
const { spectra } = state.data;
|
|
30
|
+
const { selectedId } = state.view;
|
|
31
|
+
const { pickBands: picking, picking: pickingOptions } = state.settings;
|
|
32
|
+
const { assignmentTolerance } = state.settings;
|
|
33
|
+
const visibleSpectra = useMemo(() => {
|
|
34
|
+
const visible = [];
|
|
35
|
+
for (const spectrum of spectra) {
|
|
36
|
+
if (spectrum.visible)
|
|
37
|
+
visible.push(spectrum);
|
|
38
|
+
}
|
|
39
|
+
return visible;
|
|
40
|
+
}, [spectra]);
|
|
41
|
+
const selectedSpectrum = useMemo(() => {
|
|
42
|
+
if (selectedId === null)
|
|
43
|
+
return null;
|
|
44
|
+
for (const spectrum of spectra) {
|
|
45
|
+
if (spectrum.id === selectedId)
|
|
46
|
+
return spectrum;
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}, [spectra, selectedId]);
|
|
50
|
+
const bands = useMemo(() => selectedSpectrum === null || !picking
|
|
51
|
+
? []
|
|
52
|
+
: pickBands(selectedSpectrum, pickingOptions), [selectedSpectrum, picking, pickingOptions]);
|
|
53
|
+
// Assigning is a walk of thirty ranges per band, which is nothing beside the
|
|
54
|
+
// picking — so it is a memo of its own, and moving the tolerance does not
|
|
55
|
+
// re-pick.
|
|
56
|
+
const assigned = useMemo(() => assignBands(bands, { tolerance: assignmentTolerance }), [bands, assignmentTolerance]);
|
|
57
|
+
// What was reported last, so a host passing a fresh callback on every render
|
|
58
|
+
// is not told about spectra that did not change. The identities are compared
|
|
59
|
+
// rather than the array: every edit replaces it, including the ones that only
|
|
60
|
+
// change how a spectrum is drawn.
|
|
61
|
+
const reported = useRef(spectra);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (sameSpectra(reported.current, spectra))
|
|
64
|
+
return;
|
|
65
|
+
reported.current = spectra;
|
|
66
|
+
onChange?.(spectra);
|
|
67
|
+
}, [spectra, onChange]);
|
|
68
|
+
return useMemo(() => ({ state, visibleSpectra, selectedSpectrum, assigned, actions }), [state, visibleSpectra, selectedSpectrum, assigned, actions]);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Whether two lists hold the same spectra, by identity and in order.
|
|
72
|
+
* @param current - What was reported last.
|
|
73
|
+
* @param next - What is open now.
|
|
74
|
+
* @returns Whether the report can be skipped.
|
|
75
|
+
*/
|
|
76
|
+
function sameSpectra(current, next) {
|
|
77
|
+
if (current === next)
|
|
78
|
+
return true;
|
|
79
|
+
if (current.length !== next.length)
|
|
80
|
+
return false;
|
|
81
|
+
for (let index = 0; index < current.length; index++) {
|
|
82
|
+
if (current[index].id !== next[index].id) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=useIrEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIrEditor.js","sourceRoot":"","sources":["../../../src/ir/ui/useIrEditor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGhE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AA6BjD;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,UAA8B,EAAE;IAC1D,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,GAAG,OAAO,CAAC;IAEzC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,SAAS,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;IACxE,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAErE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;IAC/B,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;IAClC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC;IACvE,MAAM,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC;IAE/C,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,EAAE;QAClC,MAAM,OAAO,GAAiB,EAAE,CAAC;QACjC,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;YAC/B,IAAI,QAAQ,CAAC,OAAO;gBAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,EAAE;QACpC,IAAI,UAAU,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QACrC,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;YAC/B,IAAI,QAAQ,CAAC,EAAE,KAAK,UAAU;gBAAE,OAAO,QAAQ,CAAC;QAClD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;IAE1B,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CACH,gBAAgB,KAAK,IAAI,IAAI,CAAC,OAAO;QACnC,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,SAAS,CAAC,gBAAgB,EAAE,cAAc,CAAC,EACjD,CAAC,gBAAgB,EAAE,OAAO,EAAE,cAAc,CAAC,CAC5C,CAAC;IAEF,6EAA6E;IAC7E,0EAA0E;IAC1E,WAAW;IACX,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,EAC5D,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAC7B,CAAC;IAEF,6EAA6E;IAC7E,6EAA6E;IAC7E,8EAA8E;IAC9E,kCAAkC;IAClC,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,EAAE,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EACtE,CAAC,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,CAAC,CAC7D,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAClB,OAA8B,EAC9B,IAA2B;IAE3B,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,IAAK,OAAO,CAAC,KAAK,CAAgB,CAAC,EAAE,KAAM,IAAI,CAAC,KAAK,CAAgB,CAAC,EAAE,EAAE,CAAC;YACzE,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an infrared chart reads under the pointer, and which band it is asking
|
|
3
|
+
* about.
|
|
4
|
+
*
|
|
5
|
+
* Following the pointer at all is `useChartPointer` in the shared chart.
|
|
6
|
+
* What it *reads* there is the part that is about infrared, and is the whole of
|
|
7
|
+
* this file — the wavenumber, the value in whichever axis is drawn, and the band
|
|
8
|
+
* within reach.
|
|
9
|
+
*/
|
|
10
|
+
import type { RefObject } from 'react';
|
|
11
|
+
import type { PlotRect } from '../../chart/core/chartGeometry.ts';
|
|
12
|
+
import type { ChartScale } from '../../chart/core/chartScale.ts';
|
|
13
|
+
import type { ChartPointer } from '../../chart/ui/useChartPointer.ts';
|
|
14
|
+
import type { IrBand } from '../core/irBand.ts';
|
|
15
|
+
import type { IrMode } from '../core/irSpectrum.ts';
|
|
16
|
+
/** What the axes say under the pointer, which is what a readout prints. */
|
|
17
|
+
export interface IrReadout {
|
|
18
|
+
/** What the wavenumber axis reads there, in cm⁻¹. */
|
|
19
|
+
wavenumber: number;
|
|
20
|
+
/** What the value axis reads there, in whichever mode is drawn. */
|
|
21
|
+
value: number;
|
|
22
|
+
/** Which axis that value is in, so a readout can label it. */
|
|
23
|
+
mode: IrMode;
|
|
24
|
+
/** The band within reach of the pointer, `null` when none is. */
|
|
25
|
+
band: IrBand | null;
|
|
26
|
+
}
|
|
27
|
+
export interface IrPointerOptions {
|
|
28
|
+
/** The SVG the chart is drawn on, as it was handed to its `ref`. */
|
|
29
|
+
svgRef: RefObject<SVGSVGElement | null>;
|
|
30
|
+
/** Where the plot sits inside that SVG. */
|
|
31
|
+
plot: PlotRect;
|
|
32
|
+
/** The wavenumber axis as it is currently zoomed, running right to left. */
|
|
33
|
+
xScale: ChartScale;
|
|
34
|
+
/** The value axis as it is currently zoomed. */
|
|
35
|
+
yScale: ChartScale;
|
|
36
|
+
/** Which value axis is being drawn. */
|
|
37
|
+
mode: IrMode;
|
|
38
|
+
/** The bands of every drawn spectrum, for the one under the pointer. */
|
|
39
|
+
bands: readonly IrBand[];
|
|
40
|
+
/**
|
|
41
|
+
* Told which band the pointer has come to rest on, and told `null` when it
|
|
42
|
+
* leaves one — called only when the answer changes, so it is safe to hang a
|
|
43
|
+
* highlight that redraws half the page on it.
|
|
44
|
+
* @default undefined
|
|
45
|
+
*/
|
|
46
|
+
onBand?: (band: IrBand | null) => void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Follow the pointer over an infrared chart.
|
|
50
|
+
* @param options - The chart, its axes and the bands it is showing.
|
|
51
|
+
* @returns Where the pointer is and what it reads, both `null` while it is
|
|
52
|
+
* anywhere but over the plot.
|
|
53
|
+
*/
|
|
54
|
+
export declare function useIrPointer(options: IrPointerOptions): ChartPointer<IrReadout>;
|
|
55
|
+
/**
|
|
56
|
+
* Whether two readings are about the same band.
|
|
57
|
+
*
|
|
58
|
+
* The band alone, and never the wavenumber under the crosshair: that fractional
|
|
59
|
+
* value changes on every pixel the pointer moves, and comparing it would report a
|
|
60
|
+
* new answer for every tremor of a hand resting on one band.
|
|
61
|
+
* @param current - What was last read.
|
|
62
|
+
* @param next - What has just been read.
|
|
63
|
+
* @returns Whether both are about the same band.
|
|
64
|
+
*/
|
|
65
|
+
export declare function sameIrReadout(current: IrReadout, next: IrReadout): boolean;
|
|
66
|
+
//# sourceMappingURL=useIrPointer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIrPointer.d.ts","sourceRoot":"","sources":["../../../src/ir/ui/useIrPointer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;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,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD,2EAA2E;AAC3E,MAAM,WAAW,SAAS;IACxB,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,oEAAoE;IACpE,MAAM,EAAE,SAAS,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IACxC,2CAA2C;IAC3C,IAAI,EAAE,QAAQ,CAAC;IACf,4EAA4E;IAC5E,MAAM,EAAE,UAAU,CAAC;IACnB,gDAAgD;IAChD,MAAM,EAAE,UAAU,CAAC;IACnB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,gBAAgB,GACxB,YAAY,CAAC,SAAS,CAAC,CA4BzB;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAE1E"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an infrared chart reads under the pointer, and which band it is asking
|
|
3
|
+
* about.
|
|
4
|
+
*
|
|
5
|
+
* Following the pointer at all is `useChartPointer` in the shared chart.
|
|
6
|
+
* What it *reads* there is the part that is about infrared, and is the whole of
|
|
7
|
+
* this file — the wavenumber, the value in whichever axis is drawn, and the band
|
|
8
|
+
* within reach.
|
|
9
|
+
*/
|
|
10
|
+
import { useCallback, useMemo } from 'react';
|
|
11
|
+
import { chartValue } from "../../chart/core/chartScale.js";
|
|
12
|
+
import { useChartPointer } from "../../chart/ui/useChartPointer.js";
|
|
13
|
+
import { sameIrBand } from "../core/irBand.js";
|
|
14
|
+
import { nearestBandAt } from "../core/nearestBand.js";
|
|
15
|
+
/**
|
|
16
|
+
* Follow the pointer over an infrared chart.
|
|
17
|
+
* @param options - The chart, its axes and the bands it is showing.
|
|
18
|
+
* @returns Where the pointer is and what it reads, both `null` while it is
|
|
19
|
+
* anywhere but over the plot.
|
|
20
|
+
*/
|
|
21
|
+
export function useIrPointer(options) {
|
|
22
|
+
const { svgRef, plot, xScale, yScale, mode, bands, onBand } = options;
|
|
23
|
+
const read = useCallback((point) => ({
|
|
24
|
+
wavenumber: chartValue(xScale, point.x),
|
|
25
|
+
value: chartValue(yScale, point.y),
|
|
26
|
+
mode,
|
|
27
|
+
band: nearestBandAt(bands, xScale, point.x),
|
|
28
|
+
}), [xScale, yScale, mode, bands]);
|
|
29
|
+
const onReadout = useMemo(() => onBand === undefined
|
|
30
|
+
? undefined
|
|
31
|
+
: (readout) => onBand(readout?.band ?? null), [onBand]);
|
|
32
|
+
return useChartPointer({
|
|
33
|
+
svgRef,
|
|
34
|
+
plot,
|
|
35
|
+
read,
|
|
36
|
+
sameReadout: sameIrReadout,
|
|
37
|
+
onReadout,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Whether two readings are about the same band.
|
|
42
|
+
*
|
|
43
|
+
* The band alone, and never the wavenumber under the crosshair: that fractional
|
|
44
|
+
* value changes on every pixel the pointer moves, and comparing it would report a
|
|
45
|
+
* new answer for every tremor of a hand resting on one band.
|
|
46
|
+
* @param current - What was last read.
|
|
47
|
+
* @param next - What has just been read.
|
|
48
|
+
* @returns Whether both are about the same band.
|
|
49
|
+
*/
|
|
50
|
+
export function sameIrReadout(current, next) {
|
|
51
|
+
return sameIrBand(current.band, next.band);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=useIrPointer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIrPointer.js","sourceRoot":"","sources":["../../../src/ir/ui/useIrPointer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAI7C,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAG5D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAoCvD;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAyB;IAEzB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEtE,MAAM,IAAI,GAAG,WAAW,CACtB,CAAC,KAAiB,EAAa,EAAE,CAAC,CAAC;QACjC,UAAU,EAAE,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;QACvC,KAAK,EAAE,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;QAClC,IAAI;QACJ,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;KAC5C,CAAC,EACF,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAC9B,CAAC;IAEF,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CACH,MAAM,KAAK,SAAS;QAClB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,CAAC,OAAyB,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,IAAI,IAAI,CAAC,EAClE,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,OAAO,eAAe,CAAC;QACrB,MAAM;QACN,IAAI;QACJ,IAAI;QACJ,WAAW,EAAE,aAAa;QAC1B,SAAS;KACV,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,OAAkB,EAAE,IAAe;IAC/D,OAAO,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The keys, heard on the viewer's own root rather than on the document.
|
|
3
|
+
*
|
|
4
|
+
* On its own root and with `stopPropagation`, which is the deliberate half of a
|
|
5
|
+
* decision the repo has already taken once: two viewers on one page must not both
|
|
6
|
+
* answer `f`, and a page that holds this beside a glycan editor must not have its
|
|
7
|
+
* own keys eaten. So the viewer hears a key only while it holds the caret — the
|
|
8
|
+
* root carries `tabIndex={-1}` so a click anywhere in it does — and a key it
|
|
9
|
+
* acted on goes no further.
|
|
10
|
+
*/
|
|
11
|
+
import type { RefObject } from 'react';
|
|
12
|
+
import type { IrCommandHandlers } from '../core/irCommands.ts';
|
|
13
|
+
/**
|
|
14
|
+
* Fire the viewer's commands from the keyboard.
|
|
15
|
+
*
|
|
16
|
+
* The handlers are read live through a ref rather than closed over, so the
|
|
17
|
+
* listener is attached once for the life of the viewer instead of being torn down
|
|
18
|
+
* and rebuilt on every render — and the chart re-renders on every move of the
|
|
19
|
+
* pointer across it.
|
|
20
|
+
* @param root - The viewer's root, as it was handed to its `ref`.
|
|
21
|
+
* @param handlers - What each command does.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useIrShortcuts(root: RefObject<HTMLElement | null> | HTMLElement | null, handlers: IrCommandHandlers): void;
|
|
24
|
+
//# sourceMappingURL=useIrShortcuts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIrShortcuts.d.ts","sourceRoot":"","sources":["../../../src/ir/ui/useIrShortcuts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,uBAAuB,CAAC;AAG/B;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,WAAW,GAAG,IAAI,EACxD,QAAQ,EAAE,iBAAiB,GAC1B,IAAI,CAoCN"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The keys, heard on the viewer's own root rather than on the document.
|
|
3
|
+
*
|
|
4
|
+
* On its own root and with `stopPropagation`, which is the deliberate half of a
|
|
5
|
+
* decision the repo has already taken once: two viewers on one page must not both
|
|
6
|
+
* answer `f`, and a page that holds this beside a glycan editor must not have its
|
|
7
|
+
* own keys eaten. So the viewer hears a key only while it holds the caret — the
|
|
8
|
+
* root carries `tabIndex={-1}` so a click anywhere in it does — and a key it
|
|
9
|
+
* acted on goes no further.
|
|
10
|
+
*/
|
|
11
|
+
import { useEffect, useLayoutEffect, useRef } from 'react';
|
|
12
|
+
import { isEditingField } from "../../panel/core/isEditingField.js";
|
|
13
|
+
import { irCommands } from "../core/irCommands.js";
|
|
14
|
+
/**
|
|
15
|
+
* Fire the viewer's commands from the keyboard.
|
|
16
|
+
*
|
|
17
|
+
* The handlers are read live through a ref rather than closed over, so the
|
|
18
|
+
* listener is attached once for the life of the viewer instead of being torn down
|
|
19
|
+
* and rebuilt on every render — and the chart re-renders on every move of the
|
|
20
|
+
* pointer across it.
|
|
21
|
+
* @param root - The viewer's root, as it was handed to its `ref`.
|
|
22
|
+
* @param handlers - What each command does.
|
|
23
|
+
*/
|
|
24
|
+
export function useIrShortcuts(root, handlers) {
|
|
25
|
+
const latest = useRef(handlers);
|
|
26
|
+
useLayoutEffect(() => {
|
|
27
|
+
latest.current = handlers;
|
|
28
|
+
});
|
|
29
|
+
const element = root === null || root instanceof HTMLElement ? root : null;
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (element === null)
|
|
32
|
+
return;
|
|
33
|
+
function onKeyDown(event) {
|
|
34
|
+
// A key pressed with a modifier belongs to the browser or to the page:
|
|
35
|
+
// Ctrl+F is a search, and a viewer that swallowed it to fit its chart
|
|
36
|
+
// would be a viewer people stop typing in.
|
|
37
|
+
if (event.ctrlKey || event.metaKey || event.altKey)
|
|
38
|
+
return;
|
|
39
|
+
// Never while a name is being typed into the spectra panel.
|
|
40
|
+
if (isEditingField(event.target))
|
|
41
|
+
return;
|
|
42
|
+
const id = commandFor(event.key);
|
|
43
|
+
if (id === undefined)
|
|
44
|
+
return;
|
|
45
|
+
const handler = latest.current[id];
|
|
46
|
+
if (handler === undefined)
|
|
47
|
+
return;
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
// So the same key does not also reach a viewer mounted beside this one.
|
|
50
|
+
event.stopPropagation();
|
|
51
|
+
handler();
|
|
52
|
+
}
|
|
53
|
+
element.addEventListener('keydown', onKeyDown);
|
|
54
|
+
return () => {
|
|
55
|
+
element.removeEventListener('keydown', onKeyDown);
|
|
56
|
+
};
|
|
57
|
+
}, [element]);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Which command a key runs, if any.
|
|
61
|
+
*
|
|
62
|
+
* Built once from the command table rather than looked up by walking it, and
|
|
63
|
+
* compared case-insensitively so a capital arriving from a held shift still
|
|
64
|
+
* reaches the command a lowercase key names.
|
|
65
|
+
* @param key - The `event.key` that arrived.
|
|
66
|
+
* @returns The command, or `undefined` when the key names none.
|
|
67
|
+
*/
|
|
68
|
+
function commandFor(key) {
|
|
69
|
+
return KEYS.get(key.toLowerCase());
|
|
70
|
+
}
|
|
71
|
+
/** Every key the viewer answers to, against the command it runs. */
|
|
72
|
+
const KEYS = new Map(Object.entries(irCommands).flatMap(([id, command]) => (command.shortcut?.keys ?? []).map((key) => [key.toLowerCase(), id])));
|
|
73
|
+
//# sourceMappingURL=useIrShortcuts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIrShortcuts.js","sourceRoot":"","sources":["../../../src/ir/ui/useIrShortcuts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAMpE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAwD,EACxD,QAA2B;IAE3B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEhC,eAAe,CAAC,GAAG,EAAE;QACnB,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,IAAI,KAAK,IAAI,IAAI,IAAI,YAAY,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAE3E,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,KAAK,IAAI;YAAE,OAAO;QAE7B,SAAS,SAAS,CAAC,KAAoB;YACrC,uEAAuE;YACvE,sEAAsE;YACtE,2CAA2C;YAC3C,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM;gBAAE,OAAO;YAC3D,4DAA4D;YAC5D,IAAI,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC;gBAAE,OAAO;YAEzC,MAAM,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACjC,IAAI,EAAE,KAAK,SAAS;gBAAE,OAAO;YAC7B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACnC,IAAI,OAAO,KAAK,SAAS;gBAAE,OAAO;YAElC,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,wEAAwE;YACxE,KAAK,CAAC,eAAe,EAAE,CAAC;YACxB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAC/C,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACpD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAChB,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,UAAU,CAAC,GAAW;IAC7B,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;AACrC,CAAC;AAED,oEAAoE;AACpE,MAAM,IAAI,GAAG,IAAI,GAAG,CAClB,MAAM,CAAC,OAAO,CAAC,UAAuC,CAAC,CAAC,OAAO,CAC7D,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,CAChB,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAChC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,EAAiB,CAAU,CACzD,CACJ,CACF,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The generic zoom, told what an infrared window is fitted to and how its value
|
|
3
|
+
* axis behaves.
|
|
4
|
+
*
|
|
5
|
+
* Every gesture is `useChartZoom` in the shared chart and none of it is
|
|
6
|
+
* written here. What is about infrared is the three things handed in: the fit,
|
|
7
|
+
* which has to refit when the mode changes because the value axis is replaced
|
|
8
|
+
* rather than nudged; the y axis rules, which are where percent transmittance
|
|
9
|
+
* says that its baseline is 100 and not zero; and which gestures the mode
|
|
10
|
+
* answers at all, which is where it says that a rectangle is the only drag worth
|
|
11
|
+
* making on it and that the wheel belongs to the page.
|
|
12
|
+
*/
|
|
13
|
+
import type { RefObject } from 'react';
|
|
14
|
+
import type { ZoomDragMode } from '../../chart/core/chartDomain.ts';
|
|
15
|
+
import type { PlotRect } from '../../chart/core/chartGeometry.ts';
|
|
16
|
+
import type { ChartZoom } from '../../chart/ui/useChartZoom.ts';
|
|
17
|
+
import type { IrDomain, IrMode, IrSpectrum } from '../core/irSpectrum.ts';
|
|
18
|
+
export interface IrZoomOptions {
|
|
19
|
+
/** Everything the chart holds, which is what the window is fitted to. */
|
|
20
|
+
spectra: readonly IrSpectrum[];
|
|
21
|
+
/** Which value axis is being drawn. */
|
|
22
|
+
mode: IrMode;
|
|
23
|
+
/** The SVG the gestures are made on, as it was handed to its `ref`. */
|
|
24
|
+
svgRef: RefObject<SVGSVGElement | null>;
|
|
25
|
+
/** Where the plot sits inside that SVG, which the axes are laid over. */
|
|
26
|
+
plot: PlotRect;
|
|
27
|
+
/**
|
|
28
|
+
* The window a host is imposing, `null` while it imposes none. Handed straight
|
|
29
|
+
* through; `useChartZoom` documents what imposing one does.
|
|
30
|
+
* @default null
|
|
31
|
+
*/
|
|
32
|
+
domain?: IrDomain | null;
|
|
33
|
+
/**
|
|
34
|
+
* What a drag asks for **where the mode leaves the choice open** — the
|
|
35
|
+
* wavenumber axis, or the rectangle swept out. Percent transmittance takes the
|
|
36
|
+
* rectangle whatever this says; `zoomGestures` is where that is decided.
|
|
37
|
+
* @default 'xAxis'
|
|
38
|
+
*/
|
|
39
|
+
drag?: ZoomDragMode;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Zoom an infrared chart by dragging it, and — reading absorbance — by the wheel.
|
|
43
|
+
*
|
|
44
|
+
* A double click always fits everything again, in either mode: it is the way
|
|
45
|
+
* back from a zoom, and a chart that offers a gesture has to offer the way out
|
|
46
|
+
* of it.
|
|
47
|
+
* @param options - The chart, what it holds and which axis it is read in.
|
|
48
|
+
* @returns The window and the gestures that move it.
|
|
49
|
+
*/
|
|
50
|
+
export declare function useIrZoom(options: IrZoomOptions): ChartZoom;
|
|
51
|
+
//# sourceMappingURL=useIrZoom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIrZoom.d.ts","sourceRoot":"","sources":["../../../src/ir/ui/useIrZoom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAIhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAE1E,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IAC/B,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,MAAM,EAAE,SAAS,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IACxC,yEAAyE;IACzE,IAAI,EAAE,QAAQ,CAAC;IACf;;;;OAIG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACzB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,CA4B3D"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The generic zoom, told what an infrared window is fitted to and how its value
|
|
3
|
+
* axis behaves.
|
|
4
|
+
*
|
|
5
|
+
* Every gesture is `useChartZoom` in the shared chart and none of it is
|
|
6
|
+
* written here. What is about infrared is the three things handed in: the fit,
|
|
7
|
+
* which has to refit when the mode changes because the value axis is replaced
|
|
8
|
+
* rather than nudged; the y axis rules, which are where percent transmittance
|
|
9
|
+
* says that its baseline is 100 and not zero; and which gestures the mode
|
|
10
|
+
* answers at all, which is where it says that a rectangle is the only drag worth
|
|
11
|
+
* making on it and that the wheel belongs to the page.
|
|
12
|
+
*/
|
|
13
|
+
import { useMemo } from 'react';
|
|
14
|
+
import { useChartZoom } from "../../chart/ui/useChartZoom.js";
|
|
15
|
+
import { fittedTo, fullDomain } from "../core/irDomain.js";
|
|
16
|
+
import { yAxisRules, zoomGestures } from "../core/irMode.js";
|
|
17
|
+
/**
|
|
18
|
+
* Zoom an infrared chart by dragging it, and — reading absorbance — by the wheel.
|
|
19
|
+
*
|
|
20
|
+
* A double click always fits everything again, in either mode: it is the way
|
|
21
|
+
* back from a zoom, and a chart that offers a gesture has to offer the way out
|
|
22
|
+
* of it.
|
|
23
|
+
* @param options - The chart, what it holds and which axis it is read in.
|
|
24
|
+
* @returns The window and the gestures that move it.
|
|
25
|
+
*/
|
|
26
|
+
export function useIrZoom(options) {
|
|
27
|
+
const { spectra, mode, svgRef, plot, domain = null, drag = 'xAxis', } = options;
|
|
28
|
+
const fitted = useMemo(() => fullDomain(spectra, mode), [spectra, mode]);
|
|
29
|
+
const fitKey = useMemo(() => fittedTo(spectra, mode), [spectra, mode]);
|
|
30
|
+
const yAxis = useMemo(() => yAxisRules(mode), [mode]);
|
|
31
|
+
const gestures = useMemo(() => zoomGestures(mode, drag), [mode, drag]);
|
|
32
|
+
// `reverseX` is not decoration: the hook measures every gesture by inverting a
|
|
33
|
+
// pixel through the scale it builds, so it has to build the same reversed one
|
|
34
|
+
// the chart draws with.
|
|
35
|
+
return useChartZoom({
|
|
36
|
+
fitted,
|
|
37
|
+
fitKey,
|
|
38
|
+
svgRef,
|
|
39
|
+
plot,
|
|
40
|
+
yAxis,
|
|
41
|
+
domain,
|
|
42
|
+
gestures,
|
|
43
|
+
reverseX: true,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=useIrZoom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIrZoom.js","sourceRoot":"","sources":["../../../src/ir/ui/useIrZoom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAKhC,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AA2B7D;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,OAAsB;IAC9C,MAAM,EACJ,OAAO,EACP,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,MAAM,GAAG,IAAI,EACb,IAAI,GAAG,OAAO,GACf,GAAG,OAAO,CAAC;IAEZ,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IACzE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IACvE,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAEvE,+EAA+E;IAC/E,8EAA8E;IAC9E,wBAAwB;IACxB,OAAO,YAAY,CAAC;QAClB,MAAM;QACN,MAAM;QACN,MAAM;QACN,IAAI;QACJ,KAAK;QACL,MAAM;QACN,QAAQ;QACR,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;AACL,CAAC"}
|
package/lib/ir.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Displaying and assigning infrared spectra: the chart, the band table and the
|
|
3
|
+
* whole editor.
|
|
4
|
+
*
|
|
5
|
+
* A door of its own, and not part of `react-cheminfo/core` or
|
|
6
|
+
* `react-cheminfo/ui`, because reading a spectrum drags the formats it may
|
|
7
|
+
* arrive in — `ir-spectrum` for the band correlations, `convert-to-jcamp` for
|
|
8
|
+
* writing them back out, and a JCAMP or SPC reader fetched only once the bytes
|
|
9
|
+
* turn out to need it. A site with no spectra to look at installs none of it.
|
|
10
|
+
*/
|
|
11
|
+
export * from './ir/core/index.ts';
|
|
12
|
+
export * from './ir/ui/index.ts';
|
|
13
|
+
//# sourceMappingURL=ir.d.ts.map
|
package/lib/ir.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir.d.ts","sourceRoot":"","sources":["../src/ir.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
|
package/lib/ir.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Displaying and assigning infrared spectra: the chart, the band table and the
|
|
3
|
+
* whole editor.
|
|
4
|
+
*
|
|
5
|
+
* A door of its own, and not part of `react-cheminfo/core` or
|
|
6
|
+
* `react-cheminfo/ui`, because reading a spectrum drags the formats it may
|
|
7
|
+
* arrive in — `ir-spectrum` for the band correlations, `convert-to-jcamp` for
|
|
8
|
+
* writing them back out, and a JCAMP or SPC reader fetched only once the bytes
|
|
9
|
+
* turn out to need it. A site with no spectra to look at installs none of it.
|
|
10
|
+
*/
|
|
11
|
+
export * from "./ir/core/index.js";
|
|
12
|
+
export * from "./ir/ui/index.js";
|
|
13
|
+
//# sourceMappingURL=ir.js.map
|
package/lib/ir.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir.js","sourceRoot":"","sources":["../src/ir.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** What a paragraph inside a dialog section looks like. */
|
|
2
|
+
export declare const paragraphStyle: {
|
|
3
|
+
readonly margin: 0;
|
|
4
|
+
};
|
|
5
|
+
/** What a list of things a panel holds looks like. */
|
|
6
|
+
export declare const listStyle: {
|
|
7
|
+
readonly margin: 0;
|
|
8
|
+
readonly paddingLeft: 18;
|
|
9
|
+
readonly display: "flex";
|
|
10
|
+
readonly flexDirection: "column";
|
|
11
|
+
readonly gap: 4;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=dialogStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialogStyles.d.ts","sourceRoot":"","sources":["../../../src/panel/core/dialogStyles.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,eAAO,MAAM,cAAc;;CAAyB,CAAC;AAErD,sDAAsD;AACtD,eAAO,MAAM,SAAS;;;;;;CAMZ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** What a paragraph inside a dialog section looks like. */
|
|
2
|
+
export const paragraphStyle = { margin: 0 };
|
|
3
|
+
/** What a list of things a panel holds looks like. */
|
|
4
|
+
export const listStyle = {
|
|
5
|
+
margin: 0,
|
|
6
|
+
paddingLeft: 18,
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexDirection: 'column',
|
|
9
|
+
gap: 4,
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=dialogStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialogStyles.js","sourceRoot":"","sources":["../../../src/panel/core/dialogStyles.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,MAAM,EAAE,CAAC,EAAW,CAAC;AAErD,sDAAsD;AACtD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,MAAM,EAAE,CAAC;IACT,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,QAAQ;IACvB,GAAG,EAAE,CAAC;CACE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chrome an editor is laid out with, below the components that wear it.
|
|
3
|
+
*
|
|
4
|
+
* A panel, a status bar and a dialog look the same in every editor of the
|
|
5
|
+
* family, and they have to: a reader who has learnt one editor has learnt the
|
|
6
|
+
* others, and that only holds while the parts are literally the same parts.
|
|
7
|
+
* What is here is the half that draws nothing — the style objects each part is
|
|
8
|
+
* built from, the questions the DOM is asked before a shortcut fires, and the
|
|
9
|
+
* sentences a reader is given when a file goes wrong.
|
|
10
|
+
*/
|
|
11
|
+
export { listStyle, paragraphStyle } from './dialogStyles.ts';
|
|
12
|
+
export { isEditingField } from './isEditingField.ts';
|
|
13
|
+
export { inlineLabelStyle, labelRowStyle, labelStyle, panelBodyStyle, panelCapsuleGroupStyle, panelCapsuleRowStyle, panelCapsulesStyle, panelCellStyle, panelColumnButtonStyle, panelEmptyStyle, panelHeaderCellStyle, panelHeadingStyle, panelNumberCellStyle, panelScrollAreaStyle, panelStickyHeaderStyle, panelStyle, panelTableStyle, panelToolbarCountStyle, panelToolbarStyle, shortPanelStyle, smallCapsuleStyle, } from './panelStyles.ts';
|
|
14
|
+
export type { RowPlacement, RowSpacers } from './rowSpacers.ts';
|
|
15
|
+
export { rowSpacers } from './rowSpacers.ts';
|
|
16
|
+
export { countLabel, statusBarStyle, statusItemStyle, statusMutedStyle, statusSpacerStyle, } from './statusBar.ts';
|
|
17
|
+
export { filterNeedle, matchesNeedle } from './textFilter.ts';
|
|
18
|
+
export { yieldToPainting } from './yieldToPainting.ts';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/panel/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,UAAU,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chrome an editor is laid out with, below the components that wear it.
|
|
3
|
+
*
|
|
4
|
+
* A panel, a status bar and a dialog look the same in every editor of the
|
|
5
|
+
* family, and they have to: a reader who has learnt one editor has learnt the
|
|
6
|
+
* others, and that only holds while the parts are literally the same parts.
|
|
7
|
+
* What is here is the half that draws nothing — the style objects each part is
|
|
8
|
+
* built from, the questions the DOM is asked before a shortcut fires, and the
|
|
9
|
+
* sentences a reader is given when a file goes wrong.
|
|
10
|
+
*/
|
|
11
|
+
export { listStyle, paragraphStyle } from "./dialogStyles.js";
|
|
12
|
+
export { isEditingField } from "./isEditingField.js";
|
|
13
|
+
export { inlineLabelStyle, labelRowStyle, labelStyle, panelBodyStyle, panelCapsuleGroupStyle, panelCapsuleRowStyle, panelCapsulesStyle, panelCellStyle, panelColumnButtonStyle, panelEmptyStyle, panelHeaderCellStyle, panelHeadingStyle, panelNumberCellStyle, panelScrollAreaStyle, panelStickyHeaderStyle, panelStyle, panelTableStyle, panelToolbarCountStyle, panelToolbarStyle, shortPanelStyle, smallCapsuleStyle, } from "./panelStyles.js";
|
|
14
|
+
export { rowSpacers } from "./rowSpacers.js";
|
|
15
|
+
export { countLabel, statusBarStyle, statusItemStyle, statusMutedStyle, statusSpacerStyle, } from "./statusBar.js";
|
|
16
|
+
export { filterNeedle, matchesNeedle } from "./textFilter.js";
|
|
17
|
+
export { yieldToPainting } from "./yieldToPainting.js";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/panel/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,UAAU,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether an event belongs to something the user is typing in.
|
|
3
|
+
*
|
|
4
|
+
* An editor listens on the document for shortcuts and for pastes, so both have
|
|
5
|
+
* to keep their hands off every field on the page: an `f` typed into a mass box,
|
|
6
|
+
* a row filter or a sequence field is part of what is being written, not a chart
|
|
7
|
+
* being fitted or a glycan being drawn.
|
|
8
|
+
*
|
|
9
|
+
* `isContentEditable` is asked as well as the tag, because a rich text box is a
|
|
10
|
+
* `div` and swallowing its keys is the same mistake made less visibly. Two of
|
|
11
|
+
* the three copies this replaces had lost that line — one of them while keeping
|
|
12
|
+
* the sentence claiming it.
|
|
13
|
+
* @param target - What the event was delivered to.
|
|
14
|
+
* @returns Whether it should be left alone.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isEditingField(target: EventTarget | null): boolean;
|
|
17
|
+
//# sourceMappingURL=isEditingField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isEditingField.d.ts","sourceRoot":"","sources":["../../../src/panel/core/isEditingField.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAIlE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether an event belongs to something the user is typing in.
|
|
3
|
+
*
|
|
4
|
+
* An editor listens on the document for shortcuts and for pastes, so both have
|
|
5
|
+
* to keep their hands off every field on the page: an `f` typed into a mass box,
|
|
6
|
+
* a row filter or a sequence field is part of what is being written, not a chart
|
|
7
|
+
* being fitted or a glycan being drawn.
|
|
8
|
+
*
|
|
9
|
+
* `isContentEditable` is asked as well as the tag, because a rich text box is a
|
|
10
|
+
* `div` and swallowing its keys is the same mistake made less visibly. Two of
|
|
11
|
+
* the three copies this replaces had lost that line — one of them while keeping
|
|
12
|
+
* the sentence claiming it.
|
|
13
|
+
* @param target - What the event was delivered to.
|
|
14
|
+
* @returns Whether it should be left alone.
|
|
15
|
+
*/
|
|
16
|
+
export function isEditingField(target) {
|
|
17
|
+
if (!(target instanceof HTMLElement))
|
|
18
|
+
return false;
|
|
19
|
+
if (target.isContentEditable)
|
|
20
|
+
return true;
|
|
21
|
+
return EDITING_TAGS.has(target.tagName);
|
|
22
|
+
}
|
|
23
|
+
/** Elements an event belongs to rather than to the editor around them. */
|
|
24
|
+
const EDITING_TAGS = new Set(['INPUT', 'TEXTAREA', 'SELECT']);
|
|
25
|
+
//# sourceMappingURL=isEditingField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isEditingField.js","sourceRoot":"","sources":["../../../src/panel/core/isEditingField.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAAC,MAA0B;IACvD,IAAI,CAAC,CAAC,MAAM,YAAY,WAAW,CAAC;QAAE,OAAO,KAAK,CAAC;IACnD,IAAI,MAAM,CAAC,iBAAiB;QAAE,OAAO,IAAI,CAAC;IAC1C,OAAO,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC;AAED,0EAA0E;AAC1E,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC"}
|