react-cheminfo 0.4.0 → 0.6.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 (119) hide show
  1. package/README.md +182 -34
  2. package/lib/ecosystem/core/index.d.ts +1 -1
  3. package/lib/ecosystem/core/index.d.ts.map +1 -1
  4. package/lib/ecosystem/core/index.js +1 -1
  5. package/lib/ecosystem/core/index.js.map +1 -1
  6. package/lib/ecosystem/core/lookup.d.ts +11 -0
  7. package/lib/ecosystem/core/lookup.d.ts.map +1 -1
  8. package/lib/ecosystem/core/lookup.js +15 -0
  9. package/lib/ecosystem/core/lookup.js.map +1 -1
  10. package/lib/ecosystem/core/sites.d.ts +1 -1
  11. package/lib/ecosystem/core/sites.d.ts.map +1 -1
  12. package/lib/ecosystem/core/sites.js +14 -4
  13. package/lib/ecosystem/core/sites.js.map +1 -1
  14. package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
  15. package/lib/ecosystem/ui/glyphs.js +4 -1
  16. package/lib/ecosystem/ui/glyphs.js.map +1 -1
  17. package/lib/orbital/ui/AtomicOrbitalCanvas.d.ts +5 -0
  18. package/lib/orbital/ui/AtomicOrbitalCanvas.d.ts.map +1 -1
  19. package/lib/orbital/ui/AtomicOrbitalCanvas.js +4 -3
  20. package/lib/orbital/ui/AtomicOrbitalCanvas.js.map +1 -1
  21. package/lib/orbital/ui/AtomicOrbitalViewer.d.ts +5 -0
  22. package/lib/orbital/ui/AtomicOrbitalViewer.d.ts.map +1 -1
  23. package/lib/orbital/ui/AtomicOrbitalViewer.js.map +1 -1
  24. package/lib/orbital/ui/axesGeometry.d.ts +27 -0
  25. package/lib/orbital/ui/axesGeometry.d.ts.map +1 -0
  26. package/lib/orbital/ui/axesGeometry.js +74 -0
  27. package/lib/orbital/ui/axesGeometry.js.map +1 -0
  28. package/lib/orbital/ui/camera.d.ts +7 -0
  29. package/lib/orbital/ui/camera.d.ts.map +1 -1
  30. package/lib/orbital/ui/camera.js +8 -1
  31. package/lib/orbital/ui/camera.js.map +1 -1
  32. package/lib/orbital/ui/renderAxes.d.ts +53 -0
  33. package/lib/orbital/ui/renderAxes.d.ts.map +1 -0
  34. package/lib/orbital/ui/renderAxes.js +110 -0
  35. package/lib/orbital/ui/renderAxes.js.map +1 -0
  36. package/lib/orbital/ui/viewer.d.ts +16 -0
  37. package/lib/orbital/ui/viewer.d.ts.map +1 -1
  38. package/lib/orbital/ui/viewer.js +24 -2
  39. package/lib/orbital/ui/viewer.js.map +1 -1
  40. package/lib/seo/core/documentMeta.d.ts +2 -2
  41. package/lib/seo/core/documentMeta.js +4 -3
  42. package/lib/seo/core/documentMeta.js.map +1 -1
  43. package/lib/seo/core/index.d.ts +15 -0
  44. package/lib/seo/core/index.d.ts.map +1 -1
  45. package/lib/seo/core/index.js +8 -0
  46. package/lib/seo/core/index.js.map +1 -1
  47. package/lib/seo/core/noscript.d.ts +97 -0
  48. package/lib/seo/core/noscript.d.ts.map +1 -0
  49. package/lib/seo/core/noscript.js +93 -0
  50. package/lib/seo/core/noscript.js.map +1 -0
  51. package/lib/seo/core/pageMeta.d.ts +76 -0
  52. package/lib/seo/core/pageMeta.d.ts.map +1 -0
  53. package/lib/seo/core/pageMeta.js +88 -0
  54. package/lib/seo/core/pageMeta.js.map +1 -0
  55. package/lib/seo/core/robots.d.ts +55 -0
  56. package/lib/seo/core/robots.d.ts.map +1 -0
  57. package/lib/seo/core/robots.js +70 -0
  58. package/lib/seo/core/robots.js.map +1 -0
  59. package/lib/seo/core/routes.d.ts +120 -0
  60. package/lib/seo/core/routes.d.ts.map +1 -0
  61. package/lib/seo/core/routes.js +188 -0
  62. package/lib/seo/core/routes.js.map +1 -0
  63. package/lib/seo/core/siteFiles.d.ts +69 -0
  64. package/lib/seo/core/siteFiles.d.ts.map +1 -0
  65. package/lib/seo/core/siteFiles.js +84 -0
  66. package/lib/seo/core/siteFiles.js.map +1 -0
  67. package/lib/seo/core/startDocumentMeta.d.ts +44 -0
  68. package/lib/seo/core/startDocumentMeta.d.ts.map +1 -0
  69. package/lib/seo/core/startDocumentMeta.js +47 -0
  70. package/lib/seo/core/startDocumentMeta.js.map +1 -0
  71. package/lib/seo/core/structuredData.d.ts +48 -0
  72. package/lib/seo/core/structuredData.d.ts.map +1 -0
  73. package/lib/seo/core/structuredData.js +41 -0
  74. package/lib/seo/core/structuredData.js.map +1 -0
  75. package/lib/seo/core/template.d.ts +48 -0
  76. package/lib/seo/core/template.d.ts.map +1 -0
  77. package/lib/seo/core/template.js +53 -0
  78. package/lib/seo/core/template.js.map +1 -0
  79. package/lib/seo/vite/index.d.ts +5 -0
  80. package/lib/seo/vite/index.d.ts.map +1 -0
  81. package/lib/seo/vite/index.js +3 -0
  82. package/lib/seo/vite/index.js.map +1 -0
  83. package/lib/seo/vite/ogCard.d.ts +41 -0
  84. package/lib/seo/vite/ogCard.d.ts.map +1 -0
  85. package/lib/seo/vite/ogCard.js +82 -0
  86. package/lib/seo/vite/ogCard.js.map +1 -0
  87. package/lib/seo/vite/prerender.d.ts +89 -0
  88. package/lib/seo/vite/prerender.d.ts.map +1 -0
  89. package/lib/seo/vite/prerender.js +114 -0
  90. package/lib/seo/vite/prerender.js.map +1 -0
  91. package/lib/vite.d.ts +2 -0
  92. package/lib/vite.d.ts.map +1 -0
  93. package/lib/vite.js +2 -0
  94. package/lib/vite.js.map +1 -0
  95. package/package.json +7 -2
  96. package/src/ecosystem/core/index.ts +1 -1
  97. package/src/ecosystem/core/lookup.ts +16 -0
  98. package/src/ecosystem/core/sites.ts +16 -5
  99. package/src/ecosystem/ui/glyphs.tsx +20 -1
  100. package/src/orbital/ui/AtomicOrbitalCanvas.tsx +9 -2
  101. package/src/orbital/ui/AtomicOrbitalViewer.tsx +5 -0
  102. package/src/orbital/ui/axesGeometry.ts +91 -0
  103. package/src/orbital/ui/camera.ts +9 -1
  104. package/src/orbital/ui/renderAxes.ts +190 -0
  105. package/src/orbital/ui/viewer.ts +32 -2
  106. package/src/seo/core/documentMeta.ts +5 -5
  107. package/src/seo/core/index.ts +27 -0
  108. package/src/seo/core/noscript.ts +195 -0
  109. package/src/seo/core/pageMeta.ts +128 -0
  110. package/src/seo/core/robots.ts +114 -0
  111. package/src/seo/core/routes.ts +246 -0
  112. package/src/seo/core/siteFiles.ts +112 -0
  113. package/src/seo/core/startDocumentMeta.ts +77 -0
  114. package/src/seo/core/structuredData.ts +80 -0
  115. package/src/seo/core/template.ts +54 -0
  116. package/src/seo/vite/index.ts +4 -0
  117. package/src/seo/vite/ogCard.ts +102 -0
  118. package/src/seo/vite/prerender.ts +203 -0
  119. package/src/vite.ts +1 -0
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The geometry of the cartesian frame: three rods through the origin and the
3
+ * three letters that name them.
4
+ *
5
+ * It is arithmetic over positions, which is why it is here rather than in
6
+ * `renderAxes.ts` — that module is about representations, exactly as
7
+ * `volumeField.ts` is to `renderVolume.ts`.
8
+ */
9
+ import type { Mesh } from 'molstar/lib/mol-geo/geometry/mesh/mesh.js';
10
+ import type { Text } from 'molstar/lib/mol-geo/geometry/text/text.js';
11
+ /** How far a rod, and a label, sit from the origin as fractions of the reach. */
12
+ export declare const ROD_LENGTH = 1.06;
13
+ export declare const LABEL_SIZE = 0.1;
14
+ /**
15
+ * Three rods through the origin, each with an arrowhead on its positive end.
16
+ * @param reach - How far the orbital reaches, in scene units.
17
+ * @returns The mesh, one group per axis.
18
+ */
19
+ export declare function buildAxisRods(reach: number): Mesh;
20
+ /**
21
+ * One label just beyond each arrowhead.
22
+ * @param at - Distance from the origin the labels sit at, in scene units.
23
+ * @param labels - What the axes are called, in x, y, z order.
24
+ * @returns The text geometry, one group per axis.
25
+ */
26
+ export declare function buildAxisLabels(at: number, labels: readonly string[]): Text;
27
+ //# sourceMappingURL=axesGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axesGeometry.d.ts","sourceRoot":"","sources":["../../../src/orbital/ui/axesGeometry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2CAA2C,CAAC;AAEtE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2CAA2C,CAAC;AAGtE,iFAAiF;AACjF,eAAO,MAAM,UAAU,OAAO,CAAC;AAC/B,eAAO,MAAM,UAAU,MAAM,CAAC;AAkB9B;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CA0BjD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAe3E"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * The geometry of the cartesian frame: three rods through the origin and the
3
+ * three letters that name them.
4
+ *
5
+ * It is arithmetic over positions, which is why it is here rather than in
6
+ * `renderAxes.ts` — that module is about representations, exactly as
7
+ * `volumeField.ts` is to `renderVolume.ts`.
8
+ */
9
+ import { addCylinder } from 'molstar/lib/mol-geo/geometry/mesh/builder/cylinder.js';
10
+ import { MeshBuilder } from 'molstar/lib/mol-geo/geometry/mesh/mesh-builder.js';
11
+ import { TextBuilder } from 'molstar/lib/mol-geo/geometry/text/text-builder.js';
12
+ import { Vec3 } from 'molstar/lib/mol-math/linear-algebra.js';
13
+ /** How far a rod, and a label, sit from the origin as fractions of the reach. */
14
+ export const ROD_LENGTH = 1.06;
15
+ export const LABEL_SIZE = 0.1;
16
+ /** Rod radius, as a fraction of the reach. */
17
+ const ROD_RADIUS = 0.006;
18
+ /** Arrowhead length as a fraction of the rod's half-length. */
19
+ const HEAD_LENGTH = 0.06;
20
+ /** Arrowhead radius as a multiple of the rod's. */
21
+ const HEAD_FLARE = 4;
22
+ /** x, y and z, in the order their labels are given in. */
23
+ const AXIS_DIRECTIONS = [
24
+ Vec3.create(1, 0, 0),
25
+ Vec3.create(0, 1, 0),
26
+ Vec3.create(0, 0, 1),
27
+ ];
28
+ /**
29
+ * Three rods through the origin, each with an arrowhead on its positive end.
30
+ * @param reach - How far the orbital reaches, in scene units.
31
+ * @returns The mesh, one group per axis.
32
+ */
33
+ export function buildAxisRods(reach) {
34
+ const state = MeshBuilder.createState(1024, 512);
35
+ const length = reach * ROD_LENGTH;
36
+ const radius = reach * ROD_RADIUS;
37
+ const head = length * HEAD_LENGTH;
38
+ for (const [axis, direction] of AXIS_DIRECTIONS.entries()) {
39
+ state.currentGroup = axis;
40
+ const start = Vec3.scale(Vec3.zero(), direction, -length);
41
+ const neck = Vec3.scale(Vec3.zero(), direction, length - head);
42
+ const tip = Vec3.scale(Vec3.zero(), direction, length);
43
+ addCylinder(state, start, neck, 1, {
44
+ radiusTop: radius,
45
+ radiusBottom: radius,
46
+ topCap: true,
47
+ bottomCap: true,
48
+ radialSegments: 12,
49
+ });
50
+ addCylinder(state, neck, tip, 1, {
51
+ radiusTop: 0,
52
+ radiusBottom: radius * HEAD_FLARE,
53
+ topCap: true,
54
+ bottomCap: true,
55
+ radialSegments: 16,
56
+ });
57
+ }
58
+ return MeshBuilder.getMesh(state);
59
+ }
60
+ /**
61
+ * One label just beyond each arrowhead.
62
+ * @param at - Distance from the origin the labels sit at, in scene units.
63
+ * @param labels - What the axes are called, in x, y, z order.
64
+ * @returns The text geometry, one group per axis.
65
+ */
66
+ export function buildAxisLabels(at, labels) {
67
+ const builder = TextBuilder.create({}, 3, 3);
68
+ for (const [axis, direction] of AXIS_DIRECTIONS.entries()) {
69
+ const position = Vec3.scale(Vec3.zero(), direction, at);
70
+ builder.add(labels[axis] ?? '', position[0], position[1], position[2], 0, 1, axis);
71
+ }
72
+ return builder.getText();
73
+ }
74
+ //# sourceMappingURL=axesGeometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axesGeometry.js","sourceRoot":"","sources":["../../../src/orbital/ui/axesGeometry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uDAAuD,CAAC;AACpF,OAAO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,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC3B,CAAC"}
@@ -6,6 +6,13 @@
6
6
  import type { PluginContext } from 'molstar/lib/mol-plugin/context.js';
