react-cheminfo 0.39.1 → 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.
Files changed (96) hide show
  1. package/bin/check-deploy.mjs +4 -2
  2. package/lib/deploy/core/checkDeploy.d.ts +3 -1
  3. package/lib/deploy/core/checkDeploy.d.ts.map +1 -1
  4. package/lib/deploy/core/checkDeploy.js +8 -2
  5. package/lib/deploy/core/checkDeploy.js.map +1 -1
  6. package/lib/deploy/core/index.d.ts +1 -0
  7. package/lib/deploy/core/index.d.ts.map +1 -1
  8. package/lib/deploy/core/index.js +1 -0
  9. package/lib/deploy/core/index.js.map +1 -1
  10. package/lib/deploy/core/publishedImage.d.ts +30 -0
  11. package/lib/deploy/core/publishedImage.d.ts.map +1 -0
  12. package/lib/deploy/core/publishedImage.js +96 -0
  13. package/lib/deploy/core/publishedImage.js.map +1 -0
  14. package/lib/deploy/core/types.d.ts +1 -1
  15. package/lib/deploy/core/types.d.ts.map +1 -1
  16. package/lib/deploy/core/types.js.map +1 -1
  17. package/lib/molecule3d/ui/Molecule3DToolbar.d.ts +9 -7
  18. package/lib/molecule3d/ui/Molecule3DToolbar.d.ts.map +1 -1
  19. package/lib/molecule3d/ui/Molecule3DToolbar.js +13 -8
  20. package/lib/molecule3d/ui/Molecule3DToolbar.js.map +1 -1
  21. package/lib/molecule3d/ui/MoleculeCanvas3D.js +1 -1
  22. package/lib/molecule3d/ui/MoleculeCanvas3D.js.map +1 -1
  23. package/lib/molecule3d/ui/camera.d.ts +0 -11
  24. package/lib/molecule3d/ui/camera.d.ts.map +1 -1
  25. package/lib/molecule3d/ui/camera.js +6 -80
  26. package/lib/molecule3d/ui/camera.js.map +1 -1
  27. package/lib/molecule3d/ui/exportMoleculeImage.d.ts +6 -2
  28. package/lib/molecule3d/ui/exportMoleculeImage.d.ts.map +1 -1
  29. package/lib/molecule3d/ui/exportMoleculeImage.js.map +1 -1
  30. package/lib/molecule3d/ui/index.d.ts +9 -0
  31. package/lib/molecule3d/ui/index.d.ts.map +1 -1
  32. package/lib/molecule3d/ui/index.js +5 -0
  33. package/lib/molecule3d/ui/index.js.map +1 -1
  34. package/lib/molecule3d/ui/measurements.d.ts +22 -2
  35. package/lib/molecule3d/ui/measurements.d.ts.map +1 -1
  36. package/lib/molecule3d/ui/measurements.js +25 -3
  37. package/lib/molecule3d/ui/measurements.js.map +1 -1
  38. package/lib/molecule3d/ui/useImageExport.d.ts +2 -2
  39. package/lib/molecule3d/ui/useImageExport.d.ts.map +1 -1
  40. package/lib/molecule3d/ui/useImageExport.js.map +1 -1
  41. package/lib/molecule3d/ui/viewer.d.ts.map +1 -1
  42. package/lib/molecule3d/ui/viewer.js +16 -49
  43. package/lib/molecule3d/ui/viewer.js.map +1 -1
  44. package/lib/molstar/core/camera.d.ts +37 -0
  45. package/lib/molstar/core/camera.d.ts.map +1 -0
  46. package/lib/molstar/core/camera.js +49 -0
  47. package/lib/molstar/core/camera.js.map +1 -0
  48. package/lib/molstar/core/cameraPose.d.ts +54 -0
  49. package/lib/molstar/core/cameraPose.d.ts.map +1 -0
  50. package/lib/molstar/core/cameraPose.js +78 -0
  51. package/lib/molstar/core/cameraPose.js.map +1 -0
  52. package/lib/molstar/core/hover.d.ts +49 -0
  53. package/lib/molstar/core/hover.d.ts.map +1 -0
  54. package/lib/molstar/core/hover.js +91 -0
  55. package/lib/molstar/core/hover.js.map +1 -0
  56. package/lib/molstar/core/index.d.ts +7 -0
  57. package/lib/molstar/core/index.d.ts.map +1 -0
  58. package/lib/molstar/core/index.js +5 -0
  59. package/lib/molstar/core/index.js.map +1 -0
  60. package/lib/molstar/core/plugin.d.ts +80 -0
  61. package/lib/molstar/core/plugin.d.ts.map +1 -0
  62. package/lib/molstar/core/plugin.js +125 -0
  63. package/lib/molstar/core/plugin.js.map +1 -0
  64. package/lib/molstar.d.ts +18 -0
  65. package/lib/molstar.d.ts.map +1 -0
  66. package/lib/molstar.js +17 -0
  67. package/lib/molstar.js.map +1 -0
  68. package/lib/structure/ui/ConformerTable.d.ts +8 -0
  69. package/lib/structure/ui/ConformerTable.d.ts.map +1 -1
  70. package/lib/structure/ui/ConformerTable.js +24 -4
  71. package/lib/structure/ui/ConformerTable.js.map +1 -1
  72. package/package.json +2 -1
  73. package/src/deploy/core/checkDeploy.ts +14 -2
  74. package/src/deploy/core/index.ts +5 -0
  75. package/src/deploy/core/publishedImage.ts +110 -0
  76. package/src/deploy/core/types.ts +3 -1
  77. package/src/molecule3d/ui/Molecule3DToolbar.tsx +23 -16
  78. package/src/molecule3d/ui/MoleculeCanvas3D.tsx +1 -1
  79. package/src/molecule3d/ui/camera.ts +18 -93
  80. package/src/molecule3d/ui/exportMoleculeImage.ts +6 -2
  81. package/src/molecule3d/ui/index.ts +12 -0
  82. package/src/molecule3d/ui/measurements.ts +42 -3
  83. package/src/molecule3d/ui/useImageExport.ts +2 -2
  84. package/src/molecule3d/ui/viewer.ts +21 -51
  85. package/src/molstar/core/camera.ts +61 -0
  86. package/src/molstar/core/cameraPose.ts +126 -0
  87. package/src/molstar/core/hover.ts +109 -0
  88. package/src/molstar/core/index.ts +13 -0
  89. package/src/molstar/core/plugin.ts +159 -0
  90. package/src/molstar.ts +22 -0
  91. package/src/structure/ui/ConformerTable.tsx +38 -4
  92. package/lib/molecule3d/ui/viewerSpec.d.ts +0 -17
  93. package/lib/molecule3d/ui/viewerSpec.d.ts.map +0 -1
  94. package/lib/molecule3d/ui/viewerSpec.js +0 -34
  95. package/lib/molecule3d/ui/viewerSpec.js.map +0 -1
  96. 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('&nbsp;', ' ')
