react-cheminfo 0.33.0 → 0.35.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 +28 -28
- package/lib/about/core/about.d.ts +1 -30
- package/lib/about/core/about.d.ts.map +1 -1
- package/lib/about/core/about.js +0 -16
- package/lib/about/core/about.js.map +1 -1
- package/lib/about/core/index.d.ts +0 -1
- package/lib/about/core/index.d.ts.map +1 -1
- package/lib/about/core/index.js +0 -1
- package/lib/about/core/index.js.map +1 -1
- package/lib/about/ui/AboutBuild.d.ts +2 -5
- package/lib/about/ui/AboutBuild.d.ts.map +1 -1
- package/lib/about/ui/AboutBuild.js +7 -19
- package/lib/about/ui/AboutBuild.js.map +1 -1
- package/lib/about/ui/AboutPage.d.ts +2 -2
- package/lib/about/ui/AboutPage.d.ts.map +1 -1
- package/lib/about/ui/AboutPage.js +3 -14
- package/lib/about/ui/AboutPage.js.map +1 -1
- package/lib/about/ui/AboutVersion.d.ts +0 -4
- package/lib/about/ui/AboutVersion.d.ts.map +1 -1
- package/lib/about/ui/AboutVersion.js +3 -31
- package/lib/about/ui/AboutVersion.js.map +1 -1
- package/lib/axis/core/axisMarks.d.ts +54 -0
- package/lib/axis/core/axisMarks.d.ts.map +1 -0
- package/lib/axis/core/axisMarks.js +69 -0
- package/lib/axis/core/axisMarks.js.map +1 -0
- package/lib/axis/core/axisScale.d.ts +31 -0
- package/lib/axis/core/axisScale.d.ts.map +1 -0
- package/lib/axis/core/axisScale.js +31 -0
- package/lib/axis/core/axisScale.js.map +1 -0
- package/lib/axis/core/index.d.ts +16 -0
- package/lib/axis/core/index.d.ts.map +1 -0
- package/lib/axis/core/index.js +13 -0
- package/lib/axis/core/index.js.map +1 -0
- package/lib/axis/core/logAxisBounds.d.ts +78 -0
- package/lib/axis/core/logAxisBounds.d.ts.map +1 -0
- package/lib/axis/core/logAxisBounds.js +129 -0
- package/lib/axis/core/logAxisBounds.js.map +1 -0
- package/lib/axis/ui/AxisScaleControl.d.ts +66 -0
- package/lib/axis/ui/AxisScaleControl.d.ts.map +1 -0
- package/lib/axis/ui/AxisScaleControl.js +26 -0
- package/lib/axis/ui/AxisScaleControl.js.map +1 -0
- package/lib/axis/ui/index.d.ts +6 -0
- package/lib/axis/ui/index.d.ts.map +1 -0
- package/lib/axis/ui/index.js +5 -0
- package/lib/axis/ui/index.js.map +1 -0
- package/lib/core.d.ts +1 -0
- package/lib/core.d.ts.map +1 -1
- package/lib/core.js +1 -0
- package/lib/core.js.map +1 -1
- package/lib/delimited/core/index.d.ts +2 -0
- package/lib/delimited/core/index.d.ts.map +1 -1
- package/lib/delimited/core/index.js +1 -0
- package/lib/delimited/core/index.js.map +1 -1
- package/lib/delimited/core/tableRows.d.ts +49 -0
- package/lib/delimited/core/tableRows.d.ts.map +1 -0
- package/lib/delimited/core/tableRows.js +63 -0
- package/lib/delimited/core/tableRows.js.map +1 -0
- package/lib/delimited/ui/DelimitedTextPanel.d.ts +9 -0
- package/lib/delimited/ui/DelimitedTextPanel.d.ts.map +1 -1
- package/lib/delimited/ui/DelimitedTextPanel.js +3 -2
- package/lib/delimited/ui/DelimitedTextPanel.js.map +1 -1
- package/lib/delimited/ui/TableDataButton.d.ts +96 -0
- package/lib/delimited/ui/TableDataButton.d.ts.map +1 -0
- package/lib/delimited/ui/TableDataButton.js +39 -0
- package/lib/delimited/ui/TableDataButton.js.map +1 -0
- package/lib/delimited/ui/index.d.ts +2 -0
- package/lib/delimited/ui/index.d.ts.map +1 -1
- package/lib/delimited/ui/index.js +1 -0
- package/lib/delimited/ui/index.js.map +1 -1
- package/lib/download/core/index.d.ts +0 -5
- package/lib/download/core/index.d.ts.map +1 -1
- package/lib/download/core/index.js +0 -3
- package/lib/download/core/index.js.map +1 -1
- package/lib/download/ui/FigureDownload.d.ts +4 -55
- package/lib/download/ui/FigureDownload.d.ts.map +1 -1
- package/lib/download/ui/FigureDownload.js +6 -66
- package/lib/download/ui/FigureDownload.js.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.d.ts +16 -2
- package/lib/download/ui/FigureDownloadPanel.d.ts.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.js +11 -30
- package/lib/download/ui/FigureDownloadPanel.js.map +1 -1
- package/lib/download/ui/figureDownloadHint.d.ts +30 -0
- package/lib/download/ui/figureDownloadHint.d.ts.map +1 -0
- package/lib/download/ui/figureDownloadHint.js +33 -0
- package/lib/download/ui/figureDownloadHint.js.map +1 -0
- package/lib/download/ui/index.d.ts +3 -10
- package/lib/download/ui/index.d.ts.map +1 -1
- package/lib/download/ui/index.js +1 -5
- package/lib/download/ui/index.js.map +1 -1
- package/lib/download/ui/useFigureActions.d.ts +50 -0
- package/lib/download/ui/useFigureActions.d.ts.map +1 -0
- package/lib/download/ui/useFigureActions.js +58 -0
- package/lib/download/ui/useFigureActions.js.map +1 -0
- package/lib/download/ui/useFigureDownload.d.ts +85 -0
- package/lib/download/ui/useFigureDownload.d.ts.map +1 -0
- package/lib/download/ui/useFigureDownload.js +75 -0
- package/lib/download/ui/useFigureDownload.js.map +1 -0
- package/lib/ecosystem/core/sites.d.ts.map +1 -1
- package/lib/ecosystem/core/sites.js +0 -40
- package/lib/ecosystem/core/sites.js.map +1 -1
- package/lib/ecosystem/core/types.d.ts +0 -10
- package/lib/ecosystem/core/types.d.ts.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/irCommands.d.ts +2 -2
- package/lib/ir/core/irCommands.js +2 -2
- package/lib/ir/core/irCommands.js.map +1 -1
- package/lib/ir/ui/IrAboutDialog.d.ts.map +1 -1
- package/lib/ir/ui/IrAboutDialog.js +1 -1
- package/lib/ir/ui/IrAboutDialog.js.map +1 -1
- package/lib/ir/ui/IrCanvas.d.ts +6 -0
- package/lib/ir/ui/IrCanvas.d.ts.map +1 -1
- package/lib/ir/ui/IrCanvas.js +2 -2
- package/lib/ir/ui/IrCanvas.js.map +1 -1
- package/lib/ir/ui/IrShell.d.ts.map +1 -1
- package/lib/ir/ui/IrShell.js +16 -11
- package/lib/ir/ui/IrShell.js.map +1 -1
- package/lib/ir/ui/IrToolbar.d.ts +11 -1
- package/lib/ir/ui/IrToolbar.d.ts.map +1 -1
- package/lib/ir/ui/IrToolbar.js +12 -2
- package/lib/ir/ui/IrToolbar.js.map +1 -1
- package/lib/ir/ui/index.d.ts +1 -0
- package/lib/ir/ui/index.d.ts.map +1 -1
- package/lib/ir/ui/index.js.map +1 -1
- package/lib/locales/de.json +8 -4
- package/lib/locales/en.json +8 -4
- package/lib/locales/es.json +8 -4
- package/lib/locales/fr.json +8 -4
- package/lib/locales/it.json +8 -4
- package/lib/overlay/ui/OverlayPanel.d.ts +6 -0
- package/lib/overlay/ui/OverlayPanel.d.ts.map +1 -1
- package/lib/overlay/ui/OverlayPanel.js +2 -2
- package/lib/overlay/ui/OverlayPanel.js.map +1 -1
- package/lib/overlay/ui/overlayPanelStyles.d.ts +2 -1
- package/lib/overlay/ui/overlayPanelStyles.d.ts.map +1 -1
- package/lib/overlay/ui/overlayPanelStyles.js +3 -1
- package/lib/overlay/ui/overlayPanelStyles.js.map +1 -1
- package/lib/periodic/core/index.d.ts +1 -1
- package/lib/periodic/core/index.d.ts.map +1 -1
- package/lib/periodic/core/index.js +1 -1
- package/lib/periodic/core/index.js.map +1 -1
- package/lib/periodic/core/layout.d.ts +18 -0
- package/lib/periodic/core/layout.d.ts.map +1 -1
- package/lib/periodic/core/layout.js +9 -0
- package/lib/periodic/core/layout.js.map +1 -1
- package/lib/periodic/ui/ElementCell.d.ts +0 -6
- package/lib/periodic/ui/ElementCell.d.ts.map +1 -1
- package/lib/periodic/ui/ElementCell.js +35 -19
- package/lib/periodic/ui/ElementCell.js.map +1 -1
- package/lib/periodic/ui/PeriodicTable.d.ts +12 -1
- package/lib/periodic/ui/PeriodicTable.d.ts.map +1 -1
- package/lib/periodic/ui/PeriodicTable.js +34 -15
- package/lib/periodic/ui/PeriodicTable.js.map +1 -1
- package/lib/ui.d.ts +1 -0
- package/lib/ui.d.ts.map +1 -1
- package/lib/ui.js +1 -0
- package/lib/ui.js.map +1 -1
- package/package.json +1 -1
- package/src/about/core/about.ts +1 -51
- package/src/about/core/index.ts +0 -1
- package/src/about/ui/AboutBuild.tsx +8 -37
- package/src/about/ui/AboutPage.tsx +8 -64
- package/src/about/ui/AboutVersion.tsx +5 -45
- package/src/axis/core/axisMarks.ts +114 -0
- package/src/axis/core/axisScale.ts +41 -0
- package/src/axis/core/index.ts +20 -0
- package/src/axis/core/logAxisBounds.ts +198 -0
- package/src/axis/ui/AxisScaleControl.tsx +103 -0
- package/src/axis/ui/index.ts +9 -0
- package/src/core.ts +1 -0
- package/src/delimited/core/index.ts +2 -0
- package/src/delimited/core/tableRows.ts +93 -0
- package/src/delimited/ui/DelimitedTextPanel.tsx +25 -9
- package/src/delimited/ui/TableDataButton.tsx +162 -0
- package/src/delimited/ui/index.ts +2 -0
- package/src/download/core/index.ts +0 -25
- package/src/download/ui/FigureDownload.tsx +11 -148
- package/src/download/ui/FigureDownloadPanel.tsx +46 -45
- package/src/download/ui/figureDownloadHint.ts +52 -0
- package/src/download/ui/index.ts +6 -10
- package/src/download/ui/useFigureActions.ts +113 -0
- package/src/download/ui/useFigureDownload.tsx +191 -0
- package/src/ecosystem/core/sites.ts +0 -40
- package/src/ecosystem/core/types.ts +0 -10
- package/src/ir/core/irCommands.ts +2 -2
- package/src/ir/ui/IrAboutDialog.tsx +0 -13
- package/src/ir/ui/IrCanvas.tsx +8 -2
- package/src/ir/ui/IrShell.tsx +23 -25
- package/src/ir/ui/IrToolbar.tsx +36 -6
- package/src/ir/ui/index.ts +1 -0
- package/src/locales/de.json +8 -4
- package/src/locales/en.json +8 -4
- package/src/locales/es.json +8 -4
- package/src/locales/fr.json +8 -4
- package/src/locales/it.json +8 -4
- package/src/overlay/ui/OverlayPanel.tsx +8 -2
- package/src/overlay/ui/overlayPanelStyles.ts +3 -0
- package/src/periodic/core/index.ts +1 -0
- package/src/periodic/core/layout.ts +19 -0
- package/src/periodic/ui/ElementCell.tsx +35 -26
- package/src/periodic/ui/PeriodicTable.tsx +55 -16
- package/src/ui.ts +1 -0
- package/styles/chrome.css +71 -0
- package/lib/about/core/repository.d.ts +0 -14
- package/lib/about/core/repository.d.ts.map +0 -1
- package/lib/about/core/repository.js +0 -21
- package/lib/about/core/repository.js.map +0 -1
- package/lib/download/core/exportStyles.d.ts +0 -22
- package/lib/download/core/exportStyles.d.ts.map +0 -1
- package/lib/download/core/exportStyles.js +0 -19
- package/lib/download/core/exportStyles.js.map +0 -1
- package/lib/download/core/imageResolution.d.ts +0 -88
- package/lib/download/core/imageResolution.d.ts.map +0 -1
- package/lib/download/core/imageResolution.js +0 -77
- package/lib/download/core/imageResolution.js.map +0 -1
- package/lib/download/core/pictureExport.d.ts +0 -93
- package/lib/download/core/pictureExport.d.ts.map +0 -1
- package/lib/download/core/pictureExport.js +0 -116
- package/lib/download/core/pictureExport.js.map +0 -1
- package/lib/download/ui/ExportDialogFrame.d.ts +0 -46
- package/lib/download/ui/ExportDialogFrame.d.ts.map +0 -1
- package/lib/download/ui/ExportDialogFrame.js +0 -24
- package/lib/download/ui/ExportDialogFrame.js.map +0 -1
- package/lib/download/ui/ExportImageDialog.d.ts +0 -47
- package/lib/download/ui/ExportImageDialog.d.ts.map +0 -1
- package/lib/download/ui/ExportImageDialog.js +0 -25
- package/lib/download/ui/ExportImageDialog.js.map +0 -1
- package/lib/download/ui/ExportNameField.d.ts +0 -29
- package/lib/download/ui/ExportNameField.d.ts.map +0 -1
- package/lib/download/ui/ExportNameField.js +0 -99
- package/lib/download/ui/ExportNameField.js.map +0 -1
- package/lib/download/ui/ExportPictureSection.d.ts +0 -38
- package/lib/download/ui/ExportPictureSection.d.ts.map +0 -1
- package/lib/download/ui/ExportPictureSection.js +0 -48
- package/lib/download/ui/ExportPictureSection.js.map +0 -1
- package/lib/download/ui/useDrawingBox.d.ts +0 -23
- package/lib/download/ui/useDrawingBox.d.ts.map +0 -1
- package/lib/download/ui/useDrawingBox.js +0 -21
- package/lib/download/ui/useDrawingBox.js.map +0 -1
- package/src/about/core/repository.ts +0 -22
- package/src/download/core/exportStyles.ts +0 -20
- package/src/download/core/imageResolution.ts +0 -118
- package/src/download/core/pictureExport.ts +0 -207
- package/src/download/ui/ExportDialogFrame.tsx +0 -86
- package/src/download/ui/ExportImageDialog.tsx +0 -91
- package/src/download/ui/ExportNameField.tsx +0 -148
- package/src/download/ui/ExportPictureSection.tsx +0 -142
- package/src/download/ui/useDrawingBox.ts +0 -37
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { writeImageToClipboard } from "../../clipboard/core/copyPng.js";
|
|
2
|
-
import { downloadBlob } from "./downloadBlob.js";
|
|
3
|
-
import { downloadText } from "./downloadText.js";
|
|
4
|
-
import { imageSize } from "./imageResolution.js";
|
|
5
|
-
import { contentBox, elementBox } from "./svgBounds.js";
|
|
6
|
-
import { svgToPng } from "./svgToPng.js";
|
|
7
|
-
import { svgToString } from "./svgToString.js";
|
|
8
|
-
/**
|
|
9
|
-
* Room left around a drawing in a written-out picture, in drawing units.
|
|
10
|
-
*
|
|
11
|
-
* Enough that a name written under the bottom of the drawing, and the stroke
|
|
12
|
-
* around its outermost mark, are inside the picture rather than against its
|
|
13
|
-
* edge.
|
|
14
|
-
*/
|
|
15
|
-
export const PICTURE_PADDING = 12;
|
|
16
|
-
/**
|
|
17
|
-
* How big the drawing comes out at a resolution, before it is written out.
|
|
18
|
-
*
|
|
19
|
-
* What is measured is what the picture will be of rather than whatever is on
|
|
20
|
-
* screen, so the answer does not change when the window is resized or the
|
|
21
|
-
* drawing panned — the size shown next to the resolution is the size of the
|
|
22
|
-
* file that is about to be written.
|
|
23
|
-
* @param svg - The element, as it is rendered.
|
|
24
|
-
* @param scale - How many pixels each drawing unit becomes.
|
|
25
|
-
* @param options - What the picture is of.
|
|
26
|
-
* @returns The size, or `null` when nothing is drawn.
|
|
27
|
-
*/
|
|
28
|
-
export function pictureSize(svg, scale, options = {}) {
|
|
29
|
-
const box = svg && pictureBox(svg, options);
|
|
30
|
-
return box && imageSize(box, scale);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Put the drawing on the clipboard as a PNG.
|
|
34
|
-
*
|
|
35
|
-
* The rasterization is handed to the clipboard as a promise rather than awaited
|
|
36
|
-
* first: Safari only allows a clipboard write the click itself started.
|
|
37
|
-
* @param svg - The element, as it is rendered.
|
|
38
|
-
* @param options - How big to make it.
|
|
39
|
-
* @returns Whether it was copied. `false` when nothing is drawn, and in a
|
|
40
|
-
* browser whose clipboard takes text only.
|
|
41
|
-
*/
|
|
42
|
-
export async function copyPicture(svg, options = {}) {
|
|
43
|
-
const written = describe(svg, options);
|
|
44
|
-
if (!written)
|
|
45
|
-
return false;
|
|
46
|
-
return await writeImageToClipboard(svgToPng(written.svg, written.png));
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Save the drawing as a PNG.
|
|
50
|
-
* @param svg - The element, as it is rendered.
|
|
51
|
-
* @param options - How big to make it, and what to call it.
|
|
52
|
-
* @returns Whether it was saved. `false` when nothing is drawn.
|
|
53
|
-
*/
|
|
54
|
-
export async function savePngPicture(svg, options = {}) {
|
|
55
|
-
const written = describe(svg, options);
|
|
56
|
-
if (!written)
|
|
57
|
-
return false;
|
|
58
|
-
downloadBlob(await svgToPng(written.svg, written.png), `${written.name}.png`);
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Save the drawing as an SVG.
|
|
63
|
-
*
|
|
64
|
-
* The resolution is carried into the file as the size it opens at, but the
|
|
65
|
-
* shapes stay shapes: an SVG printed at any size is drawn again rather than
|
|
66
|
-
* enlarged, which is the reason to prefer it wherever it can go.
|
|
67
|
-
* @param svg - The element, as it is rendered.
|
|
68
|
-
* @param options - How big to make it, and what to call it.
|
|
69
|
-
* @returns Whether it was saved. `false` when nothing is drawn.
|
|
70
|
-
*/
|
|
71
|
-
export function saveSvgPicture(svg, options = {}) {
|
|
72
|
-
const written = describe(svg, options);
|
|
73
|
-
if (!written)
|
|
74
|
-
return false;
|
|
75
|
-
downloadText(svgToString(written.svg, written.png), `${written.name}.svg`, 'image/svg+xml');
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* The rectangle a picture of the element would cover, in drawing units.
|
|
80
|
-
* @param svg - The element, as it is rendered.
|
|
81
|
-
* @param options - What the picture is of.
|
|
82
|
-
* @returns The rectangle, or `null` when nothing is drawn.
|
|
83
|
-
*/
|
|
84
|
-
function pictureBox(svg, options) {
|
|
85
|
-
const { frame = 'content', padding = PICTURE_PADDING } = options;
|
|
86
|
-
return frame === 'content' ? contentBox(svg, padding) : elementBox(svg);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Work out what a picture of the element would be.
|
|
90
|
-
* @param svg - The element, as it is rendered.
|
|
91
|
-
* @param options - How big to make it, and what to call it.
|
|
92
|
-
* @returns The element and the rectangle to write out, or `null` when nothing
|
|
93
|
-
* is drawn.
|
|
94
|
-
*/
|
|
95
|
-
function describe(svg, options) {
|
|
96
|
-
const { scale = 2, filename = 'picture', label = 'Drawing', frame = 'content', } = options;
|
|
97
|
-
if (!svg)
|
|
98
|
-
return null;
|
|
99
|
-
const box = pictureBox(svg, options);
|
|
100
|
-
if (!box)
|
|
101
|
-
return null;
|
|
102
|
-
const size = imageSize(box, scale);
|
|
103
|
-
return {
|
|
104
|
-
svg,
|
|
105
|
-
// A picture of the element keeps the `viewBox` the element was drawn with,
|
|
106
|
-
// which is the one thing that makes its own scaling come out right.
|
|
107
|
-
png: {
|
|
108
|
-
box: frame === 'content' ? box : null,
|
|
109
|
-
width: size.width,
|
|
110
|
-
height: size.height,
|
|
111
|
-
label,
|
|
112
|
-
},
|
|
113
|
-
name: filename,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
//# sourceMappingURL=pictureExport.js.map
|
|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CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IAEtB,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACnC,OAAO;QACL,GAAG;QACH,2EAA2E;QAC3E,oEAAoE;QACpE,GAAG,EAAE;YACH,GAAG,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI;YACrC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK;SACN;QACD,IAAI,EAAE,QAAQ;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { IconName } from '@blueprintjs/core';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
export interface ExportDialogFrameProps {
|
|
4
|
-
/** Whether the dialog is showing. */
|
|
5
|
-
isOpen: boolean;
|
|
6
|
-
/** What it is about, along the top. */
|
|
7
|
-
title: string;
|
|
8
|
-
/** The icon beside that title. */
|
|
9
|
-
icon: IconName;
|
|
10
|
-
/**
|
|
11
|
-
* The name saved files take, without their extension; the section is keyed on
|
|
12
|
-
* it, so a file saved under a new name is what the name box opens on next
|
|
13
|
-
* time rather than what was typed and then thought better of.
|
|
14
|
-
*/
|
|
15
|
-
filename: string;
|
|
16
|
-
/**
|
|
17
|
-
* How wide the dialog opens, in pixels. A section showing text needs the room
|
|
18
|
-
* to show a molfile line whole; one showing controls does not.
|
|
19
|
-
* @default 560
|
|
20
|
-
*/
|
|
21
|
-
width?: number;
|
|
22
|
-
/**
|
|
23
|
-
* Whether the section is mounted only while the dialog is open, for a section
|
|
24
|
-
* whose work — measuring a picture off the page — is only worth doing while
|
|
25
|
-
* it is being looked at.
|
|
26
|
-
* @default false
|
|
27
|
-
*/
|
|
28
|
-
mountWhileOpen?: boolean;
|
|
29
|
-
/** The section, built with the status setter the footer reads. */
|
|
30
|
-
children: (onStatus: (status: string) => void) => ReactNode;
|
|
31
|
-
/** Called when the dialog is dismissed. */
|
|
32
|
-
onClose: () => void;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* The frame every export dialog shares: the section, and what it last did.
|
|
36
|
-
*
|
|
37
|
-
* Each thing the editor writes out gets a dialog of its own rather than one
|
|
38
|
-
* shared dialog of tabs, since a picture, a structure and a sequence are asked
|
|
39
|
-
* for at different moments; what they have in common is only the frame, which
|
|
40
|
-
* is here so the three cannot come to differ in how they close or where they
|
|
41
|
-
* say what they wrote.
|
|
42
|
-
* @param props - Component props.
|
|
43
|
-
* @returns The dialog.
|
|
44
|
-
*/
|
|
45
|
-
export declare function ExportDialogFrame(props: ExportDialogFrameProps): import("react").JSX.Element;
|
|
46
|
-
//# sourceMappingURL=ExportDialogFrame.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExportDialogFrame.d.ts","sourceRoot":"","sources":["../../../src/download/ui/ExportDialogFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,MAAM,WAAW,sBAAsB;IACrC,qCAAqC;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kEAAkE;IAClE,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,SAAS,CAAC;IAC5D,2CAA2C;IAC3C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,+BAgC9D"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import { useConfirmOnEnter } from "../../panel/ui/useConfirmOnEnter.js";
|
|
5
|
-
import { exportNoteStyle } from "../core/exportStyles.js";
|
|
6
|
-
/**
|
|
7
|
-
* The frame every export dialog shares: the section, and what it last did.
|
|
8
|
-
*
|
|
9
|
-
* Each thing the editor writes out gets a dialog of its own rather than one
|
|
10
|
-
* shared dialog of tabs, since a picture, a structure and a sequence are asked
|
|
11
|
-
* for at different moments; what they have in common is only the frame, which
|
|
12
|
-
* is here so the three cannot come to differ in how they close or where they
|
|
13
|
-
* say what they wrote.
|
|
14
|
-
* @param props - Component props.
|
|
15
|
-
* @returns The dialog.
|
|
16
|
-
*/
|
|
17
|
-
export function ExportDialogFrame(props) {
|
|
18
|
-
const { isOpen, title, icon, filename, width = DEFAULT_WIDTH, mountWhileOpen = false, children, onClose, } = props;
|
|
19
|
-
const [status, setStatus] = useState(null);
|
|
20
|
-
useConfirmOnEnter(isOpen, onClose);
|
|
21
|
-
return (_jsxs(Dialog, { isOpen: isOpen, title: title, icon: icon, style: { width, maxWidth: '92vw' }, onClose: onClose, children: [_jsx(DialogBody, { children: mountWhileOpen && !isOpen ? null : children(setStatus) }, filename), _jsx(DialogFooter, { actions: _jsx(Button, { text: "Close", onClick: onClose }), children: _jsx("span", { style: exportNoteStyle, children: status }) })] }));
|
|
22
|
-
}
|
|
23
|
-
const DEFAULT_WIDTH = 560;
|
|
24
|
-
//# sourceMappingURL=ExportDialogFrame.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExportDialogFrame.js","sourceRoot":"","sources":["../../../src/download/ui/ExportDialogFrame.tsx"],"names":[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DialogProps {
|
|
3
|
-
/** Whether the dialog is showing. */
|
|
4
|
-
isOpen: boolean;
|
|
5
|
-
/**
|
|
6
|
-
* The drawing the picture is taken of, as it is rendered. Read when a button
|
|
7
|
-
* is pressed rather than passed in, since a drawing is laid out again on
|
|
8
|
-
* every resize. `null` when nothing is drawn.
|
|
9
|
-
*/
|
|
10
|
-
getDrawing: () => SVGSVGElement | null;
|
|
11
|
-
/**
|
|
12
|
-
* The name saved files take, without their extension.
|
|
13
|
-
* @default 'picture'
|
|
14
|
-
*/
|
|
15
|
-
filename?: string;
|
|
16
|
-
/**
|
|
17
|
-
* What the picture is read out as in the file it is written to, in place of
|
|
18
|
-
* the instructions the element carries for whoever is working it.
|
|
19
|
-
* @default 'Drawing'
|
|
20
|
-
*/
|
|
21
|
-
label?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Whether the picture is the drawing inside the element — a canvas, which is
|
|
24
|
-
* mostly the empty space around what is on it — or the element as it is laid
|
|
25
|
-
* out, which is what a chart drawn to the box it was given is.
|
|
26
|
-
* @default 'content'
|
|
27
|
-
*/
|
|
28
|
-
frame?: PictureFrame;
|
|
29
|
-
/** Called when the dialog is dismissed. */
|
|
30
|
-
onClose: () => void;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* A drawing as a picture: PNG at a chosen resolution, or SVG.
|
|
34
|
-
*
|
|
35
|
-
* How big it comes out is asked rather than guessed, since only one size could
|
|
36
|
-
* be the default and neither a figure nor a thumbnail is it. SVG is the honest
|
|
37
|
-
* answer wherever it is accepted — it is drawn again at whatever size it is
|
|
38
|
-
* printed — so the resolution there is only the size the file opens at.
|
|
39
|
-
*
|
|
40
|
-
* The same dialog writes out a glycan, a molecule and a spectrum, because none
|
|
41
|
-
* of what it does depends on what is drawn: it is handed an SVG element that is
|
|
42
|
-
* already on the page, and asks it how big it is.
|
|
43
|
-
* @param props - Component props.
|
|
44
|
-
* @returns The dialog.
|
|
45
|
-
*/
|
|
46
|
-
export declare function ExportImageDialog(props: ExportImageDialogProps): import("react").JSX.Element;
|
|
47
|
-
//# sourceMappingURL=ExportImageDialog.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExportImageDialog.d.ts","sourceRoot":"","sources":["../../../src/download/ui/ExportImageDialog.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAK7D,MAAM,WAAW,sBAAsB;IACrC,qCAAqC;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,UAAU,EAAE,MAAM,aAAa,GAAG,IAAI,CAAC;IACvC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,2CAA2C;IAC3C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,+BAqC9D"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { DEFAULT_IMAGE_RESOLUTION } from "../core/imageResolution.js";
|
|
4
|
-
import { ExportDialogFrame } from "./ExportDialogFrame.js";
|
|
5
|
-
import { ExportPictureSection } from "./ExportPictureSection.js";
|
|
6
|
-
/**
|
|
7
|
-
* A drawing as a picture: PNG at a chosen resolution, or SVG.
|
|
8
|
-
*
|
|
9
|
-
* How big it comes out is asked rather than guessed, since only one size could
|
|
10
|
-
* be the default and neither a figure nor a thumbnail is it. SVG is the honest
|
|
11
|
-
* answer wherever it is accepted — it is drawn again at whatever size it is
|
|
12
|
-
* printed — so the resolution there is only the size the file opens at.
|
|
13
|
-
*
|
|
14
|
-
* The same dialog writes out a glycan, a molecule and a spectrum, because none
|
|
15
|
-
* of what it does depends on what is drawn: it is handed an SVG element that is
|
|
16
|
-
* already on the page, and asks it how big it is.
|
|
17
|
-
* @param props - Component props.
|
|
18
|
-
* @returns The dialog.
|
|
19
|
-
*/
|
|
20
|
-
export function ExportImageDialog(props) {
|
|
21
|
-
const { isOpen, getDrawing, filename = 'picture', label = 'Drawing', frame, onClose, } = props;
|
|
22
|
-
const [resolutionId, setResolutionId] = useState(DEFAULT_IMAGE_RESOLUTION.id);
|
|
23
|
-
return (_jsx(ExportDialogFrame, { isOpen: isOpen, title: "Export as an image", icon: "media", filename: filename, width: 460, mountWhileOpen: true, onClose: onClose, children: (onStatus) => (_jsx(ExportPictureSection, { getDrawing: getDrawing, resolutionId: resolutionId, onResolutionChange: setResolutionId, filename: filename, label: label, frame: frame, onStatus: onStatus })) }));
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=ExportImageDialog.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExportImageDialog.js","sourceRoot":"","sources":["../../../src/download/ui/ExportImageDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA4B,CAAC;AAiClE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,EACJ,MAAM,EACN,UAAU,EACV,QAAQ,GAAG,SAAS,EACpB,KAAK,GAAG,SAAS,EACjB,KAAK,EACL,OAAO,GACR,GAAG,KAAK,CAAC;IAEV,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAC9C,wBAAwB,CAAC,EAAE,CAC5B,CAAC;IAEF,OAAO,CACL,KAAC,iBAAiB,IAChB,MAAM,EAAE,MAAM,EACd,KAAK,EAAC,oBAAoB,EAC1B,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,GAAG,EACV,cAAc,QACd,OAAO,EAAE,OAAO,YAEf,CAAC,QAAQ,EAAE,EAAE,CAAC,CACb,KAAC,oBAAoB,IACnB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,kBAAkB,EAAE,eAAe,EACnC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,GAClB,CACH,GACiB,CACrB,CAAC;AACJ,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export interface ExportNameFieldProps {
|
|
2
|
-
/** What is in the box, without an extension. */
|
|
3
|
-
name: string;
|
|
4
|
-
/**
|
|
5
|
-
* The extension the file is about to take, shown after what is typed.
|
|
6
|
-
* @default ''
|
|
7
|
-
*/
|
|
8
|
-
extension?: string;
|
|
9
|
-
/** Called with what was typed. */
|
|
10
|
-
onChange: (name: string) => void;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* What the file about to be written out is called.
|
|
14
|
-
*
|
|
15
|
-
* It sits at the right of the row of buttons, against the one that writes the
|
|
16
|
-
* file, because that is what it is about — copying takes no name, and puts
|
|
17
|
-
* itself at the other end of the row. The name the editor came in with is
|
|
18
|
-
* offered, since that is what a glycan is usually saved under, but a picture
|
|
19
|
-
* for a slide and a molfile for a docking run are rarely wanted under it.
|
|
20
|
-
*
|
|
21
|
-
* The box grows with what is typed, so the extension sits directly against the
|
|
22
|
-
* name and the two read as the one filename they are about to become. Held to a
|
|
23
|
-
* fixed width instead, the extension hangs at the far edge with the gap between
|
|
24
|
-
* them reading as part of neither.
|
|
25
|
-
* @param props - Component props.
|
|
26
|
-
* @returns The field.
|
|
27
|
-
*/
|
|
28
|
-
export declare function ExportNameField(props: ExportNameFieldProps): import("react").JSX.Element;
|
|
29
|
-
//# sourceMappingURL=ExportNameField.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExportNameField.d.ts","sourceRoot":"","sources":["../../../src/download/ui/ExportNameField.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,+BAmD1D"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useLayoutEffect, useRef } from 'react';
|
|
3
|
-
import { TOKEN } from "../../tokens/core/familyTokens.js";
|
|
4
|
-
/**
|
|
5
|
-
* What the file about to be written out is called.
|
|
6
|
-
*
|
|
7
|
-
* It sits at the right of the row of buttons, against the one that writes the
|
|
8
|
-
* file, because that is what it is about — copying takes no name, and puts
|
|
9
|
-
* itself at the other end of the row. The name the editor came in with is
|
|
10
|
-
* offered, since that is what a glycan is usually saved under, but a picture
|
|
11
|
-
* for a slide and a molfile for a docking run are rarely wanted under it.
|
|
12
|
-
*
|
|
13
|
-
* The box grows with what is typed, so the extension sits directly against the
|
|
14
|
-
* name and the two read as the one filename they are about to become. Held to a
|
|
15
|
-
* fixed width instead, the extension hangs at the far edge with the gap between
|
|
16
|
-
* them reading as part of neither.
|
|
17
|
-
* @param props - Component props.
|
|
18
|
-
* @returns The field.
|
|
19
|
-
*/
|
|
20
|
-
export function ExportNameField(props) {
|
|
21
|
-
const { name, extension = '', onChange } = props;
|
|
22
|
-
const input = useRef(null);
|
|
23
|
-
const mirror = useRef(null);
|
|
24
|
-
const ruler = useRef(null);
|
|
25
|
-
// Measured off a copy of the text in the same font rather than counted in
|
|
26
|
-
// characters, which only holds for a monospace one. The width is set on the
|
|
27
|
-
// element instead of kept in state: it is what the browser has just measured,
|
|
28
|
-
// so rendering again to store it would measure the same thing twice.
|
|
29
|
-
useLayoutEffect(() => {
|
|
30
|
-
if (!input.current || !mirror.current || !ruler.current)
|
|
31
|
-
return;
|
|
32
|
-
const measured = mirror.current.offsetWidth + CARET;
|
|
33
|
-
const floor = ruler.current.offsetWidth;
|
|
34
|
-
input.current.style.width = `${Math.min(Math.max(measured, floor), MAXIMUM)}px`;
|
|
35
|
-
});
|
|
36
|
-
return (_jsx("div", { style: fieldStyle, children: _jsxs("div", { className: "bp6-input", style: boxStyle, children: [_jsx("input", { ref: input, value: name, "aria-label": "File name", placeholder: PLACEHOLDER, spellCheck: false, autoComplete: "off", style: inputStyle, onChange: (event) => onChange(event.target.value),
|
|
37
|
-
// The name is in force as it is typed, so Enter has nothing left to
|
|
38
|
-
// confirm — and is kept off the dialog, whose answer is to close.
|
|
39
|
-
onKeyDown: (event) => {
|
|
40
|
-
if (event.key === 'Enter')
|
|
41
|
-
event.stopPropagation();
|
|
42
|
-
} }), extension === '' ? null : (_jsx("span", { style: extensionStyle, children: extension })), _jsx("span", { ref: mirror, style: mirrorStyle, "aria-hidden": "true", children: name === '' ? PLACEHOLDER : name }), _jsx("span", { ref: ruler, style: mirrorStyle, "aria-hidden": "true", children: FLOOR_SAMPLE })] }) }));
|
|
43
|
-
}
|
|
44
|
-
/** What the box says when nothing has been typed into it. */
|
|
45
|
-
const PLACEHOLDER = 'File name';
|
|
46
|
-
/** Room for the caret past the last character, so it is never clipped. */
|
|
47
|
-
const CARET = 2;
|
|
48
|
-
/**
|
|
49
|
-
* Twenty characters, which the box is never narrower than.
|
|
50
|
-
*
|
|
51
|
-
* A name is typed into this box as often as it is read out of it, and a box cut
|
|
52
|
-
* to `glycan` leaves no room to do that in — so the floor is a name of the
|
|
53
|
-
* length one usually is, measured in the box's own font rather than counted at
|
|
54
|
-
* some assumed character width. `n` is about the average width of a lowercase
|
|
55
|
-
* letter, which is what a filename is mostly made of.
|
|
56
|
-
*/
|
|
57
|
-
const FLOOR_SAMPLE = 'n'.repeat(20);
|
|
58
|
-
/** Past this a name scrolls inside the box rather than pushing the dialog. */
|
|
59
|
-
const MAXIMUM = 260;
|
|
60
|
-
// Held against the right of the row beside the button that writes the file, so
|
|
61
|
-
// the space in the row falls between copying and saving rather than inside the
|
|
62
|
-
// name.
|
|
63
|
-
const fieldStyle = { marginLeft: 'auto', flexShrink: 0 };
|
|
64
|
-
// Blueprint's own input chrome, worn by the box rather than by the field inside
|
|
65
|
-
// it, so the name and the extension sit within one border. Positioned, so the
|
|
66
|
-
// hidden copy the width is measured off can be taken out of the layout without
|
|
67
|
-
// leaving the box it takes its font from.
|
|
68
|
-
const boxStyle = {
|
|
69
|
-
position: 'relative',
|
|
70
|
-
display: 'flex',
|
|
71
|
-
alignItems: 'center',
|
|
72
|
-
width: 'fit-content',
|
|
73
|
-
};
|
|
74
|
-
// The field itself brings nothing of its own: the box around it is what is
|
|
75
|
-
// seen, and the text has to be in the font the width was measured in.
|
|
76
|
-
const inputStyle = {
|
|
77
|
-
font: 'inherit',
|
|
78
|
-
border: 'none',
|
|
79
|
-
outline: 'none',
|
|
80
|
-
padding: 0,
|
|
81
|
-
margin: 0,
|
|
82
|
-
background: 'transparent',
|
|
83
|
-
color: 'inherit',
|
|
84
|
-
};
|
|
85
|
-
const extensionStyle = {
|
|
86
|
-
color: TOKEN.textMuted,
|
|
87
|
-
whiteSpace: 'pre',
|
|
88
|
-
};
|
|
89
|
-
// A copy of what is typed, in the same font, laid out but never painted.
|
|
90
|
-
const mirrorStyle = {
|
|
91
|
-
position: 'absolute',
|
|
92
|
-
top: 0,
|
|
93
|
-
left: 0,
|
|
94
|
-
visibility: 'hidden',
|
|
95
|
-
pointerEvents: 'none',
|
|
96
|
-
whiteSpace: 'pre',
|
|
97
|
-
font: 'inherit',
|
|
98
|
-
};
|
|
99
|
-
//# sourceMappingURL=ExportNameField.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExportNameField.js","sourceRoot":"","sources":["../../../src/download/ui/ExportNameField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAc1D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,EAAE,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEjD,MAAM,KAAK,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,MAAM,CAAkB,IAAI,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,MAAM,CAAkB,IAAI,CAAC,CAAC;IAE5C,0EAA0E;IAC1E,4EAA4E;IAC5E,8EAA8E;IAC9E,qEAAqE;IACrE,eAAe,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO;YAAE,OAAO;QAChE,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC;QACpD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC;QACxC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC;IAClF,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,cAAK,KAAK,EAAE,UAAU,YACpB,eAAK,SAAS,EAAC,WAAW,EAAC,KAAK,EAAE,QAAQ,aACxC,gBACE,GAAG,EAAE,KA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,QAAQ,GAAG;IACf,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,aAAa;CACZ,CAAC;AAEX,2EAA2E;AAC3E,sEAAsE;AACtE,MAAM,UAAU,GAAG;IACjB,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,UAAU,EAAE,aAAa;IACzB,KAAK,EAAE,SAAS;CACR,CAAC;AAEX,MAAM,cAAc,GAAG;IACrB,KAAK,EAAE,KAAK,CAAC,SAAS;IACtB,UAAU,EAAE,KAAK;CACT,CAAC;AAEX,yEAAyE;AACzE,MAAM,WAAW,GAAG;IAClB,QAAQ,EAAE,UAAU;IACpB,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;IACP,UAAU,EAAE,QAAQ;IACpB,aAAa,EAAE,MAAM;IACrB,UAAU,EAAE,KAAK;IACjB,IAAI,EAAE,SAAS;CACP,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { PictureFrame } from '../core/pictureExport.ts';
|
|
2
|
-
export interface ExportPictureSectionProps {
|
|
3
|
-
/** The drawing a picture is taken of, as it is rendered. */
|
|
4
|
-
getDrawing: () => SVGSVGElement | null;
|
|
5
|
-
/** Which of the resolutions is picked. */
|
|
6
|
-
resolutionId: string;
|
|
7
|
-
/** Called with the resolution that was picked. */
|
|
8
|
-
onResolutionChange: (id: string) => void;
|
|
9
|
-
/**
|
|
10
|
-
* The name the name box opens on, and falls back to when it is cleared,
|
|
11
|
-
* without its extension.
|
|
12
|
-
*/
|
|
13
|
-
filename: string;
|
|
14
|
-
/** What the picture is read out as in the file it is written to. */
|
|
15
|
-
label: string;
|
|
16
|
-
/**
|
|
17
|
-
* Whether the picture is the drawing inside the element or the element as it
|
|
18
|
-
* is laid out.
|
|
19
|
-
* @default 'content'
|
|
20
|
-
*/
|
|
21
|
-
frame?: PictureFrame;
|
|
22
|
-
/** Called with what became of the last thing written out. */
|
|
23
|
-
onStatus: (status: string) => void;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* The drawing as a picture: how big it comes out, and where it goes.
|
|
27
|
-
*
|
|
28
|
-
* The size the file will be is shown beside the resolution rather than after
|
|
29
|
-
* the fact, since that is the number the choice is made on — a figure for a
|
|
30
|
-
* paper and a thumbnail for a slide are the same drawing at very different
|
|
31
|
-
* sizes. What is measured is what the picture will be of and not whatever is on
|
|
32
|
-
* screen, so the answer does not change when the window is resized or the
|
|
33
|
-
* drawing panned.
|
|
34
|
-
* @param props - Component props.
|
|
35
|
-
* @returns The section.
|
|
36
|
-
*/
|
|
37
|
-
export declare function ExportPictureSection(props: ExportPictureSectionProps): import("react").JSX.Element;
|
|
38
|
-
//# sourceMappingURL=ExportPictureSection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExportPictureSection.d.ts","sourceRoot":"","sources":["../../../src/download/ui/ExportPictureSection.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAW7D,MAAM,WAAW,yBAAyB;IACxC,4DAA4D;IAC5D,UAAU,EAAE,MAAM,aAAa,GAAG,IAAI,CAAC;IACvC,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,kBAAkB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,6DAA6D;IAC7D,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,+BA2EpE"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, HTMLSelect } from '@blueprintjs/core';
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import { exportButtonsStyle, exportNoteStyle, exportSectionStyle, } from "../core/exportStyles.js";
|
|
5
|
-
import { IMAGE_RESOLUTIONS, formatImageSize, imageResolution, } from "../core/imageResolution.js";
|
|
6
|
-
import { copyPicture, pictureSize, savePngPicture, saveSvgPicture, } from "../core/pictureExport.js";
|
|
7
|
-
import { sanitizeFileName } from "../core/sanitizeFileName.js";
|
|
8
|
-
import { ExportNameField } from "./ExportNameField.js";
|
|
9
|
-
/**
|
|
10
|
-
* The drawing as a picture: how big it comes out, and where it goes.
|
|
11
|
-
*
|
|
12
|
-
* The size the file will be is shown beside the resolution rather than after
|
|
13
|
-
* the fact, since that is the number the choice is made on — a figure for a
|
|
14
|
-
* paper and a thumbnail for a slide are the same drawing at very different
|
|
15
|
-
* sizes. What is measured is what the picture will be of and not whatever is on
|
|
16
|
-
* screen, so the answer does not change when the window is resized or the
|
|
17
|
-
* drawing panned.
|
|
18
|
-
* @param props - Component props.
|
|
19
|
-
* @returns The section.
|
|
20
|
-
*/
|
|
21
|
-
export function ExportPictureSection(props) {
|
|
22
|
-
const { getDrawing, resolutionId, onResolutionChange, filename, label, frame, onStatus, } = props;
|
|
23
|
-
const [name, setName] = useState(filename);
|
|
24
|
-
const savedName = sanitizeFileName(name, filename);
|
|
25
|
-
const { scale } = imageResolution(resolutionId);
|
|
26
|
-
const size = pictureSize(getDrawing(), scale, { frame });
|
|
27
|
-
const options = { scale, filename: savedName, label, frame };
|
|
28
|
-
return (_jsxs("section", { style: exportSectionStyle, children: [_jsxs("div", { style: resolutionStyle, children: [_jsx(HTMLSelect, { value: resolutionId, "aria-label": "Resolution", onChange: (event) => onResolutionChange(event.currentTarget.value), children: IMAGE_RESOLUTIONS.map((resolution) => (_jsx("option", { value: resolution.id, children: resolution.label }, resolution.id))) }), _jsx("span", { style: exportNoteStyle, children: formatImageSize(size) })] }), _jsxs("div", { style: exportButtonsStyle, children: [_jsx(Button, { icon: "duplicate", disabled: size === null, text: "Copy PNG", onClick: () => {
|
|
29
|
-
// The rasterization is started here rather than awaited: Safari
|
|
30
|
-
// only allows a clipboard write the click itself started.
|
|
31
|
-
void copyPicture(getDrawing(), options).then((copied) => onStatus(copied ? 'Picture copied.' : 'Nothing was copied.'), () => onStatus('Nothing was copied.'));
|
|
32
|
-
} }), _jsx(ExportNameField, { name: name, onChange: setName }), _jsx(Button, { icon: "download", disabled: size === null, text: "Save PNG", title: `Save as ${savedName}.png`, onClick: () => {
|
|
33
|
-
void savePngPicture(getDrawing(), options).then((saved) => {
|
|
34
|
-
if (saved)
|
|
35
|
-
onStatus(`Saved as ${savedName}.png.`);
|
|
36
|
-
});
|
|
37
|
-
} }), _jsx(Button, { icon: "download", disabled: size === null, text: "Save SVG", title: `Save as ${savedName}.svg`, onClick: () => {
|
|
38
|
-
if (saveSvgPicture(getDrawing(), options)) {
|
|
39
|
-
onStatus(`Saved as ${savedName}.svg.`);
|
|
40
|
-
}
|
|
41
|
-
} })] })] }));
|
|
42
|
-
}
|
|
43
|
-
const resolutionStyle = {
|
|
44
|
-
display: 'flex',
|
|
45
|
-
alignItems: 'center',
|
|
46
|
-
gap: 8,
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=ExportPictureSection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExportPictureSection.js","sourceRoot":"","sources":["../../../src/download/ui/ExportPictureSection.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,kBAAkB,GACnB,MAAM,yB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,OAAO,CAAC,EAAE,CAAC;gCAC1C,QAAQ,CAAC,YAAY,SAAS,OAAO,CAAC,CAAC;4BACzC,CAAC;wBACH,CAAC,GACD,IACE,IACE,CACX,CAAC;AACJ,CAAC;AAED,MAAM,eAAe,GAAG;IACtB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,GAAG,EAAE,CAAC;CACE,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** The box a picture is taken out of. */
|
|
2
|
-
export interface DrawingBox {
|
|
3
|
-
/** Put on the box the drawing sits in, so it can be found again. */
|
|
4
|
-
attach: (element: HTMLElement | null) => void;
|
|
5
|
-
/**
|
|
6
|
-
* The drawing a picture is taken of, `null` when the box holds none — which
|
|
7
|
-
* is what an editor showing nothing yet, or one whose box has not been
|
|
8
|
-
* mounted, hands the export dialog.
|
|
9
|
-
*/
|
|
10
|
-
getDrawing: () => SVGSVGElement | null;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Find the drawing a picture is to be taken of, when it is asked for.
|
|
14
|
-
*
|
|
15
|
-
* A drawing is laid out again on every resize, so the element itself is never
|
|
16
|
-
* held onto: what is kept is the box it sits in, and the drawing is read out of
|
|
17
|
-
* it at the moment a button is pressed. What counts as the drawing in there —
|
|
18
|
-
* the one element for an editor showing one, the panes composed for an editor
|
|
19
|
-
* showing a stack of charts — is `drawingIn`.
|
|
20
|
-
* @returns The box to attach, and the drawing inside it.
|
|
21
|
-
*/
|
|
22
|
-
export declare function useDrawingBox(): DrawingBox;
|
|
23
|
-
//# sourceMappingURL=useDrawingBox.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDrawingBox.d.ts","sourceRoot":"","sources":["../../../src/download/ui/useDrawingBox.ts"],"names":[],"mappings":"AAIA,yCAAyC;AACzC,MAAM,WAAW,UAAU;IACzB,oEAAoE;IACpE,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9C;;;;OAIG;IACH,UAAU,EAAE,MAAM,aAAa,GAAG,IAAI,CAAC;CACxC;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAU1C"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useCallback, useRef } from 'react';
|
|
2
|
-
import { drawingIn } from "../core/stackedDrawing.js";
|
|
3
|
-
/**
|
|
4
|
-
* Find the drawing a picture is to be taken of, when it is asked for.
|
|
5
|
-
*
|
|
6
|
-
* A drawing is laid out again on every resize, so the element itself is never
|
|
7
|
-
* held onto: what is kept is the box it sits in, and the drawing is read out of
|
|
8
|
-
* it at the moment a button is pressed. What counts as the drawing in there —
|
|
9
|
-
* the one element for an editor showing one, the panes composed for an editor
|
|
10
|
-
* showing a stack of charts — is `drawingIn`.
|
|
11
|
-
* @returns The box to attach, and the drawing inside it.
|
|
12
|
-
*/
|
|
13
|
-
export function useDrawingBox() {
|
|
14
|
-
const box = useRef(null);
|
|
15
|
-
const attach = useCallback((element) => {
|
|
16
|
-
box.current = element;
|
|
17
|
-
}, []);
|
|
18
|
-
const getDrawing = useCallback(() => drawingIn(box.current), []);
|
|
19
|
-
return { attach, getDrawing };
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=useDrawingBox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDrawingBox.js","sourceRoot":"","sources":["../../../src/download/ui/useDrawingBox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AActD;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,GAAG,GAAG,MAAM,CAAqB,IAAI,CAAC,CAAC;IAE7C,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,OAA2B,EAAE,EAAE;QACzD,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IAEjE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What can be linked to inside a repository, and when.
|
|
3
|
-
*
|
|
4
|
-
* Only GitHub has the addresses the About page builds — a release tag, a
|
|
5
|
-
* commit — and only a repository a visitor can open is worth pointing them at.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/** Where our repositories live, and the only host whose paths we know. */
|
|
9
|
-
const GITHUB = 'https://github.com/';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* The sources as a base a release or a commit can be appended to.
|
|
13
|
-
* @param repository - Where the sources live.
|
|
14
|
-
* @returns The address without its trailing slash, or `undefined` when it is
|
|
15
|
-
* not a GitHub repository and nothing inside it can be addressed.
|
|
16
|
-
*/
|
|
17
|
-
export function githubSources(repository: string): string | undefined {
|
|
18
|
-
const sources = repository.endsWith('/')
|
|
19
|
-
? repository.slice(0, -1)
|
|
20
|
-
: repository;
|
|
21
|
-
return sources.startsWith(GITHUB) ? sources : undefined;
|
|
22
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A row of buttons with the name box among them, wrapping when the dialog is
|
|
3
|
-
* too narrow for them.
|
|
4
|
-
*/
|
|
5
|
-
export const exportButtonsStyle = {
|
|
6
|
-
display: 'flex',
|
|
7
|
-
flexWrap: 'wrap',
|
|
8
|
-
alignItems: 'center',
|
|
9
|
-
gap: 6,
|
|
10
|
-
} as const;
|
|
11
|
-
|
|
12
|
-
/** One group of an export dialog: what it offers, in a column. */
|
|
13
|
-
export const exportSectionStyle = {
|
|
14
|
-
display: 'flex',
|
|
15
|
-
flexDirection: 'column',
|
|
16
|
-
gap: 8,
|
|
17
|
-
} as const;
|
|
18
|
-
|
|
19
|
-
/** Text that says something about a control rather than being one. */
|
|
20
|
-
export const exportNoteStyle = { fontSize: 12, opacity: 0.7 } as const;
|