react-cheminfo 0.50.0 → 0.52.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 +71 -16
- 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/host/core/connectHost.d.ts +75 -0
- package/lib/host/core/connectHost.d.ts.map +1 -0
- package/lib/host/core/connectHost.js +171 -0
- package/lib/host/core/connectHost.js.map +1 -0
- package/lib/host/core/hostStructure.d.ts +52 -0
- package/lib/host/core/hostStructure.d.ts.map +1 -0
- package/lib/host/core/hostStructure.js +106 -0
- package/lib/host/core/hostStructure.js.map +1 -0
- package/lib/host/core/index.d.ts +9 -0
- package/lib/host/core/index.d.ts.map +1 -0
- package/lib/host/core/index.js +5 -0
- package/lib/host/core/index.js.map +1 -0
- package/lib/host/core/kinds.d.ts +73 -0
- package/lib/host/core/kinds.d.ts.map +1 -0
- package/lib/host/core/kinds.js +88 -0
- package/lib/host/core/kinds.js.map +1 -0
- package/lib/host/core/protocol.d.ts +134 -0
- package/lib/host/core/protocol.d.ts.map +1 -0
- package/lib/host/core/protocol.js +92 -0
- package/lib/host/core/protocol.js.map +1 -0
- package/lib/host/testing/sciPeaks.d.ts +21 -0
- package/lib/host/testing/sciPeaks.d.ts.map +1 -0
- package/lib/host/testing/sciPeaks.js +62 -0
- package/lib/host/testing/sciPeaks.js.map +1 -0
- package/lib/host/testing/standInHost.d.ts +47 -0
- package/lib/host/testing/standInHost.d.ts.map +1 -0
- package/lib/host/testing/standInHost.js +85 -0
- package/lib/host/testing/standInHost.js.map +1 -0
- package/lib/host/ui/index.d.ts +3 -0
- package/lib/host/ui/index.d.ts.map +1 -0
- package/lib/host/ui/index.js +2 -0
- package/lib/host/ui/index.js.map +1 -0
- package/lib/host/ui/useHostConnection.d.ts +36 -0
- package/lib/host/ui/useHostConnection.d.ts.map +1 -0
- package/lib/host/ui/useHostConnection.js +62 -0
- package/lib/host/ui/useHostConnection.js.map +1 -0
- package/lib/host-testing.d.ts +8 -0
- package/lib/host-testing.d.ts.map +1 -0
- package/lib/host-testing.js +7 -0
- package/lib/host-testing.js.map +1 -0
- package/lib/host.d.ts +11 -0
- package/lib/host.d.ts.map +1 -0
- package/lib/host.js +11 -0
- package/lib/host.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 +4 -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/host/core/connectHost.ts +240 -0
- package/src/host/core/hostStructure.ts +129 -0
- package/src/host/core/index.ts +46 -0
- package/src/host/core/kinds.ts +128 -0
- package/src/host/core/protocol.ts +197 -0
- package/src/host/testing/sciPeaks.ts +66 -0
- package/src/host/testing/standInHost.ts +116 -0
- package/src/host/ui/index.ts +2 -0
- package/src/host/ui/useHostConnection.ts +85 -0
- package/src/host-testing.ts +18 -0
- package/src/host.ts +11 -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
|
@@ -42,6 +42,8 @@ const MIN_WIDTH = 280;
|
|
|
42
42
|
const ROW_HEIGHT = ofWidth(ROW_SHARE);
|
|
43
43
|
/** The band the two inner-transition series were lifted out across. */
|
|
44
44
|
const SERIES_GAP = `max(6px, ${ofWidth(1.1)})`;
|
|
45
|
+
/** The height of a header strip, and of the gap once it carries block labels. */
|
|
46
|
+
const STRIP_HEIGHT = `max(12px, ${ofWidth(2)})`;
|
|
45
47
|
export const rootStyle = {
|
|
46
48
|
display: 'flex',
|
|
47
49
|
flexDirection: 'column',
|
|
@@ -65,11 +67,14 @@ const baseGridStyle = {
|
|
|
65
67
|
* The grid the cells are placed on.
|
|
66
68
|
* @param headers - Whether a leading column and row hold the period and group
|
|
67
69
|
* numbers.
|
|
70
|
+
* @param blocks - Whether the gap under period 7 names the blocks, which needs
|
|
71
|
+
* it as tall as a header strip.
|
|
68
72
|
* @returns The style of the grid.
|
|
69
73
|
*/
|
|
70
|
-
export function gridStyle(headers) {
|
|
74
|
+
export function gridStyle(headers, blocks = false) {
|
|
71
75
|
// The eighth row is the gap the inner-transition series are lifted out into.
|
|
72
|
-
const
|
|
76
|
+
const gap = blocks ? STRIP_HEIGHT : SERIES_GAP;
|
|
77
|
+
const rows = `repeat(7, ${ROW_HEIGHT}) ${gap} repeat(2, ${ROW_HEIGHT})`;
|
|
73
78
|
if (!headers) {
|
|
74
79
|
return {
|
|
75
80
|
...baseGridStyle,
|
|
@@ -80,7 +85,7 @@ export function gridStyle(headers) {
|
|
|
80
85
|
return {
|
|
81
86
|
...baseGridStyle,
|
|
82
87
|
gridTemplateColumns: `max(14px, ${ofWidth(2.4)}) repeat(${String(COLUMN_COUNT)}, minmax(0, 1fr))`,
|
|
83
|
-
gridTemplateRows:
|
|
88
|
+
gridTemplateRows: `${STRIP_HEIGHT} ${rows}`,
|
|
84
89
|
};
|
|
85
90
|
}
|
|
86
91
|
//# sourceMappingURL=tableLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tableLayout.js","sourceRoot":"","sources":["../../../src/periodic/ui/tableLayout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc;IACvC,OAAO;QACL,UAAU,EAAE,QAAQ;QACpB,OAAO,EAAE,MAAM;QACf,uEAAuE;QACvE,yDAAyD;QACzD,OAAO,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,EAAE;QAC5B,UAAU,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC,WAAW,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE;QAC7F,OAAO,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,GAAG,MAAM,CAAC,WAAW,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;QACpF,0EAA0E;QAC1E,yEAAyE;QACzE,iCAAiC;QACjC,QAAQ,EAAE,eAAe,OAAO,CAAC,GAAG,CAAC,GAAG;QACxC,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,QAAQ;KACnB,CAAC;AACJ,CAAC;AAED,iFAAiF;AACjF,MAAM,SAAS,GAAG,GAAG,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ChB,mBAAmB,EAAE,UAAU,MAAM,CAAC,YAAY,CAAC,mBAAmB;YACtE,gBAAgB,EAAE,IAAI;SACvB,CAAC;IACJ,CAAC;IACD,OAAO;QACL,GAAG,aAAa;QAChB,mBAAmB,EAAE,aAAa,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,YAAY,CAAC,mBAAmB;QACjG,gBAAgB,EAAE,GAAG,YAAY,IAAI,IAAI,EAAE;KAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -4,8 +4,9 @@ import type { ShareDialogProps } from './ShareDialog.tsx';
|
|
|
4
4
|
/** Everything the dialog holds, minus what only its shell is concerned with. */
|
|
5
5
|
export type ShareDialogContentProps<Codecs extends ShareParamCodecs = Record<string, never>> = Omit<ShareDialogProps<Codecs>, 'isOpen' | 'usePortal'>;
|
|
6
6
|
/**
|
|
7
|
-
* The share dialog's body:
|
|
8
|
-
*
|
|
7
|
+
* The share dialog's body: the options on the left and the page they write on
|
|
8
|
+
* the right, and what one does with the link in the footer, never scrolled
|
|
9
|
+
* away. A copy closes the dialog, since it was what the dialog was opened for.
|
|
9
10
|
* @param props - What the site's links can say, how the page is named, and the extra section.
|
|
10
11
|
* @returns The body and the footer of the dialog.
|
|
11
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShareDialogContent.d.ts","sourceRoot":"","sources":["../../../src/share/ui/ShareDialogContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ShareDialogContent.d.ts","sourceRoot":"","sources":["../../../src/share/ui/ShareDialogContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAIzD,OAAO,KAAK,EAGV,gBAAgB,EAIjB,MAAM,kBAAkB,CAAC;AAa1B,OAAO,KAAK,EAAE,gBAAgB,EAAc,MAAM,mBAAmB,CAAC;AActE,gFAAgF;AAChF,MAAM,MAAM,uBAAuB,CACjC,MAAM,SAAS,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IACrD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC,CAAC;AAE3D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,SAAS,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EACvD,KAAK,EAAE,uBAAuB,CAAC,MAAM,CAAC,GAAG,YAAY,CAsItD"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { DialogFooter } from '@blueprintjs/core';
|
|
3
3
|
import { useRef, useState } from 'react';
|
|
4
4
|
import { useContainerSize } from "../../hooks/ui/useContainerSize.js";
|
|
5
|
-
import { useChromeT } from "../../i18n/ui/useT.js";
|
|
6
5
|
import { applySharePreset, buildEmbedCode, buildShareUrl, findSharePreset, isShareConfigured, parseShareConfig, suggestedShareConfig, visibleShareParts, } from "../core/index.js";
|
|
7
6
|
import { ShareConfigOptions } from "./ShareConfigOptions.js";
|
|
8
7
|
import { ShareLinkBar } from "./ShareLinkBar.js";
|
|
@@ -15,14 +14,14 @@ const NO_PRESETS = [];
|
|
|
15
14
|
const TWO_PANE_WIDTH = 720;
|
|
16
15
|
const SECTION_STYLE = { marginBottom: 14 };
|
|
17
16
|
/**
|
|
18
|
-
* The share dialog's body:
|
|
19
|
-
*
|
|
17
|
+
* The share dialog's body: the options on the left and the page they write on
|
|
18
|
+
* the right, and what one does with the link in the footer, never scrolled
|
|
19
|
+
* away. A copy closes the dialog, since it was what the dialog was opened for.
|
|
20
20
|
* @param props - What the site's links can say, how the page is named, and the extra section.
|
|
21
21
|
* @returns The body and the footer of the dialog.
|
|
22
22
|
*/
|
|
23
23
|
export function ShareDialogContent(props) {
|
|
24
24
|
const { onClose, vocabulary, presets = NO_PRESETS, defaultPreset, title, baseUrl, search, frameTitle, frameHeight, preview = true, partDescriptions = 'inline', children, } = props;
|
|
25
|
-
const t = useChromeT();
|
|
26
25
|
const address = globalThis.location;
|
|
27
26
|
const base = baseUrl ?? address?.href ?? '';
|
|
28
27
|
const query = search ?? address?.search ?? '';
|
|
@@ -73,7 +72,7 @@ export function ShareDialogContent(props) {
|
|
|
73
72
|
const openPreset = findPreset(presets, presetKey);
|
|
74
73
|
const optionsPane = (_jsxs("div", { className: "share-dialog__options", children: [openPreset === undefined ? (options) : (_jsx("p", { className: "share-dialog__preset", children: openPreset.description })), children === undefined ? null : (_jsx("section", { className: "share-section", style: SECTION_STYLE, children: typeof children === 'function' ? children(draft) : children }))] }));
|
|
75
74
|
const previewPane = preview ? (_jsx(SharePreview, { url: url, title: frameTitle ?? title, highlight: highlightOf(vocabulary.parts, pointed) })) : null;
|
|
76
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "share-dialog__body", ref: body, children: [
|
|
75
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "share-dialog__body", ref: body, children: [presets.length === 0 ? null : (_jsx("div", { className: "share-dialog__top", children: _jsx(SharePresetTabs, { presets: presets, selected: presetKey, onSelect: selectPreset }) })), _jsx(SharePanes, { options: optionsPane, preview: previewPane, narrow: narrow })] }), _jsx(DialogFooter, { actions: _jsx(ShareLinkBar, { url: url, frame: frame, onCopied: onClose }) })] }));
|
|
77
76
|
}
|
|
78
77
|
function initialDraft(search, vocabulary, preset) {
|
|
79
78
|
const current = parseShareConfig(search, vocabulary);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShareDialogContent.js","sourceRoot":"","sources":["../../../src/share/ui/ShareDialogContent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ShareDialogContent.js","sourceRoot":"","sources":["../../../src/share/ui/ShareDialogContent.tsx"],"names":[],"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AC,OAAO,EAAE,UAAU,CAAC;QAAE,OAAO,OAAO,CAAC;IAC3D,MAAM,SAAS,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACnD,OAAO,MAAM,KAAK,SAAS;QACzB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AACtD,CAAC;AAED,0EAA0E;AAC1E,4EAA4E;AAC5E,8BAA8B;AAC9B,SAAS,WAAW,CAClB,KAA8B,EAC9B,OAAsB;IAEtB,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,GAAG,KAAK,OAAO;YAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IACzE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,UAAU,CACjB,OAA2C,EAC3C,GAAkB;IAElB,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACnC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,GAAG,KAAK,GAAG;YAAE,OAAO,MAAM,CAAC;IACxC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -4,11 +4,17 @@ export interface ShareLinkBarProps {
|
|
|
4
4
|
url: string;
|
|
5
5
|
/** The markup that frames the page in someone else's site. */
|
|
6
6
|
frame: string;
|
|
7
|
+
/**
|
|
8
|
+
* Called once either copy has landed on the clipboard.
|
|
9
|
+
* @default undefined
|
|
10
|
+
*/
|
|
11
|
+
onCopied?: () => void;
|
|
7
12
|
}
|
|
8
13
|
/**
|
|
9
|
-
* The three things one does with a share link,
|
|
14
|
+
* The three things one does with a share link, in the dialog's footer and
|
|
10
15
|
* never scrolled away: a dialog whose Copy button is below the fold is a dialog
|
|
11
|
-
* one scrolls through every single time.
|
|
16
|
+
* one scrolls through every single time. A copy is what the dialog was opened
|
|
17
|
+
* for, so the dialog is told when one lands and closes on it.
|
|
12
18
|
*
|
|
13
19
|
* Neither the address nor the frame markup is printed. A teacher reads neither
|
|
14
20
|
* before pasting it, and a hundred characters of query string set in monospace
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShareLinkBar.d.ts","sourceRoot":"","sources":["../../../src/share/ui/ShareLinkBar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAM1C,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ShareLinkBar.d.ts","sourceRoot":"","sources":["../../../src/share/ui/ShareLinkBar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAM1C,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAiDnE"}
|
|
@@ -4,9 +4,10 @@ import { CopyButton } from "../../clipboard/ui/index.js";
|
|
|
4
4
|
import { HelpTooltip } from "../../help/ui/index.js";
|
|
5
5
|
import { useChromeT } from "../../i18n/ui/useT.js";
|
|
6
6
|
/**
|
|
7
|
-
* The three things one does with a share link,
|
|
7
|
+
* The three things one does with a share link, in the dialog's footer and
|
|
8
8
|
* never scrolled away: a dialog whose Copy button is below the fold is a dialog
|
|
9
|
-
* one scrolls through every single time.
|
|
9
|
+
* one scrolls through every single time. A copy is what the dialog was opened
|
|
10
|
+
* for, so the dialog is told when one lands and closes on it.
|
|
10
11
|
*
|
|
11
12
|
* Neither the address nor the frame markup is printed. A teacher reads neither
|
|
12
13
|
* before pasting it, and a hundred characters of query string set in monospace
|
|
@@ -16,17 +17,17 @@ import { useChromeT } from "../../i18n/ui/useT.js";
|
|
|
16
17
|
* @returns The bar.
|
|
17
18
|
*/
|
|
18
19
|
export function ShareLinkBar(props) {
|
|
19
|
-
const { url, frame } = props;
|
|
20
|
+
const { url, frame, onCopied } = props;
|
|
20
21
|
const t = useChromeT();
|
|
21
22
|
return (_jsxs("div", { className: "share-linkbar", children: [_jsx(HelpTooltip, { content: {
|
|
22
23
|
title: t('share.copyLinkHelpTitle'),
|
|
23
24
|
body: t('share.copyLinkHelp'),
|
|
24
|
-
}, children: _jsx(CopyButton, { content: url, label: t('share.copyLink'), title: "" }) }), _jsx(HelpTooltip, { content: {
|
|
25
|
+
}, children: _jsx(CopyButton, { content: url, label: t('share.copyLink'), title: "", onCopied: onCopied }) }), _jsx(HelpTooltip, { content: {
|
|
25
26
|
title: t('share.openInNewTabHelpTitle'),
|
|
26
27
|
body: t('share.openInNewTabHelp'),
|
|
27
28
|
}, children: _jsx(AnchorButton, { icon: "share", text: t('share.openInNewTab'), href: url, target: "_blank", rel: "noopener noreferrer" }) }), _jsx(HelpTooltip, { content: {
|
|
28
29
|
title: t('share.copyIframeHelpTitle'),
|
|
29
30
|
body: t('share.copyIframeHelp'),
|
|
30
|
-
}, children: _jsx(CopyButton, { content: frame, icon: "code", label: t('share.copyIframe'), title: "" }) })] }));
|
|
31
|
+
}, children: _jsx(CopyButton, { content: frame, icon: "code", label: t('share.copyIframe'), title: "", onCopied: onCopied }) })] }));
|
|
31
32
|
}
|
|
32
33
|
//# sourceMappingURL=ShareLinkBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShareLinkBar.js","sourceRoot":"","sources":["../../../src/share/ui/ShareLinkBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"ShareLinkBar.js","sourceRoot":"","sources":["../../../src/share/ui/ShareLinkBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAcnD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACvC,MAAM,CAAC,GAAG,UAAU,EAAE,CAAC;IAEvB,OAAO,CACL,eAAK,SAAS,EAAC,eAAe,aAC5B,KAAC,WAAW,IACV,OAAO,EAAE;oBACP,KAAK,EAAE,CAAC,CAAC,yBAAyB,CAAC;oBACnC,IAAI,EAAE,CAAC,CAAC,oBAAoB,CAAC;iBAC9B,YAED,KAAC,UAAU,IACT,OAAO,EAAE,GAAG,EACZ,KAAK,EAAE,CAAC,CAAC,gBAAgB,CAAC,EAC1B,KAAK,EAAC,EAAE,EACR,QAAQ,EAAE,QAAQ,GAClB,GACU,EACd,KAAC,WAAW,IACV,OAAO,EAAE;oBACP,KAAK,EAAE,CAAC,CAAC,6BAA6B,CAAC;oBACvC,IAAI,EAAE,CAAC,CAAC,wBAAwB,CAAC;iBAClC,YAED,KAAC,YAAY,IACX,IAAI,EAAC,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,oBAAoB,CAAC,EAC7B,IAAI,EAAE,GAAG,EACT,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,GACzB,GACU,EACd,KAAC,WAAW,IACV,OAAO,EAAE;oBACP,KAAK,EAAE,CAAC,CAAC,2BAA2B,CAAC;oBACrC,IAAI,EAAE,CAAC,CAAC,sBAAsB,CAAC;iBAChC,YAED,KAAC,UAAU,IACT,OAAO,EAAE,KAAK,EACd,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,CAAC,CAAC,kBAAkB,CAAC,EAC5B,KAAK,EAAC,EAAE,EACR,QAAQ,EAAE,QAAQ,GAClB,GACU,IACV,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharePreview.d.ts","sourceRoot":"","sources":["../../../src/share/ui/SharePreview.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AA6BzD,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACpD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"SharePreview.d.ts","sourceRoot":"","sources":["../../../src/share/ui/SharePreview.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AA6BzD,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACpD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CA6InE"}
|
|
@@ -9,7 +9,7 @@ import { useChromeT } from "../../i18n/ui/useT.js";
|
|
|
9
9
|
import { SHARE_REGIONS_REQUEST, readShareRegions, sharePreviewAddress, sharePreviewScale, sharePreviewSize, } from "../core/index.js";
|
|
10
10
|
import { SharePreviewDevices } from "./SharePreviewDevices.js";
|
|
11
11
|
/** Room the window's own bar takes, which the page is not scaled into. */
|
|
12
|
-
const CHROME_HEIGHT =
|
|
12
|
+
const CHROME_HEIGHT = 31;
|
|
13
13
|
/** How often the framed page is asked again while it has answered nothing. */
|
|
14
14
|
const ASK_INTERVAL = 300;
|
|
15
15
|
/** How many times, so a page with nothing to report is left alone. */
|
|
@@ -90,7 +90,7 @@ export function SharePreview(props) {
|
|
|
90
90
|
clearInterval(timer);
|
|
91
91
|
};
|
|
92
92
|
}, [regions, src]);
|
|
93
|
-
return (_jsxs("section", { className: "share-preview", "aria-label": t('share.preview'), children: [_jsxs("header", { className: "share-preview__header", children: [_jsxs(H6, { className: "share-preview__label", children: [_jsx(Icon, { icon: "eye-open", size: 13 }), t('share.preview'), _jsx(HelpIcon, { content: help })] }), _jsx(SharePreviewDevices, { value: device, onChange: setDevice, windowSize: windowSize })] }), _jsx("div", { className: "share-preview__stage", ref: stage, children: _jsxs("div", { className: "share-preview__device", style: { width: page.width * scale }, children: [_jsxs("div", { className: "share-preview__chrome", children: [
|
|
93
|
+
return (_jsxs("section", { className: "share-preview", "aria-label": t('share.preview'), children: [_jsxs("header", { className: "share-preview__header", children: [_jsxs(H6, { className: "share-preview__label", children: [_jsx(Icon, { icon: "eye-open", size: 13 }), t('share.preview'), _jsx(HelpIcon, { content: help })] }), _jsx(SharePreviewDevices, { value: device, onChange: setDevice, windowSize: windowSize })] }), _jsx("div", { className: "share-preview__stage", ref: stage, children: _jsxs("div", { className: "share-preview__device", style: { width: page.width * scale }, children: [_jsxs("div", { className: "share-preview__chrome", children: [_jsxs("span", { className: "share-preview__lights", "aria-hidden": "true", children: [_jsx("span", {}), _jsx("span", {}), _jsx("span", {})] }), _jsx("span", { className: "share-preview__address", children: sharePreviewAddress(url) }), _jsx("span", { className: "share-preview__size", children: sizeNote(page.width, page.height, scale) })] }), _jsxs("div", { className: "share-preview__page", style: { height: page.height * scale }, children: [_jsx("iframe", { ref: frame, className: "share-preview__frame", src: src, title: title, style: frameStyle(page.width, page.height, scale), onLoad: () => {
|
|
94
94
|
// What the page before it reported is where its own parts
|
|
95
95
|
// were, so it is dropped rather than drawn over this one.
|
|
96
96
|
setRegions(NO_REGIONS);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharePreview.js","sourceRoot":"","sources":["../../../src/share/ui/SharePreview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA2B,CAAC;AAEhE,0EAA0E;AAC1E,MAAM,aAAa,GAAG,EAAE,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
|
import { useMemo, useState } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { copyFigure } from "../../download/core/copyFigure.js";
|
|
5
5
|
import { downloadBlob } from "../../download/core/downloadBlob.js";
|
|
6
6
|
import { downloadText } from "../../download/core/downloadText.js";
|
|
7
7
|
import { figurePng } from "../../download/core/figurePng.js";
|
|
@@ -67,8 +67,8 @@ export function StructurePicturePane(props) {
|
|
|
67
67
|
}) }), _jsx(Button, { icon: "clipboard", size: "small", text: t('structure.export.copyPng'), onClick: () =>
|
|
68
68
|
// Safari only allows a clipboard write the click itself started,
|
|
69
69
|
// so the image is handed over as a promise rather than awaited
|
|
70
|
-
// first — see `
|
|
71
|
-
void run(async () => (await
|
|
70
|
+
// first — see `copyFigure`.
|
|
71
|
+
void run(async () => (await copyFigure(png())) === 'copied'
|
|
72
72
|
? t('download.hintCopied', {
|
|
73
73
|
pixels: formatFigurePixels(picture),
|
|
74
74
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StructurePicturePane.js","sourceRoot":"","sources":["../../../src/structure/ui/StructurePicturePane.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"StructurePicturePane.js","sourceRoot":"","sources":["../../../src/structure/ui/StructurePicturePane.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO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AAC,CAAC,CAAC,0BAA0B,CAAC,CAClC,GAEH,IACE,EACL,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACxB,YAAG,SAAS,EAAC,0BAA0B,EAAC,KAAK,EAAE,YAAY,YACxD,MAAM,GACL,CACL,IACG,CACP,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,IAAsB;IAK1C,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC;YACX,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC;YAC9B,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;YACpB,QAAQ,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,GAAG;IACjB,GAAG,uBAAuB;IAC1B,KAAK,EAAE,KAAK,CAAC,SAAS;IACtB,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,GAAG;CACiB,CAAC;AAEnC,MAAM,YAAY,GAAG;IACnB,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,KAAK,CAAC,SAAS;IACtB,QAAQ,EAAE,EAAE;IACZ,kBAAkB,EAAE,cAAc;CACF,CAAC;AAEnC,MAAM,YAAY,GAAG;IACnB,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,KAAK,CAAC,SAAS;IACtB,QAAQ,EAAE,EAAE;CACoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-cheminfo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React components, hooks and framework-free helpers shared by the cheminfo sites: site chrome, citations, sharing, routing, pedagogy, charts, and the structure, orbital and 3D molecule viewers",
|
|
6
6
|
"author": "Luc Patiny",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"./build-info": "./lib/build-info.js",
|
|
19
19
|
"./conformers": "./lib/conformers.js",
|
|
20
20
|
"./core": "./lib/core.js",
|
|
21
|
+
"./host": "./lib/host.js",
|
|
22
|
+
"./host-testing": "./lib/host-testing.js",
|
|
21
23
|
"./ir": "./lib/ir.js",
|
|
22
24
|
"./molecule3d": "./lib/molecule3d.js",
|
|
23
25
|
"./molstar/*": "./lib/molstar/*/index.js",
|
|
@@ -66,6 +68,7 @@
|
|
|
66
68
|
"dependencies": {
|
|
67
69
|
"@formatjs/icu-messageformat-parser": "^3.5.20",
|
|
68
70
|
"@tanstack/react-virtual": "^3.14.13",
|
|
71
|
+
"ajv": "^8.20.0",
|
|
69
72
|
"cheminfo-font": "^1.28.0",
|
|
70
73
|
"cheminfo-types": "^1.16.0",
|
|
71
74
|
"convert-to-jcamp": "^7.0.1",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { writeImageToClipboard } from './copyPng.ts';
|
|
2
1
|
export type { WriteBlobToClipboardOptions } from './writeBlobToClipboard.ts';
|
|
3
2
|
export { writeBlobToClipboard } from './writeBlobToClipboard.ts';
|
|
4
3
|
export type { ClipboardContent, ClipboardText } from './writeToClipboard.ts';
|
|
@@ -71,6 +71,12 @@ export interface CopyButtonProps {
|
|
|
71
71
|
* @default undefined
|
|
72
72
|
*/
|
|
73
73
|
className?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Called once the clipboard has taken the content — never when it refused —
|
|
76
|
+
* for a dialog whose whole purpose was that copy and that closes on it.
|
|
77
|
+
* @default undefined
|
|
78
|
+
*/
|
|
79
|
+
onCopied?: () => void;
|
|
74
80
|
}
|
|
75
81
|
|
|
76
82
|
/**
|
|
@@ -92,6 +98,7 @@ export function CopyButton(props: CopyButtonProps): ReactElement {
|
|
|
92
98
|
resetAfter = DEFAULT_COPY_RESET_AFTER,
|
|
93
99
|
title,
|
|
94
100
|
className,
|
|
101
|
+
onCopied,
|
|
95
102
|
} = props;
|
|
96
103
|
const t = useChromeT();
|
|
97
104
|
const { copied, failed, copy } = useCopyToClipboard(resetAfter);
|
|
@@ -117,7 +124,11 @@ export function CopyButton(props: CopyButtonProps): ReactElement {
|
|
|
117
124
|
title={hoverTitle}
|
|
118
125
|
aria-label={label ?? hoverTitle}
|
|
119
126
|
onClick={() => {
|
|
120
|
-
void copy(typeof content === 'function' ? content() : content)
|
|
127
|
+
void copy(typeof content === 'function' ? content() : content).then(
|
|
128
|
+
(written) => {
|
|
129
|
+
if (written) onCopied?.();
|
|
130
|
+
},
|
|
131
|
+
);
|
|
121
132
|
}}
|
|
122
133
|
/>
|
|
123
134
|
);
|
package/src/color/core/index.ts
CHANGED
|
@@ -21,6 +21,15 @@ export {
|
|
|
21
21
|
DEFAULT_COLOR_SCALE_ID,
|
|
22
22
|
colorScaleById,
|
|
23
23
|
} from './scales.ts';
|
|
24
|
+
export {
|
|
25
|
+
UNIFORM_COLOR_SCALE_ID,
|
|
26
|
+
UNIFORM_SWATCH,
|
|
27
|
+
formatUniformColorScale,
|
|
28
|
+
isUniformColorScale,
|
|
29
|
+
uniformSwatch,
|
|
30
|
+
} from './uniform.ts';
|
|
31
|
+
export type { ScaleTone } from './tone.ts';
|
|
32
|
+
export { scaleTone, setScaleTone } from './tone.ts';
|
|
24
33
|
export type { ResolvedColorScale } from './scaleText.ts';
|
|
25
34
|
export {
|
|
26
35
|
MAXIMUM_CUSTOM_STOPS,
|
|
@@ -3,6 +3,7 @@ import { clamp } from '../../format/core/clamp.ts';
|
|
|
3
3
|
import type { ReadableInkOptions } from './contrast.ts';
|
|
4
4
|
import { readableInk } from './contrast.ts';
|
|
5
5
|
import { parseHexColor, toHexColor } from './hex.ts';
|
|
6
|
+
import type { HsvColor } from './hsv.ts';
|
|
6
7
|
import { hsvToRgb, rgbToHsv, wrapHue } from './hsv.ts';
|
|
7
8
|
|
|
8
9
|
const HALF_TURN = 180;
|
|
@@ -33,8 +34,10 @@ export interface ColorStop {
|
|
|
33
34
|
* - `hsv` turns along the colour wheel the short way round, so two anchors
|
|
34
35
|
* already describe a ramp that keeps its saturation instead of fading
|
|
35
36
|
* through the grey in the middle of the straight line between them.
|
|
36
|
-
* - `hsv-long` turns the
|
|
37
|
-
*
|
|
37
|
+
* - `hsv-long` turns the whole scale one way round the wheel: the long way
|
|
38
|
+
* between its two ends, which is how two anchors draw a rainbow. Each anchor
|
|
39
|
+
* in between is reached by turning that same way, never by a turn of its own,
|
|
40
|
+
* so adding one where the scale already has its colour changes nothing.
|
|
38
41
|
*/
|
|
39
42
|
export type ColorInterpolation = 'rgb' | 'hsv' | 'hsv-long';
|
|
40
43
|
|
|
@@ -94,7 +97,11 @@ export function colorAt(scale: ColorScale, position: number): string {
|
|
|
94
97
|
if (at > end.position) continue;
|
|
95
98
|
const span = end.position - start.position;
|
|
96
99
|
const ratio = span <= 0 ? 0 : (at - start.position) / span;
|
|
97
|
-
return mix(start.color, end.color, ratio,
|
|
100
|
+
return mix(start.color, end.color, ratio, {
|
|
101
|
+
interpolation,
|
|
102
|
+
turn: longTurn(first.color, last.color),
|
|
103
|
+
whole: stops.length === MINIMUM_SAMPLES,
|
|
104
|
+
});
|
|
98
105
|
}
|
|
99
106
|
return toHexColor(parseHexColor(last.color));
|
|
100
107
|
}
|
|
@@ -134,15 +141,18 @@ export function sampleScale(scale: ColorScale, count: number): string[] {
|
|
|
134
141
|
return colors;
|
|
135
142
|
}
|
|
136
143
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
144
|
+
interface HuePath {
|
|
145
|
+
interpolation: ColorInterpolation;
|
|
146
|
+
/** The way the long path turns: 1 up the wheel, -1 down it. */
|
|
147
|
+
turn: number;
|
|
148
|
+
/** Whether the two anchors are the whole scale, so one hue on both is a full turn. */
|
|
149
|
+
whole: boolean;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function mix(start: string, end: string, ratio: number, path: HuePath): string {
|
|
143
153
|
const from = parseHexColor(start);
|
|
144
154
|
const to = parseHexColor(end);
|
|
145
|
-
if (interpolation === 'rgb') {
|
|
155
|
+
if (path.interpolation === 'rgb') {
|
|
146
156
|
return toHexColor({
|
|
147
157
|
red: from.red + (to.red - from.red) * ratio,
|
|
148
158
|
green: from.green + (to.green - from.green) * ratio,
|
|
@@ -152,7 +162,8 @@ function mix(
|
|
|
152
162
|
|
|
153
163
|
const one = rgbToHsv(from);
|
|
154
164
|
const other = rgbToHsv(to);
|
|
155
|
-
const
|
|
165
|
+
const [fromHue, toHue] = pairHues(one, other);
|
|
166
|
+
const hue = fromHue + hueStep(fromHue, toHue, path) * ratio;
|
|
156
167
|
return toHexColor(
|
|
157
168
|
hsvToRgb({
|
|
158
169
|
hue: wrapHue(hue),
|
|
@@ -162,15 +173,33 @@ function mix(
|
|
|
162
173
|
);
|
|
163
174
|
}
|
|
164
175
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
)
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
+
// A grey, black or white has no hue of its own, so it takes the other one's:
|
|
177
|
+
// the path then fades to it instead of sweeping through red on the way.
|
|
178
|
+
function pairHues(one: HsvColor, other: HsvColor): [number, number] {
|
|
179
|
+
if (one.saturation === 0) return [other.hue, other.hue];
|
|
180
|
+
if (other.saturation === 0) return [one.hue, one.hue];
|
|
181
|
+
return [one.hue, other.hue];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function hueStep(from: number, to: number, path: HuePath): number {
|
|
185
|
+
if (path.interpolation !== 'hsv-long') return shortestStep(from, to);
|
|
186
|
+
const step = path.turn > 0 ? upStep(from, to) : -upStep(to, from);
|
|
187
|
+
return step === 0 && path.whole ? path.turn * TURN : step;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function longTurn(first: string, last: string): number {
|
|
191
|
+
const [from, to] = pairHues(
|
|
192
|
+
rgbToHsv(parseHexColor(first)),
|
|
193
|
+
rgbToHsv(parseHexColor(last)),
|
|
194
|
+
);
|
|
195
|
+
// Two ends of one hue are a full turn apart, taken up the wheel.
|
|
196
|
+
return shortestStep(from, to) > 0 ? -1 : 1;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function shortestStep(from: number, to: number): number {
|
|
200
|
+
return ((((to - from) % TURN) + TURN + HALF_TURN) % TURN) - HALF_TURN;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function upStep(from: number, to: number): number {
|
|
204
|
+
return (((to - from) % TURN) + TURN) % TURN;
|
|
176
205
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { clamp } from '../../format/core/clamp.ts';
|
|
2
|
+
|
|
3
|
+
import type { ColorScale, ColorStop } from './interpolate.ts';
|
|
4
|
+
import { colorAt } from './interpolate.ts';
|
|
5
|
+
import { MAXIMUM_CUSTOM_STOPS } from './scaleText.ts';
|
|
6
|
+
|
|
7
|
+
/** How few anchors a scale may have: one at each end of what it draws. */
|
|
8
|
+
export const MINIMUM_CUSTOM_STOPS = 2;
|
|
9
|
+
|
|
10
|
+
// A link writes three decimals, so an anchor is held where the link puts it.
|
|
11
|
+
const POSITION_FACTOR = 1000;
|
|
12
|
+
|
|
13
|
+
/** The anchors after an edit, and where the edited one now stands among them. */
|
|
14
|
+
export interface EditedStops {
|
|
15
|
+
/** The anchors, from the low end. */
|
|
16
|
+
stops: ColorStop[];
|
|
17
|
+
/** The index of the anchor that was added or moved. */
|
|
18
|
+
index: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Add an anchor where the reader clicked, in the colour the scale already has
|
|
23
|
+
* there — so adding one changes nothing until it is moved or recoloured.
|
|
24
|
+
* @param scale - The scale being edited.
|
|
25
|
+
* @param position - Where to add it, from 0 at the low end to 1 at the high end.
|
|
26
|
+
* @returns The anchors with the new one, or `null` when the scale already holds as many as a link may carry.
|
|
27
|
+
*/
|
|
28
|
+
export function addColorStop(
|
|
29
|
+
scale: ColorScale,
|
|
30
|
+
position: number,
|
|
31
|
+
): EditedStops | null {
|
|
32
|
+
if (scale.stops.length >= MAXIMUM_CUSTOM_STOPS) return null;
|
|
33
|
+
const at = roundPosition(position);
|
|
34
|
+
const added: ColorStop = { position: at, color: colorAt(scale, at) };
|
|
35
|
+
return sortAround([...scale.stops, added], added);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Move an anchor. It may pass its neighbours: the anchors are kept in order,
|
|
40
|
+
* and the returned index follows the one that moved.
|
|
41
|
+
* @param stops - The anchors, from the low end.
|
|
42
|
+
* @param index - Which of them moves.
|
|
43
|
+
* @param position - Where to, clamped to the scale.
|
|
44
|
+
* @returns The anchors in their new order, and where the moved one landed.
|
|
45
|
+
*/
|
|
46
|
+
export function moveColorStop(
|
|
47
|
+
stops: readonly ColorStop[],
|
|
48
|
+
index: number,
|
|
49
|
+
position: number,
|
|
50
|
+
): EditedStops {
|
|
51
|
+
const stop = stops[index];
|
|
52
|
+
if (stop === undefined || !Number.isFinite(position)) {
|
|
53
|
+
return { stops: [...stops], index };
|
|
54
|
+
}
|
|
55
|
+
const moved: ColorStop = { ...stop, position: roundPosition(position) };
|
|
56
|
+
return sortAround(
|
|
57
|
+
stops.map((other, at) => (at === index ? moved : other)),
|
|
58
|
+
moved,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Remove an anchor, unless the scale would be left with fewer than two.
|
|
64
|
+
* @param stops - The anchors, from the low end.
|
|
65
|
+
* @param index - Which of them to remove.
|
|
66
|
+
* @returns The remaining anchors, or the same ones when none may go.
|
|
67
|
+
*/
|
|
68
|
+
export function removeColorStop(
|
|
69
|
+
stops: readonly ColorStop[],
|
|
70
|
+
index: number,
|
|
71
|
+
): ColorStop[] {
|
|
72
|
+
if (stops.length <= MINIMUM_CUSTOM_STOPS) return [...stops];
|
|
73
|
+
return stops.filter((_, at) => at !== index);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Recolour an anchor.
|
|
78
|
+
* @param stops - The anchors, from the low end.
|
|
79
|
+
* @param index - Which of them to recolour.
|
|
80
|
+
* @param color - Its new colour.
|
|
81
|
+
* @returns The anchors, with that one recoloured.
|
|
82
|
+
*/
|
|
83
|
+
export function recolorColorStop(
|
|
84
|
+
stops: readonly ColorStop[],
|
|
85
|
+
index: number,
|
|
86
|
+
color: string,
|
|
87
|
+
): ColorStop[] {
|
|
88
|
+
return stops.map((stop, at) => (at === index ? { ...stop, color } : stop));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function roundPosition(position: number): number {
|
|
92
|
+
return Math.round(clamp(position, 0, 1) * POSITION_FACTOR) / POSITION_FACTOR;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function sortAround(stops: ColorStop[], edited: ColorStop): EditedStops {
|
|
96
|
+
const sorted = stops.toSorted((one, other) => one.position - other.position);
|
|
97
|
+
return { stops: sorted, index: sorted.indexOf(edited) };
|
|
98
|
+
}
|