astraeus 0.7.0 → 0.8.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 (271) hide show
  1. package/CHANGELOG.md +176 -0
  2. package/README.md +185 -37
  3. package/package.json +5 -4
  4. package/src/api/AstraeusScene.d.ts +21 -5
  5. package/src/api/AstraeusScene.js +34 -10
  6. package/src/api/AstraeusScene.node.js +34 -10
  7. package/src/api/assembleScene.d.ts +36 -0
  8. package/src/api/assembleScene.js +175 -0
  9. package/src/api/bodySetChecks.d.ts +10 -0
  10. package/src/api/bodySetChecks.js +117 -0
  11. package/src/api/bodySetInput.d.ts +81 -0
  12. package/src/api/bodySetInput.js +1 -0
  13. package/src/api/containingBlock.d.ts +6 -0
  14. package/src/api/containingBlock.js +16 -0
  15. package/src/api/data.d.ts +17 -5
  16. package/src/api/data.js +28 -10
  17. package/src/api/definitionOf.d.ts +16 -0
  18. package/src/api/definitionOf.js +20 -0
  19. package/src/api/errors.d.ts +61 -1
  20. package/src/api/frozenCopy.d.ts +6 -0
  21. package/src/api/frozenCopy.js +26 -0
  22. package/src/api/group.d.ts +8 -2
  23. package/src/api/group.js +24 -5
  24. package/src/api/index.d.ts +18 -7
  25. package/src/api/index.js +2 -2
  26. package/src/api/index.node.js +2 -2
  27. package/src/api/listeners.d.ts +5 -0
  28. package/src/api/listeners.js +25 -0
  29. package/src/api/look.d.ts +47 -0
  30. package/src/api/look.js +1 -0
  31. package/src/api/lookInput.d.ts +3 -0
  32. package/src/api/lookInput.js +41 -0
  33. package/src/api/moonPanelInput.d.ts +60 -0
  34. package/src/api/moonPanelInput.js +1 -0
  35. package/src/api/mount.d.ts +9 -19
  36. package/src/api/mount.js +27 -13
  37. package/src/api/mount.node.js +27 -13
  38. package/src/api/pathProvenance.js +1 -1
  39. package/src/api/pickerInput.d.ts +25 -0
  40. package/src/api/pickerInput.js +1 -0
  41. package/src/api/planBodies.d.ts +72 -0
  42. package/src/api/planBodies.js +300 -0
  43. package/src/api/planBodySets.d.ts +68 -0
  44. package/src/api/planBodySets.js +234 -0
  45. package/src/api/planCamera.d.ts +83 -0
  46. package/src/api/planCamera.js +184 -0
  47. package/src/api/planGroups.d.ts +36 -0
  48. package/src/api/planGroups.js +103 -0
  49. package/src/api/planMoonPanel.d.ts +19 -0
  50. package/src/api/planMoonPanel.js +104 -0
  51. package/src/api/planPaths.d.ts +40 -0
  52. package/src/api/planPaths.js +212 -0
  53. package/src/api/planPicker.d.ts +12 -0
  54. package/src/api/planPicker.js +40 -0
  55. package/src/api/planPlaces.d.ts +16 -0
  56. package/src/api/planPlaces.js +99 -0
  57. package/src/api/planStory.d.ts +26 -0
  58. package/src/api/planStory.js +66 -0
  59. package/src/api/planTimeline.d.ts +27 -0
  60. package/src/api/planTimeline.js +68 -0
  61. package/src/api/planViews.d.ts +25 -0
  62. package/src/api/planViews.js +35 -0
  63. package/src/api/prepared.js +4 -1
  64. package/src/api/renamedInputs.d.ts +15 -0
  65. package/src/api/renamedInputs.js +39 -0
  66. package/src/api/scene.d.ts +162 -68
  67. package/src/api/scene.js +247 -793
  68. package/src/api/sceneFreeze.d.ts +4 -0
  69. package/src/api/sceneFreeze.js +10 -0
  70. package/src/api/sceneReads.d.ts +171 -0
  71. package/src/api/sceneReads.js +6 -0
  72. package/src/api/story.d.ts +49 -19
  73. package/src/api/story.js +54 -22
  74. package/src/api/sunOrbit.js +9 -11
  75. package/src/api/time.d.ts +2 -1
  76. package/src/api/time.js +2 -1
  77. package/src/api/viewerCamera.d.ts +22 -0
  78. package/src/api/viewerCamera.js +84 -0
  79. package/src/api/viewerClock.d.ts +30 -0
  80. package/src/api/viewerClock.js +85 -0
  81. package/src/api/viewerFirstDraw.d.ts +14 -0
  82. package/src/api/viewerFirstDraw.js +26 -0
  83. package/src/api/viewerHandle.d.ts +79 -0
  84. package/src/api/viewerHandle.js +31 -0
  85. package/src/api/viewerLink.d.ts +87 -15
  86. package/src/api/viewerLink.js +111 -75
  87. package/src/api/viewerLooks.d.ts +19 -0
  88. package/src/api/viewerLooks.js +37 -0
  89. package/src/api/viewerPicker.d.ts +22 -0
  90. package/src/api/viewerPicker.js +49 -0
  91. package/src/api/viewerSelection.d.ts +25 -0
  92. package/src/api/viewerSelection.js +31 -0
  93. package/src/api/viewerViews.d.ts +10 -0
  94. package/src/api/viewerViews.js +18 -0
  95. package/src/api/viewerZones.d.ts +20 -0
  96. package/src/api/viewerZones.js +47 -0
  97. package/src/api/views.d.ts +4 -5
  98. package/src/api/views.js +7 -5
  99. package/src/app/App.d.ts +5 -3
  100. package/src/app/App.js +191 -82
  101. package/src/app/App.node.js +191 -82
  102. package/src/app/AstraeusScene.d.ts +16 -2
  103. package/src/app/AstraeusScene.js +4 -4
  104. package/src/app/BodyView.d.ts +4 -1
  105. package/src/app/BodyView.js +2 -2
  106. package/src/app/CameraController.d.ts +6 -0
  107. package/src/app/DeveloperSettings.d.ts +1 -4
  108. package/src/app/DeveloperSettings.js +6 -10
  109. package/src/app/FeatureMarkers.d.ts +4 -3
  110. package/src/app/FeatureMarkers.js +8 -13
  111. package/src/app/FrameRateSection.js +2 -1
  112. package/src/app/OrbitSetView.js +1 -1
  113. package/src/app/SettingControls.d.ts +11 -3
  114. package/src/app/SettingControls.js +10 -2
  115. package/src/app/SkyView.d.ts +3 -10
  116. package/src/app/SkyView.js +6 -28
  117. package/src/app/address.d.ts +16 -0
  118. package/src/app/address.js +31 -0
  119. package/src/app/bodyDraw.d.ts +10 -7
  120. package/src/app/bodyDraw.js +12 -32
  121. package/src/app/bodyMetrics.js +2 -2
  122. package/src/app/bodySet.d.ts +4 -20
  123. package/src/app/bodySet.js +5 -16
  124. package/src/app/debugReadout.js +1 -1
  125. package/src/app/displaySwitches.d.ts +4 -0
  126. package/src/app/displaySwitches.js +6 -0
  127. package/src/app/experienceDefinition.d.ts +11 -23
  128. package/src/app/listSwitch.d.ts +8 -14
  129. package/src/app/listSwitch.js +3 -10
  130. package/src/app/liveLook.d.ts +39 -0
  131. package/src/app/liveLook.js +66 -0
  132. package/src/app/look.d.ts +36 -0
  133. package/src/app/look.js +61 -0
  134. package/src/app/mission.d.ts +1 -1
  135. package/src/app/mission.js +1 -1
  136. package/src/app/openClock.d.ts +3 -2
  137. package/src/app/openClock.js +3 -3
  138. package/src/app/sceneCamera.js +9 -0
  139. package/src/app/sceneFrame.d.ts +4 -4
  140. package/src/app/sceneFrame.js +13 -8
  141. package/src/app/sceneHooks.js +3 -2
  142. package/src/app/style.css +114 -139
  143. package/src/app/trackedMetrics.d.ts +10 -3
  144. package/src/app/trackedMetrics.js +22 -11
  145. package/src/app/viewLink.d.ts +10 -32
  146. package/src/app/viewLink.js +10 -49
  147. package/src/app/viewerPort.d.ts +50 -0
  148. package/src/app/views.d.ts +1 -0
  149. package/src/assets/bodies/galileanMoons.js +1 -2
  150. package/src/assets/bodies/io.js +2 -2
  151. package/src/assets/bodies/listedMoons.d.ts +1 -1
  152. package/src/assets/bodies/listedMoons.js +2 -3
  153. package/src/assets/bodies/planetSystemMaps.js +2 -3
  154. package/src/assets/bodies/venus.js +2 -6
  155. package/src/assets/catalogue.js +1 -2
  156. package/src/assets/licence.d.ts +3 -3
  157. package/src/assets/licence.js +3 -3
  158. package/src/assets/pictures.d.ts +15 -12
  159. package/src/assets/pictures.js +24 -20
  160. package/src/assets/sky.d.ts +6 -5
  161. package/src/assets/sky.js +6 -9
  162. package/src/assets/visual.d.ts +4 -0
  163. package/src/core/bodies/index.d.ts +0 -4
  164. package/src/core/bodies/index.js +1 -6
  165. package/src/core/bodies/jupiterData.d.ts +0 -1
  166. package/src/core/bodies/jupiterData.js +2 -5
  167. package/src/core/bodies/moonSystem.d.ts +1 -1
  168. package/src/core/bodies/moonSystem.js +102 -55
  169. package/src/core/bodies/outerPlanetRingData.js +2 -2
  170. package/src/core/bodies/planetTrajectory.js +1 -1
  171. package/src/core/bodySetFamilies.d.ts +20 -0
  172. package/src/core/bodySetFamilies.js +14 -0
  173. package/src/core/chebyshevEphemeris.js +1 -1
  174. package/src/core/elementsBody.d.ts +8 -4
  175. package/src/core/elementsBody.js +32 -11
  176. package/src/core/elementsGroup.d.ts +27 -0
  177. package/src/core/elementsGroup.js +85 -0
  178. package/src/core/events.d.ts +2 -0
  179. package/src/core/events.js +2 -0
  180. package/src/core/illumination.js +1 -1
  181. package/src/core/listedOrbitGroup.d.ts +2 -0
  182. package/src/core/listedOrbitGroup.js +11 -7
  183. package/src/core/moonListText.d.ts +6 -0
  184. package/src/core/moonListText.js +19 -0
  185. package/src/core/moonTrajectory.js +1 -1
  186. package/src/core/pacing.d.ts +38 -3
  187. package/src/core/pacing.js +55 -4
  188. package/src/core/planetModels.js +2 -2
  189. package/src/core/planetSeries.d.ts +8 -0
  190. package/src/core/planetSeries.js +16 -2
  191. package/src/core/pointGroup.js +1 -1
  192. package/src/core/provenance.d.ts +2 -1
  193. package/src/core/provenance.js +2 -2
  194. package/src/core/referenceCenters.js +5 -5
  195. package/src/core/sampledTrajectory.js +1 -1
  196. package/src/core/scalePolicy.d.ts +1 -0
  197. package/src/core/startView.d.ts +19 -0
  198. package/src/core/startView.js +28 -0
  199. package/src/core/state.d.ts +6 -2
  200. package/src/core/state.js +3 -3
  201. package/src/core/storyPanels.d.ts +63 -0
  202. package/src/core/storyPanels.js +111 -0
  203. package/src/core/sunCentredSources.d.ts +4 -0
  204. package/src/core/sunCentredSources.js +9 -2
  205. package/src/core/timeInput.d.ts +4 -0
  206. package/src/core/timeInput.js +4 -0
  207. package/src/shell/AstraeusShell.d.ts +5 -1
  208. package/src/shell/AstraeusShell.js +20 -11
  209. package/src/shell/AstraeusShell.node.js +20 -11
  210. package/src/shell/Collapsible.d.ts +4 -3
  211. package/src/shell/Collapsible.js +5 -5
  212. package/src/shell/ControlsDrawer.d.ts +1 -1
  213. package/src/shell/ControlsDrawer.js +3 -1
  214. package/src/shell/DisplaySwitches.js +2 -1
  215. package/src/shell/InfoPanel.d.ts +3 -1
  216. package/src/shell/InfoPanel.js +5 -4
  217. package/src/shell/MoonFamilyPanel.js +1 -1
  218. package/src/shell/ObjectControls.d.ts +3 -1
  219. package/src/shell/ObjectControls.js +2 -2
  220. package/src/shell/Sources.d.ts +5 -3
  221. package/src/shell/Sources.js +5 -5
  222. package/src/shell/StoryPanelView.d.ts +4 -3
  223. package/src/shell/StoryPanelView.js +8 -6
  224. package/src/shell/SwitchControl.d.ts +5 -11
  225. package/src/shell/SwitchControl.js +2 -20
  226. package/src/shell/TimelineBar.css +81 -81
  227. package/src/shell/TimelineBar.d.ts +5 -2
  228. package/src/shell/TimelineBar.js +9 -8
  229. package/src/shell/TimelineBar.node.js +9 -8
  230. package/src/shell/TopBar.css +22 -22
  231. package/src/shell/TopBar.d.ts +5 -1
  232. package/src/shell/TopBar.js +2 -2
  233. package/src/shell/TopBar.node.js +2 -2
  234. package/src/shell/bootLoader.d.ts +4 -10
  235. package/src/shell/bootLoader.js +6 -52
  236. package/src/shell/embedded.css +18 -18
  237. package/src/shell/experience.d.ts +1 -1
  238. package/src/shell/moonFamilies.d.ts +2 -6
  239. package/src/shell/moonFamilies.js +2 -18
  240. package/src/shell/phone.css +58 -58
  241. package/src/shell/storyPanels.d.ts +2 -53
  242. package/src/shell/storyPanels.js +1 -106
  243. package/src/shell/style.css +153 -134
  244. package/src/shell/useDrawers.d.ts +3 -2
  245. package/src/shell/useDrawers.js +4 -3
  246. package/src/shell/viewerKeys.d.ts +8 -0
  247. package/src/shell/viewerKeys.js +16 -0
  248. package/src/synthetic/syntheticDefinition.js +20 -24
  249. package/src/synthetic/syntheticJourneyScene.js +3 -3
  250. package/src/synthetic/syntheticProbeDefinition.js +2 -1
  251. package/src/synthetic/syntheticViewsDefinition.d.ts +0 -3
  252. package/src/synthetic/syntheticViewsDefinition.js +10 -16
  253. package/data/moons/jupiter.json +0 -3333
  254. package/data/moons/neptune.json +0 -555
  255. package/data/moons/pluto.json +0 -205
  256. package/data/moons/saturn.json +0 -8267
  257. package/data/moons/uranus.json +0 -887
  258. package/src/app/addressNavigation.d.ts +0 -17
  259. package/src/app/addressNavigation.js +0 -16
  260. package/src/assets/bodies/jupiterMoonCatalogue.d.ts +0 -3
  261. package/src/assets/bodies/jupiterMoonCatalogue.js +0 -4
  262. package/src/assets/bodies/outerPlanetCatalogues.d.ts +0 -7
  263. package/src/assets/bodies/outerPlanetCatalogues.js +0 -8
  264. package/src/assets/bodies/swiftTuttle.d.ts +0 -12
  265. package/src/assets/bodies/swiftTuttle.js +0 -13
  266. package/src/assets/moonCatalogue.d.ts +0 -49
  267. package/src/assets/moonCatalogue.js +0 -80
  268. package/src/core/bodies/outerPlanetData.d.ts +0 -4
  269. package/src/core/bodies/outerPlanetData.js +0 -13
  270. package/src/core/bodies/swiftTuttle.d.ts +0 -46
  271. package/src/core/bodies/swiftTuttle.js +0 -106
