react-cheminfo 0.56.0 → 0.58.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/lib/credits/core/credits.d.ts +12 -0
- package/lib/credits/core/credits.d.ts.map +1 -1
- package/lib/credits/core/credits.js +14 -0
- package/lib/credits/core/credits.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/core/unlistedSites.d.ts.map +1 -1
- package/lib/ecosystem/core/unlistedSites.js +5 -3
- package/lib/ecosystem/core/unlistedSites.js.map +1 -1
- package/lib/ecosystem/ui/glyphs.js +1 -1
- 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 +1 -0
- package/lib/locales/en.json +1 -0
- package/lib/locales/es.json +1 -0
- package/lib/locales/fr.json +1 -0
- package/lib/locales/it.json +1 -0
- package/lib/molecule3d/core/settings.d.ts +6 -0
- package/lib/molecule3d/core/settings.d.ts.map +1 -1
- package/lib/molecule3d/core/settings.js +1 -0
- package/lib/molecule3d/core/settings.js.map +1 -1
- package/lib/molecule3d/ui/Molecule3DStage.d.ts +29 -0
- package/lib/molecule3d/ui/Molecule3DStage.d.ts.map +1 -0
- package/lib/molecule3d/ui/Molecule3DStage.js +40 -0
- package/lib/molecule3d/ui/Molecule3DStage.js.map +1 -0
- package/lib/molecule3d/ui/Molecule3DToolbar.d.ts +14 -1
- package/lib/molecule3d/ui/Molecule3DToolbar.d.ts.map +1 -1
- package/lib/molecule3d/ui/Molecule3DToolbar.js +5 -3
- package/lib/molecule3d/ui/Molecule3DToolbar.js.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.d.ts +2 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.d.ts.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.js +7 -6
- package/lib/molecule3d/ui/MoleculeCanvas3D.js.map +1 -1
- package/lib/molecule3d/ui/MoleculeViewer3D.d.ts +2 -1
- package/lib/molecule3d/ui/MoleculeViewer3D.d.ts.map +1 -1
- package/lib/molecule3d/ui/MoleculeViewer3D.js +2 -1
- package/lib/molecule3d/ui/MoleculeViewer3D.js.map +1 -1
- package/lib/molecule3d/ui/index.d.ts +1 -1
- package/lib/molecule3d/ui/index.d.ts.map +1 -1
- package/lib/molecule3d/ui/index.js.map +1 -1
- package/package.json +1 -1
- package/src/credits/core/credits.ts +15 -0
- package/src/ecosystem/core/types.ts +1 -1
- package/src/ecosystem/core/unlistedSites.ts +5 -3
- package/src/ecosystem/ui/glyphs.tsx +1 -1
- package/src/locales/de.json +1 -0
- package/src/locales/en.json +1 -0
- package/src/locales/es.json +1 -0
- package/src/locales/fr.json +1 -0
- package/src/locales/it.json +1 -0
- package/src/molecule3d/core/settings.ts +7 -0
- package/src/molecule3d/ui/Molecule3DStage.tsx +80 -0
- package/src/molecule3d/ui/Molecule3DToolbar.tsx +28 -1
- package/src/molecule3d/ui/MoleculeCanvas3D.tsx +48 -37
- package/src/molecule3d/ui/MoleculeViewer3D.tsx +2 -1
- package/src/molecule3d/ui/index.ts +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Molecule3DToolbar.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/Molecule3DToolbar.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,cA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AAM;IACf,aAAa,EAAE,QAAQ;IACvB,GAAG,EAAE,CAAC;IACN,aAAa,EAAE,MAAM;CACtB,CAAC;AAEF,MAAM,UAAU,GAAkB,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The molstar canvas of `MoleculeViewer3D`, with its toolbars over it
|
|
2
|
+
* The molstar canvas of `MoleculeViewer3D`, with its toolbars over it, in a
|
|
3
|
+
* box that can fill the screen.
|
|
3
4
|
*
|
|
4
5
|
* Reached through `React.lazy`, so a page that never shows a molecule never
|
|
5
6
|
* downloads molstar.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoleculeCanvas3D.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeCanvas3D.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"MoleculeCanvas3D.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeCanvas3D.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAezD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAOxE,yCAAyC;AACzC,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,qBAAqB,EACrB,UAAU,GAAG,mBAAmB,CACjC;IACC,2EAA2E;IAC3E,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACnD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CA8J3E"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { DEFAULT_SPIN_SPEED } from "../../molstar/core/index.js";
|
|
4
4
|
import { normalizeMolecule3DSettings, resolveMolecule3DTools, } from "../core/settings.js";
|
|
5
5
|
import { Molecule3DExport } from "./Molecule3DExport.js";
|
|
6
6
|
import { Molecule3DOptions } from "./Molecule3DOptions.js";
|
|
7
|
+
import { Molecule3DStage } from "./Molecule3DStage.js";
|
|
7
8
|
import { Molecule3DToolbar } from "./Molecule3DToolbar.js";
|
|
8
9
|
import { createMolecule3DViewer } from "./createViewer.js";
|
|
9
10
|
import { useControlledState } from "./useControlledState.js";
|
|
@@ -82,11 +83,11 @@ export function MoleculeCanvas3D(props) {
|
|
|
82
83
|
camera: props,
|
|
83
84
|
});
|
|
84
85
|
const { canvasSize, exportImage, copyImage } = useImageExport(container, viewerRef, fileName);
|
|
85
|
-
return (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
return (_jsx(Molecule3DStage, { style: { ...STAGE_STYLE, minHeight }, children: (fullscreen) => (_jsxs(_Fragment, { children: [_jsx("div", { ref: setContainer, style: CANVAS_STYLE, "data-testid": "molecule3d" }), molfile !== null && (_jsx("div", { style: OVERLAY_STYLE, children: _jsx(Molecule3DToolbar, { tools: tools, fullscreen: fullscreen, measureKind: measureKind, onMeasureKindChange: setMeasureKind, measurementCount: measurements.length, onClearMeasurements: () => {
|
|
87
|
+
setMeasurements(NO_MEASUREMENTS);
|
|
88
|
+
}, spinning: spinning, onSpinningChange: setSpinning, showSurface: settings.showSurface, onShowSurfaceChange: (showSurface) => {
|
|
89
|
+
setSettings({ ...settings, showSurface });
|
|
90
|
+
}, onResetView: resetView, options: _jsx(Molecule3DOptions, { settings: settings, onChange: setSettings, polarSurfaceArea: polarSurfaceArea, defaults: initialSettings }), exportPanel: _jsx(Molecule3DExport, { getSize: canvasSize, onExport: exportImage, onCopy: copyImage }) }) }))] })) }));
|
|
90
91
|
}
|
|
91
92
|
const NO_MEASUREMENTS = [];
|
|
92
93
|
const STAGE_STYLE = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoleculeCanvas3D.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeCanvas3D.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"MoleculeCanvas3D.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeCanvas3D.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAwB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAY/D;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAA4B;IAC3D,MAAM,EACJ,OAAO,EACP,gBAAgB,GAAG,MAAM,EACzB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,YAAY,EACtB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EAAE,YAAY,EACtB,eAAe,GAAG,KAAK,EACvB,gBAAgB,EAChB,SAAS,GAAG,kBAAkB,EAC9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,MAAM,eAAe,GAA2B,EAAE,CAAC;AAEnD,MAAM,WAAW,GAAkB;IACjC,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,MAAM;IACb,YAAY,EAAE,CAAC;IACf,QAAQ,EAAE,QAAQ;CACnB,CAAC;AAEF,8EAA8E;AAC9E,MAAM,YAAY,GAAkB,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAEvE,MAAM,aAAa,GAAkB;IACnC,QAAQ,EAAE,UAAU;IACpB,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,YAAY;IACxB,GAAG,EAAE,CAAC;IACN,aAAa,EAAE,MAAM;CACtB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A molecule in three dimensions, with a toolbar to measure it, turn it, wrap
|
|
3
|
-
* it in its surface and
|
|
3
|
+
* it in its surface, restyle it and fill the screen with it — and what to say
|
|
4
|
+
* when there cannot be one.
|
|
4
5
|
*
|
|
5
6
|
* The WebGL probe runs before molstar is touched, so a machine without WebGL
|
|
6
7
|
* gets an explanation instead of a blank rectangle, and the canvas sits behind
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoleculeViewer3D.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeViewer3D.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"MoleculeViewer3D.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeViewer3D.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAQzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAOxE;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CAiC3E"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
3
|
* A molecule in three dimensions, with a toolbar to measure it, turn it, wrap
|
|
4
|
-
* it in its surface and
|
|
4
|
+
* it in its surface, restyle it and fill the screen with it — and what to say
|
|
5
|
+
* when there cannot be one.
|
|
5
6
|
*
|
|
6
7
|
* The WebGL probe runs before molstar is touched, so a machine without WebGL
|
|
7
8
|
* gets an explanation instead of a blank rectangle, and the canvas sits behind
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoleculeViewer3D.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeViewer3D.tsx"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"MoleculeViewer3D.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeViewer3D.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjD,4EAA4E;AAC5E,uEAAuE;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAIvE,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE;IACvC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,uBAAwB,CAAC,CAAC;IACtD,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAC;AAC9C,CAAC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAA4B;IAC3D,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EA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
@@ -10,7 +10,7 @@ export { Molecule3DExport } from './Molecule3DExport.tsx';
|
|
|
10
10
|
export type { Molecule3DExportProps } from './Molecule3DExport.tsx';
|
|
11
11
|
export { Molecule3DHelp } from './Molecule3DHelp.tsx';
|
|
12
12
|
export { Molecule3DToolbar } from './Molecule3DToolbar.tsx';
|
|
13
|
-
export type { Molecule3DToolbarProps } from './Molecule3DToolbar.tsx';
|
|
13
|
+
export type { Molecule3DFullscreen, Molecule3DToolbarProps, } from './Molecule3DToolbar.tsx';
|
|
14
14
|
export type { MoleculeImageRequest, SceneCapture, } from './exportMoleculeImage.ts';
|
|
15
15
|
export { exportMoleculeImage } from './exportMoleculeImage.ts';
|
|
16
16
|
export type { ImageExport } from './useImageExport.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,YAAY,EACV,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,oBAAoB,EACpB,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAwB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAwB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAC;AAS5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAwB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-cheminfo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.58.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",
|
|
@@ -308,6 +308,21 @@ export const CREDITS = [
|
|
|
308
308
|
'the articles, and the Chembox and Drugbox infoboxes every value is read from.',
|
|
309
309
|
license: 'CC-BY-SA-4.0',
|
|
310
310
|
},
|
|
311
|
+
{
|
|
312
|
+
id: 'wikidata',
|
|
313
|
+
name: 'Wikidata',
|
|
314
|
+
href: 'https://www.wikidata.org/',
|
|
315
|
+
description:
|
|
316
|
+
'the name of every compound in every language, and its article in each Wikipedia.',
|
|
317
|
+
license: 'CC0-1.0',
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
id: 'country-flag-icons',
|
|
321
|
+
name: 'country-flag-icons',
|
|
322
|
+
href: 'https://gitlab.com/catamphetamine/country-flag-icons',
|
|
323
|
+
description: 'the flag each language is picked by.',
|
|
324
|
+
license: 'MIT',
|
|
325
|
+
},
|
|
311
326
|
{
|
|
312
327
|
id: 'wtf-wikipedia',
|
|
313
328
|
name: 'wtf_wikipedia',
|
|
@@ -19,9 +19,11 @@ export const UNLISTED_SITES: readonly EcosystemSite[] = [
|
|
|
19
19
|
mark: { plate: '#be185d', accent: '#5eead4' },
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
|
-
id: '
|
|
23
|
-
name
|
|
24
|
-
|
|
22
|
+
id: 'chembio',
|
|
23
|
+
// The name splits on itself, chemistry and biology, so it carries no
|
|
24
|
+
// domain.
|
|
25
|
+
name: { lead: 'chem', alt: 'bio', dot: false },
|
|
26
|
+
host: 'chembio.cheminfo.org',
|
|
25
27
|
tagline: 'Natural products, and the organisms they were found in.',
|
|
26
28
|
group: 'research',
|
|
27
29
|
// Moss, the green of the plants most natural products come from, 8.5
|
|
@@ -509,7 +509,7 @@ export const GLYPHS: Record<SiteId, (alt: string) => ReactNode> = {
|
|
|
509
509
|
// A ring, the compound, with a stem leading out of it to a leaf: a natural
|
|
510
510
|
// product, and the organism it came from. The leaf carries the answering
|
|
511
511
|
// colour.
|
|
512
|
-
|
|
512
|
+
chembio: (alt) => (
|
|
513
513
|
<>
|
|
514
514
|
<path
|
|
515
515
|
d="M11.5 14 16.7 17 16.7 23 11.5 26 6.3 23 6.3 17Z"
|
package/src/locales/de.json
CHANGED
|
@@ -484,6 +484,7 @@
|
|
|
484
484
|
"molecule3d.molecularSurface": "Moleküloberfläche",
|
|
485
485
|
"molecule3d.displayOptions": "Anzeigeoptionen",
|
|
486
486
|
"molecule3d.exportImage": "Bild exportieren",
|
|
487
|
+
"molecule3d.fullScreen": "Vollbild",
|
|
487
488
|
"molecule3d.measure": "Messen",
|
|
488
489
|
"molecule3d.clearMeasurements": "Alle Messungen entfernen",
|
|
489
490
|
"molecule3d.measurement.distance": "Abstand",
|
package/src/locales/en.json
CHANGED
|
@@ -460,6 +460,7 @@
|
|
|
460
460
|
"molecule3d.molecularSurface": "Molecular surface",
|
|
461
461
|
"molecule3d.displayOptions": "Display options",
|
|
462
462
|
"molecule3d.exportImage": "Export image",
|
|
463
|
+
"molecule3d.fullScreen": "Full screen",
|
|
463
464
|
"molecule3d.measure": "Measure",
|
|
464
465
|
"molecule3d.clearMeasurements": "Remove all measurements",
|
|
465
466
|
"molecule3d.measurement.distance": "Distance",
|
package/src/locales/es.json
CHANGED
|
@@ -484,6 +484,7 @@
|
|
|
484
484
|
"molecule3d.molecularSurface": "Superficie molecular",
|
|
485
485
|
"molecule3d.displayOptions": "Opciones de presentación",
|
|
486
486
|
"molecule3d.exportImage": "Exportar la imagen",
|
|
487
|
+
"molecule3d.fullScreen": "Pantalla completa",
|
|
487
488
|
"molecule3d.measure": "Medir",
|
|
488
489
|
"molecule3d.clearMeasurements": "Quitar todas las medidas",
|
|
489
490
|
"molecule3d.measurement.distance": "Distancia",
|
package/src/locales/fr.json
CHANGED
|
@@ -484,6 +484,7 @@
|
|
|
484
484
|
"molecule3d.molecularSurface": "Surface moléculaire",
|
|
485
485
|
"molecule3d.displayOptions": "Options d'affichage",
|
|
486
486
|
"molecule3d.exportImage": "Exporter l'image",
|
|
487
|
+
"molecule3d.fullScreen": "Plein écran",
|
|
487
488
|
"molecule3d.measure": "Mesurer",
|
|
488
489
|
"molecule3d.clearMeasurements": "Retirer toutes les mesures",
|
|
489
490
|
"molecule3d.measurement.distance": "Distance",
|
package/src/locales/it.json
CHANGED
|
@@ -460,6 +460,7 @@
|
|
|
460
460
|
"molecule3d.molecularSurface": "Superficie molecolare",
|
|
461
461
|
"molecule3d.displayOptions": "Opzioni di visualizzazione",
|
|
462
462
|
"molecule3d.exportImage": "Esporta l'immagine",
|
|
463
|
+
"molecule3d.fullScreen": "Schermo intero",
|
|
463
464
|
"molecule3d.measure": "Misura",
|
|
464
465
|
"molecule3d.clearMeasurements": "Togli tutte le misure",
|
|
465
466
|
"molecule3d.measurement.distance": "Distanza",
|
|
@@ -105,6 +105,12 @@ export interface Molecule3DTools {
|
|
|
105
105
|
reset: boolean;
|
|
106
106
|
/** A popover saving the picture as a PNG or an SVG. */
|
|
107
107
|
export: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* A toggle filling the screen with the canvas and its toolbars. It is left
|
|
110
|
+
* out where the browser cannot fill the screen, as on an iPhone or in a
|
|
111
|
+
* frame not allowed to.
|
|
112
|
+
*/
|
|
113
|
+
fullscreen: boolean;
|
|
108
114
|
/** A popover listing what the mouse and the keyboard do on the canvas. */
|
|
109
115
|
help: boolean;
|
|
110
116
|
}
|
|
@@ -117,6 +123,7 @@ export const DEFAULT_MOLECULE_3D_TOOLS: Molecule3DTools = {
|
|
|
117
123
|
surface: true,
|
|
118
124
|
reset: true,
|
|
119
125
|
export: true,
|
|
126
|
+
fullscreen: true,
|
|
120
127
|
help: true,
|
|
121
128
|
};
|
|
122
129
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
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.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { PortalContext, PortalProvider } from '@blueprintjs/core';
|
|
13
|
+
import type { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
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
|
+
/** Style of the box. */
|
|
22
|
+
style: CSSProperties;
|
|
23
|
+
/**
|
|
24
|
+
* What is drawn in the box, handed whether it fills the screen and the
|
|
25
|
+
* toggle, or `undefined` where the browser cannot fill the screen.
|
|
26
|
+
*/
|
|
27
|
+
children: (fullscreen: Molecule3DFullscreen | undefined) => ReactNode;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The box of the canvas, able to fill the screen.
|
|
32
|
+
* @param props - See {@link Molecule3DStageProps}.
|
|
33
|
+
* @returns The box.
|
|
34
|
+
*/
|
|
35
|
+
export function Molecule3DStage(props: Molecule3DStageProps): ReactElement {
|
|
36
|
+
return (
|
|
37
|
+
<FullScreenProvider>
|
|
38
|
+
{(fullscreenRef) => <Stage {...props} fullscreenRef={fullscreenRef} />}
|
|
39
|
+
</FullScreenProvider>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface StageProps extends Molecule3DStageProps {
|
|
44
|
+
/** Where `FullScreenProvider` expects the element that fills the screen. */
|
|
45
|
+
fullscreenRef: { current: HTMLDivElement | null };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function Stage(props: StageProps): ReactElement {
|
|
49
|
+
const { style, children, fullscreenRef } = props;
|
|
50
|
+
const { isFullScreen, toggle } = useFullscreen();
|
|
51
|
+
const portal = useContext(PortalContext);
|
|
52
|
+
const [canFillScreen] = useState(isFullscreenEnabled);
|
|
53
|
+
const [stage, setStage] = useState<HTMLDivElement | null>(null);
|
|
54
|
+
const stageRef = useCallback(
|
|
55
|
+
(element: HTMLDivElement | null) => {
|
|
56
|
+
fullscreenRef.current = element;
|
|
57
|
+
setStage(element);
|
|
58
|
+
},
|
|
59
|
+
[fullscreenRef],
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
// The provider is always there, so entering full screen changes a value
|
|
63
|
+
// rather than the tree, and the canvas inside is never mounted again.
|
|
64
|
+
return (
|
|
65
|
+
<div ref={stageRef} style={style}>
|
|
66
|
+
<PortalProvider
|
|
67
|
+
portalClassName={portal.portalClassName}
|
|
68
|
+
portalContainer={
|
|
69
|
+
isFullScreen && stage !== null ? stage : portal.portalContainer
|
|
70
|
+
}
|
|
71
|
+
>
|
|
72
|
+
{children(canFillScreen ? { active: isFullScreen, toggle } : undefined)}
|
|
73
|
+
</PortalProvider>
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function isFullscreenEnabled(): boolean {
|
|
79
|
+
return typeof document !== 'undefined' && document.fullscreenEnabled;
|
|
80
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The toolbars floating over the molecule canvas: the view — reset, spin,
|
|
3
|
-
* surface,
|
|
3
|
+
* surface, the options and export popovers, full screen and help — in one vertical
|
|
4
4
|
* react-science `Toolbar`, and the measuring tools with their own clear button
|
|
5
5
|
* in a second one under it.
|
|
6
6
|
*/
|
|
@@ -26,6 +26,14 @@ import {
|
|
|
26
26
|
SurfaceIcon,
|
|
27
27
|
} from './molecule3dIcons.tsx';
|
|
28
28
|
|
|
29
|
+
/** Whether the canvas fills the screen, and how to change that. */
|
|
30
|
+
export interface Molecule3DFullscreen {
|
|
31
|
+
/** Whether the canvas and its toolbars fill the screen. */
|
|
32
|
+
active: boolean;
|
|
33
|
+
/** Fill the screen, or leave it. */
|
|
34
|
+
toggle: () => void;
|
|
35
|
+
}
|
|
36
|
+
|
|
29
37
|
/** Props of {@link Molecule3DToolbar}. */
|
|
30
38
|
export interface Molecule3DToolbarProps {
|
|
31
39
|
/** Which tools to show; every one it does not name is on. */
|
|
@@ -44,6 +52,12 @@ export interface Molecule3DToolbarProps {
|
|
|
44
52
|
options?: ReactElement;
|
|
45
53
|
/** Content of the export popover; its tool is left out without one. */
|
|
46
54
|
exportPanel?: ReactElement;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the canvas fills the screen, and the toggle; its tool is left out
|
|
57
|
+
* without one, which is what a browser that cannot fill the screen gets.
|
|
58
|
+
* @default undefined
|
|
59
|
+
*/
|
|
60
|
+
fullscreen?: Molecule3DFullscreen;
|
|
47
61
|
}
|
|
48
62
|
|
|
49
63
|
/**
|
|
@@ -65,18 +79,21 @@ export function Molecule3DToolbar(props: Molecule3DToolbarProps): ReactElement {
|
|
|
65
79
|
onResetView,
|
|
66
80
|
options,
|
|
67
81
|
exportPanel,
|
|
82
|
+
fullscreen,
|
|
68
83
|
} = props;
|
|
69
84
|
const t = useChromeT();
|
|
70
85
|
const tools = resolveMolecule3DTools(toolsProp);
|
|
71
86
|
const showOptions = tools.options && options !== undefined;
|
|
72
87
|
const showSurfaceTool = tools.surface && onShowSurfaceChange !== undefined;
|
|
73
88
|
const showExport = tools.export && exportPanel !== undefined;
|
|
89
|
+
const showFullscreen = tools.fullscreen && fullscreen !== undefined;
|
|
74
90
|
const hasView =
|
|
75
91
|
tools.spin ||
|
|
76
92
|
tools.surface ||
|
|
77
93
|
tools.reset ||
|
|
78
94
|
showOptions ||
|
|
79
95
|
showExport ||
|
|
96
|
+
showFullscreen ||
|
|
80
97
|
tools.help;
|
|
81
98
|
|
|
82
99
|
return (
|
|
@@ -141,6 +158,16 @@ export function Molecule3DToolbar(props: Molecule3DToolbarProps): ReactElement {
|
|
|
141
158
|
}}
|
|
142
159
|
/>
|
|
143
160
|
)}
|
|
161
|
+
{showFullscreen && (
|
|
162
|
+
<Toolbar.Item
|
|
163
|
+
icon={fullscreen.active ? 'minimize' : 'fullscreen'}
|
|
164
|
+
active={fullscreen.active}
|
|
165
|
+
aria-label={t('molecule3d.fullScreen')}
|
|
166
|
+
tooltip={t('molecule3d.fullScreen')}
|
|
167
|
+
tooltipProps={TOOLTIP_PROPS}
|
|
168
|
+
onClick={fullscreen.toggle}
|
|
169
|
+
/>
|
|
170
|
+
)}
|
|
144
171
|
{tools.help && (
|
|
145
172
|
<Toolbar.PopoverItem
|
|
146
173
|
placement="right-start"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The molstar canvas of `MoleculeViewer3D`, with its toolbars over it
|
|
2
|
+
* The molstar canvas of `MoleculeViewer3D`, with its toolbars over it, in a
|
|
3
|
+
* box that can fill the screen.
|
|
3
4
|
*
|
|
4
5
|
* Reached through `React.lazy`, so a page that never shows a molecule never
|
|
5
6
|
* downloads molstar.
|
|
@@ -17,6 +18,7 @@ import {
|
|
|
17
18
|
|
|
18
19
|
import { Molecule3DExport } from './Molecule3DExport.tsx';
|
|
19
20
|
import { Molecule3DOptions } from './Molecule3DOptions.tsx';
|
|
21
|
+
import { Molecule3DStage } from './Molecule3DStage.tsx';
|
|
20
22
|
import { Molecule3DToolbar } from './Molecule3DToolbar.tsx';
|
|
21
23
|
import { createMolecule3DViewer } from './createViewer.ts';
|
|
22
24
|
import type { MoleculeViewer3DProps } from './moleculeViewer3DProps.ts';
|
|
@@ -150,44 +152,53 @@ export function MoleculeCanvas3D(props: MoleculeCanvas3DProps): ReactElement {
|
|
|
150
152
|
);
|
|
151
153
|
|
|
152
154
|
return (
|
|
153
|
-
<
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
onMeasureKindChange={setMeasureKind}
|
|
161
|
-
measurementCount={measurements.length}
|
|
162
|
-
onClearMeasurements={() => {
|
|
163
|
-
setMeasurements(NO_MEASUREMENTS);
|
|
164
|
-
}}
|
|
165
|
-
spinning={spinning}
|
|
166
|
-
onSpinningChange={setSpinning}
|
|
167
|
-
showSurface={settings.showSurface}
|
|
168
|
-
onShowSurfaceChange={(showSurface) => {
|
|
169
|
-
setSettings({ ...settings, showSurface });
|
|
170
|
-
}}
|
|
171
|
-
onResetView={resetView}
|
|
172
|
-
options={
|
|
173
|
-
<Molecule3DOptions
|
|
174
|
-
settings={settings}
|
|
175
|
-
onChange={setSettings}
|
|
176
|
-
polarSurfaceArea={polarSurfaceArea}
|
|
177
|
-
defaults={initialSettings}
|
|
178
|
-
/>
|
|
179
|
-
}
|
|
180
|
-
exportPanel={
|
|
181
|
-
<Molecule3DExport
|
|
182
|
-
getSize={canvasSize}
|
|
183
|
-
onExport={exportImage}
|
|
184
|
-
onCopy={copyImage}
|
|
185
|
-
/>
|
|
186
|
-
}
|
|
155
|
+
<Molecule3DStage style={{ ...STAGE_STYLE, minHeight }}>
|
|
156
|
+
{(fullscreen) => (
|
|
157
|
+
<>
|
|
158
|
+
<div
|
|
159
|
+
ref={setContainer}
|
|
160
|
+
style={CANVAS_STYLE}
|
|
161
|
+
data-testid="molecule3d"
|
|
187
162
|
/>
|
|
188
|
-
|
|
163
|
+
{molfile !== null && (
|
|
164
|
+
<div style={OVERLAY_STYLE}>
|
|
165
|
+
<Molecule3DToolbar
|
|
166
|
+
tools={tools}
|
|
167
|
+
fullscreen={fullscreen}
|
|
168
|
+
measureKind={measureKind}
|
|
169
|
+
onMeasureKindChange={setMeasureKind}
|
|
170
|
+
measurementCount={measurements.length}
|
|
171
|
+
onClearMeasurements={() => {
|
|
172
|
+
setMeasurements(NO_MEASUREMENTS);
|
|
173
|
+
}}
|
|
174
|
+
spinning={spinning}
|
|
175
|
+
onSpinningChange={setSpinning}
|
|
176
|
+
showSurface={settings.showSurface}
|
|
177
|
+
onShowSurfaceChange={(showSurface) => {
|
|
178
|
+
setSettings({ ...settings, showSurface });
|
|
179
|
+
}}
|
|
180
|
+
onResetView={resetView}
|
|
181
|
+
options={
|
|
182
|
+
<Molecule3DOptions
|
|
183
|
+
settings={settings}
|
|
184
|
+
onChange={setSettings}
|
|
185
|
+
polarSurfaceArea={polarSurfaceArea}
|
|
186
|
+
defaults={initialSettings}
|
|
187
|
+
/>
|
|
188
|
+
}
|
|
189
|
+
exportPanel={
|
|
190
|
+
<Molecule3DExport
|
|
191
|
+
getSize={canvasSize}
|
|
192
|
+
onExport={exportImage}
|
|
193
|
+
onCopy={copyImage}
|
|
194
|
+
/>
|
|
195
|
+
}
|
|
196
|
+
/>
|
|
197
|
+
</div>
|
|
198
|
+
)}
|
|
199
|
+
</>
|
|
189
200
|
)}
|
|
190
|
-
</
|
|
201
|
+
</Molecule3DStage>
|
|
191
202
|
);
|
|
192
203
|
}
|
|
193
204
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A molecule in three dimensions, with a toolbar to measure it, turn it, wrap
|
|
3
|
-
* it in its surface and
|
|
3
|
+
* it in its surface, restyle it and fill the screen with it — and what to say
|
|
4
|
+
* when there cannot be one.
|
|
4
5
|
*
|
|
5
6
|
* The WebGL probe runs before molstar is touched, so a machine without WebGL
|
|
6
7
|
* gets an explanation instead of a blank rectangle, and the canvas sits behind
|
|
@@ -11,7 +11,10 @@ export { Molecule3DExport } from './Molecule3DExport.tsx';
|
|
|
11
11
|
export type { Molecule3DExportProps } from './Molecule3DExport.tsx';
|
|
12
12
|
export { Molecule3DHelp } from './Molecule3DHelp.tsx';
|
|
13
13
|
export { Molecule3DToolbar } from './Molecule3DToolbar.tsx';
|
|
14
|
-
export type {
|
|
14
|
+
export type {
|
|
15
|
+
Molecule3DFullscreen,
|
|
16
|
+
Molecule3DToolbarProps,
|
|
17
|
+
} from './Molecule3DToolbar.tsx';
|
|
15
18
|
export type {
|
|
16
19
|
MoleculeImageRequest,
|
|
17
20
|
SceneCapture,
|