87
+ .replaceAll('&amp;', '&')
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,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AG,CAAC,EAAE,CAAC;AAClC,CAAC;AAED;;;GAGG;AACH,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK;SACT,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC;SAC3B,UAAU,CAAC,QAAQ,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":["../../../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AAE,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"}
@@ -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"}
@@ -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,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AO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAO7D,uCAAuC;AACvC,MAAM,WAAW,mBAAmB;IAClC,kDAAkD;IAClD,UAAU,EAAE,SAAS,YAAY,EAAE,CAAC;IACpC;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACrC;;;OAGG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,uDAAuD;IACvD,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IACjC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;IACxD;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,mBAAmB,GACzB,YAAY,GAAG,IAAI,CA6IrB"}
@@ -32,7 +32,7 @@ import { CONFORMER_COLUMN_LABELS, NUMERIC_CONFORMER_COLUMNS, PICKER_COLUMNS, } f
32
32
  * @returns The table, or `null` when there is nothing to show.
33
33
  */
34
34
  export function ConformerTable(props) {
35
- const { conformers, columns = PICKER_COLUMNS, ranking = 'force-field', selectedId = null, onSelect, temperature = ROOM_TEMPERATURE, label = 'Conformers, most stable first', rowName = String, columnLabels, } = props;
35
+ const { conformers, columns = PICKER_COLUMNS, ranking = 'force-field', selectedId = null, onSelect, temperature = ROOM_TEMPERATURE, label = 'Conformers, most stable first', rowName = String, columnLabels, provisional = false, } = props;
36
36
  const bodyRef = useRef(null);
37
37
  const shares = useMemo(() => {
38
38
  if (!columns.includes('population'))
@@ -93,7 +93,7 @@ export function ConformerTable(props) {
93
93
  return copyableHere &&
94
94
  COPY_LABELS[column] !== undefined &&
95
95
  typeof content === 'string' &&
96
- content !== '—' ? (_jsx(ClickToCopy, { as: "td", style: cellStyle(column), value: content, label: COPY_LABELS[column], testId: CELL_TEST_IDS[column], children: content }, column)) : (_jsx("td", { style: cellStyle(column), "data-testid": CELL_TEST_IDS[column], children: content }, column));
96
+ content !== '—' ? (_jsx(ClickToCopy, { as: "td", style: cellStyle(column, provisional), value: content, label: COPY_LABELS[column], testId: CELL_TEST_IDS[column], children: content }, column)) : (_jsx("td", { style: cellStyle(column, provisional), "data-testid": CELL_TEST_IDS[column], children: content }, column));
97
97
  }) }, conformer.id));
