react-cheminfo 0.39.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/check-deploy.mjs +4 -2
- package/lib/deploy/core/checkDeploy.d.ts +3 -1
- package/lib/deploy/core/checkDeploy.d.ts.map +1 -1
- package/lib/deploy/core/checkDeploy.js +8 -2
- package/lib/deploy/core/checkDeploy.js.map +1 -1
- package/lib/deploy/core/index.d.ts +1 -0
- package/lib/deploy/core/index.d.ts.map +1 -1
- package/lib/deploy/core/index.js +1 -0
- package/lib/deploy/core/index.js.map +1 -1
- package/lib/deploy/core/publishedImage.d.ts +30 -0
- package/lib/deploy/core/publishedImage.d.ts.map +1 -0
- package/lib/deploy/core/publishedImage.js +96 -0
- package/lib/deploy/core/publishedImage.js.map +1 -0
- package/lib/deploy/core/types.d.ts +1 -1
- package/lib/deploy/core/types.d.ts.map +1 -1
- package/lib/deploy/core/types.js.map +1 -1
- package/lib/molecule3d/ui/Molecule3DToolbar.d.ts +9 -7
- package/lib/molecule3d/ui/Molecule3DToolbar.d.ts.map +1 -1
- package/lib/molecule3d/ui/Molecule3DToolbar.js +13 -8
- package/lib/molecule3d/ui/Molecule3DToolbar.js.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.js +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.js.map +1 -1
- package/lib/molecule3d/ui/camera.d.ts +0 -11
- package/lib/molecule3d/ui/camera.d.ts.map +1 -1
- package/lib/molecule3d/ui/camera.js +6 -80
- package/lib/molecule3d/ui/camera.js.map +1 -1
- package/lib/molecule3d/ui/exportMoleculeImage.d.ts +6 -2
- package/lib/molecule3d/ui/exportMoleculeImage.d.ts.map +1 -1
- package/lib/molecule3d/ui/exportMoleculeImage.js.map +1 -1
- package/lib/molecule3d/ui/index.d.ts +9 -0
- package/lib/molecule3d/ui/index.d.ts.map +1 -1
- package/lib/molecule3d/ui/index.js +5 -0
- package/lib/molecule3d/ui/index.js.map +1 -1
- package/lib/molecule3d/ui/measurements.d.ts +22 -2
- package/lib/molecule3d/ui/measurements.d.ts.map +1 -1
- package/lib/molecule3d/ui/measurements.js +25 -3
- package/lib/molecule3d/ui/measurements.js.map +1 -1
- package/lib/molecule3d/ui/useImageExport.d.ts +2 -2
- package/lib/molecule3d/ui/useImageExport.d.ts.map +1 -1
- package/lib/molecule3d/ui/useImageExport.js.map +1 -1
- package/lib/molecule3d/ui/viewer.d.ts.map +1 -1
- package/lib/molecule3d/ui/viewer.js +16 -49
- package/lib/molecule3d/ui/viewer.js.map +1 -1
- package/lib/molstar/core/camera.d.ts +37 -0
- package/lib/molstar/core/camera.d.ts.map +1 -0
- package/lib/molstar/core/camera.js +49 -0
- package/lib/molstar/core/camera.js.map +1 -0
- package/lib/molstar/core/cameraPose.d.ts +54 -0
- package/lib/molstar/core/cameraPose.d.ts.map +1 -0
- package/lib/molstar/core/cameraPose.js +78 -0
- package/lib/molstar/core/cameraPose.js.map +1 -0
- package/lib/molstar/core/hover.d.ts +49 -0
- package/lib/molstar/core/hover.d.ts.map +1 -0
- package/lib/molstar/core/hover.js +91 -0
- package/lib/molstar/core/hover.js.map +1 -0
- package/lib/molstar/core/index.d.ts +7 -0
- package/lib/molstar/core/index.d.ts.map +1 -0
- package/lib/molstar/core/index.js +5 -0
- package/lib/molstar/core/index.js.map +1 -0
- package/lib/molstar/core/plugin.d.ts +80 -0
- package/lib/molstar/core/plugin.d.ts.map +1 -0
- package/lib/molstar/core/plugin.js +125 -0
- package/lib/molstar/core/plugin.js.map +1 -0
- package/lib/molstar.d.ts +18 -0
- package/lib/molstar.d.ts.map +1 -0
- package/lib/molstar.js +17 -0
- package/lib/molstar.js.map +1 -0
- package/lib/share/ui/SharePreview.d.ts.map +1 -1
- package/lib/share/ui/SharePreview.js +25 -0
- package/lib/share/ui/SharePreview.js.map +1 -1
- package/lib/share/ui/useShareRegionReports.d.ts.map +1 -1
- package/lib/share/ui/useShareRegionReports.js +41 -12
- package/lib/share/ui/useShareRegionReports.js.map +1 -1
- package/lib/structure/ui/ConformerTable.d.ts +8 -0
- package/lib/structure/ui/ConformerTable.d.ts.map +1 -1
- package/lib/structure/ui/ConformerTable.js +24 -4
- package/lib/structure/ui/ConformerTable.js.map +1 -1
- package/package.json +2 -1
- package/src/deploy/core/checkDeploy.ts +14 -2
- package/src/deploy/core/index.ts +5 -0
- package/src/deploy/core/publishedImage.ts +110 -0
- package/src/deploy/core/types.ts +3 -1
- package/src/molecule3d/ui/Molecule3DToolbar.tsx +23 -16
- package/src/molecule3d/ui/MoleculeCanvas3D.tsx +1 -1
- package/src/molecule3d/ui/camera.ts +18 -93
- package/src/molecule3d/ui/exportMoleculeImage.ts +6 -2
- package/src/molecule3d/ui/index.ts +12 -0
- package/src/molecule3d/ui/measurements.ts +42 -3
- package/src/molecule3d/ui/useImageExport.ts +2 -2
- package/src/molecule3d/ui/viewer.ts +21 -51
- package/src/molstar/core/camera.ts +61 -0
- package/src/molstar/core/cameraPose.ts +126 -0
- package/src/molstar/core/hover.ts +109 -0
- package/src/molstar/core/index.ts +13 -0
- package/src/molstar/core/plugin.ts +159 -0
- package/src/molstar.ts +22 -0
- package/src/share/ui/SharePreview.tsx +31 -0
- package/src/share/ui/useShareRegionReports.ts +39 -15
- package/src/structure/ui/ConformerTable.tsx +38 -4
- package/lib/molecule3d/ui/viewerSpec.d.ts +0 -17
- package/lib/molecule3d/ui/viewerSpec.d.ts.map +0 -1
- package/lib/molecule3d/ui/viewerSpec.js +0 -34
- package/lib/molecule3d/ui/viewerSpec.js.map +0 -1
- package/src/molecule3d/ui/viewerSpec.ts +0 -38
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the pointer rests on, as a line of text.
|
|
3
|
+
*
|
|
4
|
+
* Every drawing our sites make carries a label already — `C1 sp³ σ to H5 (+)`,
|
|
5
|
+
* `C3 along [111]` — but molstar's own UI is not mounted, so nothing shows
|
|
6
|
+
* them. This turns the plugin's hover behaviour into that one string, which the
|
|
7
|
+
* canvas renders itself.
|
|
8
|
+
*/
|
|
9
|
+
import type { Loci } from 'molstar/lib/mol-model/loci.js';
|
|
10
|
+
import type { PluginContext } from 'molstar/lib/mol-plugin/context.js';
|
|
11
|
+
/**
|
|
12
|
+
* Report whatever the pointer rests on.
|
|
13
|
+
* @param plugin - The molstar context.
|
|
14
|
+
* @param listener - Called with the loci, or `null` when the pointer is over
|
|
15
|
+
* nothing. The pointer over the background reports an empty loci, whose label
|
|
16
|
+
* is the word "Nothing" — a sentence, not an absence — so it arrives as `null`.
|
|
17
|
+
* @returns The unsubscribe function.
|
|
18
|
+
*/
|
|
19
|
+
export declare function subscribeHover(plugin: PluginContext, listener: (loci: Loci | null) => void): () => void;
|
|
20
|
+
/**
|
|
21
|
+
* The one line a loci is worth, in molstar's own words.
|
|
22
|
+
* @param loci - What the pointer is over.
|
|
23
|
+
* @returns The label, stripped of the markup molstar writes into it, or `null`
|
|
24
|
+
* when there is nothing to say.
|
|
25
|
+
*/
|
|
26
|
+
export declare function lociText(loci: Loci): string | null;
|
|
27
|
+
/**
|
|
28
|
+
* The atoms a loci holds, in words a reader wants.
|
|
29
|
+
*
|
|
30
|
+
* molstar names one after the row it parsed — `xyz | Model 0 | Instance 1_555 |
|
|
31
|
+
* A | MOL 1 | O [idx 1]` — which is the address of a line in a file we wrote to
|
|
32
|
+
* hand it the atoms, and says nothing a student wants. The element and which
|
|
33
|
+
* atom of the scene it is do: the two hydrogens of water can then be told apart.
|
|
34
|
+
* @param loci - What the pointer rests on: an atom, or the two ends of a bond.
|
|
35
|
+
* @returns `O 1`, `Si 4 — O 8`, or `null` when the loci holds no atom.
|
|
36
|
+
*/
|
|
37
|
+
export declare function atomText(loci: Loci): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* What a site calls one atom of its scene.
|
|
40
|
+
*
|
|
41
|
+
* molstar upper-cases an element symbol on its way in, so the atom it hands
|
|
42
|
+
* back from an `Si` it was given is an `SI`, which is not how anybody writes
|
|
43
|
+
* silicon. The number is which atom of the scene it is, counting from one.
|
|
44
|
+
* @param element - Its element symbol, in any case.
|
|
45
|
+
* @param index - Its place in the file the viewer was handed, from zero.
|
|
46
|
+
* @returns `O 1`, `Si 4`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function atomName(element: string, index: number): string;
|
|
49
|
+
//# sourceMappingURL=hover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../../src/molstar/core/hover.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAO1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGvE;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,GACpC,MAAM,IAAI,CAQZ;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAIlD;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAiBlD;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAI/D"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the pointer rests on, as a line of text.
|
|
3
|
+
*
|
|
4
|
+
* Every drawing our sites make carries a label already — `C1 sp³ σ to H5 (+)`,
|
|
5
|
+
* `C3 along [111]` — but molstar's own UI is not mounted, so nothing shows
|
|
6
|
+
* them. This turns the plugin's hover behaviour into that one string, which the
|
|
7
|
+
* canvas renders itself.
|
|
8
|
+
*/
|
|
9
|
+
import { isEmptyLoci, isEveryLoci } from 'molstar/lib/mol-model/loci.js';
|
|
10
|
+
import { Bond, StructureElement, StructureProperties, } from 'molstar/lib/mol-model/structure.js';
|
|
11
|
+
import { lociLabel } from 'molstar/lib/mol-theme/label.js';
|
|
12
|
+
/**
|
|
13
|
+
* Report whatever the pointer rests on.
|
|
14
|
+
* @param plugin - The molstar context.
|
|
15
|
+
* @param listener - Called with the loci, or `null` when the pointer is over
|
|
16
|
+
* nothing. The pointer over the background reports an empty loci, whose label
|
|
17
|
+
* is the word "Nothing" — a sentence, not an absence — so it arrives as `null`.
|
|
18
|
+
* @returns The unsubscribe function.
|
|
19
|
+
*/
|
|
20
|
+
export function subscribeHover(plugin, listener) {
|
|
21
|
+
const subscription = plugin.behaviors.interaction.hover.subscribe((event) => {
|
|
22
|
+
const { loci } = event.current;
|
|
23
|
+
listener(isEmptyLoci(loci) || isEveryLoci(loci) ? null : loci);
|
|
24
|
+
});
|
|
25
|
+
return () => {
|
|
26
|
+
subscription.unsubscribe();
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The one line a loci is worth, in molstar's own words.
|
|
31
|
+
* @param loci - What the pointer is over.
|
|
32
|
+
* @returns The label, stripped of the markup molstar writes into it, or `null`
|
|
33
|
+
* when there is nothing to say.
|
|
34
|
+
*/
|
|
35
|
+
export function lociText(loci) {
|
|
36
|
+
if (isEmptyLoci(loci) || isEveryLoci(loci))
|
|
37
|
+
return null;
|
|
38
|
+
const label = stripMarkup(lociLabel(loci, { granularity: 'element' }));
|
|
39
|
+
return label === '' ? null : label;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The atoms a loci holds, in words a reader wants.
|
|
43
|
+
*
|
|
44
|
+
* molstar names one after the row it parsed — `xyz | Model 0 | Instance 1_555 |
|
|
45
|
+
* A | MOL 1 | O [idx 1]` — which is the address of a line in a file we wrote to
|
|
46
|
+
* hand it the atoms, and says nothing a student wants. The element and which
|
|
47
|
+
* atom of the scene it is do: the two hydrogens of water can then be told apart.
|
|
48
|
+
* @param loci - What the pointer rests on: an atom, or the two ends of a bond.
|
|
49
|
+
* @returns `O 1`, `Si 4 — O 8`, or `null` when the loci holds no atom.
|
|
50
|
+
*/
|
|
51
|
+
export function atomText(loci) {
|
|
52
|
+
const atoms = StructureElement.Loci.is(loci)
|
|
53
|
+
? loci
|
|
54
|
+
: Bond.isLoci(loci)
|
|
55
|
+
? Bond.toStructureElementLoci(loci)
|
|
56
|
+
: null;
|
|
57
|
+
if (atoms === null)
|
|
58
|
+
return null;
|
|
59
|
+
const names = [];
|
|
60
|
+
StructureElement.Loci.forEachLocation(atoms, (location) => {
|
|
61
|
+
names.push(atomName(String(StructureProperties.atom.type_symbol(location)), StructureProperties.atom.sourceIndex(location)));
|
|
62
|
+
});
|
|
63
|
+
return names.length === 0 ? null : names.join(' — ');
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* What a site calls one atom of its scene.
|
|
67
|
+
*
|
|
68
|
+
* molstar upper-cases an element symbol on its way in, so the atom it hands
|
|
69
|
+
* back from an `Si` it was given is an `SI`, which is not how anybody writes
|
|
70
|
+
* silicon. The number is which atom of the scene it is, counting from one.
|
|
71
|
+
* @param element - Its element symbol, in any case.
|
|
72
|
+
* @param index - Its place in the file the viewer was handed, from zero.
|
|
73
|
+
* @returns `O 1`, `Si 4`.
|
|
74
|
+
*/
|
|
75
|
+
export function atomName(element, index) {
|
|
76
|
+
const symbol = element.charAt(0).toUpperCase() + element.slice(1).toLowerCase();
|
|
77
|
+
return `${symbol} ${index + 1}`;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Molstar's label providers return HTML, and a readout is plain text.
|
|
81
|
+
* @param label
|
|
82
|
+
*/
|
|
83
|
+
function stripMarkup(label) {
|
|
84
|
+
return label
|
|
85
|
+
.replaceAll(/<[^>]*>/g, ' ')
|
|
86
|
+
.replaceAll(' ', ' ')
|
|
87
|
+
.replaceAll('&', '&')
|
|
88
|
+
.replaceAll(/\s+/g, ' ')
|
|
89
|
+
.trim();
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=hover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hover.js","sourceRoot":"","sources":["../../../src/molstar/core/hover.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EACL,IAAI,EACJ,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAqB,EACrB,QAAqC;IAErC,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1E,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC;QAC/B,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,EAAE;QACV,YAAY,CAAC,WAAW,EAAE,CAAC;IAC7B,CAAC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAU;IACjC,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACxD,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACvE,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAC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,EAAE,GAAG,CAAC;SACzB,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC;SACxB,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC;SACvB,IAAI,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { CameraPose, CameraReference, PoseOptions } from './cameraPose.ts';
|
|
2
|
+
export { cameraToPose, poseToCamera } from './cameraPose.ts';
|
|
3
|
+
export { DEFAULT_CAMERA_DURATION, DEFAULT_SPIN_SPEED, FRAMING_MARGIN, MINIMUM_FRAMING_RADIUS, framedRadius, setSpin, } from './camera.ts';
|
|
4
|
+
export { atomName, atomText, lociText, subscribeHover } from './hover.ts';
|
|
5
|
+
export type { MolstarPluginOptions } from './plugin.ts';
|
|
6
|
+
export { MolstarPlugin } from './plugin.ts';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molstar/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,YAAY,EACZ,OAAO,GACR,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1E,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { cameraToPose, poseToCamera } from "./cameraPose.js";
|
|
2
|
+
export { DEFAULT_CAMERA_DURATION, DEFAULT_SPIN_SPEED, FRAMING_MARGIN, MINIMUM_FRAMING_RADIUS, framedRadius, setSpin, } from "./camera.js";
|
|
3
|
+
export { atomName, atomText, lociText, subscribeHover } from "./hover.js";
|
|
4
|
+
export { MolstarPlugin } from "./plugin.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molstar/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,YAAY,EACZ,OAAO,GACR,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lifecycle of one headless molstar canvas: created now, disposed whenever,
|
|
3
|
+
* every call queued behind initialisation.
|
|
4
|
+
*
|
|
5
|
+
* The constructor is **synchronous** on purpose. React 19 runs an effect, its
|
|
6
|
+
* cleanup and the effect again on every mount in development, so an `await`ed
|
|
7
|
+
* constructor hands the cleanup nothing to dispose and leaks a WebGL context
|
|
8
|
+
* per mount — browsers drop the oldest after about sixteen, and the viewer
|
|
9
|
+
* silently goes blank. Returning the handle immediately means `dispose()` can
|
|
10
|
+
* always be called, even before initialisation has finished; the work is queued
|
|
11
|
+
* behind `ready`.
|
|
12
|
+
*
|
|
13
|
+
* molstar's own UI is never mounted: every control on our sites is ours.
|
|
14
|
+
*/
|
|
15
|
+
import type { PluginContext } from 'molstar/lib/mol-plugin/context.js';
|
|
16
|
+
import type { PluginSpec } from 'molstar/lib/mol-plugin/spec.js';
|
|
17
|
+
/** Settings fixed for the life of a plugin. */
|
|
18
|
+
export interface MolstarPluginOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Scene background, as `#rrggbb`. A WebGL clear colour, so it cannot be a CSS
|
|
21
|
+
* custom property.
|
|
22
|
+
* @default '#ffffff'
|
|
23
|
+
*/
|
|
24
|
+
background?: string;
|
|
25
|
+
/**
|
|
26
|
+
* How long molstar animates a reframe it decided on itself; 0 jumps.
|
|
27
|
+
*
|
|
28
|
+
* Replacing a scene commits several times — the old drawing is deleted, the
|
|
29
|
+
* new one added — and molstar glides the camera on each, so the model appears
|
|
30
|
+
* to drift into place. Reframing is right; animating it between two unrelated
|
|
31
|
+
* scenes is not.
|
|
32
|
+
* @default molstar's own 250 ms
|
|
33
|
+
*/
|
|
34
|
+
cameraResetDurationMilliseconds?: number;
|
|
35
|
+
/**
|
|
36
|
+
* The last word on the spec, applied over everything above: a site that needs
|
|
37
|
+
* a behaviour dropped, a marking colour or a renderer setting of its own
|
|
38
|
+
* passes it here rather than mounting its own view model.
|
|
39
|
+
*/
|
|
40
|
+
spec?: (spec: PluginSpec) => PluginSpec;
|
|
41
|
+
}
|
|
42
|
+
/** One molstar canvas, and the queue everything drawn on it goes through. */
|
|
43
|
+
export declare class MolstarPlugin {
|
|
44
|
+
#private;
|
|
45
|
+
/** Resolves once the canvas exists; every call awaits it internally. */
|
|
46
|
+
readonly ready: Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Mount a canvas in `container` and start initialising it.
|
|
49
|
+
* @param container - An element with `position: relative`; molstar inserts
|
|
50
|
+
* its own canvas into it.
|
|
51
|
+
* @param options - See {@link MolstarPluginOptions}.
|
|
52
|
+
*/
|
|
53
|
+
constructor(container: HTMLElement, options?: MolstarPluginOptions);
|
|
54
|
+
/** Whether {@link dispose} has been called. */
|
|
55
|
+
get disposed(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Wait for initialisation, then run `action` on the plugin.
|
|
58
|
+
* @param action - What to do with the molstar context.
|
|
59
|
+
* @returns What `action` returned, or `undefined` once the plugin has been
|
|
60
|
+
* disposed — before the call or while `action` was still running. An
|
|
61
|
+
* initialisation failure, and anything `action` throws while the plugin is
|
|
62
|
+
* alive, still reach the caller.
|
|
63
|
+
*/
|
|
64
|
+
run<Result>(action: (plugin: PluginContext) => Result | Promise<Result>): Promise<Result | undefined>;
|
|
65
|
+
/**
|
|
66
|
+
* Start a subscription once the plugin exists.
|
|
67
|
+
* @param start - Subscribes, and returns its own unsubscribe function.
|
|
68
|
+
* @returns A function that stops the subscription, or stops it from ever
|
|
69
|
+
* starting; safe to call at any time.
|
|
70
|
+
*/
|
|
71
|
+
subscribe(start: (plugin: PluginContext) => () => void): () => void;
|
|
72
|
+
/** Re-read the container's size. Call from a `ResizeObserver`. */
|
|
73
|
+
handleResize(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Tear the canvas down and release its WebGL context. Idempotent, and safe to
|
|
76
|
+
* call before initialisation has finished.
|
|
77
|
+
*/
|
|
78
|
+
dispose(): void;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/molstar/core/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAKjE,+CAA+C;AAC/C,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;OAQG;IACH,+BAA+B,CAAC,EAAE,MAAM,CAAC;IACzC;;;;OAIG;IACH,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,UAAU,CAAC;CACzC;AAED,6EAA6E;AAC7E,qBAAa,aAAa;;IAIxB,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9B;;;;;OAKG;gBACS,SAAS,EAAE,WAAW,EAAE,OAAO,GAAE,oBAAyB;IA0BtE,+CAA+C;IAC/C,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;;;;;;OAOG;IACG,GAAG,CAAC,MAAM,EACd,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAC1D,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAY9B;;;;;OAKG;IACH,SAAS,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,MAAM,IAAI,GAAG,MAAM,IAAI;IAcnE,kEAAkE;IAClE,YAAY,IAAI,IAAI;IAKpB;;;OAGG;IACH,OAAO,IAAI,IAAI;CAahB"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lifecycle of one headless molstar canvas: created now, disposed whenever,
|
|
3
|
+
* every call queued behind initialisation.
|
|
4
|
+
*
|
|
5
|
+
* The constructor is **synchronous** on purpose. React 19 runs an effect, its
|
|
6
|
+
* cleanup and the effect again on every mount in development, so an `await`ed
|
|
7
|
+
* constructor hands the cleanup nothing to dispose and leaks a WebGL context
|
|
8
|
+
* per mount — browsers drop the oldest after about sixteen, and the viewer
|
|
9
|
+
* silently goes blank. Returning the handle immediately means `dispose()` can
|
|
10
|
+
* always be called, even before initialisation has finished; the work is queued
|
|
11
|
+
* behind `ready`.
|
|
12
|
+
*
|
|
13
|
+
* molstar's own UI is never mounted: every control on our sites is ours.
|
|
14
|
+
*/
|
|
15
|
+
import { PluginViewModel } from 'molstar/lib/extensions/plugin/view-model.js';
|
|
16
|
+
// Lowercased on import: it is a factory, not a constructor.
|
|
17
|
+
import { DefaultPluginSpec as defaultPluginSpec } from 'molstar/lib/mol-plugin/spec.js';
|
|
18
|
+
import { Color } from 'molstar/lib/mol-util/color/color.js';
|
|
19
|
+
/** One molstar canvas, and the queue everything drawn on it goes through. */
|
|
20
|
+
export class MolstarPlugin {
|
|
21
|
+
#model;
|
|
22
|
+
#disposed = false;
|
|
23
|
+
/** Resolves once the canvas exists; every call awaits it internally. */
|
|
24
|
+
ready;
|
|
25
|
+
/**
|
|
26
|
+
* Mount a canvas in `container` and start initialising it.
|
|
27
|
+
* @param container - An element with `position: relative`; molstar inserts
|
|
28
|
+
* its own canvas into it.
|
|
29
|
+
* @param options - See {@link MolstarPluginOptions}.
|
|
30
|
+
*/
|
|
31
|
+
constructor(container, options = {}) {
|
|
32
|
+
const { background = '#ffffff', // tokens-ok: a WebGL clear colour
|
|
33
|
+
cameraResetDurationMilliseconds, spec: refine, } = options;
|
|
34
|
+
const base = defaultPluginSpec();
|
|
35
|
+
const spec = {
|
|
36
|
+
...base,
|
|
37
|
+
canvas3d: {
|
|
38
|
+
...base.canvas3d,
|
|
39
|
+
renderer: { backgroundColor: Color.fromHexStyle(background) },
|
|
40
|
+
// A scene is read from its own shape, never from the world axes.
|
|
41
|
+
camera: { helper: { axes: { name: 'off', params: {} } } },
|
|
42
|
+
...(cameraResetDurationMilliseconds === undefined
|
|
43
|
+
? {}
|
|
44
|
+
: { cameraResetDurationMs: cameraResetDurationMilliseconds }),
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
this.#model = new PluginViewModel({
|
|
48
|
+
spec: refine === undefined ? spec : refine(spec),
|
|
49
|
+
});
|
|
50
|
+
this.#model.mount(container);
|
|
51
|
+
this.ready = this.#model.initialized;
|
|
52
|
+
}
|
|
53
|
+
/** Whether {@link dispose} has been called. */
|
|
54
|
+
get disposed() {
|
|
55
|
+
return this.#disposed;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Wait for initialisation, then run `action` on the plugin.
|
|
59
|
+
* @param action - What to do with the molstar context.
|
|
60
|
+
* @returns What `action` returned, or `undefined` once the plugin has been
|
|
61
|
+
* disposed — before the call or while `action` was still running. An
|
|
62
|
+
* initialisation failure, and anything `action` throws while the plugin is
|
|
63
|
+
* alive, still reach the caller.
|
|
64
|
+
*/
|
|
65
|
+
async run(action) {
|
|
66
|
+
if (this.#disposed)
|
|
67
|
+
return undefined;
|
|
68
|
+
await this.ready;
|
|
69
|
+
if (this.#disposed)
|
|
70
|
+
return undefined;
|
|
71
|
+
try {
|
|
72
|
+
return await action(this.#model.plugin);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
if (this.#disposed)
|
|
76
|
+
return undefined;
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Start a subscription once the plugin exists.
|
|
82
|
+
* @param start - Subscribes, and returns its own unsubscribe function.
|
|
83
|
+
* @returns A function that stops the subscription, or stops it from ever
|
|
84
|
+
* starting; safe to call at any time.
|
|
85
|
+
*/
|
|
86
|
+
subscribe(start) {
|
|
87
|
+
let stop = null;
|
|
88
|
+
let cancelled = false;
|
|
89
|
+
void this.run((plugin) => {
|
|
90
|
+
if (cancelled)
|
|
91
|
+
return;
|
|
92
|
+
stop = start(plugin);
|
|
93
|
+
});
|
|
94
|
+
return () => {
|
|
95
|
+
cancelled = true;
|
|
96
|
+
stop?.();
|
|
97
|
+
stop = null;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/** Re-read the container's size. Call from a `ResizeObserver`. */
|
|
101
|
+
handleResize() {
|
|
102
|
+
if (this.#disposed)
|
|
103
|
+
return;
|
|
104
|
+
this.#model.plugin.handleResize();
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Tear the canvas down and release its WebGL context. Idempotent, and safe to
|
|
108
|
+
* call before initialisation has finished.
|
|
109
|
+
*/
|
|
110
|
+
dispose() {
|
|
111
|
+
if (this.#disposed)
|
|
112
|
+
return;
|
|
113
|
+
this.#disposed = true;
|
|
114
|
+
// `mount` creates the canvas synchronously, so the context exists even when
|
|
115
|
+
// initialisation went on to fail; releasing it is what stops the browser
|
|
116
|
+
// dropping an older viewer's. A rejected `ready` must not escape here
|
|
117
|
+
// either — nobody is left to handle it.
|
|
118
|
+
void this.ready
|
|
119
|
+
.catch(() => undefined)
|
|
120
|
+
.then(() => {
|
|
121
|
+
this.#model.plugin.dispose();
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/molstar/core/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAG9E,4DAA4D;AAC5D,OAAO,EAAE,iBAAiB,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AA4B5D,6EAA6E;AAC7E,MAAM,OAAO,aAAa;IACf,MAAM,CAAkB;IACjC,SAAS,GAAG,KAAK,CAAC;IAElB,wEAAwE;IAC/D,KAAK,CAAgB;IAE9B;;;;;OAKG;IACH,YAAY,SAAsB,EAAE,UAAgC,EAAE;QACpE,MAAM,EACJ,UAAU,GAAG,SAAS,EAAE,kCAAkC;QAC1D,+BAA+B,EAC/B,IAAI,EAAE,MAAM,GACb,GAAG,OAAO,CAAC;QACZ,MAAM,IAAI,GAAG,iBAAiB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAe;YACvB,GAAG,IAAI;YACP,QAAQ,EAAE;gBACR,GAAG,IAAI,CAAC,QAAQ;gBAChB,QAAQ,EAAE,EAAE,eAAe,EAAE,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE;gBAC7D,iEAAiE;gBACjE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE;gBACzD,GAAG,CAAC,+BAA+B,KAAK,SAAS;oBAC/C,CAAC,CAAC,EAAE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AI,EAAE,EAAE,CAAC;YACT,IAAI,GAAG,IAAI,CAAC;QACd,CAAC,CAAC;IACJ,CAAC;IAED,kEAAkE;IAClE,YAAY;QACV,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO;QAC3B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,4EAA4E;QAC5E,yEAAyE;QACzE,sEAAsE;QACtE,wCAAwC;QACxC,KAAK,IAAI,CAAC,KAAK;aACZ,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;aACtB,IAAI,CAAC,GAAG,EAAE;YACT,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAC/B,CAAC,CAAC,CAAC;IACP,CAAC;CACF"}
|
package/lib/molstar.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The molstar layer under the 3D views: the plugin lifecycle, the camera, the
|
|
3
|
+
* hover labels, the measurements and the picture of a scene.
|
|
4
|
+
*
|
|
5
|
+
* Three of our sites mount a headless molstar canvas — the molecule viewer
|
|
6
|
+
* here, lcao's orbitals and symmetry's crystals — and each of them had its own
|
|
7
|
+
* copy of the lifecycle, the spec and the spin. This is that one copy; what
|
|
8
|
+
* stays in a site is the scene it draws.
|
|
9
|
+
*
|
|
10
|
+
* **Importing this pulls molstar in statically.** A site that only wants
|
|
11
|
+
* `<MoleculeViewer3D>` imports `react-cheminfo/molecule3d`, whose canvas is
|
|
12
|
+
* lazy.
|
|
13
|
+
*/
|
|
14
|
+
export * from './molstar/core/index.ts';
|
|
15
|
+
export { captureScene } from './molecule3d/ui/captureScene.ts';
|
|
16
|
+
export type { MoleculeStructureSource } from './molecule3d/ui/measurements.ts';
|
|
17
|
+
export { atomReferenceOf, clearMeasurements, renderMeasurements, } from './molecule3d/ui/measurements.ts';
|
|
18
|
+
//# sourceMappingURL=molstar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"molstar.d.ts","sourceRoot":"","sources":["../src/molstar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,iCAAiC,CAAC"}
|
package/lib/molstar.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The molstar layer under the 3D views: the plugin lifecycle, the camera, the
|
|
3
|
+
* hover labels, the measurements and the picture of a scene.
|
|
4
|
+
*
|
|
5
|
+
* Three of our sites mount a headless molstar canvas — the molecule viewer
|
|
6
|
+
* here, lcao's orbitals and symmetry's crystals — and each of them had its own
|
|
7
|
+
* copy of the lifecycle, the spec and the spin. This is that one copy; what
|
|
8
|
+
* stays in a site is the scene it draws.
|
|
9
|
+
*
|
|
10
|
+
* **Importing this pulls molstar in statically.** A site that only wants
|
|
11
|
+
* `<MoleculeViewer3D>` imports `react-cheminfo/molecule3d`, whose canvas is
|
|
12
|
+
* lazy.
|
|
13
|
+
*/
|
|
14
|
+
export * from "./molstar/core/index.js";
|
|
15
|
+
export { captureScene } from "./molecule3d/ui/captureScene.js";
|
|
16
|
+
export { atomReferenceOf, clearMeasurements, renderMeasurements, } from "./molecule3d/ui/measurements.js";
|
|
17
|
+
//# sourceMappingURL=molstar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"molstar.js","sourceRoot":"","sources":["../src/molstar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,iCAAiC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharePreview.d.ts","sourceRoot":"","sources":["../../../src/share/ui/SharePreview.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SharePreview.d.ts","sourceRoot":"","sources":["../../../src/share/ui/SharePreview.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AA6BzD,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACpD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAyInE"}
|
|
@@ -10,6 +10,10 @@ import { SHARE_REGIONS_REQUEST, readShareRegions, sharePreviewAddress, sharePrev
|
|
|
10
10
|
import { SharePreviewDevices } from "./SharePreviewDevices.js";
|
|
11
11
|
/** Room the window's own bar takes, which the page is not scaled into. */
|
|
12
12
|
const CHROME_HEIGHT = 26;
|
|
13
|
+
/** How often the framed page is asked again while it has answered nothing. */
|
|
14
|
+
const ASK_INTERVAL = 300;
|
|
15
|
+
/** How many times, so a page with nothing to report is left alone. */
|
|
16
|
+
const ASK_LIMIT = 10;
|
|
13
17
|
/**
|
|
14
18
|
* The page as the link hands it out, live, beside the options that write it.
|
|
15
19
|
*
|
|
@@ -65,6 +69,27 @@ export function SharePreview(props) {
|
|
|
65
69
|
useEffect(() => {
|
|
66
70
|
mark.current?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
67
71
|
}, [highlight?.part]);
|
|
72
|
+
// The frame's own load says the document is there, never that the page it
|
|
73
|
+
// builds is listening: a React tree mounts in a task of its own, after it.
|
|
74
|
+
// So the question is repeated until it is answered — there is no event on
|
|
75
|
+
// this side to wait for, and a page that answers nothing is a page with no
|
|
76
|
+
// parts to point at, which costs ten messages and stops.
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (regions.length > 0)
|
|
79
|
+
return undefined;
|
|
80
|
+
let asked = 0;
|
|
81
|
+
const timer = setInterval(() => {
|
|
82
|
+
asked += 1;
|
|
83
|
+
if (asked > ASK_LIMIT) {
|
|
84
|
+
clearInterval(timer);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
frame.current?.contentWindow?.postMessage({ type: SHARE_REGIONS_REQUEST }, '*');
|
|
88
|
+
}, ASK_INTERVAL);
|
|
89
|
+
return () => {
|
|
90
|
+
clearInterval(timer);
|
|
91
|
+
};
|
|
92
|
+
}, [regions, src]);
|
|
68
93
|
return (_jsxs("section", { className: "share-preview", "aria-label": t('share.preview'), children: [_jsxs("header", { className: "share-preview__header", children: [_jsxs(H6, { className: "share-preview__label", children: [_jsx(Icon, { icon: "eye-open", size: 13 }), t('share.preview'), _jsx(HelpIcon, { content: help })] }), _jsx(SharePreviewDevices, { value: device, onChange: setDevice, windowSize: windowSize })] }), _jsx("div", { className: "share-preview__stage", ref: stage, children: _jsxs("div", { className: "share-preview__device", style: { width: page.width * scale }, children: [_jsxs("div", { className: "share-preview__chrome", children: [_jsx(Icon, { icon: "eye-open", size: 11 }), _jsx("span", { className: "share-preview__address", children: sharePreviewAddress(url) }), _jsx("span", { className: "share-preview__size", children: sizeNote(page.width, page.height, scale) })] }), _jsxs("div", { className: "share-preview__page", style: { height: page.height * scale }, children: [_jsx("iframe", { ref: frame, className: "share-preview__frame", src: src, title: title, style: frameStyle(page.width, page.height, scale), onLoad: () => {
|
|
69
94
|
// What the page before it reported is where its own parts
|
|
70
95
|
// were, so it is dropped rather than drawn over this one.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharePreview.js","sourceRoot":"","sources":["../../../src/share/ui/SharePreview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA2B,CAAC;AAEhE,0EAA0E;AAC1E,MAAM,aAAa,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"SharePreview.js","sourceRoot":"","sources":["../../../src/share/ui/SharePreview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCA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O,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO,MAAM,CAAC;IAC1C,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,WAAW,CAAC,MAAmB,EAAE,KAAa;IACrD,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,CAAC,GAAG,KAAK;QACtB,GAAG,EAAE,MAAM,CAAC,CAAC,GAAG,KAAK;QACrB,KAAK,EAAE,MAAM,CAAC,KAAK,GAAG,KAAK;QAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,KAAK;KAC9B,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CACjB,KAAa,EACb,MAAc,EACd,KAAa;IAEb,OAAO;QACL,KAAK;QACL,MAAM;QACN,MAAM,EAAE,CAAC;QACT,SAAS,EAAE,SAAS,KAAK,GAAG;QAC5B,eAAe,EAAE,UAAU;KAC5B,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa,EAAE,MAAc,EAAE,KAAa;IAC5D,MAAM,IAAI,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;IAClE,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC;AACtE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useShareRegionReports.d.ts","sourceRoot":"","sources":["../../../src/share/ui/useShareRegionReports.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"useShareRegionReports.d.ts","sourceRoot":"","sources":["../../../src/share/ui/useShareRegionReports.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,OAAO,CAiE1E"}
|
|
@@ -29,19 +29,46 @@ export function useShareRegionReports(hidden) {
|
|
|
29
29
|
if (!marking)
|
|
30
30
|
return undefined;
|
|
31
31
|
const host = globalThis.parent;
|
|
32
|
+
let scheduled = 0;
|
|
33
|
+
let reported = '';
|
|
32
34
|
function report() {
|
|
33
|
-
|
|
35
|
+
scheduled = 0;
|
|
36
|
+
const regions = measureRegions();
|
|
37
|
+
// A page that is drawing — a structure, a result, a chart — mutates many
|
|
38
|
+
// times a second while its boxes stay where they are, and every message
|
|
39
|
+
// sent re-renders the dialog on the other side. Only a move is news.
|
|
40
|
+
const signature = JSON.stringify(regions);
|
|
41
|
+
if (signature === reported)
|
|
42
|
+
return;
|
|
43
|
+
reported = signature;
|
|
44
|
+
host.postMessage({ type: SHARE_REGIONS_MESSAGE, regions }, '*');
|
|
45
|
+
}
|
|
46
|
+
// A search that returns, a structure that draws and a font that lands all
|
|
47
|
+
// move the boxes within a frame of each other, so the page is measured
|
|
48
|
+
// once after them rather than once per notification.
|
|
49
|
+
function schedule() {
|
|
50
|
+
if (scheduled === 0)
|
|
51
|
+
scheduled = requestAnimationFrame(report);
|
|
34
52
|
}
|
|
35
53
|
// A chart, a web font or a structure drawn after mount all move the boxes,
|
|
36
|
-
// so the page is measured again whenever anything in it
|
|
37
|
-
// than once, on a deadline it would lose.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
54
|
+
// so the page is measured again whenever anything in it changes rather
|
|
55
|
+
// than once, on a deadline it would lose. Watching its size is not enough:
|
|
56
|
+
// a page laid out to the height of the viewport keeps that height while a
|
|
57
|
+
// result appears inside a column of it, and the part nobody measured is
|
|
58
|
+
// the one the reader is pointing at.
|
|
59
|
+
const resizes = new ResizeObserver(schedule);
|
|
60
|
+
resizes.observe(document.documentElement);
|
|
61
|
+
resizes.observe(document.body);
|
|
62
|
+
const mutations = new MutationObserver(schedule);
|
|
63
|
+
mutations.observe(document.body, { childList: true, subtree: true });
|
|
64
|
+
globalThis.addEventListener('resize', schedule);
|
|
41
65
|
report();
|
|
42
66
|
return () => {
|
|
43
|
-
|
|
44
|
-
|
|
67
|
+
if (scheduled !== 0)
|
|
68
|
+
cancelAnimationFrame(scheduled);
|
|
69
|
+
resizes.disconnect();
|
|
70
|
+
mutations.disconnect();
|
|
71
|
+
globalThis.removeEventListener('resize', schedule);
|
|
45
72
|
};
|
|
46
73
|
}, [marking, hidden]);
|
|
47
74
|
return marking;
|
|
@@ -60,12 +87,14 @@ function measureRegions() {
|
|
|
60
87
|
const box = range.getBoundingClientRect();
|
|
61
88
|
if (box.width === 0 || box.height === 0)
|
|
62
89
|
continue;
|
|
90
|
+
// Rounded, so a layout that settles half a pixel to the left is not
|
|
91
|
+
// reported as a part that moved.
|
|
63
92
|
regions.push({
|
|
64
93
|
part,
|
|
65
|
-
x: box.x + globalThis.scrollX,
|
|
66
|
-
y: box.y + globalThis.scrollY,
|
|
67
|
-
width: box.width,
|
|
68
|
-
height: box.height,
|
|
94
|
+
x: Math.round(box.x + globalThis.scrollX),
|
|
95
|
+
y: Math.round(box.y + globalThis.scrollY),
|
|
96
|
+
width: Math.round(box.width),
|
|
97
|
+
height: Math.round(box.height),
|
|
69
98
|
});
|
|
70
99
|
}
|
|
71
100
|
return regions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useShareRegionReports.js","sourceRoot":"","sources":["../../../src/share/ui/useShareRegionReports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEhF;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAA2B;IAC/D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,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E;QACpE,iCAAiC;QACjC,OAAO,CAAC,IAAI,CAAC;YACX,IAAI;YACJ,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC;YACzC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC;YACzC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;YAC5B,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;SAC/B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -59,6 +59,14 @@ export interface ConformerTableProps {
|
|
|
59
59
|
* @default undefined — every column keeps its own
|
|
60
60
|
*/
|
|
61
61
|
columnLabels?: Partial<Record<ConformerColumn, string>>;
|
|
62
|
+
/**
|
|
63
|
+
* Whether the energies on screen are expected to be replaced — a force
|
|
64
|
+
* field's numbers while a better method is still working on the set. They
|
|
65
|
+
* are then drawn muted, so a reader can tell at a glance which of the two
|
|
66
|
+
* rankings they are looking at.
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
provisional?: boolean;
|
|
62
70
|
}
|
|
63
71
|
/**
|
|
64
72
|
* The conformers of a set, as a selectable table.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConformerTable.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/ConformerTable.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAgC,YAAY,EAAE,MAAM,OAAO,CAAC;AAUxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAO7D,u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