react-cheminfo 0.13.0 → 0.15.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 +79 -21
- package/lib/about/core/about.d.ts +13 -7
- package/lib/about/core/about.d.ts.map +1 -1
- package/lib/about/core/about.js +4 -2
- package/lib/about/core/about.js.map +1 -1
- package/lib/about/ui/AboutBuild.d.ts +20 -0
- package/lib/about/ui/AboutBuild.d.ts.map +1 -0
- package/lib/about/ui/AboutBuild.js +38 -0
- package/lib/about/ui/AboutBuild.js.map +1 -0
- package/lib/about/ui/AboutPage.d.ts +7 -0
- package/lib/about/ui/AboutPage.d.ts.map +1 -1
- package/lib/about/ui/AboutPage.js +5 -2
- package/lib/about/ui/AboutPage.js.map +1 -1
- package/lib/about/ui/index.d.ts +2 -0
- package/lib/about/ui/index.d.ts.map +1 -1
- package/lib/about/ui/index.js +1 -0
- package/lib/about/ui/index.js.map +1 -1
- package/lib/build/core/buildInfo.d.ts +39 -0
- package/lib/build/core/buildInfo.d.ts.map +1 -0
- package/lib/build/core/buildInfo.js +20 -0
- package/lib/build/core/buildInfo.js.map +1 -0
- package/lib/build/core/current.d.ts +12 -0
- package/lib/build/core/current.d.ts.map +1 -0
- package/lib/build/core/current.js +11 -0
- package/lib/build/core/current.js.map +1 -0
- package/lib/build/core/index.d.ts +3 -0
- package/lib/build/core/index.d.ts.map +1 -0
- package/lib/build/core/index.js +2 -0
- package/lib/build/core/index.js.map +1 -0
- package/lib/build/vite/buildInfo.d.ts +57 -0
- package/lib/build/vite/buildInfo.d.ts.map +1 -0
- package/lib/build/vite/buildInfo.js +151 -0
- package/lib/build/vite/buildInfo.js.map +1 -0
- package/lib/build/vite/gitHead.d.ts +29 -0
- package/lib/build/vite/gitHead.d.ts.map +1 -0
- package/lib/build/vite/gitHead.js +102 -0
- package/lib/build/vite/gitHead.js.map +1 -0
- package/lib/build/vite/index.d.ts +4 -0
- package/lib/build/vite/index.d.ts.map +1 -0
- package/lib/build/vite/index.js +3 -0
- package/lib/build/vite/index.js.map +1 -0
- package/lib/build-info.d.ts +3 -0
- package/lib/build-info.d.ts.map +1 -0
- package/lib/build-info.js +2 -0
- package/lib/build-info.js.map +1 -0
- package/lib/core.d.ts +1 -0
- package/lib/core.d.ts.map +1 -1
- package/lib/core.js +1 -0
- package/lib/core.js.map +1 -1
- package/lib/credits/core/credits.d.ts +18 -0
- package/lib/credits/core/credits.d.ts.map +1 -1
- package/lib/credits/core/credits.js +21 -0
- package/lib/credits/core/credits.js.map +1 -1
- package/lib/ecosystem/ui/Wordmark.d.ts +14 -3
- package/lib/ecosystem/ui/Wordmark.d.ts.map +1 -1
- package/lib/ecosystem/ui/Wordmark.js +8 -4
- package/lib/ecosystem/ui/Wordmark.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/camera.d.ts +3 -1
- package/lib/molecule3d/ui/camera.d.ts.map +1 -1
- package/lib/molecule3d/ui/camera.js +10 -2
- package/lib/molecule3d/ui/camera.js.map +1 -1
- package/lib/molecule3d/ui/drawScene.d.ts +4 -2
- package/lib/molecule3d/ui/drawScene.d.ts.map +1 -1
- package/lib/molecule3d/ui/drawScene.js +6 -2
- package/lib/molecule3d/ui/drawScene.js.map +1 -1
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts +8 -0
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts.map +1 -1
- package/lib/molecule3d/ui/viewer.d.ts +2 -1
- package/lib/molecule3d/ui/viewer.d.ts.map +1 -1
- package/lib/molecule3d/ui/viewer.js +3 -2
- package/lib/molecule3d/ui/viewer.js.map +1 -1
- package/lib/vite.d.ts +1 -0
- package/lib/vite.d.ts.map +1 -1
- package/lib/vite.js +1 -0
- package/lib/vite.js.map +1 -1
- package/package.json +2 -1
- package/src/about/core/about.ts +18 -9
- package/src/about/ui/AboutBuild.tsx +83 -0
- package/src/about/ui/AboutPage.tsx +15 -7
- package/src/about/ui/index.ts +2 -0
- package/src/build/core/buildInfo.ts +48 -0
- package/src/build/core/current.ts +12 -0
- package/src/build/core/index.ts +2 -0
- package/src/build/vite/buildInfo.ts +178 -0
- package/src/build/vite/gitHead.ts +114 -0
- package/src/build/vite/index.ts +8 -0
- package/src/build-info.ts +2 -0
- package/src/core.ts +1 -0
- package/src/credits/core/credits.ts +21 -0
- package/src/ecosystem/ui/Wordmark.tsx +22 -7
- package/src/molecule3d/ui/MoleculeCanvas3D.tsx +4 -2
- package/src/molecule3d/ui/camera.ts +13 -3
- package/src/molecule3d/ui/drawScene.ts +6 -3
- package/src/molecule3d/ui/moleculeViewer3DProps.ts +8 -0
- package/src/molecule3d/ui/viewer.ts +6 -2
- package/src/vite.ts +1 -0
|
@@ -20,6 +20,9 @@ const FRAMING_MARGIN = 0.08;
|
|
|
20
20
|
const SPIN_AXIS = Vec3.create(0, 1, 0);
|
|
21
21
|
/** Smallest radius framed, in ångström, so a single atom is not a close-up. */
|
|
22
22
|
const MIN_FRAMING_RADIUS = 0.5;
|
|
23
|
+
/** Screen up and viewing direction when the model is seen as its file lays it. */
|
|
24
|
+
const FRONT_UP = Vec3.create(0, 1, 0);
|
|
25
|
+
const FRONT_DIRECTION = Vec3.create(0, 0, -1);
|
|
23
26
|
/**
|
|
24
27
|
* Frame everything currently in the scene.
|
|
25
28
|
*
|
|
@@ -30,13 +33,18 @@ const MIN_FRAMING_RADIUS = 0.5;
|
|
|
30
33
|
* after that commit.
|
|
31
34
|
* @param plugin - The molstar context.
|
|
32
35
|
* @param durationMilliseconds - Transition length. Pass 0 for an instant jump.
|
|
36
|
+
* @param fromFront - Look down -z with y up, instead of keeping the current
|
|
37
|
+
* direction.
|
|
33
38
|
*/
|
|
34
|
-
export function resetCamera(plugin, durationMilliseconds = DEFAULT_CAMERA_DURATION) {
|
|
39
|
+
export function resetCamera(plugin, durationMilliseconds = DEFAULT_CAMERA_DURATION, fromFront = false) {
|
|
35
40
|
plugin.canvas3d?.requestCameraReset({
|
|
36
41
|
durationMs: durationMilliseconds,
|
|
37
42
|
snapshot: (scene, camera) => {
|
|
38
43
|
const { center, radius } = scene.boundingSphereVisible;
|
|
39
|
-
|
|
44
|
+
const framed = Math.max(radius * (1 + FRAMING_MARGIN), MIN_FRAMING_RADIUS);
|
|
45
|
+
return fromFront
|
|
46
|
+
? camera.getFocus(center, framed, FRONT_UP, FRONT_DIRECTION)
|
|
47
|
+
: camera.getFocus(center, framed);
|
|
40
48
|
},
|
|
41
49
|
});
|
|
42
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/camera.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,wCAAwC,CAAC;AAG9D,8EAA8E;AAC9E,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAE3C,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAG,CAAC,CAAC;AAExC;;;;;;;GAOG;AACH,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B,sDAAsD;AACtD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAEvC,+EAA+E;AAC/E,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B
|
|
1
|
+
{"version":3,"file":"camera.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/camera.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,wCAAwC,CAAC;AAG9D,8EAA8E;AAC9E,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAE3C,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAA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C;QACxB,SAAS,EAAE;YACT,OAAO,EAAE,QAAQ;gBACf,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;gBACtD,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;SAChC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -8,8 +8,10 @@ import type { Molecule3DViewer } from './viewer.ts';
|
|
|
8
8
|
* @param molfile - What to draw, or `null` to empty the scene.
|
|
9
9
|
* @param settings - How to draw it.
|
|
10
10
|
* @param measurements - What to draw over it.
|
|
11
|
-
* @param frameCamera -
|
|
11
|
+
* @param frameCamera - How to frame the camera once everything is there:
|
|
12
|
+
* `keep` glides to it along the current direction, `front` jumps to it looking
|
|
13
|
+
* down -z, `none` leaves the camera alone.
|
|
12
14
|
* @returns Nothing; resolves once the scene is complete.
|
|
13
15
|
*/
|
|
14
|
-
export declare function drawScene(viewer: Molecule3DViewer, molfile: Molecule3DFile | null, settings: Molecule3DSettings, measurements: readonly Measurement[], frameCamera:
|
|
16
|
+
export declare function drawScene(viewer: Molecule3DViewer, molfile: Molecule3DFile | null, settings: Molecule3DSettings, measurements: readonly Measurement[], frameCamera: 'none' | 'keep' | 'front'): Promise<void>;
|
|
15
17
|
//# sourceMappingURL=drawScene.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawScene.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/drawScene.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD
|
|
1
|
+
{"version":3,"file":"drawScene.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/drawScene.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;;;;;;;;;;GAWG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,cAAc,GAAG,IAAI,EAC9B,QAAQ,EAAE,kBAAkB,EAC5B,YAAY,EAAE,SAAS,WAAW,EAAE,EACpC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GACrC,OAAO,CAAC,IAAI,CAAC,CAqBf"}
|
|
@@ -6,7 +6,9 @@ import { normalizeMolecule3DSettings } from "../core/settings.js";
|
|
|
6
6
|
* @param molfile - What to draw, or `null` to empty the scene.
|
|
7
7
|
* @param settings - How to draw it.
|
|
8
8
|
* @param measurements - What to draw over it.
|
|
9
|
-
* @param frameCamera -
|
|
9
|
+
* @param frameCamera - How to frame the camera once everything is there:
|
|
10
|
+
* `keep` glides to it along the current direction, `front` jumps to it looking
|
|
11
|
+
* down -z, `none` leaves the camera alone.
|
|
10
12
|
* @returns Nothing; resolves once the scene is complete.
|
|
11
13
|
*/
|
|
12
14
|
export async function drawScene(viewer, molfile, settings, measurements, frameCamera) {
|
|
@@ -28,7 +30,9 @@ export async function drawScene(viewer, molfile, settings, measurements, frameCa
|
|
|
28
30
|
});
|
|
29
31
|
}
|
|
30
32
|
await viewer.showMeasurements(measurements);
|
|
31
|
-
if (frameCamera)
|
|
33
|
+
if (frameCamera === 'keep')
|
|
32
34
|
await viewer.resetCamera();
|
|
35
|
+
if (frameCamera === 'front')
|
|
36
|
+
await viewer.resetCamera(0, true);
|
|
33
37
|
}
|
|
34
38
|
//# sourceMappingURL=drawScene.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawScene.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/drawScene.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAIlE
|
|
1
|
+
{"version":3,"file":"drawScene.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/drawScene.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAIlE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,MAAwB,EACxB,OAA8B,EAC9B,QAA4B,EAC5B,YAAoC,EACpC,WAAsC;IAEtC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;QAC5B,OAAO;IACT,CAAC;IACD,MAAM,IAAI,GAAG,2BAA2B,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE;QACjC,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC,CAAC;IACH,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,MAAM,MAAM,CAAC,WAAW,CAAC;YACvB,KAAK,EAAE,IAAI,CAAC,YAAY;YACxB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,eAAe;YAC9B,KAAK,EAAE,IAAI,CAAC,YAAY;SACzB,CAAC,CAAC;IACL,CAAC;IACD,MAAM,MAAM,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC5C,IAAI,WAAW,KAAK,MAAM;QAAE,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;IACvD,IAAI,WAAW,KAAK,OAAO;QAAE,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -12,6 +12,14 @@ import type { Molecule3DFile, Molecule3DSettings, Molecule3DTools } from '../cor
|
|
|
12
12
|
export interface MoleculeViewer3DProps {
|
|
13
13
|
/** The molecule to draw, with 3D coordinates, or `null` for none. */
|
|
14
14
|
molfile: Molecule3DFile | null;
|
|
15
|
+
/**
|
|
16
|
+
* How the camera meets a new molecule. `keep` glides to it along the current
|
|
17
|
+
* direction, which suits conformers of one molecule; `front` jumps to it
|
|
18
|
+
* looking down -z with y up, so unrelated molecules, each laid out in its
|
|
19
|
+
* file the way it reads best, never swing in from the previous view.
|
|
20
|
+
* @default 'keep'
|
|
21
|
+
*/
|
|
22
|
+
frameNewMolecule?: 'keep' | 'front';
|
|
15
23
|
/**
|
|
16
24
|
* Which buttons the toolbar over the canvas shows; tools not named stay on.
|
|
17
25
|
* @default every tool
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moleculeViewer3DProps.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/moleculeViewer3DProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,qEAAqE;IACrE,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9C;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,k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AAO,CAAC;IACpC;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9C;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC1D;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IACtC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,KAAK,IAAI,CAAC;IACtE;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,SAAS,CAAC;CACjE"}
|
|
@@ -81,9 +81,10 @@ export declare class Molecule3DViewer {
|
|
|
81
81
|
/**
|
|
82
82
|
* Frame everything on screen.
|
|
83
83
|
* @param durationMilliseconds - Transition length; 0 jumps.
|
|
84
|
+
* @param fromFront - Look down -z with y up instead of keeping the direction.
|
|
84
85
|
* @returns Nothing; resolves once the move has been ordered.
|
|
85
86
|
*/
|
|
86
|
-
resetCamera(durationMilliseconds?: number): Promise<void>;
|
|
87
|
+
resetCamera(durationMilliseconds?: number, fromFront?: boolean): Promise<void>;
|
|
87
88
|
/**
|
|
88
89
|
* Turn the automatic spin on or off.
|
|
89
90
|
* @param spinning - Whether the scene should keep turning.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewer.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/viewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAe1D,OAAO,KAAK,EACV,uBAAuB,EACvB,aAAa,EACb,YAAY,EACb,MAAM,kBAAkB,CAAC;AAE1B;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,WAAW,EACtB,OAAO,GAAE,uBAA4B,GACpC,gBAAgB,CAElB;AAED;;;GAGG;AACH,qBAAa,gBAAgB;;IAK3B,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9B;;;;OAIG;gBACS,SAAS,EAAE,WAAW,EAAE,OAAO,GAAE,uBAA4B;IAyBzE;;;;;;OAMG;IACH,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAO3E;;;OAGG;IACH,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAO7B;;;;OAIG;IACH,WAAW,CAAC,KAAK,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhD;;;OAGG;IACH,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;;OAIG;IACH,gBAAgB,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,GAAG,OAAO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CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrE;;;;OAIG;IACH,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAM3D;;;;;;OAMG;IACH,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAgB1D;;;;;OAKG;IACH,WAAW,CACT,oBAAoB,SAA0B,EAC9C,SAAS,UAAQ,GAChB,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,SAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMrE,kEAAkE;IAClE,YAAY,IAAI,IAAI;IAKpB,sEAAsE;IACtE,OAAO,IAAI,IAAI;CAwBhB"}
|
|
@@ -145,11 +145,12 @@ export class Molecule3DViewer {
|
|
|
145
145
|
/**
|
|
146
146
|
* Frame everything on screen.
|
|
147
147
|
* @param durationMilliseconds - Transition length; 0 jumps.
|
|
148
|
+
* @param fromFront - Look down -z with y up instead of keeping the direction.
|
|
148
149
|
* @returns Nothing; resolves once the move has been ordered.
|
|
149
150
|
*/
|
|
150
|
-
resetCamera(durationMilliseconds = DEFAULT_CAMERA_DURATION) {
|
|
151
|
+
resetCamera(durationMilliseconds = DEFAULT_CAMERA_DURATION, fromFront = false) {
|
|
151
152
|
return this.#run((plugin) => {
|
|
152
|
-
resetCamera(plugin, durationMilliseconds);
|
|
153
|
+
resetCamera(plugin, durationMilliseconds, fromFront);
|
|
153
154
|
});
|
|
154
155
|
}
|
|
155
156
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewer.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/viewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAE9E,4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Ac,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC"}
|
package/lib/vite.js
CHANGED
package/lib/vite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"vite.js","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-cheminfo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"./styles/*.css"
|
|
16
16
|
],
|
|
17
17
|
"exports": {
|
|
18
|
+
"./build-info": "./lib/build-info.js",
|
|
18
19
|
"./core": "./lib/core.js",
|
|
19
20
|
"./molecule3d": "./lib/molecule3d.js",
|
|
20
21
|
"./orbital": "./lib/orbital.js",
|
package/src/about/core/about.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BuildInfo } from '../../build/core/buildInfo.ts';
|
|
1
2
|
import type { CitedWork } from '../../citation/core/works.ts';
|
|
2
3
|
import type { CreditEntry, CreditId } from '../../credits/core/credits.ts';
|
|
3
4
|
import { credits } from '../../credits/core/credits.ts';
|
|
@@ -17,8 +18,12 @@ import { providers } from './providers.ts';
|
|
|
17
18
|
* each crediting a different half of what it runs on.
|
|
18
19
|
*/
|
|
19
20
|
export interface AboutContent {
|
|
20
|
-
/**
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The site the page belongs to: its id, or the record itself for a site that
|
|
23
|
+
* is deliberately not listed in the family's Tools menu and therefore not in
|
|
24
|
+
* `ECOSYSTEM_SITES`.
|
|
25
|
+
*/
|
|
26
|
+
siteId: SiteId | EcosystemSite;
|
|
22
27
|
/** One sentence: what this tool is. */
|
|
23
28
|
what: string;
|
|
24
29
|
/**
|
|
@@ -59,10 +64,11 @@ export interface AboutContent {
|
|
|
59
64
|
*/
|
|
60
65
|
repository?: string;
|
|
61
66
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
67
|
+
* Which build is running, from `virtual:cheminfo-build-info` — never written
|
|
68
|
+
* by hand, which is what keeps it true after the next release.
|
|
69
|
+
* @default undefined — the site's build does not publish one
|
|
64
70
|
*/
|
|
65
|
-
|
|
71
|
+
build?: BuildInfo;
|
|
66
72
|
/**
|
|
67
73
|
* Where a problem is reported.
|
|
68
74
|
* @default the repository's /issues
|
|
@@ -102,8 +108,8 @@ export interface ResolvedAbout {
|
|
|
102
108
|
providedBy: ProviderEntry[];
|
|
103
109
|
license: string;
|
|
104
110
|
repository: string;
|
|
105
|
-
/**
|
|
106
|
-
|
|
111
|
+
/** Which build is running, or `undefined` when the site does not say. */
|
|
112
|
+
build: BuildInfo | undefined;
|
|
107
113
|
issues: string;
|
|
108
114
|
}
|
|
109
115
|
|
|
@@ -116,7 +122,10 @@ export interface ResolvedAbout {
|
|
|
116
122
|
* credits nobody.
|
|
117
123
|
*/
|
|
118
124
|
export function resolveAbout(content: AboutContent): ResolvedAbout {
|
|
119
|
-
const site =
|
|
125
|
+
const site =
|
|
126
|
+
typeof content.siteId === 'string'
|
|
127
|
+
? siteById(content.siteId)
|
|
128
|
+
: content.siteId;
|
|
120
129
|
const repository = content.repository ?? site.repository;
|
|
121
130
|
|
|
122
131
|
return {
|
|
@@ -130,7 +139,7 @@ export function resolveAbout(content: AboutContent): ResolvedAbout {
|
|
|
130
139
|
providedBy: providers(content.providedBy ?? []),
|
|
131
140
|
license: content.license ?? DEFAULT_LICENSE,
|
|
132
141
|
repository,
|
|
133
|
-
|
|
142
|
+
build: content.build,
|
|
134
143
|
issues: content.issues ?? `${withoutTrailingSlash(repository)}/issues`,
|
|
135
144
|
};
|
|
136
145
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { BuildInfo } from '../../build/core/buildInfo.ts';
|
|
4
|
+
import { formatBuiltAt, shortCommit } from '../../build/core/buildInfo.ts';
|
|
5
|
+
|
|
6
|
+
export interface AboutBuildProps {
|
|
7
|
+
/** What the build published about itself. */
|
|
8
|
+
build: BuildInfo;
|
|
9
|
+
/** Where the sources live, which is what the version and commit link into. */
|
|
10
|
+
repository: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The one line that says which build of the site a visitor has open.
|
|
15
|
+
*
|
|
16
|
+
* A report of something going wrong is worth answering only when we know what
|
|
17
|
+
* was running, and a visitor cannot read that off the page otherwise. The
|
|
18
|
+
* version and the commit link into the repository, so the change that caused a
|
|
19
|
+
* problem is one click from the page that shows it.
|
|
20
|
+
* @param props - See {@link AboutBuildProps}.
|
|
21
|
+
* @returns The line.
|
|
22
|
+
*/
|
|
23
|
+
export function AboutBuild(props: AboutBuildProps): ReactElement {
|
|
24
|
+
const { build, repository } = props;
|
|
25
|
+
const sources = repository.endsWith('/')
|
|
26
|
+
? repository.slice(0, -1)
|
|
27
|
+
: repository;
|
|
28
|
+
const onGitHub = sources.startsWith(GITHUB);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<p style={PARAGRAPH_STYLE}>
|
|
32
|
+
Running version{' '}
|
|
33
|
+
<Reference
|
|
34
|
+
href={
|
|
35
|
+
onGitHub ? `${sources}/releases/tag/v${build.version}` : undefined
|
|
36
|
+
}
|
|
37
|
+
>
|
|
38
|
+
{build.version}
|
|
39
|
+
</Reference>
|
|
40
|
+
, built {formatBuiltAt(build.builtAt)}
|
|
41
|
+
{build.commit === undefined ? null : (
|
|
42
|
+
<>
|
|
43
|
+
{' from commit '}
|
|
44
|
+
<Reference
|
|
45
|
+
href={onGitHub ? `${sources}/commit/${build.commit}` : undefined}
|
|
46
|
+
>
|
|
47
|
+
{shortCommit(build.commit)}
|
|
48
|
+
</Reference>
|
|
49
|
+
</>
|
|
50
|
+
)}
|
|
51
|
+
.
|
|
52
|
+
</p>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function Reference(props: {
|
|
57
|
+
href: string | undefined;
|
|
58
|
+
children: ReactNode;
|
|
59
|
+
}): ReactElement {
|
|
60
|
+
const { href, children } = props;
|
|
61
|
+
if (href === undefined) return <code style={CODE_STYLE}>{children}</code>;
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<a href={href} target="_blank" rel="noopener noreferrer" style={LINK_STYLE}>
|
|
65
|
+
<code style={CODE_STYLE}>{children}</code>
|
|
66
|
+
</a>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const GITHUB = 'https://github.com/';
|
|
71
|
+
|
|
72
|
+
const PARAGRAPH_STYLE = {
|
|
73
|
+
margin: '8px 0 0',
|
|
74
|
+
color: 'var(--text-muted)',
|
|
75
|
+
fontSize: 13,
|
|
76
|
+
} as const satisfies CSSProperties;
|
|
77
|
+
|
|
78
|
+
const CODE_STYLE = {
|
|
79
|
+
fontFamily: 'var(--font-mono, ui-monospace, monospace)',
|
|
80
|
+
fontSize: 13,
|
|
81
|
+
} as const satisfies CSSProperties;
|
|
82
|
+
|
|
83
|
+
const LINK_STYLE = { color: 'var(--accent)' } as const satisfies CSSProperties;
|
|
@@ -6,6 +6,7 @@ import { SiteMark } from '../../ecosystem/ui/marks.tsx';
|
|
|
6
6
|
import type { AboutContent } from '../core/about.ts';
|
|
7
7
|
import { resolveAbout } from '../core/about.ts';
|
|
8
8
|
|
|
9
|
+
import { AboutBuild } from './AboutBuild.tsx';
|
|
9
10
|
import { AboutCitations } from './AboutCitations.tsx';
|
|
10
11
|
import { AboutProvidedBy } from './AboutProvidedBy.tsx';
|
|
11
12
|
import { AboutSection } from './AboutSection.tsx';
|
|
@@ -25,6 +26,13 @@ export interface AboutPageProps {
|
|
|
25
26
|
* @default undefined
|
|
26
27
|
*/
|
|
27
28
|
children?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* The site's own mark, for a site the shared glyph set does not hold —
|
|
31
|
+
* one that is deliberately not listed in `ECOSYSTEM_SITES`. It stands where
|
|
32
|
+
* `SiteMark` would, and the hero is otherwise unchanged.
|
|
33
|
+
* @default undefined — the family's mark for that site
|
|
34
|
+
*/
|
|
35
|
+
mark?: ReactNode;
|
|
28
36
|
/**
|
|
29
37
|
* The site's own drawn lockup, for a site that has one. It stands in the
|
|
30
38
|
* hero in place of the mark and the written name, above the tagline, and
|
|
@@ -48,7 +56,7 @@ export interface AboutPageProps {
|
|
|
48
56
|
* @throws {Error} When the record names a site or a credit that does not exist.
|
|
49
57
|
*/
|
|
50
58
|
export function AboutPage(props: AboutPageProps): ReactElement {
|
|
51
|
-
const { content, className, children, logo } = props;
|
|
59
|
+
const { content, className, children, logo, mark } = props;
|
|
52
60
|
const about = resolveAbout(content);
|
|
53
61
|
const site = about.site;
|
|
54
62
|
|
|
@@ -63,10 +71,12 @@ export function AboutPage(props: AboutPageProps): ReactElement {
|
|
|
63
71
|
className="about-hero"
|
|
64
72
|
style={logo === undefined ? HERO_STYLE : LOGO_HERO_STYLE}
|
|
65
73
|
>
|
|
66
|
-
{logo === undefined
|
|
74
|
+
{logo === undefined
|
|
75
|
+
? (mark ?? <SiteMark site={site} size={56} />)
|
|
76
|
+
: null}
|
|
67
77
|
<div>
|
|
68
78
|
<h1 style={logo === undefined ? NAME_STYLE : LOGO_NAME_STYLE}>
|
|
69
|
-
{logo ?? <Wordmark
|
|
79
|
+
{logo ?? <Wordmark site={site} size={26} />}
|
|
70
80
|
</h1>
|
|
71
81
|
<p style={TAGLINE_STYLE}>{site.tagline}</p>
|
|
72
82
|
<p style={WHAT_STYLE}>{about.what}</p>
|
|
@@ -118,10 +128,8 @@ export function AboutPage(props: AboutPageProps): ReactElement {
|
|
|
118
128
|
piece of it into something else. The sources are at{' '}
|
|
119
129
|
<ExternalLink href={about.repository} />.
|
|
120
130
|
</p>
|
|
121
|
-
{about.
|
|
122
|
-
<
|
|
123
|
-
This page is running version {about.version}.
|
|
124
|
-
</p>
|
|
131
|
+
{about.build === undefined ? null : (
|
|
132
|
+
<AboutBuild build={about.build} repository={about.repository} />
|
|
125
133
|
)}
|
|
126
134
|
</AboutSection>
|
|
127
135
|
|
package/src/about/ui/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export type { AboutBuildProps } from './AboutBuild.tsx';
|
|
2
|
+
export { AboutBuild } from './AboutBuild.tsx';
|
|
1
3
|
export type { AboutCitationsProps } from './AboutCitations.tsx';
|
|
2
4
|
export { AboutCitations } from './AboutCitations.tsx';
|
|
3
5
|
export type { AboutPageProps } from './AboutPage.tsx';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a deployed page can say about itself: which release it is, when it was
|
|
3
|
+
* built, and from which commit.
|
|
4
|
+
*
|
|
5
|
+
* A site of ours is a link somebody handed out in a course, so the first
|
|
6
|
+
* question a report raises is *which one of these is running*. The record is
|
|
7
|
+
* filled by the build rather than written by hand — a version a human types
|
|
8
|
+
* into a source file is a version that is wrong by the next release.
|
|
9
|
+
*/
|
|
10
|
+
export interface BuildInfo {
|
|
11
|
+
/** The released version, from the package.json at the repository root. */
|
|
12
|
+
version: string;
|
|
13
|
+
/** When the build ran, as an ISO instant to the second: `2026-09-16T09:41:07Z`. */
|
|
14
|
+
builtAt: string;
|
|
15
|
+
/**
|
|
16
|
+
* The full commit the build was made from.
|
|
17
|
+
* @default undefined — the build could not see the repository
|
|
18
|
+
*/
|
|
19
|
+
commit?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The version of `react-cheminfo` the site is built against, which is what
|
|
22
|
+
* says whether a site is running the current chrome.
|
|
23
|
+
* @default undefined — the build could not read it
|
|
24
|
+
*/
|
|
25
|
+
reactCheminfo?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The commit as it is written for a reader.
|
|
30
|
+
* @param commit - The full hash.
|
|
31
|
+
* @returns Its first seven characters, which is what git itself shows.
|
|
32
|
+
*/
|
|
33
|
+
export function shortCommit(commit: string): string {
|
|
34
|
+
return commit.slice(0, SHORT_COMMIT_LENGTH);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The build instant as it is read on the page.
|
|
39
|
+
* @param builtAt - The ISO instant the build wrote.
|
|
40
|
+
* @returns The day and the time, in UTC, e.g. `2026-09-16 09:41:07 UTC`.
|
|
41
|
+
*/
|
|
42
|
+
export function formatBuiltAt(builtAt: string): string {
|
|
43
|
+
const seconds = builtAt.slice(0, SECOND_LENGTH).replace('T', ' ');
|
|
44
|
+
return `${seconds} UTC`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const SHORT_COMMIT_LENGTH = 7;
|
|
48
|
+
const SECOND_LENGTH = 19;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BuildInfo } from './buildInfo.ts';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Which build of the site is running, or `undefined` when nothing filled it in.
|
|
5
|
+
*
|
|
6
|
+
* The module is replaced at build time by `cheminfoBuildInfo`, which is what
|
|
7
|
+
* puts the real version, instant and commit here. It stays a real module rather
|
|
8
|
+
* than a virtual one so that a test, a Playwright spec or a backend can import
|
|
9
|
+
* the About record in plain Node: outside a build there is simply no record,
|
|
10
|
+
* and the About page leaves the line out.
|
|
11
|
+
*/
|
|
12
|
+
export const BUILD_INFO: BuildInfo | undefined = undefined;
|