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,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The crosshair a chart follows the pointer with, and the lines it reads out.
|
|
3
|
+
*
|
|
4
|
+
* Every viewer draws the same two dashed rules and writes the same stack of
|
|
5
|
+
* short lines beside them; what differs is the words, which are the one thing
|
|
6
|
+
* only the viewer knows — an m/z and a height here, a retention time and a
|
|
7
|
+
* summed current there. So the geometry, the dashes and the placement live
|
|
8
|
+
* here, and the caller hands over the lines already written.
|
|
9
|
+
*
|
|
10
|
+
* The first line is the one being pointed at and is written plainly; the rest
|
|
11
|
+
* are quieter, because they answer the question the first one raises rather
|
|
12
|
+
* than being asked for in their own right.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { ReactElement } from 'react';
|
|
16
|
+
|
|
17
|
+
import type { PlotRect } from '../core/chartGeometry.ts';
|
|
18
|
+
import {
|
|
19
|
+
CHART_COLORS,
|
|
20
|
+
CHART_FONT,
|
|
21
|
+
LABEL_HALO,
|
|
22
|
+
LABEL_QUIET,
|
|
23
|
+
PEAK_LABEL,
|
|
24
|
+
} from '../core/chartTheme.ts';
|
|
25
|
+
import type { ChartPoint } from '../core/svgPoint.ts';
|
|
26
|
+
import { readoutPlacement } from '../core/trackerReadout.ts';
|
|
27
|
+
|
|
28
|
+
/** What the tracker is given. */
|
|
29
|
+
export interface ChartTrackerProps {
|
|
30
|
+
/** Where the pointer is, `null` whenever it is off the plot. */
|
|
31
|
+
position: ChartPoint | null;
|
|
32
|
+
/** Where the plot sits inside the SVG. */
|
|
33
|
+
plot: PlotRect;
|
|
34
|
+
/**
|
|
35
|
+
* What to write beside the crosshair, most important first, `null` where the
|
|
36
|
+
* axes read nothing under the pointer.
|
|
37
|
+
* @default null
|
|
38
|
+
*/
|
|
39
|
+
lines?: readonly string[] | null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Draw the crosshair and its readout.
|
|
44
|
+
* @param props - The pointer, the plot and the lines to write.
|
|
45
|
+
* @returns The crosshair, or nothing while the pointer is off the plot.
|
|
46
|
+
*/
|
|
47
|
+
export function ChartTracker(props: ChartTrackerProps): ReactElement | null {
|
|
48
|
+
const { position, plot, lines = null } = props;
|
|
49
|
+
if (position === null) return null;
|
|
50
|
+
|
|
51
|
+
const place = readoutPlacement(position, plot);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<g pointerEvents="none">
|
|
55
|
+
<line
|
|
56
|
+
x1={position.x}
|
|
57
|
+
y1={plot.top}
|
|
58
|
+
x2={position.x}
|
|
59
|
+
y2={plot.bottom}
|
|
60
|
+
strokeDasharray={TRACKER_DASH}
|
|
61
|
+
style={crosshairStyle}
|
|
62
|
+
/>
|
|
63
|
+
<line
|
|
64
|
+
x1={plot.left}
|
|
65
|
+
y1={position.y}
|
|
66
|
+
x2={plot.right}
|
|
67
|
+
y2={position.y}
|
|
68
|
+
strokeDasharray={TRACKER_DASH}
|
|
69
|
+
style={crosshairStyle}
|
|
70
|
+
/>
|
|
71
|
+
{lines === null || lines.length === 0 ? null : (
|
|
72
|
+
<text textAnchor={place.anchor} style={readoutStyle}>
|
|
73
|
+
{lines.map((line, at) => (
|
|
74
|
+
<tspan
|
|
75
|
+
key={line}
|
|
76
|
+
x={place.x}
|
|
77
|
+
y={place.y + at * PEAK_LABEL.lineHeight}
|
|
78
|
+
fillOpacity={at === 0 ? undefined : LABEL_QUIET}
|
|
79
|
+
>
|
|
80
|
+
{line}
|
|
81
|
+
</tspan>
|
|
82
|
+
))}
|
|
83
|
+
</text>
|
|
84
|
+
)}
|
|
85
|
+
</g>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** What the crosshair is dashed with, so it is never read as a trace. */
|
|
90
|
+
const TRACKER_DASH = '3 3';
|
|
91
|
+
|
|
92
|
+
const crosshairStyle = { stroke: CHART_COLORS.tracker } as const;
|
|
93
|
+
|
|
94
|
+
const readoutStyle = {
|
|
95
|
+
fill: CHART_COLORS.trackerText,
|
|
96
|
+
fontSize: CHART_FONT.readout,
|
|
97
|
+
// Haloed like every other label written onto the plot, and it needs it more
|
|
98
|
+
// than any of them: the pointer is put wherever the question is, which is over
|
|
99
|
+
// the trace rather than beside it.
|
|
100
|
+
...LABEL_HALO,
|
|
101
|
+
} as const;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { PlotRect } from '../core/chartGeometry.ts';
|
|
4
|
+
import { CHART_COLORS, LABEL_HALO } from '../core/chartTheme.ts';
|
|
5
|
+
import {
|
|
6
|
+
CHARACTER_WIDTH,
|
|
7
|
+
FONT_SIZE,
|
|
8
|
+
GAP,
|
|
9
|
+
MARGIN,
|
|
10
|
+
ROW_HEIGHT,
|
|
11
|
+
} from '../core/legendBox.ts';
|
|
12
|
+
|
|
13
|
+
/** What the caption says, and how much of the plot it may say it across. */
|
|
14
|
+
export interface PlotCaptionProps {
|
|
15
|
+
/** What the plot is a picture of, in one line. */
|
|
16
|
+
text: string;
|
|
17
|
+
/** The plot it is written on. */
|
|
18
|
+
plot: PlotRect;
|
|
19
|
+
/**
|
|
20
|
+
* The x it must stop short of, in the plot's own pixels.
|
|
21
|
+
*
|
|
22
|
+
* The left edge of a legend sharing the top of the plot, which `legendBox`
|
|
23
|
+
* answers for whoever is drawing one. Nothing here works that out on its own:
|
|
24
|
+
* a caption is written wherever a caller asks and only the caller knows what
|
|
25
|
+
* else it put up there.
|
|
26
|
+
* @default the plot's right edge
|
|
27
|
+
*/
|
|
28
|
+
until?: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* What a plot is a picture of, written in its top left corner.
|
|
33
|
+
*
|
|
34
|
+
* The opposite corner from the legend, and it says the opposite kind of thing:
|
|
35
|
+
* a legend names the curves against each other, while a caption says which
|
|
36
|
+
* measurement the whole pane is of — which file, which acquisition of it, when
|
|
37
|
+
* it was measured. A stack of panes is where that matters, since three charts
|
|
38
|
+
* one above another are three pictures of three different scans and the axes
|
|
39
|
+
* say nothing about which.
|
|
40
|
+
*
|
|
41
|
+
* Drawn **inside the SVG**, for the reason `TraceLegend` states: a picture is
|
|
42
|
+
* exported by cloning the chart's own `SVGSVGElement`, so a caption living in a
|
|
43
|
+
* `<div>` beside it would be missing from every figure while looking perfectly
|
|
44
|
+
* right on screen — and a figure that does not say what it is a picture of is
|
|
45
|
+
* the one thing a caption exists to prevent.
|
|
46
|
+
*
|
|
47
|
+
* It is written on the plot rather than above it. The room over a plot belongs
|
|
48
|
+
* to the tallest peak's label, and taking it for a caption would either push
|
|
49
|
+
* the measurement down or have the two collide on whichever spectrum happens to
|
|
50
|
+
* peak at the left.
|
|
51
|
+
* @param props - Component props.
|
|
52
|
+
* @returns The caption, or nothing where there is no room to write it.
|
|
53
|
+
*/
|
|
54
|
+
export function PlotCaption(props: PlotCaptionProps): ReactElement | null {
|
|
55
|
+
const { text, plot, until } = props;
|
|
56
|
+
|
|
57
|
+
const said = elide(text, (until ?? plot.right) - GAP - plot.left - MARGIN);
|
|
58
|
+
if (said === '') return null;
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<text
|
|
62
|
+
x={plot.left + MARGIN}
|
|
63
|
+
y={plot.top + MARGIN + ROW_HEIGHT / 2}
|
|
64
|
+
fontSize={FONT_SIZE}
|
|
65
|
+
dominantBaseline="middle"
|
|
66
|
+
style={captionStyle}
|
|
67
|
+
pointerEvents="none"
|
|
68
|
+
aria-hidden="true"
|
|
69
|
+
>
|
|
70
|
+
{said}
|
|
71
|
+
</text>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The caption cut to the room it has, with an ellipsis where it was cut.
|
|
77
|
+
*
|
|
78
|
+
* Measured from character counts rather than from the DOM, for the reason
|
|
79
|
+
* `legendBox` gives: the text is decided during render, where a
|
|
80
|
+
* `getComputedTextLength` would need a layout pass that has not happened, and
|
|
81
|
+
* the clone an export takes gets no layout at all — so a caption that measured
|
|
82
|
+
* itself would come out one length on screen and another in the figure.
|
|
83
|
+
* @param text - What the pane would say.
|
|
84
|
+
* @param room - How wide it may be, in pixels.
|
|
85
|
+
* @returns What it says, or nothing where a caption would be a stub.
|
|
86
|
+
*/
|
|
87
|
+
function elide(text: string, room: number): string {
|
|
88
|
+
const fits = Math.floor(room / CHARACTER_WIDTH);
|
|
89
|
+
if (fits >= text.length) return text;
|
|
90
|
+
// A caption cut to three characters is not a caption, and a reader has to
|
|
91
|
+
// guess at what it was — better a pane that says nothing than one that
|
|
92
|
+
// appears to answer and does not.
|
|
93
|
+
if (fits < MINIMUM_CHARACTERS) return '';
|
|
94
|
+
return `${text.slice(0, fits - 1).trimEnd()}…`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** The shortest caption still worth writing, in characters. */
|
|
98
|
+
const MINIMUM_CHARACTERS = 8;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The face it is set in: the axis titles' ink, haloed like a peak label.
|
|
102
|
+
*
|
|
103
|
+
* The halo is what lets it be written straight onto the plot rather than in a
|
|
104
|
+
* box: a box in the top left would hide the very trace the pane is a picture
|
|
105
|
+
* of, while a hairline of paper around each glyph clears the letters and
|
|
106
|
+
* nothing else.
|
|
107
|
+
*/
|
|
108
|
+
const captionStyle = { fill: CHART_COLORS.title, ...LABEL_HALO } as const;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { PlotRect } from '../core/chartGeometry.ts';
|
|
4
|
+
import { CHART_COLORS } from '../core/chartTheme.ts';
|
|
5
|
+
import { selectionRectangle } from '../core/selectionGeometry.ts';
|
|
6
|
+
import type { ZoomSelection } from '../core/zoomDomain.ts';
|
|
7
|
+
|
|
8
|
+
export interface SelectionRectProps {
|
|
9
|
+
/** The drag being made, `null` when none is. */
|
|
10
|
+
selection: ZoomSelection | null;
|
|
11
|
+
/** Where the plot sits inside the SVG, which the drag is confined to. */
|
|
12
|
+
plot: PlotRect;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* What the drag being made promises, drawn before the button is let go.
|
|
17
|
+
*
|
|
18
|
+
* It is painted over the data rather than under it, which is the one place a
|
|
19
|
+
* preview may cover a trace: a rectangle drawn behind a dense spectrum is a
|
|
20
|
+
* rectangle nobody sees, and the whole point of it is to be seen while the hand
|
|
21
|
+
* is still moving. The fill is faint enough for the peaks inside it to be read
|
|
22
|
+
* through, so the window being asked for can be judged against what is in it.
|
|
23
|
+
*
|
|
24
|
+
* Nothing here takes a pointer event: the drag is already captured on the SVG,
|
|
25
|
+
* and a rectangle that swallowed the pointer would end the very gesture it is
|
|
26
|
+
* drawing.
|
|
27
|
+
* @param props - Component props.
|
|
28
|
+
* @returns The rectangle, or nothing when no drag is being made and when the one
|
|
29
|
+
* being made is too short to zoom.
|
|
30
|
+
*/
|
|
31
|
+
export function SelectionRect(props: SelectionRectProps): ReactElement | null {
|
|
32
|
+
const { selection, plot } = props;
|
|
33
|
+
|
|
34
|
+
const rectangle = selectionRectangle(selection, plot);
|
|
35
|
+
if (rectangle === null) return null;
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<rect
|
|
39
|
+
x={rectangle.x}
|
|
40
|
+
y={rectangle.y}
|
|
41
|
+
width={rectangle.width}
|
|
42
|
+
height={rectangle.height}
|
|
43
|
+
pointerEvents="none"
|
|
44
|
+
style={selectionStyle}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const selectionStyle = {
|
|
50
|
+
fill: CHART_COLORS.selection,
|
|
51
|
+
stroke: CHART_COLORS.selectionBorder,
|
|
52
|
+
} as const;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
import { TOKEN } from '../../tokens/core/familyTokens.ts';
|
|
4
|
+
import type { PlotRect } from '../core/chartGeometry.ts';
|
|
5
|
+
import {
|
|
6
|
+
CLOSE_COLUMN,
|
|
7
|
+
FONT_SIZE,
|
|
8
|
+
GAP,
|
|
9
|
+
PADDING,
|
|
10
|
+
ROW_HEIGHT,
|
|
11
|
+
SWATCH,
|
|
12
|
+
hiddenLabel,
|
|
13
|
+
legendBox,
|
|
14
|
+
legendLabel,
|
|
15
|
+
legendNames,
|
|
16
|
+
} from '../core/legendBox.ts';
|
|
17
|
+
|
|
18
|
+
/** One trace the legend names. */
|
|
19
|
+
export interface LegendEntry {
|
|
20
|
+
/** Identity, which is what the list is keyed on. */
|
|
21
|
+
id: string;
|
|
22
|
+
/** What it is called. */
|
|
23
|
+
name: string;
|
|
24
|
+
/** The colour it is drawn in. */
|
|
25
|
+
color: string;
|
|
26
|
+
/**
|
|
27
|
+
* Whether it is drawn solid or faint — a trace that is present but not the
|
|
28
|
+
* one being read.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
dimmed?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* A 1-based number written before the name.
|
|
34
|
+
*
|
|
35
|
+
* The palette hands out six hues and `nextSpectrumColor` deliberately falls
|
|
36
|
+
* back to the least-used one rather than reaching for a colour only some
|
|
37
|
+
* readers can place, so the seventh trace legitimately repeats a colour and
|
|
38
|
+
* the legend stops being able to tell two rows apart by swatch alone. A
|
|
39
|
+
* number tells them apart at twelve traces and at thirty, survives a
|
|
40
|
+
* monochrome print, and survives a trace too short to show its colour
|
|
41
|
+
* clearly — the row then reads `3 · x 132, y 88`.
|
|
42
|
+
* @default undefined
|
|
43
|
+
*/
|
|
44
|
+
index?: number;
|
|
45
|
+
/**
|
|
46
|
+
* A short remark written at the right of the row, in grey.
|
|
47
|
+
* @default undefined
|
|
48
|
+
*/
|
|
49
|
+
note?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface TraceLegendProps {
|
|
53
|
+
/** The traces, in the order they are drawn. */
|
|
54
|
+
entries: readonly LegendEntry[];
|
|
55
|
+
/** The plot the legend sits inside. */
|
|
56
|
+
plot: PlotRect;
|
|
57
|
+
/**
|
|
58
|
+
* How many entries are named before the rest are counted instead.
|
|
59
|
+
*
|
|
60
|
+
* A legend taller than the plot is a legend that hides the measurement it is
|
|
61
|
+
* explaining, which is the failure a scrollbar in a legend admits to. Past
|
|
62
|
+
* this many the last line reads `+ 4 more`.
|
|
63
|
+
* @default 8
|
|
64
|
+
*/
|
|
65
|
+
limit?: number;
|
|
66
|
+
/**
|
|
67
|
+
* How few named traces are still worth a legend.
|
|
68
|
+
*
|
|
69
|
+
* Two is right for a chart standing on its own: the axis title already says
|
|
70
|
+
* what the single curve is, so a box naming the only trace is furniture. It
|
|
71
|
+
* is wrong for a pane of a stack, where the panes share their axes and the
|
|
72
|
+
* legend is the only thing saying which measurement this one is of — there a
|
|
73
|
+
* single name is the whole point, and the pane passes 1.
|
|
74
|
+
* @default 2
|
|
75
|
+
*/
|
|
76
|
+
minimumEntries?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Whether a column is left at the right of every row for a control.
|
|
79
|
+
*
|
|
80
|
+
* The picture never draws that control — a cross drawn here would be cloned
|
|
81
|
+
* into every exported figure as a dead glyph, and a press on the SVG root is
|
|
82
|
+
* read as the start of a chart gesture — but it has to leave the room for it,
|
|
83
|
+
* or the box painted behind the rows comes out narrower than the rows an HTML
|
|
84
|
+
* layer places over it and every cross hangs off the end of the legend.
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
closable?: boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* What each curve on a chart is, written in the top right of the plot.
|
|
92
|
+
*
|
|
93
|
+
* Drawn **inside the SVG** and never as HTML beside it, which is not a style
|
|
94
|
+
* choice: `stackDrawings` exports a picture by cloning the chart's own
|
|
95
|
+
* `SVGSVGElement`, so a legend living in a `<div>` would be missing from every
|
|
96
|
+
* exported figure while looking perfectly correct on screen — a picture that is
|
|
97
|
+
* wrong only once it leaves the application is the worst kind to ship.
|
|
98
|
+
*
|
|
99
|
+
* Top right because that is where a chromatogram has room: a trace rises from
|
|
100
|
+
* the baseline and the tallest peak is rarely at the right-hand edge. It is
|
|
101
|
+
* drawn over the plot rather than in a gutter beside it so that adding a legend
|
|
102
|
+
* does not narrow the measurement.
|
|
103
|
+
*
|
|
104
|
+
* Where it sits and how tall it is comes from `legendBox` rather than from
|
|
105
|
+
* arithmetic of its own, because a legend whose rows carry an interactive
|
|
106
|
+
* control is drawn a second time in HTML over this one, and two owners of a row
|
|
107
|
+
* position is a cross that drifts off the name it closes.
|
|
108
|
+
*
|
|
109
|
+
* A trace with no name is not given one here. An unnamed curve in a legend is a
|
|
110
|
+
* row of colour and nothing else, which is worse than being left out, and the
|
|
111
|
+
* caller knows what it drew.
|
|
112
|
+
* @param props - Component props.
|
|
113
|
+
* @returns The legend, or nothing when there are too few traces to name.
|
|
114
|
+
*/
|
|
115
|
+
export function TraceLegend(props: TraceLegendProps): ReactElement | null {
|
|
116
|
+
const {
|
|
117
|
+
entries,
|
|
118
|
+
plot,
|
|
119
|
+
limit = 8,
|
|
120
|
+
minimumEntries = 2,
|
|
121
|
+
closable = false,
|
|
122
|
+
} = props;
|
|
123
|
+
const named = legendNames(entries, minimumEntries);
|
|
124
|
+
if (named.length === 0) return null;
|
|
125
|
+
|
|
126
|
+
// The very options the control layer measures with, or the two disagree by
|
|
127
|
+
// exactly the width of the column a cross stands in.
|
|
128
|
+
const box = legendBox(named, plot, { limit, closable });
|
|
129
|
+
const noteX = box.left + box.width - PADDING - (closable ? CLOSE_COLUMN : 0);
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<g aria-hidden="true" pointerEvents="none">
|
|
133
|
+
<rect
|
|
134
|
+
x={box.left}
|
|
135
|
+
y={box.top}
|
|
136
|
+
width={box.width}
|
|
137
|
+
height={box.height}
|
|
138
|
+
rx={3}
|
|
139
|
+
fill="rgb(255 255 255 / 82%)"
|
|
140
|
+
stroke="rgb(217 223 230)"
|
|
141
|
+
strokeWidth={0.5}
|
|
142
|
+
/>
|
|
143
|
+
{box.rows.map((row, index) => {
|
|
144
|
+
const entry = named[index];
|
|
145
|
+
if (entry === undefined) return null;
|
|
146
|
+
return (
|
|
147
|
+
<g key={row.id} opacity={entry.dimmed === true ? 0.45 : 1}>
|
|
148
|
+
<line
|
|
149
|
+
x1={box.left + PADDING}
|
|
150
|
+
x2={box.left + PADDING + SWATCH}
|
|
151
|
+
y1={row.middle}
|
|
152
|
+
y2={row.middle}
|
|
153
|
+
stroke={entry.color}
|
|
154
|
+
strokeWidth={2}
|
|
155
|
+
/>
|
|
156
|
+
<text
|
|
157
|
+
x={box.left + PADDING + SWATCH + GAP}
|
|
158
|
+
y={row.middle}
|
|
159
|
+
fontSize={FONT_SIZE}
|
|
160
|
+
dominantBaseline="middle"
|
|
161
|
+
fill="rgb(28 33 39)"
|
|
162
|
+
>
|
|
163
|
+
{legendLabel(entry)}
|
|
164
|
+
</text>
|
|
165
|
+
{entry.note !== undefined && (
|
|
166
|
+
<text
|
|
167
|
+
x={noteX}
|
|
168
|
+
y={row.middle}
|
|
169
|
+
fontSize={FONT_SIZE}
|
|
170
|
+
dominantBaseline="middle"
|
|
171
|
+
textAnchor="end"
|
|
172
|
+
fill={TOKEN.textMuted}
|
|
173
|
+
>
|
|
174
|
+
{entry.note}
|
|
175
|
+
</text>
|
|
176
|
+
)}
|
|
177
|
+
</g>
|
|
178
|
+
);
|
|
179
|
+
})}
|
|
180
|
+
{box.hidden > 0 && (
|
|
181
|
+
<text
|
|
182
|
+
x={box.left + PADDING + SWATCH + GAP}
|
|
183
|
+
y={box.top + box.height - PADDING - ROW_HEIGHT / 2}
|
|
184
|
+
fontSize={FONT_SIZE}
|
|
185
|
+
dominantBaseline="middle"
|
|
186
|
+
fill={TOKEN.textMuted}
|
|
187
|
+
>
|
|
188
|
+
{hiddenLabel(box.hidden)}
|
|
189
|
+
</text>
|
|
190
|
+
)}
|
|
191
|
+
</g>
|
|
192
|
+
);
|
|
193
|
+
}
|