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,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the guide for one value is drawn when that value is not on screen.
|
|
3
|
+
*
|
|
4
|
+
* A chart zoomed onto a single feature is the normal way of reading a spectrum
|
|
5
|
+
* — one isotopologue cluster two millimass units wide, one chromatographic peak
|
|
6
|
+
* four seconds wide — and most of what a panel beside it can point at then lies
|
|
7
|
+
* outside the window. Drawing nothing in that case answers the only question
|
|
8
|
+
* the guide exists for — where is it? — with silence, and the reader is left
|
|
9
|
+
* unable to tell a fragment the spectrum does not carry from one that is simply
|
|
10
|
+
* off to the left. So the guide is parked on the edge it went out of instead,
|
|
11
|
+
* dashed and carrying an arrow, which says both that it is elsewhere and which
|
|
12
|
+
* way.
|
|
13
|
+
*
|
|
14
|
+
* Nothing here reads the domain: the value is put through the scale, and the
|
|
15
|
+
* pixel that comes back is compared against the two pixel edges of the plot.
|
|
16
|
+
* That is what lets `left` and `right` mean what they say on an axis that runs
|
|
17
|
+
* backwards, as an infrared chart's wavenumbers do — they are the edges of the
|
|
18
|
+
* screen, not the ends of the window, and a descending axis parks a value below
|
|
19
|
+
* its window on the right, which is exactly where the reader must look for it.
|
|
20
|
+
*/
|
|
21
|
+
import { chartPixel, chartRoundPixel } from "./chartScale.js";
|
|
22
|
+
/**
|
|
23
|
+
* Work out where the guide for a value goes.
|
|
24
|
+
*
|
|
25
|
+
* The test is made in pixels rather than against the domain, so the guide can
|
|
26
|
+
* never disagree with the axis it is drawn over: both are read off the same
|
|
27
|
+
* scale, and a rounding that puts a value a hundredth of a unit inside the
|
|
28
|
+
* window puts the guide a hundredth of a pixel inside the plot rather than
|
|
29
|
+
* parking it on an edge it is standing beside.
|
|
30
|
+
* @param value - The place on the horizontal axis being pointed at, in whatever
|
|
31
|
+
* that axis measures — an m/z, a retention time, a wavenumber.
|
|
32
|
+
* @param plot - The plotting area the guide is confined to.
|
|
33
|
+
* @param xScale - The horizontal axis as it is currently zoomed.
|
|
34
|
+
* The pixel is rounded for the markup, to the hundredth: that is under a tenth
|
|
35
|
+
* of a device pixel at any zoom a browser offers, and it keeps the last digits
|
|
36
|
+
* of a multiply-add out of the `d` a reader has to look at in a failing test.
|
|
37
|
+
* @returns Where to draw it, or `null` for a value no scale maps anywhere — an
|
|
38
|
+
* empty chart's degenerate axis, or a `NaN` out of an unparsed field.
|
|
39
|
+
*/
|
|
40
|
+
export function guidePlacement(value, plot, xScale) {
|
|
41
|
+
if (!Number.isFinite(value))
|
|
42
|
+
return null;
|
|
43
|
+
const pixel = chartPixel(xScale, value);
|
|
44
|
+
if (!Number.isFinite(pixel))
|
|
45
|
+
return null;
|
|
46
|
+
if (pixel < plot.left)
|
|
47
|
+
return { x: plot.left, direction: 'left' };
|
|
48
|
+
if (pixel > plot.right)
|
|
49
|
+
return { x: plot.right, direction: 'right' };
|
|
50
|
+
return { x: chartRoundPixel(pixel), direction: null };
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=guidePlacement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guidePlacement.js","sourceRoot":"","sources":["../../../src/chart/core/guidePlacement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAa9D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAa,EACb,IAAc,EACd,MAAkB;IAElB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzC,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzC,IAAI,KAAK,GAAG,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IAClE,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;IACrE,OAAO,EAAE,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AACxD,CAAC"}
|
|
@@ -21,9 +21,36 @@ export { chartAxisTitle, chartShare } from './chartLabels.ts';
|
|
|
21
21
|
export type { ChartColorRole } from './chartPalette.ts';
|
|
22
22
|
export { CHART_SERIES_COLORS, chartSeriesColor } from './chartPalette.ts';
|
|
23
23
|
export type { ChartScale } from './chartScale.ts';
|
|
24
|
-
export { chartPixel, chartScale, chartValue } from './chartScale.ts';
|
|
24
|
+
export { chartPixel, chartRoundPixel, chartScale, chartValue, } from './chartScale.ts';
|
|
25
25
|
export type { ChartViewport } from './chartViewport.ts';
|
|
26
|
-
export { CHART_SMALLEST_ZOOM,
|
|
26
|
+
export { CHART_SMALLEST_ZOOM, CHART_WHEEL_LINE, CHART_WHEEL_PAGE, CHART_WHEEL_SPEED, CHART_WHEEL_TRAVEL, chartClampViewport, chartWheelFactor, chartWheelTravel, chartZoomDomain, chartZoomViewport, } from './chartViewport.ts';
|
|
27
27
|
export type { MatrixLike } from './matrix.ts';
|
|
28
28
|
export { mappedMatrix, rowMatrix, stackedMatrix } from './matrix.ts';
|
|
29
|
+
export { SCIENTIFIC_ABOVE, SCIENTIFIC_BELOW, axisLabeller, formatNumber, formatScientific, } from './axisLabels.ts';
|
|
30
|
+
export { MAXIMUM_DRIFT_STEPS, layoutAnnotationBoxes } from './boxLayout.ts';
|
|
31
|
+
export type { ChartDomain, DragMode, YAxisRules, ZoomDragMode, ZoomGestures, ZoomRules, } from './chartDomain.ts';
|
|
32
|
+
export { DEFAULT_Y_AXIS_RULES, DEFAULT_ZOOM_GESTURES, sameChartDomain, } from './chartDomain.ts';
|
|
33
|
+
export type { ChartLayer, ChartMargin, ChartSize, PlotRect, } from './chartGeometry.ts';
|
|
34
|
+
export { CHART_LAYERS, MARGIN, MINIMUM_PLOT_SIDE, SHARED_AXIS_MARGIN, plotRect, } from './chartGeometry.ts';
|
|
35
|
+
export { CHART_PANE_ATTRIBUTE } from './chartPane.ts';
|
|
36
|
+
export { CHART_COLORS, CHART_FONT, LABEL_HALO, LABEL_QUIET, PEAK_LABEL, } from './chartTheme.ts';
|
|
37
|
+
export type { GuidePlacement } from './guidePlacement.ts';
|
|
38
|
+
export { guidePlacement } from './guidePlacement.ts';
|
|
39
|
+
export { labelStackBaselines } from './labelStack.ts';
|
|
40
|
+
export type { LegendBox, LegendBoxEntry, LegendBoxOptions, LegendRow, } from './legendBox.ts';
|
|
41
|
+
export { CLOSE_COLUMN, MAXIMUM_CHARACTERS, PADDING, ROW_HEIGHT, SWATCH, hiddenLabel, legendBox, legendLabel, legendNames, } from './legendBox.ts';
|
|
42
|
+
export type { SelectionRectangle } from './selectionGeometry.ts';
|
|
43
|
+
export { selectionRectangle } from './selectionGeometry.ts';
|
|
44
|
+
export { ALL_SPECTRUM_COLORS, EXTRA_SPECTRUM_COLORS, SPECTRUM_COLORS, nextSpectrumColor, } from './spectrumColor.ts';
|
|
45
|
+
export { FOOT_FURNITURE, FOOT_MINIMUM, STACKED_MINIMUM, STACK_LIMIT, stackCapacity, stackShares, } from './stackCapacity.ts';
|
|
46
|
+
export type { ChartPoint, PointerSurface, ScreenMatrix } from './svgPoint.ts';
|
|
47
|
+
export { svgPointAt } from './svgPoint.ts';
|
|
48
|
+
export type { AreaPathOptions } from './tracePath.ts';
|
|
49
|
+
export { areaPath, profilePath, stickPath } from './tracePath.ts';
|
|
50
|
+
export type { ReadoutPlacement } from './trackerReadout.ts';
|
|
51
|
+
export { READOUT_GAP, READOUT_LINES, READOUT_WIDTH, readoutPlacement, } from './trackerReadout.ts';
|
|
52
|
+
export type { ViewBox, ViewState, ZoomBounds } from './viewTransform.ts';
|
|
53
|
+
export { INITIAL_VIEW, MAXIMUM_CONTENT_SCALE, MAXIMUM_ZOOM, MINIMUM_ZOOM, baseViewBox, clampZoom, magnificationOf, panBy, viewBoxAttribute, viewBoxOf, zoomAbout, zoomToAboutCentre, } from './viewTransform.ts';
|
|
54
|
+
export type { DragBox, ZoomSelection } from './zoomDomain.ts';
|
|
55
|
+
export { MINIMUM_DRAG, releasedBeyondBaseline, scaledYAxis, zoomSelection, zoomedDomain, } from './zoomDomain.ts';
|
|
29
56
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chart/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,YAAY,EACV,cAAc,EACd,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,YAAY,EACV,wBAAwB,EACxB,WAAW,EACX,wBAAwB,GACzB,MAAM,kBA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,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,SAAS,EACT,eAAe,EACf,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,aAAa,EACb,YAAY,GACb,MAAM,iBAAiB,CAAC"}
|
package/lib/chart/core/index.js
CHANGED
|
@@ -14,7 +14,24 @@ export { chartBinCounts } from "./chartBins.js";
|
|
|
14
14
|
export { EMPTY_EXTENT, chartColumnExtent, chartMergeExtents, chartPadExtent, chartValuesExtent, } from "./chartExtent.js";
|
|
15
15
|
export { chartAxisTitle, chartShare } from "./chartLabels.js";
|
|
16
16
|
export { CHART_SERIES_COLORS, chartSeriesColor } from "./chartPalette.js";
|
|
17
|
-
export { chartPixel, chartScale, chartValue } from "./chartScale.js";
|
|
18
|
-
export { CHART_SMALLEST_ZOOM,
|
|
17
|
+
export { chartPixel, chartRoundPixel, chartScale, chartValue, } from "./chartScale.js";
|
|
18
|
+
export { CHART_SMALLEST_ZOOM, CHART_WHEEL_LINE, CHART_WHEEL_PAGE, CHART_WHEEL_SPEED, CHART_WHEEL_TRAVEL, chartClampViewport, chartWheelFactor, chartWheelTravel, chartZoomDomain, chartZoomViewport, } from "./chartViewport.js";
|
|
19
19
|
export { mappedMatrix, rowMatrix, stackedMatrix } from "./matrix.js";
|
|
20
|
+
export { SCIENTIFIC_ABOVE, SCIENTIFIC_BELOW, axisLabeller, formatNumber, formatScientific, } from "./axisLabels.js";
|
|
21
|
+
export { MAXIMUM_DRIFT_STEPS, layoutAnnotationBoxes } from "./boxLayout.js";
|
|
22
|
+
export { DEFAULT_Y_AXIS_RULES, DEFAULT_ZOOM_GESTURES, sameChartDomain, } from "./chartDomain.js";
|
|
23
|
+
export { CHART_LAYERS, MARGIN, MINIMUM_PLOT_SIDE, SHARED_AXIS_MARGIN, plotRect, } from "./chartGeometry.js";
|
|
24
|
+
export { CHART_PANE_ATTRIBUTE } from "./chartPane.js";
|
|
25
|
+
export { CHART_COLORS, CHART_FONT, LABEL_HALO, LABEL_QUIET, PEAK_LABEL, } from "./chartTheme.js";
|
|
26
|
+
export { guidePlacement } from "./guidePlacement.js";
|
|
27
|
+
export { labelStackBaselines } from "./labelStack.js";
|
|
28
|
+
export { CLOSE_COLUMN, MAXIMUM_CHARACTERS, PADDING, ROW_HEIGHT, SWATCH, hiddenLabel, legendBox, legendLabel, legendNames, } from "./legendBox.js";
|
|
29
|
+
export { selectionRectangle } from "./selectionGeometry.js";
|
|
30
|
+
export { ALL_SPECTRUM_COLORS, EXTRA_SPECTRUM_COLORS, SPECTRUM_COLORS, nextSpectrumColor, } from "./spectrumColor.js";
|
|
31
|
+
export { FOOT_FURNITURE, FOOT_MINIMUM, STACKED_MINIMUM, STACK_LIMIT, stackCapacity, stackShares, } from "./stackCapacity.js";
|
|
32
|
+
export { svgPointAt } from "./svgPoint.js";
|
|
33
|
+
export { areaPath, profilePath, stickPath } from "./tracePath.js";
|
|
34
|
+
export { READOUT_GAP, READOUT_LINES, READOUT_WIDTH, readoutPlacement, } from "./trackerReadout.js";
|
|
35
|
+
export { INITIAL_VIEW, MAXIMUM_CONTENT_SCALE, MAXIMUM_ZOOM, MINIMUM_ZOOM, baseViewBox, clampZoom, magnificationOf, panBy, viewBoxAttribute, viewBoxOf, zoomAbout, zoomToAboutCentre, } from "./viewTransform.js";
|
|
36
|
+
export { MINIMUM_DRAG, releasedBeyondBaseline, scaledYAxis, zoomSelection, zoomedDomain, } from "./zoomDomain.js";
|
|
20
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/chart/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,EACL,cAAc,EACd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AAgB,CAAC;AAElE,OAAO,EACL,WAAW,EACX,aAAa,EACb,aAAa,EACb,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,SAAS,EACT,eAAe,EACf,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,aAAa,EACb,YAAY,GACb,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where each line of a stack of labels above a feature is written.
|
|
3
|
+
*
|
|
4
|
+
* The arithmetic only, and none of the wording: what a stack *says* is the one
|
|
5
|
+
* thing every viewer answers differently — a mass peak carries its intensity,
|
|
6
|
+
* its m/z and its charge, an infrared band carries its wavenumber and the group
|
|
7
|
+
* it is assigned to — while where the lines go is the same sum in both, and the
|
|
8
|
+
* same sum again for the reflected half of a mirrored chart.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Where each line of a stack is written, in pixels down the SVG.
|
|
12
|
+
*
|
|
13
|
+
* A stack that would run off the top of the plot is **pushed back down** rather
|
|
14
|
+
* than clipped: the tallest peak of a spectrum is the one most worth naming, its
|
|
15
|
+
* tip is by construction near the top of the window, and a label cut in half by
|
|
16
|
+
* the plot edge names nothing. Sliding it down puts it over the feature instead,
|
|
17
|
+
* which is the one place a reader already knows to look.
|
|
18
|
+
* @param tip - Where the top of the feature is, in pixels down the SVG.
|
|
19
|
+
* @param lineCount - How many lines the stack has.
|
|
20
|
+
* @param bounds - `[top, bottom]` of the plot in pixels, which no line may pass.
|
|
21
|
+
* @param below - Whether the stack hangs under the feature, which is what the
|
|
22
|
+
* mirrored half of a chart wants — above its sticks is the other spectrum.
|
|
23
|
+
* Defaults to `false`.
|
|
24
|
+
* @returns The baseline of each line, in the order the lines were given.
|
|
25
|
+
*/
|
|
26
|
+
export declare function labelStackBaselines(tip: number, lineCount: number, bounds: readonly [number, number], below?: boolean): Float64Array;
|
|
27
|
+
//# sourceMappingURL=labelStack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"labelStack.d.ts","sourceRoot":"","sources":["../../../src/chart/core/labelStack.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,KAAK,UAAQ,GACZ,YAAY,CA0Bd"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where each line of a stack of labels above a feature is written.
|
|
3
|
+
*
|
|
4
|
+
* The arithmetic only, and none of the wording: what a stack *says* is the one
|
|
5
|
+
* thing every viewer answers differently — a mass peak carries its intensity,
|
|
6
|
+
* its m/z and its charge, an infrared band carries its wavenumber and the group
|
|
7
|
+
* it is assigned to — while where the lines go is the same sum in both, and the
|
|
8
|
+
* same sum again for the reflected half of a mirrored chart.
|
|
9
|
+
*/
|
|
10
|
+
import { PEAK_LABEL } from "./chartTheme.js";
|
|
11
|
+
/**
|
|
12
|
+
* Where each line of a stack is written, in pixels down the SVG.
|
|
13
|
+
*
|
|
14
|
+
* A stack that would run off the top of the plot is **pushed back down** rather
|
|
15
|
+
* than clipped: the tallest peak of a spectrum is the one most worth naming, its
|
|
16
|
+
* tip is by construction near the top of the window, and a label cut in half by
|
|
17
|
+
* the plot edge names nothing. Sliding it down puts it over the feature instead,
|
|
18
|
+
* which is the one place a reader already knows to look.
|
|
19
|
+
* @param tip - Where the top of the feature is, in pixels down the SVG.
|
|
20
|
+
* @param lineCount - How many lines the stack has.
|
|
21
|
+
* @param bounds - `[top, bottom]` of the plot in pixels, which no line may pass.
|
|
22
|
+
* @param below - Whether the stack hangs under the feature, which is what the
|
|
23
|
+
* mirrored half of a chart wants — above its sticks is the other spectrum.
|
|
24
|
+
* Defaults to `false`.
|
|
25
|
+
* @returns The baseline of each line, in the order the lines were given.
|
|
26
|
+
*/
|
|
27
|
+
export function labelStackBaselines(tip, lineCount, bounds, below = false) {
|
|
28
|
+
const count = Number.isFinite(lineCount)
|
|
29
|
+
? Math.max(0, Math.floor(lineCount))
|
|
30
|
+
: 0;
|
|
31
|
+
const baselines = new Float64Array(count);
|
|
32
|
+
if (count === 0)
|
|
33
|
+
return baselines;
|
|
34
|
+
const { lineHeight, topPad } = PEAK_LABEL;
|
|
35
|
+
if (below) {
|
|
36
|
+
for (let line = 0; line < count; line++) {
|
|
37
|
+
baselines[line] = tip + topPad + (count - line) * lineHeight;
|
|
38
|
+
}
|
|
39
|
+
shift(baselines, Math.min(0, bounds[1] - baselines[0]));
|
|
40
|
+
return baselines;
|
|
41
|
+
}
|
|
42
|
+
for (let line = 0; line < count; line++) {
|
|
43
|
+
baselines[line] = tip - topPad - (count - 1 - line) * lineHeight;
|
|
44
|
+
}
|
|
45
|
+
// A baseline one line height below the top edge is what keeps the glyphs of
|
|
46
|
+
// the topmost line inside the plot rather than half over it.
|
|
47
|
+
shift(baselines, Math.max(0, bounds[0] + lineHeight - baselines[0]));
|
|
48
|
+
return baselines;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Move every baseline of a stack by the same amount.
|
|
52
|
+
* @param baselines - The baselines, written into.
|
|
53
|
+
* @param delta - How far down to move them; zero leaves them alone.
|
|
54
|
+
*/
|
|
55
|
+
function shift(baselines, delta) {
|
|
56
|
+
if (delta === 0)
|
|
57
|
+
return;
|
|
58
|
+
for (let line = 0; line < baselines.length; line++) {
|
|
59
|
+
baselines[line] = baselines[line] + delta;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=labelStack.js.map
|
|
@@ -0,0 +1 @@
|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AI,CAAC,GAAG,UAAU,CAAC;IACnE,CAAC;IACD,4EAA4E;IAC5E,6DAA6D;IAC7D,KAAK,CACH,SAAS,EACT,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,UAAU,GAAI,SAAS,CAAC,CAAC,CAAY,CAAC,CAC/D,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,SAAS,KAAK,CAAC,SAAuB,EAAE,KAAa;IACnD,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO;IACxB,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC;QACnD,SAAS,CAAC,IAAI,CAAC,GAAI,SAAS,CAAC,IAAI,CAAY,GAAG,KAAK,CAAC;IACxD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a legend sits, and where every one of its rows sits inside it.
|
|
3
|
+
*
|
|
4
|
+
* A legend whose rows carry a control is drawn **twice, in two technologies**,
|
|
5
|
+
* and that is what this module exists for. The picture has to be SVG, because
|
|
6
|
+
* an export clones the chart's own `SVGSVGElement` and anything living beside
|
|
7
|
+
* it in a `<div>` is missing from every figure while looking perfectly right on
|
|
8
|
+
* screen; a close cross has to be HTML, because an SVG `×` would be cloned into
|
|
9
|
+
* that same figure as a dead glyph, and a `pointerdown` on the SVG root is read
|
|
10
|
+
* as a chart gesture rather than as a click on a row. Two renderings of one box
|
|
11
|
+
* are two chances to place a row differently, so the arithmetic has exactly one
|
|
12
|
+
* owner and neither of them does any of its own — a cross half a row off the
|
|
13
|
+
* name beside it is a cross that closes the wrong trace.
|
|
14
|
+
*
|
|
15
|
+
* Everything is measured from character counts rather than from the DOM. The
|
|
16
|
+
* box is worked out during render, where a `getComputedTextLength` would need a
|
|
17
|
+
* layout pass that has not happened yet, and the exported clone gets no layout
|
|
18
|
+
* at all — so a legend that measured itself would come out a different size in
|
|
19
|
+
* the figure than on screen. `CHARACTER_WIDTH` is a conservative average
|
|
20
|
+
* advance for the face at `FONT_SIZE`: a name that overruns it by a character
|
|
21
|
+
* is a smaller problem than a picture that disagrees with itself.
|
|
22
|
+
*/
|
|
23
|
+
import type { PlotRect } from './chartGeometry.ts';
|
|
24
|
+
/** Where a legend sits, and where each of its rows sits inside it. */
|
|
25
|
+
export interface LegendBox {
|
|
26
|
+
/** The box's left edge, in the plot's own pixels. */
|
|
27
|
+
left: number;
|
|
28
|
+
/** Its top edge. */
|
|
29
|
+
top: number;
|
|
30
|
+
/** How wide it is. */
|
|
31
|
+
width: number;
|
|
32
|
+
/** How tall it is. */
|
|
33
|
+
height: number;
|
|
34
|
+
/** The rows it draws, in order. */
|
|
35
|
+
rows: readonly LegendRow[];
|
|
36
|
+
/** How many entries were left out, counted on a final row. 0 when none were. */
|
|
37
|
+
hidden: number;
|
|
38
|
+
}
|
|
39
|
+
/** One row of a legend, placed. */
|
|
40
|
+
export interface LegendRow {
|
|
41
|
+
/** Identity of the entry it draws. */
|
|
42
|
+
id: string;
|
|
43
|
+
/** The row's own top edge. */
|
|
44
|
+
top: number;
|
|
45
|
+
/** How tall it is. */
|
|
46
|
+
height: number;
|
|
47
|
+
/** The vertical middle of the row, which is what a swatch and a baseline sit on. */
|
|
48
|
+
middle: number;
|
|
49
|
+
}
|
|
50
|
+
/** What a legend has to know about an entry to give it room. */
|
|
51
|
+
export interface LegendBoxEntry {
|
|
52
|
+
/** Identity, which is what the list is keyed on. */
|
|
53
|
+
id: string;
|
|
54
|
+
/** What it is called. */
|
|
55
|
+
name: string;
|
|
56
|
+
/**
|
|
57
|
+
* A 1-based number written before the name.
|
|
58
|
+
* @default undefined
|
|
59
|
+
*/
|
|
60
|
+
index?: number;
|
|
61
|
+
/**
|
|
62
|
+
* A short remark written at the right of the row.
|
|
63
|
+
* @default undefined
|
|
64
|
+
*/
|
|
65
|
+
note?: string;
|
|
66
|
+
}
|
|
67
|
+
/** How a legend is measured. */
|
|
68
|
+
export interface LegendBoxOptions {
|
|
69
|
+
/**
|
|
70
|
+
* How many entries are named before the rest are counted instead.
|
|
71
|
+
* @default 8
|
|
72
|
+
*/
|
|
73
|
+
limit?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Whether a column is left at the right of each row for a control.
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
closable?: boolean;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Measure the legend a set of entries asks for, and place its rows.
|
|
82
|
+
*
|
|
83
|
+
* Top right of the plot, because that is where a trace leaves room: a curve
|
|
84
|
+
* rises from the baseline and the tallest peak is rarely at the right-hand
|
|
85
|
+
* edge. Over the plot rather than in a gutter beside it, so that naming the
|
|
86
|
+
* traces never narrows the measurement they are drawn in.
|
|
87
|
+
*
|
|
88
|
+
* Past `limit` the remaining entries are counted rather than named — a legend
|
|
89
|
+
* taller than the plot hides the measurement it is explaining, which is the
|
|
90
|
+
* failure a scrollbar in a legend admits to. The count is a row of its own, so
|
|
91
|
+
* it is paid for in `height` while staying out of `rows`: nothing draws a
|
|
92
|
+
* swatch or a cross for it, and it names no entry to key on.
|
|
93
|
+
* @param entries - The traces to name, in the order they are drawn. Only the
|
|
94
|
+
* first `limit` of them get a row; the rest are counted.
|
|
95
|
+
* @param plot - The plot the legend is placed against.
|
|
96
|
+
* @param options - How many are named, and whether a control column is kept.
|
|
97
|
+
* @returns The box and its rows, in the plot's own pixels.
|
|
98
|
+
*/
|
|
99
|
+
export declare function legendBox(entries: readonly LegendBoxEntry[], plot: PlotRect, options?: LegendBoxOptions): LegendBox;
|
|
100
|
+
/**
|
|
101
|
+
* What a row of the legend actually reads, index and all.
|
|
102
|
+
*
|
|
103
|
+
* The number goes in front of the name rather than beside it because the
|
|
104
|
+
* palette hands out six hues and a seventh trace legitimately repeats one, so
|
|
105
|
+
* the number is what tells two blue traces apart — and it has to be the first
|
|
106
|
+
* thing on the row for that to work while the eye is running down the column.
|
|
107
|
+
* Written here rather than at each drawing site so that whatever measured the
|
|
108
|
+
* row and whatever draws it agree on the string, to the character.
|
|
109
|
+
* @param entry - The entry the row names.
|
|
110
|
+
* @returns The text of the row, without its note.
|
|
111
|
+
*/
|
|
112
|
+
export declare function legendLabel(entry: LegendBoxEntry): string;
|
|
113
|
+
/**
|
|
114
|
+
* What the final row reads when entries were left out.
|
|
115
|
+
* @param hidden - How many were not named.
|
|
116
|
+
* @returns The text of that row.
|
|
117
|
+
*/
|
|
118
|
+
export declare function hiddenLabel(hidden: number): string;
|
|
119
|
+
/**
|
|
120
|
+
* The entries a legend actually draws a row for.
|
|
121
|
+
*
|
|
122
|
+
* Two rules in one answer, and three drawings depend on both of them agreeing:
|
|
123
|
+
* the SVG legend, the HTML row layer placed over it, and whatever else is
|
|
124
|
+
* written along the top of the same plot and has to keep clear of the box. A
|
|
125
|
+
* trace with no name is not given a row — an unnamed curve in a legend is a
|
|
126
|
+
* swatch and nothing else, which is worse than being left out — and below
|
|
127
|
+
* `minimumEntries` names no legend is drawn at all, since the axis title
|
|
128
|
+
* already says what a single curve is.
|
|
129
|
+
* @param entries - The traces, in the order they are drawn.
|
|
130
|
+
* @param minimumEntries - How few named traces are still worth a legend.
|
|
131
|
+
* @returns The entries that get a row, empty where none is drawn.
|
|
132
|
+
*/
|
|
133
|
+
export declare function legendNames<Entry extends LegendBoxEntry>(entries: readonly Entry[], minimumEntries?: number): Entry[];
|
|
134
|
+
/** The line of colour that stands for the curve. */
|
|
135
|
+
export declare const SWATCH = 14;
|
|
136
|
+
/** Between the swatch and the name, and between the name and a note. */
|
|
137
|
+
export declare const GAP = 5;
|
|
138
|
+
/** Inside the box, on every side. */
|
|
139
|
+
export declare const PADDING = 6;
|
|
140
|
+
/** One row of the legend. */
|
|
141
|
+
export declare const ROW_HEIGHT = 14;
|
|
142
|
+
/** Between the box and the edge of the plot. */
|
|
143
|
+
export declare const MARGIN = 6;
|
|
144
|
+
/** The face the names are written at. */
|
|
145
|
+
export declare const FONT_SIZE = 11;
|
|
146
|
+
/** About how wide one character is at that size. */
|
|
147
|
+
export declare const CHARACTER_WIDTH = 6.1;
|
|
148
|
+
/** The longest name the box is widened for; past it a name simply overruns. */
|
|
149
|
+
export declare const MAXIMUM_CHARACTERS = 28;
|
|
150
|
+
/** The strip kept at the right of a row for a control, when one is asked for. */
|
|
151
|
+
export declare const CLOSE_COLUMN = 12;
|
|
152
|
+
//# sourceMappingURL=legendBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legendBox.d.ts","sourceRoot":"","sources":["../../../src/chart/core/legendBox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,sEAAsE;AACtE,MAAM,WAAW,SAAS;IACxB,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,IAAI,EAAE,SAAS,SAAS,EAAE,CAAC;IAC3B,gFAAgF;IAChF,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,mCAAmC;AACnC,MAAM,WAAW,SAAS;IACxB,sCAAsC;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,gEAAgE;AAChE,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,MA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3
|
+
*
|
|
4
|
+
* A legend whose rows carry a control is drawn **twice, in two technologies**,
|
|
5
|
+
* and that is what this module exists for. The picture has to be SVG, because
|
|
6
|
+
* an export clones the chart's own `SVGSVGElement` and anything living beside
|
|
7
|
+
* it in a `<div>` is missing from every figure while looking perfectly right on
|
|
8
|
+
* screen; a close cross has to be HTML, because an SVG `×` would be cloned into
|
|
9
|
+
* that same figure as a dead glyph, and a `pointerdown` on the SVG root is read
|
|
10
|
+
* as a chart gesture rather than as a click on a row. Two renderings of one box
|
|
11
|
+
* are two chances to place a row differently, so the arithmetic has exactly one
|
|
12
|
+
* owner and neither of them does any of its own — a cross half a row off the
|
|
13
|
+
* name beside it is a cross that closes the wrong trace.
|
|
14
|
+
*
|
|
15
|
+
* Everything is measured from character counts rather than from the DOM. The
|
|
16
|
+
* box is worked out during render, where a `getComputedTextLength` would need a
|
|
17
|
+
* layout pass that has not happened yet, and the exported clone gets no layout
|
|
18
|
+
* at all — so a legend that measured itself would come out a different size in
|
|
19
|
+
* the figure than on screen. `CHARACTER_WIDTH` is a conservative average
|
|
20
|
+
* advance for the face at `FONT_SIZE`: a name that overruns it by a character
|
|
21
|
+
* is a smaller problem than a picture that disagrees with itself.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Measure the legend a set of entries asks for, and place its rows.
|
|
25
|
+
*
|
|
26
|
+
* Top right of the plot, because that is where a trace leaves room: a curve
|
|
27
|
+
* rises from the baseline and the tallest peak is rarely at the right-hand
|
|
28
|
+
* edge. Over the plot rather than in a gutter beside it, so that naming the
|
|
29
|
+
* traces never narrows the measurement they are drawn in.
|
|
30
|
+
*
|
|
31
|
+
* Past `limit` the remaining entries are counted rather than named — a legend
|
|
32
|
+
* taller than the plot hides the measurement it is explaining, which is the
|
|
33
|
+
* failure a scrollbar in a legend admits to. The count is a row of its own, so
|
|
34
|
+
* it is paid for in `height` while staying out of `rows`: nothing draws a
|
|
35
|
+
* swatch or a cross for it, and it names no entry to key on.
|
|
36
|
+
* @param entries - The traces to name, in the order they are drawn. Only the
|
|
37
|
+
* first `limit` of them get a row; the rest are counted.
|
|
38
|
+
* @param plot - The plot the legend is placed against.
|
|
39
|
+
* @param options - How many are named, and whether a control column is kept.
|
|
40
|
+
* @returns The box and its rows, in the plot's own pixels.
|
|
41
|
+
*/
|
|
42
|
+
export function legendBox(entries, plot, options = {}) {
|
|
43
|
+
const { limit = 8, closable = false } = options;
|
|
44
|
+
// Never taller than the plot it is drawn over. A legend covers the
|
|
45
|
+
// measurement it explains, so one that overran its plot would hide the axis
|
|
46
|
+
// under it — and on a pane of a stack that axis is the only one the whole
|
|
47
|
+
// stack has. The surplus is counted on a last row exactly as `limit`'s is, so
|
|
48
|
+
// nothing goes missing; it is only no longer named.
|
|
49
|
+
const room = Math.max(1, Math.floor((plot.height - MARGIN * 2 - PADDING * 2) / ROW_HEIGHT));
|
|
50
|
+
const asked = Math.min(Math.max(0, limit), entries.length);
|
|
51
|
+
// A row is spent on the count whenever anything is left out, so the test is
|
|
52
|
+
// against `asked + 1` in that case — otherwise a legend of exactly `room`
|
|
53
|
+
// names would grow a counted row and overflow by one after all.
|
|
54
|
+
const overflows = asked < entries.length ? asked + 1 > room : asked > room;
|
|
55
|
+
const named = overflows ? Math.max(0, room - 1) : asked;
|
|
56
|
+
const shown = entries.slice(0, named);
|
|
57
|
+
const hidden = entries.length - shown.length;
|
|
58
|
+
const width = boxWidth(shown, hidden, closable);
|
|
59
|
+
const rowCount = shown.length + (hidden > 0 ? 1 : 0);
|
|
60
|
+
const height = rowCount * ROW_HEIGHT + PADDING * 2;
|
|
61
|
+
const left = plot.left + plot.width - width - MARGIN;
|
|
62
|
+
const top = plot.top + MARGIN;
|
|
63
|
+
const rows = [];
|
|
64
|
+
for (const [index, entry] of shown.entries()) {
|
|
65
|
+
const rowTop = top + PADDING + index * ROW_HEIGHT;
|
|
66
|
+
rows.push({
|
|
67
|
+
id: entry.id,
|
|
68
|
+
top: rowTop,
|
|
69
|
+
height: ROW_HEIGHT,
|
|
70
|
+
middle: rowTop + ROW_HEIGHT / 2,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return { left, top, width, height, rows, hidden };
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* What a row of the legend actually reads, index and all.
|
|
77
|
+
*
|
|
78
|
+
* The number goes in front of the name rather than beside it because the
|
|
79
|
+
* palette hands out six hues and a seventh trace legitimately repeats one, so
|
|
80
|
+
* the number is what tells two blue traces apart — and it has to be the first
|
|
81
|
+
* thing on the row for that to work while the eye is running down the column.
|
|
82
|
+
* Written here rather than at each drawing site so that whatever measured the
|
|
83
|
+
* row and whatever draws it agree on the string, to the character.
|
|
84
|
+
* @param entry - The entry the row names.
|
|
85
|
+
* @returns The text of the row, without its note.
|
|
86
|
+
*/
|
|
87
|
+
export function legendLabel(entry) {
|
|
88
|
+
return entry.index === undefined
|
|
89
|
+
? entry.name
|
|
90
|
+
: `${entry.index}${INDEX_SEPARATOR}${entry.name}`;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* What the final row reads when entries were left out.
|
|
94
|
+
* @param hidden - How many were not named.
|
|
95
|
+
* @returns The text of that row.
|
|
96
|
+
*/
|
|
97
|
+
export function hiddenLabel(hidden) {
|
|
98
|
+
return `+ ${hidden} more`;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The entries a legend actually draws a row for.
|
|
102
|
+
*
|
|
103
|
+
* Two rules in one answer, and three drawings depend on both of them agreeing:
|
|
104
|
+
* the SVG legend, the HTML row layer placed over it, and whatever else is
|
|
105
|
+
* written along the top of the same plot and has to keep clear of the box. A
|
|
106
|
+
* trace with no name is not given a row — an unnamed curve in a legend is a
|
|
107
|
+
* swatch and nothing else, which is worse than being left out — and below
|
|
108
|
+
* `minimumEntries` names no legend is drawn at all, since the axis title
|
|
109
|
+
* already says what a single curve is.
|
|
110
|
+
* @param entries - The traces, in the order they are drawn.
|
|
111
|
+
* @param minimumEntries - How few named traces are still worth a legend.
|
|
112
|
+
* @returns The entries that get a row, empty where none is drawn.
|
|
113
|
+
*/
|
|
114
|
+
export function legendNames(entries, minimumEntries = 2) {
|
|
115
|
+
const named = entries.filter((entry) => entry.name !== '');
|
|
116
|
+
return named.length < minimumEntries ? [] : named;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* How wide the box has to be to hold the longest row it is drawing.
|
|
120
|
+
*
|
|
121
|
+
* The name column is sized on the longest label — the counted row included,
|
|
122
|
+
* since it is written in the same column — and clamped at
|
|
123
|
+
* `MAXIMUM_CHARACTERS`, past which a name simply overruns rather than dragging
|
|
124
|
+
* the box across the plot it is standing on. A note is a column of its own at
|
|
125
|
+
* the right, so a long note never pushes the names about, and the control
|
|
126
|
+
* column is a fixed strip because a cross is one glyph whatever the row says.
|
|
127
|
+
* @param entries - The rows being drawn.
|
|
128
|
+
* @param hidden - How many were left out, which the final row counts.
|
|
129
|
+
* @param closable - Whether a control column is kept at the right.
|
|
130
|
+
* @returns The width in pixels.
|
|
131
|
+
*/
|
|
132
|
+
function boxWidth(entries, hidden, closable) {
|
|
133
|
+
let longest = hidden > 0 ? hiddenLabel(hidden).length : 0;
|
|
134
|
+
let longestNote = 0;
|
|
135
|
+
for (const entry of entries) {
|
|
136
|
+
const label = legendLabel(entry).length;
|
|
137
|
+
if (label > longest)
|
|
138
|
+
longest = label;
|
|
139
|
+
const note = entry.note === undefined ? 0 : entry.note.length;
|
|
140
|
+
if (note > longestNote)
|
|
141
|
+
longestNote = note;
|
|
142
|
+
}
|
|
143
|
+
const text = Math.min(longest, MAXIMUM_CHARACTERS) * CHARACTER_WIDTH;
|
|
144
|
+
const note = longestNote === 0
|
|
145
|
+
? 0
|
|
146
|
+
: GAP + Math.min(longestNote, MAXIMUM_CHARACTERS) * CHARACTER_WIDTH;
|
|
147
|
+
return (PADDING * 2 + SWATCH + GAP + text + note + (closable ? CLOSE_COLUMN : 0));
|
|
148
|
+
}
|
|
149
|
+
/** The line of colour that stands for the curve. */
|
|
150
|
+
export const SWATCH = 14;
|
|
151
|
+
/** Between the swatch and the name, and between the name and a note. */
|
|
152
|
+
export const GAP = 5;
|
|
153
|
+
/** Inside the box, on every side. */
|
|
154
|
+
export const PADDING = 6;
|
|
155
|
+
/** One row of the legend. */
|
|
156
|
+
export const ROW_HEIGHT = 14;
|
|
157
|
+
/** Between the box and the edge of the plot. */
|
|
158
|
+
export const MARGIN = 6;
|
|
159
|
+
/** The face the names are written at. */
|
|
160
|
+
export const FONT_SIZE = 11;
|
|
161
|
+
/** About how wide one character is at that size. */
|
|
162
|
+
export const CHARACTER_WIDTH = 6.1;
|
|
163
|
+
/** The longest name the box is widened for; past it a name simply overruns. */
|
|
164
|
+
export const MAXIMUM_CHARACTERS = 28;
|
|
165
|
+
/** The strip kept at the right of a row for a control, when one is asked for. */
|
|
166
|
+
export const CLOSE_COLUMN = 12;
|
|
167
|
+
/** Between the index and the name it numbers. */
|
|
168
|
+
const INDEX_SEPARATOR = ' · ';
|
|
169
|
+
//# sourceMappingURL=legendBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legendBox.js","sourceRoot":"","sources":["../../../src/chart/core/legendBox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAgEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,SAAS,CACvB,OAAkC,EAClC,IAAc,EACd,UAA4B,EAAE;IAE9B,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAChD,mEAAmE;IACnE,4EAA4E;IAC5E,0EAA0E;IAC1E,8EAA8E;IAC9E,oDAAoD;IACpD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CACnB,CAAC,EACD,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC,GAAG,UAAU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M,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AAEnC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,iFAAiF;AACjF,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,iDAAiD;AACjD,MAAM,eAAe,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rectangle a drag sweeps out, in the pixels it is drawn in.
|
|
3
|
+
*
|
|
4
|
+
* The preview and the release are two readings of one gesture, and they have to
|
|
5
|
+
* agree: a rectangle that promises a window the release then refuses teaches a
|
|
6
|
+
* user that the chart is unreliable, which is a far more expensive mistake than
|
|
7
|
+
* a preview that is a pixel out. So the same two tests decide both — the drag is
|
|
8
|
+
* pulled back inside the plot and measured against `MINIMUM_DRAG` here exactly
|
|
9
|
+
* as `zoomedDomain` does it, and the height comes from the answer
|
|
10
|
+
* `zoomSelection` already worked out rather than from a second one.
|
|
11
|
+
*/
|
|
12
|
+
import type { PlotRect } from './chartGeometry.ts';
|
|
13
|
+
import type { ZoomSelection } from './zoomDomain.ts';
|
|
14
|
+
/** A rectangle in the user units of the SVG. */
|
|
15
|
+
export interface SelectionRectangle {
|
|
16
|
+
/** Its left edge. */
|
|
17
|
+
x: number;
|
|
18
|
+
/** Its top edge. */
|
|
19
|
+
y: number;
|
|
20
|
+
/** How wide it is. */
|
|
21
|
+
width: number;
|
|
22
|
+
/** How tall it is. */
|
|
23
|
+
height: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The rectangle to draw for a drag being made.
|
|
27
|
+
*
|
|
28
|
+
* A drag that takes the y axis with it is drawn at the height of the drag
|
|
29
|
+
* itself, and one that asks for the x axis alone spans the whole plot.
|
|
30
|
+
* That is the gesture announcing itself before the button is let go: the
|
|
31
|
+
* rectangle changing shape as the pointer crosses the baseline is the only
|
|
32
|
+
* warning a user gets that the release is about to move both axes, and it is one
|
|
33
|
+
* they can still act on.
|
|
34
|
+
*
|
|
35
|
+
* A drag too short to zoom draws nothing at all. Below `MINIMUM_DRAG` the
|
|
36
|
+
* release does nothing — most clicks made on a trackpad wobble by a pixel or two
|
|
37
|
+
* — and a rectangle flashing up on every click would say that something
|
|
38
|
+
* happened.
|
|
39
|
+
* @param selection - The drag being made, `null` when none is.
|
|
40
|
+
* @param plot - Where the plot sits inside the SVG, which the drag is confined
|
|
41
|
+
* to.
|
|
42
|
+
* @returns The rectangle, `null` when there is nothing to draw.
|
|
43
|
+
*/
|
|
44
|
+
export declare function selectionRectangle(selection: ZoomSelection | null, plot: PlotRect): SelectionRectangle | null;
|
|
45
|
+
//# sourceMappingURL=selectionGeometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectionGeometry.d.ts","sourceRoot":"","sources":["../../../src/chart/core/selectionGeometry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,gDAAgD;AAChD,MAAM,WAAW,kBAAkB;IACjC,qBAAqB;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,oBAAoB;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,aAAa,GAAG,IAAI,EAC/B,IAAI,EAAE,QAAQ,GACb,kBAAkB,GAAG,IAAI,CAe3B"}
|