react-cheminfo 0.76.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/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 +4 -1
- package/lib/download/core/index.d.ts.map +1 -1
- package/lib/download/core/index.js +3 -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/locales/de.json +30 -1
- package/lib/locales/en.json +30 -1
- package/lib/locales/es.json +30 -1
- package/lib/locales/fr.json +30 -1
- package/lib/locales/it.json +30 -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/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/index.d.ts +1 -0
- package/lib/structure/ui/index.d.ts.map +1 -1
- 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/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 +13 -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/locales/de.json +30 -1
- package/src/locales/en.json +30 -1
- package/src/locales/es.json +30 -1
- package/src/locales/fr.json +30 -1
- package/src/locales/it.json +30 -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/StructureExportPanel.tsx +23 -4
- package/src/structure/ui/index.ts +4 -0
- package/styles/osiris.css +339 -0
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* slide deck and issue tracker actually accepts. So both are offered. The
|
|
8
8
|
* resolution paints a PNG with more pixels, and makes an SVG open larger.
|
|
9
9
|
*/
|
|
10
|
-
import type { FigureSvgOptions } from './figureSvg.ts';
|
|
10
|
+
import type { FigureSvg, FigureSvgOptions } from './figureSvg.ts';
|
|
11
11
|
/** Which file a figure is saved as. */
|
|
12
12
|
export type FigureFormat = 'svg' | 'png';
|
|
13
13
|
/** How a figure is saved. */
|
|
@@ -38,4 +38,15 @@ export interface DownloadFigureOptions extends FigureSvgOptions {
|
|
|
38
38
|
* @throws {Error} When the box holds no figure, or the browser cannot paint it.
|
|
39
39
|
*/
|
|
40
40
|
export declare function downloadFigure(target: string | Element, options?: DownloadFigureOptions): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Save a figure its page wrote as an SVG document itself, rather than one
|
|
43
|
+
* copied off the page: a drawing whose file carries more than its picture.
|
|
44
|
+
* The SVG is saved as written, at the size it states; the PNG is painted from
|
|
45
|
+
* it at the multiple asked for.
|
|
46
|
+
* @param figure - The document, and its size in pixels of the page.
|
|
47
|
+
* @param options - Which file, at what multiple, and its name; a background
|
|
48
|
+
* is the document's own business.
|
|
49
|
+
* @throws {Error} When the browser cannot paint it.
|
|
50
|
+
*/
|
|
51
|
+
export declare function downloadFigureSvg(figure: FigureSvg, options?: Omit<DownloadFigureOptions, 'background'>): Promise<void>;
|
|
41
52
|
//# sourceMappingURL=downloadFigure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"downloadFigure.d.ts","sourceRoot":"","sources":["../../../src/download/core/downloadFigure.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"downloadFigure.d.ts","sourceRoot":"","sources":["../../../src/download/core/downloadFigure.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIlE,uCAAuC;AACvC,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,KAAK,CAAC;AAEzC,6BAA6B;AAC7B,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,GAAG,OAAO,EACxB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CAcf;AAED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,SAAS,EACjB,OAAO,GAAE,IAAI,CAAC,qBAAqB,EAAE,YAAY,CAAM,GACtD,OAAO,CAAC,IAAI,CAAC,CAUf"}
|
|
@@ -33,4 +33,25 @@ export async function downloadFigure(target, options = {}) {
|
|
|
33
33
|
const figure = figureSvg(target, { background });
|
|
34
34
|
downloadBlob(await figurePng(figure, scale), `${name}.png`);
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Save a figure its page wrote as an SVG document itself, rather than one
|
|
38
|
+
* copied off the page: a drawing whose file carries more than its picture.
|
|
39
|
+
* The SVG is saved as written, at the size it states; the PNG is painted from
|
|
40
|
+
* it at the multiple asked for.
|
|
41
|
+
* @param figure - The document, and its size in pixels of the page.
|
|
42
|
+
* @param options - Which file, at what multiple, and its name; a background
|
|
43
|
+
* is the document's own business.
|
|
44
|
+
* @throws {Error} When the browser cannot paint it.
|
|
45
|
+
*/
|
|
46
|
+
export async function downloadFigureSvg(figure, options = {}) {
|
|
47
|
+
const { format = 'png', fileName = DEFAULT_FILE_NAME } = options;
|
|
48
|
+
const name = sanitizeFileName(fileName, DEFAULT_FILE_NAME);
|
|
49
|
+
if (format === 'svg') {
|
|
50
|
+
const blob = new Blob([figure.markup], { type: FIGURE_SVG_TYPE });
|
|
51
|
+
downloadBlob(blob, `${name}.svg`);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const scale = options.scale ?? defaultFigureScale(format);
|
|
55
|
+
downloadBlob(await figurePng(figure, scale), `${name}.png`);
|
|
56
|
+
}
|
|
36
57
|
//# sourceMappingURL=downloadFigure.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"downloadFigure.js","sourceRoot":"","sources":["../../../src/download/core/downloadFigure.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AA2BzD,4DAA4D;AAC5D,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAwB,EACxB,UAAiC,EAAE;IAEnC,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,QAAQ,GAAG,iBAAiB,EAAE,UAAU,EA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AAM,CAAC,CAAC;QAClC,OAAO;IACT,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC1D,YAAY,CAAC,MAAM,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG,IAAI,MAAM,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A figure's resolution stated in dots per inch.
|
|
3
|
+
*
|
|
4
|
+
* A pixel of the page is a ninety-sixth of an inch, by the definition of CSS,
|
|
5
|
+
* so every figure on screen already has a printed size, and the multiple it is
|
|
6
|
+
* painted at is a resolution in another unit: 1× is 96 dpi. A figure whose size
|
|
7
|
+
* on the page is the size it prints at — a structure drawn to a journal's bond
|
|
8
|
+
* length — is offered its resolution in dots per inch, which is what a journal
|
|
9
|
+
* asks for; any other figure is offered multiples of what the reader sees.
|
|
10
|
+
*/
|
|
11
|
+
import type { FigurePixels } from './figureScale.ts';
|
|
12
|
+
/** How the resolution of a figure is offered. */
|
|
13
|
+
export type FigureResolutionUnit = 'multiple' | 'dpi';
|
|
14
|
+
/** How many pixels of the page make an inch. */
|
|
15
|
+
export declare const CSS_PIXELS_PER_INCH = 96;
|
|
16
|
+
/**
|
|
17
|
+
* The dots per inch offered: a slide, a journal's halftone, its combination
|
|
18
|
+
* art, and its line art.
|
|
19
|
+
*/
|
|
20
|
+
export declare const FIGURE_DPIS: readonly number[];
|
|
21
|
+
/** The dots per inch a figure with a printed size is saved at by default. */
|
|
22
|
+
export declare const DEFAULT_FIGURE_DPI = 300;
|
|
23
|
+
/**
|
|
24
|
+
* The multiple a figure is painted at to reach this many dots per inch.
|
|
25
|
+
* @param dpi - Dots per inch.
|
|
26
|
+
* @returns The multiple of its size on the page.
|
|
27
|
+
*/
|
|
28
|
+
export declare function dpiScale(dpi: number): number;
|
|
29
|
+
/**
|
|
30
|
+
* The dots per inch a figure painted at this multiple has, when it is printed
|
|
31
|
+
* at its size on the page.
|
|
32
|
+
* @param scale - The multiple of its size on the page.
|
|
33
|
+
* @returns Whole dots per inch.
|
|
34
|
+
*/
|
|
35
|
+
export declare function figureDpi(scale: number): number;
|
|
36
|
+
/**
|
|
37
|
+
* The size a figure prints at.
|
|
38
|
+
* @param size - Its size on the page, in pixels.
|
|
39
|
+
* @returns Its width and height in centimetres.
|
|
40
|
+
*/
|
|
41
|
+
export declare function figureCentimetres(size: FigurePixels): FigurePixels;
|
|
42
|
+
/**
|
|
43
|
+
* The size a figure prints at, written out to a tenth of a centimetre.
|
|
44
|
+
* @param size - Its size on the page, in pixels.
|
|
45
|
+
* @param language - The language the numbers are written in.
|
|
46
|
+
* @returns Its width and height in centimetres, as text: `8.5` or `8,5`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function formatFigureCentimetres(size: FigurePixels, language: string): {
|
|
49
|
+
width: string;
|
|
50
|
+
height: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* What a resolution reads on a button: `2×`, or `300 dpi`.
|
|
54
|
+
* @param scale - The multiple of the figure's size on the page.
|
|
55
|
+
* @param unit - How the resolution is offered.
|
|
56
|
+
* @returns Its label.
|
|
57
|
+
*/
|
|
58
|
+
export declare function figureResolutionLabel(scale: number, unit: FigureResolutionUnit): string;
|
|
59
|
+
//# sourceMappingURL=figureDpi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figureDpi.d.ts","sourceRoot":"","sources":["../../../src/download/core/figureDpi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,iDAAiD;AACjD,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,KAAK,CAAC;AAEtD,gDAAgD;AAChD,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAA0B,CAAC;AAEpE,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAKtC;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,CAGlE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,MAAM,GACf;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAUnC;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,oBAAoB,GACzB,MAAM,CAER"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A figure's resolution stated in dots per inch.
|
|
3
|
+
*
|
|
4
|
+
* A pixel of the page is a ninety-sixth of an inch, by the definition of CSS,
|
|
5
|
+
* so every figure on screen already has a printed size, and the multiple it is
|
|
6
|
+
* painted at is a resolution in another unit: 1× is 96 dpi. A figure whose size
|
|
7
|
+
* on the page is the size it prints at — a structure drawn to a journal's bond
|
|
8
|
+
* length — is offered its resolution in dots per inch, which is what a journal
|
|
9
|
+
* asks for; any other figure is offered multiples of what the reader sees.
|
|
10
|
+
*/
|
|
11
|
+
import { figureScaleLabel } from "./figureScale.js";
|
|
12
|
+
/** How many pixels of the page make an inch. */
|
|
13
|
+
export const CSS_PIXELS_PER_INCH = 96;
|
|
14
|
+
/**
|
|
15
|
+
* The dots per inch offered: a slide, a journal's halftone, its combination
|
|
16
|
+
* art, and its line art.
|
|
17
|
+
*/
|
|
18
|
+
export const FIGURE_DPIS = [150, 300, 600, 1200];
|
|
19
|
+
/** The dots per inch a figure with a printed size is saved at by default. */
|
|
20
|
+
export const DEFAULT_FIGURE_DPI = 300;
|
|
21
|
+
/** Centimetres in an inch. */
|
|
22
|
+
const CENTIMETRES_PER_INCH = 2.54;
|
|
23
|
+
/**
|
|
24
|
+
* The multiple a figure is painted at to reach this many dots per inch.
|
|
25
|
+
* @param dpi - Dots per inch.
|
|
26
|
+
* @returns The multiple of its size on the page.
|
|
27
|
+
*/
|
|
28
|
+
export function dpiScale(dpi) {
|
|
29
|
+
return dpi / CSS_PIXELS_PER_INCH;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The dots per inch a figure painted at this multiple has, when it is printed
|
|
33
|
+
* at its size on the page.
|
|
34
|
+
* @param scale - The multiple of its size on the page.
|
|
35
|
+
* @returns Whole dots per inch.
|
|
36
|
+
*/
|
|
37
|
+
export function figureDpi(scale) {
|
|
38
|
+
return Math.round(scale * CSS_PIXELS_PER_INCH);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The size a figure prints at.
|
|
42
|
+
* @param size - Its size on the page, in pixels.
|
|
43
|
+
* @returns Its width and height in centimetres.
|
|
44
|
+
*/
|
|
45
|
+
export function figureCentimetres(size) {
|
|
46
|
+
const factor = CENTIMETRES_PER_INCH / CSS_PIXELS_PER_INCH;
|
|
47
|
+
return { width: size.width * factor, height: size.height * factor };
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The size a figure prints at, written out to a tenth of a centimetre.
|
|
51
|
+
* @param size - Its size on the page, in pixels.
|
|
52
|
+
* @param language - The language the numbers are written in.
|
|
53
|
+
* @returns Its width and height in centimetres, as text: `8.5` or `8,5`.
|
|
54
|
+
*/
|
|
55
|
+
export function formatFigureCentimetres(size, language) {
|
|
56
|
+
const printed = figureCentimetres(size);
|
|
57
|
+
const format = new Intl.NumberFormat(language, {
|
|
58
|
+
minimumFractionDigits: 1,
|
|
59
|
+
maximumFractionDigits: 1,
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
width: format.format(printed.width),
|
|
63
|
+
height: format.format(printed.height),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* What a resolution reads on a button: `2×`, or `300 dpi`.
|
|
68
|
+
* @param scale - The multiple of the figure's size on the page.
|
|
69
|
+
* @param unit - How the resolution is offered.
|
|
70
|
+
* @returns Its label.
|
|
71
|
+
*/
|
|
72
|
+
export function figureResolutionLabel(scale, unit) {
|
|
73
|
+
return unit === 'dpi' ? `${figureDpi(scale)} dpi` : figureScaleLabel(scale);
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=figureDpi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figureDpi.js","sourceRoot":"","sources":["../../../src/download/core/figureDpi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAKpD,gDAAgD;AAChD,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAsB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;AAEpE,6EAA6E;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,8BAA8B;AAC9B,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAElC;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,OAAO,GAAG,GAAG,mBAAmB,CAAC;AACnC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,mBAAmB,CAAC,CAAC;AACjD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAkB;IAClD,MAAM,MAAM,GAAG,oBAAoB,GAAG,mBAAmB,CAAC;IAC1D,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;AACtE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,IAAkB,EAClB,QAAgB;IAEhB,MAAM,OAAO,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;QAC7C,qBAAqB,EAAE,CAAC;QACxB,qBAAqB,EAAE,CAAC;KACzB,CAAC,CAAC;IACH,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QACnC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;KACtC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAa,EACb,IAA0B;IAE1B,OAAO,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
* the figure that was read, and two drawing paths are two things to keep in
|
|
7
7
|
* step. Scaling is the browser's own, so a figure saved at three times is
|
|
8
8
|
* genuinely three times the detail rather than a stretched screenshot.
|
|
9
|
+
*
|
|
10
|
+
* The file states its resolution, so a document places it at the size the
|
|
11
|
+
* figure has on the page rather than at one pixel per point.
|
|
9
12
|
*/
|
|
10
13
|
import type { FigureSvg } from './figureSvg.ts';
|
|
11
14
|
/** What a saved raster figure is. */
|
|
@@ -14,7 +17,7 @@ export declare const FIGURE_PNG_TYPE = "image/png";
|
|
|
14
17
|
* The figure as a PNG.
|
|
15
18
|
* @param figure - The figure, already copied off the page.
|
|
16
19
|
* @param scale - How many pixels are painted per pixel on screen.
|
|
17
|
-
* @returns The image.
|
|
20
|
+
* @returns The image, stating `96 × scale` dots per inch.
|
|
18
21
|
* @throws {Error} When the browser cannot paint or encode it.
|
|
19
22
|
*/
|
|
20
23
|
export declare function figurePng(figure: FigureSvg, scale?: number): Promise<Blob>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"figurePng.d.ts","sourceRoot":"","sources":["../../../src/download/core/figurePng.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"figurePng.d.ts","sourceRoot":"","sources":["../../../src/download/core/figurePng.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIhD,qCAAqC;AACrC,eAAO,MAAM,eAAe,cAAc,CAAC;AAE3C;;;;;;GAMG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,SAAS,EACjB,KAAK,GAAE,MAA6B,GACnC,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIlD"}
|
|
@@ -6,16 +6,21 @@
|
|
|
6
6
|
* the figure that was read, and two drawing paths are two things to keep in
|
|
7
7
|
* step. Scaling is the browser's own, so a figure saved at three times is
|
|
8
8
|
* genuinely three times the detail rather than a stretched screenshot.
|
|
9
|
+
*
|
|
10
|
+
* The file states its resolution, so a document places it at the size the
|
|
11
|
+
* figure has on the page rather than at one pixel per point.
|
|
9
12
|
*/
|
|
13
|
+
import { figureDpi } from "./figureDpi.js";
|
|
10
14
|
import { DEFAULT_FIGURE_SCALE, figurePixels } from "./figureScale.js";
|
|
11
15
|
import { FIGURE_SVG_TYPE } from "./figureSvg.js";
|
|
16
|
+
import { withPngDpi } from "./pngDpi.js";
|
|
12
17
|
/** What a saved raster figure is. */
|
|
13
18
|
export const FIGURE_PNG_TYPE = 'image/png';
|
|
14
19
|
/**
|
|
15
20
|
* The figure as a PNG.
|
|
16
21
|
* @param figure - The figure, already copied off the page.
|
|
17
22
|
* @param scale - How many pixels are painted per pixel on screen.
|
|
18
|
-
* @returns The image.
|
|
23
|
+
* @returns The image, stating `96 × scale` dots per inch.
|
|
19
24
|
* @throws {Error} When the browser cannot paint or encode it.
|
|
20
25
|
*/
|
|
21
26
|
export async function figurePng(figure, scale = DEFAULT_FIGURE_SCALE) {
|
|
@@ -29,7 +34,11 @@ export async function figurePng(figure, scale = DEFAULT_FIGURE_SCALE) {
|
|
|
29
34
|
throw new Error('This browser cannot paint the figure into an image.');
|
|
30
35
|
}
|
|
31
36
|
context.drawImage(drawing, 0, 0, pixels.width, pixels.height);
|
|
32
|
-
|
|
37
|
+
const encoded = await encode(canvas);
|
|
38
|
+
const png = new Uint8Array(await encoded.arrayBuffer());
|
|
39
|
+
return new Blob([withPngDpi(png, figureDpi(scale))], {
|
|
40
|
+
type: FIGURE_PNG_TYPE,
|
|
41
|
+
});
|
|
33
42
|
}
|
|
34
43
|
/**
|
|
35
44
|
* Where the browser reads an SVG document back from, to paint it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"figurePng.js","sourceRoot":"","sources":["../../../src/download/core/figurePng.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"figurePng.js","sourceRoot":"","sources":["../../../src/download/core/figurePng.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,qCAAqC;AACrC,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC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
|
|
|
4
4
|
export { cssTokenNames, resolveCssTokens } from './cssTokens.ts';
|
|
5
5
|
export { downloadBlob } from './downloadBlob.ts';
|
|
6
6
|
export type { DownloadFigureOptions, FigureFormat } from './downloadFigure.ts';
|
|
7
|
-
export { downloadFigure } from './downloadFigure.ts';
|
|
7
|
+
export { downloadFigure, downloadFigureSvg } from './downloadFigure.ts';
|
|
8
8
|
export { downloadText } from './downloadText.ts';
|
|
9
|
+
export type { FigureResolutionUnit } from './figureDpi.ts';
|
|
10
|
+
export { CSS_PIXELS_PER_INCH, DEFAULT_FIGURE_DPI, FIGURE_DPIS, dpiScale, figureCentimetres, figureDpi, figureResolutionLabel, formatFigureCentimetres, } from './figureDpi.ts';
|
|
9
11
|
export type { FigureLayout } from './figureLayout.ts';
|
|
10
12
|
export { FIGURE_COLUMN_WIDTH, FIGURE_LAYOUTS, FIGURE_LAYOUT_MAX, FIGURE_LAYOUT_MIN, figureLayoutRedraws, figureLayoutSide, figureLayoutSize, } from './figureLayout.ts';
|
|
11
13
|
export { FIGURE_PNG_TYPE, figurePng } from './figurePng.ts';
|
|
@@ -21,6 +23,7 @@ export type { FigureLegendCard, FigureLegendMark, FigureLegendPrint, FigureLegen
|
|
|
21
23
|
export { figureLegendMarkup } from './figureLegend.ts';
|
|
22
24
|
export type { FigureBounds } from './figureTarget.ts';
|
|
23
25
|
export { figureBounds, figureDrawings, figureElement, figureLegends, figurePaintings, figureSize, } from './figureTarget.ts';
|
|
26
|
+
export { pngDpi, withPngDpi } from './pngDpi.ts';
|
|
24
27
|
export { sanitizeFileName } from './sanitizeFileName.ts';
|
|
25
28
|
export { drawingIn, stackDrawings } from './stackedDrawing.ts';
|
|
26
29
|
export type { SvgBox } from './svgBounds.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/download/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD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C3E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -2,8 +2,9 @@ export { copyFigure } from "./copyFigure.js";
|
|
|
2
2
|
export { copySvg } from "./copySvg.js";
|
|
3
3
|
export { cssTokenNames, resolveCssTokens } from "./cssTokens.js";
|
|
4
4
|
export { downloadBlob } from "./downloadBlob.js";
|
|
5
|
-
export { downloadFigure } from "./downloadFigure.js";
|
|
5
|
+
export { downloadFigure, downloadFigureSvg } from "./downloadFigure.js";
|
|
6
6
|
export { downloadText } from "./downloadText.js";
|
|
7
|
+
export { CSS_PIXELS_PER_INCH, DEFAULT_FIGURE_DPI, FIGURE_DPIS, dpiScale, figureCentimetres, figureDpi, figureResolutionLabel, formatFigureCentimetres, } from "./figureDpi.js";
|
|
7
8
|
export { FIGURE_COLUMN_WIDTH, FIGURE_LAYOUTS, FIGURE_LAYOUT_MAX, FIGURE_LAYOUT_MIN, figureLayoutRedraws, figureLayoutSide, figureLayoutSize, } from "./figureLayout.js";
|
|
8
9
|
export { FIGURE_PNG_TYPE, figurePng } from "./figurePng.js";
|
|
9
10
|
export { whenFigureSettles } from "./figureSettle.js";
|
|
@@ -12,6 +13,7 @@ export { FIGURE_SVG_TYPE, figureSvg } from "./figureSvg.js";
|
|
|
12
13
|
export { figureSvgDocument } from "./figureSvgDocument.js";
|
|
13
14
|
export { figureLegendMarkup } from "./figureLegend.js";
|
|
14
15
|
export { figureBounds, figureDrawings, figureElement, figureLegends, figurePaintings, figureSize, } from "./figureTarget.js";
|
|
16
|
+
export { pngDpi, withPngDpi } from "./pngDpi.js";
|
|
15
17
|
export { sanitizeFileName } from "./sanitizeFileName.js";
|
|
16
18
|
export { drawingIn, stackDrawings } from "./stackedDrawing.js";
|
|
17
19
|
export { CONTENT_ATTRIBUTE, contentBox, elementBox } from "./svgBounds.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/download/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/download/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAO3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,EACb,eAAe,EACf,UAAU,GACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The resolution a PNG states, in its `pHYs` chunk.
|
|
3
|
+
*
|
|
4
|
+
* A browser writes none, and a word processor or a slide then places the
|
|
5
|
+
* picture as if it were 72 or 96 dpi — a figure painted for print arrives
|
|
6
|
+
* several times too large. Stated, it arrives at the size it was drawn.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* A PNG stating a resolution, any resolution it stated before dropped.
|
|
10
|
+
* @param png - The PNG file's bytes.
|
|
11
|
+
* @param dpi - Dots per inch.
|
|
12
|
+
* @returns A new PNG file.
|
|
13
|
+
* @throws {Error} When the bytes are not a PNG.
|
|
14
|
+
*/
|
|
15
|
+
export declare function withPngDpi(png: Uint8Array, dpi: number): Uint8Array<ArrayBuffer>;
|
|
16
|
+
/**
|
|
17
|
+
* The resolution a PNG states.
|
|
18
|
+
* @param png - The PNG file's bytes.
|
|
19
|
+
* @returns Whole dots per inch, or `undefined` when it states none.
|
|
20
|
+
*/
|
|
21
|
+
export declare function pngDpi(png: Uint8Array): number | undefined;
|
|
22
|
+
//# sourceMappingURL=pngDpi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pngDpi.d.ts","sourceRoot":"","sources":["../../../src/download/core/pngDpi.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,MAAM,GACV,UAAU,CAAC,WAAW,CAAC,CAuBzB;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAU1D"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The resolution a PNG states, in its `pHYs` chunk.
|
|
3
|
+
*
|
|
4
|
+
* A browser writes none, and a word processor or a slide then places the
|
|
5
|
+
* picture as if it were 72 or 96 dpi — a figure painted for print arrives
|
|
6
|
+
* several times too large. Stated, it arrives at the size it was drawn.
|
|
7
|
+
*/
|
|
8
|
+
import CRC32 from 'crc-32';
|
|
9
|
+
const SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
|
|
10
|
+
/** Metres in an inch: `pHYs` counts pixels per metre. */
|
|
11
|
+
const METRES_PER_INCH = 0.0254;
|
|
12
|
+
/**
|
|
13
|
+
* A PNG stating a resolution, any resolution it stated before dropped.
|
|
14
|
+
* @param png - The PNG file's bytes.
|
|
15
|
+
* @param dpi - Dots per inch.
|
|
16
|
+
* @returns A new PNG file.
|
|
17
|
+
* @throws {Error} When the bytes are not a PNG.
|
|
18
|
+
*/
|
|
19
|
+
export function withPngDpi(png, dpi) {
|
|
20
|
+
for (let index = 0; index < SIGNATURE.length; index++) {
|
|
21
|
+
if (png[index] !== SIGNATURE[index])
|
|
22
|
+
throw new Error('Not a PNG file.');
|
|
23
|
+
}
|
|
24
|
+
const view = new DataView(png.buffer, png.byteOffset, png.byteLength);
|
|
25
|
+
const chunks = [png.subarray(0, SIGNATURE.length)];
|
|
26
|
+
let offset = SIGNATURE.length;
|
|
27
|
+
while (offset + 8 <= png.length) {
|
|
28
|
+
const end = offset + 12 + view.getUint32(offset);
|
|
29
|
+
const type = chunkType(png, offset);
|
|
30
|
+
if (type !== 'pHYs')
|
|
31
|
+
chunks.push(png.subarray(offset, end));
|
|
32
|
+
if (type === 'IHDR')
|
|
33
|
+
chunks.push(physChunk(dpi));
|
|
34
|
+
offset = end;
|
|
35
|
+
}
|
|
36
|
+
let total = 0;
|
|
37
|
+
for (const chunk of chunks)
|
|
38
|
+
total += chunk.length;
|
|
39
|
+
const result = new Uint8Array(total);
|
|
40
|
+
let position = 0;
|
|
41
|
+
for (const chunk of chunks) {
|
|
42
|
+
result.set(chunk, position);
|
|
43
|
+
position += chunk.length;
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The resolution a PNG states.
|
|
49
|
+
* @param png - The PNG file's bytes.
|
|
50
|
+
* @returns Whole dots per inch, or `undefined` when it states none.
|
|
51
|
+
*/
|
|
52
|
+
export function pngDpi(png) {
|
|
53
|
+
const view = new DataView(png.buffer, png.byteOffset, png.byteLength);
|
|
54
|
+
let offset = SIGNATURE.length;
|
|
55
|
+
while (offset + 8 <= png.length) {
|
|
56
|
+
if (chunkType(png, offset) === 'pHYs' && png[offset + 16] === 1) {
|
|
57
|
+
return Math.round(view.getUint32(offset + 8) * METRES_PER_INCH);
|
|
58
|
+
}
|
|
59
|
+
offset += 12 + view.getUint32(offset);
|
|
60
|
+
}
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
function chunkType(png, offset) {
|
|
64
|
+
return String.fromCodePoint(...png.subarray(offset + 4, offset + 8));
|
|
65
|
+
}
|
|
66
|
+
function physChunk(dpi) {
|
|
67
|
+
const chunk = new Uint8Array(21);
|
|
68
|
+
const view = new DataView(chunk.buffer);
|
|
69
|
+
view.setUint32(0, 9);
|
|
70
|
+
chunk.set([0x70, 0x48, 0x59, 0x73], 4);
|
|
71
|
+
const perMetre = Math.round(dpi / METRES_PER_INCH);
|
|
72
|
+
view.setUint32(8, perMetre);
|
|
73
|
+
view.setUint32(12, perMetre);
|
|
74
|
+
// The unit: 1 is the metre, 0 an aspect ratio with no size.
|
|
75
|
+
chunk[16] = 1;
|
|
76
|
+
view.setInt32(17, CRC32.buf(chunk.subarray(4, 17)));
|
|
77
|
+
return chunk;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=pngDpi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pngDpi.js","sourceRoot":"","sources":["../../../src/download/core/pngDpi.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,QAAQ,CAAC;AAE3B,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEnE,yDAAyD;AACzD,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,GAAe,EACf,GAAW;IAEX,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACtD,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,KAAK,C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AAe,CAAC,CAAC;IACnD,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC5B,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC7B,4DAA4D;IAC5D,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACd,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IACpD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import type { FigureNotice } from '../core/copyFigure.ts';
|
|
3
3
|
import type { FigureFormat } from '../core/downloadFigure.ts';
|
|
4
|
+
import type { FigureResolutionUnit } from '../core/figureDpi.ts';
|
|
4
5
|
import type { FigurePixels } from '../core/figureScale.ts';
|
|
5
6
|
import type { FigureSizing } from './FigureSizeRows.tsx';
|
|
6
7
|
/** What {@link FigureDownloadPanel} is drawn from. */
|
|
@@ -13,6 +14,18 @@ export interface FigureDownloadPanelProps {
|
|
|
13
14
|
scale: number;
|
|
14
15
|
/** The multiples offered. */
|
|
15
16
|
scales: readonly number[];
|
|
17
|
+
/**
|
|
18
|
+
* How the resolution reads: multiples of the figure on screen, or the dots
|
|
19
|
+
* per inch it has printed at its size on the page — 1× is 96 dpi.
|
|
20
|
+
* @default 'multiple'
|
|
21
|
+
*/
|
|
22
|
+
unit?: FigureResolutionUnit;
|
|
23
|
+
/**
|
|
24
|
+
* Whether an SVG is saved at the size it states, whatever the resolution:
|
|
25
|
+
* the resolution then paints the PNG alone, and is not offered for the SVG.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
svgAtOwnSize?: boolean;
|
|
16
29
|
/** How big the figure is on the page, or `null` where there is none. */
|
|
17
30
|
size: FigurePixels | null;
|
|
18
31
|
/** What went wrong the last time save was pressed, if anything. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FigureDownloadPanel.d.ts","sourceRoot":"","sources":["../../../src/download/ui/FigureDownloadPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FigureDownloadPanel.d.ts","sourceRoot":"","sources":["../../../src/download/ui/FigureDownloadPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKzD,sDAAsD;AACtD,MAAM,WAAW,wBAAwB;IACvC,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,MAAM,EAAE,YAAY,CAAC;IACrB,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B;;;;OAIG;IACH,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,wEAAwE;IACxE,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;IAC1B,mEAAmE;IACnE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;;OAIG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC7B,2DAA2D;IAC3D,MAAM,EAAE,OAAO,CAAC;IAChB,gDAAgD;IAChD,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAC/C,4CAA4C;IAC5C,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,mCAAmC;IACnC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB;;;OAGG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,wBAAwB,GAC9B,YAAY,CA+Ed"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLanguage } from "../../i18n/ui/useLanguage.js";
|
|
2
3
|
import { useChromeT } from "../../i18n/ui/useT.js";
|
|
3
4
|
import { OverlayAction } from "../../overlay/ui/OverlayAction.js";
|
|
4
5
|
import { OverlayPanel } from "../../overlay/ui/OverlayPanel.js";
|
|
5
6
|
import { OverlaySegmented } from "../../overlay/ui/OverlaySegmented.js";
|
|
6
7
|
import { figureLayoutSize } from "../core/figureLayout.js";
|
|
7
|
-
import { figurePixels, figureScaleFits, figureScaleLabel, formatFigurePixels, } from "../core/figureScale.js";
|
|
8
8
|
import { FigureSizeRows } from "./FigureSizeRows.js";
|
|
9
9
|
import { hintOf } from "./figureDownloadHint.js";
|
|
10
|
+
import { resolutionHelp, scaleChoices } from "./resolutionChoices.js";
|
|
10
11
|
/**
|
|
11
12
|
* The choices behind the save glyph, and the buttons that write the file and
|
|
12
13
|
* copy the picture.
|
|
@@ -30,56 +31,39 @@ export function FigureDownloadPanel(props) {
|
|
|
30
31
|
const { title, format, scale, scales, size, failure, saving } = props;
|
|
31
32
|
const { onFormatChange, onScaleChange, onSave, rasterSvg = false } = props;
|
|
32
33
|
const { sizing, onCopy, notice = null, children } = props;
|
|
34
|
+
const { unit = 'multiple', svgAtOwnSize = false } = props;
|
|
33
35
|
const t = useChromeT();
|
|
36
|
+
const language = useLanguage();
|
|
34
37
|
// What the file is drawn at: the figure on screen, or the shape picked.
|
|
35
38
|
const drawn = size === null || sizing === undefined
|
|
36
39
|
? size
|
|
37
40
|
: figureLayoutSize(sizing.layout, size, sizing.custom ?? size);
|
|
38
41
|
const painted = format === 'png' || rasterSvg;
|
|
39
|
-
|
|
42
|
+
const offerResolution = format === 'png' || !svgAtOwnSize;
|
|
43
|
+
return (_jsxs(OverlayPanel, { title: title, width: unit === 'dpi' ? DPI_PANEL_WIDTH : PANEL_WIDTH, hint: hintOf({
|
|
44
|
+
format,
|
|
45
|
+
size: drawn,
|
|
46
|
+
scale,
|
|
47
|
+
failure,
|
|
48
|
+
notice,
|
|
49
|
+
rasterSvg,
|
|
50
|
+
unit,
|
|
51
|
+
language,
|
|
52
|
+
}, t), actions: _jsxs(_Fragment, { children: [_jsx(OverlayAction, { text: t('download.save'), icon: "download", intent: "primary", disabled: size === null, busy: saving, onClick: onSave }), _jsx(OverlayAction, { text: t('clipboard.copy'), icon: "clipboard", disabled: size === null, busy: saving, onClick: onCopy })] }), children: [_jsx(OverlaySegmented, { label: t('download.format'), help: {
|
|
40
53
|
title: t('download.format'),
|
|
41
54
|
body: t('download.formatHelp'),
|
|
42
|
-
}, value: format, options: FORMAT_CHOICES, onChange: onFormatChange }), children, sizing === undefined ? null : (_jsx(FigureSizeRows, { sizing: sizing, size: size })), _jsx(OverlaySegmented, { label: t('download.resolution'), help:
|
|
43
|
-
title: t('download.resolution'),
|
|
44
|
-
body: t('download.resolutionHelp'),
|
|
45
|
-
example: {
|
|
46
|
-
code: '2×',
|
|
47
|
-
note: t('download.resolutionExample'),
|
|
48
|
-
},
|
|
49
|
-
}, value: String(scale), options: scaleChoices(scales, drawn, painted), onChange: (picked) => onScaleChange(Number(picked)) })] }));
|
|
55
|
+
}, value: format, options: FORMAT_CHOICES, onChange: onFormatChange }), children, sizing === undefined ? null : (_jsx(FigureSizeRows, { sizing: sizing, size: size })), offerResolution ? (_jsx(OverlaySegmented, { label: t('download.resolution'), help: resolutionHelp(unit, t), value: String(scale), options: scaleChoices(scales, drawn, painted, unit), onChange: (picked) => onScaleChange(Number(picked)) })) : null] }));
|
|
50
56
|
}
|
|
51
57
|
/**
|
|
52
58
|
* Wide enough for the longest hint on one line in English, so switching
|
|
53
59
|
* between PNG and SVG — whose hints differ in length — never resizes the panel.
|
|
54
60
|
*/
|
|
55
61
|
const PANEL_WIDTH = '27em';
|
|
62
|
+
/** Wide enough for the four dots per inch on one row, `1200 dpi` last. */
|
|
63
|
+
const DPI_PANEL_WIDTH = '33em';
|
|
56
64
|
/** The two files a figure can leave the page as. */
|
|
57
65
|
const FORMAT_CHOICES = [
|
|
58
66
|
{ value: 'png', label: 'PNG' },
|
|
59
67
|
{ value: 'svg', label: 'SVG' },
|
|
60
68
|
];
|
|
61
|
-
/**
|
|
62
|
-
* The multiples offered, each saying what it would actually produce.
|
|
63
|
-
*
|
|
64
|
-
* One too large for the browser to paint is greyed rather than dropped, so the
|
|
65
|
-
* reader learns the ceiling exists before they meet it as a blank file. An SVG
|
|
66
|
-
* is not painted, so it has no such ceiling.
|
|
67
|
-
* @param scales - The multiples the caller offers.
|
|
68
|
-
* @param size - How big the figure is drawn for the file.
|
|
69
|
-
* @param painted - Whether the file is painted into pixels.
|
|
70
|
-
* @returns The choices, in the order offered.
|
|
71
|
-
*/
|
|
72
|
-
function scaleChoices(scales, size, painted) {
|
|
73
|
-
const choices = [];
|
|
74
|
-
for (const scale of scales) {
|
|
75
|
-
const pixels = size === null ? null : figurePixels(size, scale);
|
|
76
|
-
choices.push({
|
|
77
|
-
value: String(scale),
|
|
78
|
-
label: figureScaleLabel(scale),
|
|
79
|
-
title: pixels === null ? undefined : formatFigurePixels(pixels),
|
|
80
|
-
disabled: painted && size !== null && !figureScaleFits(size, scale),
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
return choices;
|
|
84
|
-
}
|
|
85
69
|
//# sourceMappingURL=FigureDownloadPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FigureDownloadPanel.js","sourceRoot":"","sources":["../../../src/download/ui/FigureDownloadPanel.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAoC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAmC,CAAC;AAEjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"FigureDownloadPanel.js","sourceRoot":"","sources":["../../../src/download/ui/FigureDownloadPanel.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAoC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAmC,CAAC;AAEjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAuC,CAAC;AAIzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAI3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAqEtE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAA+B;IAE/B,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAA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