7
7
  /** Transition length used when the caller does not pick one, milliseconds. */
8
8
  export declare const DEFAULT_CAMERA_DURATION = 250;
9
+ /**
10
+ * Turn rate used when the caller does not pick one, in molstar's own spin unit.
11
+ *
12
+ * A lobe has to stay in one place long enough to be read; molstar's own 1 turns
13
+ * an orbital fast enough that the phases blur into each other.
14
+ */
15
+ export declare const DEFAULT_SPIN_SPEED = 0.3;
9
16
  /**
10
17
  * Frame everything currently in the scene.
11
18
  * @param plugin - The molstar context.
@@ -1 +1 @@
1
- {"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../../../src/orbital/ui/camera.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvE,8EAA8E;AAC9E,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAY3C;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,aAAa,EACrB,UAAU,SAA0B,GACnC,IAAI,CAWN;AAkBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,aAAa,EACrB,aAAa,CAAC,EAAE,MAAM,EACtB,UAAU,SAA0B,GACnC,IAAI,CA4BN;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,OAAO,EACjB,KAAK,SAAI,GACR,IAAI,CAQN"}
1
+ {"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../../../src/orbital/ui/camera.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvE,8EAA8E;AAC9E,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAYtC;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,aAAa,EACrB,UAAU,SAA0B,GACnC,IAAI,CAWN;AAkBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,aAAa,EACrB,aAAa,CAAC,EAAE,MAAM,EACtB,UAAU,SAA0B,GACnC,IAAI,CA4BN;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,OAAO,EACjB,KAAK,SAAqB,GACzB,IAAI,CAQN"}
@@ -6,6 +6,13 @@
6
6
  import { Vec3 } from 'molstar/lib/mol-math/linear-algebra.js';
7
7
  /** Transition length used when the caller does not pick one, milliseconds. */
