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
package/src/app/App.js CHANGED
@@ -1,14 +1,18 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Suspense, useCallback, useEffect, useMemo, useRef, useState } from "react";
2
+ import { Suspense, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
3
3
  import { createOrbAstronomyAdapter } from "../core/astronomyAdapter.js";
4
4
  import { viewUpFromSearch, viewUpVector } from "./viewUp.js";
5
- import { applyPacing } from "../core/pacing.js";
5
+ import { activeEventZones, applyPacing, startPaceEase } from "../core/pacing.js";
6
6
  import { openClock } from "./openClock.js";
7
+ import { pickerSwitch } from "./listSwitch.js";
7
8
  import { createSolarSystemScale } from "../core/scalePolicy.js";
8
9
  import { bodySetsOf, cameraReachOf, catalogueOf, compositionOf, experienceWithGroups, groupsOf, initialObjectIdOf, mountedBodiesOf, pageTitleOf, scaleChoiceIdsOf, sceneCenterOf, sunCentredOf, trackedBodiesOf, visualOverridesOf } from "./experienceDefinition.js";
9
10
  import { AstraeusShell } from "../shell/AstraeusShell.js";
10
- import { scaleChoicesFor, scalePolicyFor, startScaleFor } from "../shell/scaleModel.js";
11
- import { scaleFromSearch, timeFromSearch, viewFromSearch, shareViewLink } from "./viewLink.js";
11
+ import { SCALE_CHOICES, scaleChoicesFor, scalePolicyFor, startScaleFor } from "../shell/scaleModel.js";
12
+ import { scaleFromSearch, showFromSearch, timeFromSearch, viewFromAngles, viewFromSearch } from "./viewLink.js";
13
+ import { createOrbitCameraState } from "./CameraController.js";
14
+ import { START_CAMERA_DISTANCE } from "./sceneFraming.js";
15
+ import { addressSearch, shareViewLink } from "./address.js";
12
16
  import { Collapsible } from "../shell/Collapsible.js";
13
17
  import { PanelLoadBoundary } from "./PanelLoadBoundary.js";
14
18
  import { BOOT_FADE_LIMITS, bootFadeSeconds, saveBootFadeSeconds } from "../shell/bootLoader.js";
@@ -17,29 +21,22 @@ import { DEFAULT_ILLUMINATE_ALL } from "./lighting.js";
17
21
  import { SettingButtons, SettingColor, SettingGroup, SettingSlider } from "./SettingControls.js";
18
22
  import { DEFAULT_TIMELINE_GLOW } from "../shell/timelineGlow.js";
19
23
  import { DEFAULT_PHONE_LAYOUT, PHONE_LAYOUT_LIMITS } from "../shell/phoneLayout.js";
20
- import { featureMarkerSpecs, featureMinBodyPxFromSearch } from "./FeatureMarkers.js";
24
+ import { featureMarkerSpecs, featureMinBodyPxOf } from "./FeatureMarkers.js";
21
25
  import { FrameStats } from "./frameStats.js";
22
26
  import { AstraeusScene } from "./AstraeusScene.js";
23
27
  import { HOVER_BRIGHTNESS_DEFAULT } from "./scenePicking.js";
24
28
  import { createSceneResolver } from "./sceneLayout.js";
25
29
  import { loadStarCatalogue } from "../assets/sky.js";
26
- import { resolveSkySettings, withSkyObject } from "./skyModel.js";
30
+ import { withSkyObject } from "./skyModel.js";
27
31
  import { ORBIT_LOOK_LIMITS, resolveOrbitLook } from "../assets/orbitLook.js";
28
32
  import { DEFAULT_BODY_SET_LOOK } from "./bodySet.js";
29
- import { displaySwitchItems, orbitStart } from "./displaySwitches.js";
33
+ import { displaySwitchItems, hostReachable, orbitStart } from "./displaySwitches.js";
30
34
  import { experienceInView, hiddenByView, viewById } from "./viewHiding.js";
31
- import { baseGlowOf, glowLookFromSearch, markerSettingsFromSearch } from "./bodyDraw.js";
32
- import { brightnessFromSearch, milkyWayFromSearch, skyHiddenBySearch } from "./SkyView.js";
35
+ import { baseGlowOf, glowLookOf, markerSettingsOf } from "./bodyDraw.js";
36
+ import { resolveLook } from "./look.js";
37
+ import { applyLook, desktopPicturesOf, lookReadOf, presentationOf, skySettingsOf } from "./liveLook.js";
33
38
  /** Frames-per-second readings kept for the graph: one per 250 ms poll, so about 15 seconds. */
34
39
  const FPS_HISTORY = 60;
35
- /** The sky settings in force: the experience's own, hidden when the address says `?sky=off`. */
36
- function skySettingsOf(definition) {
37
- const settings = resolveSkySettings(definition.sky);
38
- const milkyWay = milkyWayFromSearch(window.location.search) ?? definition.displaySwitches?.milkyWay?.on ?? settings.milkyWay;
39
- const starBrightness = brightnessFromSearch(window.location.search, "stars") ?? settings.starBrightness;
40
- const milkyWayBrightness = brightnessFromSearch(window.location.search, "milkywaybrightness") ?? settings.milkyWayBrightness;
41
- return { ...settings, milkyWay, starBrightness, milkyWayBrightness, visible: settings.visible && !skyHiddenBySearch(window.location.search) };
42
- }
43
40
  /** The labels switched off at the start: objects that set `showLabel: false`, then `?labels=<id>:on|off,...` over them. */
44
41
  export function hiddenLabelsFrom(search, objects) {
45
42
  const hidden = new Set(objects.filter((object) => object.showLabel === false).map((object) => object.id));
@@ -59,6 +56,18 @@ export function loopFromSearch(search, fallback) {
59
56
  const value = new URLSearchParams(search).get("loop");
60
57
  return value === "on" ? true : value === "off" ? false : fallback;
61
58
  }
59
+ /** The scene view showing at the start: `?show=<id>` when it names one of the scene's views, else the scene's own `start` (an unknown id is not an error). */
60
+ function startViewId(definition, search) {
61
+ const asked = showFromSearch(search);
62
+ const known = asked !== undefined && definition.views?.views.some((view) => view.id === asked) === true;
63
+ return known ? asked : definition.views?.start ?? "";
64
+ }
65
+ /** The "Copy view link" button and its readout: offered only when the host turned the address option on (nothing else writes the address). */
66
+ function ViewLinkGroup({ offered, onCopy, ...readout }) {
67
+ if (!offered)
68
+ return null;
69
+ return (_jsxs("div", { className: "view-link", role: "group", "aria-label": "Camera view", children: [_jsx(SettingButtons, { label: "Camera view", children: _jsx("button", { onClick: onCopy, children: "Copy view link" }) }), _jsx(ViewLinkReadout, { ...readout })] }));
70
+ }
62
71
  /** The labels switch's starting state, if the story gave one. */
63
72
  function labelStart(definition) {
64
73
  return definition.displaySwitches?.labels?.on;
@@ -75,20 +84,19 @@ function orbitPathsOf(runtime) {
75
84
  return runtime.composition?.paths ?? [];
76
85
  }
77
86
  /** The up direction at the start: `?up=` in the address, else the experience's own, else the equatorial pole. */
78
- function startViewUp(definition) {
79
- return viewUpFromSearch(window.location.search, definition.viewUp ?? "equatorial");
87
+ function startViewUp(definition, search) {
88
+ return viewUpFromSearch(search, definition.viewUp ?? "equatorial");
80
89
  }
81
90
  function storyStartOf(storySet) {
82
91
  return { autoOpen: storySet?.autoOpen ?? false, pauseSeconds: storySet?.pauseSeconds ?? 0 };
83
92
  }
84
- function switcherOf(definition, runtime, open) {
85
- return definition.switcher === undefined ? undefined : { ...definition.switcher, currentTimeUtcMs: () => runtime.clock.snapshot().timeUtcMs, open };
86
- }
87
93
  /** Everything one mounted experience shares: clock, resolver, catalogue and the settings read from its definition and the address. */
88
- function buildRuntime(definition) {
94
+ function buildRuntime(definition, search) {
89
95
  const adapter = createOrbAstronomyAdapter();
96
+ // The looks in force: the scene's, with the address over them; the one source every look reader below uses.
97
+ const look = resolveLook(definition.look, search);
90
98
  // A copied view link carries the time it was copied at.
91
- const clock = openClock(definition, timeFromSearch(window.location.search));
99
+ const clock = openClock(definition, timeFromSearch(search), shownEventsOf(definition, startViewId(definition, search)));
92
100
  // One resolver per mount: every position in the scene comes from it, whatever the scene centre.
93
101
  const resolver = createSceneResolver(adapter, catalogueOf(definition));
94
102
  return {
@@ -99,67 +107,95 @@ function buildRuntime(definition) {
99
107
  bodies: mountedBodiesOf(definition),
100
108
  composition: compositionOf(definition),
101
109
  overrides: visualOverridesOf(definition),
102
- desktopTextures: definition.desktopTextures === true,
110
+ desktopTextures: desktopPicturesOf(definition, look),
111
+ ...(definition.pictures === undefined ? {} : { pictures: definition.pictures }),
103
112
  sceneCenter: sceneCenterOf(definition),
104
113
  trackedBodies: trackedBodiesOf(definition),
105
114
  groups: groupsOf(definition),
106
115
  bodySets: bodySetsOf(definition),
107
116
  ...sunCentredOf(definition),
108
117
  cameraReach: cameraReachOf(definition),
109
- sky: skySettingsOf(definition),
118
+ look,
119
+ sky: skySettingsOf(definition, look),
110
120
  loopWindow: definition.experience.window,
111
121
  ...(definition.experience.hideTimeline === true ? {} : { stopAtWindow: true }),
112
122
  ...(definition.pacing === undefined ? {} : { pacing: definition.pacing }),
113
- up: viewUpVector(startViewUp(definition)),
123
+ ...(definition.eventZones === undefined ? {} : { eventZones: definition.eventZones }),
124
+ up: viewUpVector(startViewUp(definition, search)),
114
125
  };
115
126
  }
127
+ /** The event ids the view shows, which choose the pacing zones that apply; undefined for a scene without views (every zone applies). */
128
+ function shownEventsOf(definition, viewId) {
129
+ return viewById(definition.views, viewId)?.events;
130
+ }
116
131
  /** Whether the experience has anything the Display controls (markers, labels, timeline, phone layout) act on. */
117
- function showsDisplayControls(definition, runtime, orbitPathCount, storyMarkerCount) {
118
- return orbitPathCount > 0 || runtime.trackedBodies.length > 0 || runtime.sky.visible || storyMarkerCount > 0 || (definition.experience.storyPanels?.panels.length ?? 0) > 0
132
+ function showsDisplayControls(definition, runtime, skyVisible, orbitPathCount, storyMarkerCount) {
133
+ return orbitPathCount > 0 || runtime.trackedBodies.length > 0 || skyVisible || storyMarkerCount > 0 || (definition.experience.storyPanels?.panels.length ?? 0) > 0
119
134
  || runtime.bodies.some((id) => runtime.catalogue.get(id).visual.kind === "sphere");
120
135
  }
136
+ /** The camera as the scene opens it (the start view, else its default framing): what a host reads before the scene's first frame writes `viewReadout`. */
137
+ function openingCamera(definition, runtime, search) {
138
+ const start = viewFromSearch(search) ?? definition.startView;
139
+ if (start !== undefined)
140
+ return start;
141
+ const opening = createOrbitCameraState(START_CAMERA_DISTANCE, runtime.sceneCenter);
142
+ return viewFromAngles(opening.focus, opening.azimuth, opening.elevation, opening.distance);
143
+ }
121
144
  /** The scene's live controls at mount: the address overrides the experience's own start values. */
122
- function initialSceneControls(definition, runtime, experience, startScale, glowBase, storyMarkers, suppliedPolicies) {
123
- const search = window.location.search;
145
+ function initialSceneControls(definition, runtime, experience, startScale, glowBase, storyMarkers, suppliedPolicies, search) {
124
146
  const startView = viewFromSearch(search) ?? definition.startView;
125
147
  return {
126
148
  policy: scalePolicyFor(startScale, suppliedPolicies),
127
149
  cameraRequest: null,
128
150
  showAnchorLabels: labelStart(definition) === true && runtime.trackedBodies.length > 0,
129
151
  loop: loopFromSearch(search, definition.loop === true),
130
- ...(definition.pacing === undefined ? {} : { paceAuto: true }),
131
- up: viewUpVector(startViewUp(definition)),
152
+ ...(definition.pacing === undefined ? {} : { paceAuto: true, pace: { shown: shownEventsOf(definition, startViewId(definition, search)) } }),
153
+ up: viewUpVector(startViewUp(definition, search)),
132
154
  showMilkyWay: runtime.sky.milkyWay,
133
- bodyMarker: markerSettingsFromSearch(search),
134
- ...(glowBase === null ? {} : { glowLook: glowLookFromSearch(search, glowBase) }),
155
+ skyVisible: runtime.sky.visible,
156
+ bodyMarker: markerSettingsOf(runtime.look),
157
+ ...(glowBase === null ? {} : { glowLook: glowLookOf(runtime.look, glowBase) }),
135
158
  starBrightness: runtime.sky.starBrightness,
136
159
  milkyWayBrightness: runtime.sky.milkyWayBrightness,
137
160
  illuminateAll: DEFAULT_ILLUMINATE_ALL,
138
161
  hiddenLabels: hiddenLabelsFrom(search, labelStart(definition) === undefined ? experience.objects : experience.objects.map(({ id }) => ({ id, showLabel: labelStart(definition) }))),
139
162
  ...startOrbitControls(definition),
140
163
  labelObjects: experience.objects,
141
- viewHidden: hiddenByView(definition.views, viewById(definition.views, definition.views?.start ?? ""), experience),
164
+ viewHidden: hiddenByView(definition.views, viewById(definition.views, startViewId(definition, search)), experience),
165
+ loadFadeSeconds: bootFadeSeconds(runtime.look),
166
+ desktopPictures: runtime.desktopTextures,
142
167
  storyMarkers,
143
168
  featureMarkers: featureMarkerSpecs(definition.experience.bodyFeatures),
144
- featureMinBodyPx: featureMinBodyPxFromSearch(search),
169
+ featureMinBodyPx: featureMinBodyPxOf(runtime.look),
145
170
  selectedObjectId: initialObjectIdOf(definition),
146
171
  frameStats: null,
147
172
  groupFills: [],
148
173
  ...(startView === undefined ? {} : { startView }),
149
174
  };
150
175
  }
176
+ /** The Developer drawer when the host asked for developer tools, else nothing (the shell then draws no toggle and no drawer). */
177
+ const drawerWhen = (asked, drawer) => (asked === true ? drawer : undefined);
151
178
  /**
152
- * `onOpenAddress`: the entry's way to open a switch's address in place; without it a switch navigates the page.
153
179
  * `writeTitle`: whether the page heading is set to the experience's name (default true); `mount` and `AstraeusScene` pass false so a host page keeps its own title.
180
+ * `developerTools`: whether the viewer shows the Developer toggle and drawer (default false; the drawer's code is fetched only when a visitor opens it, so off never fetches it; the demo site passes true).
181
+ * `address`: whether the viewer reads the page address (`view`, `t`, `scale`, `up`, `show`, `stars`, `milkyway`, `labels` and the other parameters in the README) and offers a copy-link button that writes it (default false: a host page's address is its own; the demo site passes true).
154
182
  * `host`: the link a host page reads and sets the one clock through (time, speed) and hears its changes from; every change goes through the same handlers as the timeline's own controls.
155
183
  */
156
- export function App({ definition, onOpenAddress, writeTitle = true, host }) {
184
+ export function App({ definition, writeTitle = true, address, developerTools, host }) {
157
185
  // The page heading names the experience once it is open; app.html says only "Astraeus" until then.
158
186
  useEffect(() => {
159
187
  if (writeTitle)
160
188
  document.title = pageTitleOf(definition);
161
189
  }, [definition, writeTitle]);
162
- const runtime = useMemo(() => buildRuntime(definition), [definition]);
190
+ // The address text every reader below uses: the page's when the host turned the option on, else empty. Read once per scene, as before.
191
+ const search = useMemo(() => addressSearch(address), [definition, address]); // eslint-disable-line react-hooks/exhaustive-deps
192
+ const runtime = useMemo(() => buildRuntime(definition, search), [definition, search]);
193
+ // The host link hears the scene's first drawn frame (`onFirstDraw`).
194
+ const told = useCallback(() => host?.firstDraw(), [host]);
195
+ // The host's picker: the pressed option is the host's to move (`setPick`), and a press is only reported (`onPick`).
196
+ const watchPick = useCallback((watcher) => host?.watchPick(watcher) ?? (() => undefined), [host]);
197
+ const hostPick = useSyncExternalStore(watchPick, () => host?.pickNow());
198
+ const choosePick = useCallback((value) => host?.picked(value), [host]);
163
199
  const experienceRuntime = useMemo(() => ({ clock: runtime.clock, resolver: runtime.resolver, catalogue: runtime.catalogue }), [runtime]);
164
200
  // The choices offered, in the experience's order; the solar-system policy enlarges only the bodies the experience names.
165
201
  const scaleChoiceIds = useMemo(() => scaleChoiceIdsOf(definition), [definition]);
@@ -171,7 +207,7 @@ export function App({ definition, onOpenAddress, writeTitle = true, host }) {
171
207
  exaggeration[id] = override.exaggeration;
172
208
  return [createSolarSystemScale({ exaggeration, defaultExaggeration: 1 })];
173
209
  }, [runtime]);
174
- const linkedScale = scaleFromSearch(window.location.search);
210
+ const linkedScale = scaleFromSearch(search);
175
211
  const startScale = startScaleFor(linkedScale, scaleChoiceIds);
176
212
  const experience = useMemo(() => experienceWithGroups(definition), [definition]);
177
213
  // The shell also lists the sky, citing its sources and saying whether the stars were fetched.
@@ -185,15 +221,17 @@ export function App({ definition, onOpenAddress, writeTitle = true, host }) {
185
221
  return () => { cancelled = true; };
186
222
  }, []);
187
223
  // The current view (App state, like the display switches). The shell's lists read one experience, filtered here once; the scene hides the same ids from `controls.viewHidden`.
188
- const [viewId, setViewId] = useState(() => definition.views?.start ?? "");
224
+ const [viewId, setViewId] = useState(() => startViewId(definition, search));
189
225
  const currentView = useMemo(() => viewById(definition.views, viewId), [definition.views, viewId]);
190
226
  const viewExperience = useMemo(() => experienceInView(experience, definition.views, currentView), [experience, definition.views, currentView]);
191
- const shellExperience = useMemo(() => withSkyObject(viewExperience, runtime.sky.visible, starStatus), [viewExperience, runtime.sky.visible, starStatus]);
227
+ // Whether the sky is drawn: the look's `skyVisible`, live (a host's `setLook` changes it).
228
+ const [skyVisible, setSkyVisible] = useState(runtime.sky.visible);
229
+ const shellExperience = useMemo(() => withSkyObject(viewExperience, skyVisible, starStatus), [viewExperience, skyVisible, starStatus]);
192
230
  const metricsFor = useMemo(() => definition.createMetrics(experienceRuntime), [definition, experienceRuntime]);
193
231
  const glowBase = useMemo(() => baseGlowOf(runtime.bodies.map((id) => runtime.catalogue.get(id))), [runtime]);
194
232
  const storySet = definition.experience.storyPanels;
195
233
  const storyMarkerSpecs = useMemo(() => (storySet?.panels ?? []).flatMap((panel) => (panel.objectId === undefined ? [] : [{ panelId: panel.id, objectId: panel.objectId, title: panel.title, timeUtcMs: panel.timeUtcMs }])), [storySet]);
196
- const controls = useRef(initialSceneControls(definition, runtime, experience, startScale, glowBase, storyMarkerSpecs, suppliedPolicies));
234
+ const controls = useRef(initialSceneControls(definition, runtime, experience, startScale, glowBase, storyMarkerSpecs, suppliedPolicies, search));
197
235
  const readout = useRef(null);
198
236
  const [clockSnapshot, setClockSnapshot] = useState(() => runtime.clock.snapshot());
199
237
  const [scale, setScale] = useState(startScale);
@@ -228,13 +266,13 @@ export function App({ definition, onOpenAddress, writeTitle = true, host }) {
228
266
  const labelToggles = useMemo(() => experience.objects.filter((object) => object.showLabel !== undefined), [experience]);
229
267
  const [hiddenLabels, setHiddenLabels] = useState(() => new Set(controls.current.hiddenLabels));
230
268
  const [loopOn, setLoopOn] = useState(controls.current.loop === true);
231
- const [upChoice, setUpChoice] = useState(startViewUp(definition));
269
+ const [upChoice, setUpChoice] = useState(startViewUp(definition, search));
232
270
  const [illuminateAll, setIlluminateAll] = useState(controls.current.illuminateAll);
233
271
  const [milkyWayOn, setMilkyWayOn] = useState(runtime.sky.milkyWay);
234
272
  const [hoverBrightness, setHoverBrightness] = useState(HOVER_BRIGHTNESS_DEFAULT);
235
273
  const [starBrightness, setStarBrightness] = useState(runtime.sky.starBrightness);
236
274
  const [milkyWayBrightness, setMilkyWayBrightness] = useState(runtime.sky.milkyWayBrightness);
237
- const [loadFade, setLoadFade] = useState(() => bootFadeSeconds());
275
+ const [loadFade, setLoadFade] = useState(() => bootFadeSeconds(runtime.look));
238
276
  const [markerPx, setMarkerPx] = useState(() => controls.current.bodyMarker.minSpherePx);
239
277
  const [storyAutoOpen, setStoryAutoOpen] = useState(storyStartOf(storySet).autoOpen);
240
278
  const [storyPauseSeconds, setStoryPauseSeconds] = useState(storyStartOf(storySet).pauseSeconds);
@@ -266,9 +304,6 @@ export function App({ definition, onOpenAddress, writeTitle = true, host }) {
266
304
  controls.current.onStoryMarker = requestPanel;
267
305
  controls.current.onFeatureMarker = requestFeature;
268
306
  controls.current.onPickObject = requestPick;
269
- const updateSelectedObject = useCallback((objectId) => {
270
- controls.current.selectedObjectId = objectId;
271
- }, []);
272
307
  const updateScale = useCallback((id) => {
273
308
  controls.current.policy = scalePolicyFor(id, suppliedPolicies);
274
309
  setScale(id);
@@ -278,14 +313,41 @@ export function App({ definition, onOpenAddress, writeTitle = true, host }) {
278
313
  const chooseView = useCallback((id) => {
279
314
  viewRef.current = id;
280
315
  controls.current.viewHidden = hiddenByView(definition.views, viewById(definition.views, id), experience);
316
+ // The showing view's events choose the pacing zones; a paced rate that changes with them eases in rather than jumping.
317
+ if (controls.current.pace !== undefined) {
318
+ controls.current.pace.shown = shownEventsOf(definition, id);
319
+ if (controls.current.paceAuto === true)
320
+ startPaceEase(controls.current.pace, runtime.clock.rate, performance.now());
321
+ }
281
322
  setViewId(id);
282
- }, [definition, experience]);
323
+ }, [definition, experience, runtime]);
283
324
  const viewIds = useMemo(() => definition.views?.views.map((view) => view.id) ?? [], [definition]);
284
- const stateNow = useCallback(() => ({
285
- ...runtime.clock.snapshot(),
286
- ...(runtime.pacing === undefined ? {} : { auto: controls.current.paceAuto === true }),
287
- ...(definition.views === undefined ? {} : { view: viewRef.current }),
288
- }), [runtime, definition]);
325
+ // The presentation a host reads and sets (looks, switches, scale), rebuilt every render over the live controls; the stable callbacks below call through it.
326
+ const live = useRef(null);
327
+ const stateNow = useCallback(() => {
328
+ const snapshot = runtime.clock.snapshot();
329
+ return {
330
+ ...snapshot,
331
+ scale: controls.current.policy.id,
332
+ look: lookReadOf(controls.current),
333
+ switches: live.current?.switches() ?? {},
334
+ ...(runtime.pacing === undefined ? {} : { auto: controls.current.paceAuto === true }),
335
+ ...(runtime.eventZones === undefined ? {} : { zones: activeEventZones(runtime.eventZones, shownEventsOf(definition, viewRef.current), snapshot.timeUtcMs) }),
336
+ ...(definition.views === undefined ? {} : { view: viewRef.current }),
337
+ ...(controls.current.selectedObjectId === "" ? {} : { selected: controls.current.selectedObjectId }),
338
+ };
339
+ }, [runtime, definition]);
340
+ // A selection that changes is told to the host at once (the shell calls this for a menu choice, a pick and a view switch that drops the object); the opening selection and any before the host is attached wait for the attach reading.
341
+ const hostAttached = useRef(false);
342
+ // The presentation (scale, looks, switches) last told to the host, to find what a visitor changed.
343
+ const shownKey = useRef(null);
344
+ // `origin` "move": time or the view moved and the selection followed (a drop or a view rule's framing target); the link names whatever last moved them (a host call, the visitor or playback).
345
+ const updateSelectedObject = useCallback((objectId, origin) => {
346
+ const changed = controls.current.selectedObjectId !== objectId;
347
+ controls.current.selectedObjectId = objectId;
348
+ if (changed && hostAttached.current)
349
+ host?.publishSelection(stateNow(), origin === "move");
350
+ }, [host, stateNow]);
289
351
  useEffect(() => {
290
352
  const id = window.setInterval(() => {
291
353
  // The readout wraps with the scene, so the shown time never rests past the end while looping.
@@ -294,7 +356,7 @@ export function App({ definition, onOpenAddress, writeTitle = true, host }) {
294
356
  else if (runtime.stopAtWindow === true && runtime.loopWindow !== undefined)
295
357
  runtime.clock.stopWithin(runtime.loopWindow);
296
358
  if (controls.current.paceAuto === true && runtime.pacing !== undefined)
297
- applyPacing(runtime.clock, runtime.pacing);
359
+ applyPacing(runtime.clock, runtime.pacing, controls.current.pace);
298
360
  setClockSnapshot(runtime.clock.snapshot());
299
361
  host?.publish(stateNow(), "playback");
300
362
  }, 100);
@@ -303,14 +365,22 @@ export function App({ definition, onOpenAddress, writeTitle = true, host }) {
303
365
  // The host reaches the one clock through the same seek and rate handlers a visitor's timeline uses.
304
366
  const seekTo = useCallback((timeUtcMs) => {
305
367
  runtime.clock.seek(timeUtcMs);
368
+ // A seek lands on the paced rate for the new time at once, not through a view-switch ease.
369
+ if (controls.current.pace !== undefined) {
370
+ delete controls.current.pace.ease;
371
+ if (controls.current.paceAuto === true && runtime.pacing !== undefined)
372
+ applyPacing(runtime.clock, runtime.pacing, controls.current.pace);
373
+ }
306
374
  setClockSnapshot(runtime.clock.snapshot());
307
375
  }, [runtime]);
308
376
  // A speed picked by the visitor or the host takes over from pacing; "auto" gives the rate back to it.
309
377
  const [paceAuto, setPaceAuto] = useState(controls.current.paceAuto === true);
310
378
  const changeRate = useCallback((rate) => {
311
379
  if (rate === "auto") {
380
+ if (controls.current.pace !== undefined)
381
+ delete controls.current.pace.ease;
312
382
  if (runtime.pacing !== undefined)
313
- applyPacing(runtime.clock, runtime.pacing);
383
+ applyPacing(runtime.clock, runtime.pacing, controls.current.pace);
314
384
  }
315
385
  else
316
386
  runtime.clock.setRate(rate);
@@ -318,12 +388,30 @@ export function App({ definition, onOpenAddress, writeTitle = true, host }) {
318
388
  setPaceAuto(rate === "auto");
319
389
  setClockSnapshot(runtime.clock.snapshot());
320
390
  }, [runtime]);
391
+ // The same play handler the visitor's button reaches, so a host and a visitor share one clock.
392
+ const hostSetPlaying = setPlaying;
393
+ // The objects a host may point the camera at: those the showing view shows (read live, so a view switch is already counted).
394
+ const cameraTargets = useCallback(() => {
395
+ const hidden = controls.current.viewHidden?.objects;
396
+ return experience.objects.map(({ id }) => id).filter((id) => hidden === undefined || !hidden.has(id));
397
+ }, [experience]);
398
+ const opening = useMemo(() => openingCamera(definition, runtime, search), []); // eslint-disable-line react-hooks/exhaustive-deps
399
+ const readCamera = useCallback(() => {
400
+ return { ...(controls.current.viewReadout ?? opening) };
401
+ }, [opening]);
402
+ const setCamera = useCallback((request) => { controls.current.cameraRequest = request; }, []);
403
+ const hostScales = useMemo(() => scaleChoiceIds ?? SCALE_CHOICES.map((choice) => choice.id), [scaleChoiceIds]);
404
+ const hostSetLook = useCallback((look) => live.current?.setLook(look), []);
405
+ const hostSetScale = useCallback((id) => live.current?.setScale(id), []);
406
+ const hostSetSwitch = useCallback((id, on) => live.current?.setSwitch(id, on), []);
321
407
  useEffect(() => {
322
408
  if (host === undefined)
323
409
  return undefined;
324
- host.attach({ window: runtime.loopWindow, rates: definition.experience.rates, paced: runtime.pacing !== undefined, read: stateNow, seek: seekTo, setRate: changeRate, views: viewIds, setView: chooseView });
325
- return () => host.detach();
326
- }, [host, runtime, definition, seekTo, changeRate, viewIds, chooseView]);
410
+ hostAttached.current = true;
411
+ shownKey.current = null; // the presentation is read afresh after each attach
412
+ host.attach({ ...(definition.picker === undefined ? {} : { picker: { id: definition.picker.id, values: definition.picker.options.map((option) => option.value), start: definition.picker.value } }), window: runtime.loopWindow, events: experience.events, rates: definition.experience.rates, paced: runtime.pacing !== undefined, read: stateNow, seek: seekTo, setRate: changeRate, playable: definition.experience.hideTimeline !== true, setPlaying: hostSetPlaying, views: viewIds, setView: chooseView, cameraTargets, readCamera, setCamera, scales: hostScales, setScale: hostSetScale, setLook: hostSetLook, setSwitch: hostSetSwitch });
413
+ return () => { hostAttached.current = false; host.detach(); };
414
+ }, [host, runtime, definition, seekTo, changeRate, viewIds, chooseView, cameraTargets, readCamera, setCamera, experience, hostSetPlaying, hostScales, hostSetScale, hostSetLook, hostSetSwitch]);
327
415
  useEffect(() => {
328
416
  if (!developerMode)
329
417
  return undefined;
@@ -350,7 +438,7 @@ export function App({ definition, onOpenAddress, writeTitle = true, host }) {
350
438
  const view = controls.current.viewReadout;
351
439
  if (view === undefined)
352
440
  return;
353
- setViewLink(await shareViewLink({ view, scaleId: scale, up: upChoice, timeUtcMs: runtime.clock.snapshot().timeUtcMs }));
441
+ setViewLink(await shareViewLink({ view, scaleId: scale, up: upChoice, timeUtcMs: runtime.clock.snapshot().timeUtcMs, ...(definition.views === undefined ? {} : { show: viewRef.current }) }));
354
442
  };
355
443
  const viewChoice = definition.views === undefined ? undefined : {
356
444
  place: definition.views.place,
@@ -360,21 +448,46 @@ export function App({ definition, onOpenAddress, writeTitle = true, host }) {
360
448
  host?.publish(stateNow(), "visitor");
361
449
  },
362
450
  };
363
- const displaySwitches = displaySwitchItems({
451
+ const bindingsNow = () => ({
364
452
  settings: definition.displaySwitches,
365
- orbit: { present: orbitPaths.length > 0, look: orbitShown, set: setOrbit },
366
- moons: { present: bodySets.length > 0, look: setLook, set: changeSetLook },
367
- sky: { present: runtime.sky.visible, on: milkyWayOn, set: (on) => { controls.current.showMilkyWay = on; setMilkyWayOn(on); } },
453
+ orbit: { present: orbitPaths.length > 0, look: { ...orbitDefault, ...controls.current.orbitLook }, set: setOrbit },
454
+ moons: { present: bodySets.length > 0, look: controls.current.bodySetLook ?? DEFAULT_BODY_SET_LOOK, set: changeSetLook },
455
+ sky: { present: controls.current.skyVisible !== false, on: controls.current.showMilkyWay, set: (on) => { controls.current.showMilkyWay = on; setMilkyWayOn(on); } },
368
456
  labels: {
369
- objectIds: experience.objects.map((object) => object.id), hidden: hiddenLabels,
457
+ objectIds: experience.objects.map((object) => object.id), hidden: controls.current.hiddenLabels ?? hiddenLabels,
370
458
  setHidden: (hidden) => { controls.current.hiddenLabels = new Set(hidden); setHiddenLabels(new Set(hidden)); },
371
- anchorsPresent: runtime.trackedBodies.length > 0, anchors: anchorLabels, setAnchors: (on) => { controls.current.showAnchorLabels = on; setAnchorLabels(on); },
459
+ anchorsPresent: runtime.trackedBodies.length > 0, anchors: controls.current.showAnchorLabels, setAnchors: (on) => { controls.current.showAnchorLabels = on; setAnchorLabels(on); },
372
460
  },
373
461
  });
374
- const sections = definition.developerSections ?? [];
375
- const renderSection = (section) => (_jsxs("section", { className: section.id === "clock" ? "hud-section hud-section-clock" : "hud-section", "aria-labelledby": `developer-${section.id}-heading`, children: [_jsx("h3", { id: `developer-${section.id}-heading`, children: section.heading }), section.render(experienceRuntime)] }, section.id));
462
+ const displaySwitches = displaySwitchItems(bindingsNow());
463
+ live.current = presentationOf({
464
+ setLook: (look) => {
465
+ const read = applyLook(controls.current, definition, glowBase, look);
466
+ setStarBrightness(read.starBrightness);
467
+ setMilkyWayBrightness(read.milkyWayBrightness);
468
+ setMilkyWayOn(read.milkyWay);
469
+ setSkyVisible(read.skyVisible);
470
+ if (read.sunGlow !== undefined)
471
+ setGlowShown({ ...controls.current.glowLook });
472
+ setMarkerPx(read.markerSwapRadiusPx);
473
+ setLoadFade(read.loadFadeSeconds);
474
+ },
475
+ setScale: updateScale,
476
+ items: () => displaySwitchItems({ ...bindingsNow(), settings: hostReachable(definition.displaySwitches) }),
477
+ });
478
+ // A change the visitor made (the scale or a switch in the shell, a slider or button in the Developer drawer) is told to the host once the screen has it; a host call has already been told, so this finds nothing new.
479
+ useEffect(() => {
480
+ if (!hostAttached.current)
481
+ return;
482
+ const state = stateNow();
483
+ const key = JSON.stringify([state.scale, state.look, state.switches]);
484
+ const changed = shownKey.current !== null && shownKey.current !== key;
485
+ shownKey.current = key;
486
+ if (changed)
487
+ host?.publish(state, "visitor");
488
+ }, [host, stateNow, scale, skyVisible, starBrightness, milkyWayBrightness, milkyWayOn, glowShown, markerPx, loadFade, orbitShown, setLook, hiddenLabels, anchorLabels]);
376
489
  const hasStoryPanels = (storySet?.panels.length ?? 0) > 0;
377
- const showDisplay = showsDisplayControls(definition, runtime, orbitPaths.length, storyMarkerSpecs.length);
490
+ const showDisplay = showsDisplayControls(definition, runtime, skyVisible, orbitPaths.length, storyMarkerSpecs.length);
378
491
  // Orbit-line sliders: the first four stay in view, the rest sit in a nested "Fine-tune" fold (T-090).
379
492
  const orbitSliders = {
380
493
  main: [
@@ -395,17 +508,13 @@ export function App({ definition, onOpenAddress, writeTitle = true, host }) {
395
508
  const orbitSlider = ([key, label, testId, step]) => (_jsx(SettingSlider, { label: label, ariaLabel: label, testId: `${testId}-value`, display: orbitShown[key].toFixed(step === 1 ? 0 : step === 0.5 ? 1 : step < 0.01 ? 4 : 2), min: ORBIT_LOOK_LIMITS[key].min, max: ORBIT_LOOK_LIMITS[key].max, step: step, value: orbitShown[key], onChange: (value) => setOrbit({ [key]: value }) }, key));
396
509
  // The panel's folds, in order; the first one present opens by default and the rest start closed (T-090).
397
510
  const groups = [
398
- sections.length === 0 ? null : {
399
- id: "demo", title: "This demo", className: "dev-group-cards",
400
- body: (_jsxs(_Fragment, { children: [sections.filter((section) => section.placement === "before-scene").map(renderSection), sections.filter((section) => section.placement === "after-scene").map(renderSection)] })),
401
- },
402
511
  !showDisplay ? null : {
403
512
  id: "camera", title: "Camera and view",
404
- body: (_jsxs(_Fragment, { children: [_jsx(SettingButtons, { label: "Up direction", children: [["ecliptic", "Planets' plane (ecliptic)"], ["equatorial", "Earth's pole (equatorial)"]].map(([choice, text]) => (_jsx("button", { "aria-pressed": upChoice === choice, onClick: () => { controls.current.up = viewUpVector(choice); setUpChoice(choice); }, children: text }, choice))) }), _jsx(SettingSlider, { label: "Marker threshold (px)", ariaLabel: "Body marker threshold", testId: "body-marker-value", display: markerPx.toFixed(1), min: 0, max: 20, step: 0.5, value: markerPx, onChange: (value) => { controls.current.bodyMarker = { ...controls.current.bodyMarker, minSpherePx: value }; setMarkerPx(value); } }), _jsx(SettingSlider, { label: "Loading fade (s, next load)", ariaLabel: "Loading fade", testId: "load-fade-value", display: loadFade.toFixed(1), min: BOOT_FADE_LIMITS.min, max: BOOT_FADE_LIMITS.max, step: 0.1, value: loadFade, onChange: (value) => { saveBootFadeSeconds(value); setLoadFade(value); } }), _jsxs("div", { className: "view-link", role: "group", "aria-label": "Camera view", children: [_jsx(SettingButtons, { label: "Camera view", children: _jsx("button", { onClick: () => void copyViewLink(), children: "Copy view link" }) }), _jsx(ViewLinkReadout, { viewNow: viewNow, viewLink: viewLink, scale: scale, upChoice: upChoice })] }), _jsx(SettingButtons, { children: _jsx("button", { "aria-pressed": loopOn, onClick: () => { controls.current.loop = !loopOn; setLoopOn(!loopOn); }, children: "Loop playback" }) })] })),
513
+ body: (_jsxs(_Fragment, { children: [_jsx(SettingButtons, { label: "Up direction", children: [["ecliptic", "Planets' plane (ecliptic)"], ["equatorial", "Earth's pole (equatorial)"]].map(([choice, text]) => (_jsx("button", { "aria-pressed": upChoice === choice, onClick: () => { controls.current.up = viewUpVector(choice); setUpChoice(choice); }, children: text }, choice))) }), _jsx(SettingSlider, { label: "Marker threshold (px)", ariaLabel: "Body marker threshold", testId: "body-marker-value", display: markerPx.toFixed(1), min: 0, max: 20, step: 0.5, value: markerPx, onChange: (value) => { controls.current.bodyMarker = { ...controls.current.bodyMarker, minSpherePx: value }; setMarkerPx(value); } }), _jsx(SettingSlider, { label: "Loading fade (s, next load)", ariaLabel: "Loading fade", testId: "load-fade-value", display: loadFade.toFixed(1), min: BOOT_FADE_LIMITS.min, max: BOOT_FADE_LIMITS.max, step: 0.1, value: loadFade, onChange: (value) => { saveBootFadeSeconds(value); controls.current.loadFadeSeconds = value; setLoadFade(value); } }), _jsx(ViewLinkGroup, { offered: address === true, onCopy: () => void copyViewLink(), viewNow: viewNow, viewLink: viewLink, scale: scale, upChoice: upChoice }), _jsx(SettingButtons, { children: _jsx("button", { "aria-pressed": loopOn, onClick: () => { controls.current.loop = !loopOn; setLoopOn(!loopOn); }, children: "Loop playback" }) })] })),
405
514
  },
406
515
  !showDisplay ? null : {
407
516
  id: "timeline", title: "Timeline and stories",
408
- body: (_jsxs(_Fragment, { children: [_jsxs(SettingGroup, { id: "timeline-glow", title: "Timeline glow", children: [_jsx(SettingColor, { label: "Glow colour", ariaLabel: "Timeline glow colour", testId: "glow-color-value", value: timelineGlow.color, onChange: (color) => setTimelineGlow({ ...timelineGlow, color }) }), _jsx(SettingColor, { label: "Played colour", ariaLabel: "Timeline played colour", testId: "glow-played-value", value: timelineGlow.playedColor, onChange: (playedColor) => setTimelineGlow({ ...timelineGlow, playedColor }) }), [
517
+ body: (_jsxs(_Fragment, { children: [_jsxs(SettingGroup, { name: "timeline-glow", title: "Timeline glow", children: [_jsx(SettingColor, { label: "Glow colour", ariaLabel: "Timeline glow colour", testId: "glow-color-value", value: timelineGlow.color, onChange: (color) => setTimelineGlow({ ...timelineGlow, color }) }), _jsx(SettingColor, { label: "Played colour", ariaLabel: "Timeline played colour", testId: "glow-played-value", value: timelineGlow.playedColor, onChange: (playedColor) => setTimelineGlow({ ...timelineGlow, playedColor }) }), [
409
518
  ["minBrightness", "Quiet brightness", "Timeline quiet brightness", "glow-min-value", 0, 1, 0.01],
410
519
  ["steadyBrightness", "Steady brightness (no rate)", "Timeline steady brightness", "glow-steady-value", 0, 1, 0.01],
411
520
  ["curve", "Curve (rate to brightness)", "Timeline glow curve", "glow-curve-value", 0.2, 3, 0.05],
@@ -416,15 +525,15 @@ export function App({ definition, onOpenAddress, writeTitle = true, host }) {
416
525
  },
417
526
  orbitPaths.length === 0 ? null : {
418
527
  id: "orbit-lines", title: "Orbit lines",
419
- body: (_jsxs(_Fragment, { children: [_jsxs(SettingButtons, { children: [_jsx("button", { "aria-pressed": orbitShown.baseOn, onClick: () => setOrbit({ baseOn: !orbitShown.baseOn }), children: "Orbit ring" }), _jsx("button", { "aria-pressed": orbitShown.endFadeOn, onClick: () => setOrbit({ endFadeOn: !orbitShown.endFadeOn }), children: "Fade ring ends" }), _jsx("button", { "aria-pressed": orbitShown.arcOn, onClick: () => setOrbit({ arcOn: !orbitShown.arcOn }), children: "Trailing arc" }), _jsx("button", { "aria-pressed": orbitShown.zoomOn, onClick: () => setOrbit({ zoomOn: !orbitShown.zoomOn }), children: "Brighten when zoomed out" })] }), orbitSliders.main.map(orbitSlider), _jsx(Collapsible, { id: "orbit-fine-tune", title: "Fine-tune", level: 4, nested: true, children: orbitSliders.fine.map(orbitSlider) }), _jsx(SettingButtons, { children: _jsx("button", { onClick: resetOrbit, children: "Reset orbit lines" }) })] })),
528
+ body: (_jsxs(_Fragment, { children: [_jsxs(SettingButtons, { children: [_jsx("button", { "aria-pressed": orbitShown.baseOn, onClick: () => setOrbit({ baseOn: !orbitShown.baseOn }), children: "Orbit ring" }), _jsx("button", { "aria-pressed": orbitShown.endFadeOn, onClick: () => setOrbit({ endFadeOn: !orbitShown.endFadeOn }), children: "Fade ring ends" }), _jsx("button", { "aria-pressed": orbitShown.arcOn, onClick: () => setOrbit({ arcOn: !orbitShown.arcOn }), children: "Trailing arc" }), _jsx("button", { "aria-pressed": orbitShown.zoomOn, onClick: () => setOrbit({ zoomOn: !orbitShown.zoomOn }), children: "Brighten when zoomed out" })] }), orbitSliders.main.map(orbitSlider), _jsx(Collapsible, { fold: "orbit-fine-tune", title: "Fine-tune", level: 4, nested: true, children: orbitSliders.fine.map(orbitSlider) }), _jsx(SettingButtons, { children: _jsx("button", { onClick: resetOrbit, children: "Reset orbit lines" }) })] })),
420
529
  },
421
530
  bodySets.length === 0 && ringSystems.length === 0 ? null : {
422
531
  id: "moons-rings", title: "Moons and rings",
423
532
  body: (_jsx(MoonsAndRingsSettings, { bodySets: bodySets, ringSystems: ringSystems, setLook: setLook, changeSetLook: changeSetLook, ringLook: ringLook, changeRing: changeRing, controls: controls, setSetLook: setSetLook, setRingLook: setRingLook })),
424
533
  },
425
- !(runtime.sky.visible || glowShown !== null) ? null : {
534
+ !(skyVisible || glowShown !== null) ? null : {
426
535
  id: "sky-sun", title: "Sky and Sun",
427
- body: (_jsx(SkyAndSunSettings, { illuminateAll: illuminateAll, setIlluminateAll: setIlluminateAll, visible: runtime.sky.visible, glowShown: glowShown, setGlowShown: setGlowShown, controls: controls, milkyWayOn: milkyWayOn, setMilkyWayOn: setMilkyWayOn, starBrightness: starBrightness, setStarBrightness: setStarBrightness, milkyWayBrightness: milkyWayBrightness, setMilkyWayBrightness: setMilkyWayBrightness })),
536
+ body: (_jsx(SkyAndSunSettings, { illuminateAll: illuminateAll, setIlluminateAll: setIlluminateAll, visible: skyVisible, glowShown: glowShown, setGlowShown: setGlowShown, controls: controls, milkyWayOn: milkyWayOn, setMilkyWayOn: setMilkyWayOn, starBrightness: starBrightness, setStarBrightness: setStarBrightness, milkyWayBrightness: milkyWayBrightness, setMilkyWayBrightness: setMilkyWayBrightness })),
428
537
  },
429
538
  {
430
539
  id: "labels", title: "Labels",
@@ -442,11 +551,11 @@ export function App({ definition, onOpenAddress, writeTitle = true, host }) {
442
551
  },
443
552
  {
444
553
  id: "under-the-hood", title: "Under the hood",
445
- body: (_jsx(UnderTheHoodSettings, { hud: hud, frames: frames, fills: fills, fpsHistory: fpsHistory, alternates: showDisplay ? definition.alternates : undefined })),
554
+ body: (_jsx(UnderTheHoodSettings, { hud: hud, frames: frames, fills: fills, fpsHistory: fpsHistory })),
446
555
  },
447
556
  ];
448
557
  const presentGroups = groups.filter((group) => group !== null);
449
- const developerTools = (_jsx(PanelLoadBoundary, { children: _jsx(Suspense, { fallback: _jsx("p", { className: "developer-loading", role: "status", children: "Loading developer tools..." }), children: _jsxs("div", { className: "hud", children: [_jsxs("header", { className: "developer-heading", children: [_jsx("h2", { children: "Developer tools" }), _jsx("p", { children: "Live readouts, controls and diagnostics for this scene." })] }), presentGroups.map((group, index) => (_jsx(Collapsible, { id: group.id, title: group.title, defaultOpen: index === 0, className: `dev-group${group.className === undefined ? "" : ` ${group.className}`}`, children: group.body }, group.id)))] }) }) }));
558
+ const drawer = (_jsx(PanelLoadBoundary, { children: _jsx(Suspense, { fallback: _jsx("p", { className: "developer-loading", role: "status", children: "Loading developer tools..." }), children: _jsxs("div", { className: "hud", children: [_jsxs("header", { className: "developer-heading", children: [_jsx("h2", { children: "Developer tools" }), _jsx("p", { children: "Live readouts, controls and diagnostics for this scene." })] }), presentGroups.map((group, index) => (_jsx(Collapsible, { fold: group.id, title: group.title, defaultOpen: index === 0, className: `dev-group${group.className === undefined ? "" : ` ${group.className}`}`, children: group.body }, group.id)))] }) }) }));
450
559
  return (_jsx(AstraeusShell, { experience: shellExperience, snapshot: clockSnapshot, paceAuto: runtime.pacing === undefined ? undefined : paceAuto, developerMode: developerMode, onDeveloperModeChange: setDeveloperMode, onTogglePlayback: () => {
451
560
  if (runtime.clock.playing)
452
561
  runtime.clock.pause();
@@ -460,5 +569,5 @@ export function App({ definition, onOpenAddress, writeTitle = true, host }) {
460
569
  }, onSeek: (timeUtcMs) => {
461
570
  seekTo(timeUtcMs);
462
571
  host?.publish(stateNow(), "visitor");
463
- }, onCameraRequest: updateCameraRequest, onCameraHold: holdCamera, onSelectionChange: updateSelectedObject, scaleId: scale, onScaleChange: updateScale, scaleChoices: scaleChoices, switcher: switcherOf(definition, runtime, onOpenAddress), displaySwitches: displaySwitches, viewChoice: viewChoice, viewCamera: currentView === undefined ? undefined : { id: currentView.id, rule: currentView.camera }, metricsFor: metricsFor, developerTools: developerTools, storyPanelSettings: { autoOpen: storyAutoOpen, pauseSeconds: storyPauseSeconds }, timelineGlow: timelineGlow, phoneLayout: phoneLayout, highlightedFamily: setLook.highlightFamily, onHighlightFamily: highlightFamily, onSetPlaying: setPlaying, panelRequest: panelRequest, onOpenPanelChange: markOpenPanel, featureRequest: featureRequest, pickRequest: pickRequest, onOpenFeatureChange: markOpenFeature, children: _jsx("div", { className: "canvas-host", children: _jsx(AstraeusScene, { runtime: runtime, controls: controls.current, readout: readout, scaleId: scale }) }) }));
572
+ }, onCameraRequest: updateCameraRequest, onCameraHold: holdCamera, onSelectionChange: updateSelectedObject, scaleId: scale, onScaleChange: updateScale, scaleChoices: scaleChoices, switcher: definition.picker === undefined ? undefined : pickerSwitch(definition.picker, hostPick ?? definition.picker.value, choosePick), displaySwitches: displaySwitches, viewChoice: viewChoice, viewCamera: currentView === undefined ? undefined : { id: currentView.id, rule: currentView.camera }, metricsFor: metricsFor, developerTools: drawerWhen(developerTools, drawer), storyPanelSettings: { autoOpen: storyAutoOpen, pauseSeconds: storyPauseSeconds }, timelineGlow: timelineGlow, phoneLayout: phoneLayout, highlightedFamily: setLook.highlightFamily, onHighlightFamily: highlightFamily, onSetPlaying: setPlaying, panelRequest: panelRequest, onOpenPanelChange: markOpenPanel, featureRequest: featureRequest, pickRequest: pickRequest, onOpenFeatureChange: markOpenFeature, children: _jsx("div", { className: "canvas-host", children: _jsx(AstraeusScene, { runtime: runtime, controls: controls.current, readout: readout, scaleId: scale, onFirstDraw: host === undefined ? undefined : told }) }) }));
464
573
  }