98
98
  }) })] }));
99
99
  }
@@ -200,14 +200,34 @@ const ENERGY_RESOLUTION = 0.005;
200
200
  function headerStyle(column) {
201
201
  return NUMERIC_CONFORMER_COLUMNS.has(column) ? numericStyle : undefined;
202
202
  }
203
- function cellStyle(column) {
204
- return NUMERIC_CONFORMER_COLUMNS.has(column) ? numericStyle : undefined;
203
+ /**
204
+ * A cell's own style: numbers are right-aligned and tabular, and every cell a
205
+ * better method will restate is muted while it works. The rank is not one of
206
+ * them — it names the row rather than measuring it, and it is what a reader
207
+ * follows as the order changes under them.
208
+ * @param column - The column the cell is in.
209
+ * @param provisional - Whether the energies are still expected to change.
210
+ * @returns The cell's inline style, or `undefined` when it needs none.
211
+ */
212
+ function cellStyle(column, provisional) {
213
+ const numeric = NUMERIC_CONFORMER_COLUMNS.has(column);
214
+ if (!provisional || column === 'id') {
215
+ return numeric ? numericStyle : undefined;
216
+ }
217
+ return numeric ? provisionalNumericStyle : provisionalStyle;
205
218
  }
206
219
  const tableStyle = { width: '100%' };
207
220
  const numericStyle = {
208
221
  textAlign: 'right',
209
222
  fontVariantNumeric: 'tabular-nums',
210
223
  };
224
+ const provisionalStyle = {
225
+ color: 'var(--text-muted)',
226
+ };
227
+ const provisionalNumericStyle = {
228
+ ...numericStyle,
229
+ ...provisionalStyle,
230
+ };
211
231
  /**
212
232
  * The selected row is tinted with the site's own accent, so the table belongs
213
233
  * to whichever site draws it; a row is a pointer only where a click does
@@ -1 +1 @@
1
- {"version":3,"file":"ConformerTable.js","sourceRoot":"","sources":["../../../src/structure/ui/ConformerTable.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAoC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EACL,gBAAgB,EAChB,eAAe,GAChB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI7E,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,cAAc,GACf,MAAM,uBAAuB,CAAC;AA8C/B;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC5B,KAA0B;IAE1B,MAAM,EACJ,UAAU,EACV,OAAO,GAAG,cAAc,EACxB,OAAO,GAAG,aAAa,EACvB,UAAU,GAAG,IAAI,EACjB,QAAQ,EACR,WAAW,GAAG,gBAAgB,EAC9B,KAAK,GAAG,+BAA+B,EACvC,OAAO,GAAG,MAAM,EAChB,YAAY,GACb,GAAG,KAAK,CAAC;IAEV,MAAM,OAAO,GAAG,MAAM,CAA0B,IAAI,CAAC,CAAC;IAEtD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QAC1B,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;YAAE,OAAO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EAAE,mDAAmD;IACpE,QAAQ,EAAE,QAAQ;CACc,CAAC;AAEnC,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,MAAM;IACd,YAAY,EAAE,CAAC;IACf,eAAe,EAAE,cAAc;CACC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-cheminfo",
3
- "version": "0.39.1",
3
+ "version": "0.40.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",
@@ -20,6 +20,7 @@
20
20
  "./core": "./lib/core.js",
21
21
  "./ir": "./lib/ir.js",
22
22
  "./molecule3d": "./lib/molecule3d.js",
23
+ "./molstar": "./lib/molstar.js",
23
24
  "./orbital": "./lib/orbital.js",
24
25
  "./slides": "./lib/slides.js",
25
26
  "./spectra": "./lib/spectra.js",
@@ -1,6 +1,11 @@
1
1
  import { readComposeFile } from './composeFile.ts';
2
2
  import { readEnvExample } from './envExample.ts';
3
3
  import { readPageCache } from './pageCache.ts';
4
+ import {
5
+ DOCKER_IMAGE_WORKFLOW,
6
+ readInstallRetries,
7
+ readPublishedImage,
8
+ } from './publishedImage.ts';
4
9
  import type { CheckDeployOptions, DeployFile, DeployProblem } from './types.ts';
5
10
  import { DEPLOY_COMPOSE_FILES } from './types.ts';
6
11
 
@@ -13,7 +18,9 @@ import { DEPLOY_COMPOSE_FILES } from './types.ts';
13
18
  * reports it healthy. So a repository has to hand it a selectable tag on every
14
19
  * image we build, an `IMAGE_NAME` that names the package our own workflow
15
20
  * publishes, a compose file that parses on a checkout with no `.env` yet, and a
16
- * health probe to read. It also has to hand the browser a page the browser will
21
+ * health probe to read. It also has to publish that image in the first place:
22
+ * with no `latest` to pull the script builds from source on the deploy host,
23
+ * and the install that follows must survive a blip in the registry. It also has to hand the browser a page the browser will
17
24
  * not keep, or the next deploy leaves returning visitors on a blank one. Each
18
25
  * of those is invisible until a deploy, which is the
19
26
  * worst moment to discover it — an `env_file` without `required: false` fails
@@ -72,7 +79,12 @@ export function findDeployProblems(
72
79
  }
73
80
 
74
81
  const dockerfile = byPath.get('Dockerfile');
75
- if (dockerfile !== undefined) readPageCache(dockerfile, byPath, problems);
82
+ if (dockerfile !== undefined) {
83
+ readPageCache(dockerfile, byPath, problems);
84
+ readInstallRetries(dockerfile, problems);
85
+ }
86
+
87
+ readPublishedImage(byPath.get(DOCKER_IMAGE_WORKFLOW), problems);
76
88
 
77
89
  const gitignore = byPath.get('.gitignore');
78
90
  if (gitignore === undefined || !/^\s*\/?\.deploy\/?\s*$/m.test(gitignore)) {
@@ -6,4 +6,9 @@ export type {
6
6
  DeployProblemKind,
7
7
  } from './types.ts';
8
8
  export { NGINX_CONFIG, PAGE_CACHE_CONFIG } from './pageCache.ts';
9
+ export {
10
+ DOCKER_IMAGE_WORKFLOW,
11
+ readInstallRetries,
12
+ readPublishedImage,
13
+ } from './publishedImage.ts';
9
14
  export { DEPLOY_COMPOSE_FILES } from './types.ts';