react-cheminfo 0.34.0 → 0.36.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/bin/check-seo.mjs +333 -0
- 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/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/language/core/index.d.ts +2 -0
- package/lib/language/core/index.d.ts.map +1 -1
- package/lib/language/core/index.js +1 -0
- package/lib/language/core/index.js.map +1 -1
- package/lib/language/core/languagePath.d.ts +52 -0
- package/lib/language/core/languagePath.d.ts.map +1 -0
- package/lib/language/core/languagePath.js +65 -0
- package/lib/language/core/languagePath.js.map +1 -0
- package/lib/locales/de.json +2 -4
- package/lib/locales/en.json +2 -4
- package/lib/locales/es.json +2 -4
- package/lib/locales/fr.json +2 -4
- package/lib/locales/it.json +2 -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/ui/ElementCell.d.ts +0 -6
- package/lib/periodic/ui/ElementCell.d.ts.map +1 -1
- package/lib/periodic/ui/ElementCell.js +34 -30
- package/lib/periodic/ui/ElementCell.js.map +1 -1
- package/lib/periodic/ui/PeriodicTable.d.ts.map +1 -1
- package/lib/periodic/ui/PeriodicTable.js +12 -15
- package/lib/periodic/ui/PeriodicTable.js.map +1 -1
- package/lib/seo/core/alternates.d.ts +40 -0
- package/lib/seo/core/alternates.d.ts.map +1 -0
- package/lib/seo/core/alternates.js +42 -0
- package/lib/seo/core/alternates.js.map +1 -0
- package/lib/seo/core/index.d.ts +3 -0
- package/lib/seo/core/index.d.ts.map +1 -1
- package/lib/seo/core/index.js +2 -0
- package/lib/seo/core/index.js.map +1 -1
- package/lib/seo/core/noscript.d.ts +9 -0
- package/lib/seo/core/noscript.d.ts.map +1 -1
- package/lib/seo/core/noscript.js +7 -2
- package/lib/seo/core/noscript.js.map +1 -1
- package/lib/seo/core/pageMeta.d.ts +23 -0
- package/lib/seo/core/pageMeta.d.ts.map +1 -1
- package/lib/seo/core/pageMeta.js +52 -3
- package/lib/seo/core/pageMeta.js.map +1 -1
- package/lib/seo/core/pageProse.d.ts +76 -0
- package/lib/seo/core/pageProse.d.ts.map +1 -0
- package/lib/seo/core/pageProse.js +92 -0
- package/lib/seo/core/pageProse.js.map +1 -0
- package/lib/seo/core/routeProblems.d.ts +33 -0
- package/lib/seo/core/routeProblems.d.ts.map +1 -0
- package/lib/seo/core/routeProblems.js +89 -0
- package/lib/seo/core/routeProblems.js.map +1 -0
- package/lib/seo/core/routes.d.ts +14 -0
- package/lib/seo/core/routes.d.ts.map +1 -1
- package/lib/seo/core/routes.js.map +1 -1
- package/lib/seo/core/siteFiles.d.ts.map +1 -1
- package/lib/seo/core/siteFiles.js +2 -1
- package/lib/seo/core/siteFiles.js.map +1 -1
- package/lib/seo/vite/prerender.d.ts +13 -0
- package/lib/seo/vite/prerender.d.ts.map +1 -1
- package/lib/seo/vite/prerender.js +17 -10
- package/lib/seo/vite/prerender.js.map +1 -1
- package/package.json +2 -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/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/language/core/index.ts +2 -0
- package/src/language/core/languagePath.ts +78 -0
- package/src/locales/de.json +2 -4
- package/src/locales/en.json +2 -4
- package/src/locales/es.json +2 -4
- package/src/locales/fr.json +2 -4
- package/src/locales/it.json +2 -4
- package/src/overlay/ui/OverlayPanel.tsx +8 -2
- package/src/overlay/ui/overlayPanelStyles.ts +3 -0
- package/src/periodic/ui/ElementCell.tsx +34 -37
- package/src/periodic/ui/PeriodicTable.tsx +12 -17
- package/src/seo/core/alternates.ts +65 -0
- package/src/seo/core/index.ts +3 -0
- package/src/seo/core/noscript.ts +18 -2
- package/src/seo/core/pageMeta.ts +74 -3
- package/src/seo/core/pageProse.ts +146 -0
- package/src/seo/core/routeProblems.ts +111 -0
- package/src/seo/core/routes.ts +14 -0
- package/src/seo/core/siteFiles.ts +2 -1
- package/src/seo/vite/prerender.ts +30 -11
- 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,43 +1,32 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { formatBuiltAt, shortCommit } from "../../build/core/buildInfo.js";
|
|
3
3
|
import { useChromeT } from "../../i18n/ui/useT.js";
|
|
4
|
-
import { githubSources } from "../core/repository.js";
|
|
5
4
|
/**
|
|
6
5
|
* The one line that says when the build a visitor has open was made.
|
|
7
6
|
*
|
|
8
7
|
* A report of something going wrong is worth answering only when we know what
|
|
9
8
|
* was running. The version itself is in the hero, where a reader is asked to
|
|
10
|
-
* quote it from; this line carries the rest,
|
|
11
|
-
*
|
|
12
|
-
* that shows it.
|
|
9
|
+
* quote it from; this line carries the rest, so a report can name the exact
|
|
10
|
+
* build the problem was seen on.
|
|
13
11
|
* @param props - See {@link AboutBuildProps}.
|
|
14
12
|
* @returns The line.
|
|
15
13
|
*/
|
|
16
14
|
export function AboutBuild(props) {
|
|
17
|
-
const { build
|
|
15
|
+
const { build } = props;
|
|
18
16
|
const t = useChromeT();
|
|
19
|
-
const sources = githubSources(repository);
|
|
20
17
|
const builtAt = formatBuiltAt(build.builtAt);
|
|
21
18
|
if (build.commit === undefined) {
|
|
22
19
|
return _jsx("p", { style: PARAGRAPH_STYLE, children: t('about.built', { builtAt }) });
|
|
23
20
|
}
|
|
24
|
-
// The commit
|
|
25
|
-
//
|
|
21
|
+
// The commit sits inside a sentence whose word order is the translator's,
|
|
22
|
+
// so the message names where it goes and is split there.
|
|
26
23
|
const [before = '', after = ''] = t('about.builtFromCommit', {
|
|
27
24
|
builtAt,
|
|
28
25
|
}).split('{commit}');
|
|
29
|
-
return (_jsxs("p", { style: PARAGRAPH_STYLE, children: [before, _jsx(
|
|
30
|
-
? undefined
|
|
31
|
-
: `${sources}/commit/${build.commit}`, children: shortCommit(build.commit) }), after] }));
|
|
32
|
-
}
|
|
33
|
-
function Reference(props) {
|
|
34
|
-
const { href, children } = props;
|
|
35
|
-
if (href === undefined)
|
|
36
|
-
return _jsx("code", { style: CODE_STYLE, children: children });
|
|
37
|
-
return (_jsx("a", { href: href, target: "_blank", rel: "noopener noreferrer", style: LINK_STYLE, children: _jsx("code", { style: CODE_STYLE, children: children }) }));
|
|
26
|
+
return (_jsxs("p", { style: PARAGRAPH_STYLE, children: [before, _jsx("code", { style: CODE_STYLE, children: shortCommit(build.commit) }), after] }));
|
|
38
27
|
}
|
|
39
28
|
const PARAGRAPH_STYLE = {
|
|
40
|
-
margin:
|
|
29
|
+
margin: 0,
|
|
41
30
|
color: 'var(--text-muted)',
|
|
42
31
|
fontSize: 13,
|
|
43
32
|
};
|
|
@@ -45,5 +34,4 @@ const CODE_STYLE = {
|
|
|
45
34
|
fontFamily: 'var(--font-mono, ui-monospace, monospace)',
|
|
46
35
|
fontSize: 13,
|
|
47
36
|
};
|
|
48
|
-
const LINK_STYLE = { color: 'var(--accent)' };
|
|
49
37
|
//# sourceMappingURL=AboutBuild.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AboutBuild.js","sourceRoot":"","sources":["../../../src/about/ui/AboutBuild.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"AboutBuild.js","sourceRoot":"","sources":["../../../src/about/ui/AboutBuild.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAOnD;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,MAAM,CAAC,GAAG,UAAU,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7C,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,YAAG,KAAK,EAAE,eAAe,YAAG,CAAC,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,CAAC,GAAK,CAAC;IACxE,CAAC;IAED,0EAA0E;IAC1E,yDAAyD;IACzD,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,uBAAuB,EAAE;QAC3D,OAAO;KACR,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAErB,OAAO,CACL,aAAG,KAAK,EAAE,eAAe,aACtB,MAAM,EACP,eAAM,KAAK,EAAE,UAAU,YAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,GAAQ,EAC1D,KAAK,IACJ,CACL,CAAC;AACJ,CAAC;AAED,MAAM,eAAe,GAAG;IACtB,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,mBAAmB;IAC1B,QAAQ,EAAE,EAAE;CACoB,CAAC;AAEnC,MAAM,UAAU,GAAG;IACjB,UAAU,EAAE,2CAA2C;IACvD,QAAQ,EAAE,EAAE;CACoB,CAAC"}
|
|
@@ -33,8 +33,8 @@ export interface AboutPageProps {
|
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* The About page of a site of the family: what the tool is, who provides it,
|
|
36
|
-
* what a visitor can do with it, what it is built on, how to cite it
|
|
37
|
-
*
|
|
36
|
+
* what a visitor can do with it, what it is built on, and how to cite it —
|
|
37
|
+
* always in that order.
|
|
38
38
|
*
|
|
39
39
|
* The order is the point. A reader who has read one of our About pages knows
|
|
40
40
|
* where the credits are on the other thirteen, and a site that writes its own
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AboutPage.d.ts","sourceRoot":"","sources":["../../../src/about/ui/AboutPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AASrD,MAAM,WAAW,cAAc;IAC7B,uCAAuC;IACvC,OAAO,EAAE,YAAY,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"AboutPage.d.ts","sourceRoot":"","sources":["../../../src/about/ui/AboutPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AASrD,MAAM,WAAW,cAAc;IAC7B,uCAAuC;IACvC,OAAO,EAAE,YAAY,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,CAkF7D"}
|
|
@@ -11,8 +11,8 @@ import { AboutSection } from "./AboutSection.js";
|
|
|
11
11
|
import { AboutVersion } from "./AboutVersion.js";
|
|
12
12
|
/**
|
|
13
13
|
* The About page of a site of the family: what the tool is, who provides it,
|
|
14
|
-
* what a visitor can do with it, what it is built on, how to cite it
|
|
15
|
-
*
|
|
14
|
+
* what a visitor can do with it, what it is built on, and how to cite it —
|
|
15
|
+
* always in that order.
|
|
16
16
|
*
|
|
17
17
|
* The order is the point. A reader who has read one of our About pages knows
|
|
18
18
|
* where the credits are on the other thirteen, and a site that writes its own
|
|
@@ -28,17 +28,7 @@ export function AboutPage(props) {
|
|
|
28
28
|
const site = about.site;
|
|
29
29
|
return (_jsxs("div", { className: className === undefined ? 'about-page' : `about-page ${className}`, style: PAGE_STYLE, children: [_jsxs("header", { className: "about-hero", style: HERO_STYLE, children: [logo === undefined
|
|
30
30
|
? (mark ?? _jsx(SiteMark, { site: site, size: 56 }))
|
|
31
|
-
: null, _jsxs("div", { style: HERO_BODY_STYLE, children: [_jsx("h1", { style: logo === undefined ? NAME_STYLE : LOGO_NAME_STYLE, children: logo ?? _jsx(Wordmark, { site: site, size: 26 }) }), _jsx("p", { style: TAGLINE_STYLE, children: t.or(`site.${site.id}.tagline`, site.tagline) }), _jsx("p", { style: WHAT_STYLE, children: about.what })] }), _jsx(AboutVersion, { build: about.build
|
|
32
|
-
}
|
|
33
|
-
// A link sits inside a sentence whose word order is the translator's, so the
|
|
34
|
-
// message names where it goes with a placeholder and is split there.
|
|
35
|
-
function around(message, placeholder, link) {
|
|
36
|
-
const [before = '', after = ''] = message.split(`{${placeholder}}`);
|
|
37
|
-
return [before, link, after];
|
|
38
|
-
}
|
|
39
|
-
function ExternalLink(props) {
|
|
40
|
-
const { href } = props;
|
|
41
|
-
return (_jsx("a", { href: href, target: "_blank", rel: "noopener noreferrer", style: LINK_STYLE, children: href.replace(/^https?:\/\//, '') }));
|
|
31
|
+
: null, _jsxs("div", { style: HERO_BODY_STYLE, children: [_jsx("h1", { style: logo === undefined ? NAME_STYLE : LOGO_NAME_STYLE, children: logo ?? _jsx(Wordmark, { site: site, size: 26 }) }), _jsx("p", { style: TAGLINE_STYLE, children: t.or(`site.${site.id}.tagline`, site.tagline) }), _jsx("p", { style: WHAT_STYLE, children: about.what })] }), _jsx(AboutVersion, { build: about.build })] }), about.people.length === 0 && about.providedBy.length === 0 ? null : (_jsx(AboutSection, { title: t('about.providedBy'), className: "about-provided-by", children: _jsx(AboutProvidedBy, { people: about.people, providers: about.providedBy }) })), _jsx(AboutSection, { title: t('about.whatYouCanDo'), className: "about-can", children: _jsx("ul", { style: CAN_LIST_STYLE, children: about.can.map((line) => (_jsx("li", { children: line }, line))) }) }), about.paragraphs.length === 0 ? null : (_jsx(AboutSection, { className: "about-context", children: about.paragraphs.map((paragraph, index) => (_jsx("p", { style: index === 0 ? FIRST_PARAGRAPH_STYLE : PARAGRAPH_STYLE, children: paragraph }, paragraph))) })), children, _jsx(AboutSection, { title: t('about.builtOn'), className: "about-credits", children: _jsx(CreditsList, { entries: about.credits }) }), about.cite.length === 0 ? null : (_jsx(AboutSection, { title: t('about.howToCite'), className: "about-cite", children: _jsx(AboutCitations, { works: about.cite }) })), about.build === undefined ? null : (_jsx(AboutSection, { className: "about-build", children: _jsx(AboutBuild, { build: about.build }) }))] }));
|
|
42
32
|
}
|
|
43
33
|
const PAGE_STYLE = {
|
|
44
34
|
display: 'flex',
|
|
@@ -86,5 +76,4 @@ const FIRST_PARAGRAPH_STYLE = {
|
|
|
86
76
|
const PARAGRAPH_STYLE = {
|
|
87
77
|
margin: '8px 0 0',
|
|
88
78
|
};
|
|
89
|
-
const LINK_STYLE = { color: 'var(--accent)' };
|
|
90
79
|
//# sourceMappingURL=AboutPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AboutPage.js","sourceRoot":"","sources":["../../../src/about/ui/AboutPage.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAkC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAiC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA8B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAoB,CAAC;AAkClD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,MAAM,EAAE,OAAO,EAAE,SAAS,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;IACtB,MAAM,EAAE,SAAS;CACe,CAAC;AAEnC,MAAM,aAAa,GAAG;IACpB,MAAM,EAAE,WAAW;IACnB,KAAK,EAAE,mBAAmB;IAC1B,QAAQ,EAAE,EAAE;CACoB,CAAC;AAEnC,MAAM,UAAU,GAAG,EAAE,MAAM,EAAE,CAAC,EAAmC,CAAC;AAElE,MAAM,cAAc,GAAG;IACrB,MAAM,EAAE,CAAC;IACT,WAAW,EAAE,EAAE;CACiB,CAAC;AAEnC,MAAM,qBAAqB,GAAG;IAC5B,MAAM,EAAE,CAAC;CACuB,CAAC;AAEnC,MAAM,eAAe,GAAG;IACtB,MAAM,EAAE,SAAS;CACe,CAAC"}
|
|
@@ -11,10 +11,6 @@ import type { BuildInfo } from '../../build/core/buildInfo.ts';
|
|
|
11
11
|
export interface AboutVersionProps {
|
|
12
12
|
/** What the build published about itself, or `undefined` when it published none. */
|
|
13
13
|
build: BuildInfo | undefined;
|
|
14
|
-
/** Where the sources live, which is what the badge links into. */
|
|
15
|
-
repository: string;
|
|
16
|
-
/** Whether a visitor can open that repository, and so whether it is linked. */
|
|
17
|
-
publicRepository: boolean;
|
|
18
14
|
}
|
|
19
15
|
/**
|
|
20
16
|
* The build badge: the release a site is serving, or the commit it was built
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AboutVersion.d.ts","sourceRoot":"","sources":["../../../src/about/ui/AboutVersion.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"AboutVersion.d.ts","sourceRoot":"","sources":["../../../src/about/ui/AboutVersion.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAO/D,MAAM,WAAW,iBAAiB;IAChC,oFAAoF;IACpF,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,GAAG,IAAI,CAiB1E"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { buildLabel, buildStamp, buildSummary,
|
|
3
|
-
import { githubSources } from "../core/repository.js";
|
|
2
|
+
import { buildLabel, buildStamp, buildSummary, } from "../../build/core/buildInfo.js";
|
|
4
3
|
/**
|
|
5
4
|
* The build badge: the release a site is serving, or the commit it was built
|
|
6
5
|
* from while it has no release yet, and when it was made.
|
|
@@ -8,37 +7,14 @@ import { githubSources } from "../core/repository.js";
|
|
|
8
7
|
* @returns The badge, or `null` when the build says nothing worth showing.
|
|
9
8
|
*/
|
|
10
9
|
export function AboutVersion(props) {
|
|
11
|
-
const { build
|
|
10
|
+
const { build } = props;
|
|
12
11
|
const label = buildLabel(build);
|
|
13
12
|
if (build === undefined || label === undefined)
|
|
14
13
|
return null;
|
|
15
|
-
const href = publicRepository ? addressOf(build, repository) : undefined;
|
|
16
|
-
const summary = buildSummary(build);
|
|
17
14
|
// The instant belongs on the badge rather than in its hover: a version
|
|
18
15
|
// nobody can date says nothing about how old the page they read is.
|
|
19
16
|
const badge = `${label} · ${buildStamp(build.builtAt)}`;
|
|
20
|
-
|
|
21
|
-
return (_jsx("span", { style: BADGE_STYLE, className: "about-version", title: summary, children: badge }));
|
|
22
|
-
}
|
|
23
|
-
return (_jsx("a", { className: "about-version", href: href, title: summary, target: "_blank", rel: "noopener noreferrer", style: LINK_BADGE_STYLE, children: badge }));
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* What the badge opens: the release it names, or the commit it was built from.
|
|
27
|
-
* @param build - What the build published about itself.
|
|
28
|
-
* @param repository - Where the sources live.
|
|
29
|
-
* @returns The address, or `undefined` when nothing inside the repository can
|
|
30
|
-
* be addressed.
|
|
31
|
-
*/
|
|
32
|
-
function addressOf(build, repository) {
|
|
33
|
-
const sources = githubSources(repository);
|
|
34
|
-
if (sources === undefined)
|
|
35
|
-
return undefined;
|
|
36
|
-
const version = releasedVersion(build);
|
|
37
|
-
if (version !== undefined)
|
|
38
|
-
return `${sources}/releases/tag/v${version}`;
|
|
39
|
-
return build.commit === undefined
|
|
40
|
-
? undefined
|
|
41
|
-
: `${sources}/commit/${build.commit}`;
|
|
17
|
+
return (_jsx("span", { style: BADGE_STYLE, className: "about-version", title: buildSummary(build), children: badge }));
|
|
42
18
|
}
|
|
43
19
|
const BADGE_STYLE = {
|
|
44
20
|
flex: '0 0 auto',
|
|
@@ -47,8 +23,4 @@ const BADGE_STYLE = {
|
|
|
47
23
|
color: 'var(--text-muted)',
|
|
48
24
|
whiteSpace: 'nowrap',
|
|
49
25
|
};
|
|
50
|
-
const LINK_BADGE_STYLE = {
|
|
51
|
-
...BADGE_STYLE,
|
|
52
|
-
color: 'var(--accent)',
|
|
53
|
-
};
|
|
54
26
|
//# sourceMappingURL=AboutVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AboutVersion.js","sourceRoot":"","sources":["../../../src/about/ui/AboutVersion.tsx"],"names":[],"mappings":";AAYA,OAAO,EACL,UAAU,EACV,UAAU,EACV,YAAY,
|
|
1
|
+
{"version":3,"file":"AboutVersion.js","sourceRoot":"","sources":["../../../src/about/ui/AboutVersion.tsx"],"names":[],"mappings":";AAYA,OAAO,EACL,UAAU,EACV,UAAU,EACV,YAAY,GACb,MAAM,+BAA+B,CAAC;AAOvC;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAChC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAC5D,uEAAuE;IACvE,oEAAoE;IACpE,MAAM,KAAK,GAAG,GAAG,KAAK,MAAM,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;IAExD,OAAO,CACL,eACE,KAAK,EAAE,WAAW,EAClB,SAAS,EAAC,eAAe,EACzB,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,YAEzB,KAAK,GACD,CACR,CAAC;AACJ,CAAC;AAED,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,UAAU;IAChB,UAAU,EAAE,2CAA2C;IACvD,QAAQ,EAAE,EAAE;IACZ,KAAK,EAAE,mBAAmB;IAC1B,UAAU,EAAE,QAAQ;CACY,CAAC"}
|
|
@@ -19,11 +19,6 @@ export { figureLegendMarkup } from './figureLegend.ts';
|
|
|
19
19
|
export type { FigureBounds } from './figureTarget.ts';
|
|
20
20
|
export { figureBounds, figureDrawings, figureElement, figureLegends, figureSize, } from './figureTarget.ts';
|
|
21
21
|
export { sanitizeFileName } from './sanitizeFileName.ts';
|
|
22
|
-
export { exportButtonsStyle, exportNoteStyle, exportSectionStyle, } from './exportStyles.ts';
|
|
23
|
-
export type { ImageResolution, ImageResolutionId, ImageSize, } from './imageResolution.ts';
|
|
24
|
-
export { DEFAULT_IMAGE_RESOLUTION, IMAGE_RESOLUTIONS, formatImageSize, imageResolution, imageSize, } from './imageResolution.ts';
|
|
25
|
-
export type { PictureFrame, PictureOptions } from './pictureExport.ts';
|
|
26
|
-
export { PICTURE_PADDING, copyPicture, pictureSize, savePngPicture, saveSvgPicture, } from './pictureExport.ts';
|
|
27
22
|
export { drawingIn, stackDrawings } from './stackedDrawing.ts';
|
|
28
23
|
export type { SvgBox } from './svgBounds.ts';
|
|
29
24
|
export { CONTENT_ATTRIBUTE, contentBox, elementBox } from './svgBounds.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRo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ClE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC5D,YAAY,EACV,WAAW,EACX,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,EACb,UAAU,GACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/D,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC3E,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"}
|
|
@@ -11,9 +11,6 @@ export { figureSvgDocument } from "./figureSvgDocument.js";
|
|
|
11
11
|
export { figureLegendMarkup } from "./figureLegend.js";
|
|
12
12
|
export { figureBounds, figureDrawings, figureElement, figureLegends, figureSize, } from "./figureTarget.js";
|
|
13
13
|
export { sanitizeFileName } from "./sanitizeFileName.js";
|
|
14
|
-
export { exportButtonsStyle, exportNoteStyle, exportSectionStyle, } from "./exportStyles.js";
|
|
15
|
-
export { DEFAULT_IMAGE_RESOLUTION, IMAGE_RESOLUTIONS, formatImageSize, imageResolution, imageSize, } from "./imageResolution.js";
|
|
16
|
-
export { PICTURE_PADDING, copyPicture, pictureSize, savePngPicture, saveSvgPicture, } from "./pictureExport.js";
|
|
17
14
|
export { drawingIn, stackDrawings } from "./stackedDrawing.js";
|
|
18
15
|
export { CONTENT_ATTRIBUTE, contentBox, elementBox } from "./svgBounds.js";
|
|
19
16
|
export { SVG_NAMESPACE } from "./svgNamespace.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/download/core/index.ts"],"names":[],"mappings":"AAAA,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;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,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,O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E/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"}
|
|
@@ -1,55 +1,13 @@
|
|
|
1
1
|
import type { IconName } from '@blueprintjs/core';
|
|
2
2
|
import type { ReactElement } from 'react';
|
|
3
|
-
import type {
|
|
4
|
-
import type { FigureRenderer } from './useFigureRedraw.tsx';
|
|
3
|
+
import type { FigureDownloadOptions } from './useFigureDownload.tsx';
|
|
5
4
|
/** What {@link FigureDownload} needs. */
|
|
6
|
-
export interface FigureDownloadProps {
|
|
7
|
-
/**
|
|
8
|
-
* The `id` of the box the figure is mounted in. Everything drawn inside it
|
|
9
|
-
* is saved — sixteen charts of a pair grid as readily as one scatter plot —
|
|
10
|
-
* and the controls floating over it are left behind.
|
|
11
|
-
*/
|
|
12
|
-
targetId: string;
|
|
13
|
-
/**
|
|
14
|
-
* What the saved file is called, without its extension. Name it after the
|
|
15
|
-
* data rather than after the tool: a reader with four of these in a
|
|
16
|
-
* downloads folder cannot tell four `figure.png` apart.
|
|
17
|
-
* @default 'figure'
|
|
18
|
-
*/
|
|
19
|
-
fileName?: string;
|
|
20
|
-
/**
|
|
21
|
-
* The format it opens on.
|
|
22
|
-
* @default 'png'
|
|
23
|
-
*/
|
|
24
|
-
defaultFormat?: FigureFormat;
|
|
25
|
-
/**
|
|
26
|
-
* The resolution a PNG opens on, as a multiple of the figure on screen. An
|
|
27
|
-
* SVG opens at 1×, the size it has on screen, and each format keeps the
|
|
28
|
-
* multiple the reader last picked for it.
|
|
29
|
-
* @default 2
|
|
30
|
-
*/
|
|
31
|
-
defaultScale?: number;
|
|
32
|
-
/**
|
|
33
|
-
* The resolutions offered.
|
|
34
|
-
* @default [1, 2, 3, 4]
|
|
35
|
-
*/
|
|
36
|
-
scales?: readonly number[];
|
|
37
|
-
/**
|
|
38
|
-
* What is painted under the figure. `transparent` leaves it unpainted, for a
|
|
39
|
-
* figure going onto a coloured slide.
|
|
40
|
-
* @default the surface the figure is drawn on
|
|
41
|
-
*/
|
|
42
|
-
background?: string;
|
|
5
|
+
export interface FigureDownloadProps extends FigureDownloadOptions {
|
|
43
6
|
/**
|
|
44
7
|
* What the glyph is called, for the pointer and for a screen reader.
|
|
45
8
|
* @default the chrome's own line, in the language of the page
|
|
46
9
|
*/
|
|
47
10
|
label?: string;
|
|
48
|
-
/**
|
|
49
|
-
* What the panel behind it is called.
|
|
50
|
-
* @default the chrome's own line, in the language of the page
|
|
51
|
-
*/
|
|
52
|
-
title?: string;
|
|
53
11
|
/**
|
|
54
12
|
* Its glyph.
|
|
55
13
|
* @default 'download'
|
|
@@ -60,19 +18,10 @@ export interface FigureDownloadProps {
|
|
|
60
18
|
* @default undefined
|
|
61
19
|
*/
|
|
62
20
|
testId?: string;
|
|
63
|
-
/**
|
|
64
|
-
* Draws the figure at a size, for a file. When it is given the panel offers
|
|
65
|
-
* a size — as shown, 4:3, 16:9, a journal column, or typed — and a figure
|
|
66
|
-
* saved at a size other than its own is drawn again at that size, off the
|
|
67
|
-
* page, so its axes and labels are laid out for the new shape rather than
|
|
68
|
-
* stretched into it. Draw exactly what is on screen, with the same data,
|
|
69
|
-
* zoom and colours; only the box changes.
|
|
70
|
-
* @default undefined — the figure is saved at the size it has on screen
|
|
71
|
-
*/
|
|
72
|
-
renderFigure?: FigureRenderer;
|
|
73
21
|
}
|
|
74
22
|
/**
|
|
75
|
-
* The glyph that takes the figure off the page as a file
|
|
23
|
+
* The glyph that takes the figure off the page, as a file or onto the
|
|
24
|
+
* clipboard.
|
|
76
25
|
*
|
|
77
26
|
* It works from the `id` of the box the figure is mounted in rather than from
|
|
78
27
|
* the figure itself, so the control is free to sit in the bar above the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FigureDownload.d.ts","sourceRoot":"","sources":["../../../src/download/ui/FigureDownload.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAK1C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"FigureDownload.d.ts","sourceRoot":"","sources":["../../../src/download/ui/FigureDownload.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAK1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGrE,yCAAyC;AACzC,MAAM,WAAW,mBAAoB,SAAQ,qBAAqB;IAChE;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CAyBvE"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { PopoverNext } from '@blueprintjs/core';
|
|
3
|
-
import { useState } from 'react';
|
|
4
3
|
import { useChromeT } from "../../i18n/ui/useT.js";
|
|
5
4
|
import { OverlayIconButton } from "../../overlay/ui/OverlayIconButton.js";
|
|
6
|
-
import {
|
|
7
|
-
import { figureLayoutRedraws, figureLayoutSize } from "../core/figureLayout.js";
|
|
8
|
-
import { DEFAULT_FIGURE_SCALE, FIGURE_SCALES, defaultFigureScale, } from "../core/figureScale.js";
|
|
9
|
-
import { figureSize } from "../core/figureTarget.js";
|
|
10
|
-
import { FigureDownloadPanel } from "./FigureDownloadPanel.js";
|
|
11
|
-
import { useFigureRedraw } from "./useFigureRedraw.js";
|
|
5
|
+
import { useFigureDownload } from "./useFigureDownload.js";
|
|
12
6
|
/**
|
|
13
|
-
* The glyph that takes the figure off the page as a file
|
|
7
|
+
* The glyph that takes the figure off the page, as a file or onto the
|
|
8
|
+
* clipboard.
|
|
14
9
|
*
|
|
15
10
|
* It works from the `id` of the box the figure is mounted in rather than from
|
|
16
11
|
* the figure itself, so the control is free to sit in the bar above the
|
|
@@ -30,64 +25,9 @@ import { useFigureRedraw } from "./useFigureRedraw.js";
|
|
|
30
25
|
* @returns The glyph and its panel.
|
|
31
26
|
*/
|
|
32
27
|
export function FigureDownload(props) {
|
|
33
|
-
const {
|
|
34
|
-
const { defaultFormat = 'png', defaultScale = DEFAULT_FIGURE_SCALE } = props;
|
|
35
|
-
const { label, title } = props;
|
|
36
|
-
const { icon = 'download', testId, renderFigure } = props;
|
|
28
|
+
const { label, icon = 'download', testId, ...options } = props;
|
|
37
29
|
const t = useChromeT();
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
const [picked, setPicked] = useState(() => ({
|
|
41
|
-
png: defaultScale,
|
|
42
|
-
svg: defaultFigureScale('svg'),
|
|
43
|
-
}));
|
|
44
|
-
const scale = picked[format];
|
|
45
|
-
const [size, setSize] = useState(null);
|
|
46
|
-
const [failure, setFailure] = useState(null);
|
|
47
|
-
const [saving, setSaving] = useState(false);
|
|
48
|
-
const [layout, setLayout] = useState('screen');
|
|
49
|
-
const [custom, setCustom] = useState(null);
|
|
50
|
-
const { redraw, portal } = useFigureRedraw(renderFigure);
|
|
51
|
-
// The panel is held open from here rather than left to itself, because the
|
|
52
|
-
// figure has to be measured at the moment it opens: its size is what the
|
|
53
|
-
// panel writes out, and reading a bounding box on every render would cost a
|
|
54
|
-
// layout pass on a bar that is re-rendered on every pointer move.
|
|
55
|
-
function interact(next) {
|
|
56
|
-
setOpen(next);
|
|
57
|
-
if (!next)
|
|
58
|
-
return;
|
|
59
|
-
setSize(figureSize(targetId));
|
|
60
|
-
setFailure(null);
|
|
61
|
-
}
|
|
62
|
-
async function save() {
|
|
63
|
-
setSaving(true);
|
|
64
|
-
try {
|
|
65
|
-
const options = { format, scale, fileName, background };
|
|
66
|
-
if (renderFigure !== undefined &&
|
|
67
|
-
size !== null &&
|
|
68
|
-
figureLayoutRedraws(layout, size, custom ?? size)) {
|
|
69
|
-
const drawn = figureLayoutSize(layout, size, custom ?? size);
|
|
70
|
-
await redraw(targetId, drawn, (box) => downloadFigure(box, options));
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
await downloadFigure(targetId, options);
|
|
74
|
-
}
|
|
75
|
-
setFailure(null);
|
|
76
|
-
}
|
|
77
|
-
catch (error) {
|
|
78
|
-
setFailure(error instanceof Error ? error.message : String(error));
|
|
79
|
-
}
|
|
80
|
-
finally {
|
|
81
|
-
setSaving(false);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return (_jsxs(_Fragment, { children: [_jsx(PopoverNext, { isOpen: open, placement: "bottom-end", onInteraction: interact, content: _jsx(FigureDownloadPanel, { title: title ?? t('download.saveFigure'), format: format, scale: scale, scales: scales, size: size, failure: failure, saving: saving, onFormatChange: setFormat, onScaleChange: (next) => setPicked((current) => ({ ...current, [format]: next })), onSave: () => void save(), sizing: renderFigure === undefined
|
|
85
|
-
? undefined
|
|
86
|
-
: {
|
|
87
|
-
layout,
|
|
88
|
-
custom,
|
|
89
|
-
onLayoutChange: setLayout,
|
|
90
|
-
onCustomChange: setCustom,
|
|
91
|
-
} }), children: _jsx(OverlayIconButton, { icon: icon, label: label ?? t('download.saveThisFigure'), value: format.toUpperCase(), active: open, testId: testId, opensMenu: true }) }), portal] }));
|
|
30
|
+
const { isOpen, setOpen, panel, format, portal } = useFigureDownload(options);
|
|
31
|
+
return (_jsxs(_Fragment, { children: [_jsx(PopoverNext, { isOpen: isOpen, placement: "bottom-end", onInteraction: setOpen, content: panel, children: _jsx(OverlayIconButton, { icon: icon, label: label ?? t('download.saveThisFigure'), value: format.toUpperCase(), active: isOpen, testId: testId, opensMenu: true }) }), portal] }));
|
|
92
32
|
}
|
|
93
33
|
//# sourceMappingURL=FigureDownload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FigureDownload.js","sourceRoot":"","sources":["../../../src/download/ui/FigureDownload.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"FigureDownload.js","sourceRoot":"","sources":["../../../src/download/ui/FigureDownload.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAwC,CAAC;AAG3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAC;AAqB5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,KAAK,EAAE,IAAI,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK,CAAC;IAC/D,MAAM,CAAC,GAAG,UAAU,EAAE,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAE9E,OAAO,CACL,8BACE,KAAC,WAAW,IACV,MAAM,EAAE,MAAM,EACd,SAAS,EAAC,YAAY,EACtB,aAAa,EAAE,OAAO,EACtB,OAAO,EAAE,KAAK,YAEd,KAAC,iBAAiB,IAChB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,IAAI,CAAC,CAAC,yBAAyB,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,EAC3B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,SACT,GACU,EACb,MAAM,IACN,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -2,6 +2,7 @@ import type { ReactElement } from 'react';
|
|
|
2
2
|
import type { FigureFormat } from '../core/downloadFigure.ts';
|
|
3
3
|
import type { FigurePixels } from '../core/figureScale.ts';
|
|
4
4
|
import type { FigureSizing } from './FigureSizeRows.tsx';
|
|
5
|
+
import type { FigureNotice } from './useFigureActions.ts';
|
|
5
6
|
/** What {@link FigureDownloadPanel} is drawn from. */
|
|
6
7
|
export interface FigureDownloadPanelProps {
|
|
7
8
|
/** What the panel is called. */
|
|
@@ -16,7 +17,13 @@ export interface FigureDownloadPanelProps {
|
|
|
16
17
|
size: FigurePixels | null;
|
|
17
18
|
/** What went wrong the last time save was pressed, if anything. */
|
|
18
19
|
failure: string | null;
|
|
19
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* What the last copy came to, while the choices it was made with still
|
|
22
|
+
* stand.
|
|
23
|
+
* @default null
|
|
24
|
+
*/
|
|
25
|
+
notice?: FigureNotice | null;
|
|
26
|
+
/** Whether a file or a copy is being written right now. */
|
|
20
27
|
saving: boolean;
|
|
21
28
|
/** Called with the format the reader picked. */
|
|
22
29
|
onFormatChange: (format: FigureFormat) => void;
|
|
@@ -24,6 +31,12 @@ export interface FigureDownloadPanelProps {
|
|
|
24
31
|
onScaleChange: (scale: number) => void;
|
|
25
32
|
/** Called when they press save. */
|
|
26
33
|
onSave: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Called when they press copy, which puts a PNG at the resolution picked on
|
|
36
|
+
* the clipboard.
|
|
37
|
+
* @default undefined — no copy is offered
|
|
38
|
+
*/
|
|
39
|
+
onCopy?: () => void;
|
|
27
40
|
/**
|
|
28
41
|
* Whether the SVG holds a rendered picture rather than vector drawings, as
|
|
29
42
|
* for a WebGL scene: its resolution is then the pixels of that picture, it
|
|
@@ -40,7 +53,8 @@ export interface FigureDownloadPanelProps {
|
|
|
40
53
|
sizing?: FigureSizing;
|
|
41
54
|
}
|
|
42
55
|
/**
|
|
43
|
-
* The choices behind the save glyph, and the
|
|
56
|
+
* The choices behind the save glyph, and the buttons that write the file and
|
|
57
|
+
* copy the picture.
|
|
44
58
|
*
|
|
45
59
|
* The resolution applies to both formats, and means what the reader needs it
|
|
46
60
|
* to: a PNG is painted with that many more pixels, and an SVG, drawn the same,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FigureDownloadPanel.d.ts","sourceRoot":"","sources":["../../../src/download/ui/FigureDownloadPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,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,MAAM,OAAO,CAAC;AAO1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAQ3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,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,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;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,wBAAwB,GAC9B,YAAY,CAuEd"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useChromeT } from "../../i18n/ui/useT.js";
|
|
3
3
|
import { OverlayAction } from "../../overlay/ui/OverlayAction.js";
|
|
4
4
|
import { OverlayPanel } from "../../overlay/ui/OverlayPanel.js";
|
|
@@ -6,8 +6,10 @@ import { OverlaySegmented } from "../../overlay/ui/OverlaySegmented.js";
|
|
|
6
6
|
import { figureLayoutSize } from "../core/figureLayout.js";
|
|
7
7
|
import { figurePixels, figureScaleFits, figureScaleLabel, formatFigurePixels, } from "../core/figureScale.js";
|
|
8
8
|
import { FigureSizeRows } from "./FigureSizeRows.js";
|
|
9
|
+
import { hintOf } from "./figureDownloadHint.js";
|
|
9
10
|
/**
|
|
10
|
-
* The choices behind the save glyph, and the
|
|
11
|
+
* The choices behind the save glyph, and the buttons that write the file and
|
|
12
|
+
* copy the picture.
|
|
11
13
|
*
|
|
12
14
|
* The resolution applies to both formats, and means what the reader needs it
|
|
13
15
|
* to: a PNG is painted with that many more pixels, and an SVG, drawn the same,
|
|
@@ -27,14 +29,14 @@ import { FigureSizeRows } from "./FigureSizeRows.js";
|
|
|
27
29
|
export function FigureDownloadPanel(props) {
|
|
28
30
|
const { title, format, scale, scales, size, failure, saving } = props;
|
|
29
31
|
const { onFormatChange, onScaleChange, onSave, rasterSvg = false } = props;
|
|
30
|
-
const { sizing } = props;
|
|
32
|
+
const { sizing, onCopy, notice = null } = props;
|
|
31
33
|
const t = useChromeT();
|
|
32
34
|
// What the file is drawn at: the figure on screen, or the shape picked.
|
|
33
35
|
const drawn = size === null || sizing === undefined
|
|
34
36
|
? size
|
|
35
37
|
: figureLayoutSize(sizing.layout, size, sizing.custom ?? size);
|
|
36
38
|
const painted = format === 'png' || rasterSvg;
|
|
37
|
-
return (_jsxs(OverlayPanel, { title: title, hint: hintOf(format, drawn, scale, failure, rasterSvg, t), actions: _jsx(OverlayAction, { text: t('download.save'), icon: "download", intent: "primary", disabled: saving || size === null, onClick: onSave }), children: [_jsx(OverlaySegmented, { label: t('download.format'), help: {
|
|
39
|
+
return (_jsxs(OverlayPanel, { title: title, width: PANEL_WIDTH, hint: hintOf({ format, size: drawn, scale, failure, notice, rasterSvg }, t), actions: _jsxs(_Fragment, { children: [_jsx(OverlayAction, { text: t('download.save'), icon: "download", intent: "primary", disabled: saving || size === null, onClick: onSave }), onCopy === undefined ? null : (_jsx(OverlayAction, { text: t('clipboard.copy'), icon: "clipboard", disabled: saving || size === null, onClick: onCopy }))] }), children: [_jsx(OverlaySegmented, { label: t('download.format'), help: {
|
|
38
40
|
title: t('download.format'),
|
|
39
41
|
body: t('download.formatHelp'),
|
|
40
42
|
}, value: format, options: FORMAT_CHOICES, onChange: onFormatChange }), sizing === undefined ? null : (_jsx(FigureSizeRows, { sizing: sizing, size: size })), _jsx(OverlaySegmented, { label: t('download.resolution'), help: {
|
|
@@ -46,6 +48,11 @@ export function FigureDownloadPanel(props) {
|
|
|
46
48
|
},
|
|
47
49
|
}, value: String(scale), options: scaleChoices(scales, drawn, painted), onChange: (picked) => onScaleChange(Number(picked)) })] }));
|
|
48
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Wide enough for the longest hint on one line in English, so switching
|
|
53
|
+
* between PNG and SVG — whose hints differ in length — never resizes the panel.
|
|
54
|
+
*/
|
|
55
|
+
const PANEL_WIDTH = '27em';
|
|
49
56
|
/** The two files a figure can leave the page as. */
|
|
50
57
|
const FORMAT_CHOICES = [
|
|
51
58
|
{ value: 'png', label: 'PNG' },
|
|
@@ -75,30 +82,4 @@ function scaleChoices(scales, size, painted) {
|
|
|
75
82
|
}
|
|
76
83
|
return choices;
|
|
77
84
|
}
|
|
78
|
-
/**
|
|
79
|
-
* The line at the foot of the panel: what pressing save is about to do.
|
|
80
|
-
* @param format - Which file the reader is about to write.
|
|
81
|
-
* @param size - How big the figure is drawn for the file.
|
|
82
|
-
* @param scale - The multiple it is saved at.
|
|
83
|
-
* @param failure - What went wrong last time, if anything.
|
|
84
|
-
* @param rasterSvg - Whether the SVG embeds a rendered picture.
|
|
85
|
-
* @param t - The chrome's formatter, so the sentence is in the language of
|
|
86
|
-
* the page.
|
|
87
|
-
* @returns The sentence.
|
|
88
|
-
*/
|
|
89
|
-
function hintOf(format, size, scale, failure, rasterSvg, t) {
|
|
90
|
-
if (failure !== null)
|
|
91
|
-
return failure;
|
|
92
|
-
if (size === null)
|
|
93
|
-
return t('download.noFigure');
|
|
94
|
-
if (format === 'svg' && rasterSvg) {
|
|
95
|
-
return t('download.hintRasterSvg', {
|
|
96
|
-
pixels: formatFigurePixels(figurePixels(size, scale)),
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
const pixels = formatFigurePixels(figurePixels(size, scale));
|
|
100
|
-
return format === 'svg'
|
|
101
|
-
? t('download.hintSvg', { pixels })
|
|
102
|
-
: t('download.hintPng', { pixels });
|
|
103
|
-
}
|
|
104
85
|
//# sourceMappingURL=FigureDownloadPanel.js.map
|