react-cheminfo 0.76.0 → 0.77.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +141 -31
- package/lib/card/core/cardAddress.d.ts +19 -2
- package/lib/card/core/cardAddress.d.ts.map +1 -1
- package/lib/card/core/cardAddress.js +35 -2
- package/lib/card/core/cardAddress.js.map +1 -1
- package/lib/card/core/cardPageUrl.d.ts +7 -1
- package/lib/card/core/cardPageUrl.d.ts.map +1 -1
- package/lib/card/core/cardPageUrl.js +4 -2
- package/lib/card/core/cardPageUrl.js.map +1 -1
- package/lib/card/core/index.d.ts +1 -1
- package/lib/card/core/index.d.ts.map +1 -1
- package/lib/card/core/index.js +1 -1
- package/lib/card/core/index.js.map +1 -1
- package/lib/credits/core/credits.d.ts +30 -0
- package/lib/credits/core/credits.d.ts.map +1 -1
- package/lib/credits/core/credits.js +35 -0
- package/lib/credits/core/credits.js.map +1 -1
- package/lib/download/core/downloadFigure.d.ts +12 -1
- package/lib/download/core/downloadFigure.d.ts.map +1 -1
- package/lib/download/core/downloadFigure.js +21 -0
- package/lib/download/core/downloadFigure.js.map +1 -1
- package/lib/download/core/figureDpi.d.ts +59 -0
- package/lib/download/core/figureDpi.d.ts.map +1 -0
- package/lib/download/core/figureDpi.js +75 -0
- package/lib/download/core/figureDpi.js.map +1 -0
- package/lib/download/core/figurePng.d.ts +4 -1
- package/lib/download/core/figurePng.d.ts.map +1 -1
- package/lib/download/core/figurePng.js +11 -2
- package/lib/download/core/figurePng.js.map +1 -1
- package/lib/download/core/index.d.ts +4 -1
- package/lib/download/core/index.d.ts.map +1 -1
- package/lib/download/core/index.js +3 -1
- package/lib/download/core/index.js.map +1 -1
- package/lib/download/core/pngDpi.d.ts +22 -0
- package/lib/download/core/pngDpi.d.ts.map +1 -0
- package/lib/download/core/pngDpi.js +79 -0
- package/lib/download/core/pngDpi.js.map +1 -0
- package/lib/download/ui/FigureDownloadPanel.d.ts +13 -0
- package/lib/download/ui/FigureDownloadPanel.d.ts.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.js +18 -34
- package/lib/download/ui/FigureDownloadPanel.js.map +1 -1
- package/lib/download/ui/figureDownloadHint.d.ts +5 -0
- package/lib/download/ui/figureDownloadHint.d.ts.map +1 -1
- package/lib/download/ui/figureDownloadHint.js +8 -0
- package/lib/download/ui/figureDownloadHint.js.map +1 -1
- package/lib/download/ui/figureDownloadOptions.d.ts +84 -0
- package/lib/download/ui/figureDownloadOptions.d.ts.map +1 -0
- package/lib/download/ui/figureDownloadOptions.js +2 -0
- package/lib/download/ui/figureDownloadOptions.js.map +1 -0
- package/lib/download/ui/resolutionChoices.d.ts +27 -0
- package/lib/download/ui/resolutionChoices.d.ts.map +1 -0
- package/lib/download/ui/resolutionChoices.js +48 -0
- package/lib/download/ui/resolutionChoices.js.map +1 -0
- package/lib/download/ui/useFigureActions.d.ts +4 -1
- package/lib/download/ui/useFigureActions.d.ts.map +1 -1
- package/lib/download/ui/useFigureActions.js +17 -8
- package/lib/download/ui/useFigureActions.js.map +1 -1
- package/lib/download/ui/useFigureDownload.d.ts +2 -55
- package/lib/download/ui/useFigureDownload.d.ts.map +1 -1
- package/lib/download/ui/useFigureDownload.js +45 -13
- package/lib/download/ui/useFigureDownload.js.map +1 -1
- package/lib/ecosystem/core/sites.d.ts.map +1 -1
- package/lib/ecosystem/core/sites.js +14 -0
- package/lib/ecosystem/core/sites.js.map +1 -1
- package/lib/ecosystem/core/types.d.ts +1 -1
- package/lib/ecosystem/core/types.d.ts.map +1 -1
- package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
- package/lib/ecosystem/ui/glyphs.js +3 -0
- package/lib/ecosystem/ui/glyphs.js.map +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/locales/de.json +30 -1
- package/lib/locales/en.json +30 -1
- package/lib/locales/es.json +30 -1
- package/lib/locales/fr.json +30 -1
- package/lib/locales/it.json +30 -1
- package/lib/molecule3d/ui/Molecule3DStage.d.ts +4 -33
- package/lib/molecule3d/ui/Molecule3DStage.d.ts.map +1 -1
- package/lib/molecule3d/ui/Molecule3DStage.js +3 -37
- package/lib/molecule3d/ui/Molecule3DStage.js.map +1 -1
- package/lib/osiris/core/barGeometry.d.ts +42 -0
- package/lib/osiris/core/barGeometry.d.ts.map +1 -0
- package/lib/osiris/core/barGeometry.js +46 -0
- package/lib/osiris/core/barGeometry.js.map +1 -0
- package/lib/osiris/core/computeProperties.d.ts +42 -0
- package/lib/osiris/core/computeProperties.d.ts.map +1 -0
- package/lib/osiris/core/computeProperties.js +115 -0
- package/lib/osiris/core/computeProperties.js.map +1 -0
- package/lib/osiris/core/constants.d.ts +70 -0
- package/lib/osiris/core/constants.d.ts.map +1 -0
- package/lib/osiris/core/constants.js +99 -0
- package/lib/osiris/core/constants.js.map +1 -0
- package/lib/osiris/core/fitness.d.ts +32 -0
- package/lib/osiris/core/fitness.d.ts.map +1 -0
- package/lib/osiris/core/fitness.js +48 -0
- package/lib/osiris/core/fitness.js.map +1 -0
- package/lib/osiris/core/index.d.ts +29 -0
- package/lib/osiris/core/index.d.ts.map +1 -0
- package/lib/osiris/core/index.js +19 -0
- package/lib/osiris/core/index.js.map +1 -0
- package/lib/osiris/core/poolSize.d.ts +17 -0
- package/lib/osiris/core/poolSize.d.ts.map +1 -0
- package/lib/osiris/core/poolSize.js +22 -0
- package/lib/osiris/core/poolSize.js.map +1 -0
- package/lib/osiris/core/poolTypes.d.ts +140 -0
- package/lib/osiris/core/poolTypes.d.ts.map +1 -0
- package/lib/osiris/core/poolTypes.js +12 -0
- package/lib/osiris/core/poolTypes.js.map +1 -0
- package/lib/osiris/core/predictIdCode.d.ts +39 -0
- package/lib/osiris/core/predictIdCode.d.ts.map +1 -0
- package/lib/osiris/core/predictIdCode.js +54 -0
- package/lib/osiris/core/predictIdCode.js.map +1 -0
- package/lib/osiris/core/predictProtocol.d.ts +67 -0
- package/lib/osiris/core/predictProtocol.d.ts.map +1 -0
- package/lib/osiris/core/predictProtocol.js +29 -0
- package/lib/osiris/core/predictProtocol.js.map +1 -0
- package/lib/osiris/core/predictionPool.d.ts +23 -0
- package/lib/osiris/core/predictionPool.d.ts.map +1 -0
- package/lib/osiris/core/predictionPool.js +186 -0
- package/lib/osiris/core/predictionPool.js.map +1 -0
- package/lib/osiris/core/predictionQueue.d.ts +46 -0
- package/lib/osiris/core/predictionQueue.d.ts.map +1 -0
- package/lib/osiris/core/predictionQueue.js +57 -0
- package/lib/osiris/core/predictionQueue.js.map +1 -0
- package/lib/osiris/core/predictors.d.ts +62 -0
- package/lib/osiris/core/predictors.d.ts.map +1 -0
- package/lib/osiris/core/predictors.js +100 -0
- package/lib/osiris/core/predictors.js.map +1 -0
- package/lib/osiris/core/propertyKeys.d.ts +32 -0
- package/lib/osiris/core/propertyKeys.d.ts.map +1 -0
- package/lib/osiris/core/propertyKeys.js +44 -0
- package/lib/osiris/core/propertyKeys.js.map +1 -0
- package/lib/osiris/core/riskAppearance.d.ts +60 -0
- package/lib/osiris/core/riskAppearance.d.ts.map +1 -0
- package/lib/osiris/core/riskAppearance.js +59 -0
- package/lib/osiris/core/riskAppearance.js.map +1 -0
- package/lib/osiris/core/riskDetail.d.ts +22 -0
- package/lib/osiris/core/riskDetail.d.ts.map +1 -0
- package/lib/osiris/core/riskDetail.js +86 -0
- package/lib/osiris/core/riskDetail.js.map +1 -0
- package/lib/osiris/core/riskDetailRequest.d.ts +31 -0
- package/lib/osiris/core/riskDetailRequest.d.ts.map +1 -0
- package/lib/osiris/core/riskDetailRequest.js +49 -0
- package/lib/osiris/core/riskDetailRequest.js.map +1 -0
- package/lib/osiris/core/riskFindings.d.ts +26 -0
- package/lib/osiris/core/riskFindings.d.ts.map +1 -0
- package/lib/osiris/core/riskFindings.js +79 -0
- package/lib/osiris/core/riskFindings.js.map +1 -0
- package/lib/osiris/core/runPredictionJob.d.ts +20 -0
- package/lib/osiris/core/runPredictionJob.d.ts.map +1 -0
- package/lib/osiris/core/runPredictionJob.js +43 -0
- package/lib/osiris/core/runPredictionJob.js.map +1 -0
- package/lib/osiris/core/scales.d.ts +70 -0
- package/lib/osiris/core/scales.d.ts.map +1 -0
- package/lib/osiris/core/scales.js +185 -0
- package/lib/osiris/core/scales.js.map +1 -0
- package/lib/osiris/core/types.d.ts +91 -0
- package/lib/osiris/core/types.d.ts.map +1 -0
- package/lib/osiris/core/types.js +19 -0
- package/lib/osiris/core/types.js.map +1 -0
- package/lib/osiris/core/valuation.d.ts +28 -0
- package/lib/osiris/core/valuation.d.ts.map +1 -0
- package/lib/osiris/core/valuation.js +39 -0
- package/lib/osiris/core/valuation.js.map +1 -0
- package/lib/osiris/ui/PropertyBar.d.ts +27 -0
- package/lib/osiris/ui/PropertyBar.d.ts.map +1 -0
- package/lib/osiris/ui/PropertyBar.js +27 -0
- package/lib/osiris/ui/PropertyBar.js.map +1 -0
- package/lib/osiris/ui/PropertyPanel.d.ts +91 -0
- package/lib/osiris/ui/PropertyPanel.d.ts.map +1 -0
- package/lib/osiris/ui/PropertyPanel.js +77 -0
- package/lib/osiris/ui/PropertyPanel.js.map +1 -0
- package/lib/osiris/ui/PropertyRows.d.ts +40 -0
- package/lib/osiris/ui/PropertyRows.d.ts.map +1 -0
- package/lib/osiris/ui/PropertyRows.js +23 -0
- package/lib/osiris/ui/PropertyRows.js.map +1 -0
- package/lib/osiris/ui/RiskFindings.d.ts +43 -0
- package/lib/osiris/ui/RiskFindings.d.ts.map +1 -0
- package/lib/osiris/ui/RiskFindings.js +51 -0
- package/lib/osiris/ui/RiskFindings.js.map +1 -0
- package/lib/osiris/ui/RiskPanel.d.ts +46 -0
- package/lib/osiris/ui/RiskPanel.d.ts.map +1 -0
- package/lib/osiris/ui/RiskPanel.js +32 -0
- package/lib/osiris/ui/RiskPanel.js.map +1 -0
- package/lib/osiris/ui/RiskSquare.d.ts +51 -0
- package/lib/osiris/ui/RiskSquare.d.ts.map +1 -0
- package/lib/osiris/ui/RiskSquare.js +23 -0
- package/lib/osiris/ui/RiskSquare.js.map +1 -0
- package/lib/osiris/ui/index.d.ts +15 -0
- package/lib/osiris/ui/index.d.ts.map +1 -0
- package/lib/osiris/ui/index.js +8 -0
- package/lib/osiris/ui/index.js.map +1 -0
- package/lib/osiris/ui/usePredictions.d.ts +81 -0
- package/lib/osiris/ui/usePredictions.d.ts.map +1 -0
- package/lib/osiris/ui/usePredictions.js +102 -0
- package/lib/osiris/ui/usePredictions.js.map +1 -0
- package/lib/osiris-ui.d.ts +11 -0
- package/lib/osiris-ui.d.ts.map +1 -0
- package/lib/osiris-ui.js +11 -0
- package/lib/osiris-ui.js.map +1 -0
- package/lib/osiris.d.ts +17 -0
- package/lib/osiris.d.ts.map +1 -0
- package/lib/osiris.js +17 -0
- package/lib/osiris.js.map +1 -0
- package/lib/panel/ui/FilterInput.d.ts.map +1 -1
- package/lib/panel/ui/FilterInput.js +3 -1
- package/lib/panel/ui/FilterInput.js.map +1 -1
- package/lib/panel/ui/SidePanelItem.d.ts +39 -0
- package/lib/panel/ui/SidePanelItem.d.ts.map +1 -0
- package/lib/panel/ui/SidePanelItem.js +63 -0
- package/lib/panel/ui/SidePanelItem.js.map +1 -0
- package/lib/panel/ui/SidePanelStack.d.ts +11 -10
- package/lib/panel/ui/SidePanelStack.d.ts.map +1 -1
- package/lib/panel/ui/SidePanelStack.js +22 -15
- package/lib/panel/ui/SidePanelStack.js.map +1 -1
- package/lib/panel/ui/SpectrumColorSwatch.d.ts.map +1 -1
- package/lib/panel/ui/SpectrumColorSwatch.js +4 -2
- package/lib/panel/ui/SpectrumColorSwatch.js.map +1 -1
- package/lib/panel/ui/usePanelFolds.d.ts +35 -0
- package/lib/panel/ui/usePanelFolds.d.ts.map +1 -0
- package/lib/panel/ui/usePanelFolds.js +73 -0
- package/lib/panel/ui/usePanelFolds.js.map +1 -0
- package/lib/shared/ui/FullscreenStage.d.ts +43 -0
- package/lib/shared/ui/FullscreenStage.d.ts.map +1 -0
- package/lib/shared/ui/FullscreenStage.js +38 -0
- package/lib/shared/ui/FullscreenStage.js.map +1 -0
- package/lib/shared/ui/canFillScreen.d.ts +7 -0
- package/lib/shared/ui/canFillScreen.d.ts.map +1 -0
- package/lib/shared/ui/canFillScreen.js +9 -0
- package/lib/shared/ui/canFillScreen.js.map +1 -0
- package/lib/shared/ui/index.d.ts +3 -0
- package/lib/shared/ui/index.d.ts.map +1 -1
- package/lib/shared/ui/index.js +2 -0
- package/lib/shared/ui/index.js.map +1 -1
- package/lib/split/ui/splitPanes.d.ts +3 -3
- package/lib/split/ui/splitPanes.js +1 -1
- package/lib/structure/core/structureNotations.d.ts +8 -1
- package/lib/structure/core/structureNotations.d.ts.map +1 -1
- package/lib/structure/core/structureNotations.js +14 -8
- package/lib/structure/core/structureNotations.js.map +1 -1
- package/lib/structure/ui/StructureExportPanel.d.ts +8 -0
- package/lib/structure/ui/StructureExportPanel.d.ts.map +1 -1
- package/lib/structure/ui/StructureExportPanel.js +9 -4
- package/lib/structure/ui/StructureExportPanel.js.map +1 -1
- package/lib/structure/ui/index.d.ts +1 -0
- package/lib/structure/ui/index.d.ts.map +1 -1
- package/lib/structure/ui/index.js.map +1 -1
- package/package.json +4 -1
- package/src/card/core/cardAddress.ts +39 -3
- package/src/card/core/cardPageUrl.ts +10 -3
- package/src/card/core/index.ts +7 -1
- package/src/credits/core/credits.ts +40 -0
- package/src/download/core/downloadFigure.ts +26 -1
- package/src/download/core/figureDpi.ts +94 -0
- package/src/download/core/figurePng.ts +11 -2
- package/src/download/core/index.ts +13 -1
- package/src/download/core/pngDpi.ts +84 -0
- package/src/download/ui/FigureDownloadPanel.tsx +41 -51
- package/src/download/ui/figureDownloadHint.ts +13 -0
- package/src/download/ui/figureDownloadOptions.ts +85 -0
- package/src/download/ui/resolutionChoices.ts +67 -0
- package/src/download/ui/useFigureActions.ts +24 -9
- package/src/download/ui/useFigureDownload.tsx +57 -71
- package/src/ecosystem/core/sites.ts +14 -0
- package/src/ecosystem/core/types.ts +2 -1
- package/src/ecosystem/ui/glyphs.tsx +20 -0
- package/src/locales/de.json +30 -1
- package/src/locales/en.json +30 -1
- package/src/locales/es.json +30 -1
- package/src/locales/fr.json +30 -1
- package/src/locales/it.json +30 -1
- package/src/molecule3d/ui/Molecule3DStage.tsx +4 -88
- package/src/osiris/core/barGeometry.ts +74 -0
- package/src/osiris/core/computeProperties.ts +175 -0
- package/src/osiris/core/constants.ts +110 -0
- package/src/osiris/core/fitness.ts +59 -0
- package/src/osiris/core/index.ts +78 -0
- package/src/osiris/core/poolSize.ts +24 -0
- package/src/osiris/core/poolTypes.ts +140 -0
- package/src/osiris/core/predictIdCode.ts +69 -0
- package/src/osiris/core/predictProtocol.ts +78 -0
- package/src/osiris/core/predictionPool.ts +237 -0
- package/src/osiris/core/predictionQueue.ts +89 -0
- package/src/osiris/core/predictors.ts +142 -0
- package/src/osiris/core/propertyKeys.ts +54 -0
- package/src/osiris/core/riskAppearance.ts +86 -0
- package/src/osiris/core/riskDetail.ts +120 -0
- package/src/osiris/core/riskDetailRequest.ts +64 -0
- package/src/osiris/core/riskFindings.ts +92 -0
- package/src/osiris/core/runPredictionJob.ts +49 -0
- package/src/osiris/core/scales.ts +236 -0
- package/src/osiris/core/types.ts +103 -0
- package/src/osiris/core/valuation.ts +44 -0
- package/src/osiris/ui/PropertyBar.tsx +77 -0
- package/src/osiris/ui/PropertyPanel.tsx +227 -0
- package/src/osiris/ui/PropertyRows.tsx +92 -0
- package/src/osiris/ui/RiskFindings.tsx +137 -0
- package/src/osiris/ui/RiskPanel.tsx +81 -0
- package/src/osiris/ui/RiskSquare.tsx +108 -0
- package/src/osiris/ui/index.ts +17 -0
- package/src/osiris/ui/usePredictions.ts +194 -0
- package/src/osiris-ui.ts +11 -0
- package/src/osiris.ts +17 -0
- package/src/panel/ui/FilterInput.tsx +4 -1
- package/src/panel/ui/SidePanelItem.tsx +162 -0
- package/src/panel/ui/SidePanelStack.tsx +29 -36
- package/src/panel/ui/SpectrumColorSwatch.tsx +5 -3
- package/src/panel/ui/usePanelFolds.ts +103 -0
- package/src/shared/ui/FullscreenStage.tsx +96 -0
- package/src/shared/ui/canFillScreen.ts +8 -0
- package/src/shared/ui/index.ts +6 -0
- package/src/split/ui/splitPanes.tsx +4 -4
- package/src/structure/core/structureNotations.ts +25 -8
- package/src/structure/ui/StructureExportPanel.tsx +23 -4
- package/src/structure/ui/index.ts +4 -0
- package/styles/osiris.css +339 -0
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { useCallback, useState } from 'react';
|
|
2
|
+
import { useCallback, useRef, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import { useChromeT } from '../../i18n/ui/useT.ts';
|
|
5
5
|
import type { FigureFormat } from '../core/downloadFigure.ts';
|
|
6
|
+
import {
|
|
7
|
+
DEFAULT_FIGURE_DPI,
|
|
8
|
+
FIGURE_DPIS,
|
|
9
|
+
dpiScale,
|
|
10
|
+
} from '../core/figureDpi.ts';
|
|
6
11
|
import type { FigureLayout } from '../core/figureLayout.ts';
|
|
7
12
|
import { figureLayoutRedraws, figureLayoutSize } from '../core/figureLayout.ts';
|
|
8
13
|
import type { FigurePixels } from '../core/figureScale.ts';
|
|
@@ -14,64 +19,11 @@ import {
|
|
|
14
19
|
import { figureSize } from '../core/figureTarget.ts';
|
|
15
20
|
|
|
16
21
|
import { FigureDownloadPanel } from './FigureDownloadPanel.tsx';
|
|
22
|
+
import type { FigureDownloadOptions } from './figureDownloadOptions.ts';
|
|
17
23
|
import { useFigureActions } from './useFigureActions.ts';
|
|
18
|
-
import type { FigureRenderer } from './useFigureRedraw.tsx';
|
|
19
24
|
import { useFigureRedraw } from './useFigureRedraw.tsx';
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
export interface FigureDownloadOptions {
|
|
23
|
-
/**
|
|
24
|
-
* The `id` of the box the figure is mounted in. Everything drawn inside it
|
|
25
|
-
* is saved — sixteen charts of a pair grid as readily as one scatter plot —
|
|
26
|
-
* and the controls floating over it are left behind.
|
|
27
|
-
*/
|
|
28
|
-
targetId: string;
|
|
29
|
-
/**
|
|
30
|
-
* What the saved file is called, without its extension. Name it after the
|
|
31
|
-
* data rather than after the tool: a reader with four of these in a
|
|
32
|
-
* downloads folder cannot tell four `figure.png` apart.
|
|
33
|
-
* @default 'figure'
|
|
34
|
-
*/
|
|
35
|
-
fileName?: string;
|
|
36
|
-
/**
|
|
37
|
-
* The format it opens on.
|
|
38
|
-
* @default 'png'
|
|
39
|
-
*/
|
|
40
|
-
defaultFormat?: FigureFormat;
|
|
41
|
-
/**
|
|
42
|
-
* The resolution a PNG opens on, as a multiple of the figure on screen. An
|
|
43
|
-
* SVG opens at 1×, the size it has on screen, and each format keeps the
|
|
44
|
-
* multiple the reader last picked for it.
|
|
45
|
-
* @default 2
|
|
46
|
-
*/
|
|
47
|
-
defaultScale?: number;
|
|
48
|
-
/**
|
|
49
|
-
* The resolutions offered.
|
|
50
|
-
* @default [1, 2, 3, 4]
|
|
51
|
-
*/
|
|
52
|
-
scales?: readonly number[];
|
|
53
|
-
/**
|
|
54
|
-
* What is painted under the figure. `transparent` leaves it unpainted, for a
|
|
55
|
-
* figure going onto a coloured slide.
|
|
56
|
-
* @default the surface the figure is drawn on
|
|
57
|
-
*/
|
|
58
|
-
background?: string;
|
|
59
|
-
/**
|
|
60
|
-
* What the panel is called.
|
|
61
|
-
* @default the chrome's own line, in the language of the page
|
|
62
|
-
*/
|
|
63
|
-
title?: string;
|
|
64
|
-
/**
|
|
65
|
-
* Draws the figure at a size, for a file. When it is given the panel offers
|
|
66
|
-
* a size — as shown, 4:3, 16:9, a journal column, or typed — and a figure
|
|
67
|
-
* saved at a size other than its own is drawn again at that size, off the
|
|
68
|
-
* page, so its axes and labels are laid out for the new shape rather than
|
|
69
|
-
* stretched into it. Draw exactly what is on screen, with the same data,
|
|
70
|
-
* zoom and colours; only the box changes.
|
|
71
|
-
* @default undefined — the figure is saved at the size it has on screen
|
|
72
|
-
*/
|
|
73
|
-
renderFigure?: FigureRenderer;
|
|
74
|
-
}
|
|
26
|
+
export type { FigureDownloadOptions } from './figureDownloadOptions.ts';
|
|
75
27
|
|
|
76
28
|
/** What {@link useFigureDownload} hands back. */
|
|
77
29
|
export interface FigureDownloadState {
|
|
@@ -93,6 +45,9 @@ export interface FigureDownloadState {
|
|
|
93
45
|
portal: ReactNode;
|
|
94
46
|
}
|
|
95
47
|
|
|
48
|
+
/** The dots per inch offered, as the multiples the figure is painted at. */
|
|
49
|
+
const DPI_SCALES = FIGURE_DPIS.map(dpiScale);
|
|
50
|
+
|
|
96
51
|
/**
|
|
97
52
|
* The "Save figure" panel — save as PNG or SVG, or copy as PNG — for a caller
|
|
98
53
|
* that brings its own trigger, such as a button in an editor's toolbar.
|
|
@@ -103,10 +58,18 @@ export interface FigureDownloadState {
|
|
|
103
58
|
export function useFigureDownload(
|
|
104
59
|
options: FigureDownloadOptions,
|
|
105
60
|
): FigureDownloadState {
|
|
106
|
-
const { targetId, fileName, background
|
|
107
|
-
const {
|
|
108
|
-
|
|
109
|
-
const
|
|
61
|
+
const { targetId, writeFigure, fileName, background } = options;
|
|
62
|
+
const { unit = 'multiple', defaultFormat = 'png' } = options;
|
|
63
|
+
const { title, renderFigure, onScaleChange } = options;
|
|
64
|
+
const dpi = unit === 'dpi';
|
|
65
|
+
const scales = options.scales ?? (dpi ? DPI_SCALES : FIGURE_SCALES);
|
|
66
|
+
const defaultScale =
|
|
67
|
+
options.defaultScale ??
|
|
68
|
+
(dpi ? dpiScale(DEFAULT_FIGURE_DPI) : DEFAULT_FIGURE_SCALE);
|
|
69
|
+
// A figure with a printed size, or one its page wrote, keeps the size its
|
|
70
|
+
// SVG states: the resolution is then the PNG's alone.
|
|
71
|
+
const svgAtOwnSize = dpi || writeFigure !== undefined;
|
|
72
|
+
const redraws = renderFigure !== undefined && writeFigure === undefined;
|
|
110
73
|
|
|
111
74
|
const t = useChromeT();
|
|
112
75
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -115,19 +78,23 @@ export function useFigureDownload(
|
|
|
115
78
|
png: defaultScale,
|
|
116
79
|
svg: defaultFigureScale('svg'),
|
|
117
80
|
}));
|
|
118
|
-
const scale = picked[format];
|
|
81
|
+
const scale = format === 'svg' && svgAtOwnSize ? 1 : picked[format];
|
|
119
82
|
const [size, setSize] = useState<FigurePixels | null>(null);
|
|
83
|
+
const opening = useRef(0);
|
|
120
84
|
const [layout, setLayout] = useState<FigureLayout>('screen');
|
|
121
85
|
const [custom, setCustom] = useState<FigurePixels | null>(null);
|
|
122
|
-
const { redraw, portal } = useFigureRedraw(
|
|
86
|
+
const { redraw, portal } = useFigureRedraw(
|
|
87
|
+
redraws ? renderFigure : undefined,
|
|
88
|
+
);
|
|
123
89
|
const redrawAt =
|
|
124
|
-
|
|
90
|
+
redraws &&
|
|
125
91
|
size !== null &&
|
|
126
92
|
figureLayoutRedraws(layout, size, custom ?? size)
|
|
127
93
|
? figureLayoutSize(layout, size, custom ?? size)
|
|
128
94
|
: null;
|
|
129
95
|
const { save, copy, busy, failure, notice, clear } = useFigureActions({
|
|
130
96
|
targetId,
|
|
97
|
+
writeFigure,
|
|
131
98
|
format,
|
|
132
99
|
scale,
|
|
133
100
|
fileName,
|
|
@@ -144,10 +111,26 @@ export function useFigureDownload(
|
|
|
144
111
|
(next: boolean) => {
|
|
145
112
|
setIsOpen(next);
|
|
146
113
|
if (!next) return;
|
|
147
|
-
setSize(figureSize(targetId));
|
|
148
114
|
clear();
|
|
115
|
+
if (writeFigure === undefined) {
|
|
116
|
+
setSize(targetId === undefined ? null : figureSize(targetId));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
// A written figure is measured once it is written; only the last
|
|
120
|
+
// opening is answered.
|
|
121
|
+
opening.current += 1;
|
|
122
|
+
const ticket = opening.current;
|
|
123
|
+
writeFigure().then(
|
|
124
|
+
(figure) => {
|
|
125
|
+
if (ticket !== opening.current) return;
|
|
126
|
+
setSize({ width: figure.width, height: figure.height });
|
|
127
|
+
},
|
|
128
|
+
() => {
|
|
129
|
+
if (ticket === opening.current) setSize(null);
|
|
130
|
+
},
|
|
131
|
+
);
|
|
149
132
|
},
|
|
150
|
-
[targetId, clear],
|
|
133
|
+
[targetId, writeFigure, clear],
|
|
151
134
|
);
|
|
152
135
|
|
|
153
136
|
// What the last copy came to only describes the choices it was made with.
|
|
@@ -164,25 +147,28 @@ export function useFigureDownload(
|
|
|
164
147
|
format={format}
|
|
165
148
|
scale={scale}
|
|
166
149
|
scales={scales}
|
|
150
|
+
unit={unit}
|
|
151
|
+
svgAtOwnSize={svgAtOwnSize}
|
|
167
152
|
size={size}
|
|
168
153
|
failure={failure}
|
|
169
154
|
notice={notice}
|
|
170
155
|
saving={busy}
|
|
171
156
|
onFormatChange={changed(setFormat)}
|
|
172
|
-
onScaleChange={changed((next: number) =>
|
|
173
|
-
setPicked((current) => ({ ...current, [format]: next }))
|
|
174
|
-
|
|
157
|
+
onScaleChange={changed((next: number) => {
|
|
158
|
+
setPicked((current) => ({ ...current, [format]: next }));
|
|
159
|
+
if (format === 'png') onScaleChange?.(next);
|
|
160
|
+
})}
|
|
175
161
|
onSave={save}
|
|
176
162
|
onCopy={copy}
|
|
177
163
|
sizing={
|
|
178
|
-
|
|
179
|
-
?
|
|
180
|
-
: {
|
|
164
|
+
redraws
|
|
165
|
+
? {
|
|
181
166
|
layout,
|
|
182
167
|
custom,
|
|
183
168
|
onLayoutChange: changed(setLayout),
|
|
184
169
|
onCustomChange: changed(setCustom),
|
|
185
170
|
}
|
|
171
|
+
: undefined
|
|
186
172
|
}
|
|
187
173
|
/>
|
|
188
174
|
);
|
|
@@ -350,6 +350,20 @@ export const ECOSYSTEM_SITES: readonly EcosystemSite[] = [
|
|
|
350
350
|
brandAlt: '#a16207',
|
|
351
351
|
mark: { plate: '#0072b2', accent: '#e69f00' },
|
|
352
352
|
},
|
|
353
|
+
{
|
|
354
|
+
id: 'draw',
|
|
355
|
+
name: { lead: 'draw', alt: 'cheminfo', dot: true },
|
|
356
|
+
host: 'draw.cheminfo.org',
|
|
357
|
+
tagline: 'Journal-grade structures, in an SVG that keeps the chemistry.',
|
|
358
|
+
group: 'computing',
|
|
359
|
+
// The ink a structure is printed in.
|
|
360
|
+
brand: '#1f2a44',
|
|
361
|
+
// The red curly arrows are taught in, at 5.9:1 on white.
|
|
362
|
+
brandAlt: '#c0261d',
|
|
363
|
+
// Ink and red on paper: a red nib on the navy stays under 4:1, where on
|
|
364
|
+
// white it reads at 5.9:1.
|
|
365
|
+
mark: { plate: '#ffffff', accent: '#c0261d', edge: '#dfe3e8' },
|
|
366
|
+
},
|
|
353
367
|
];
|
|
354
368
|
|
|
355
369
|
/** How a link to a site is written, beyond the site itself. */
|
|
@@ -602,4 +602,24 @@ export const GLYPHS: Record<SiteId, (alt: string) => ReactNode> = {
|
|
|
602
602
|
/>
|
|
603
603
|
</>
|
|
604
604
|
),
|
|
605
|
+
// A ring in ink, with a pen nib drawing its last bond in the answering
|
|
606
|
+
// colour: a structure being drawn by hand.
|
|
607
|
+
draw: (alt) => (
|
|
608
|
+
<>
|
|
609
|
+
<path
|
|
610
|
+
d="M19 15.25 19 22.75 12.5 26.5 6 22.75 6 15.25 12.5 11.5 15.3 13.1"
|
|
611
|
+
fill="none"
|
|
612
|
+
stroke="#1f2a44"
|
|
613
|
+
strokeWidth="2.4"
|
|
614
|
+
strokeLinecap="round"
|
|
615
|
+
strokeLinejoin="round"
|
|
616
|
+
/>
|
|
617
|
+
<path
|
|
618
|
+
d="M15.6 13 22.32 11.94 26.35 6.78 21.82 2.25 16.66 6.28Z"
|
|
619
|
+
fill={alt}
|
|
620
|
+
/>
|
|
621
|
+
<path d="M16.59 12.01 20.13 8.47" stroke="#ffffff" strokeWidth="1.1" />
|
|
622
|
+
<circle cx="20.55" cy="8.05" r="1.25" fill="#ffffff" />
|
|
623
|
+
</>
|
|
624
|
+
),
|
|
605
625
|
};
|
package/src/locales/de.json
CHANGED
|
@@ -114,6 +114,14 @@
|
|
|
114
114
|
"site.atoms.tagline": "Elektronen, Neutronen, Lewis-Formeln und Oxidationszahlen.",
|
|
115
115
|
"site.moles.tagline": "Eine Reaktion ausgleichen und ihre Massenzusammensetzung berechnen.",
|
|
116
116
|
"site.inorganic.tagline": "Eine anorganische Verbindung benennen und ihre Formel schreiben.",
|
|
117
|
+
"site.iupac-name.tagline": "Der IUPAC-Name einer Struktur, und die Struktur, die ein Name bezeichnet.",
|
|
118
|
+
"site.slides.tagline": "Ein laufendes Werkzeug auf eine Folie setzen, mit dem Link seiner Schaltfläche Teilen.",
|
|
119
|
+
"site.vibrations.tagline": "IR- und Raman-Spektren, im Browser berechnet.",
|
|
120
|
+
"site.draw.tagline": "Strukturen in Publikationsqualität, als SVG, das die Chemie behält.",
|
|
121
|
+
"site.molecules.tagline": "Ein Molekül nachschlagen, mit seinen berechneten Eigenschaften und Quellen.",
|
|
122
|
+
"site.chembio.tagline": "Naturstoffe, und die Organismen, in denen sie gefunden wurden.",
|
|
123
|
+
"site.wikidata.tagline": "Die Chemie der Wikipedia-Infoboxen, nach Struktur durchsuchbar.",
|
|
124
|
+
"site.mz.tagline": "Massenspektren, danach geordnet, wie sie gemessen wurden.",
|
|
117
125
|
"share.button": "Teilen",
|
|
118
126
|
"share.buttonTitle": "Einen Link zu dieser Seite teilen oder sie in Ihre eigene Website einbetten",
|
|
119
127
|
"share.dialogTitleFor": "{title} teilen oder einbetten",
|
|
@@ -282,10 +290,14 @@
|
|
|
282
290
|
"download.resolution": "Auflösung",
|
|
283
291
|
"download.resolutionHelp": "Wie viele Male größer als die Abbildung auf dem Bildschirm die Datei ist. Ein PNG bekommt entsprechend mehr Pixel: zwei passt für eine Folie, drei oder vier für den Druck. Ein SVG bleibt in jeder Größe scharf und öffnet sich entsprechend größer.",
|
|
284
292
|
"download.resolutionExample": "Eine auf dem Bildschirm 640 Pixel breite Abbildung wird 1280 Pixel breit gespeichert.",
|
|
293
|
+
"download.resolutionDpiHelp": "Punkte pro Zoll, wenn die Abbildung in ihrer Größe auf der Seite gedruckt wird. 150 genügt für eine Folie, 300 für die Fotos einer Zeitschrift, 600 bis 1200 für Strichzeichnungen. Das PNG gibt sie an, sodass ein Dokument es in dieser Größe platziert.",
|
|
294
|
+
"download.resolutionDpiExample": "Eine 8,5 cm breite Abbildung wird 1004 Pixel breit gespeichert.",
|
|
285
295
|
"download.noFigure": "Auf der Seite gibt es noch keine Abbildung zum Speichern.",
|
|
286
296
|
"download.hintRasterSvg": "Ein SVG, das ein Bild von {pixels} enthält: eine 3D-Szene hat keine Vektorform.",
|
|
287
297
|
"download.hintSvg": "Öffnet sich mit {pixels} und bleibt in jeder Größe scharf.",
|
|
288
298
|
"download.hintPng": "Gespeichert {pixels}.",
|
|
299
|
+
"download.hintSvgDpi": "Wird {width} × {height} cm groß gedruckt und bleibt in jeder Größe scharf.",
|
|
300
|
+
"download.hintPngDpi": "Gespeichert {pixels}, gedruckt {width} × {height} cm.",
|
|
289
301
|
"download.hintCopied": "In die Zwischenablage kopiert: PNG mit {pixels}.",
|
|
290
302
|
"download.copyUnsupported": "Dieser Browser kann kein Bild in die Zwischenablage legen. Speichern Sie es stattdessen.",
|
|
291
303
|
"download.size": "Größe",
|
|
@@ -794,5 +806,22 @@
|
|
|
794
806
|
"ir.raman.doc.sampled": "Eine Bande wird an dem abgetasteten Punkt angegeben, an dem sie ihr Maximum hat: Ihre Lage ist nur so genau wie das Raster, auf dem das Spektrum aufgenommen wurde.",
|
|
795
807
|
"ir.raman.aboutLead": "Zeichnet ein Raman-Spektrum, findet seine Banden und listet sie neben dem Diagramm auf.",
|
|
796
808
|
"ir.raman.credit.picking": "**ir-spectrum** (cheminfo, MIT) findet die Banden, mit dem Peakfinder von **common-spectrum** und **ml-gsd**.",
|
|
797
|
-
"ir.raman.credit.jcamp": "**convert-to-jcamp** (cheminfo, MIT) schreibt die heruntergeladene JCAMP-DX-Datei."
|
|
809
|
+
"ir.raman.credit.jcamp": "**convert-to-jcamp** (cheminfo, MIT) schreibt die heruntergeladene JCAMP-DX-Datei.",
|
|
810
|
+
"panel.focus": "Auf das Panel „{panel}“ konzentrieren",
|
|
811
|
+
"panel.focusTooltip": "Auf dieses Panel konzentrieren: alle anderen einklappen",
|
|
812
|
+
"panel.unfocusTooltip": "Die anderen Panels wieder ausklappen",
|
|
813
|
+
"panel.fillScreen": "Panel „{panel}“ im Vollbild zeigen",
|
|
814
|
+
"panel.fillScreenTooltip": "Dieses Panel im Vollbild zeigen",
|
|
815
|
+
"panel.fold": "Panel „{panel}“ einklappen",
|
|
816
|
+
"panel.unfold": "Panel „{panel}“ ausklappen",
|
|
817
|
+
"panel.foldTooltip": "Dieses Panel einklappen",
|
|
818
|
+
"panel.unfoldTooltip": "Ausklappen",
|
|
819
|
+
"panel.close": "Panel „{panel}“ schließen",
|
|
820
|
+
"panel.closeTooltip": "Dieses Panel schließen",
|
|
821
|
+
"panel.leaveFullScreen": "Vollbild verlassen",
|
|
822
|
+
"panel.leaveFullScreenTooltip": "Vollbild verlassen (Esc)",
|
|
823
|
+
"panel.clearFilter": "Filter leeren",
|
|
824
|
+
"panel.colourOf": "Farbe von {name}",
|
|
825
|
+
"panel.drawIn": "{name} in {color} zeichnen",
|
|
826
|
+
"panel.changeColour": "Dieses Spektrum in einer anderen Farbe zeichnen"
|
|
798
827
|
}
|
package/src/locales/en.json
CHANGED
|
@@ -114,6 +114,14 @@
|
|
|
114
114
|
"site.atoms.tagline": "Electrons, neutrons, Lewis structures and oxidation states.",
|
|
115
115
|
"site.moles.tagline": "Balance a reaction, and work out its mass composition.",
|
|
116
116
|
"site.inorganic.tagline": "Name an inorganic compound, and write its formula.",
|
|
117
|
+
"site.iupac-name.tagline": "The IUPAC name of a structure, and the structure a name denotes.",
|
|
118
|
+
"site.slides.tagline": "Put a live tool on a slide, from the link its Share button gives.",
|
|
119
|
+
"site.vibrations.tagline": "IR and Raman spectra computed in the browser.",
|
|
120
|
+
"site.draw.tagline": "Journal-grade structures, in an SVG that keeps the chemistry.",
|
|
121
|
+
"site.molecules.tagline": "Look up a molecule, its computed properties and its sources.",
|
|
122
|
+
"site.chembio.tagline": "Natural products, and the organisms they were found in.",
|
|
123
|
+
"site.wikidata.tagline": "The chemistry of Wikipedia’s infoboxes, searchable by structure.",
|
|
124
|
+
"site.mz.tagline": "Mass spectra, classified by how they were measured.",
|
|
117
125
|
"share.button": "Share",
|
|
118
126
|
"share.buttonTitle": "Share a link to this page, or embed it in your own site",
|
|
119
127
|
"share.dialogTitleFor": "Share or embed — {title}",
|
|
@@ -282,10 +290,14 @@
|
|
|
282
290
|
"download.resolution": "Resolution",
|
|
283
291
|
"download.resolutionHelp": "How many times the figure on screen the file is. A PNG gets that many more pixels: two is right for a slide, three or four for print. An SVG stays sharp at any size, and opens that many times larger.",
|
|
284
292
|
"download.resolutionExample": "A figure 640 pixels wide on screen is saved 1280 pixels wide.",
|
|
293
|
+
"download.resolutionDpiHelp": "Dots per inch, with the figure printed at its size on the page. 150 is enough for a slide, 300 for a journal's photographs, 600 to 1200 for line art. The PNG states it, so a document places it at that size.",
|
|
294
|
+
"download.resolutionDpiExample": "A figure 8.5 cm wide is saved 1004 pixels wide.",
|
|
285
295
|
"download.noFigure": "There is no figure on the page to save yet.",
|
|
286
296
|
"download.hintRasterSvg": "An SVG holding a picture of {pixels}: a 3D scene has no vector form.",
|
|
287
297
|
"download.hintSvg": "Opens at {pixels}, and stays sharp at any size.",
|
|
288
298
|
"download.hintPng": "Saved {pixels}.",
|
|
299
|
+
"download.hintSvgDpi": "Prints {width} × {height} cm, and stays sharp at any size.",
|
|
300
|
+
"download.hintPngDpi": "Saved {pixels}, which print {width} × {height} cm.",
|
|
289
301
|
"download.hintCopied": "Copied {pixels} to the clipboard, as a PNG.",
|
|
290
302
|
"download.copyUnsupported": "This browser cannot put a picture on the clipboard. Save it instead.",
|
|
291
303
|
"download.size": "Size",
|
|
@@ -794,5 +806,22 @@
|
|
|
794
806
|
"ir.raman.doc.sampled": "A band is reported at the sampled point it peaked on, so its position is only as precise as the grid the spectrum was recorded on.",
|
|
795
807
|
"ir.raman.aboutLead": "Draws a Raman spectrum, picks its bands and lists them beside the chart.",
|
|
796
808
|
"ir.raman.credit.picking": "**ir-spectrum** (cheminfo, MIT) picks the bands, with the peak picker of **common-spectrum** and **ml-gsd**.",
|
|
797
|
-
"ir.raman.credit.jcamp": "**convert-to-jcamp** (cheminfo, MIT) writes the JCAMP-DX download."
|
|
809
|
+
"ir.raman.credit.jcamp": "**convert-to-jcamp** (cheminfo, MIT) writes the JCAMP-DX download.",
|
|
810
|
+
"panel.focus": "Focus on the {panel} panel",
|
|
811
|
+
"panel.focusTooltip": "Focus on this panel: fold every other one away",
|
|
812
|
+
"panel.unfocusTooltip": "Unfold the other panels again",
|
|
813
|
+
"panel.fillScreen": "Fill the screen with the {panel} panel",
|
|
814
|
+
"panel.fillScreenTooltip": "Fill the screen with this panel",
|
|
815
|
+
"panel.fold": "Fold the {panel} panel",
|
|
816
|
+
"panel.unfold": "Unfold the {panel} panel",
|
|
817
|
+
"panel.foldTooltip": "Fold this panel away",
|
|
818
|
+
"panel.unfoldTooltip": "Unfold it",
|
|
819
|
+
"panel.close": "Close the {panel} panel",
|
|
820
|
+
"panel.closeTooltip": "Close this panel",
|
|
821
|
+
"panel.leaveFullScreen": "Leave full screen",
|
|
822
|
+
"panel.leaveFullScreenTooltip": "Leave full screen (Esc)",
|
|
823
|
+
"panel.clearFilter": "Clear the filter",
|
|
824
|
+
"panel.colourOf": "Colour of {name}",
|
|
825
|
+
"panel.drawIn": "Draw {name} in {color}",
|
|
826
|
+
"panel.changeColour": "Draw this spectrum in another colour"
|
|
798
827
|
}
|
package/src/locales/es.json
CHANGED
|
@@ -114,6 +114,14 @@
|
|
|
114
114
|
"site.atoms.tagline": "Electrones, neutrones, estructuras de Lewis y números de oxidación.",
|
|
115
115
|
"site.moles.tagline": "Ajustar una reacción y calcular su composición en masa.",
|
|
116
116
|
"site.inorganic.tagline": "Nombrar un compuesto inorgánico y escribir su fórmula.",
|
|
117
|
+
"site.iupac-name.tagline": "El nombre IUPAC de una estructura, y la estructura que designa un nombre.",
|
|
118
|
+
"site.slides.tagline": "Poner una herramienta en vivo en una diapositiva, con el enlace que da su botón Compartir.",
|
|
119
|
+
"site.vibrations.tagline": "Espectros IR y Raman calculados en el navegador.",
|
|
120
|
+
"site.draw.tagline": "Estructuras con calidad de publicación, en un SVG que conserva la química.",
|
|
121
|
+
"site.molecules.tagline": "Buscar una molécula, sus propiedades calculadas y sus fuentes.",
|
|
122
|
+
"site.chembio.tagline": "Productos naturales, y los organismos en los que se encontraron.",
|
|
123
|
+
"site.wikidata.tagline": "La química de las fichas de Wikipedia, con búsqueda por estructura.",
|
|
124
|
+
"site.mz.tagline": "Espectros de masas, clasificados según cómo se midieron.",
|
|
117
125
|
"share.button": "Compartir",
|
|
118
126
|
"share.buttonTitle": "Compartir un enlace a esta página, o incrustarla en su propio sitio",
|
|
119
127
|
"share.dialogTitleFor": "Compartir o incrustar — {title}",
|
|
@@ -282,10 +290,14 @@
|
|
|
282
290
|
"download.resolution": "Resolución",
|
|
283
291
|
"download.resolutionHelp": "Cuántas veces la figura en pantalla mide el archivo. Un PNG recibe tantos píxeles más: dos sirve para una diapositiva, tres o cuatro para imprimir. Un SVG se mantiene nítido a cualquier tamaño, y se abre tantas veces más grande.",
|
|
284
292
|
"download.resolutionExample": "Una figura de 640 píxeles de ancho en pantalla se guarda con 1280 píxeles de ancho.",
|
|
293
|
+
"download.resolutionDpiHelp": "Puntos por pulgada, con la figura impresa a su tamaño en la página. 150 basta para una diapositiva, 300 para las fotografías de una revista, de 600 a 1200 para el dibujo de línea. El PNG lo indica, así un documento lo coloca a ese tamaño.",
|
|
294
|
+
"download.resolutionDpiExample": "Una figura de 8,5 cm de ancho se guarda con 1004 píxeles de ancho.",
|
|
285
295
|
"download.noFigure": "Todavía no hay ninguna figura en la página que guardar.",
|
|
286
296
|
"download.hintRasterSvg": "Un SVG que contiene una imagen de {pixels}: una escena 3D no tiene forma vectorial.",
|
|
287
297
|
"download.hintSvg": "Se abre a {pixels}, y se mantiene nítido a cualquier tamaño.",
|
|
288
298
|
"download.hintPng": "Guardado {pixels}.",
|
|
299
|
+
"download.hintSvgDpi": "Se imprime a {width} × {height} cm, y se mantiene nítido a cualquier tamaño.",
|
|
300
|
+
"download.hintPngDpi": "Guardado {pixels}, que se imprimen a {width} × {height} cm.",
|
|
289
301
|
"download.hintCopied": "Copiado al portapapeles: PNG de {pixels}.",
|
|
290
302
|
"download.copyUnsupported": "Este navegador no puede poner una imagen en el portapapeles. Guárdala en su lugar.",
|
|
291
303
|
"download.size": "Tamaño",
|
|
@@ -794,5 +806,22 @@
|
|
|
794
806
|
"ir.raman.doc.sampled": "Una banda se da en el punto muestreado donde alcanza su máximo: su posición no es más precisa que la rejilla en la que se registró el espectro.",
|
|
795
807
|
"ir.raman.aboutLead": "Dibuja un espectro Raman, encuentra sus bandas y las enumera junto a la gráfica.",
|
|
796
808
|
"ir.raman.credit.picking": "**ir-spectrum** (cheminfo, MIT) encuentra las bandas, con el detector de picos de **common-spectrum** y **ml-gsd**.",
|
|
797
|
-
"ir.raman.credit.jcamp": "**convert-to-jcamp** (cheminfo, MIT) escribe el archivo JCAMP-DX descargado."
|
|
809
|
+
"ir.raman.credit.jcamp": "**convert-to-jcamp** (cheminfo, MIT) escribe el archivo JCAMP-DX descargado.",
|
|
810
|
+
"panel.focus": "Centrarse en el panel {panel}",
|
|
811
|
+
"panel.focusTooltip": "Centrarse en este panel: plegar todos los demás",
|
|
812
|
+
"panel.unfocusTooltip": "Desplegar de nuevo los demás paneles",
|
|
813
|
+
"panel.fillScreen": "Mostrar el panel {panel} a pantalla completa",
|
|
814
|
+
"panel.fillScreenTooltip": "Mostrar este panel a pantalla completa",
|
|
815
|
+
"panel.fold": "Plegar el panel {panel}",
|
|
816
|
+
"panel.unfold": "Desplegar el panel {panel}",
|
|
817
|
+
"panel.foldTooltip": "Plegar este panel",
|
|
818
|
+
"panel.unfoldTooltip": "Desplegarlo",
|
|
819
|
+
"panel.close": "Cerrar el panel {panel}",
|
|
820
|
+
"panel.closeTooltip": "Cerrar este panel",
|
|
821
|
+
"panel.leaveFullScreen": "Salir de la pantalla completa",
|
|
822
|
+
"panel.leaveFullScreenTooltip": "Salir de la pantalla completa (Esc)",
|
|
823
|
+
"panel.clearFilter": "Borrar el filtro",
|
|
824
|
+
"panel.colourOf": "Color de {name}",
|
|
825
|
+
"panel.drawIn": "Dibujar {name} en {color}",
|
|
826
|
+
"panel.changeColour": "Dibujar este espectro en otro color"
|
|
798
827
|
}
|
package/src/locales/fr.json
CHANGED
|
@@ -114,6 +114,14 @@
|
|
|
114
114
|
"site.atoms.tagline": "Électrons, neutrons, structures de Lewis et nombres d'oxydation.",
|
|
115
115
|
"site.moles.tagline": "Équilibrer une réaction, et en calculer la composition massique.",
|
|
116
116
|
"site.inorganic.tagline": "Nommer un composé inorganique, et en écrire la formule.",
|
|
117
|
+
"site.iupac-name.tagline": "Le nom IUPAC d'une structure, et la structure que désigne un nom.",
|
|
118
|
+
"site.slides.tagline": "Mettre un outil vivant sur une diapositive, avec le lien que donne son bouton Partager.",
|
|
119
|
+
"site.vibrations.tagline": "Spectres IR et Raman calculés dans le navigateur.",
|
|
120
|
+
"site.draw.tagline": "Des structures de qualité publication, dans un SVG qui garde la chimie.",
|
|
121
|
+
"site.molecules.tagline": "Rechercher une molécule, ses propriétés calculées et ses sources.",
|
|
122
|
+
"site.chembio.tagline": "Les produits naturels, et les organismes où ils ont été trouvés.",
|
|
123
|
+
"site.wikidata.tagline": "La chimie des infobox de Wikipédia, interrogeable par structure.",
|
|
124
|
+
"site.mz.tagline": "Des spectres de masse, classés selon la façon dont ils ont été mesurés.",
|
|
117
125
|
"share.button": "Partager",
|
|
118
126
|
"share.buttonTitle": "Partager un lien vers cette page, ou l'intégrer à votre propre site",
|
|
119
127
|
"share.dialogTitleFor": "Partager ou intégrer — {title}",
|
|
@@ -282,10 +290,14 @@
|
|
|
282
290
|
"download.resolution": "Résolution",
|
|
283
291
|
"download.resolutionHelp": "Combien de fois la figure à l'écran mesure le fichier. Un PNG reçoit d'autant plus de pixels : deux convient pour une diapositive, trois ou quatre pour l'impression. Un SVG reste net à toute taille, et s'ouvre d'autant plus grand.",
|
|
284
292
|
"download.resolutionExample": "Une figure large de 640 pixels à l'écran est enregistrée large de 1280 pixels.",
|
|
293
|
+
"download.resolutionDpiHelp": "Points par pouce, la figure étant imprimée à sa taille sur la page. 150 suffit pour une diapositive, 300 pour les photographies d'une revue, 600 à 1200 pour un dessin au trait. Le PNG l'indique, si bien qu'un document le place à cette taille.",
|
|
294
|
+
"download.resolutionDpiExample": "Une figure large de 8,5 cm est enregistrée large de 1004 pixels.",
|
|
285
295
|
"download.noFigure": "Il n'y a encore aucune figure à enregistrer sur la page.",
|
|
286
296
|
"download.hintRasterSvg": "Un SVG contenant une image de {pixels} : une scène 3D n'a pas de forme vectorielle.",
|
|
287
297
|
"download.hintSvg": "S'ouvre à {pixels}, et reste net à toute taille.",
|
|
288
298
|
"download.hintPng": "Enregistré {pixels}.",
|
|
299
|
+
"download.hintSvgDpi": "S'imprime en {width} × {height} cm, et reste net à toute taille.",
|
|
300
|
+
"download.hintPngDpi": "Enregistré {pixels}, qui s'impriment en {width} × {height} cm.",
|
|
289
301
|
"download.hintCopied": "Copié dans le presse-papiers : PNG de {pixels}.",
|
|
290
302
|
"download.copyUnsupported": "Ce navigateur ne peut pas copier une image dans le presse-papiers. Enregistrez-la plutôt.",
|
|
291
303
|
"download.size": "Taille",
|
|
@@ -794,5 +806,22 @@
|
|
|
794
806
|
"ir.raman.doc.sampled": "Une bande est donnée au point échantillonné où elle culmine : sa position n'est pas plus précise que la grille sur laquelle le spectre a été enregistré.",
|
|
795
807
|
"ir.raman.aboutLead": "Trace un spectre Raman, repère ses bandes et les liste à côté du graphique.",
|
|
796
808
|
"ir.raman.credit.picking": "**ir-spectrum** (cheminfo, MIT) repère les bandes, avec le détecteur de pics de **common-spectrum** et **ml-gsd**.",
|
|
797
|
-
"ir.raman.credit.jcamp": "**convert-to-jcamp** (cheminfo, MIT) écrit le fichier JCAMP-DX téléchargé."
|
|
809
|
+
"ir.raman.credit.jcamp": "**convert-to-jcamp** (cheminfo, MIT) écrit le fichier JCAMP-DX téléchargé.",
|
|
810
|
+
"panel.focus": "Se concentrer sur le panneau {panel}",
|
|
811
|
+
"panel.focusTooltip": "Se concentrer sur ce panneau : replier tous les autres",
|
|
812
|
+
"panel.unfocusTooltip": "Déplier de nouveau les autres panneaux",
|
|
813
|
+
"panel.fillScreen": "Afficher le panneau {panel} en plein écran",
|
|
814
|
+
"panel.fillScreenTooltip": "Afficher ce panneau en plein écran",
|
|
815
|
+
"panel.fold": "Replier le panneau {panel}",
|
|
816
|
+
"panel.unfold": "Déplier le panneau {panel}",
|
|
817
|
+
"panel.foldTooltip": "Replier ce panneau",
|
|
818
|
+
"panel.unfoldTooltip": "Le déplier",
|
|
819
|
+
"panel.close": "Fermer le panneau {panel}",
|
|
820
|
+
"panel.closeTooltip": "Fermer ce panneau",
|
|
821
|
+
"panel.leaveFullScreen": "Quitter le plein écran",
|
|
822
|
+
"panel.leaveFullScreenTooltip": "Quitter le plein écran (Échap)",
|
|
823
|
+
"panel.clearFilter": "Effacer le filtre",
|
|
824
|
+
"panel.colourOf": "Couleur de {name}",
|
|
825
|
+
"panel.drawIn": "Tracer {name} en {color}",
|
|
826
|
+
"panel.changeColour": "Tracer ce spectre dans une autre couleur"
|
|
798
827
|
}
|
package/src/locales/it.json
CHANGED
|
@@ -114,6 +114,14 @@
|
|
|
114
114
|
"site.atoms.tagline": "Elettroni, neutroni, strutture di Lewis e numeri di ossidazione.",
|
|
115
115
|
"site.moles.tagline": "Bilanciare una reazione e calcolarne la composizione in massa.",
|
|
116
116
|
"site.inorganic.tagline": "Nominare un composto inorganico e scriverne la formula.",
|
|
117
|
+
"site.iupac-name.tagline": "Il nome IUPAC di una struttura, e la struttura che un nome designa.",
|
|
118
|
+
"site.slides.tagline": "Mettere uno strumento interattivo su una diapositiva, con il link del suo pulsante Condividi.",
|
|
119
|
+
"site.vibrations.tagline": "Spettri IR e Raman calcolati nel browser.",
|
|
120
|
+
"site.draw.tagline": "Strutture di qualità da pubblicazione, in un SVG che conserva la chimica.",
|
|
121
|
+
"site.molecules.tagline": "Cercare una molecola, le sue proprietà calcolate e le sue fonti.",
|
|
122
|
+
"site.chembio.tagline": "Prodotti naturali, e gli organismi in cui sono stati trovati.",
|
|
123
|
+
"site.wikidata.tagline": "La chimica delle infobox di Wikipedia, ricercabile per struttura.",
|
|
124
|
+
"site.mz.tagline": "Spettri di massa, classificati in base a come sono stati misurati.",
|
|
117
125
|
"share.button": "Condividi",
|
|
118
126
|
"share.buttonTitle": "Condividere un link a questa pagina, o incorporarla nel proprio sito",
|
|
119
127
|
"share.dialogTitleFor": "Condividere o incorporare — {title}",
|
|
@@ -282,10 +290,14 @@
|
|
|
282
290
|
"download.resolution": "Risoluzione",
|
|
283
291
|
"download.resolutionHelp": "Quante volte la figura sullo schermo misura il file. Un PNG riceve altrettanti pixel in più: due va bene per una diapositiva, tre o quattro per la stampa. Un SVG resta nitido a qualsiasi dimensione, e si apre altrettante volte più grande.",
|
|
284
292
|
"download.resolutionExample": "Una figura larga 640 pixel sullo schermo viene salvata larga 1280 pixel.",
|
|
293
|
+
"download.resolutionDpiHelp": "Punti per pollice, con la figura stampata alla sua dimensione sulla pagina. 150 basta per una diapositiva, 300 per le fotografie di una rivista, da 600 a 1200 per i disegni al tratto. Il PNG lo indica, così un documento lo colloca a quella dimensione.",
|
|
294
|
+
"download.resolutionDpiExample": "Una figura larga 8,5 cm viene salvata larga 1004 pixel.",
|
|
285
295
|
"download.noFigure": "Non c'è ancora nessuna figura nella pagina da salvare.",
|
|
286
296
|
"download.hintRasterSvg": "Un SVG che contiene un'immagine di {pixels}: una scena 3D non ha forma vettoriale.",
|
|
287
297
|
"download.hintSvg": "Si apre a {pixels}, e resta nitido a qualsiasi dimensione.",
|
|
288
298
|
"download.hintPng": "Salvato {pixels}.",
|
|
299
|
+
"download.hintSvgDpi": "Si stampa a {width} × {height} cm, e resta nitido a qualsiasi dimensione.",
|
|
300
|
+
"download.hintPngDpi": "Salvato {pixels}, che si stampano a {width} × {height} cm.",
|
|
289
301
|
"download.hintCopied": "Copiato negli appunti: PNG di {pixels}.",
|
|
290
302
|
"download.copyUnsupported": "Questo browser non può mettere un'immagine negli appunti. Salvala invece.",
|
|
291
303
|
"download.size": "Dimensione",
|
|
@@ -794,5 +806,22 @@
|
|
|
794
806
|
"ir.raman.doc.sampled": "Una banda è data nel punto campionato in cui raggiunge il massimo: la sua posizione non è più precisa della griglia su cui lo spettro è stato registrato.",
|
|
795
807
|
"ir.raman.aboutLead": "Disegna uno spettro Raman, ne trova le bande e le elenca accanto al grafico.",
|
|
796
808
|
"ir.raman.credit.picking": "**ir-spectrum** (cheminfo, MIT) trova le bande, con il rilevatore di picchi di **common-spectrum** e **ml-gsd**.",
|
|
797
|
-
"ir.raman.credit.jcamp": "**convert-to-jcamp** (cheminfo, MIT) scrive il file JCAMP-DX scaricato."
|
|
809
|
+
"ir.raman.credit.jcamp": "**convert-to-jcamp** (cheminfo, MIT) scrive il file JCAMP-DX scaricato.",
|
|
810
|
+
"panel.focus": "Concentrati sul pannello {panel}",
|
|
811
|
+
"panel.focusTooltip": "Concentrati su questo pannello: comprimi tutti gli altri",
|
|
812
|
+
"panel.unfocusTooltip": "Espandi di nuovo gli altri pannelli",
|
|
813
|
+
"panel.fillScreen": "Mostra il pannello {panel} a schermo intero",
|
|
814
|
+
"panel.fillScreenTooltip": "Mostra questo pannello a schermo intero",
|
|
815
|
+
"panel.fold": "Comprimi il pannello {panel}",
|
|
816
|
+
"panel.unfold": "Espandi il pannello {panel}",
|
|
817
|
+
"panel.foldTooltip": "Comprimi questo pannello",
|
|
818
|
+
"panel.unfoldTooltip": "Espandilo",
|
|
819
|
+
"panel.close": "Chiudi il pannello {panel}",
|
|
820
|
+
"panel.closeTooltip": "Chiudi questo pannello",
|
|
821
|
+
"panel.leaveFullScreen": "Esci dallo schermo intero",
|
|
822
|
+
"panel.leaveFullScreenTooltip": "Esci dallo schermo intero (Esc)",
|
|
823
|
+
"panel.clearFilter": "Cancella il filtro",
|
|
824
|
+
"panel.colourOf": "Colore di {name}",
|
|
825
|
+
"panel.drawIn": "Disegna {name} in {color}",
|
|
826
|
+
"panel.changeColour": "Disegna questo spettro in un altro colore"
|
|
798
827
|
}
|
|
@@ -1,92 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The box the molecule canvas and its toolbars are drawn in, which is also the
|
|
3
|
-
* box that fills the screen.
|
|
4
|
-
*
|
|
5
|
-
* A box filling the screen hides everything outside it, and the popovers and
|
|
6
|
-
* tooltips of the toolbars are portalled to `document.body`: while the box
|
|
7
|
-
* fills the screen they are portalled into it instead, the way react-science's
|
|
8
|
-
* `RootLayout` keeps its own menus visible. Otherwise the portal options of the
|
|
9
|
-
* page around the viewer are passed through untouched.
|
|
3
|
+
* box that fills the screen. It is the shared fullscreen stage, so the
|
|
4
|
+
* toolbars' popovers stay visible while it does.
|
|
10
5
|
*/
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import { useCallback, useContext, useState } from 'react';
|
|
15
|
-
import { FullScreenProvider, useFullscreen } from 'react-science/ui';
|
|
16
|
-
|
|
17
|
-
import type { Molecule3DFullscreen } from './Molecule3DToolbar.tsx';
|
|
18
|
-
|
|
19
|
-
/** Props of {@link Molecule3DStage}. */
|
|
20
|
-
export interface Molecule3DStageProps {
|
|
21
|
-
/**
|
|
22
|
-
* Style of the box, or a function handed whether the box fills the screen,
|
|
23
|
-
* for a box shaped differently while it does.
|
|
24
|
-
*/
|
|
25
|
-
style: CSSProperties | ((fillsScreen: boolean) => CSSProperties);
|
|
26
|
-
/**
|
|
27
|
-
* Called with the box once it is mounted, and with `null` once it is gone.
|
|
28
|
-
* @default undefined
|
|
29
|
-
*/
|
|
30
|
-
onStage?: (element: HTMLDivElement | null) => void;
|
|
31
|
-
/**
|
|
32
|
-
* What is drawn in the box, handed whether it fills the screen and the
|
|
33
|
-
* toggle, or `undefined` where the browser cannot fill the screen.
|
|
34
|
-
*/
|
|
35
|
-
children: (fullscreen: Molecule3DFullscreen | undefined) => ReactNode;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* The box of the canvas, able to fill the screen.
|
|
40
|
-
* @param props - See {@link Molecule3DStageProps}.
|
|
41
|
-
* @returns The box.
|
|
42
|
-
*/
|
|
43
|
-
export function Molecule3DStage(props: Molecule3DStageProps): ReactElement {
|
|
44
|
-
return (
|
|
45
|
-
<FullScreenProvider>
|
|
46
|
-
{(fullscreenRef) => <Stage {...props} fullscreenRef={fullscreenRef} />}
|
|
47
|
-
</FullScreenProvider>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
interface StageProps extends Molecule3DStageProps {
|
|
52
|
-
/** Where `FullScreenProvider` expects the element that fills the screen. */
|
|
53
|
-
fullscreenRef: { current: HTMLDivElement | null };
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function Stage(props: StageProps): ReactElement {
|
|
57
|
-
const { style, onStage, children, fullscreenRef } = props;
|
|
58
|
-
const { isFullScreen, toggle } = useFullscreen();
|
|
59
|
-
const portal = useContext(PortalContext);
|
|
60
|
-
const [canFillScreen] = useState(isFullscreenEnabled);
|
|
61
|
-
const [stage, setStage] = useState<HTMLDivElement | null>(null);
|
|
62
|
-
const stageRef = useCallback(
|
|
63
|
-
(element: HTMLDivElement | null) => {
|
|
64
|
-
fullscreenRef.current = element;
|
|
65
|
-
setStage(element);
|
|
66
|
-
onStage?.(element);
|
|
67
|
-
},
|
|
68
|
-
[fullscreenRef, onStage],
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
// The provider is always there, so entering full screen changes a value
|
|
72
|
-
// rather than the tree, and the canvas inside is never mounted again.
|
|
73
|
-
return (
|
|
74
|
-
<div
|
|
75
|
-
ref={stageRef}
|
|
76
|
-
style={typeof style === 'function' ? style(isFullScreen) : style}
|
|
77
|
-
>
|
|
78
|
-
<PortalProvider
|
|
79
|
-
portalClassName={portal.portalClassName}
|
|
80
|
-
portalContainer={
|
|
81
|
-
isFullScreen && stage !== null ? stage : portal.portalContainer
|
|
82
|
-
}
|
|
83
|
-
>
|
|
84
|
-
{children(canFillScreen ? { active: isFullScreen, toggle } : undefined)}
|
|
85
|
-
</PortalProvider>
|
|
86
|
-
</div>
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function isFullscreenEnabled(): boolean {
|
|
91
|
-
return typeof document !== 'undefined' && document.fullscreenEnabled;
|
|
92
|
-
}
|
|
7
|
+
export type { FullscreenStageProps as Molecule3DStageProps } from '../../shared/ui/FullscreenStage.tsx';
|
|
8
|
+
export { FullscreenStage as Molecule3DStage } from '../../shared/ui/FullscreenStage.tsx';
|