8
8
  export const DEFAULT_CAMERA_DURATION = 250;
9
+ /**
10
+ * Turn rate used when the caller does not pick one, in molstar's own spin unit.
11
+ *
12
+ * A lobe has to stay in one place long enough to be read; molstar's own 1 turns
13
+ * an orbital fast enough that the phases blur into each other.
14
+ */
15
+ export const DEFAULT_SPIN_SPEED = 0.3;
9
16
  /**
10
17
  * Fraction of the bounding sphere kept as breathing room around the orbital.
11
18
  *
@@ -86,7 +93,7 @@ export function frameOrbital(plugin, orbitalRadius, durationMs = DEFAULT_CAMERA_
86
93
  * @param spinning - Whether the scene should keep turning.
87
94
  * @param speed - Revolutions per minute-ish; molstar's own unit.
88
95
  */
89
- export function setSpin(plugin, spinning, speed = 1) {
96
+ export function setSpin(plugin, spinning, speed = DEFAULT_SPIN_SPEED) {
90
97
  plugin.canvas3d?.setProps({
91
98
  trackball: {
92
99
  animate: spinning
@@ -1 +1 @@
1
- {"version":3,"file":"camera.js","sourceRoot":"","sources":["../../../src/orbital/ui/camera.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,wCAAwC,CAAC;AAG9D,8EAA8E;AAC9E,MAAM,CAAC,M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C,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;gBACjE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;SAChC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The cartesian frame an atomic orbital is read against.
3
+ *
4
+ * A `3d_xz` is only `3d_xz` because of where its lobes sit relative to x and
5
+ * z, and a lone isosurface on a blank canvas says nothing about that: the
6
+ * student is looking at four identical lobes and has to take the label's word
7
+ * for it. Three labelled axes through the nucleus are what turn the picture
8
+ * back into the diagram their textbook draws.
9
+ *
10
+ * The axes are neutral grey on purpose. The phase palette already owns colour
11
+ * here — blue against red, or blue against amber — so the usual red/green/blue
12
+ * axis convention would compete with the one thing the surface is saying, and
13
+ * the labels tell the three apart anyway.
14
+ *
15
+ * Like the isosurfaces, the representations live outside the state tree and
16
+ * are tracked per plugin.
17
+ */
18
+ import type { PluginContext } from 'molstar/lib/mol-plugin/context.js';
19
+ /** How the cartesian frame is drawn. */
20
+ export interface AxesStyle {
21
+ /**
22
+ * Colour of the three rods, as `#rrggbb`.
23
+ * @default '#64748b'
24
+ */
25
+ colour?: string;
26
+ /**
27
+ * Colour of the three labels, as `#rrggbb`.
28
+ * @default '#334155'
29
+ */
30
+ labelColour?: string;
31
+ /**
32
+ * What the axes are called, in x, y, z order.
33
+ * @default ['x', 'y', 'z']
34
+ */
35
+ labels?: readonly [string, string, string];
36
+ }
37
+ /**
38
+ * Draw a labelled x, y, z frame through the origin, replacing any previous one.
39
+ * @param plugin - The molstar context.
40
+ * @param reach - How far the orbital reaches, in scene units — what
41
+ * `renderSampledVolume` returned.
42
+ * @param style - See {@link AxesStyle}.
43
+ * @returns How far the frame reaches, labels included, in scene units: what a
44
+ * camera has to frame for the whole of it to be on screen.
45
+ * @throws {Error} When the canvas is not ready.
46
+ */
47
+ export declare function renderOrbitalAxes(plugin: PluginContext, reach: number, style?: AxesStyle): Promise<number>;
48
+ /**
49
+ * Remove the frame, leaving anything else on the canvas.
50
+ * @param plugin - The molstar context.
51
+ */
52
+ export declare function clearOrbitalAxes(plugin: PluginContext): void;
53
+ //# sourceMappingURL=renderAxes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderAxes.d.ts","sourceRoot":"","sources":["../../../src/orbital/ui/renderAxes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAavE,wCAAwC;AACxC,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5C;AAED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,SAAc,GACpB,OAAO,CAAC,MAAM,CAAC,CA6BjB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAQ5D"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * The cartesian frame an atomic orbital is read against.
3
+ *
4
+ * A `3d_xz` is only `3d_xz` because of where its lobes sit relative to x and
5
+ * z, and a lone isosurface on a blank canvas says nothing about that: the
6
+ * student is looking at four identical lobes and has to take the label's word
7
+ * for it. Three labelled axes through the nucleus are what turn the picture
8
+ * back into the diagram their textbook draws.
9
+ *
10
+ * The axes are neutral grey on purpose. The phase palette already owns colour
11
+ * here — blue against red, or blue against amber — so the usual red/green/blue
12
+ * axis convention would compete with the one thing the surface is saying, and
13
+ * the labels tell the three apart anyway.
14
+ *
15
+ * Like the isosurfaces, the representations live outside the state tree and
16
+ * are tracked per plugin.
17
+ */
18
+ import { Mesh } from 'molstar/lib/mol-geo/geometry/mesh/mesh.js';
19
+ import { Text } from 'molstar/lib/mol-geo/geometry/text/text.js';
20
+ import { Shape } from 'molstar/lib/mol-model/shape.js';
21
+ // Lowercased on import: it is a factory, not a constructor.
22
+ import { ShapeRepresentation as shapeRepresentation } from 'molstar/lib/mol-repr/shape/representation.js';
23
+ import { Color } from 'molstar/lib/mol-util/color/color.js';
24
+ import { LABEL_SIZE, ROD_LENGTH, buildAxisLabels, buildAxisRods, } from "./axesGeometry.js";
25
+ /**
26
+ * Draw a labelled x, y, z frame through the origin, replacing any previous one.
27
+ * @param plugin - The molstar context.
28
+ * @param reach - How far the orbital reaches, in scene units — what
29
+ * `renderSampledVolume` returned.
30
+ * @param style - See {@link AxesStyle}.
31
+ * @returns How far the frame reaches, labels included, in scene units: what a
32
+ * camera has to frame for the whole of it to be on screen.
33
+ * @throws {Error} When the canvas is not ready.
34
+ */
35
+ export async function renderOrbitalAxes(plugin, reach, style = {}) {
36
+ const canvas3d = plugin.canvas3d;
37
+ if (canvas3d === undefined) {
38
+ throw new Error('renderOrbitalAxes: the molstar canvas is not ready.');
39
+ }
40
+ const { colour = '#64748b', labelColour = '#334155', labels = ['x', 'y', 'z'], } = style;
41
+ clearOrbitalAxes(plugin);
42
+ if (reach <= 0)
43
+ return 0;
44
+ const labelSize = reach * LABEL_SIZE;
45
+ const labelAt = reach * ROD_LENGTH + labelSize;
46
+ const drawn = await Promise.all([
47
+ createRods(plugin, buildAxisRods(reach), colour),
48
+ createLabels(plugin, buildAxisLabels(labelAt, labels), labelColour, labelSize),
49
+ ]);
50
+ representations.set(plugin, drawn);
51
+ for (const representation of drawn)
52
+ canvas3d.add(representation);
53
+ // add() only queues; nothing appears until the queue is committed.
54
+ canvas3d.commit();
55
+ return labelAt + labelSize / 2;
56
+ }
57
+ /**
58
+ * Remove the frame, leaving anything else on the canvas.
59
+ * @param plugin - The molstar context.
60
+ */
61
+ export function clearOrbitalAxes(plugin) {
62
+ const previous = representations.get(plugin);
63
+ if (previous === undefined)
64
+ return;
65
+ representations.delete(plugin);
66
+ for (const representation of previous) {
67
+ plugin.canvas3d?.remove(representation);
68
+ }
69
+ plugin.canvas3d?.commit();
70
+ }
71
+ /**
72
+ * The rods, as a representation the canvas can hold.
73
+ * @param plugin - The molstar context.
74
+ * @param mesh - The rod mesh.
75
+ * @param colour - Rod colour, as `#rrggbb`.
76
+ * @returns The representation.
77
+ */
78
+ async function createRods(plugin, mesh, colour) {
79
+ const value = Color.fromHexStyle(colour);
80
+ const representation = shapeRepresentation((_ctx, data) => Shape.create('orbital axes', {}, data, () => value, () => 1, () => 'axis'), Mesh.Utils);
81
+ await plugin.runTask(
82
+ // Unlit: a shaded rod reads as a cylinder in front of the surface, while a
83
+ // flat one reads as the axis line a textbook draws.
84
+ representation.createOrUpdate({ alpha: 1, ignoreLight: true }, mesh));
85
+ representation.setState({ pickable: false });
86
+ return representation;
87
+ }
88
+ /**
89
+ * The labels, as a representation the canvas can hold.
90
+ * @param plugin - The molstar context.
91
+ * @param text - The label geometry.
92
+ * @param colour - Label colour, as `#rrggbb`.
93
+ * @param size - Label height, in scene units.
94
+ * @returns The representation.
95
+ */
96
+ async function createLabels(plugin, text, colour, size) {
97
+ const value = Color.fromHexStyle(colour);
98
+ const representation = shapeRepresentation((_ctx, data) => Shape.create('orbital axis labels', {}, data, () => value, () => 1, () => 'axis label'), Text.Utils);
99
+ await plugin.runTask(representation.createOrUpdate({
100
+ sizeFactor: size,
101
+ background: false,
102
+ attachment: 'middle-center',
103
+ fontWeight: 'bold',
104
+ }, text));
105
+ representation.setState({ pickable: false });
106
+ return representation;
107
+ }
108
+ /** One frame per plugin, outside the state tree like the isosurfaces. */
109
+ const representations = new WeakMap();
110
+ //# sourceMappingURL=renderAxes.js.map
@@ -0,0 +1 @@
1
+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EAAE,KAAK,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,CACrE,CAAC;IACF,cAAc,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7C,OAAO,cAAc,CAAC;AACxB,CAAC;AAED;;;;;;;GAOG;AACH,KAAK,UAAU,YAAY,CACzB,MAAqB,EACrB,IAAU,EACV,MAAc,EACd,IAAY;IAEZ,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,cAAc,GAAG,mBAAmB,CACxC,CAAC,IAAI,EAAE,IAAU,EAAE,EAAE,CACnB,KAAK,CAAC,MAAM,CACV,qBAAqB,EACrB,EAAE,EACF,IAAI,EACJ,GAAG,EAAE,CAAC,KAAK,EACX,GAAG,EAAE,CAAC,CAAC,EACP,GAAG,EAAE,CAAC,YAAY,CACnB,EACH,IAAI,CAAC,KAAK,CACX,CAAC;IACF,MAAM,MAAM,CAAC,OAAO,CAClB,cAAc,CAAC,cAAc,CAC3B;QACE,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,eAAe;QAC3B,UAAU,EAAE,MAAM;KACnB,EACD,IAAI,CACL,CACF,CAAC;IACF,cAAc,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7C,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,yEAAyE;AACzE,MAAM,eAAe,GAAG,IAAI,OAAO,EAAuC,CAAC"}
@@ -14,6 +14,7 @@
14
14
  */
15
15
  import type { OrbitalGrid } from '../core/grid.ts';
16
16
  import type { OrbitalContour } from '../core/isovalue.ts';
17
+ import type { AxesStyle } from './renderAxes.ts';
17
18
  import type { VolumeStyle } from './renderVolume.ts';
18
19
  /** Settings fixed for the life of a viewer. */
19
20
  export interface OrbitalViewerOptions {
@@ -56,6 +57,21 @@ export declare class OrbitalViewer {
56
57
  * to frame; `undefined` once the viewer has been disposed.
57
58
  */
58
59
  showOrbital(field: OrbitalGrid, contour: OrbitalContour, style?: VolumeStyle): Promise<number | undefined>;
60
+ /**
61
+ * Draw the labelled x, y, z frame through the origin, replacing any previous
62
+ * one.
63
+ * @param reach - How far the orbital reaches, in scene units, as
64
+ * `showOrbital` returned it.
65
+ * @param style - See {@link AxesStyle}.
66
+ * @returns How far the frame reaches, labels included, for the camera to
67
+ * frame; `undefined` once the viewer has been disposed.
68
+ */
69
+ showAxes(reach: number, style?: AxesStyle): Promise<number | undefined>;
70
+ /**
71
+ * Remove the frame.
72
+ * @returns Nothing, once the axes are gone.
73
+ */
74
+ hideAxes(): Promise<void>;
59
75
  /**
60
76
  * Remove the isosurface pair.
61
77
  * @returns Nothing, once the surfaces are gone.
@@ -1 +1 @@
1
- {"version":3,"file":"viewer.d.ts","sourceRoot":"","sources":["../../../src/orbital/ui/viewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,+CAA+C;AAC/C,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,WAAW,EACtB,OAAO,GAAE,oBAAyB,GACjC,aAAa,CAEf;AAED;;;;;GAKG;AACH,qBAAa,aAAa;;IAIxB,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;gBAElB,SAAS,EAAE,WAAW,EAAE,OAAO,GAAE,oBAAyB;IAiBtE;;;OAGG;IACH,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;;;;;;OAOG;I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,OAAO,CAEtB;IAED;;;;;;;OAOG;IACH,WAAW,CACT,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,cAAc,EACvB,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAM9B;;;;;;;;OAQG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAIvE;;;OAGG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAMzB;;;OAGG;IACH,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAM5B;;;;;;;OAOG;IACH,KAAK,CACH,aAAa,CAAC,EAAE,MAAM,EACtB,UAAU,SAA0B,GACnC,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;;;OAGG;IACH,OAAO,IAAI,IAAI;CAkChB"}
@@ -16,7 +16,8 @@ import { PluginViewModel } from 'molstar/lib/extensions/plugin/view-model.js';
16
16
  // Lowercased on import: it is a factory, not a constructor.
17
17
  import { DefaultPluginSpec as defaultPluginSpec } from 'molstar/lib/mol-plugin/spec.js';
18
18
  import { Color } from 'molstar/lib/mol-util/color/color.js';
19
- import { DEFAULT_CAMERA_DURATION, frameOrbital, setSpin } from "./camera.js";
19
+ import { DEFAULT_CAMERA_DURATION, DEFAULT_SPIN_SPEED, frameOrbital, setSpin, } from "./camera.js";
20
+ import { clearOrbitalAxes, renderOrbitalAxes } from "./renderAxes.js";
20
21
  import { clearSampledVolume, renderSampledVolume } from "./renderVolume.js";
21
22
  /**
22
23
  * Create a viewer inside `container` and start initialising it.
@@ -73,6 +74,27 @@ export class OrbitalViewer {
73
74
  showOrbital(field, contour, style) {
74
75
  return this.#run((plugin) => renderSampledVolume(plugin, field, contour, style));
75
76
  }
77
+ /**
78
+ * Draw the labelled x, y, z frame through the origin, replacing any previous
79
+ * one.
80
+ * @param reach - How far the orbital reaches, in scene units, as
81
+ * `showOrbital` returned it.
82
+ * @param style - See {@link AxesStyle}.
83
+ * @returns How far the frame reaches, labels included, for the camera to
84
+ * frame; `undefined` once the viewer has been disposed.
85
+ */
86
+ showAxes(reach, style) {
87
+ return this.#run((plugin) => renderOrbitalAxes(plugin, reach, style));
88
+ }
89
+ /**
90
+ * Remove the frame.
91
+ * @returns Nothing, once the axes are gone.
92
+ */
93
+ hideAxes() {
94
+ return this.#run((plugin) => {
95
+ clearOrbitalAxes(plugin);
96
+ });
97
+ }
76
98
  /**
77
99
  * Remove the isosurface pair.
78
100
  * @returns Nothing, once the surfaces are gone.
@@ -101,7 +123,7 @@ export class OrbitalViewer {
101
123
  * @param speed - molstar's own spin unit.
102
124
  * @returns Nothing, once the spin has been switched.
103
125
  */
104
- setSpin(spinning, speed = 1) {
126
+ setSpin(spinning, speed = DEFAULT_SPIN_SPEED) {
105
127
  return this.#run((plugin) => {
106
128
  setSpin(plugin, spinning, speed);
107
129
  });
@@ -1 +1 @@
1
- {"version":3,"file":"viewer.js","sourceRoot":"","sources":["../../../src/orbital/ui/viewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAE9E,4DAA4D;AAC5D,OAAO,EAAE,iBAAiB,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAK5D,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7E,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAW5E;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,SAAsB,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MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC1C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,IAAI,CAAC,SAAS;gBAAE,OAAO,SAAS,CAAC;YACrC,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
@@ -30,8 +30,8 @@ export interface DocumentMeta {
30
30
  title: string;
31
31
  /**
32
32
  * One sentence describing this page, in the words someone would search for.
33
- * Left out, the description the page was served with stays as it is — which
34
- * is what every crawler but a rendering one has already read.
33
+ * Left out or empty, the description the page was served with stays as it is
34
+ * — which is what every crawler but a rendering one has already read.
35
35
  * @default undefined
36
36
  */
37
37
  description?: string;
@@ -11,10 +11,11 @@
11
11
  export function writeDocumentMeta(meta) {
12
12
  if (typeof document === 'undefined')
13
13
  return;
14
- documentTitle(meta.title);
15
- if (meta.description !== undefined)
14
+ if (meta.title)
15
+ documentTitle(meta.title);
16
+ if (meta.description)
16
17
  metaDescription(meta.description);
17
- if (meta.canonical !== undefined)
18
+ if (meta.canonical)
18
19
  canonicalLink(meta.canonical);
19
20
  }
20
21
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"documentMeta.js","sourceRoot":"","sources":["../../../src/seo/core/documentMeta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAkB;IAClD,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO;IAC5C,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS;QAAE,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtE,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS;QAAE,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAClE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,IAAI,OAAO,QAAQ,KAAK,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AC;IAC3B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;AACtB,CAAC;AAqBD,SAAS,eAAe,CAAC,OAAe;IACtC,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CACrC,0BAA0B,CAC3B,CAAC;IACF,IAAI,QAAQ,EAAE,CAAC;QACb,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACzB,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAChC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAChD,CAAC"}
@@ -1,3 +1,18 @@
1
1
  export type { DocumentMeta } from './documentMeta.ts';
2
2
  export { canonicalLink, documentTitle, writeDocumentMeta, } from './documentMeta.ts';
3
+ export type { NoscriptEcosystem, NoscriptHrefs, NoscriptOptions, NoscriptRoute, NoscriptText, } from './noscript.ts';
4
+ export { noscriptIndex } from './noscript.ts';
5
+ export type { PageMetaOptions } from './pageMeta.ts';
6
+ export { injectPageMeta, pageDocumentMeta, pageHeadTags } from './pageMeta.ts';
7
+ export type { RobotsDisallow } from './robots.ts';
8
+ export { robotsTxt } from './robots.ts';
9
+ export type { RouteMeta } from './routes.ts';
10
+ export { assertRoutes, homeRoute, pageMetaFor, routeFor, trimTrailingSlash, } from './routes.ts';
11
+ export type { SiteFilesOptions } from './siteFiles.ts';
12
+ export { sitemapXml } from './siteFiles.ts';
13
+ export type { StartDocumentMetaOptions } from './startDocumentMeta.ts';
14
+ export { startDocumentMeta } from './startDocumentMeta.ts';
15
+ export type { StructuredDataOptions } from './structuredData.ts';
16
+ export { structuredDataScript } from './structuredData.ts';
17
+ export { PAGE_BODY_MARKER, PAGE_HEAD_MARKER, fill } from './template.ts';
3
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/seo/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,aAAa,EACb,aAAa,EACb,iBAAiB,GAClB,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/seo/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,aAAa,EACb,aAAa,EACb,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/E,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,YAAY,EACZ,SAAS,EACT,WAAW,EACX,QAAQ,EACR,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,YAAY,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC"}
@@ -1,2 +1,10 @@
1
1
  export { canonicalLink, documentTitle, writeDocumentMeta, } from "./documentMeta.js";
2
+ export { noscriptIndex } from "./noscript.js";
3
+ export { injectPageMeta, pageDocumentMeta, pageHeadTags } from "./pageMeta.js";
4
+ export { robotsTxt } from "./robots.js";
5
+ export { assertRoutes, homeRoute, pageMetaFor, routeFor, trimTrailingSlash, } from "./routes.js";
6
+ export { sitemapXml } from "./siteFiles.js";
7
+ export { startDocumentMeta } from "./startDocumentMeta.js";
8
+ export { structuredDataScript } from "./structuredData.js";
9
+ export { PAGE_BODY_MARKER, PAGE_HEAD_MARKER, fill } from "./template.js";
2
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/seo/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,aAAa,EACb,iBAAiB,GAClB,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/seo/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,aAAa,EACb,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE/E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EACL,YAAY,EACZ,SAAS,EACT,WAAW,EACX,QAAQ,EACR,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * A readable page for a visitor, or a crawler, with no JavaScript.
3
+ *
4
+ * The body of our sites is an empty root element, so this is the only crawl
5
+ * path through them that costs nothing to render — and it is honest: it says
6
+ * the tool needs JavaScript, and links the addresses it answers.
7
+ */
8
+ import type { SiteId } from '../../ecosystem/core/sites.ts';
9
+ import type { RouteMeta } from './routes.ts';
10
+ import type { SiteFilesOptions } from './siteFiles.ts';
11
+ /** How the addresses of the site's own pages are written. */
12
+ export type NoscriptHrefs = 'absolute' | 'relative';
13
+ /** A page the block links, and the pages listed under it. */
14
+ export interface NoscriptRoute extends RouteMeta {
15
+ /**
16
+ * Pages listed under this one, as a list nested in its item — the sections of
17
+ * an exercise set under the set itself.
18
+ * @default undefined — the item carries no list
19
+ */
20
+ children?: readonly NoscriptRoute[];
21
+ }
22
+ /** Which of the family's other sites are listed, and how. */
23
+ export interface NoscriptEcosystem {
24
+ /**
25
+ * The sites listed, in the order they are named. The site writing the block
26
+ * is never one of them, whether or not it is named: the list is headed *Our
27
+ * other tools*.
28
+ * @default every other site in the family, in the family's own order
29
+ */
30
+ sites?: readonly SiteId[];
31
+ /**
32
+ * Whether each host is followed by ` — ` and the site's one-line tagline.
33
+ * @default true
34
+ */
35
+ taglines?: boolean;
36
+ }
37
+ /** The prose of the block, where the site says more than its record does. */
38
+ export interface NoscriptText {
39
+ /**
40
+ * The heading the block opens with.
41
+ * @default the site's display name
42
+ */
43
+ heading?: string;
44
+ /**
45
+ * The paragraph under it, taken as written. It is the one place a reader with
46
+ * no JavaScript is told what the tool is, so it may say more than the tagline
47
+ * — but it still has to say that the tool needs JavaScript.
48
+ * @default the tagline, followed by the sentence naming the requirement
49
+ */
50
+ intro?: string;
51
+ /**
52
+ * Whether the family's other sites are listed under the site's own pages, and
53
+ * which of them. A crawler that runs no script has no other path from one of
54
+ * our tools to the next, so a site that lists none leaves it with none.
55
+ * `true` lists every other site with its tagline; an object names the sites,
56
+ * or drops the taglines, or both.
57
+ * @default false
58
+ */
59
+ ecosystem?: boolean | NoscriptEcosystem;
60
+ /**
61
+ * How the site's own addresses are written. `'absolute'` writes them from the
62
+ * root of the host, under the mount the origin names. `'relative'` writes
63
+ * `./exercises` and `./`, which the page resolves against its own `<base>` —
64
+ * the only shape that works for an image whose mount is chosen at container
65
+ * startup, because it bakes no mount into the build at all. The `<base>` such
66
+ * a deployment stamps in ends with a slash, or a relative address resolves
67
+ * one directory too high.
68
+ * @default 'absolute'
69
+ */
70
+ hrefs?: NoscriptHrefs;
71
+ /**
72
+ * The pages the block links, when they are not the site's whole route table.
73
+ * A crawl path is a menu: a site whose table carries an entry per tutorial
74
+ * step lists the tutorial, not its hundred and thirty-seven steps.
75
+ * @default every route the site answers
76
+ */
77
+ routes?: readonly NoscriptRoute[];
78
+ }
79
+ /** What the block says, and which addresses it links. */
80
+ export interface NoscriptOptions extends Omit<SiteFilesOptions, 'routes'>, Omit<NoscriptText, 'routes'> {
81
+ /** The addresses it links, each with the label it is linked under. */
82
+ routes: readonly NoscriptRoute[];
83
+ }
84
+ /**
85
+ * The `noscript` block, ready to put in the body.
86
+ *
87
+ * An absolute address is written under the mount the deployment named, so a
88
+ * build published as one tool among several on a shared host links its own
89
+ * pages rather than the root of the host it shares.
90
+ * @param options - The site, the pages it links, and the prose that opens the
91
+ * block.
92
+ * @returns The block.
93
+ * @throws {Error} When the deployment named an origin that is not an absolute
94
+ * address.
95
+ */
96
+ export declare function noscriptIndex(options: NoscriptOptions): string;
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