react-cheminfo 0.75.0 → 0.77.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 +141 -31
- package/lib/card/core/cardAddress.d.ts +19 -2
- package/lib/card/core/cardAddress.d.ts.map +1 -1
- package/lib/card/core/cardAddress.js +35 -2
- package/lib/card/core/cardAddress.js.map +1 -1
- package/lib/card/core/cardPageUrl.d.ts +7 -1
- package/lib/card/core/cardPageUrl.d.ts.map +1 -1
- package/lib/card/core/cardPageUrl.js +4 -2
- package/lib/card/core/cardPageUrl.js.map +1 -1
- package/lib/card/core/index.d.ts +1 -1
- package/lib/card/core/index.d.ts.map +1 -1
- package/lib/card/core/index.js +1 -1
- package/lib/card/core/index.js.map +1 -1
- package/lib/credits/core/credits.d.ts +30 -0
- package/lib/credits/core/credits.d.ts.map +1 -1
- package/lib/credits/core/credits.js +35 -0
- package/lib/credits/core/credits.js.map +1 -1
- package/lib/download/core/copySvg.d.ts +12 -0
- package/lib/download/core/copySvg.d.ts.map +1 -0
- package/lib/download/core/copySvg.js +38 -0
- package/lib/download/core/copySvg.js.map +1 -0
- package/lib/download/core/downloadFigure.d.ts +12 -1
- package/lib/download/core/downloadFigure.d.ts.map +1 -1
- package/lib/download/core/downloadFigure.js +21 -0
- package/lib/download/core/downloadFigure.js.map +1 -1
- package/lib/download/core/figureDpi.d.ts +59 -0
- package/lib/download/core/figureDpi.d.ts.map +1 -0
- package/lib/download/core/figureDpi.js +75 -0
- package/lib/download/core/figureDpi.js.map +1 -0
- package/lib/download/core/figurePng.d.ts +4 -1
- package/lib/download/core/figurePng.d.ts.map +1 -1
- package/lib/download/core/figurePng.js +11 -2
- package/lib/download/core/figurePng.js.map +1 -1
- package/lib/download/core/index.d.ts +5 -1
- package/lib/download/core/index.d.ts.map +1 -1
- package/lib/download/core/index.js +4 -1
- package/lib/download/core/index.js.map +1 -1
- package/lib/download/core/pngDpi.d.ts +22 -0
- package/lib/download/core/pngDpi.d.ts.map +1 -0
- package/lib/download/core/pngDpi.js +79 -0
- package/lib/download/core/pngDpi.js.map +1 -0
- package/lib/download/ui/FigureDownloadPanel.d.ts +13 -0
- package/lib/download/ui/FigureDownloadPanel.d.ts.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.js +18 -34
- package/lib/download/ui/FigureDownloadPanel.js.map +1 -1
- package/lib/download/ui/figureDownloadHint.d.ts +5 -0
- package/lib/download/ui/figureDownloadHint.d.ts.map +1 -1
- package/lib/download/ui/figureDownloadHint.js +8 -0
- package/lib/download/ui/figureDownloadHint.js.map +1 -1
- package/lib/download/ui/figureDownloadOptions.d.ts +84 -0
- package/lib/download/ui/figureDownloadOptions.d.ts.map +1 -0
- package/lib/download/ui/figureDownloadOptions.js +2 -0
- package/lib/download/ui/figureDownloadOptions.js.map +1 -0
- package/lib/download/ui/resolutionChoices.d.ts +27 -0
- package/lib/download/ui/resolutionChoices.d.ts.map +1 -0
- package/lib/download/ui/resolutionChoices.js +48 -0
- package/lib/download/ui/resolutionChoices.js.map +1 -0
- package/lib/download/ui/useFigureActions.d.ts +4 -1
- package/lib/download/ui/useFigureActions.d.ts.map +1 -1
- package/lib/download/ui/useFigureActions.js +17 -8
- package/lib/download/ui/useFigureActions.js.map +1 -1
- package/lib/download/ui/useFigureDownload.d.ts +2 -55
- package/lib/download/ui/useFigureDownload.d.ts.map +1 -1
- package/lib/download/ui/useFigureDownload.js +45 -13
- package/lib/download/ui/useFigureDownload.js.map +1 -1
- package/lib/ecosystem/core/sites.d.ts.map +1 -1
- package/lib/ecosystem/core/sites.js +14 -0
- package/lib/ecosystem/core/sites.js.map +1 -1
- package/lib/ecosystem/core/types.d.ts +1 -1
- package/lib/ecosystem/core/types.d.ts.map +1 -1
- package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
- package/lib/ecosystem/ui/glyphs.js +3 -0
- package/lib/ecosystem/ui/glyphs.js.map +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/ir/core/bandAssignments.d.ts.map +1 -1
- package/lib/ir/core/bandAssignments.js +27 -0
- package/lib/ir/core/bandAssignments.js.map +1 -1
- package/lib/ir/ui/BandRow.d.ts +4 -4
- package/lib/ir/ui/BandRow.d.ts.map +1 -1
- package/lib/ir/ui/BandRow.js +41 -14
- package/lib/ir/ui/BandRow.js.map +1 -1
- package/lib/locales/de.json +32 -1
- package/lib/locales/en.json +32 -1
- package/lib/locales/es.json +32 -1
- package/lib/locales/fr.json +32 -1
- package/lib/locales/it.json +32 -1
- package/lib/molecule3d/ui/Molecule3DStage.d.ts +4 -33
- package/lib/molecule3d/ui/Molecule3DStage.d.ts.map +1 -1
- package/lib/molecule3d/ui/Molecule3DStage.js +3 -37
- package/lib/molecule3d/ui/Molecule3DStage.js.map +1 -1
- package/lib/osiris/core/barGeometry.d.ts +42 -0
- package/lib/osiris/core/barGeometry.d.ts.map +1 -0
- package/lib/osiris/core/barGeometry.js +46 -0
- package/lib/osiris/core/barGeometry.js.map +1 -0
- package/lib/osiris/core/computeProperties.d.ts +42 -0
- package/lib/osiris/core/computeProperties.d.ts.map +1 -0
- package/lib/osiris/core/computeProperties.js +115 -0
- package/lib/osiris/core/computeProperties.js.map +1 -0
- package/lib/osiris/core/constants.d.ts +70 -0
- package/lib/osiris/core/constants.d.ts.map +1 -0
- package/lib/osiris/core/constants.js +99 -0
- package/lib/osiris/core/constants.js.map +1 -0
- package/lib/osiris/core/fitness.d.ts +32 -0
- package/lib/osiris/core/fitness.d.ts.map +1 -0
- package/lib/osiris/core/fitness.js +48 -0
- package/lib/osiris/core/fitness.js.map +1 -0
- package/lib/osiris/core/index.d.ts +29 -0
- package/lib/osiris/core/index.d.ts.map +1 -0
- package/lib/osiris/core/index.js +19 -0
- package/lib/osiris/core/index.js.map +1 -0
- package/lib/osiris/core/poolSize.d.ts +17 -0
- package/lib/osiris/core/poolSize.d.ts.map +1 -0
- package/lib/osiris/core/poolSize.js +22 -0
- package/lib/osiris/core/poolSize.js.map +1 -0
- package/lib/osiris/core/poolTypes.d.ts +140 -0
- package/lib/osiris/core/poolTypes.d.ts.map +1 -0
- package/lib/osiris/core/poolTypes.js +12 -0
- package/lib/osiris/core/poolTypes.js.map +1 -0
- package/lib/osiris/core/predictIdCode.d.ts +39 -0
- package/lib/osiris/core/predictIdCode.d.ts.map +1 -0
- package/lib/osiris/core/predictIdCode.js +54 -0
- package/lib/osiris/core/predictIdCode.js.map +1 -0
- package/lib/osiris/core/predictProtocol.d.ts +67 -0
- package/lib/osiris/core/predictProtocol.d.ts.map +1 -0
- package/lib/osiris/core/predictProtocol.js +29 -0
- package/lib/osiris/core/predictProtocol.js.map +1 -0
- package/lib/osiris/core/predictionPool.d.ts +23 -0
- package/lib/osiris/core/predictionPool.d.ts.map +1 -0
- package/lib/osiris/core/predictionPool.js +186 -0
- package/lib/osiris/core/predictionPool.js.map +1 -0
- package/lib/osiris/core/predictionQueue.d.ts +46 -0
- package/lib/osiris/core/predictionQueue.d.ts.map +1 -0
- package/lib/osiris/core/predictionQueue.js +57 -0
- package/lib/osiris/core/predictionQueue.js.map +1 -0
- package/lib/osiris/core/predictors.d.ts +62 -0
- package/lib/osiris/core/predictors.d.ts.map +1 -0
- package/lib/osiris/core/predictors.js +100 -0
- package/lib/osiris/core/predictors.js.map +1 -0
- package/lib/osiris/core/propertyKeys.d.ts +32 -0
- package/lib/osiris/core/propertyKeys.d.ts.map +1 -0
- package/lib/osiris/core/propertyKeys.js +44 -0
- package/lib/osiris/core/propertyKeys.js.map +1 -0
- package/lib/osiris/core/riskAppearance.d.ts +60 -0
- package/lib/osiris/core/riskAppearance.d.ts.map +1 -0
- package/lib/osiris/core/riskAppearance.js +59 -0
- package/lib/osiris/core/riskAppearance.js.map +1 -0
- package/lib/osiris/core/riskDetail.d.ts +22 -0
- package/lib/osiris/core/riskDetail.d.ts.map +1 -0
- package/lib/osiris/core/riskDetail.js +86 -0
- package/lib/osiris/core/riskDetail.js.map +1 -0
- package/lib/osiris/core/riskDetailRequest.d.ts +31 -0
- package/lib/osiris/core/riskDetailRequest.d.ts.map +1 -0
- package/lib/osiris/core/riskDetailRequest.js +49 -0
- package/lib/osiris/core/riskDetailRequest.js.map +1 -0
- package/lib/osiris/core/riskFindings.d.ts +26 -0
- package/lib/osiris/core/riskFindings.d.ts.map +1 -0
- package/lib/osiris/core/riskFindings.js +79 -0
- package/lib/osiris/core/riskFindings.js.map +1 -0
- package/lib/osiris/core/runPredictionJob.d.ts +20 -0
- package/lib/osiris/core/runPredictionJob.d.ts.map +1 -0
- package/lib/osiris/core/runPredictionJob.js +43 -0
- package/lib/osiris/core/runPredictionJob.js.map +1 -0
- package/lib/osiris/core/scales.d.ts +70 -0
- package/lib/osiris/core/scales.d.ts.map +1 -0
- package/lib/osiris/core/scales.js +185 -0
- package/lib/osiris/core/scales.js.map +1 -0
- package/lib/osiris/core/types.d.ts +91 -0
- package/lib/osiris/core/types.d.ts.map +1 -0
- package/lib/osiris/core/types.js +19 -0
- package/lib/osiris/core/types.js.map +1 -0
- package/lib/osiris/core/valuation.d.ts +28 -0
- package/lib/osiris/core/valuation.d.ts.map +1 -0
- package/lib/osiris/core/valuation.js +39 -0
- package/lib/osiris/core/valuation.js.map +1 -0
- package/lib/osiris/ui/PropertyBar.d.ts +27 -0
- package/lib/osiris/ui/PropertyBar.d.ts.map +1 -0
- package/lib/osiris/ui/PropertyBar.js +27 -0
- package/lib/osiris/ui/PropertyBar.js.map +1 -0
- package/lib/osiris/ui/PropertyPanel.d.ts +91 -0
- package/lib/osiris/ui/PropertyPanel.d.ts.map +1 -0
- package/lib/osiris/ui/PropertyPanel.js +77 -0
- package/lib/osiris/ui/PropertyPanel.js.map +1 -0
- package/lib/osiris/ui/PropertyRows.d.ts +40 -0
- package/lib/osiris/ui/PropertyRows.d.ts.map +1 -0
- package/lib/osiris/ui/PropertyRows.js +23 -0
- package/lib/osiris/ui/PropertyRows.js.map +1 -0
- package/lib/osiris/ui/RiskFindings.d.ts +43 -0
- package/lib/osiris/ui/RiskFindings.d.ts.map +1 -0
- package/lib/osiris/ui/RiskFindings.js +51 -0
- package/lib/osiris/ui/RiskFindings.js.map +1 -0
- package/lib/osiris/ui/RiskPanel.d.ts +46 -0
- package/lib/osiris/ui/RiskPanel.d.ts.map +1 -0
- package/lib/osiris/ui/RiskPanel.js +32 -0
- package/lib/osiris/ui/RiskPanel.js.map +1 -0
- package/lib/osiris/ui/RiskSquare.d.ts +51 -0
- package/lib/osiris/ui/RiskSquare.d.ts.map +1 -0
- package/lib/osiris/ui/RiskSquare.js +23 -0
- package/lib/osiris/ui/RiskSquare.js.map +1 -0
- package/lib/osiris/ui/index.d.ts +15 -0
- package/lib/osiris/ui/index.d.ts.map +1 -0
- package/lib/osiris/ui/index.js +8 -0
- package/lib/osiris/ui/index.js.map +1 -0
- package/lib/osiris/ui/usePredictions.d.ts +81 -0
- package/lib/osiris/ui/usePredictions.d.ts.map +1 -0
- package/lib/osiris/ui/usePredictions.js +102 -0
- package/lib/osiris/ui/usePredictions.js.map +1 -0
- package/lib/osiris-ui.d.ts +11 -0
- package/lib/osiris-ui.d.ts.map +1 -0
- package/lib/osiris-ui.js +11 -0
- package/lib/osiris-ui.js.map +1 -0
- package/lib/osiris.d.ts +17 -0
- package/lib/osiris.d.ts.map +1 -0
- package/lib/osiris.js +17 -0
- package/lib/osiris.js.map +1 -0
- package/lib/panel/ui/FilterInput.d.ts.map +1 -1
- package/lib/panel/ui/FilterInput.js +3 -1
- package/lib/panel/ui/FilterInput.js.map +1 -1
- package/lib/panel/ui/SidePanelItem.d.ts +39 -0
- package/lib/panel/ui/SidePanelItem.d.ts.map +1 -0
- package/lib/panel/ui/SidePanelItem.js +63 -0
- package/lib/panel/ui/SidePanelItem.js.map +1 -0
- package/lib/panel/ui/SidePanelStack.d.ts +11 -10
- package/lib/panel/ui/SidePanelStack.d.ts.map +1 -1
- package/lib/panel/ui/SidePanelStack.js +22 -15
- package/lib/panel/ui/SidePanelStack.js.map +1 -1
- package/lib/panel/ui/SpectrumColorSwatch.d.ts.map +1 -1
- package/lib/panel/ui/SpectrumColorSwatch.js +4 -2
- package/lib/panel/ui/SpectrumColorSwatch.js.map +1 -1
- package/lib/panel/ui/usePanelFolds.d.ts +35 -0
- package/lib/panel/ui/usePanelFolds.d.ts.map +1 -0
- package/lib/panel/ui/usePanelFolds.js +73 -0
- package/lib/panel/ui/usePanelFolds.js.map +1 -0
- package/lib/shared/ui/FullscreenStage.d.ts +43 -0
- package/lib/shared/ui/FullscreenStage.d.ts.map +1 -0
- package/lib/shared/ui/FullscreenStage.js +38 -0
- package/lib/shared/ui/FullscreenStage.js.map +1 -0
- package/lib/shared/ui/canFillScreen.d.ts +7 -0
- package/lib/shared/ui/canFillScreen.d.ts.map +1 -0
- package/lib/shared/ui/canFillScreen.js +9 -0
- package/lib/shared/ui/canFillScreen.js.map +1 -0
- package/lib/shared/ui/index.d.ts +3 -0
- package/lib/shared/ui/index.d.ts.map +1 -1
- package/lib/shared/ui/index.js +2 -0
- package/lib/shared/ui/index.js.map +1 -1
- package/lib/split/ui/splitPanes.d.ts +3 -3
- package/lib/split/ui/splitPanes.js +1 -1
- package/lib/structure/core/structureNotations.d.ts +8 -1
- package/lib/structure/core/structureNotations.d.ts.map +1 -1
- package/lib/structure/core/structureNotations.js +14 -8
- package/lib/structure/core/structureNotations.js.map +1 -1
- package/lib/structure/ui/CardStructure.d.ts +43 -0
- package/lib/structure/ui/CardStructure.d.ts.map +1 -0
- package/lib/structure/ui/CardStructure.js +28 -0
- package/lib/structure/ui/CardStructure.js.map +1 -0
- package/lib/structure/ui/StructureExportPanel.d.ts +8 -0
- package/lib/structure/ui/StructureExportPanel.d.ts.map +1 -1
- package/lib/structure/ui/StructureExportPanel.js +9 -4
- package/lib/structure/ui/StructureExportPanel.js.map +1 -1
- package/lib/structure/ui/StructurePicturePane.d.ts +1 -1
- package/lib/structure/ui/StructurePicturePane.d.ts.map +1 -1
- package/lib/structure/ui/StructurePicturePane.js +5 -2
- package/lib/structure/ui/StructurePicturePane.js.map +1 -1
- package/lib/structure/ui/index.d.ts +3 -0
- package/lib/structure/ui/index.d.ts.map +1 -1
- package/lib/structure/ui/index.js +1 -0
- package/lib/structure/ui/index.js.map +1 -1
- package/package.json +4 -1
- package/src/card/core/cardAddress.ts +39 -3
- package/src/card/core/cardPageUrl.ts +10 -3
- package/src/card/core/index.ts +7 -1
- package/src/credits/core/credits.ts +40 -0
- package/src/download/core/copySvg.ts +40 -0
- package/src/download/core/downloadFigure.ts +26 -1
- package/src/download/core/figureDpi.ts +94 -0
- package/src/download/core/figurePng.ts +11 -2
- package/src/download/core/index.ts +14 -1
- package/src/download/core/pngDpi.ts +84 -0
- package/src/download/ui/FigureDownloadPanel.tsx +41 -51
- package/src/download/ui/figureDownloadHint.ts +13 -0
- package/src/download/ui/figureDownloadOptions.ts +85 -0
- package/src/download/ui/resolutionChoices.ts +67 -0
- package/src/download/ui/useFigureActions.ts +24 -9
- package/src/download/ui/useFigureDownload.tsx +57 -71
- package/src/ecosystem/core/sites.ts +14 -0
- package/src/ecosystem/core/types.ts +2 -1
- package/src/ecosystem/ui/glyphs.tsx +20 -0
- package/src/ir/core/bandAssignments.ts +27 -0
- package/src/ir/ui/BandRow.tsx +84 -26
- package/src/locales/de.json +32 -1
- package/src/locales/en.json +32 -1
- package/src/locales/es.json +32 -1
- package/src/locales/fr.json +32 -1
- package/src/locales/it.json +32 -1
- package/src/molecule3d/ui/Molecule3DStage.tsx +4 -88
- package/src/osiris/core/barGeometry.ts +74 -0
- package/src/osiris/core/computeProperties.ts +175 -0
- package/src/osiris/core/constants.ts +110 -0
- package/src/osiris/core/fitness.ts +59 -0
- package/src/osiris/core/index.ts +78 -0
- package/src/osiris/core/poolSize.ts +24 -0
- package/src/osiris/core/poolTypes.ts +140 -0
- package/src/osiris/core/predictIdCode.ts +69 -0
- package/src/osiris/core/predictProtocol.ts +78 -0
- package/src/osiris/core/predictionPool.ts +237 -0
- package/src/osiris/core/predictionQueue.ts +89 -0
- package/src/osiris/core/predictors.ts +142 -0
- package/src/osiris/core/propertyKeys.ts +54 -0
- package/src/osiris/core/riskAppearance.ts +86 -0
- package/src/osiris/core/riskDetail.ts +120 -0
- package/src/osiris/core/riskDetailRequest.ts +64 -0
- package/src/osiris/core/riskFindings.ts +92 -0
- package/src/osiris/core/runPredictionJob.ts +49 -0
- package/src/osiris/core/scales.ts +236 -0
- package/src/osiris/core/types.ts +103 -0
- package/src/osiris/core/valuation.ts +44 -0
- package/src/osiris/ui/PropertyBar.tsx +77 -0
- package/src/osiris/ui/PropertyPanel.tsx +227 -0
- package/src/osiris/ui/PropertyRows.tsx +92 -0
- package/src/osiris/ui/RiskFindings.tsx +137 -0
- package/src/osiris/ui/RiskPanel.tsx +81 -0
- package/src/osiris/ui/RiskSquare.tsx +108 -0
- package/src/osiris/ui/index.ts +17 -0
- package/src/osiris/ui/usePredictions.ts +194 -0
- package/src/osiris-ui.ts +11 -0
- package/src/osiris.ts +17 -0
- package/src/panel/ui/FilterInput.tsx +4 -1
- package/src/panel/ui/SidePanelItem.tsx +162 -0
- package/src/panel/ui/SidePanelStack.tsx +29 -36
- package/src/panel/ui/SpectrumColorSwatch.tsx +5 -3
- package/src/panel/ui/usePanelFolds.ts +103 -0
- package/src/shared/ui/FullscreenStage.tsx +96 -0
- package/src/shared/ui/canFillScreen.ts +8 -0
- package/src/shared/ui/index.ts +6 -0
- package/src/split/ui/splitPanes.tsx +4 -4
- package/src/structure/core/structureNotations.ts +25 -8
- package/src/structure/ui/CardStructure.tsx +76 -0
- package/src/structure/ui/StructureExportPanel.tsx +23 -4
- package/src/structure/ui/StructurePicturePane.tsx +14 -1
- package/src/structure/ui/index.ts +6 -0
- package/styles/chrome.css +3 -3
- package/styles/osiris.css +339 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Which panels of a stack are folded, and the gestures that change that. */
|
|
2
|
+
export interface PanelFolds {
|
|
3
|
+
/**
|
|
4
|
+
* Whether a panel shows its body.
|
|
5
|
+
* @param id - The panel.
|
|
6
|
+
* @returns False while it is folded away.
|
|
7
|
+
*/
|
|
8
|
+
isOpen: (id: string) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Fold a panel away, or unfold it.
|
|
11
|
+
* @param id - The panel.
|
|
12
|
+
* @param open - Whether it shows its body.
|
|
13
|
+
*/
|
|
14
|
+
setOpen: (id: string, open: boolean) => void;
|
|
15
|
+
/** The one panel left unfolded among several, or null. */
|
|
16
|
+
focused: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Focus on a panel: unfold it and fold every other one, or, when it is
|
|
19
|
+
* already in focus, unfold them all again.
|
|
20
|
+
* @param id - The panel.
|
|
21
|
+
*/
|
|
22
|
+
toggleFocus: (id: string) => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The folds of a stack of panels, kept by the stack rather than by each panel
|
|
26
|
+
* so that one panel can be focused — every other one folded — and the focus
|
|
27
|
+
* undone.
|
|
28
|
+
*
|
|
29
|
+
* A panel closed while folded comes back unfolded when it is opened again: a
|
|
30
|
+
* reader reopening a panel from the rail is asking to see it.
|
|
31
|
+
* @param openIds - The panels in the stack, in the order they are drawn.
|
|
32
|
+
* @returns The folds.
|
|
33
|
+
*/
|
|
34
|
+
export declare function usePanelFolds(openIds: readonly string[]): PanelFolds;
|
|
35
|
+
//# sourceMappingURL=usePanelFolds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePanelFolds.d.ts","sourceRoot":"","sources":["../../../src/panel/ui/usePanelFolds.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IAChC;;;;OAIG;IACH,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,0DAA0D;IAC1D,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;;OAIG;IACH,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAID;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,CA0BpE"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
const NOTHING_FOLDED = new Set();
|
|
3
|
+
/**
|
|
4
|
+
* The folds of a stack of panels, kept by the stack rather than by each panel
|
|
5
|
+
* so that one panel can be focused — every other one folded — and the focus
|
|
6
|
+
* undone.
|
|
7
|
+
*
|
|
8
|
+
* A panel closed while folded comes back unfolded when it is opened again: a
|
|
9
|
+
* reader reopening a panel from the rail is asking to see it.
|
|
10
|
+
* @param openIds - The panels in the stack, in the order they are drawn.
|
|
11
|
+
* @returns The folds.
|
|
12
|
+
*/
|
|
13
|
+
export function usePanelFolds(openIds) {
|
|
14
|
+
const [folded, setFolded] = useState(NOTHING_FOLDED);
|
|
15
|
+
const kept = keepOnly(folded, openIds);
|
|
16
|
+
if (kept !== folded)
|
|
17
|
+
setFolded(kept);
|
|
18
|
+
return {
|
|
19
|
+
isOpen: (id) => !kept.has(id),
|
|
20
|
+
setOpen: (id, open) => {
|
|
21
|
+
setFolded((previous) => {
|
|
22
|
+
if (previous.has(id) !== open)
|
|
23
|
+
return previous;
|
|
24
|
+
const next = new Set(previous);
|
|
25
|
+
if (open)
|
|
26
|
+
next.delete(id);
|
|
27
|
+
else
|
|
28
|
+
next.add(id);
|
|
29
|
+
return next;
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
focused: focusedPanel(openIds, kept),
|
|
33
|
+
toggleFocus: (id) => {
|
|
34
|
+
setFolded(focusedPanel(openIds, kept) === id
|
|
35
|
+
? NOTHING_FOLDED
|
|
36
|
+
: new Set(openIds.filter((other) => other !== id)));
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The folds of the panels still in the stack.
|
|
42
|
+
* @param folded - The panels folded.
|
|
43
|
+
* @param openIds - The panels in the stack.
|
|
44
|
+
* @returns `folded` itself when every one of them is still in the stack.
|
|
45
|
+
*/
|
|
46
|
+
function keepOnly(folded, openIds) {
|
|
47
|
+
for (const id of folded) {
|
|
48
|
+
if (!openIds.includes(id)) {
|
|
49
|
+
return new Set(openIds.filter((open) => folded.has(open)));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return folded;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The panel in focus: the only one unfolded, when there is another to fold.
|
|
56
|
+
* @param openIds - The panels in the stack.
|
|
57
|
+
* @param folded - The panels folded.
|
|
58
|
+
* @returns The panel, or null.
|
|
59
|
+
*/
|
|
60
|
+
function focusedPanel(openIds, folded) {
|
|
61
|
+
if (openIds.length < 2)
|
|
62
|
+
return null;
|
|
63
|
+
let unfolded = null;
|
|
64
|
+
for (const id of openIds) {
|
|
65
|
+
if (folded.has(id))
|
|
66
|
+
continue;
|
|
67
|
+
if (unfolded !== null)
|
|
68
|
+
return null;
|
|
69
|
+
unfolded = id;
|
|
70
|
+
}
|
|
71
|
+
return unfolded;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=usePanelFolds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePanelFolds.js","sourceRoot":"","sources":["../../../src/panel/ui/usePanelFolds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AA0BjC,MAAM,cAAc,GAAwB,IAAI,GAAG,EAAE,CAAC;AAEtD;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,OAA0B;IACtD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;IAErD,MAAM,IAAI,GAAG,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,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,SAAS,YAAY,CACnB,OAA0B,EAC1B,MAA2B;IAE3B,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACpC,IAAI,QAAQ,GAAkB,IAAI,CAAC;IACnC,KAAK,MAAM,EAAE,IAAI,OAAO,EAAE,CAAC;QACzB,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,SAAS;QAC7B,IAAI,QAAQ,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QACnC,QAAQ,GAAG,EAAE,CAAC;IAChB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A box that can fill the screen: the 3D canvas and its toolbars, a side panel.
|
|
3
|
+
*
|
|
4
|
+
* A box filling the screen hides everything outside it, and the popovers and
|
|
5
|
+
* tooltips of what it holds are portalled to `document.body`: while the box
|
|
6
|
+
* fills the screen they are portalled into it instead, the way react-science's
|
|
7
|
+
* `RootLayout` keeps its own menus visible. Otherwise the portal options of the
|
|
8
|
+
* page around the box are passed through untouched.
|
|
9
|
+
*/
|
|
10
|
+
import type { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
11
|
+
/** Whether a box fills the screen, and how to change that. */
|
|
12
|
+
export interface StageFullscreen {
|
|
13
|
+
/** Whether the box fills the screen. */
|
|
14
|
+
active: boolean;
|
|
15
|
+
/** Fill the screen, or leave it. */
|
|
16
|
+
toggle: () => void;
|
|
17
|
+
}
|
|
18
|
+
/** Props of {@link FullscreenStage}. */
|
|
19
|
+
export interface FullscreenStageProps {
|
|
20
|
+
/**
|
|
21
|
+
* Style of the box, or a function handed whether the box fills the screen,
|
|
22
|
+
* for a box shaped differently while it does.
|
|
23
|
+
*/
|
|
24
|
+
style: CSSProperties | ((fillsScreen: boolean) => CSSProperties);
|
|
25
|
+
/**
|
|
26
|
+
* Called with the box once it is mounted, and with `null` once it is gone.
|
|
27
|
+
* It must keep its identity across renders.
|
|
28
|
+
* @default undefined
|
|
29
|
+
*/
|
|
30
|
+
onStage?: (element: HTMLDivElement | null) => void;
|
|
31
|
+
/**
|
|
32
|
+
* What is drawn in the box, handed whether it fills the screen and the
|
|
33
|
+
* toggle, or `undefined` where the browser cannot fill the screen.
|
|
34
|
+
*/
|
|
35
|
+
children: (fullscreen: StageFullscreen | undefined) => ReactNode;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The box, able to fill the screen.
|
|
39
|
+
* @param props - See {@link FullscreenStageProps}.
|
|
40
|
+
* @returns The box.
|
|
41
|
+
*/
|
|
42
|
+
export declare function FullscreenStage(props: FullscreenStageProps): ReactElement;
|
|
43
|
+
//# sourceMappingURL=FullscreenStage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FullscreenStage.d.ts","sourceRoot":"","sources":["../../../src/shared/ui/FullscreenStage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMpE,8DAA8D;AAC9D,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,MAAM,EAAE,OAAO,CAAC;IAChB,oCAAoC;IACpC,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,wCAAwC;AACxC,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,KAAK,EAAE,aAAa,GAAG,CAAC,CAAC,WAAW,EAAE,OAAO,KAAK,aAAa,CAAC,CAAC;IACjE;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IACnD;;;OAGG;IACH,QAAQ,EAAE,CAAC,UAAU,EAAE,eAAe,GAAG,SAAS,KAAK,SAAS,CAAC;CAClE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CAMzE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A box that can fill the screen: the 3D canvas and its toolbars, a side panel.
|
|
4
|
+
*
|
|
5
|
+
* A box filling the screen hides everything outside it, and the popovers and
|
|
6
|
+
* tooltips of what it holds are portalled to `document.body`: while the box
|
|
7
|
+
* fills the screen they are portalled into it instead, the way react-science's
|
|
8
|
+
* `RootLayout` keeps its own menus visible. Otherwise the portal options of the
|
|
9
|
+
* page around the box are passed through untouched.
|
|
10
|
+
*/
|
|
11
|
+
import { PortalContext, PortalProvider } from '@blueprintjs/core';
|
|
12
|
+
import { useCallback, useContext, useState } from 'react';
|
|
13
|
+
import { FullScreenProvider, useFullscreen } from 'react-science/ui';
|
|
14
|
+
import { canFillScreen } from "./canFillScreen.js";
|
|
15
|
+
/**
|
|
16
|
+
* The box, able to fill the screen.
|
|
17
|
+
* @param props - See {@link FullscreenStageProps}.
|
|
18
|
+
* @returns The box.
|
|
19
|
+
*/
|
|
20
|
+
export function FullscreenStage(props) {
|
|
21
|
+
return (_jsx(FullScreenProvider, { children: (fullscreenRef) => _jsx(Stage, { ...props, fullscreenRef: fullscreenRef }) }));
|
|
22
|
+
}
|
|
23
|
+
function Stage(props) {
|
|
24
|
+
const { style, onStage, children, fullscreenRef } = props;
|
|
25
|
+
const { isFullScreen, toggle } = useFullscreen();
|
|
26
|
+
const portal = useContext(PortalContext);
|
|
27
|
+
const [canFill] = useState(canFillScreen);
|
|
28
|
+
const [stage, setStage] = useState(null);
|
|
29
|
+
const stageRef = useCallback((element) => {
|
|
30
|
+
fullscreenRef.current = element;
|
|
31
|
+
setStage(element);
|
|
32
|
+
onStage?.(element);
|
|
33
|
+
}, [fullscreenRef, onStage]);
|
|
34
|
+
// The provider is always there, so entering full screen changes a value
|
|
35
|
+
// rather than the tree, and what the box holds is never mounted again.
|
|
36
|
+
return (_jsx("div", { ref: stageRef, style: typeof style === 'function' ? style(isFullScreen) : style, children: _jsx(PortalProvider, { portalClassName: portal.portalClassName, portalContainer: isFullScreen && stage !== null ? stage : portal.portalContainer, children: children(canFill ? { active: isFullScreen, toggle } : undefined) }) }));
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=FullscreenStage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FullscreenStage.js","sourceRoot":"","sources":["../../../src/shared/ui/FullscreenStage.tsx"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AA8BnD;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,OAAO,CACL,KAAC,kBAAkB,cAChB,CAAC,aAAa,EAAE,EAAE,CAAC,KAAC,KAAK,OAAK,KAAK,EAAE,aAAa,EAAE,aAAa,GAAI,GACnD,CACtB,CAAC;AACJ,CAAC;AAOD,SAAS,KAAK,CAAC,KAAiB;IAC9B,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IAC1D,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,CAAC;IACjD,MAAM,MAAM,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IACzC,MAAM,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IAC1C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAwB,IAAI,CAAC,CAAC;IAChE,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,OAA8B,EAAE,EAAE;QACjC,aAAa,CAAC,OAAO,GAAG,OAAO,CAAC;QAChC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClB,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC,EACD,CAAC,aAAa,EAAE,OAAO,CAAC,CACzB,CAAC;IAEF,wEAAwE;IACxE,uEAAuE;IACvE,OAAO,CACL,cACE,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,KAAK,YAEhE,KAAC,cAAc,IACb,eAAe,EAAE,MAAM,CAAC,eAAe,EACvC,eAAe,EACb,YAAY,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,YAGhE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,GAClD,GACb,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this browser lets a page fill the screen: neither an iPhone nor a
|
|
3
|
+
* frame without `allowfullscreen` does.
|
|
4
|
+
* @returns Whether `requestFullscreen` can succeed.
|
|
5
|
+
*/
|
|
6
|
+
export declare function canFillScreen(): boolean;
|
|
7
|
+
//# sourceMappingURL=canFillScreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canFillScreen.d.ts","sourceRoot":"","sources":["../../../src/shared/ui/canFillScreen.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this browser lets a page fill the screen: neither an iPhone nor a
|
|
3
|
+
* frame without `allowfullscreen` does.
|
|
4
|
+
* @returns Whether `requestFullscreen` can succeed.
|
|
5
|
+
*/
|
|
6
|
+
export function canFillScreen() {
|
|
7
|
+
return typeof document !== 'undefined' && document.fullscreenEnabled;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=canFillScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canFillScreen.js","sourceRoot":"","sources":["../../../src/shared/ui/canFillScreen.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,OAAO,QAAQ,KAAK,WAAW,IAAI,QAAQ,CAAC,iBAAiB,CAAC;AACvE,CAAC"}
|
package/lib/shared/ui/index.d.ts
CHANGED
|
@@ -4,4 +4,7 @@ export type { HeaderButtonProps, MenuButtonProps } from './MenuButton.tsx';
|
|
|
4
4
|
export { MenuButton } from './MenuButton.tsx';
|
|
5
5
|
export type { ActionTooltipState, ActionTooltipTarget, } from './useActionTooltip.ts';
|
|
6
6
|
export { ACTION_TOOLTIP_DELAY, useActionTooltip } from './useActionTooltip.ts';
|
|
7
|
+
export { canFillScreen } from './canFillScreen.ts';
|
|
8
|
+
export type { FullscreenStageProps, StageFullscreen, } from './FullscreenStage.tsx';
|
|
9
|
+
export { FullscreenStage } from './FullscreenStage.tsx';
|
|
7
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/ui/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EACV,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/ui/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EACV,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EACV,oBAAoB,EACpB,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
package/lib/shared/ui/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { ActionTooltip } from "./ActionTooltip.js";
|
|
2
2
|
export { MenuButton } from "./MenuButton.js";
|
|
3
3
|
export { ACTION_TOOLTIP_DELAY, useActionTooltip } from "./useActionTooltip.js";
|
|
4
|
+
export { canFillScreen } from "./canFillScreen.js";
|
|
5
|
+
export { FullscreenStage } from "./FullscreenStage.js";
|
|
4
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/ui/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAC;AAK9C,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/ui/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAC;AAK9C,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAuB,CAAC"}
|
|
@@ -57,9 +57,9 @@ export interface SplitPanesProps extends SplitRange {
|
|
|
57
57
|
*/
|
|
58
58
|
stackBelow?: number;
|
|
59
59
|
/**
|
|
60
|
-
* The gutter each pane keeps beside the splitter, in pixels
|
|
61
|
-
*
|
|
62
|
-
* @default
|
|
60
|
+
* The gutter each pane keeps beside the splitter, in pixels. The bar is
|
|
61
|
+
* already the separation, so a gutter only widens it into a band of page.
|
|
62
|
+
* @default 0
|
|
63
63
|
*/
|
|
64
64
|
gutter?: number;
|
|
65
65
|
/**
|
|
@@ -84,7 +84,7 @@ const STACK_ACROSS = 860;
|
|
|
84
84
|
*/
|
|
85
85
|
const STACK_DOWN = 420;
|
|
86
86
|
/** The gutter a pane keeps beside the splitter, in pixels. */
|
|
87
|
-
const GUTTER =
|
|
87
|
+
const GUTTER = 0;
|
|
88
88
|
/** The gap between the panes once they have stacked, in pixels. */
|
|
89
89
|
const STACKED_GAP = 16;
|
|
90
90
|
const STACK = {
|
|
@@ -44,6 +44,12 @@ export interface StructureNotation {
|
|
|
44
44
|
*/
|
|
45
45
|
block: boolean;
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Notations the caller has already written, shown instead of the ones
|
|
49
|
+
* OpenChemLib would write. A drawing program's molfile keeps its
|
|
50
|
+
* abbreviations as superatoms, which a round trip through OpenChemLib drops.
|
|
51
|
+
*/
|
|
52
|
+
export type SuppliedNotations = Partial<Record<StructureNotationKind, string>>;
|
|
47
53
|
/**
|
|
48
54
|
* Write a structure every way the export dialog offers.
|
|
49
55
|
*
|
|
@@ -51,7 +57,8 @@ export interface StructureNotation {
|
|
|
51
57
|
* tautomer cannot always be canonized — comes back empty rather than taking
|
|
52
58
|
* the rest of the list down with it.
|
|
53
59
|
* @param molecule - The structure, as the editor handed it over. Not modified.
|
|
60
|
+
* @param supplied - Notations the caller wrote itself, used as they are.
|
|
54
61
|
* @returns One entry per notation, in the order they are shown.
|
|
55
62
|
*/
|
|
56
|
-
export declare function structureNotations(molecule: Molecule): StructureNotation[];
|
|
63
|
+
export declare function structureNotations(molecule: Molecule, supplied?: SuppliedNotations): StructureNotation[];
|
|
57
64
|
//# sourceMappingURL=structureNotations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structureNotations.d.ts","sourceRoot":"","sources":["../../../src/structure/core/structureNotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,+DAA+D;AAC/D,MAAM,MAAM,qBAAqB,GAC7B,QAAQ,GACR,cAAc,GACd,cAAc,GACd,QAAQ,GACR,gBAAgB,GAChB,wBAAwB,CAAC;AAE7B,gDAAgD;AAChD,MAAM,WAAW,qBAAqB;IACpC,yEAAyE;IACzE,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC,4BAA4B;IAC5B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"structureNotations.d.ts","sourceRoot":"","sources":["../../../src/structure/core/structureNotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,+DAA+D;AAC/D,MAAM,MAAM,qBAAqB,GAC7B,QAAQ,GACR,cAAc,GACd,cAAc,GACd,QAAQ,GACR,gBAAgB,GAChB,wBAAwB,CAAC;AAE7B,gDAAgD;AAChD,MAAM,WAAW,qBAAqB;IACpC,yEAAyE;IACzE,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC,4BAA4B;IAC5B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC,CAAC;AAK/E;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,GAAE,iBAAsB,GAC/B,iBAAiB,EAAE,CA+CrB"}
|
|
@@ -18,41 +18,47 @@ const MOLFILE_TYPE = 'chemical/x-mdl-molfile';
|
|
|
18
18
|
* tautomer cannot always be canonized — comes back empty rather than taking
|
|
19
19
|
* the rest of the list down with it.
|
|
20
20
|
* @param molecule - The structure, as the editor handed it over. Not modified.
|
|
21
|
+
* @param supplied - Notations the caller wrote itself, used as they are.
|
|
21
22
|
* @returns One entry per notation, in the order they are shown.
|
|
22
23
|
*/
|
|
23
|
-
export function structureNotations(molecule) {
|
|
24
|
-
const
|
|
24
|
+
export function structureNotations(molecule, supplied = {}) {
|
|
25
|
+
const value = (kind, write) => supplied[kind] ?? written(write);
|
|
25
26
|
return [
|
|
26
27
|
{
|
|
27
28
|
kind: 'smiles',
|
|
28
|
-
value:
|
|
29
|
+
value: value('smiles', () => molecule.toIsomericSmiles()),
|
|
29
30
|
canonical: false,
|
|
30
31
|
block: false,
|
|
31
32
|
},
|
|
32
33
|
{
|
|
33
34
|
kind: 'molfileV3000',
|
|
34
|
-
value:
|
|
35
|
+
value: value('molfileV3000', () => molecule.toMolfileV3()),
|
|
35
36
|
canonical: false,
|
|
36
37
|
file: { suffix: '-v3000', extension: 'mol', mimeType: MOLFILE_TYPE },
|
|
37
38
|
block: true,
|
|
38
39
|
},
|
|
39
40
|
{
|
|
40
41
|
kind: 'molfileV2000',
|
|
41
|
-
value:
|
|
42
|
+
value: value('molfileV2000', () => molecule.toMolfile()),
|
|
42
43
|
canonical: false,
|
|
43
44
|
file: { suffix: '-v2000', extension: 'mol', mimeType: MOLFILE_TYPE },
|
|
44
45
|
block: true,
|
|
45
46
|
},
|
|
46
|
-
{
|
|
47
|
+
{
|
|
48
|
+
kind: 'idCode',
|
|
49
|
+
value: value('idCode', () => molecule.getIDCode()),
|
|
50
|
+
canonical: true,
|
|
51
|
+
block: false,
|
|
52
|
+
},
|
|
47
53
|
{
|
|
48
54
|
kind: 'noStereoIdCode',
|
|
49
|
-
value:
|
|
55
|
+
value: value('noStereoIdCode', () => CanonizerUtil.getIDCode(molecule, CanonizerUtil.NOSTEREO)),
|
|
50
56
|
canonical: true,
|
|
51
57
|
block: false,
|
|
52
58
|
},
|
|
53
59
|
{
|
|
54
60
|
kind: 'noStereoTautomerIdCode',
|
|
55
|
-
value:
|
|
61
|
+
value: value('noStereoTautomerIdCode', () => CanonizerUtil.getIDCode(molecule, CanonizerUtil.NOSTEREO_TAUTOMER)),
|
|
56
62
|
canonical: true,
|
|
57
63
|
block: false,
|
|
58
64
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structureNotations.js","sourceRoot":"","sources":["../../../src/structure/core/structureNotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"structureNotations.js","sourceRoot":"","sources":["../../../src/structure/core/structureNotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAqD5C,6DAA6D;AAC7D,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAkB,EAClB,WAA8B,EAAE;IAEhC,MAAM,KAAK,GAAG,CAAC,IAA2B,EAAE,KAAmB,EAAE,EAAE,CACjE,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;IACnC,OAAO;QACL;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;YACzD,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,KAAK;SACb;QACD;YACE,IAAI,EAAE,cAAc;YACpB,KAAK,EAAE,KAAK,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;YAC1D,SAAS,EAAE,KAAK;YAChB,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS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.tsx';
|
|
3
|
+
/** What {@link CardStructure} draws and hands over. */
|
|
4
|
+
export interface CardStructureProps extends StructureProps {
|
|
5
|
+
/**
|
|
6
|
+
* Base name of every file saved from the export, extension excluded.
|
|
7
|
+
* @default 'structure'
|
|
8
|
+
*/
|
|
9
|
+
name?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the structure is a query fragment, such as a toxicophore, whose
|
|
12
|
+
* idCode is not a molecule's.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
fragment?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* What the glyph is called, for the pointer and for a screen reader.
|
|
18
|
+
* @default the chrome's own line, `Copy or save the structure: SMILES,
|
|
19
|
+
* molfile`
|
|
20
|
+
*/
|
|
21
|
+
label?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The drawing, when the site draws the structure itself — its own
|
|
24
|
+
* highlights, its own numbering. The export still reads the notations.
|
|
25
|
+
* @default a `Structure` drawn from the same notations, at the same size
|
|
26
|
+
*/
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A structure of a card, with the glyph that hands it over: the export
|
|
31
|
+
* dialog, which copies it as an SVG or a PNG, a SMILES or a molfile, V2000 or
|
|
32
|
+
* V3000. Every structure an answer draws carries it, alone or in a grid, so
|
|
33
|
+
* none has to be redrawn to be reused.
|
|
34
|
+
*
|
|
35
|
+
* The glyph stands beside the top right corner, faded until the structure is
|
|
36
|
+
* pointed at, as the glyphs of `CardFigure` (`react-cheminfo/card`) do;
|
|
37
|
+
* `styles/card.css` draws both. A structure with nothing to read draws its
|
|
38
|
+
* placeholder alone.
|
|
39
|
+
* @param props - The structure, its size, and the name of its files.
|
|
40
|
+
* @returns The structure and its glyph.
|
|
41
|
+
*/
|
|
42
|
+
export declare function CardStructure(props: CardStructureProps): ReactElement;
|
|
43
|
+
//# sourceMappingURL=CardStructure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardStructure.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/CardStructure.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAItD,uDAAuD;AACvD,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,YAAY,CA0BrE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { OverlayLayer } from "../../overlay/ui/OverlayLayer.js";
|
|
3
|
+
import { structureSource } from "../core/structureSource.js";
|
|
4
|
+
import { Structure } from "./Structure.js";
|
|
5
|
+
import { StructureExportButton } from "./StructureExportButton.js";
|
|
6
|
+
/**
|
|
7
|
+
* A structure of a card, with the glyph that hands it over: the export
|
|
8
|
+
* dialog, which copies it as an SVG or a PNG, a SMILES or a molfile, V2000 or
|
|
9
|
+
* V3000. Every structure an answer draws carries it, alone or in a grid, so
|
|
10
|
+
* none has to be redrawn to be reused.
|
|
11
|
+
*
|
|
12
|
+
* The glyph stands beside the top right corner, faded until the structure is
|
|
13
|
+
* pointed at, as the glyphs of `CardFigure` (`react-cheminfo/card`) do;
|
|
14
|
+
* `styles/card.css` draws both. A structure with nothing to read draws its
|
|
15
|
+
* placeholder alone.
|
|
16
|
+
* @param props - The structure, its size, and the name of its files.
|
|
17
|
+
* @returns The structure and its glyph.
|
|
18
|
+
*/
|
|
19
|
+
export function CardStructure(props) {
|
|
20
|
+
const { name, fragment, label, children, ...structure } = props;
|
|
21
|
+
const { idCode, coordinates, molfile, smiles } = structure;
|
|
22
|
+
const drawing = children ?? _jsx(Structure, { ...structure });
|
|
23
|
+
const source = structureSource({ idCode, coordinates, molfile, smiles });
|
|
24
|
+
if (source.kind === 'empty')
|
|
25
|
+
return _jsx(_Fragment, { children: drawing });
|
|
26
|
+
return (_jsxs("div", { className: "card-figure card-structure", children: [_jsx("div", { className: "card-figure__drawing", children: drawing }), _jsx(OverlayLayer, { density: "compact", awake: true, children: _jsx("div", { className: "card-figure__tools", "data-testid": "figure-tools", children: _jsx(StructureExportButton, { idCode: idCode, coordinates: coordinates, molfile: molfile, smiles: smiles, name: name, fragment: fragment, label: label }) }) })] }));
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=CardStructure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardStructure.js","sourceRoot":"","sources":["../../../src/structure/ui/CardStructure.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAmC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAiB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA6B,CAAC;AA6BpE;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAChE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC3D,MAAM,OAAO,GAAG,QAAQ,IAAI,KAAC,SAAS,OAAK,SAAS,GAAI,CAAC;IACzD,MAAM,MAAM,GAAG,eAAe,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACzE,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,4BAAG,OAAO,GAAI,CAAC;IAEnD,OAAO,CACL,eAAK,SAAS,EAAC,4BAA4B,aACzC,cAAK,SAAS,EAAC,sBAAsB,YAAE,OAAO,GAAO,EAErD,KAAC,YAAY,IAAC,OAAO,EAAC,SAAS,EAAC,KAAK,kBACnC,cAAK,SAAS,EAAC,oBAAoB,iBAAa,cAAc,YAC5D,KAAC,qBAAqB,IACpB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,GACZ,GACE,GACO,IACX,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* this only when somebody asks to export something.
|
|
7
7
|
*/
|
|
8
8
|
import type { ReactElement } from 'react';
|
|
9
|
+
import type { SuppliedNotations } from '../core/structureNotations.ts';
|
|
9
10
|
import type { StructureSourceInput } from '../core/structureSource.ts';
|
|
10
11
|
/** What {@link StructureExportPanel} is handed. */
|
|
11
12
|
export interface StructureExportPanelProps extends StructureSourceInput {
|
|
@@ -21,6 +22,13 @@ export interface StructureExportPanelProps extends StructureSourceInput {
|
|
|
21
22
|
* @default false
|
|
22
23
|
*/
|
|
23
24
|
fragment?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Notations the caller wrote itself, shown and saved as they are instead of
|
|
27
|
+
* the ones OpenChemLib would write from the structure — a drawing program
|
|
28
|
+
* whose molfile keeps superatoms that a round trip would drop.
|
|
29
|
+
* @default {}
|
|
30
|
+
*/
|
|
31
|
+
notations?: SuppliedNotations;
|
|
24
32
|
}
|
|
25
33
|
/**
|
|
26
34
|
* Every notation of a drawn structure, and the picture of it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StructureExportPanel.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/StructureExportPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"StructureExportPanel.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/StructureExportPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AASzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAMvE,mDAAmD;AACnD,MAAM,WAAW,yBAA0B,SAAQ,oBAAoB;IACrE;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,yBAAyB,GAC/B,YAAY,CA0Dd"}
|
|
@@ -23,9 +23,9 @@ import { StructurePicturePane } from "./StructurePicturePane.js";
|
|
|
23
23
|
*/
|
|
24
24
|
export function StructureExportPanel(props) {
|
|
25
25
|
const { idCode, coordinates, molfile, smiles } = props;
|
|
26
|
-
const { name = 'structure', fragment = false } = props;
|
|
26
|
+
const { name = 'structure', fragment = false, notations: supplied } = props;
|
|
27
27
|
const t = useChromeT();
|
|
28
|
-
const read = useMemo(() => readStructure({ idCode, coordinates, molfile, smiles }, fragment), [idCode, coordinates, molfile, smiles, fragment]);
|
|
28
|
+
const read = useMemo(() => readStructure({ idCode, coordinates, molfile, smiles }, fragment, supplied), [idCode, coordinates, molfile, smiles, fragment, supplied]);
|
|
29
29
|
if (read.kind !== 'read') {
|
|
30
30
|
return (_jsx("p", { style: EMPTY_STYLE, children: read.kind === 'empty' ? t('structure.export.nothing') : read.message }));
|
|
31
31
|
}
|
|
@@ -39,9 +39,10 @@ export function StructureExportPanel(props) {
|
|
|
39
39
|
* Read the notation the caller handed over, and write every other one from it.
|
|
40
40
|
* @param input - Whatever notations the caller has.
|
|
41
41
|
* @param fragment - Whether the structure is a query fragment.
|
|
42
|
+
* @param supplied - Notations the caller wrote itself.
|
|
42
43
|
* @returns The molecule and its notations, or why there are none.
|
|
43
44
|
*/
|
|
44
|
-
function readStructure(input, fragment) {
|
|
45
|
+
function readStructure(input, fragment, supplied) {
|
|
45
46
|
const source = structureSource(input);
|
|
46
47
|
if (source.kind === 'empty')
|
|
47
48
|
return { kind: 'empty' };
|
|
@@ -54,7 +55,11 @@ function readStructure(input, fragment) {
|
|
|
54
55
|
molecule.setFragment(true);
|
|
55
56
|
if (molecule.getAllAtoms() === 0)
|
|
56
57
|
return { kind: 'empty' };
|
|
57
|
-
return {
|
|
58
|
+
return {
|
|
59
|
+
kind: 'read',
|
|
60
|
+
molecule,
|
|
61
|
+
notations: structureNotations(molecule, supplied),
|
|
62
|
+
};
|
|
58
63
|
}
|
|
59
64
|
catch (error) {
|
|
60
65
|
return { kind: 'error', message: structureError(error).message };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StructureExportPanel.js","sourceRoot":"","sources":["../../../src/structure/ui/StructureExportPanel.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA4C,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,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,EAAE,EAAE;CACoB,CAAC"}
|
|
@@ -9,7 +9,7 @@ export interface StructurePicturePaneProps {
|
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* The structure as a picture: what it looks like, how big it leaves, and the
|
|
12
|
-
*
|
|
12
|
+
* four ways it leaves.
|
|
13
13
|
*
|
|
14
14
|
* What is shown is the file: the preview is the very SVG the save button
|
|
15
15
|
* writes, laid out smaller, so nobody saves a picture they have not seen. The
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StructurePicturePane.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/StructurePicturePane.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"StructurePicturePane.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/StructurePicturePane.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAyBzD,yDAAyD;AACzD,MAAM,WAAW,yBAAyB;IACxC,mCAAmC;IACnC,QAAQ,EAAE,QAAQ,CAAC;IACnB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAKD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,yBAAyB,GAC/B,YAAY,CA4Hd"}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Button, SegmentedControl } from '@blueprintjs/core';
|
|
3
3
|
import { useMemo, useState } from 'react';
|
|
4
4
|
import { copyFigure } from "../../download/core/copyFigure.js";
|
|
5
|
+
import { copySvg } from "../../download/core/copySvg.js";
|
|
5
6
|
import { downloadBlob } from "../../download/core/downloadBlob.js";
|
|
6
7
|
import { downloadText } from "../../download/core/downloadText.js";
|
|
7
8
|
import { figurePng } from "../../download/core/figurePng.js";
|
|
@@ -16,7 +17,7 @@ import { STRUCTURE_BOND_LENGTH, structurePicture, } from "../core/structurePictu
|
|
|
16
17
|
const DEFAULT_SCALE = 2;
|
|
17
18
|
/**
|
|
18
19
|
* The structure as a picture: what it looks like, how big it leaves, and the
|
|
19
|
-
*
|
|
20
|
+
* four ways it leaves.
|
|
20
21
|
*
|
|
21
22
|
* What is shown is the file: the preview is the very SVG the save button
|
|
22
23
|
* writes, laid out smaller, so nobody saves a picture they have not seen. The
|
|
@@ -64,7 +65,9 @@ export function StructurePicturePane(props) {
|
|
|
64
65
|
}) }), _jsx(Button, { icon: "download", size: "small", intent: "primary", text: t('structure.export.savePng'), onClick: () => void run(async () => {
|
|
65
66
|
downloadBlob(await png(), `${fileName}.png`);
|
|
66
67
|
return null;
|
|
67
|
-
}) }), _jsx(Button, { icon: "clipboard", size: "small", text: t('structure.export.
|
|
68
|
+
}) }), _jsx(Button, { icon: "clipboard", size: "small", text: t('structure.export.copySvg'), onClick: () => void run(async () => (await copySvg(picture.markup))
|
|
69
|
+
? t('structure.export.svgCopied')
|
|
70
|
+
: t('clipboard.failed')) }), _jsx(Button, { icon: "clipboard", size: "small", text: t('structure.export.copyPng'), onClick: () =>
|
|
68
71
|
// Safari only allows a clipboard write the click itself started,
|
|
69
72
|
// so the image is handed over as a promise rather than awaited
|
|
70
73
|
// first — see `copyFigure`.
|