react-cheminfo 0.28.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/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/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,68 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CHART_COLORS, LABEL_HALO } from "../core/chartTheme.js";
|
|
3
|
+
import { CHARACTER_WIDTH, FONT_SIZE, GAP, MARGIN, ROW_HEIGHT, } from "../core/legendBox.js";
|
|
4
|
+
/**
|
|
5
|
+
* What a plot is a picture of, written in its top left corner.
|
|
6
|
+
*
|
|
7
|
+
* The opposite corner from the legend, and it says the opposite kind of thing:
|
|
8
|
+
* a legend names the curves against each other, while a caption says which
|
|
9
|
+
* measurement the whole pane is of — which file, which acquisition of it, when
|
|
10
|
+
* it was measured. A stack of panes is where that matters, since three charts
|
|
11
|
+
* one above another are three pictures of three different scans and the axes
|
|
12
|
+
* say nothing about which.
|
|
13
|
+
*
|
|
14
|
+
* Drawn **inside the SVG**, for the reason `TraceLegend` states: a picture is
|
|
15
|
+
* exported by cloning the chart's own `SVGSVGElement`, so a caption living in a
|
|
16
|
+
* `<div>` beside it would be missing from every figure while looking perfectly
|
|
17
|
+
* right on screen — and a figure that does not say what it is a picture of is
|
|
18
|
+
* the one thing a caption exists to prevent.
|
|
19
|
+
*
|
|
20
|
+
* It is written on the plot rather than above it. The room over a plot belongs
|
|
21
|
+
* to the tallest peak's label, and taking it for a caption would either push
|
|
22
|
+
* the measurement down or have the two collide on whichever spectrum happens to
|
|
23
|
+
* peak at the left.
|
|
24
|
+
* @param props - Component props.
|
|
25
|
+
* @returns The caption, or nothing where there is no room to write it.
|
|
26
|
+
*/
|
|
27
|
+
export function PlotCaption(props) {
|
|
28
|
+
const { text, plot, until } = props;
|
|
29
|
+
const said = elide(text, (until ?? plot.right) - GAP - plot.left - MARGIN);
|
|
30
|
+
if (said === '')
|
|
31
|
+
return null;
|
|
32
|
+
return (_jsx("text", { x: plot.left + MARGIN, y: plot.top + MARGIN + ROW_HEIGHT / 2, fontSize: FONT_SIZE, dominantBaseline: "middle", style: captionStyle, pointerEvents: "none", "aria-hidden": "true", children: said }));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The caption cut to the room it has, with an ellipsis where it was cut.
|
|
36
|
+
*
|
|
37
|
+
* Measured from character counts rather than from the DOM, for the reason
|
|
38
|
+
* `legendBox` gives: the text is decided during render, where a
|
|
39
|
+
* `getComputedTextLength` would need a layout pass that has not happened, and
|
|
40
|
+
* the clone an export takes gets no layout at all — so a caption that measured
|
|
41
|
+
* itself would come out one length on screen and another in the figure.
|
|
42
|
+
* @param text - What the pane would say.
|
|
43
|
+
* @param room - How wide it may be, in pixels.
|
|
44
|
+
* @returns What it says, or nothing where a caption would be a stub.
|
|
45
|
+
*/
|
|
46
|
+
function elide(text, room) {
|
|
47
|
+
const fits = Math.floor(room / CHARACTER_WIDTH);
|
|
48
|
+
if (fits >= text.length)
|
|
49
|
+
return text;
|
|
50
|
+
// A caption cut to three characters is not a caption, and a reader has to
|
|
51
|
+
// guess at what it was — better a pane that says nothing than one that
|
|
52
|
+
// appears to answer and does not.
|
|
53
|
+
if (fits < MINIMUM_CHARACTERS)
|
|
54
|
+
return '';
|
|
55
|
+
return `${text.slice(0, fits - 1).trimEnd()}…`;
|
|
56
|
+
}
|
|
57
|
+
/** The shortest caption still worth writing, in characters. */
|
|
58
|
+
const MINIMUM_CHARACTERS = 8;
|
|
59
|
+
/**
|
|
60
|
+
* The face it is set in: the axis titles' ink, haloed like a peak label.
|
|
61
|
+
*
|
|
62
|
+
* The halo is what lets it be written straight onto the plot rather than in a
|
|
63
|
+
* box: a box in the top left would hide the very trace the pane is a picture
|
|
64
|
+
* of, while a hairline of paper around each glyph clears the letters and
|
|
65
|
+
* nothing else.
|
|
66
|
+
*/
|
|
67
|
+
const captionStyle = { fill: CHART_COLORS.title, ...LABEL_HALO };
|
|
68
|
+
//# sourceMappingUR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AE,CAAC;IACzC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC;AACjD,CAAC;AAED,+DAA+D;AAC/D,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B;;;;;;;GAOG;AACH,MAAM,YAAY,GAAG,EAAE,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,GAAG,UAAU,EAAW,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { PlotRect } from '../core/chartGeometry.ts';
|
|
3
|
+
import type { ZoomSelection } from '../core/zoomDomain.ts';
|
|
4
|
+
export interface SelectionRectProps {
|
|
5
|
+
/** The drag being made, `null` when none is. */
|
|
6
|
+
selection: ZoomSelection | null;
|
|
7
|
+
/** Where the plot sits inside the SVG, which the drag is confined to. */
|
|
8
|
+
plot: PlotRect;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* What the drag being made promises, drawn before the button is let go.
|
|
12
|
+
*
|
|
13
|
+
* It is painted over the data rather than under it, which is the one place a
|
|
14
|
+
* preview may cover a trace: a rectangle drawn behind a dense spectrum is a
|
|
15
|
+
* rectangle nobody sees, and the whole point of it is to be seen while the hand
|
|
16
|
+
* is still moving. The fill is faint enough for the peaks inside it to be read
|
|
17
|
+
* through, so the window being asked for can be judged against what is in it.
|
|
18
|
+
*
|
|
19
|
+
* Nothing here takes a pointer event: the drag is already captured on the SVG,
|
|
20
|
+
* and a rectangle that swallowed the pointer would end the very gesture it is
|
|
21
|
+
* drawing.
|
|
22
|
+
* @param props - Component props.
|
|
23
|
+
* @returns The rectangle, or nothing when no drag is being made and when the one
|
|
24
|
+
* being made is too short to zoom.
|
|
25
|
+
*/
|
|
26
|
+
export declare function SelectionRect(props: SelectionRectProps): ReactElement | null;
|
|
27
|
+
//# sourceMappingURL=SelectionRect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionRect.d.ts","sourceRoot":"","sources":["../../../src/chart/ui/SelectionRect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;IAChC,yEAAyE;IACzE,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,YAAY,GAAG,IAAI,CAgB5E"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CHART_COLORS } from "../core/chartTheme.js";
|
|
3
|
+
import { selectionRectangle } from "../core/selectionGeometry.js";
|
|
4
|
+
/**
|
|
5
|
+
* What the drag being made promises, drawn before the button is let go.
|
|
6
|
+
*
|
|
7
|
+
* It is painted over the data rather than under it, which is the one place a
|
|
8
|
+
* preview may cover a trace: a rectangle drawn behind a dense spectrum is a
|
|
9
|
+
* rectangle nobody sees, and the whole point of it is to be seen while the hand
|
|
10
|
+
* is still moving. The fill is faint enough for the peaks inside it to be read
|
|
11
|
+
* through, so the window being asked for can be judged against what is in it.
|
|
12
|
+
*
|
|
13
|
+
* Nothing here takes a pointer event: the drag is already captured on the SVG,
|
|
14
|
+
* and a rectangle that swallowed the pointer would end the very gesture it is
|
|
15
|
+
* drawing.
|
|
16
|
+
* @param props - Component props.
|
|
17
|
+
* @returns The rectangle, or nothing when no drag is being made and when the one
|
|
18
|
+
* being made is too short to zoom.
|
|
19
|
+
*/
|
|
20
|
+
export function SelectionRect(props) {
|
|
21
|
+
const { selection, plot } = props;
|
|
22
|
+
const rectangle = selectionRectangle(selection, plot);
|
|
23
|
+
if (rectangle === null)
|
|
24
|
+
return null;
|
|
25
|
+
return (_jsx("rect", { x: rectangle.x, y: rectangle.y, width: rectangle.width, height: rectangle.height, pointerEvents: "none", style: selectionStyle }));
|
|
26
|
+
}
|
|
27
|
+
const selectionStyle = {
|
|
28
|
+
fill: CHART_COLORS.selection,
|
|
29
|
+
stroke: CHART_COLORS.selectionBorder,
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=SelectionRect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionRect.js","sourceRoot":"","sources":["../../../src/chart/ui/SelectionRect.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAUlE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAElC,MAAM,SAAS,GAAG,kBAAkB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACtD,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEpC,OAAO,CACL,eACE,CAAC,EAAE,SAAS,CAAC,CAAC,EACd,CAAC,EAAE,SAAS,CAAC,CAAC,EACd,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,MAAM,EAAE,SAAS,CAAC,MAAM,EACxB,aAAa,EAAC,MAAM,EACpB,KAAK,EAAE,cAAc,GACrB,CACH,CAAC;AACJ,CAAC;AAED,MAAM,cAAc,GAAG;IACrB,IAAI,EAAE,YAAY,CAAC,SAAS;IAC5B,MAAM,EAAE,YAAY,CAAC,eAAe;CAC5B,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { PlotRect } from '../core/chartGeometry.ts';
|
|
3
|
+
/** One trace the legend names. */
|
|
4
|
+
export interface LegendEntry {
|
|
5
|
+
/** Identity, which is what the list is keyed on. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** What it is called. */
|
|
8
|
+
name: string;
|
|
9
|
+
/** The colour it is drawn in. */
|
|
10
|
+
color: string;
|
|
11
|
+
/**
|
|
12
|
+
* Whether it is drawn solid or faint — a trace that is present but not the
|
|
13
|
+
* one being read.
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
dimmed?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* A 1-based number written before the name.
|
|
19
|
+
*
|
|
20
|
+
* The palette hands out six hues and `nextSpectrumColor` deliberately falls
|
|
21
|
+
* back to the least-used one rather than reaching for a colour only some
|
|
22
|
+
* readers can place, so the seventh trace legitimately repeats a colour and
|
|
23
|
+
* the legend stops being able to tell two rows apart by swatch alone. A
|
|
24
|
+
* number tells them apart at twelve traces and at thirty, survives a
|
|
25
|
+
* monochrome print, and survives a trace too short to show its colour
|
|
26
|
+
* clearly — the row then reads `3 · x 132, y 88`.
|
|
27
|
+
* @default undefined
|
|
28
|
+
*/
|
|
29
|
+
index?: number;
|
|
30
|
+
/**
|
|
31
|
+
* A short remark written at the right of the row, in grey.
|
|
32
|
+
* @default undefined
|
|
33
|
+
*/
|
|
34
|
+
note?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface TraceLegendProps {
|
|
37
|
+
/** The traces, in the order they are drawn. */
|
|
38
|
+
entries: readonly LegendEntry[];
|
|
39
|
+
/** The plot the legend sits inside. */
|
|
40
|
+
plot: PlotRect;
|
|
41
|
+
/**
|
|
42
|
+
* How many entries are named before the rest are counted instead.
|
|
43
|
+
*
|
|
44
|
+
* A legend taller than the plot is a legend that hides the measurement it is
|
|
45
|
+
* explaining, which is the failure a scrollbar in a legend admits to. Past
|
|
46
|
+
* this many the last line reads `+ 4 more`.
|
|
47
|
+
* @default 8
|
|
48
|
+
*/
|
|
49
|
+
limit?: number;
|
|
50
|
+
/**
|
|
51
|
+
* How few named traces are still worth a legend.
|
|
52
|
+
*
|
|
53
|
+
* Two is right for a chart standing on its own: the axis title already says
|
|
54
|
+
* what the single curve is, so a box naming the only trace is furniture. It
|
|
55
|
+
* is wrong for a pane of a stack, where the panes share their axes and the
|
|
56
|
+
* legend is the only thing saying which measurement this one is of — there a
|
|
57
|
+
* single name is the whole point, and the pane passes 1.
|
|
58
|
+
* @default 2
|
|
59
|
+
*/
|
|
60
|
+
minimumEntries?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Whether a column is left at the right of every row for a control.
|
|
63
|
+
*
|
|
64
|
+
* The picture never draws that control — a cross drawn here would be cloned
|
|
65
|
+
* into every exported figure as a dead glyph, and a press on the SVG root is
|
|
66
|
+
* read as the start of a chart gesture — but it has to leave the room for it,
|
|
67
|
+
* or the box painted behind the rows comes out narrower than the rows an HTML
|
|
68
|
+
* layer places over it and every cross hangs off the end of the legend.
|
|
69
|
+
* @default false
|
|
70
|
+
*/
|
|
71
|
+
closable?: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* What each curve on a chart is, written in the top right of the plot.
|
|
75
|
+
*
|
|
76
|
+
* Drawn **inside the SVG** and never as HTML beside it, which is not a style
|
|
77
|
+
* choice: `stackDrawings` exports a picture by cloning the chart's own
|
|
78
|
+
* `SVGSVGElement`, so a legend living in a `<div>` would be missing from every
|
|
79
|
+
* exported figure while looking perfectly correct on screen — a picture that is
|
|
80
|
+
* wrong only once it leaves the application is the worst kind to ship.
|
|
81
|
+
*
|
|
82
|
+
* Top right because that is where a chromatogram has room: a trace rises from
|
|
83
|
+
* the baseline and the tallest peak is rarely at the right-hand edge. It is
|
|
84
|
+
* drawn over the plot rather than in a gutter beside it so that adding a legend
|
|
85
|
+
* does not narrow the measurement.
|
|
86
|
+
*
|
|
87
|
+
* Where it sits and how tall it is comes from `legendBox` rather than from
|
|
88
|
+
* arithmetic of its own, because a legend whose rows carry an interactive
|
|
89
|
+
* control is drawn a second time in HTML over this one, and two owners of a row
|
|
90
|
+
* position is a cross that drifts off the name it closes.
|
|
91
|
+
*
|
|
92
|
+
* A trace with no name is not given one here. An unnamed curve in a legend is a
|
|
93
|
+
* row of colour and nothing else, which is worse than being left out, and the
|
|
94
|
+
* caller knows what it drew.
|
|
95
|
+
* @param props - Component props.
|
|
96
|
+
* @returns The legend, or nothing when there are too few traces to name.
|
|
97
|
+
*/
|
|
98
|
+
export declare function TraceLegend(props: TraceLegendProps): ReactElement | null;
|
|
99
|
+
//# sourceMappingURL=TraceLegend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TraceLegend.d.ts","sourceRoot":"","sources":["../../../src/chart/ui/TraceLegend.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAczD,kCAAkC;AAClC,MAAM,WAAW,WAAW;IAC1B,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,+CAA+C;IAC/C,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IAChC,uCAAuC;IACvC,IAAI,EAAE,QAAQ,CAAC;IACf;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,GAAG,IAAI,CA8ExE"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { TOKEN } from "../../tokens/core/familyTokens.js";
|
|
3
|
+
import { CLOSE_COLUMN, FONT_SIZE, GAP, PADDING, ROW_HEIGHT, SWATCH, hiddenLabel, legendBox, legendLabel, legendNames, } from "../core/legendBox.js";
|
|
4
|
+
/**
|
|
5
|
+
* What each curve on a chart is, written in the top right of the plot.
|
|
6
|
+
*
|
|
7
|
+
* Drawn **inside the SVG** and never as HTML beside it, which is not a style
|
|
8
|
+
* choice: `stackDrawings` exports a picture by cloning the chart's own
|
|
9
|
+
* `SVGSVGElement`, so a legend living in a `<div>` would be missing from every
|
|
10
|
+
* exported figure while looking perfectly correct on screen — a picture that is
|
|
11
|
+
* wrong only once it leaves the application is the worst kind to ship.
|
|
12
|
+
*
|
|
13
|
+
* Top right because that is where a chromatogram has room: a trace rises from
|
|
14
|
+
* the baseline and the tallest peak is rarely at the right-hand edge. It is
|
|
15
|
+
* drawn over the plot rather than in a gutter beside it so that adding a legend
|
|
16
|
+
* does not narrow the measurement.
|
|
17
|
+
*
|
|
18
|
+
* Where it sits and how tall it is comes from `legendBox` rather than from
|
|
19
|
+
* arithmetic of its own, because a legend whose rows carry an interactive
|
|
20
|
+
* control is drawn a second time in HTML over this one, and two owners of a row
|
|
21
|
+
* position is a cross that drifts off the name it closes.
|
|
22
|
+
*
|
|
23
|
+
* A trace with no name is not given one here. An unnamed curve in a legend is a
|
|
24
|
+
* row of colour and nothing else, which is worse than being left out, and the
|
|
25
|
+
* caller knows what it drew.
|
|
26
|
+
* @param props - Component props.
|
|
27
|
+
* @returns The legend, or nothing when there are too few traces to name.
|
|
28
|
+
*/
|
|
29
|
+
export function TraceLegend(props) {
|
|
30
|
+
const { entries, plot, limit = 8, minimumEntries = 2, closable = false, } = props;
|
|
31
|
+
const named = legendNames(entries, minimumEntries);
|
|
32
|
+
if (named.length === 0)
|
|
33
|
+
return null;
|
|
34
|
+
// The very options the control layer measures with, or the two disagree by
|
|
35
|
+
// exactly the width of the column a cross stands in.
|
|
36
|
+
const box = legendBox(named, plot, { limit, closable });
|
|
37
|
+
const noteX = box.left + box.width - PADDING - (closable ? CLOSE_COLUMN : 0);
|
|
38
|
+
return (_jsxs("g", { "aria-hidden": "true", pointerEvents: "none", children: [_jsx("rect", { x: box.left, y: box.top, width: box.width, height: box.height, rx: 3, fill: "rgb(255 255 255 / 82%)", stroke: "rgb(217 223 230)", strokeWidth: 0.5 }), box.rows.map((row, index) => {
|
|
39
|
+
const entry = named[index];
|
|
40
|
+
if (entry === undefined)
|
|
41
|
+
return null;
|
|
42
|
+
return (_jsxs("g", { opacity: entry.dimmed === true ? 0.45 : 1, children: [_jsx("line", { x1: box.left + PADDING, x2: box.left + PADDING + SWATCH, y1: row.middle, y2: row.middle, stroke: entry.color, strokeWidth: 2 }), _jsx("text", { x: box.left + PADDING + SWATCH + GAP, y: row.middle, fontSize: FONT_SIZE, dominantBaseline: "middle", fill: "rgb(28 33 39)", children: legendLabel(entry) }), entry.note !== undefined && (_jsx("text", { x: noteX, y: row.middle, fontSize: FONT_SIZE, dominantBaseline: "middle", textAnchor: "end", fill: TOKEN.textMuted, children: entry.note }))] }, row.id));
|
|
43
|
+
}), box.hidden > 0 && (_jsx("text", { x: box.left + PADDING + SWATCH + GAP, y: box.top + box.height - PADDING - ROW_HEIGHT / 2, fontSize: FONT_SIZE, dominantBaseline: "middle", fill: TOKEN.textMuted, children: hiddenLabel(box.hidden) }))] }));
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=TraceLegend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TraceLegend.js","sourceRoot":"","sources":["../../../src/chart/ui/TraceLegend.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CAAC,EAClD,QAAQ,EAAE,SAAS,EACnB,gBAAgB,EAAC,QAAQ,EACzB,IAAI,EAAE,KAAK,CAAC,SAAS,YAEpB,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,GACnB,CACR,IACC,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A press on a chart, and what letting go of it answers.
|
|
3
|
+
*
|
|
4
|
+
* `useChartZoom` holds the React state — the window on screen, and the drag
|
|
5
|
+
* being made across it — and this holds the arithmetic that turns a release into
|
|
6
|
+
* an answer: a window to show, a range to report, a click to report, or nothing
|
|
7
|
+
* at all. Keeping the two apart is what lets the answer be tested without a
|
|
8
|
+
* renderer, which is how `zoomedDomain` beside it has always been read, and it
|
|
9
|
+
* is why this sits next to that file rather than inside the hook.
|
|
10
|
+
*
|
|
11
|
+
* The three things a host can be told about are here for the same reason. Only
|
|
12
|
+
* one of the four answers moves the window; the other three leave the chart
|
|
13
|
+
* exactly where it was, and deciding between them in one place is what stops a
|
|
14
|
+
* gesture reporting a range and a click for the same drag.
|
|
15
|
+
*/
|
|
16
|
+
import type { PointerEvent as ReactPointerEvent } from 'react';
|
|
17
|
+
import type { ChartDomain, ZoomRules } from '../core/chartDomain.ts';
|
|
18
|
+
import type { PlotRect } from '../core/chartGeometry.ts';
|
|
19
|
+
import type { ChartScale } from '../core/chartScale.ts';
|
|
20
|
+
import type { ChartPoint } from '../core/svgPoint.ts';
|
|
21
|
+
import type { DragBox } from '../core/zoomDomain.ts';
|
|
22
|
+
/** One gesture on the SVG, as React hands it over. */
|
|
23
|
+
type PointerHandler = (event: ReactPointerEvent<SVGSVGElement>) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Which keys were held as a click was let go.
|
|
26
|
+
*
|
|
27
|
+
* Reported rather than interpreted, because what a modifier *means* is a
|
|
28
|
+
* question about the measurement and not about the gesture layer: on a mass
|
|
29
|
+
* spectrum a held shift asks for the peak to be watched for, and on an infrared
|
|
30
|
+
* one it will mean something else entirely. The chart says which keys were
|
|
31
|
+
* down; whoever knows what is being measured decides what that asks for.
|
|
32
|
+
*/
|
|
33
|
+
export interface ChartClickModifiers {
|
|
34
|
+
/** Whether shift was held. */
|
|
35
|
+
shift: boolean;
|
|
36
|
+
/** Whether alt — option on a Mac — was held. */
|
|
37
|
+
alt: boolean;
|
|
38
|
+
}
|
|
39
|
+
/** No key held, which is what a plain click reports. */
|
|
40
|
+
export declare const NO_MODIFIERS: ChartClickModifiers;
|
|
41
|
+
/** What to spread onto the SVG for it to be zoomed. */
|
|
42
|
+
export interface ChartZoomHandlers {
|
|
43
|
+
onPointerDown: PointerHandler;
|
|
44
|
+
onPointerMove: PointerHandler;
|
|
45
|
+
onPointerUp: PointerHandler;
|
|
46
|
+
onPointerCancel: PointerHandler;
|
|
47
|
+
onDoubleClick: () => void;
|
|
48
|
+
}
|
|
49
|
+
/** What a host asks to be told, beyond the window it is shown anyway. */
|
|
50
|
+
export interface ChartGestureReports {
|
|
51
|
+
/**
|
|
52
|
+
* What to do with the two values a `select` drag swept out, in the units of
|
|
53
|
+
* the horizontal axis and stated low end first.
|
|
54
|
+
*
|
|
55
|
+
* The window is left exactly where it was: the gesture asked where a peak
|
|
56
|
+
* begins and ends, not to look closer at it, and a chart that zoomed to the
|
|
57
|
+
* boundaries as they were set would take the neighbouring peaks off the screen
|
|
58
|
+
* every time. The ends are sorted before anyone is told, because a drag made
|
|
59
|
+
* right to left is as ordinary as one made left to right and an axis drawn
|
|
60
|
+
* right to left inverts them again — a range of `[2.9, 2.4]` minutes
|
|
61
|
+
* integrates nothing.
|
|
62
|
+
* @default nothing is reported, and a select drag then does nothing at all
|
|
63
|
+
*/
|
|
64
|
+
onSelectRange?: (range: [number, number]) => void;
|
|
65
|
+
/**
|
|
66
|
+
* What to do with a press that went nowhere, in the units the chart is
|
|
67
|
+
* measured in — an m/z, a wavenumber, a retention time and a value.
|
|
68
|
+
*
|
|
69
|
+
* Nowhere means nowhere on **either** axis: a press is a click when it
|
|
70
|
+
* travelled less than `MINIMUM_DRAG` across and less than `MINIMUM_DRAG` down.
|
|
71
|
+
* Only the horizontal travel decides whether there is a window to zoom to, so
|
|
72
|
+
* a drag of one pixel across and three hundred down asks for no window — but
|
|
73
|
+
* it is plainly a gesture that was made, and calling it a press that went
|
|
74
|
+
* nowhere would put a scan on the chart nobody pointed at.
|
|
75
|
+
*
|
|
76
|
+
* A `select` drag is never reported here at all. Its answer is a range or it
|
|
77
|
+
* is nothing, and a near-vertical integration drag that moved the cursor
|
|
78
|
+
* instead would be answering a question the chemist did not ask.
|
|
79
|
+
*
|
|
80
|
+
* There is no other way to be told about a click: hovering is a different
|
|
81
|
+
* question, answered continuously and by every tremor of a hand resting on the
|
|
82
|
+
* chart, and choosing the scan at 2.500 minutes is a decision made by pressing.
|
|
83
|
+
* Only a press let go over the plot is reported — the gestures are heard on the
|
|
84
|
+
* whole SVG, so the axis titles and the tick labels are under them too, and a
|
|
85
|
+
* click on the word `m/z` inverted through the scales lands at a value the
|
|
86
|
+
* chart is not even drawing.
|
|
87
|
+
* @default nothing is reported
|
|
88
|
+
*/
|
|
89
|
+
onClick?: (point: ChartPoint, modifiers: ChartClickModifiers) => void;
|
|
90
|
+
/**
|
|
91
|
+
* Whether a press at this point of the SVG, in its own user units, begins a
|
|
92
|
+
* drag at all.
|
|
93
|
+
*
|
|
94
|
+
* In pixels rather than in data units because that is the question being
|
|
95
|
+
* asked: whatever else is drawn on the chart — an integration boundary to be
|
|
96
|
+
* taken hold of, a cursor to be slid — was placed in pixels, and `isInsidePlot`
|
|
97
|
+
* is here for exactly this. Refusing means the press is never captured, so it
|
|
98
|
+
* reaches whatever is under it and that thing keeps the rest of the gesture;
|
|
99
|
+
* captured first and refused afterwards, the handle would never see the move
|
|
100
|
+
* events that drag it.
|
|
101
|
+
* @default every press over the SVG begins a drag
|
|
102
|
+
*/
|
|
103
|
+
shouldStartDrag?: (point: ChartPoint) => boolean;
|
|
104
|
+
}
|
|
105
|
+
/** A drag as it is held, tied to the pointer that started it. */
|
|
106
|
+
export interface Drag extends DragBox {
|
|
107
|
+
/** So a second finger cannot take a drag over from the first. */
|
|
108
|
+
pointerId: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* What letting go of a drag comes to, told to the host on the way.
|
|
112
|
+
*
|
|
113
|
+
* One reading of the gesture answers all four outcomes, so what a select drag
|
|
114
|
+
* reports and what a zoom would have shown can never drift apart: the clamping
|
|
115
|
+
* to the plot, the `MINIMUM_DRAG` test and the sorting after inverting are done
|
|
116
|
+
* once, in `zoomedDomain`.
|
|
117
|
+
* @param current - The window in force, kept on the axis that is not asked for.
|
|
118
|
+
* @param released - The two corners as the button came up, in user units.
|
|
119
|
+
* @param plot - Where the plot sits inside the SVG.
|
|
120
|
+
* @param xScale - The x axis as the chart is currently zoomed.
|
|
121
|
+
* @param yScale - The y axis, likewise.
|
|
122
|
+
* @param rules - How the y axis behaves and what a drag means.
|
|
123
|
+
* @param reports - What the host asked to be told.
|
|
124
|
+
* @param modifiers
|
|
125
|
+
* @returns The window to show, `null` when the chart stays where it is.
|
|
126
|
+
*/
|
|
127
|
+
export declare function answeredRelease(current: ChartDomain, released: DragBox, plot: PlotRect, xScale: ChartScale, yScale: ChartScale, rules: ZoomRules, reports: ChartGestureReports, modifiers?: ChartClickModifiers): ChartDomain | null;
|
|
128
|
+
/**
|
|
129
|
+
* The drag a press begins, `null` for a press that begins none.
|
|
130
|
+
*
|
|
131
|
+
* The host is asked before the pointer is captured rather than after it: a press
|
|
132
|
+
* taken from whatever it landed on cannot be handed back mid-gesture, so an
|
|
133
|
+
* integration boundary or a cursor drawn on the chart would never see the moves
|
|
134
|
+
* that drag it.
|
|
135
|
+
* @param event - The press.
|
|
136
|
+
* @param svg - The SVG it was made on, which is what places it in user units.
|
|
137
|
+
* @param shouldStartDrag - Whether the host lets the chart have it, absent when
|
|
138
|
+
* every press over the SVG is the chart's.
|
|
139
|
+
* @returns The drag, `null` when the press was not the chart's to take or the
|
|
140
|
+
* SVG cannot place the pointer.
|
|
141
|
+
*/
|
|
142
|
+
export declare function startedDrag(event: ReactPointerEvent<SVGSVGElement>, svg: SVGSVGElement | null, shouldStartDrag: ((point: ChartPoint) => boolean) | undefined): Drag | null;
|
|
143
|
+
/**
|
|
144
|
+
* Where a drag has got to, when the event belongs to it.
|
|
145
|
+
* @param drag - The drag being made, `null` when none is.
|
|
146
|
+
* @param event - The pointer event just received.
|
|
147
|
+
* @param svg - The SVG the gesture is made on.
|
|
148
|
+
* @returns The drag with its far corner moved, `null` when the event is not
|
|
149
|
+
* part of it or the SVG cannot place the pointer.
|
|
150
|
+
*/
|
|
151
|
+
export declare function draggedTo(drag: Drag | null, event: ReactPointerEvent<SVGSVGElement>, svg: SVGSVGElement | null): Drag | null;
|
|
152
|
+
/**
|
|
153
|
+
* Give the pointer back, so the next gesture reaches whatever it is aimed at.
|
|
154
|
+
* @param event - The event ending the drag.
|
|
155
|
+
*/
|
|
156
|
+
export declare function releaseDrag(event: ReactPointerEvent<SVGSVGElement>): void;
|
|
157
|
+
export {};
|
|
158
|
+
//# sourceMappingURL=chartGestures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chartGestures.d.ts","sourceRoot":"","sources":["../../../src/chart/ui/chartGestures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC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E,mBAAkC,GAC5C,WAAW,GAAG,IAAI,CAcpB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,iBAAiB,CAAC,aAAa,CAAC,EACvC,GAAG,EAAE,aAAa,GAAG,IAAI,EACzB,eAAe,EAAE,CAAC,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,GAAG,SAAS,GAC5D,IAAI,GAAG,IAAI,CAeb;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,IAAI,GAAG,IAAI,EACjB,KAAK,EAAE,iBAAiB,CAAC,aAAa,CAAC,EACvC,GAAG,EAAE,aAAa,GAAG,IAAI,GACxB,IAAI,GAAG,IAAI,CAKb;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,CAAC,aAAa,CAAC,GAAG,IAAI,CAIzE"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A press on a chart, and what letting go of it answers.
|
|
3
|
+
*
|
|
4
|
+
* `useChartZoom` holds the React state — the window on screen, and the drag
|
|
5
|
+
* being made across it — and this holds the arithmetic that turns a release into
|
|
6
|
+
* an answer: a window to show, a range to report, a click to report, or nothing
|
|
7
|
+
* at all. Keeping the two apart is what lets the answer be tested without a
|
|
8
|
+
* renderer, which is how `zoomedDomain` beside it has always been read, and it
|
|
9
|
+
* is why this sits next to that file rather than inside the hook.
|
|
10
|
+
*
|
|
11
|
+
* The three things a host can be told about are here for the same reason. Only
|
|
12
|
+
* one of the four answers moves the window; the other three leave the chart
|
|
13
|
+
* exactly where it was, and deciding between them in one place is what stops a
|
|
14
|
+
* gesture reporting a range and a click for the same drag.
|
|
15
|
+
*/
|
|
16
|
+
import { chartValue } from "../core/chartScale.js";
|
|
17
|
+
import { svgPointAt } from "../core/svgPoint.js";
|
|
18
|
+
import { MINIMUM_DRAG, zoomedDomain } from "../core/zoomDomain.js";
|
|
19
|
+
import { isInsidePlot } from "./useChartPointer.js";
|
|
20
|
+
/** No key held, which is what a plain click reports. */
|
|
21
|
+
export const NO_MODIFIERS = { shift: false, alt: false };
|
|
22
|
+
/**
|
|
23
|
+
* What letting go of a drag comes to, told to the host on the way.
|
|
24
|
+
*
|
|
25
|
+
* One reading of the gesture answers all four outcomes, so what a select drag
|
|
26
|
+
* reports and what a zoom would have shown can never drift apart: the clamping
|
|
27
|
+
* to the plot, the `MINIMUM_DRAG` test and the sorting after inverting are done
|
|
28
|
+
* once, in `zoomedDomain`.
|
|
29
|
+
* @param current - The window in force, kept on the axis that is not asked for.
|
|
30
|
+
* @param released - The two corners as the button came up, in user units.
|
|
31
|
+
* @param plot - Where the plot sits inside the SVG.
|
|
32
|
+
* @param xScale - The x axis as the chart is currently zoomed.
|
|
33
|
+
* @param yScale - The y axis, likewise.
|
|
34
|
+
* @param rules - How the y axis behaves and what a drag means.
|
|
35
|
+
* @param reports - What the host asked to be told.
|
|
36
|
+
* @param modifiers
|
|
37
|
+
* @returns The window to show, `null` when the chart stays where it is.
|
|
38
|
+
*/
|
|
39
|
+
export function answeredRelease(current, released, plot, xScale, yScale, rules, reports, modifiers = NO_MODIFIERS) {
|
|
40
|
+
const mode = rules.drag ?? 'xAxis';
|
|
41
|
+
const next = zoomedDomain(current, released, plot, xScale, yScale, rules);
|
|
42
|
+
if (next === null) {
|
|
43
|
+
if (mode !== 'select') {
|
|
44
|
+
reportClick(released, plot, xScale, yScale, reports.onClick, modifiers);
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
if (mode === 'select') {
|
|
49
|
+
reports.onSelectRange?.(next.x);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return next;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The drag a press begins, `null` for a press that begins none.
|
|
56
|
+
*
|
|
57
|
+
* The host is asked before the pointer is captured rather than after it: a press
|
|
58
|
+
* taken from whatever it landed on cannot be handed back mid-gesture, so an
|
|
59
|
+
* integration boundary or a cursor drawn on the chart would never see the moves
|
|
60
|
+
* that drag it.
|
|
61
|
+
* @param event - The press.
|
|
62
|
+
* @param svg - The SVG it was made on, which is what places it in user units.
|
|
63
|
+
* @param shouldStartDrag - Whether the host lets the chart have it, absent when
|
|
64
|
+
* every press over the SVG is the chart's.
|
|
65
|
+
* @returns The drag, `null` when the press was not the chart's to take or the
|
|
66
|
+
* SVG cannot place the pointer.
|
|
67
|
+
*/
|
|
68
|
+
export function startedDrag(event, svg, shouldStartDrag) {
|
|
69
|
+
if (event.button !== LEFT_BUTTON)
|
|
70
|
+
return null;
|
|
71
|
+
const point = svgPointAt(svg, event.clientX, event.clientY);
|
|
72
|
+
if (point === null)
|
|
73
|
+
return null;
|
|
74
|
+
if (shouldStartDrag !== undefined && !shouldStartDrag(point))
|
|
75
|
+
return null;
|
|
76
|
+
// Captured so a drag running off the plot — which is how the y axis is asked
|
|
77
|
+
// for — keeps being reported.
|
|
78
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
79
|
+
return {
|
|
80
|
+
pointerId: event.pointerId,
|
|
81
|
+
fromX: point.x,
|
|
82
|
+
fromY: point.y,
|
|
83
|
+
toX: point.x,
|
|
84
|
+
toY: point.y,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Where a drag has got to, when the event belongs to it.
|
|
89
|
+
* @param drag - The drag being made, `null` when none is.
|
|
90
|
+
* @param event - The pointer event just received.
|
|
91
|
+
* @param svg - The SVG the gesture is made on.
|
|
92
|
+
* @returns The drag with its far corner moved, `null` when the event is not
|
|
93
|
+
* part of it or the SVG cannot place the pointer.
|
|
94
|
+
*/
|
|
95
|
+
export function draggedTo(drag, event, svg) {
|
|
96
|
+
if (drag?.pointerId !== event.pointerId)
|
|
97
|
+
return null;
|
|
98
|
+
const point = svgPointAt(svg, event.clientX, event.clientY);
|
|
99
|
+
if (point === null)
|
|
100
|
+
return null;
|
|
101
|
+
return { ...drag, toX: point.x, toY: point.y };
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Give the pointer back, so the next gesture reaches whatever it is aimed at.
|
|
105
|
+
* @param event - The event ending the drag.
|
|
106
|
+
*/
|
|
107
|
+
export function releaseDrag(event) {
|
|
108
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
109
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Tell a host where a press that went nowhere landed, in the units the chart is
|
|
114
|
+
* measured in.
|
|
115
|
+
*
|
|
116
|
+
* The travel is measured as the hand made it, before any clamping to the plot: a
|
|
117
|
+
* gesture that ran out over the tick labels travelled however far it travelled,
|
|
118
|
+
* and one begun outside the plot is refused by `isInsidePlot` rather than by
|
|
119
|
+
* arithmetic that pretends it stopped at the edge.
|
|
120
|
+
* @param released - The gesture as it was let go, in user units of the SVG.
|
|
121
|
+
* @param plot - Where the plot sits inside that SVG, which a click has to be
|
|
122
|
+
* over for the values it inverts to be ones the chart is drawing.
|
|
123
|
+
* @param xScale - The horizontal axis as the chart is currently zoomed.
|
|
124
|
+
* @param yScale - The vertical axis, likewise.
|
|
125
|
+
* @param onClick - What the host asked to be told, absent when it asked for
|
|
126
|
+
* nothing.
|
|
127
|
+
* @param modifiers - Which keys were held as the button came up.
|
|
128
|
+
*/
|
|
129
|
+
function reportClick(released, plot, xScale, yScale, onClick, modifiers) {
|
|
130
|
+
if (onClick === undefined)
|
|
131
|
+
return;
|
|
132
|
+
if (Math.abs(released.toX - released.fromX) >= MINIMUM_DRAG)
|
|
133
|
+
return;
|
|
134
|
+
if (Math.abs(released.toY - released.fromY) >= MINIMUM_DRAG)
|
|
135
|
+
return;
|
|
136
|
+
// Where the button came up rather than where it went down: the two are within
|
|
137
|
+
// `MINIMUM_DRAG` of each other, and the release is where the user was looking.
|
|
138
|
+
const point = { x: released.toX, y: released.toY };
|
|
139
|
+
if (!isInsidePlot(plot, point))
|
|
140
|
+
return;
|
|
141
|
+
onClick({ x: chartValue(xScale, point.x), y: chartValue(yScale, point.y) }, modifiers);
|
|
142
|
+
}
|
|
143
|
+
/** Which button drags a box; the others belong to menus and to panning. */
|
|
144
|
+
const LEFT_BUTTON = 0;
|
|
145
|
+
//# sourceMappingURL=chartGestures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chartGestures.js","sourceRoot":"","sources":["../../../src/chart/ui/chartGestures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAqBpD,wDAAwD;AACxD,MAAM,CAAC,MAAM,YAAY,GAAwB,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AA0E9E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAoB,EACpB,QAAiB,EACjB,IAAc,EACd,MAAkB,EAClB,MAAkB,EAClB,KAAgB,EAChB,OAA4B,EAC5B,YAAiC,YAAY;IAE7C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,OAAO,CAAC;IACnC,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAC1E,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtB,WAAW,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAC1E,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