react-cheminfo 0.50.0 → 0.51.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/bin/check-seo.mjs +0 -0
- package/lib/clipboard/core/index.d.ts +0 -1
- package/lib/clipboard/core/index.d.ts.map +1 -1
- package/lib/clipboard/core/index.js +0 -1
- package/lib/clipboard/core/index.js.map +1 -1
- package/lib/clipboard/ui/CopyButton.d.ts +6 -0
- package/lib/clipboard/ui/CopyButton.d.ts.map +1 -1
- package/lib/clipboard/ui/CopyButton.js +5 -2
- package/lib/clipboard/ui/CopyButton.js.map +1 -1
- package/lib/color/core/index.d.ts +3 -0
- package/lib/color/core/index.d.ts.map +1 -1
- package/lib/color/core/index.js +2 -0
- package/lib/color/core/index.js.map +1 -1
- package/lib/color/core/interpolate.d.ts +4 -2
- package/lib/color/core/interpolate.d.ts.map +1 -1
- package/lib/color/core/interpolate.js +34 -12
- package/lib/color/core/interpolate.js.map +1 -1
- package/lib/color/core/stops.d.ts +43 -0
- package/lib/color/core/stops.d.ts.map +1 -0
- package/lib/color/core/stops.js +66 -0
- package/lib/color/core/stops.js.map +1 -0
- package/lib/color/core/tone.d.ts +25 -0
- package/lib/color/core/tone.d.ts.map +1 -0
- package/lib/color/core/tone.js +67 -0
- package/lib/color/core/tone.js.map +1 -0
- package/lib/color/core/uniform.d.ts +36 -0
- package/lib/color/core/uniform.d.ts.map +1 -0
- package/lib/color/core/uniform.js +61 -0
- package/lib/color/core/uniform.js.map +1 -0
- package/lib/color/ui/ColorScaleEditor.d.ts +5 -6
- package/lib/color/ui/ColorScaleEditor.d.ts.map +1 -1
- package/lib/color/ui/ColorScaleEditor.js +74 -84
- package/lib/color/ui/ColorScaleEditor.js.map +1 -1
- package/lib/color/ui/ColorScaleSelect.d.ts +16 -0
- package/lib/color/ui/ColorScaleSelect.d.ts.map +1 -1
- package/lib/color/ui/ColorScaleSelect.js +69 -17
- package/lib/color/ui/ColorScaleSelect.js.map +1 -1
- package/lib/color/ui/ColorScaleTone.d.ts +17 -0
- package/lib/color/ui/ColorScaleTone.d.ts.map +1 -0
- package/lib/color/ui/ColorScaleTone.js +55 -0
- package/lib/color/ui/ColorScaleTone.js.map +1 -0
- package/lib/color/ui/ColorScaleTrack.d.ts +29 -0
- package/lib/color/ui/ColorScaleTrack.d.ts.map +1 -0
- package/lib/color/ui/ColorScaleTrack.js +143 -0
- package/lib/color/ui/ColorScaleTrack.js.map +1 -0
- package/lib/download/core/copyFigure.d.ts +14 -0
- package/lib/download/core/copyFigure.d.ts.map +1 -0
- package/lib/download/core/copyFigure.js +18 -0
- package/lib/download/core/copyFigure.js.map +1 -0
- package/lib/download/core/figureHtml.js +1 -0
- package/lib/download/core/figureHtml.js.map +1 -1
- package/lib/download/core/figureHtmlMarkup.d.ts +10 -0
- package/lib/download/core/figureHtmlMarkup.d.ts.map +1 -1
- package/lib/download/core/figureHtmlMarkup.js +7 -1
- package/lib/download/core/figureHtmlMarkup.js.map +1 -1
- package/lib/download/core/index.d.ts +2 -0
- package/lib/download/core/index.d.ts.map +1 -1
- package/lib/download/core/index.js +1 -0
- package/lib/download/core/index.js.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.d.ts +2 -3
- package/lib/download/ui/FigureDownloadPanel.d.ts.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.js +1 -1
- package/lib/download/ui/FigureDownloadPanel.js.map +1 -1
- package/lib/download/ui/figureDownloadHint.d.ts +1 -1
- package/lib/download/ui/figureDownloadHint.d.ts.map +1 -1
- package/lib/download/ui/figureDownloadHint.js.map +1 -1
- package/lib/download/ui/index.d.ts +0 -1
- package/lib/download/ui/index.d.ts.map +1 -1
- package/lib/download/ui/useFigureActions.d.ts +2 -11
- package/lib/download/ui/useFigureActions.d.ts.map +1 -1
- package/lib/download/ui/useFigureActions.js +4 -23
- package/lib/download/ui/useFigureActions.js.map +1 -1
- package/lib/download/ui/useFigureTask.d.ts +21 -0
- package/lib/download/ui/useFigureTask.d.ts.map +1 -0
- package/lib/download/ui/useFigureTask.js +27 -0
- package/lib/download/ui/useFigureTask.js.map +1 -0
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/locales/de.json +28 -2
- package/lib/locales/en.json +28 -2
- package/lib/locales/es.json +28 -2
- package/lib/locales/fr.json +28 -2
- package/lib/locales/it.json +28 -2
- package/lib/molecule3d/core/index.d.ts +1 -1
- package/lib/molecule3d/core/index.d.ts.map +1 -1
- package/lib/molecule3d/core/index.js +1 -1
- package/lib/molecule3d/core/index.js.map +1 -1
- package/lib/molecule3d/core/settings.d.ts +15 -0
- package/lib/molecule3d/core/settings.d.ts.map +1 -1
- package/lib/molecule3d/core/settings.js +25 -0
- package/lib/molecule3d/core/settings.js.map +1 -1
- package/lib/molecule3d/ui/Molecule3DExport.d.ts +3 -0
- package/lib/molecule3d/ui/Molecule3DExport.d.ts.map +1 -1
- package/lib/molecule3d/ui/Molecule3DExport.js +10 -16
- package/lib/molecule3d/ui/Molecule3DExport.js.map +1 -1
- package/lib/molecule3d/ui/Molecule3DOptions.d.ts +3 -1
- package/lib/molecule3d/ui/Molecule3DOptions.d.ts.map +1 -1
- package/lib/molecule3d/ui/Molecule3DOptions.js +22 -6
- package/lib/molecule3d/ui/Molecule3DOptions.js.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.d.ts.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.js +4 -3
- package/lib/molecule3d/ui/MoleculeCanvas3D.js.map +1 -1
- package/lib/molecule3d/ui/exportMoleculeImage.d.ts +9 -0
- package/lib/molecule3d/ui/exportMoleculeImage.d.ts.map +1 -1
- package/lib/molecule3d/ui/exportMoleculeImage.js +15 -0
- package/lib/molecule3d/ui/exportMoleculeImage.js.map +1 -1
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts +2 -1
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts.map +1 -1
- package/lib/molecule3d/ui/useImageExport.d.ts +7 -1
- package/lib/molecule3d/ui/useImageExport.d.ts.map +1 -1
- package/lib/molecule3d/ui/useImageExport.js +12 -3
- package/lib/molecule3d/ui/useImageExport.js.map +1 -1
- package/lib/overlay/ui/FigureBar.d.ts +41 -0
- package/lib/overlay/ui/FigureBar.d.ts.map +1 -0
- package/lib/overlay/ui/FigureBar.js +43 -0
- package/lib/overlay/ui/FigureBar.js.map +1 -0
- package/lib/overlay/ui/OverlayBar.d.ts +13 -4
- package/lib/overlay/ui/OverlayBar.d.ts.map +1 -1
- package/lib/overlay/ui/OverlayBar.js +2 -2
- package/lib/overlay/ui/OverlayBar.js.map +1 -1
- package/lib/overlay/ui/OverlayBarStrip.d.ts +2 -1
- package/lib/overlay/ui/OverlayBarStrip.d.ts.map +1 -1
- package/lib/overlay/ui/OverlayBarStrip.js +9 -5
- package/lib/overlay/ui/OverlayBarStrip.js.map +1 -1
- package/lib/overlay/ui/OverlayIconButton.d.ts +8 -2
- package/lib/overlay/ui/OverlayIconButton.d.ts.map +1 -1
- package/lib/overlay/ui/OverlayIconButton.js +2 -1
- package/lib/overlay/ui/OverlayIconButton.js.map +1 -1
- package/lib/overlay/ui/index.d.ts +4 -0
- package/lib/overlay/ui/index.d.ts.map +1 -1
- package/lib/overlay/ui/index.js +2 -0
- package/lib/overlay/ui/index.js.map +1 -1
- package/lib/overlay/ui/overlayBarShape.d.ts +18 -0
- package/lib/overlay/ui/overlayBarShape.d.ts.map +1 -1
- package/lib/overlay/ui/overlayStyles.d.ts +30 -0
- package/lib/overlay/ui/overlayStyles.d.ts.map +1 -1
- package/lib/overlay/ui/overlayStyles.js +52 -0
- package/lib/overlay/ui/overlayStyles.js.map +1 -1
- package/lib/overlay/ui/useFigureBarAwake.d.ts +12 -0
- package/lib/overlay/ui/useFigureBarAwake.d.ts.map +1 -0
- package/lib/overlay/ui/useFigureBarAwake.js +51 -0
- package/lib/overlay/ui/useFigureBarAwake.js.map +1 -0
- package/lib/periodic/core/elements.d.ts +6 -3
- package/lib/periodic/core/elements.d.ts.map +1 -1
- package/lib/periodic/core/elements.js +9 -3
- package/lib/periodic/core/elements.js.map +1 -1
- package/lib/periodic/core/index.d.ts +2 -2
- 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 +33 -3
- package/lib/periodic/core/layout.d.ts.map +1 -1
- package/lib/periodic/core/layout.js +14 -0
- package/lib/periodic/core/layout.js.map +1 -1
- package/lib/periodic/ui/BlockStrip.d.ts +20 -0
- package/lib/periodic/ui/BlockStrip.d.ts.map +1 -0
- package/lib/periodic/ui/BlockStrip.js +48 -0
- package/lib/periodic/ui/BlockStrip.js.map +1 -0
- package/lib/periodic/ui/ElementCell.d.ts.map +1 -1
- package/lib/periodic/ui/ElementCell.js +9 -8
- 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 +3 -1
- package/lib/periodic/ui/PeriodicTable.js.map +1 -1
- package/lib/periodic/ui/PeriodicTableHelp.d.ts +33 -0
- package/lib/periodic/ui/PeriodicTableHelp.d.ts.map +1 -0
- package/lib/periodic/ui/PeriodicTableHelp.js +107 -0
- package/lib/periodic/ui/PeriodicTableHelp.js.map +1 -0
- package/lib/periodic/ui/cellStyles.d.ts +3 -2
- package/lib/periodic/ui/cellStyles.d.ts.map +1 -1
- package/lib/periodic/ui/cellStyles.js +3 -2
- package/lib/periodic/ui/cellStyles.js.map +1 -1
- package/lib/periodic/ui/index.d.ts +2 -0
- package/lib/periodic/ui/index.d.ts.map +1 -1
- package/lib/periodic/ui/index.js +1 -0
- package/lib/periodic/ui/index.js.map +1 -1
- package/lib/periodic/ui/periodicTableProps.d.ts +5 -4
- package/lib/periodic/ui/periodicTableProps.d.ts.map +1 -1
- package/lib/periodic/ui/tableLayout.d.ts +3 -1
- package/lib/periodic/ui/tableLayout.d.ts.map +1 -1
- package/lib/periodic/ui/tableLayout.js +8 -3
- package/lib/periodic/ui/tableLayout.js.map +1 -1
- package/lib/share/ui/ShareDialogContent.d.ts +3 -2
- package/lib/share/ui/ShareDialogContent.d.ts.map +1 -1
- package/lib/share/ui/ShareDialogContent.js +5 -6
- package/lib/share/ui/ShareDialogContent.js.map +1 -1
- package/lib/share/ui/ShareLinkBar.d.ts +8 -2
- package/lib/share/ui/ShareLinkBar.d.ts.map +1 -1
- package/lib/share/ui/ShareLinkBar.js +6 -5
- package/lib/share/ui/ShareLinkBar.js.map +1 -1
- package/lib/share/ui/SharePreview.d.ts.map +1 -1
- package/lib/share/ui/SharePreview.js +2 -2
- package/lib/share/ui/SharePreview.js.map +1 -1
- package/lib/structure/ui/StructurePicturePane.js +3 -3
- package/lib/structure/ui/StructurePicturePane.js.map +1 -1
- package/package.json +1 -1
- package/src/clipboard/core/index.ts +0 -1
- package/src/clipboard/ui/CopyButton.tsx +12 -1
- package/src/color/core/index.ts +9 -0
- package/src/color/core/interpolate.ts +51 -22
- package/src/color/core/stops.ts +98 -0
- package/src/color/core/tone.ts +79 -0
- package/src/color/core/uniform.ts +67 -0
- package/src/color/ui/ColorScaleEditor.tsx +115 -141
- package/src/color/ui/ColorScaleSelect.tsx +160 -36
- package/src/color/ui/ColorScaleTone.tsx +103 -0
- package/src/color/ui/ColorScaleTrack.tsx +239 -0
- package/src/download/core/copyFigure.ts +20 -0
- package/src/download/core/figureHtml.ts +1 -0
- package/src/download/core/figureHtmlMarkup.ts +14 -1
- package/src/download/core/index.ts +2 -0
- package/src/download/ui/FigureDownloadPanel.tsx +8 -11
- package/src/download/ui/figureDownloadHint.ts +1 -2
- package/src/download/ui/index.ts +0 -1
- package/src/download/ui/useFigureActions.ts +6 -42
- package/src/download/ui/useFigureTask.ts +46 -0
- package/src/locales/de.json +28 -2
- package/src/locales/en.json +28 -2
- package/src/locales/es.json +28 -2
- package/src/locales/fr.json +28 -2
- package/src/locales/it.json +28 -2
- package/src/molecule3d/core/index.ts +2 -0
- package/src/molecule3d/core/settings.ts +35 -0
- package/src/molecule3d/ui/Molecule3DExport.tsx +18 -17
- package/src/molecule3d/ui/Molecule3DOptions.tsx +51 -3
- package/src/molecule3d/ui/MoleculeCanvas3D.tsx +11 -3
- package/src/molecule3d/ui/exportMoleculeImage.ts +20 -0
- package/src/molecule3d/ui/moleculeViewer3DProps.ts +2 -1
- package/src/molecule3d/ui/useImageExport.ts +25 -3
- package/src/overlay/ui/FigureBar.tsx +96 -0
- package/src/overlay/ui/OverlayBar.tsx +15 -5
- package/src/overlay/ui/OverlayBarStrip.tsx +34 -22
- package/src/overlay/ui/OverlayIconButton.tsx +10 -2
- package/src/overlay/ui/index.ts +4 -0
- package/src/overlay/ui/overlayBarShape.ts +19 -0
- package/src/overlay/ui/overlayStyles.ts +61 -0
- package/src/overlay/ui/useFigureBarAwake.ts +56 -0
- package/src/periodic/core/elements.ts +8 -3
- package/src/periodic/core/index.ts +8 -1
- package/src/periodic/core/layout.ts +45 -3
- package/src/periodic/ui/BlockStrip.tsx +81 -0
- package/src/periodic/ui/ElementCell.tsx +9 -8
- package/src/periodic/ui/PeriodicTable.tsx +4 -1
- package/src/periodic/ui/PeriodicTableHelp.tsx +205 -0
- package/src/periodic/ui/cellStyles.ts +3 -2
- package/src/periodic/ui/index.ts +5 -0
- package/src/periodic/ui/periodicTableProps.ts +5 -4
- package/src/periodic/ui/tableLayout.ts +9 -3
- package/src/share/ui/ShareDialogContent.tsx +9 -13
- package/src/share/ui/ShareLinkBar.tsx +16 -4
- package/src/share/ui/SharePreview.tsx +6 -2
- package/src/structure/ui/StructurePicturePane.tsx +3 -3
- package/styles/chrome.css +43 -32
- package/lib/clipboard/core/copyPng.d.ts +0 -13
- package/lib/clipboard/core/copyPng.d.ts.map +0 -1
- package/lib/clipboard/core/copyPng.js +0 -19
- package/lib/clipboard/core/copyPng.js.map +0 -1
- package/src/clipboard/core/copyPng.ts +0 -20
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { DEFAULT_FIGURE_SCALE, FIGURE_SCALES, } from "../../download/core/figureScale.js";
|
|
4
4
|
import { FigureDownloadPanel } from "../../download/ui/FigureDownloadPanel.js";
|
|
5
|
+
import { useFigureTask } from "../../download/ui/useFigureTask.js";
|
|
5
6
|
import { useChromeT } from "../../i18n/ui/useT.js";
|
|
6
7
|
/**
|
|
7
8
|
* The export panel.
|
|
@@ -9,26 +10,19 @@ import { useChromeT } from "../../i18n/ui/useT.js";
|
|
|
9
10
|
* @returns The panel.
|
|
10
11
|
*/
|
|
11
12
|
export function Molecule3DExport(props) {
|
|
12
|
-
const { getSize, onExport } = props;
|
|
13
|
+
const { getSize, onExport, onCopy } = props;
|
|
13
14
|
const t = useChromeT();
|
|
14
15
|
const [size] = useState(getSize);
|
|
15
16
|
const [format, setFormat] = useState('png');
|
|
16
17
|
const [scale, setScale] = useState(DEFAULT_FIGURE_SCALE);
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
setFailure(error instanceof Error ? error.message : String(error));
|
|
27
|
-
}
|
|
28
|
-
finally {
|
|
29
|
-
setSaving(false);
|
|
30
|
-
}
|
|
18
|
+
const { run, busy, failure, notice, clear } = useFigureTask();
|
|
19
|
+
// What the last copy came to only describes the choices it was made with.
|
|
20
|
+
function changed(apply) {
|
|
21
|
+
return (value) => {
|
|
22
|
+
clear();
|
|
23
|
+
apply(value);
|
|
24
|
+
};
|
|
31
25
|
}
|
|
32
|
-
return (_jsx(FigureDownloadPanel, { title: t('molecule3d.exportImage'), format: format, scale: scale, scales: FIGURE_SCALES, size: size, failure: failure, saving:
|
|
26
|
+
return (_jsx(FigureDownloadPanel, { title: t('molecule3d.exportImage'), format: format, scale: scale, scales: FIGURE_SCALES, size: size, failure: failure, notice: notice, saving: busy, rasterSvg: true, onFormatChange: changed(setFormat), onScaleChange: changed(setScale), onSave: () => run(onExport(format, scale).then(() => null)), onCopy: () => run(onCopy(scale)) }));
|
|
33
27
|
}
|
|
34
28
|
//# sourceMappingURL=Molecule3DExport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Molecule3DExport.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/Molecule3DExport.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Molecule3DExport.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/Molecule3DExport.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAKjC,OAAO,EACL,oBAAoB,EACpB,aAAa,GACd,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA2C,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAYnD;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAA4B;IAC3D,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAC5C,MAAM,CAAC,GAAG,UAAU,EAAE,CAAC;IACvB,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IACjC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAe,KAAK,CAAC,CAAC;IAC1D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,oBAAoB,CAAC,CAAC;IACzD,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,EAAE,CAAC;IAE9D,0EAA0E;IAC1E,SAAS,OAAO,CAAI,KAAyB;QAC3C,OAAO,CAAC,KAAK,EAAE,EAAE;YACf,KAAK,EAAE,CAAC;YACR,KAAK,CAAC,KAAK,CAAC,CAAC;QACf,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,mBAAmB,IAClB,KAAK,EAAE,CAAC,CAAC,wBAAwB,CAAC,EAClC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,IAAI,EACZ,SAAS,QACT,cAAc,EAAE,OAAO,CAAC,SAAS,CAAC,EAClC,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,EAChC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,EAC3D,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAChC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The display options of the molecule viewer, shown in the toolbar's popover:
|
|
3
3
|
* the representation, the size, and the surface's opacity, solvent probe and
|
|
4
|
-
* colours.
|
|
4
|
+
* colours, with a button returning them all to the defaults.
|
|
5
5
|
*/
|
|
6
6
|
import type { ReactElement } from 'react';
|
|
7
7
|
import type { Molecule3DSettings } from '../core/settings.ts';
|
|
@@ -11,6 +11,8 @@ export interface Molecule3DOptionsProps {
|
|
|
11
11
|
onChange: (settings: Molecule3DSettings) => void;
|
|
12
12
|
/** Topological polar surface area in Ų, or `null` when unknown. */
|
|
13
13
|
polarSurfaceArea: number | null;
|
|
14
|
+
/** What the reset button returns to; `showSurface` is left as it is. */
|
|
15
|
+
defaults: Molecule3DSettings;
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* The options panel.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Molecule3DOptions.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/Molecule3DOptions.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAIzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"Molecule3DOptions.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/Molecule3DOptions.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAIzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAY9D,0CAA0C;AAC1C,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,QAAQ,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACjD,oEAAoE;IACpE,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,wEAAwE;IACxE,QAAQ,EAAE,kBAAkB,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,CAkG7E"}
|
|
@@ -2,12 +2,12 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
/**
|
|
3
3
|
* The display options of the molecule viewer, shown in the toolbar's popover:
|
|
4
4
|
* the representation, the size, and the surface's opacity, solvent probe and
|
|
5
|
-
* colours.
|
|
5
|
+
* colours, with a button returning them all to the defaults.
|
|
6
6
|
*/
|
|
7
|
-
import { SegmentedControl, Slider } from '@blueprintjs/core';
|
|
7
|
+
import { Button, SegmentedControl, Slider } from '@blueprintjs/core';
|
|
8
8
|
import { formatDecimal } from "../../format/core/numbers.js";
|
|
9
9
|
import { useChromeT } from "../../i18n/ui/useT.js";
|
|
10
|
-
import { MOLECULE_3D_RANGES, REPRESENTATIONS, REPRESENTATION_LABELS, isRepresentationId, } from "../core/settings.js";
|
|
10
|
+
import { MOLECULE_3D_RANGES, REPRESENTATIONS, REPRESENTATION_LABELS, isRepresentationId, resetMolecule3DSettings, sameMolecule3DSettings, } from "../core/settings.js";
|
|
11
11
|
import { Molecule3DSurfaceColors } from "./Molecule3DSurfaceColors.js";
|
|
12
12
|
/**
|
|
13
13
|
* The options panel.
|
|
@@ -15,8 +15,10 @@ import { Molecule3DSurfaceColors } from "./Molecule3DSurfaceColors.js";
|
|
|
15
15
|
* @returns The panel.
|
|
16
16
|
*/
|
|
17
17
|
export function Molecule3DOptions(props) {
|
|
18
|
-
const { settings, onChange, polarSurfaceArea } = props;
|
|
18
|
+
const { settings, onChange, polarSurfaceArea, defaults } = props;
|
|
19
19
|
const t = useChromeT();
|
|
20
|
+
const reset = resetMolecule3DSettings(settings, defaults);
|
|
21
|
+
const atDefaults = sameMolecule3DSettings(settings, reset);
|
|
20
22
|
return (_jsxs("div", { style: PANEL_STYLE, children: [_jsx(SegmentedControl, { fill: true, size: "small", intent: "primary", options: REPRESENTATIONS.map((representation) => ({
|
|
21
23
|
value: representation,
|
|
22
24
|
label: t.or(`molecule3d.representation.${representation}`, REPRESENTATION_LABELS[representation]),
|
|
@@ -26,11 +28,15 @@ export function Molecule3DOptions(props) {
|
|
|
26
28
|
}
|
|
27
29
|
} }), _jsxs("div", { style: GRID_STYLE, children: [_jsx(SliderRow, { label: t('molecule3d.size'), range: MOLECULE_3D_RANGES.sizeFactor, digits: 1, value: settings.sizeFactor, testId: "molecule3d-size-value", onChange: (sizeFactor) => {
|
|
28
30
|
onChange({ ...settings, sizeFactor });
|
|
29
|
-
} }),
|
|
31
|
+
} }), settings.showSurface ? null : (_jsxs("span", { style: SURFACE_OFF_STYLE, "data-testid": "molecule3d-surface-off", children: [t('molecule3d.surfaceOff'), _jsx(Button, { variant: "minimal", size: "small", intent: "primary", text: t('molecule3d.showSurface'), onClick: () => {
|
|
32
|
+
onChange({ ...settings, showSurface: true });
|
|
33
|
+
} })] })), _jsx(SliderRow, { label: t('molecule3d.surfaceOpacity'), range: MOLECULE_3D_RANGES.surfaceAlpha, digits: 2, value: settings.surfaceAlpha, disabled: !settings.showSurface, testId: "molecule3d-opacity-value", onChange: (surfaceAlpha) => {
|
|
30
34
|
onChange({ ...settings, surfaceAlpha });
|
|
31
35
|
} }), _jsx(SliderRow, { label: t('molecule3d.solventProbe'), title: t('molecule3d.solventProbeHelp'), range: MOLECULE_3D_RANGES.probeRadius, digits: 1, value: settings.probeRadius, disabled: !settings.showSurface, testId: "molecule3d-probe-value", onChange: (probeRadius) => {
|
|
32
36
|
onChange({ ...settings, probeRadius });
|
|
33
|
-
} })] }), _jsx(Molecule3DSurfaceColors, { settings: settings, onChange: onChange, polarSurfaceArea: polarSurfaceArea })
|
|
37
|
+
} })] }), _jsx(Molecule3DSurfaceColors, { settings: settings, onChange: onChange, polarSurfaceArea: polarSurfaceArea }), _jsx("span", { style: FOOTER_STYLE, children: _jsx("span", { title: atDefaults ? t('molecule3d.atDefaults') : undefined, children: _jsx(Button, { variant: "minimal", size: "small", icon: "reset", text: t('molecule3d.resetSettings'), disabled: atDefaults, "data-testid": "molecule3d-reset-settings", onClick: () => {
|
|
38
|
+
onChange(reset);
|
|
39
|
+
} }) }) })] }));
|
|
34
40
|
}
|
|
35
41
|
/**
|
|
36
42
|
* Label, slider and value as three grid cells; tick labels would collide.
|
|
@@ -55,6 +61,16 @@ const GRID_STYLE = {
|
|
|
55
61
|
rowGap: 6,
|
|
56
62
|
};
|
|
57
63
|
const LABEL_STYLE = { fontSize: 12 };
|
|
64
|
+
/** Spans the grid, between the size and the surface rows it explains. */
|
|
65
|
+
const SURFACE_OFF_STYLE = {
|
|
66
|
+
display: 'flex',
|
|
67
|
+
gridColumn: '1 / -1',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
justifyContent: 'space-between',
|
|
70
|
+
color: 'var(--text-muted)',
|
|
71
|
+
fontSize: 12,
|
|
72
|
+
};
|
|
73
|
+
const FOOTER_STYLE = { display: 'flex', justifyContent: 'end' };
|
|
58
74
|
/** Room on both sides, so the handle is never clipped at either end. */
|
|
59
75
|
const SLIDER_STYLE = { display: 'block', paddingInline: 8 };
|
|
60
76
|
const VALUE_STYLE = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Molecule3DOptions.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/Molecule3DOptions.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Molecule3DOptions.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/Molecule3DOptions.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA+B,CAAC;AAYxE;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACjE,MAAM,CAAC,GAAG,UAAU,EAAE,CAAC;IACvB,MAAM,KAAK,GAAG,uBAAuB,CAAC,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SAAS,EAAE,EAAE;IACb,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,MAAM,WAAW,GAAkB,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AAEpD,yEAAyE;AACzE,MAAM,iBAAiB,GAAkB;IACvC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,UAAU,EAAE,QAAQ;IACpB,cAAc,EAAE,eAAe;IAC/B,KAAK,EAAE,mBAAmB;IAC1B,QAAQ,EAAE,EAAE;CACb,CAAC;AAEF,MAAM,YAAY,GAAkB,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;AAE/E,wEAAwE;AACxE,MAAM,YAAY,GAAkB,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;AAE3E,MAAM,WAAW,GAAkB;IACjC,QAAQ,EAAE,EAAE;IACZ,kBAAkB,EAAE,cAAc;IAClC,SAAS,EAAE,OAAO;CACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoleculeCanvas3D.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeCanvas3D.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAczD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAOxE,yCAAyC;AACzC,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,qBAAqB,EACrB,UAAU,GAAG,mBAAmB,CACjC;IACC,2EAA2E;IAC3E,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACnD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"MoleculeCanvas3D.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeCanvas3D.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAczD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAOxE,yCAAyC;AACzC,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,qBAAqB,EACrB,UAAU,GAAG,mBAAmB,CACjC;IACC,2EAA2E;IAC3E,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACnD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CAqJ3E"}
|
|
@@ -18,7 +18,8 @@ import { usePolarSurfaceArea } from "./usePolarSurfaceArea.js";
|
|
|
18
18
|
export function MoleculeCanvas3D(props) {
|
|
19
19
|
const { molfile, frameNewMolecule = 'keep', tools: toolsProp, settings: settingsProp, defaultSettings, onSettingsChange, spinning: spinningProp, defaultSpinning = false, onSpinningChange, spinSpeed = DEFAULT_SPIN_SPEED, measurements: measurementsProp, onMeasurementsChange, fileName = 'molecule', background, minHeight = 320, onFailureChange, } = props;
|
|
20
20
|
const tools = resolveMolecule3DTools(toolsProp);
|
|
21
|
-
const [
|
|
21
|
+
const [initialSettings] = useState(() => normalizeMolecule3DSettings(defaultSettings));
|
|
22
|
+
const [settings, setSettings] = useControlledState(settingsProp, initialSettings, onSettingsChange);
|
|
22
23
|
const [spinning, setSpinning] = useControlledState(spinningProp, defaultSpinning, onSpinningChange);
|
|
23
24
|
const [measurements, setMeasurements] = useControlledState(measurementsProp, NO_MEASUREMENTS, onMeasurementsChange);
|
|
24
25
|
const [measureKind, setMeasureKind] = useState(null);
|
|
@@ -80,12 +81,12 @@ export function MoleculeCanvas3D(props) {
|
|
|
80
81
|
onFailureChange,
|
|
81
82
|
camera: props,
|
|
82
83
|
});
|
|
83
|
-
const { canvasSize, exportImage } = useImageExport(container, viewerRef, fileName);
|
|
84
|
+
const { canvasSize, exportImage, copyImage } = useImageExport(container, viewerRef, fileName);
|
|
84
85
|
return (_jsxs("div", { style: { ...STAGE_STYLE, minHeight }, children: [_jsx("div", { ref: setContainer, style: CANVAS_STYLE, "data-testid": "molecule3d" }), molfile !== null && (_jsx("div", { style: OVERLAY_STYLE, children: _jsx(Molecule3DToolbar, { tools: tools, measureKind: measureKind, onMeasureKindChange: setMeasureKind, measurementCount: measurements.length, onClearMeasurements: () => {
|
|
85
86
|
setMeasurements(NO_MEASUREMENTS);
|
|
86
87
|
}, spinning: spinning, onSpinningChange: setSpinning, showSurface: settings.showSurface, onShowSurfaceChange: (showSurface) => {
|
|
87
88
|
setSettings({ ...settings, showSurface });
|
|
88
|
-
}, onResetView: resetView, options: _jsx(Molecule3DOptions, { settings: settings, onChange: setSettings, polarSurfaceArea: polarSurfaceArea }), exportPanel: _jsx(Molecule3DExport, { getSize: canvasSize, onExport: exportImage }) }) }))] }));
|
|
89
|
+
}, onResetView: resetView, options: _jsx(Molecule3DOptions, { settings: settings, onChange: setSettings, polarSurfaceArea: polarSurfaceArea, defaults: initialSettings }), exportPanel: _jsx(Molecule3DExport, { getSize: canvasSize, onExport: exportImage, onCopy: copyImage }) }) }))] }));
|
|
89
90
|
}
|
|
90
91
|
const NO_MEASUREMENTS = [];
|
|
91
92
|
const STAGE_STYLE = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoleculeCanvas3D.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeCanvas3D.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAwB,C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AC,CAAC;oBACnC,CAAC,EACD,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,WAAW,EAC7B,WAAW,EAAE,QAAQ,CAAC,WAAW,EACjC,mBAAmB,EAAE,CAAC,WAAW,EAAE,EAAE;wBACnC,WAAW,CAAC,EAAE,GAAG,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;oBAC5C,CAAC,EACD,WAAW,EAAE,SAAS,EACtB,OAAO,EACL,KAAC,iBAAiB,IAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,WAAW,EACrB,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,eAAe,GACzB,EAEJ,WAAW,EACT,KAAC,gBAAgB,IACf,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,SAAS,GACjB,GAEJ,GACE,CACP,IACG,CACP,CAAC;AACJ,CAAC;AAED,MAAM,eAAe,GAA2B,EAAE,CAAC;AAEnD,MAAM,WAAW,GAAkB;IACjC,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,MAAM;IACb,YAAY,EAAE,CAAC;IACf,QAAQ,EAAE,QAAQ;CACnB,CAAC;AAEF,8EAA8E;AAC9E,MAAM,YAAY,GAAkB,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAEvE,MAAM,aAAa,GAAkB;IACnC,QAAQ,EAAE,UAAU;IACpB,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,YAAY;IACxB,GAAG,EAAE,CAAC;IACN,aAAa,EAAE,MAAM;CACtB,CAAC"}
|
|
@@ -15,6 +15,15 @@ export interface MoleculeImageRequest {
|
|
|
15
15
|
/** File name without its extension. */
|
|
16
16
|
fileName: string;
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Render the scene as a PNG, for the clipboard.
|
|
20
|
+
* @param viewer - The viewer holding the scene.
|
|
21
|
+
* @param scale - Multiple of the canvas on screen it is rendered at.
|
|
22
|
+
* @param size - Size of the canvas on screen, CSS pixels.
|
|
23
|
+
* @returns The PNG.
|
|
24
|
+
* @throws {Error} When the viewer has nothing to render.
|
|
25
|
+
*/
|
|
26
|
+
export declare function captureMoleculePng(viewer: SceneCapture, scale: number, size: ImageSize): Promise<Blob>;
|
|
18
27
|
/**
|
|
19
28
|
* Render the scene and hand it to the browser as a file.
|
|
20
29
|
* @param viewer - The viewer holding the scene.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportMoleculeImage.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/exportMoleculeImage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAK1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxD,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,YAAY,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAChE;AAED,+CAA+C;AAC/C,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,YAAY,CAAC;IACrB,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,IAAI,EAAE,SAAS,CAAC;IAChB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|
|
1
|
+
{"version":3,"file":"exportMoleculeImage.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/exportMoleculeImage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAK1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxD,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,YAAY,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAChE;AAED,+CAA+C;AAC/C,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,YAAY,CAAC;IACrB,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,IAAI,EAAE,SAAS,CAAC;IAChB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|
|
@@ -4,6 +4,21 @@ import { figurePixels } from "../../download/core/figureScale.js";
|
|
|
4
4
|
import { FIGURE_SVG_TYPE } from "../../download/core/figureSvg.js";
|
|
5
5
|
import { sanitizeFileName } from "../../download/core/sanitizeFileName.js";
|
|
6
6
|
import { dataUriBytes, rasterSvgMarkup } from "../core/exportImage.js";
|
|
7
|
+
/**
|
|
8
|
+
* Render the scene as a PNG, for the clipboard.
|
|
9
|
+
* @param viewer - The viewer holding the scene.
|
|
10
|
+
* @param scale - Multiple of the canvas on screen it is rendered at.
|
|
11
|
+
* @param size - Size of the canvas on screen, CSS pixels.
|
|
12
|
+
* @returns The PNG.
|
|
13
|
+
* @throws {Error} When the viewer has nothing to render.
|
|
14
|
+
*/
|
|
15
|
+
export async function captureMoleculePng(viewer, scale, size) {
|
|
16
|
+
const dataUri = await viewer.captureImage(figurePixels(size, scale));
|
|
17
|
+
if (dataUri === undefined) {
|
|
18
|
+
throw new Error('There is no picture to copy yet.');
|
|
19
|
+
}
|
|
20
|
+
return new Blob([dataUriBytes(dataUri)], { type: FIGURE_PNG_TYPE });
|
|
21
|
+
}
|
|
7
22
|
/**
|
|
8
23
|
* Render the scene and hand it to the browser as a file.
|
|
9
24
|
* @param viewer - The viewer holding the scene.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportMoleculeImage.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/exportMoleculeImage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAE3E,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAmBvE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAoB,EACpB,OAA6B;IAE7B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAClD,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAClD,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO;IAClC,MAAM,IAAI,GAAG,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACpD,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,YAAY,CACV,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,C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EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAClD,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAClD,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO;IAClC,MAAM,IAAI,GAAG,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACpD,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,YAAY,CACV,IAAI,IAAI,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,EAC5D,GAAG,IAAI,MAAM,CACd,CAAC;QACF,OAAO;IACT,CAAC;IACD,YAAY,CACV,IAAI,IAAI,CAAC,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,EACvE,GAAG,IAAI,MAAM,CACd,CAAC;AACJ,CAAC"}
|
|
@@ -32,7 +32,8 @@ export interface MoleculeViewer3DProps {
|
|
|
32
32
|
*/
|
|
33
33
|
settings?: Molecule3DSettings;
|
|
34
34
|
/**
|
|
35
|
-
* Starting settings when the component owns them
|
|
35
|
+
* Starting settings when the component owns them, and what the options'
|
|
36
|
+
* reset button returns to either way.
|
|
36
37
|
* @default DEFAULT_MOLECULE_3D_SETTINGS
|
|
37
38
|
*/
|
|
38
39
|
defaultSettings?: Partial<Molecule3DSettings>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moleculeViewer3DProps.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/moleculeViewer3DProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAg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;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9C;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC1D;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IACtC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,KAAK,IAAI,CAAC;IACtE;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACxC;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACpD;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,SAAS,CAAC;CACjE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
|
+
import type { FigureNotice } from '../../download/core/copyFigure.ts';
|
|
2
3
|
import type { FigureFormat } from '../../download/core/downloadFigure.ts';
|
|
3
4
|
import type { FigurePixels } from '../../download/core/figureScale.ts';
|
|
4
5
|
import type { SceneCapture } from './exportMoleculeImage.ts';
|
|
@@ -8,9 +9,14 @@ export interface ImageExport {
|
|
|
8
9
|
canvasSize: () => FigurePixels | null;
|
|
9
10
|
/** Render the scene at `scale` and download it as `format`. */
|
|
10
11
|
exportImage: (format: FigureFormat, scale: number) => Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Render the scene at `scale` and put it on the clipboard as a PNG. Call it
|
|
14
|
+
* from the click itself: Safari only allows a write the click started.
|
|
15
|
+
*/
|
|
16
|
+
copyImage: (scale: number) => Promise<FigureNotice>;
|
|
11
17
|
}
|
|
12
18
|
/**
|
|
13
|
-
* The
|
|
19
|
+
* The callbacks the export panel needs, bound to the canvas and its viewer.
|
|
14
20
|
* @param container - The element molstar draws into.
|
|
15
21
|
* @param viewerRef - The viewer, once created.
|
|
16
22
|
* @param fileName - File name without its extension.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useImageExport.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/useImageExport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"useImageExport.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/useImageExport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAM7D,0DAA0D;AAC1D,MAAM,WAAW,WAAW;IAC1B,qEAAqE;IACrE,UAAU,EAAE,MAAM,YAAY,GAAG,IAAI,CAAC;IACtC,+DAA+D;IAC/D,WAAW,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE;;;OAGG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;CACrD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,cAAc,GAAG,IAAI,EAChC,SAAS,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,EACzC,QAAQ,EAAE,MAAM,GACf,WAAW,CAiCb"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { copyFigure } from "../../download/core/copyFigure.js";
|
|
3
|
+
import { captureMoleculePng, exportMoleculeImage, } from "./exportMoleculeImage.js";
|
|
3
4
|
/**
|
|
4
|
-
* The
|
|
5
|
+
* The callbacks the export panel needs, bound to the canvas and its viewer.
|
|
5
6
|
* @param container - The element molstar draws into.
|
|
6
7
|
* @param viewerRef - The viewer, once created.
|
|
7
8
|
* @param fileName - File name without its extension.
|
|
@@ -24,6 +25,14 @@ export function useImageExport(container, viewerRef, fileName) {
|
|
|
24
25
|
}
|
|
25
26
|
await exportMoleculeImage(viewer, { format, scale, size, fileName });
|
|
26
27
|
}, [canvasSize, viewerRef, fileName]);
|
|
27
|
-
|
|
28
|
+
const copyImage = useCallback((scale) => {
|
|
29
|
+
const viewer = viewerRef.current;
|
|
30
|
+
const size = canvasSize();
|
|
31
|
+
if (viewer === null || size === null) {
|
|
32
|
+
return Promise.reject(new Error('There is no picture to copy yet.'));
|
|
33
|
+
}
|
|
34
|
+
return copyFigure(captureMoleculePng(viewer, scale, size));
|
|
35
|
+
}, [canvasSize, viewerRef]);
|
|
36
|
+
return { canvasSize, exportImage, copyImage };
|
|
28
37
|
}
|
|
29
38
|
//# sourceMappingURL=useImageExport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useImageExport.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/useImageExport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useImageExport.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/useImageExport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGpC,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAK/D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAelC;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,SAAgC,EAChC,SAAyC,EACzC,QAAgB;IAEhB,MAAM,UAAU,GAAG,WAAW,CAAC,GAAwB,EAAE;QACvD,IAAI,SAAS,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QACpC,MAAM,GAAG,GAAG,SAAS,CAAC,qBAAqB,EAAE,CAAC;QAC9C,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACnD,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1E,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,MAAM,WAAW,GAAG,WAAW,CAC7B,KAAK,EAAE,MAAoB,EAAE,KAAa,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC;QACjC,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC;QAC1B,IAAI,MAAM,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACxD,CAAC;QACD,MAAM,mBAAmB,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACvE,CAAC,EACD,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAClC,CAAC;IAEF,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,KAAa,EAAE,EAAE;QAChB,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC;QACjC,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC;QAC1B,IAAI,MAAM,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YACrC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,UAAU,CAAC,kBAAkB,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAC7D,CAAC,EACD,CAAC,UAAU,EAAE,SAAS,CAAC,CACxB,CAAC;IAEF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { OverlayDensity } from '../core/overlayMetrics.ts';
|
|
3
|
+
import type { OverlayBarProps } from './OverlayBar.tsx';
|
|
4
|
+
/** What {@link FigureBar} needs. */
|
|
5
|
+
export interface FigureBarProps extends Omit<OverlayBarProps, 'placement' | 'restingOpacity' | 'children'> {
|
|
6
|
+
/**
|
|
7
|
+
* The controls at the start of the row — how the figure is drawn, such as
|
|
8
|
+
* its axis scales. They never fold.
|
|
9
|
+
* @default undefined — the start of the row is empty
|
|
10
|
+
*/
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* How tightly the bar packs its controls. A coarse pointer wins over this,
|
|
14
|
+
* whatever it says.
|
|
15
|
+
* @default 'compact'
|
|
16
|
+
*/
|
|
17
|
+
density?: OverlayDensity;
|
|
18
|
+
/**
|
|
19
|
+
* Class the bar carries, in addition to `figure-bar no-print`.
|
|
20
|
+
* @default undefined
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The controls of a figure, in one bar spanning the width above it.
|
|
26
|
+
*
|
|
27
|
+
* Settings read from the left edge — `children`, which never fold, then `end`,
|
|
28
|
+
* which folds behind a cog on a narrow figure — and the glyphs keep the right
|
|
29
|
+
* one: the `?` in `info`, saving and printing in `tools`. Every figure of the
|
|
30
|
+
* family is laid out this way, so the reader finds both in the same place.
|
|
31
|
+
*
|
|
32
|
+
* Put it right before the figure, never inside its box, and give the two a
|
|
33
|
+
* parent of their own: it is in the flow, so it covers neither the data nor
|
|
34
|
+
* the axes, and with `rest` it wakes while that parent is pointed at. It measures its own width to decide
|
|
35
|
+
* what folds, is left out of a printed page, and is marked as chrome so that
|
|
36
|
+
* saving a figure it sits inside saves the picture without it.
|
|
37
|
+
* @param props - See {@link FigureBarProps}.
|
|
38
|
+
* @returns The bar.
|
|
39
|
+
*/
|
|
40
|
+
export declare function FigureBar(props: FigureBarProps): ReactElement;
|
|
41
|
+
//# sourceMappingURL=FigureBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FigureBar.d.ts","sourceRoot":"","sources":["../../../src/overlay/ui/FigureBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAUxD,oCAAoC;AACpC,MAAM,WAAW,cAAe,SAAQ,IAAI,CAC1C,eAAe,EACf,WAAW,GAAG,gBAAgB,GAAG,UAAU,CAC5C;IACC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,CAqC7D"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useRef } from 'react';
|
|
3
|
+
import { useContainerSize } from "../../hooks/ui/useContainerSize.js";
|
|
4
|
+
import { joinClassNames } from "../../shared/ui/joinClassNames.js";
|
|
5
|
+
import { overlayMetrics } from "../core/overlayMetrics.js";
|
|
6
|
+
import { OverlayBar } from "./OverlayBar.js";
|
|
7
|
+
import { OverlaySurfaceContext, useCoarsePointer, useOverlaySurface, } from "./overlaySurface.js";
|
|
8
|
+
import { useFigureBarAwake } from "./useFigureBarAwake.js";
|
|
9
|
+
/**
|
|
10
|
+
* The controls of a figure, in one bar spanning the width above it.
|
|
11
|
+
*
|
|
12
|
+
* Settings read from the left edge — `children`, which never fold, then `end`,
|
|
13
|
+
* which folds behind a cog on a narrow figure — and the glyphs keep the right
|
|
14
|
+
* one: the `?` in `info`, saving and printing in `tools`. Every figure of the
|
|
15
|
+
* family is laid out this way, so the reader finds both in the same place.
|
|
16
|
+
*
|
|
17
|
+
* Put it right before the figure, never inside its box, and give the two a
|
|
18
|
+
* parent of their own: it is in the flow, so it covers neither the data nor
|
|
19
|
+
* the axes, and with `rest` it wakes while that parent is pointed at. It measures its own width to decide
|
|
20
|
+
* what folds, is left out of a printed page, and is marked as chrome so that
|
|
21
|
+
* saving a figure it sits inside saves the picture without it.
|
|
22
|
+
* @param props - See {@link FigureBarProps}.
|
|
23
|
+
* @returns The bar.
|
|
24
|
+
*/
|
|
25
|
+
export function FigureBar(props) {
|
|
26
|
+
const { children, density = 'compact', className, ...bar } = props;
|
|
27
|
+
const { rest = 'visible' } = props;
|
|
28
|
+
const box = useRef(null);
|
|
29
|
+
const { width } = useContainerSize(box);
|
|
30
|
+
const above = useOverlaySurface();
|
|
31
|
+
const pointer = useCoarsePointer() ? 'coarse' : 'fine';
|
|
32
|
+
// A finger has nothing to point with until it touches, so it never rests.
|
|
33
|
+
const awake = useFigureBarAwake(box, rest !== 'visible' && pointer === 'fine');
|
|
34
|
+
const surface = useMemo(() => ({
|
|
35
|
+
...above,
|
|
36
|
+
metrics: overlayMetrics(density, pointer),
|
|
37
|
+
awake,
|
|
38
|
+
pointer,
|
|
39
|
+
width,
|
|
40
|
+
}), [above, density, awake, pointer, width]);
|
|
41
|
+
return (_jsx("div", { ref: box, className: joinClassNames('figure-bar no-print', className), "data-figure": "chrome", children: _jsx(OverlaySurfaceContext.Provider, { value: surface, children: _jsx(OverlayBar, { ...bar, placement: "stretch", children: children }) }) }));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=FigureBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FigureBar.js","sourceRoot":"","sources":["../../../src/overlay/ui/FigureBar.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAC;AAE9C,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,qBAAqB,C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 @@
|
|
|
1
1
|
import type { IconName } from '@blueprintjs/core';
|
|
2
2
|
import type { ReactElement, ReactNode } from 'react';
|
|
3
3
|
import type { OverlayPlacement } from '../core/overlayPlacement.ts';
|
|
4
|
+
import type { OverlayBarRest } from './overlayBarShape.ts';
|
|
4
5
|
/** What {@link OverlayBar} needs. */
|
|
5
6
|
export interface OverlayBarProps {
|
|
6
7
|
/**
|
|
@@ -10,10 +11,11 @@ export interface OverlayBarProps {
|
|
|
10
11
|
*/
|
|
11
12
|
children: ReactNode;
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* The controls belonging to whatever the figure is currently showing. On a
|
|
15
|
+
* card they close the row; on a stretched bar they follow the start, left
|
|
16
|
+
* aligned, and only the glyphs keep the right edge. They are the first
|
|
17
|
+
* thing to go when the figure is too narrow, folding in behind the button.
|
|
18
|
+
* @default undefined — the bar holds only its start and its glyphs
|
|
17
19
|
*/
|
|
18
20
|
end?: ReactNode;
|
|
19
21
|
/**
|
|
@@ -62,6 +64,13 @@ export interface OverlayBarProps {
|
|
|
62
64
|
* @default 0.74
|
|
63
65
|
*/
|
|
64
66
|
restingOpacity?: number;
|
|
67
|
+
/**
|
|
68
|
+
* How a stretched bar's controls are drawn while nothing points at the
|
|
69
|
+
* figure: at full strength, faded, or not at all. The bar keeps its height
|
|
70
|
+
* whichever it is. A card ignores it: its rest is `restingOpacity`.
|
|
71
|
+
* @default 'visible'
|
|
72
|
+
*/
|
|
73
|
+
rest?: OverlayBarRest;
|
|
65
74
|
/**
|
|
66
75
|
* Whether the bar is reduced to a button opening the same controls in a
|
|
67
76
|
* popover. Left out, it folds on its own once the figure is narrower than
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayBar.d.ts","sourceRoot":"","sources":["../../../src/overlay/ui/OverlayBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mB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EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CAwD/D"}
|
|
@@ -27,7 +27,7 @@ export function OverlayBar(props) {
|
|
|
27
27
|
const name = label ?? t('overlay.options');
|
|
28
28
|
const { collapsed, defaultCollapsed = false } = props;
|
|
29
29
|
const { collapseBelow = 420, moreIcon = 'cog', testId } = props;
|
|
30
|
-
const { morePadded = true } = props;
|
|
30
|
+
const { morePadded = true, rest } = props;
|
|
31
31
|
const { width } = useOverlaySurface();
|
|
32
32
|
const [startedFolded] = useState(defaultCollapsed);
|
|
33
33
|
const folded = overlayBarFolded({
|
|
@@ -37,7 +37,7 @@ export function OverlayBar(props) {
|
|
|
37
37
|
collapseBelow,
|
|
38
38
|
});
|
|
39
39
|
if (placement === 'stretch') {
|
|
40
|
-
return (_jsx(OverlayBarStrip, { end: end, tools: tools, info: info, more: more, placement: placement, label: name, moreIcon: moreIcon, morePadded: morePadded, folded: folded, testId: testId, children: children }));
|
|
40
|
+
return (_jsx(OverlayBarStrip, { end: end, tools: tools, info: info, more: more, placement: placement, label: name, moreIcon: moreIcon, morePadded: morePadded, folded: folded, rest: rest, testId: testId, children: children }));
|
|
41
41
|
}
|
|
42
42
|
return (_jsx(OverlayBarCard, { end: end, tools: tools, info: info, more: more, placement: placement, label: name, moreIcon: moreIcon, morePadded: morePadded, folded: folded, restingOpacity: restingOpacity, testId: testId, children: children }));
|
|
43
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayBar.js","sourceRoot":"","sources":["../../../src/overlay/ui/OverlayBar.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,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AC;IAC1C,MAAM,EAAE,KAAK,EAAE,GAAG,iBAAiB,EAAE,CAAC;IACtC,MAAM,CAAC,aAAa,CAAC,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAEnD,MAAM,MAAM,GAAG,gBAAgB,CAAC;QAC9B,SAAS;QACT,aAAa;QACb,KAAK;QACL,aAAa;KACd,CAAC,CAAC;IAEH,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,CACL,KAAC,eAAe,IACd,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,YAEb,QAAQ,GACO,CACnB,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,cAAc,IACb,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,cAAc,EAC9B,MAAM,EAAE,MAAM,YAEb,QAAQ,GACM,CAClB,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { OverlayBarShapeProps } from './overlayBarShape.ts';
|
|
3
3
|
/**
|
|
4
|
-
* The bar that spans the width of the figure
|
|
4
|
+
* The bar that spans the width of the figure: the settings from the left edge,
|
|
5
|
+
* the glyphs — help, saving, the button the rest folds into — at the right.
|
|
5
6
|
*
|
|
6
7
|
* It is in the flow above the picture rather than on it, and its ground is
|
|
7
8
|
* solid rather than translucent, because a strip reaching from one edge of the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayBarStrip.d.ts","sourceRoot":"","sources":["../../../src/overlay/ui/OverlayBarStrip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"OverlayBarStrip.d.ts","sourceRoot":"","sources":["../../../src/overlay/ui/OverlayBarStrip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAWjE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CA4CzE"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { OverlayBarButton } from "./OverlayBarButton.js";
|
|
3
|
-
import {
|
|
3
|
+
import { overlayBarContentStyle, overlayBarGroundStyle, overlayBarGroupStyle, overlayBarRestStyle, overlayBarSideStyle, overlayCardStyle, } from "./overlayStyles.js";
|
|
4
4
|
import { useOverlaySurface } from "./overlaySurface.js";
|
|
5
5
|
/**
|
|
6
|
-
* The bar that spans the width of the figure
|
|
6
|
+
* The bar that spans the width of the figure: the settings from the left edge,
|
|
7
|
+
* the glyphs — help, saving, the button the rest folds into — at the right.
|
|
7
8
|
*
|
|
8
9
|
* It is in the flow above the picture rather than on it, and its ground is
|
|
9
10
|
* solid rather than translucent, because a strip reaching from one edge of the
|
|
@@ -18,9 +19,12 @@ import { useOverlaySurface } from "./overlaySurface.js";
|
|
|
18
19
|
*/
|
|
19
20
|
export function OverlayBarStrip(props) {
|
|
20
21
|
const { children, end, tools, info, more, placement, label } = props;
|
|
21
|
-
const { moreIcon, morePadded, folded, testId } = props;
|
|
22
|
-
const { metrics } = useOverlaySurface();
|
|
22
|
+
const { moreIcon, morePadded, folded, testId, rest = 'visible' } = props;
|
|
23
|
+
const { metrics, awake } = useOverlaySurface();
|
|
23
24
|
const opens = more !== undefined || (folded && end !== undefined);
|
|
24
|
-
return (_jsxs("div", { style: overlayCardStyle(placement, metrics), "data-testid": testId, children: [_jsx("div", { style:
|
|
25
|
+
return (_jsxs("div", { style: overlayCardStyle(placement, metrics), "data-testid": testId, children: [_jsx("div", { style: overlayBarGroundStyle(rest, awake) }), _jsxs("div", { style: {
|
|
26
|
+
...overlayBarContentStyle(metrics),
|
|
27
|
+
...overlayBarRestStyle(rest, awake),
|
|
28
|
+
}, children: [children === null || children === undefined ? null : (_jsx("div", { style: overlayBarSideStyle(metrics), children: children })), _jsxs("div", { role: "group", "aria-label": label, style: overlayBarGroupStyle(metrics), children: [_jsx("div", { style: overlayBarSideStyle(metrics), children: folded ? null : end }), _jsxs("div", { style: overlayBarSideStyle(metrics), children: [tools, info, opens ? (_jsxs(OverlayBarButton, { placement: placement, label: label, icon: moreIcon, padded: morePadded, children: [folded ? end : null, more] })) : null] })] })] })] }));
|
|
25
29
|
}
|
|
26
30
|
//# sourceMappingURL=OverlayBarStrip.js.map
|