@@ -1,16 +1,15 @@
1
- // The loading screen is plain markup and styles in app.html (so it shows before any script); this module only ends it.
2
- // It knows nothing of any demo: `hideBootLoader` is called on each scene's first drawn frame (`showBootLoader` brings the cover back for a switch), and `failBootLoader` when the start fails.
1
+ // The loading fade time the viewer keeps: the look's `loadFadeSeconds`, the Developer drawer's saved setting, else the default.
2
+ // The cover itself belongs to the host page (the demo site owns its markup, showing, fading and failure); the engine never looks one up.
3
3
  export const BOOT_FADE_DEFAULT_SECONDS = 0.6;
4
4
  export const BOOT_FADE_LIMITS = { min: 0, max: 3 };
5
5
  const STORAGE_KEY = "astraeus.loadFade";
6
6
  function clampFade(seconds) {
7
7
  return Number.isFinite(seconds) ? Math.min(BOOT_FADE_LIMITS.max, Math.max(BOOT_FADE_LIMITS.min, seconds)) : BOOT_FADE_DEFAULT_SECONDS;
8
8
  }
9
- /** The fade time in force: `?loadfade=<seconds>`, else the saved setting, else the default. */
10
- export function bootFadeSeconds(search = window.location.search) {
11
- const asked = new URLSearchParams(search).get("loadfade");
12
- if (asked !== null && asked.trim() !== "")
13
- return clampFade(Number(asked));
9
+ /** The fade time in force: the look's `loadFadeSeconds` (the scene's, or the address's over it), else the saved setting, else the default. */
10
+ export function bootFadeSeconds(look = {}) {
11
+ if (look.loadFadeSeconds !== undefined)
12
+ return clampFade(look.loadFadeSeconds);
14
13
  try {
15
14
  const saved = window.localStorage.getItem(STORAGE_KEY);
16
15
  if (saved !== null)
@@ -26,48 +25,3 @@ export function saveBootFadeSeconds(seconds) {
26
25
  }
27
26
  catch { /* not saved */ }
28
27
  }
29
- // The loader's markup as the page first had it, kept so a switch inside the page can bring the cover back after it was removed.
30
- const bootTemplate = typeof document === "undefined" ? null : document.getElementById("boot")?.cloneNode(true) ?? null;
31
- // How many times the cover has been brought back, so a scene mounted before the latest showing cannot hide it (I-074).
32
- let showings = 0;
33
- // The removal a hide scheduled after its fade, cancelled when the cover is shown again before it runs (I-074).
34
- let removal;
35
- /** The cover's current showing; a scene notes it when it mounts and hands it to `hideBootLoader`. */
36
- export function bootShowing() {
37
- return showings;
38
- }
39
- /** Brings the loading cover back (a switch inside the page); a no-op when the page never had one. Hidden again by `hideBootLoader` on the next scene's first frame. */
40
- export function showBootLoader() {
41
- showings += 1;
42
- if (removal !== undefined) {
43
- window.clearTimeout(removal);
44
- removal = undefined;
45
- }
46
- const existing = document.getElementById("boot");
47
- if (existing !== null) {
48
- existing.style.removeProperty("--boot-fade");
49
- existing.dataset.state = "loading";
50
- return;
51
- }
52
- if (bootTemplate === null)
53
- return;
54
- const boot = bootTemplate.cloneNode(true);
55
- boot.dataset.state = "loading";
56
- document.body.prepend(boot);
57
- }
58
- /** Fades the loader out and removes it. Safe to call more than once. A scene passes the showing it mounted under; a later showing is not its to hide. */
59
- export function hideBootLoader(showing = showings) {
60
- const boot = document.getElementById("boot");
61
- if (showing !== showings || boot === null || boot.dataset.state === "done" || boot.dataset.state === "failed")
62
- return;
63
- const seconds = bootFadeSeconds();
64
- boot.style.setProperty("--boot-fade", `${seconds}s`);
65
- boot.dataset.state = "done";
66
- removal = window.setTimeout(() => { removal = undefined; boot.remove(); }, seconds * 1000 + 100);
67
- }
68
- /** Replaces the loader's animation with its failure message. */
69
- export function failBootLoader() {
70
- const boot = document.getElementById("boot");
71
- if (boot !== null)
72
- boot.dataset.state = "failed";
73
- }
@@ -10,27 +10,27 @@
10
10
  }
11
11
 
12
12
  /* Top bar: one tight row, close to the corner. */
13
- [data-embedded="true"][data-phone="false"] .shell-top { top: 6px; left: 6px; max-width: calc(100vw - 120px); --shell-timeline-space: 60px; }
14
- [data-embedded="true"][data-phone="false"] .top-bar { gap: 4px; padding: 3px; border-radius: 10px; box-shadow: 0 4px 14px rgba(0, 0, 0, .24); }
15
- [data-embedded="true"][data-phone="false"] .top-bar-divider { height: 16px; margin: 0 2px; }
16
- [data-embedded="true"][data-phone="false"] .developer-mode-toggle { top: 9px; right: 8px; }
17
- [data-embedded="true"][data-phone="false"] .scale-menu,
18
- [data-embedded="true"][data-phone="false"] .scale-explanation-panel { top: calc(100% + 4px); }
13
+ .astraeus-shell[data-embedded="true"]:where([data-phone="false"]) .shell-top { top: 6px; left: 6px; max-width: calc(100vw - 120px); --shell-timeline-space: 60px; }
14
+ .astraeus-shell[data-embedded="true"][data-phone="false"] .top-bar { gap: 4px; padding: 3px; border-radius: 10px; box-shadow: 0 4px 14px rgba(0, 0, 0, .24); }
15
+ .astraeus-shell[data-embedded="true"][data-phone="false"] .top-bar-divider { height: 16px; margin: 0 2px; }
16
+ .astraeus-shell[data-embedded="true"][data-phone="false"] .developer-mode-toggle { top: 9px; right: 8px; }
17
+ .astraeus-shell[data-embedded="true"][data-phone="false"] .scale-menu,
18
+ .astraeus-shell[data-embedded="true"][data-phone="false"] .scale-explanation-panel { top: calc(100% + 4px); }
19
19
 
20
20
  /* Timeline: one slim line, a thinner scrubber. */
21
- [data-embedded="true"][data-phone="false"] .timeline-bar { right: 6px; bottom: 6px; left: 6px; padding: 3px 8px; border-radius: 10px; font-size: 12px; }
22
- [data-embedded="true"][data-phone="false"] .timeline-main-row { gap: 8px; }
23
- [data-embedded="true"][data-phone="false"] .timeline-time { font-size: 12px; }
24
- [data-embedded="true"][data-phone="false"] .timeline-bar .timeline-speed select { width: 150px; }
21
+ .astraeus-shell[data-embedded="true"][data-phone="false"] .timeline-bar { right: 6px; bottom: 6px; left: 6px; padding: 3px 8px; border-radius: 10px; font-size: 12px; }
22
+ .astraeus-shell[data-embedded="true"][data-phone="false"] .timeline-main-row { gap: 8px; }
23
+ .astraeus-shell[data-embedded="true"][data-phone="false"] .timeline-time { font-size: 12px; }
24
+ .astraeus-shell[data-embedded="true"][data-phone="false"] .timeline-bar .timeline-speed select { width: 150px; }
25
25
  @media (pointer: fine) {
26
- [data-embedded="true"][data-phone="false"] .timeline-track,
27
- [data-embedded="true"][data-phone="false"] .timeline-track input[type="range"],
28
- [data-embedded="true"][data-phone="false"] .timeline-track input[type="range"]::-webkit-slider-runnable-track { height: 20px; }
29
- [data-embedded="true"][data-phone="false"] .timeline-track input[type="range"]::-webkit-slider-thumb { margin-top: 1px; }
26
+ .astraeus-shell[data-embedded="true"][data-phone="false"] .timeline-track,
27
+ .astraeus-shell[data-embedded="true"][data-phone="false"] .timeline-track input[type="range"],
28
+ .astraeus-shell[data-embedded="true"][data-phone="false"] .timeline-track input[type="range"]::-webkit-slider-runnable-track { height: 20px; }
29
+ .astraeus-shell[data-embedded="true"][data-phone="false"] .timeline-track input[type="range"]::-webkit-slider-thumb { margin-top: 1px; }
30
30
  }
31
- [data-embedded="true"][data-phone="false"] .timeline-bar .timeline-expanded { bottom: calc(100% + 6px); }
31
+ .astraeus-shell[data-embedded="true"][data-phone="false"] .timeline-bar .timeline-expanded { bottom: calc(100% + 6px); }
32
32
 
33
33
  /* A phone-sized frame keeps its pill, drawers and 44 px targets; only the margins and the timeline's padding tighten. */
34
- [data-embedded="true"][data-phone="true"] .controls-pill { top: calc(4px + var(--safe-top)); left: calc(4px + var(--safe-left)); }
35
- [data-embedded="true"][data-phone="true"] .developer-mode-toggle { top: calc(4px + var(--safe-top)); right: calc(4px + var(--safe-right)); }
36
- [data-embedded="true"][data-phone="true"] .timeline-bar { right: calc(4px + var(--safe-right)); bottom: calc(4px + var(--safe-bottom)); left: calc(4px + var(--safe-left)); padding: 14px 8px 1px; }
34
+ .astraeus-shell[data-embedded="true"][data-phone="true"] .controls-pill { top: calc(4px + var(--safe-top)); left: calc(4px + var(--safe-left)); }
35
+ .astraeus-shell[data-embedded="true"][data-phone="true"] .developer-mode-toggle { top: calc(4px + var(--safe-top)); right: calc(4px + var(--safe-right)); }
36
+ .astraeus-shell[data-embedded="true"][data-phone="true"] .timeline-bar { right: calc(4px + var(--safe-right)); bottom: calc(4px + var(--safe-bottom)); left: calc(4px + var(--safe-left)); padding: 14px 8px 1px; }
@@ -65,7 +65,7 @@ export interface ExperienceConfig {
65
65
  readonly rates: readonly number[];
66
66
  /** True draws no timeline bar (and no phone timeline drawer or reserved space); the clock then runs or stays frozen as the definition says. Absent: the bar is shown. */
67
67
  readonly hideTimeline?: boolean;
68
- /** Short story panels that open as playback reaches their time; see `parseStoryPanels`. Omit for an experience with none. */
68
+ /** Short story panels that open as playback reaches their time; see `resolveStoryPanels`. Omit for an experience with none. */
69
69
  readonly storyPanels?: StoryPanelSet;
70
70
  /** A planet's moons by family for the sliding moon panel; omit for an experience with none. Every moon listed must also be an object. */
71
71
  readonly moonFamilies?: MoonFamilyList;
@@ -1,3 +1,5 @@
1
+ import { moonCountText, moonListDateText, moonListSummary } from "../core/moonListText.js";
2
+ export { moonCountText, moonListDateText, moonListSummary };
1
3
  /**
2
4
  * What the moon browser (the sliding panel of a planet's moons by family) needs, as plain data any experience can hand the shell
3
5
  * (ARCH-01): families with a one-line description, and each family's moons. The panel shows named moons first and folds the unnamed away.
@@ -35,12 +37,6 @@ export interface MoonSplit {
35
37
  }
36
38
  /** Named moons first (as listed), provisional designations apart. */
37
39
  export declare function splitNamed(moons: readonly MoonListing[]): MoonSplit;
38
- /** A family's heading count: "5 moons", "1 moon". */
39
- export declare function moonCountText(count: number): string;
40
- /** A date from the data (YYYY-MM-DD, or an ISO timestamp) as "18 October 2026"; the text itself when it is not a date. */
41
- export declare function moonListDateText(date: string): string;
42
- /** "115 moons in the JPL Horizons list of 18 October 2026": the count is the moons the list holds, the source and date come from the data. */
43
- export declare function moonListSummary(count: number, source?: string, date?: string): string;
44
40
  /** The summary of a whole moon list: every moon in every family, counted live. */
45
41
  export declare const moonFamilyListSummary: (list: MoonFamilyList) => string;
46
42
  export interface MoonMatch {
@@ -1,26 +1,10 @@
1
+ import { moonCountText, moonListDateText, moonListSummary } from "../core/moonListText.js";
2
+ export { moonCountText, moonListDateText, moonListSummary };
1
3
  /** Named moons first (as listed), provisional designations apart. */
2
4
  export function splitNamed(moons) {
3
5
  return { named: moons.filter((moon) => moon.named), unnamed: moons.filter((moon) => !moon.named) };
4
6
  }
5
7
  const squash = (text) => text.toLowerCase().replace(/[^a-z0-9]+/g, "");
6
- /** A family's heading count: "5 moons", "1 moon". */
7
- export function moonCountText(count) {
8
- return count === 1 ? "1 moon" : `${count} moons`;
9
- }
10
- /** A date from the data (YYYY-MM-DD, or an ISO timestamp) as "18 October 2026"; the text itself when it is not a date. */
11
- export function moonListDateText(date) {
12
- const parsed = /^\d{4}-\d{2}-\d{2}/.test(date) ? new Date(`${date.slice(0, 10)}T00:00:00Z`) : new Date(Number.NaN);
13
- return Number.isNaN(parsed.getTime()) ? date : parsed.toLocaleDateString("en-GB", { day: "numeric", month: "long", year: "numeric", timeZone: "UTC" });
14
- }
15
- /** "115 moons in the JPL Horizons list of 18 October 2026": the count is the moons the list holds, the source and date come from the data. */
16
- export function moonListSummary(count, source, date) {
17
- const head = moonCountText(count);
18
- if (source !== undefined && date !== undefined)
19
- return `${head} in the ${source} list of ${moonListDateText(date)}`;
20
- if (date !== undefined)
21
- return `${head}, list of ${moonListDateText(date)}`;
22
- return head;
23
- }
24
8
  /** The summary of a whole moon list: every moon in every family, counted live. */
25
9
  export const moonFamilyListSummary = (list) => moonListSummary(list.families.reduce((total, family) => total + family.moons.length, 0), list.listSource, list.listDate);
26
10
  /** The moons whose name or designation contains the query, ignoring case, spaces and punctuation ("s2003 j19" finds "S/2003 J 19"); none for an empty query. */
@@ -14,7 +14,7 @@
14
14
  }
15
15
 
16
16
  /* ---- Top: the pill and the cog ---- */
17
- [data-phone="true"] .controls-pill {
17
+ .astraeus-shell[data-phone="true"] .controls-pill {
18
18
  position: absolute;
19
19
  z-index: 5;
20
20
  top: calc(8px + var(--safe-top));
@@ -24,19 +24,19 @@
24
24
  /* A vertical swipe on the pill is ours (it opens the drawer), not a page pan. */
25
25
  touch-action: none;
26
26
  }
27
- [data-phone="true"] .controls-pill-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
28
- [data-phone="true"] .controls-pill[aria-expanded="true"] { visibility: hidden; }
29
- [data-phone="true"] .developer-mode-toggle { z-index: 9; top: calc(8px + var(--safe-top)); right: calc(8px + var(--safe-right)); }
27
+ .astraeus-shell[data-phone="true"] .controls-pill-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
28
+ .astraeus-shell[data-phone="true"] .controls-pill[aria-expanded="true"] { visibility: hidden; }
29
+ .astraeus-shell[data-phone="true"] .developer-mode-toggle { z-index: 9; top: calc(8px + var(--safe-top)); right: calc(8px + var(--safe-right)); }
30
30
 
31
31
  /* ---- The drawers ---- */
32
- .drawer-handle { position: absolute; left: 50%; display: flex; width: 140px; height: 44px; transform: translateX(-50%); touch-action: none; }
33
- .drawer-handle span { display: block; width: 36px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--ui-color, #f0e6da) 28%, transparent); }
34
- .drawer-handle:hover span { background: color-mix(in srgb, var(--ui-color, #f0e6da) 50%, transparent); }
32
+ .astraeus-shell :where(.drawer-handle) { position: absolute; left: 50%; display: flex; width: 140px; height: 44px; transform: translateX(-50%); touch-action: none; }
33
+ .astraeus-shell .drawer-handle span { display: block; width: 36px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--ui-color, #f0e6da) 28%, transparent); }
34
+ .astraeus-shell .drawer-handle:hover span { background: color-mix(in srgb, var(--ui-color, #f0e6da) 50%, transparent); }
35
35
  /* The hit area (44 px) reaches past the panel's edge so a thumb finds it; the grip is drawn inside the panel. */
36
- .drawer-handle-top { top: -28px; align-items: flex-end; justify-content: center; padding-bottom: 10px; }
37
- .drawer-handle-bottom { bottom: -20px; align-items: flex-start; justify-content: center; padding-top: 12px; }
36
+ .astraeus-shell :where(.drawer-handle-top) { top: -28px; align-items: flex-end; justify-content: center; padding-bottom: 10px; }
37
+ .astraeus-shell :where(.drawer-handle-bottom) { bottom: -20px; align-items: flex-start; justify-content: center; padding-top: 12px; }
38
38
 
39
- [data-phone="true"] .controls-drawer {
39
+ .astraeus-shell[data-phone="true"] .controls-drawer {
40
40
  position: absolute;
41
41
  z-index: 7;
42
42
  top: 0;
@@ -55,13 +55,13 @@
55
55
  visibility: hidden;
56
56
  transition: transform var(--drawer-ms, 240ms) var(--drawer-ease), visibility 0s linear var(--drawer-ms, 240ms);
57
57
  }
58
- [data-phone="true"] .controls-drawer[data-open="true"] {
58
+ .astraeus-shell[data-phone="true"] .controls-drawer[data-open="true"] {
59
59
  transform: none;
60
60
  visibility: visible;
61
61
  transition: transform var(--drawer-ms, 240ms) var(--drawer-ease), visibility 0s;
62
62
  }
63
- [data-phone="true"] .controls-drawer .shell-toolbar { max-width: none; }
64
- [data-phone="true"] .controls-drawer .top-bar {
63
+ .astraeus-shell[data-phone="true"] .controls-drawer .shell-toolbar { max-width: none; }
64
+ .astraeus-shell[data-phone="true"] .controls-drawer .top-bar {
65
65
  display: grid;
66
66
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
67
67
  gap: 8px;
@@ -71,26 +71,26 @@
71
71
  box-shadow: none;
72
72
  backdrop-filter: none;
73
73
  }
74
- [data-phone="true"] .controls-drawer .object-camera-actions { display: contents; }
75
- [data-phone="true"] .controls-drawer .top-bar-divider { display: none; }
74
+ .astraeus-shell[data-phone="true"] .controls-drawer .object-camera-actions { display: contents; }
75
+ .astraeus-shell[data-phone="true"] .controls-drawer .top-bar-divider { display: none; }
76
76
  /* The object list takes the first row, leaving room for the cog at the right. */
77
- [data-phone="true"] .controls-drawer .object-picker { grid-column: 1 / -1; width: calc(100% - 52px); max-width: none; }
77
+ .astraeus-shell[data-phone="true"] .controls-drawer .object-picker { grid-column: 1 / -1; width: calc(100% - 52px); max-width: none; }
78
78
  /* Each button: icon over a short word. */
79
- [data-phone="true"] .controls-drawer .display-switches { display: contents; }
80
- [data-phone="true"] .controls-drawer .top-bar-button { width: auto; flex-direction: column; gap: 2px; padding: 0 4px; }
81
- [data-phone="true"] .controls-drawer .top-bar-button-text { display: block; max-width: 100%; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
82
- [data-phone="true"] .controls-drawer .switch-control { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 8px; }
83
- [data-phone="true"] .controls-drawer .scale-toggle { padding: 0 4px; }
84
- [data-phone="true"] .controls-drawer .scale-toggle > span { font-size: 11px; }
85
- [data-phone="true"] .controls-drawer .scale-menu,
86
- [data-phone="true"] .controls-drawer .scale-explanation-panel { top: calc(100% + 6px); right: auto; left: 0; width: min(320px, calc(100vw - 32px)); }
79
+ .astraeus-shell[data-phone="true"] .controls-drawer .display-switches { display: contents; }
80
+ .astraeus-shell[data-phone="true"] .controls-drawer .top-bar-button { width: auto; flex-direction: column; gap: 2px; padding: 0 4px; }
81
+ .astraeus-shell[data-phone="true"] .controls-drawer .top-bar-button-text { display: block; max-width: 100%; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
82
+ .astraeus-shell[data-phone="true"] .controls-drawer .switch-control { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 8px; }
83
+ .astraeus-shell[data-phone="true"] .controls-drawer .scale-toggle { padding: 0 4px; }
84
+ .astraeus-shell[data-phone="true"] .controls-drawer .scale-toggle > span { font-size: 11px; }
85
+ .astraeus-shell[data-phone="true"] .controls-drawer .scale-menu,
86
+ .astraeus-shell[data-phone="true"] .controls-drawer .scale-explanation-panel { top: calc(100% + 6px); right: auto; left: 0; width: min(320px, calc(100vw - 32px)); }
87
87
  /* The switch panel stays clear of the cog's column (60 px at the right) and the drawer's edge. */
88
- [data-phone="true"] .controls-drawer .switch-panel { top: calc(100% + 6px); right: auto; left: 0; width: min(260px, calc(100vw - 84px)); min-width: 0; }
89
- [data-phone="true"] .controls-drawer .top-bar { position: relative; }
90
- [data-phone="true"] .controls-drawer .scale-control { position: static; }
88
+ .astraeus-shell[data-phone="true"] .controls-drawer .switch-panel { top: calc(100% + 6px); right: auto; left: 0; width: min(260px, calc(100vw - 84px)); min-width: 0; }
89
+ .astraeus-shell[data-phone="true"] .controls-drawer .top-bar { position: relative; }
90
+ .astraeus-shell[data-phone="true"] .controls-drawer .scale-control { position: static; }
91
91
 
92
92
  /* ---- Bottom: the two-line timeline and its drawer ---- */
93
- [data-phone="true"] .timeline-bar {
93
+ .astraeus-shell[data-phone="true"] .timeline-bar {
94
94
  right: calc(8px + var(--safe-right));
95
95
  bottom: calc(8px + var(--safe-bottom));
96
96
  left: calc(8px + var(--safe-left));
@@ -99,26 +99,26 @@
99
99
  padding: 16px 10px 2px;
100
100
  border-radius: 18px;
101
101
  }
102
- [data-phone="true"] .timeline-bar[data-drawer-open="true"] { z-index: 6; background: var(--panel-bg); }
103
- [data-phone="true"] .timeline-main-row { gap: 4px; }
104
- [data-phone="true"] .timeline-time { flex-basis: auto; width: auto; }
105
- [data-phone="true"] .timeline-time-full { display: none; }
106
- [data-phone="true"] .timeline-time-short { display: inline; }
107
- [data-phone="true"] .timeline-bar .timeline-speed select { width: 96px; }
108
- [data-phone="true"] .timeline-scrubber { flex-basis: 100%; }
102
+ .astraeus-shell[data-phone="true"] .timeline-bar[data-drawer-open="true"] { z-index: 6; background: var(--panel-bg); }
103
+ .astraeus-shell[data-phone="true"] .timeline-main-row { gap: 4px; }
104
+ .astraeus-shell[data-phone="true"] .timeline-time { flex-basis: auto; width: auto; }
105
+ .astraeus-shell[data-phone="true"] .timeline-time-full { display: none; }
106
+ .astraeus-shell[data-phone="true"] .timeline-time-short { display: inline; }
107
+ .astraeus-shell[data-phone="true"] .timeline-bar .timeline-speed select { width: 96px; }
108
+ .astraeus-shell[data-phone="true"] .timeline-scrubber { flex-basis: 100%; }
109
109
 
110
- .timeline-drawer {
110
+ .astraeus-shell .timeline-drawer {
111
111
  display: grid;
112
112
  grid-template-rows: 0fr;
113
113
  visibility: hidden;
114
114
  transition: grid-template-rows var(--drawer-ms, 240ms) var(--drawer-ease), visibility 0s linear var(--drawer-ms, 240ms);
115
115
  }
116
- .timeline-drawer[data-open="true"] {
116
+ .astraeus-shell .timeline-drawer[data-open="true"] {
117
117
  grid-template-rows: 1fr;
118
118
  visibility: visible;
119
119
  transition: grid-template-rows var(--drawer-ms, 240ms) var(--drawer-ease), visibility 0s;
120
120
  }
121
- .timeline-drawer-body {
121
+ .astraeus-shell .timeline-drawer-body {
122
122
  display: flex;
123
123
  flex-direction: column;
124
124
  gap: 10px;
@@ -127,22 +127,22 @@
127
127
  overflow-y: auto;
128
128
  overscroll-behavior: contain;
129
129
  }
130
- .timeline-drawer[data-open="true"] .timeline-drawer-body { padding-top: 10px; }
131
- .timeline-speed-slider { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0 10px; color: var(--ui-muted, #c7bdb3); font-size: 13px; }
132
- .timeline-speed-slider input { grid-column: 1 / -1; grid-row: 2; width: 100%; min-height: 44px; margin: 0; accent-color: var(--ui-accent, #fc6323); }
133
- .timeline-speed-slider output { color: var(--ui-color, #f0e6da); font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; text-align: right; }
130
+ .astraeus-shell .timeline-drawer[data-open="true"] .timeline-drawer-body { padding-top: 10px; }
131
+ .astraeus-shell .timeline-speed-slider { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0 10px; color: var(--ui-muted, #c7bdb3); font-size: 13px; }
132
+ .astraeus-shell :where(.timeline-speed-slider) input { grid-column: 1 / -1; grid-row: 2; width: 100%; min-height: 44px; margin: 0; accent-color: var(--ui-accent, #fc6323); }
133
+ .astraeus-shell .timeline-speed-slider output { color: var(--ui-color, #f0e6da); font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; text-align: right; }
134
134
  /* Inside the drawer the events list is plain content, not a pop-up. */
135
- .timeline-drawer .timeline-expanded { position: static; width: auto; max-height: none; overflow: visible; padding: 0; border: 0; background: none; box-shadow: none; }
135
+ .astraeus-shell .timeline-drawer .timeline-expanded { position: static; width: auto; max-height: none; overflow: visible; padding: 0; border: 0; background: none; box-shadow: none; }
136
136
 
137
137
  /* An event row is two short lines (the time, then its name) so the name is not cut off. */
138
- .timeline-drawer .timeline-expanded li button { flex-direction: column; align-items: flex-start; gap: 0; padding-top: 4px; padding-bottom: 4px; }
139
- .timeline-drawer .timeline-expanded li span { max-width: 100%; white-space: normal; }
138
+ .astraeus-shell .timeline-drawer .timeline-expanded li button { flex-direction: column; align-items: flex-start; gap: 0; padding-top: 4px; padding-bottom: 4px; }
139
+ .astraeus-shell .timeline-drawer .timeline-expanded li span { max-width: 100%; white-space: normal; }
140
140
 
141
141
  /* ---- Sheets: information and story panels ---- */
142
- [data-phone="true"] .sheet-handle { display: block; flex: 0 0 auto; align-self: center; width: 40px; height: 4px; border-radius: 999px; background: color-mix(in srgb, var(--ui-accent, #fc6323) 45%, transparent); }
142
+ .astraeus-shell[data-phone="true"] .sheet-handle { display: block; flex: 0 0 auto; align-self: center; width: 40px; height: 4px; border-radius: 999px; background: color-mix(in srgb, var(--ui-accent, #fc6323) 45%, transparent); }
143
143
  /* Both sheets ride above the timeline bar, so the Play button is never covered (C-053 Observation 2, O-020 Decision 13). */
144
- [data-phone="true"] .info-panel,
145
- [data-phone="true"] .story-panel {
144
+ .astraeus-shell[data-phone="true"] .info-panel,
145
+ .astraeus-shell[data-phone="true"] .story-panel {
146
146
  position: fixed;
147
147
  top: auto;
148
148
  bottom: calc(var(--timeline-space, 150px) + 8px);
@@ -158,12 +158,12 @@
158
158
  border-radius: 16px;
159
159
  animation: story-sheet-in var(--drawer-ms, 240ms) var(--drawer-ease);
160
160
  }
161
- [data-phone="true"] .info-panel { z-index: 8; background: #0e0e13; }
162
- [data-phone="true"] .story-panel { z-index: 4; touch-action: pan-y; } /* a pinch reaches the scene beneath (useZoomThrough); a vertical drag still scrolls or dismisses */
163
- [data-phone="true"] .info-panel-header h2 { margin: 0; font-size: 22px; }
161
+ .astraeus-shell[data-phone="true"] .info-panel { z-index: 8; background: #0e0e13; }
162
+ .astraeus-shell[data-phone="true"] .story-panel { z-index: 4; touch-action: pan-y; } /* a pinch reaches the scene beneath (useZoomThrough); a vertical drag still scrolls or dismisses */
163
+ .astraeus-shell[data-phone="true"] .info-panel-header h2 { margin: 0; font-size: 22px; }
164
164
 
165
165
  /* ---- The Developer panel below the pill, above the timeline ---- */
166
- [data-phone="true"] .developer-tools {
166
+ .astraeus-shell[data-phone="true"] .developer-tools {
167
167
  top: calc(60px + var(--safe-top));
168
168
  right: calc(8px + var(--safe-right));
169
169
  left: calc(8px + var(--safe-left));
@@ -171,12 +171,12 @@
171
171
  max-height: max(160px, calc(100dvh - 60px - var(--safe-top) - var(--timeline-space, 150px) - 16px));
172
172
  padding: 9px;
173
173
  }
174
- [data-phone="true"] .shell-top { top: 8px; left: 8px; width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: none; }
175
- [data-phone="true"] .astraeus-label { font-size: 12px; }
174
+ .astraeus-shell[data-phone="true"] .shell-top { top: 8px; left: 8px; width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: none; }
175
+ .astraeus-shell[data-phone="true"] .astraeus-label { font-size: 12px; }
176
176
 
177
177
  @media (prefers-reduced-motion: reduce) {
178
- .controls-drawer,
179
- .timeline-drawer,
180
- .info-panel,
181
- .story-panel { transition: none !important; animation: none !important; }
178
+ .astraeus-shell .controls-drawer,
179
+ .astraeus-shell .timeline-drawer,
180
+ .astraeus-shell .info-panel,
181
+ .astraeus-shell .story-panel { transition: none !important; animation: none !important; }
182
182
  }
@@ -1,61 +1,10 @@
1
- import type { TimeBounds } from "../core/trajectory.js";
2
- /** How a panel's facts are labelled: measured or published values, a model of them, or a picture made to explain. */
3
- export type PanelBadge = "observed" | "modelled" | "illustrative";
4
- export declare const PANEL_BADGES: readonly PanelBadge[];
5
- /** One short story panel, resolved to a UTC time. */
6
- export interface StoryPanel {
7
- readonly id: string;
8
- readonly timeUtcMs: number;
9
- readonly title: string;
10
- /** Paragraphs, in order. */
11
- readonly body: readonly string[];
12
- readonly badge: PanelBadge;
13
- /** Short paragraphs of exact figures and measured-versus-reconstructed notes, shown in the folded section above the sources. Empty when the panel has none. */
14
- readonly details: readonly string[];
15
- /** One line per cited source (PROV-01); never empty. */
16
- readonly sources: readonly string[];
17
- /** A shell object this panel is about; the scene draws a marker on it that reopens the panel. */
18
- readonly objectId?: string;
19
- }
20
- /** The panels an experience offers, with the defaults of the two settings that govern them. */
21
- export interface StoryPanelSet {
22
- readonly panels: readonly StoryPanel[];
23
- /** How long playback holds when a panel opens by itself, in seconds (0 never pauses). */
24
- readonly pauseSeconds: number;
25
- /** Whether panels open by themselves as forward playback reaches them. */
26
- readonly autoOpen: boolean;
27
- }
28
- export declare const DEFAULT_PANEL_PAUSE_SECONDS = 6;
29
- export declare const MAX_PANEL_PAUSE_SECONDS = 20;
30
- /** What a story's settings may point a panel's time at, besides a plain UTC time. */
31
- export interface PanelLookup {
32
- readonly events: readonly {
33
- readonly id: string;
34
- readonly timeUtcMs: number;
35
- }[];
36
- /** Source anchors by id, when the experience has them. */
37
- readonly anchors?: ReadonlyMap<string, number>;
38
- /** Ids a panel's `object` may name. Absent: any id is accepted. */
39
- readonly objectIds?: readonly string[];
40
- /** When given, every panel must fall inside it. */
41
- readonly window?: TimeBounds;
42
- }
43
- /** A panel's settings entry is wrong; the message names the panel and the field. */
44
- export declare class StoryPanelError extends Error {
45
- constructor(panel: string, field: string, problem: string);
46
- }
47
- /**
48
- * Validates a story's panel settings (STYLE-06) and resolves each panel's time. Shape:
49
- * `{ pauseSeconds?, autoOpen?, panels: [{ id, at: { utc | event | anchor }, title, body, details?, badge, sources, object? }] }`.
50
- * Panels come back sorted by time; ids must be unique.
51
- */
52
- export declare function parseStoryPanels(raw: unknown, lookup: PanelLookup): StoryPanelSet;
1
+ import type { StoryPanel } from "../core/storyPanels.js";
2
+ export { checkPanelPlayback, checkStoryPanel, DEFAULT_PANEL_PAUSE_SECONDS, MAX_PANEL_PAUSE_SECONDS, resolveStoryPanels, StoryPanelError, type PanelLookup, type StoryPanel, type StoryPanelSet, } from "../core/storyPanels.js";
53
3
  /**
54
4
  * The panels forward playback just passed: those with `previousMs < time <= currentMs`, in time order.
55
5
  * A backward step or no movement crosses nothing, so loops and rewinds never open a panel.
56
6
  */
57
7
  export declare function panelsCrossed(panels: readonly StoryPanel[], previousMs: number, currentMs: number): readonly StoryPanel[];
58
- export declare const BADGE_LABELS: Readonly<Record<PanelBadge, string>>;
59
8
  /**
60
9
  * Decides, tick by tick, whether playback has just carried the clock across a panel. It remembers the last time it saw;
61
10
  * `rebase` moves that memory when a person seeks, so a jump is never read as playback and opens nothing.
@@ -1,104 +1,4 @@
1
- export const PANEL_BADGES = ["observed", "modelled", "illustrative"];
2
- export const DEFAULT_PANEL_PAUSE_SECONDS = 6;
3
- export const MAX_PANEL_PAUSE_SECONDS = 20;
4
- /** A panel's settings entry is wrong; the message names the panel and the field. */
5
- export class StoryPanelError extends Error {
6
- constructor(panel, field, problem) {
7
- super(`story panel ${panel}: ${field} ${problem}`);
8
- this.name = "StoryPanelError";
9
- }
10
- }
11
- const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
12
- function text(panel, field, value) {
13
- if (typeof value !== "string" || value.trim() === "")
14
- throw new StoryPanelError(panel, field, "must be non-empty text");
15
- return value;
16
- }
17
- function lines(panel, field, value) {
18
- const list = typeof value === "string" ? [value] : value;
19
- if (!Array.isArray(list) || list.length === 0)
20
- throw new StoryPanelError(panel, field, "must be one or more non-empty lines");
21
- return list.map((line, index) => text(panel, `${field}[${index}]`, line));
22
- }
23
- function timeOf(panel, at, lookup) {
24
- if (!isRecord(at))
25
- throw new StoryPanelError(panel, "at", "must name a time: { utc }, { event } or { anchor }");
26
- const keys = ["utc", "event", "anchor"].filter((key) => at[key] !== undefined);
27
- if (keys.length !== 1)
28
- throw new StoryPanelError(panel, "at", "must give exactly one of utc, event or anchor");
29
- if (keys[0] === "utc") {
30
- const utc = text(panel, "at.utc", at.utc);
31
- const ms = Date.parse(utc);
32
- if (!/Z$/.test(utc) || !Number.isFinite(ms))
33
- throw new StoryPanelError(panel, "at.utc", `must be an ISO-8601 UTC time ending in Z, got "${utc}"`);
34
- return ms;
35
- }
36
- if (keys[0] === "event") {
37
- const id = text(panel, "at.event", at.event);
38
- const event = lookup.events.find((candidate) => candidate.id === id);
39
- if (event === undefined)
40
- throw new StoryPanelError(panel, "at.event", `names "${id}", which the experience's events lack`);
41
- return event.timeUtcMs;
42
- }
43
- const id = text(panel, "at.anchor", at.anchor);
44
- const anchor = lookup.anchors?.get(id);
45
- if (anchor === undefined)
46
- throw new StoryPanelError(panel, "at.anchor", `names "${id}", which the experience's anchors lack`);
47
- return anchor;
48
- }
49
- function parsePanel(raw, index, lookup) {
50
- if (!isRecord(raw))
51
- throw new StoryPanelError(`#${index + 1}`, "entry", "must be an object");
52
- const id = text(`#${index + 1}`, "id", raw.id);
53
- const timeUtcMs = timeOf(id, raw.at, lookup);
54
- if (lookup.window !== undefined && (timeUtcMs < lookup.window.startUtcMs || timeUtcMs > lookup.window.endUtcMs)) {
55
- throw new StoryPanelError(id, "at", "falls outside the timeline window");
56
- }
57
- const badge = raw.badge;
58
- if (!PANEL_BADGES.includes(badge))
59
- throw new StoryPanelError(id, "badge", `must be one of ${PANEL_BADGES.join(", ")}, got ${JSON.stringify(badge)}`);
60
- const objectId = raw.object === undefined ? undefined : text(id, "object", raw.object);
61
- if (objectId !== undefined && lookup.objectIds !== undefined && !lookup.objectIds.includes(objectId)) {
62
- throw new StoryPanelError(id, "object", `names "${objectId}", which the experience lacks`);
63
- }
64
- return {
65
- id,
66
- timeUtcMs,
67
- title: text(id, "title", raw.title),
68
- body: lines(id, "body", raw.body),
69
- badge: badge,
70
- details: raw.details === undefined ? [] : lines(id, "details", raw.details),
71
- sources: lines(id, "sources", raw.sources),
72
- ...(objectId === undefined ? {} : { objectId }),
73
- };
74
- }
75
- /**
76
- * Validates a story's panel settings (STYLE-06) and resolves each panel's time. Shape:
77
- * `{ pauseSeconds?, autoOpen?, panels: [{ id, at: { utc | event | anchor }, title, body, details?, badge, sources, object? }] }`.
78
- * Panels come back sorted by time; ids must be unique.
79
- */
80
- export function parseStoryPanels(raw, lookup) {
81
- if (!isRecord(raw))
82
- throw new StoryPanelError("settings", "panels", "must be an object with a panels list");
83
- const list = raw.panels;
84
- if (!Array.isArray(list))
85
- throw new StoryPanelError("settings", "panels", "must be a list");
86
- const pauseSeconds = raw.pauseSeconds ?? DEFAULT_PANEL_PAUSE_SECONDS;
87
- if (typeof pauseSeconds !== "number" || !Number.isFinite(pauseSeconds) || pauseSeconds < 0 || pauseSeconds > MAX_PANEL_PAUSE_SECONDS) {
88
- throw new StoryPanelError("settings", "pauseSeconds", `must be between 0 and ${MAX_PANEL_PAUSE_SECONDS}, got ${JSON.stringify(pauseSeconds)}`);
89
- }
90
- const autoOpen = raw.autoOpen ?? true;
91
- if (typeof autoOpen !== "boolean")
92
- throw new StoryPanelError("settings", "autoOpen", "must be true or false");
93
- const panels = list.map((entry, index) => parsePanel(entry, index, lookup));
94
- const seen = new Set();
95
- for (const panel of panels) {
96
- if (seen.has(panel.id))
97
- throw new StoryPanelError(panel.id, "id", "is used twice");
98
- seen.add(panel.id);
99
- }
100
- return { panels: [...panels].sort((a, b) => a.timeUtcMs - b.timeUtcMs), pauseSeconds, autoOpen };
101
- }
1
+ export { checkPanelPlayback, checkStoryPanel, DEFAULT_PANEL_PAUSE_SECONDS, MAX_PANEL_PAUSE_SECONDS, resolveStoryPanels, StoryPanelError, } from "../core/storyPanels.js";
102
2
  /**
103
3
  * The panels forward playback just passed: those with `previousMs < time <= currentMs`, in time order.
104
4
  * A backward step or no movement crosses nothing, so loops and rewinds never open a panel.
@@ -108,11 +8,6 @@ export function panelsCrossed(panels, previousMs, currentMs) {
108
8
  return [];
109
9
  return panels.filter((panel) => panel.timeUtcMs > previousMs && panel.timeUtcMs <= currentMs);
110
10
  }
111
- export const BADGE_LABELS = {
112
- observed: "Observed",
113
- modelled: "Modelled",
114
- illustrative: "Illustrative",
115
- };
116
11
  /**
117
12
  * Decides, tick by tick, whether playback has just carried the clock across a panel. It remembers the last time it saw;
118
13
  * `rebase` moves that memory when a person seeks, so a jump is never read as playback and opens nothing.