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,4 +1,3 @@
1
- import { bootShowing, hideBootLoader } from "../shell/bootLoader.js";
2
1
  import { drawnRadii } from "./bodyDraw.js";
3
2
  import { DEFAULT_BODY_SET_LOOK, familyColorOf } from "./bodySet.js";
4
3
  import { applyPacing } from "../core/pacing.js";
@@ -19,9 +18,9 @@ import { viewFromAngles } from "./viewLink.js";
19
18
  import { EQUATORIAL_UP } from "./viewUp.js";
20
19
  /** Floating-origin rebase threshold in scaled units (Earth radii). */
21
20
  const REBASE_THRESHOLD = 1;
22
- export function createFrameState(policyId) {
21
+ export function createFrameState(policyId, onFirstDraw) {
23
22
  return {
24
- started: false, coverShowing: bootShowing(), spanScaled: 6, lastPolicyId: policyId, lastUp: null, pickables: [], hoverPoint: null,
23
+ started: false, onFirstDraw, spanScaled: 6, lastPolicyId: policyId, lastUp: null, pickables: [], hoverPoint: null,
25
24
  drawThisFrame: true, framesDrawn: 0, wakes: 0,
26
25
  drawn: { timeUtcMs: Number.NaN, pose: [], size: "", controls: new Map(), wakes: 0, mounted: -1, quietFrames: 0 },
27
26
  };
@@ -41,7 +40,7 @@ export function frameTime(runtime, controls) {
41
40
  else if (runtime.stopAtWindow === true && runtime.loopWindow !== undefined)
42
41
  runtime.clock.stopWithin(runtime.loopWindow);
43
42
  if (controls.paceAuto === true && runtime.pacing !== undefined)
44
- applyPacing(runtime.clock, runtime.pacing);
43
+ applyPacing(runtime.clock, runtime.pacing, controls.pace);
45
44
  return runtime.clock.now();
46
45
  }
47
46
  /** Stage 1: brings every view to the time of the frame. Returns the live body-set look. */
@@ -106,8 +105,10 @@ export function stepAndPoseCamera(ctx, t, placed) {
106
105
  resolveCamera(orbit, cameraTargetAbsolute(orbit, targets), ctx.origin, ctx.delta, REBASE_THRESHOLD, viewUp);
107
106
  placeBodies(ctx.assets, placed.composed.states, ctx.bodyRefs, policy, ctx.origin);
108
107
  poseCamera(camera, orbit, focusRadius(focusBody, policy, catalogue), ctx.origin, reach.far ?? DEFAULT_CAMERA_FAR, viewUp);
109
- if (firstFrame)
110
- requestAnimationFrame(() => hideBootLoader(state.coverShowing));
108
+ if (firstFrame && state.onFirstDraw !== undefined) {
109
+ const told = state.onFirstDraw;
110
+ requestAnimationFrame(told);
111
+ }
111
112
  controls.viewReadout = viewFromAngles(orbit.focus, orbit.azimuth, orbit.elevation, orbit.distance);
112
113
  return { targets };
113
114
  }
@@ -127,8 +128,12 @@ export function publishCanvasReadouts(ctx) {
127
128
  const { controls, camera, canvas, size, views } = ctx;
128
129
  const markerBodies = swapSmallBodiesToMarkers(ctx.assets, ctx.bodyRefs, camera, camera.fov, size.height, controls.policy, controls.bodyMarker);
129
130
  publishSceneData(canvas, { markerBodies, viewUp: viewUpOf(ctx), markerMinSpherePx: controls.bodyMarker.minSpherePx });
130
- if (views.skyView !== null)
131
- updateSky(views.skyView, camera, canvas, controls, controls.frameStats !== null);
131
+ if (views.skyView !== null) {
132
+ if (controls.skyVisible !== undefined)
133
+ views.skyView.group.visible = controls.skyVisible;
134
+ if (controls.skyVisible !== false)
135
+ updateSky(views.skyView, camera, canvas, controls, controls.frameStats !== null);
136
+ }
132
137
  }
133
138
  /** Stage 5: places every view about the floating origin and publishes the views' readouts. Returns the hover brightness gain. */
134
139
  export function placeViews(ctx, t, placed, setLook) {
@@ -1,6 +1,7 @@
1
1
  // Scene React hooks: host-layer lifetime, sky stars loading and the scene views.
2
2
  import { useEffect, useMemo } from "react";
3
- import { loadStarCatalogue } from "../assets/sky.js";
3
+ import { NO_PICTURES } from "../assets/pictures.js";
4
+ import { loadStarCatalogue, milkyWayPicture } from "../assets/sky.js";
4
5
  import { compositionPathView, createPathViews } from "./PathView.js";
5
6
  import { BodySetView } from "./BodySetView.js";
6
7
  import { OrbitSetView } from "./OrbitSetView.js";
@@ -57,7 +58,7 @@ export function useSceneViews(runtime, gl) {
57
58
  const groupViews = useMemo(() => runtime.groups.map((layer) => new PointsView(layer)), [runtime.groups]);
58
59
  const sunCentredViews = useMemo(() => createPathViews(runtime.paths ?? []), [runtime.paths]);
59
60
  const compositionPaths = useMemo(() => (runtime.composition?.paths ?? []).map((path) => compositionPathView(path, runtime.resolver, runtime.catalogue)), [runtime.composition, runtime.resolver, runtime.catalogue]);
60
- const skyView = useMemo(() => (runtime.sky?.visible ? new SkyView({ starBrightness: runtime.sky.starBrightness, milkyWayBrightness: runtime.sky.milkyWayBrightness, pixelRatio: gl.getPixelRatio(), maxAnisotropy: gl.capabilities.getMaxAnisotropy(), milkyWay: runtime.sky.milkyWay, picture: null }) : null), [runtime.sky, gl]);
61
+ const skyView = useMemo(() => (runtime.sky !== undefined && (runtime.sky.visible || runtime.sky.live === true) ? new SkyView({ starBrightness: runtime.sky.starBrightness, milkyWayBrightness: runtime.sky.milkyWayBrightness, pixelRatio: gl.getPixelRatio(), maxAnisotropy: gl.capabilities.getMaxAnisotropy(), milkyWay: runtime.sky.milkyWay, picture: null, pictureSet: milkyWayPicture(runtime.pictures ?? NO_PICTURES) }) : null), [runtime.sky, runtime.pictures, gl]);
61
62
  const bodySetViews = useMemo(() => (runtime.bodySets ?? []).map((layer) => new BodySetView(layer)), [runtime.bodySets]);
62
63
  const orbitSetViews = useMemo(() => (runtime.bodySets ?? []).map((layer) => new OrbitSetView(layer)), [runtime.bodySets]);
63
64
  useEffect(() => () => { for (const view of bodySetViews)
package/src/app/style.css CHANGED
@@ -1,33 +1,6 @@
1
- :root {
2
- color-scheme: dark;
3
- --ui-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
4
- --ui-color: #f0e6da;
5
- --ui-muted: #c7bdb3;
6
- --ui-subtle: #a99e94;
7
- --ui-border: rgba(240, 230, 218, .18);
8
- --ui-panel: rgba(13, 13, 13, .94);
9
- --ui-accent: #fc6323;
10
- --ui-data: #b1a1df;
11
- --perf-good: #6fcf8f;
12
- --perf-warn: #f0b84a;
13
- --perf-bad: #ff6b5e;
14
- }
15
-
16
- html,
17
- body,
18
- #app {
19
- height: 100%;
20
- margin: 0;
21
- background: #000;
22
- color: var(--ui-color);
23
- font-family: var(--ui-font);
24
- font-size: 14px;
25
- }
1
+ .astraeus-shell .canvas-host { position: absolute; inset: 0; touch-action: none; }
26
2
 
27
- #app { position: relative; overflow: hidden; }
28
- .canvas-host { position: absolute; inset: 0; touch-action: none; }
29
-
30
- .hud {
3
+ .astraeus-shell .hud {
31
4
  /* Cards flow down two columns and take only the height of their content, so no card is stretched to its neighbour. */
32
5
  column-count: 2;
33
6
  column-gap: 10px;
@@ -35,13 +8,13 @@ body,
35
8
  font-size: 13px;
36
9
  }
37
10
 
38
- .hud > * { break-inside: avoid; margin: 0 0 10px; }
39
- .developer-heading,
40
- .hud-section-clock { column-span: all; }
41
- .developer-heading h2 { margin: 0; font-size: 16px; line-height: 1.25; }
42
- .developer-heading p { margin: 3px 0 0; color: var(--ui-muted); font-size: 13px; }
11
+ .astraeus-shell .hud > * { break-inside: avoid; margin: 0 0 10px; }
12
+ .astraeus-shell .developer-heading,
13
+ .astraeus-shell .hud-section-clock { column-span: all; }
14
+ .astraeus-shell .developer-heading h2 { margin: 0; font-size: 16px; line-height: 1.25; }
15
+ .astraeus-shell .developer-heading p { margin: 3px 0 0; color: var(--ui-muted); font-size: 13px; }
43
16
 
44
- .hud-section {
17
+ .astraeus-shell .hud-section {
45
18
  display: block;
46
19
  min-width: 0;
47
20
  padding: 10px;
@@ -50,8 +23,8 @@ body,
50
23
  background: rgba(255, 255, 255, .035);
51
24
  }
52
25
 
53
- .hud-section h3,
54
- .hud-section h4 {
26
+ .astraeus-shell .hud-section h3,
27
+ .astraeus-shell .hud-section h4 {
55
28
  margin: 0 0 8px;
56
29
  color: var(--ui-muted);
57
30
  font-size: 12px;
@@ -62,37 +35,39 @@ body,
62
35
  }
63
36
 
64
37
  /* Frame rate has a whole row to itself in "Under the hood": readouts beside the graph. */
65
- .hud-section-frame .frame-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; gap: 4px 20px; }
66
- .hud-section-frame .frame-readouts { margin-top: 0; }
67
- .hud .frame-body > p { grid-column: 1 / -1; }
38
+ .astraeus-shell .hud-section-frame .frame-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; gap: 4px 20px; }
39
+ .astraeus-shell .hud-section-frame .frame-readouts { margin-top: 0; }
40
+ .astraeus-shell .hud .frame-body > p { grid-column: 1 / -1; }
68
41
  /* The panel's folds (T-090): a full-width heading button over the body; the first group's cards flow in two columns as they did. */
69
- .hud > .dev-group { column-span: all; padding: 4px 10px 6px; border: 1px solid var(--ui-border); border-radius: 9px; background: rgba(255, 255, 255, .035); }
70
- .collapsible-heading { margin: 0; font-size: 13px; }
71
- .hud .collapsible-toggle { width: 100%; min-height: var(--control-height, 36px); font-weight: 650; }
72
- .hud .collapsible-toggle svg { transition: transform .15s; }
73
- .hud .collapsible-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
74
- .collapsible-body { padding: 4px 2px 6px; }
75
- .collapsible-body[hidden] { display: none; }
76
- .dev-group-cards > .collapsible-body { column-count: 2; column-gap: 10px; }
77
- .dev-group-cards > .collapsible-body > * { break-inside: avoid; margin: 0 0 10px; }
78
- .dev-group-cards .hud-section-clock { column-span: all; }
79
- .collapsible-nested { margin: 4px 0 8px; border-left: 2px solid var(--ui-border); padding-left: 8px; }
80
- .hud .collapsible-nested .collapsible-toggle { font-weight: 500; color: var(--ui-muted); }
81
- @media (prefers-reduced-motion: reduce) { .hud .collapsible-toggle svg { transition: none; } }
82
- .setting-group { margin: 0 0 12px; padding: 0; border: 0; min-width: 0; }
83
- .setting-group:last-child { margin-bottom: 0; }
84
- .setting-group > h4 { margin: 0 0 6px; padding-bottom: 3px; border-bottom: 1px solid var(--ui-border); color: var(--ui-data); font-size: 12px; font-weight: 650; letter-spacing: .03em; }
85
- .hud .setting { display: grid; grid-template-columns: minmax(9.5em, 0.8fr) minmax(0, 1.4fr) 3.6em; align-items: center; gap: 4px 10px; margin: 0 0 6px; min-width: 0; }
86
- .hud .setting-label { min-width: 0; color: var(--ui-color); }
87
- .hud .setting input[type="range"] { width: 100%; min-width: 0; padding: 0; }
88
- .hud .setting output { color: var(--ui-muted); font-variant-numeric: tabular-nums; text-align: right; }
89
- .hud .setting-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; margin: 0 0 6px; }
90
- .hud .setting-buttons.has-label { display: grid; grid-template-columns: minmax(9.5em, 0.8fr) minmax(0, 2.2fr); }
91
- .hud .setting-buttons.has-label > div { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
92
- .hud .row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
93
- .hud button,
94
- .hud input,
95
- .hud select {
42
+ .astraeus-shell .hud > .dev-group { column-span: all; padding: 4px 10px 6px; border: 1px solid var(--ui-border); border-radius: 9px; background: rgba(255, 255, 255, .035); }
43
+ .astraeus-shell .collapsible-heading { margin: 0; font-size: 13px; }
44
+ .astraeus-shell .hud .collapsible-toggle { width: 100%; min-height: var(--control-height, 36px); font-weight: 650; }
45
+ .astraeus-shell .hud .collapsible-toggle svg { transition: transform .15s; }
46
+ .astraeus-shell .hud .collapsible-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
47
+ .astraeus-shell .collapsible-body { padding: 4px 2px 6px; }
48
+ .astraeus-shell .collapsible-body[hidden] { display: none; }
49
+ .astraeus-shell .dev-group-cards > .collapsible-body { column-count: 2; column-gap: 10px; }
50
+ .astraeus-shell .dev-group-cards > .collapsible-body > * { break-inside: avoid; margin: 0 0 10px; }
51
+ .astraeus-shell .dev-group-cards .hud-section-clock { column-span: all; }
52
+ .astraeus-shell .collapsible-nested { margin: 4px 0 8px; border-left: 2px solid var(--ui-border); padding-left: 8px; }
53
+ .astraeus-shell .hud .collapsible-nested .collapsible-toggle { font-weight: 500; }
54
+ /* The colour sits at (0,2,0) on purpose: on main this rule (0,3,0) lost to controls.css `button[aria-expanded="true"]:not(.ui-bare)` (0,3,1), so an open nested fold stays accent (I-140). */
55
+ .astraeus-shell :where(.hud .collapsible-nested) .collapsible-toggle { color: var(--ui-muted); }
56
+ @media (prefers-reduced-motion: reduce) { .astraeus-shell .hud .collapsible-toggle svg { transition: none; } }
57
+ .astraeus-shell .setting-group { margin: 0 0 12px; padding: 0; border: 0; min-width: 0; }
58
+ .astraeus-shell .setting-group:last-child { margin-bottom: 0; }
59
+ .astraeus-shell .setting-group > h4 { margin: 0 0 6px; padding-bottom: 3px; border-bottom: 1px solid var(--ui-border); color: var(--ui-data); font-size: 12px; font-weight: 650; letter-spacing: .03em; }
60
+ .astraeus-shell .hud .setting { display: grid; grid-template-columns: minmax(9.5em, 0.8fr) minmax(0, 1.4fr) 3.6em; align-items: center; gap: 4px 10px; margin: 0 0 6px; min-width: 0; }
61
+ .astraeus-shell .hud .setting-label { min-width: 0; color: var(--ui-color); }
62
+ .astraeus-shell .hud .setting input[type="range"] { width: 100%; min-width: 0; padding: 0; }
63
+ .astraeus-shell .hud .setting output { color: var(--ui-muted); font-variant-numeric: tabular-nums; text-align: right; }
64
+ .astraeus-shell .hud .setting-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; margin: 0 0 6px; }
65
+ .astraeus-shell .hud .setting-buttons.has-label { display: grid; grid-template-columns: minmax(9.5em, 0.8fr) minmax(0, 2.2fr); }
66
+ .astraeus-shell .hud .setting-buttons.has-label > div { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
67
+ .astraeus-shell .hud .row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
68
+ .astraeus-shell :where(.hud) button,
69
+ .astraeus-shell :where(.hud) input,
70
+ .astraeus-shell :where(.hud) select {
96
71
  min-height: 34px;
97
72
  padding: 5px 9px;
98
73
  border: 1px solid #45413d;
@@ -102,46 +77,46 @@ body,
102
77
  font: inherit;
103
78
  }
104
79
 
105
- .hud button { cursor: pointer; }
106
- .hud button:hover:not(:disabled),
107
- .hud select:hover { border-color: #888078; }
108
- .hud button[aria-pressed="true"] { border-color: var(--ui-accent); color: var(--ui-accent); }
109
- .hud .readout { color: var(--ui-muted); font-variant-numeric: tabular-nums; }
110
- .hud .controls { display: flex; flex-direction: column; gap: 8px; }
111
- .hud .controls .row:first-child { align-items: center; }
112
- .hud .controls .row:last-child input[type="range"] { flex: 1 1 250px; width: min(360px, 70vw); padding: 0; }
113
- .hud .rate-help,
114
- .hud .scale-help { margin: 7px 0 0; color: var(--ui-muted); font-size: 12px; line-height: 1.4; }
115
- .hud .error { color: #ff8174; }
116
-
117
- .hud .mission-summary { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
118
- .hud .mission-summary > p { margin: 0; color: var(--ui-muted); line-height: 1.4; }
119
- .hud .mission-summary details { min-width: 0; }
120
- .hud .mission-summary summary,
121
- .advanced-readouts summary { width: fit-content; color: var(--ui-data); cursor: pointer; }
122
- .hud .mission-summary details > strong { display: block; margin-top: 8px; color: var(--ui-color); font-size: 13px; line-height: 1.4; }
123
- .hud .mission-summary ul { display: grid; gap: 6px; margin: 6px 0 0; padding-left: 18px; color: var(--ui-muted); line-height: 1.4; }
124
- .hud .spacecraft-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; min-width: 0; }
125
- .spacecraft-card { min-width: 0; padding: 8px; border: 1px solid rgba(240, 230, 218, .12); border-radius: 7px; background: rgba(0, 0, 0, .22); }
126
- .spacecraft-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
127
- .spacecraft-card-header h4 { min-width: 0; margin: 0; color: var(--ui-color); font-size: 13px; line-height: 1.3; }
128
- .telemetry-state { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 5px; color: #b9d7bd; font-size: 11px; }
129
- .telemetry-state > span { width: 7px; height: 7px; border-radius: 50%; background: #77c58b; box-shadow: 0 0 7px rgba(119, 197, 139, .5); }
130
- .spacecraft-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
131
- .hud .mission-empty { margin: 0; color: var(--ui-muted); font-size: 13px; line-height: 1.4; }
132
- .scale-controls { align-items: center; }
133
- .scale-controls .scale-help { flex-basis: 100%; }
134
-
135
- .scientific-instruments { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
136
- .instrument-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
137
- .instrument-grid .metric-phase,
138
- .instrument-grid .metric-coordinates { grid-column: 1 / -1; }
139
- .hud-section-clock .metric-progress { margin-top: 8px; }
140
- .advanced-readouts { min-width: 0; }
141
- .hud .advanced-readouts .overlay { margin-top: 8px; }
142
-
143
- .hud .overlay,
144
- .hud .frame-readouts {
80
+ .astraeus-shell .hud button { cursor: pointer; }
81
+ .astraeus-shell :where(.hud) button:hover:not(:disabled),
82
+ .astraeus-shell :where(.hud) select:hover { border-color: #888078; }
83
+ .astraeus-shell :where(.hud) button[aria-pressed="true"] { border-color: var(--ui-accent); color: var(--ui-accent); }
84
+ .astraeus-shell .hud .readout { color: var(--ui-muted); font-variant-numeric: tabular-nums; }
85
+ .astraeus-shell .hud .controls { display: flex; flex-direction: column; gap: 8px; }
86
+ .astraeus-shell .hud .controls .row:first-child { align-items: center; }
87
+ .astraeus-shell .hud .controls .row:last-child input[type="range"] { flex: 1 1 250px; width: min(360px, 70vw); padding: 0; }
88
+ .astraeus-shell .hud .rate-help,
89
+ .astraeus-shell .hud .scale-help { margin: 7px 0 0; color: var(--ui-muted); font-size: 12px; line-height: 1.4; }
90
+ .astraeus-shell .hud .error { color: #ff8174; }
91
+
92
+ .astraeus-shell .hud .mission-summary { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
93
+ .astraeus-shell .hud .mission-summary > p { margin: 0; color: var(--ui-muted); line-height: 1.4; }
94
+ .astraeus-shell .hud .mission-summary details { min-width: 0; }
95
+ .astraeus-shell :where(.hud) .mission-summary summary,
96
+ .astraeus-shell :where(.advanced-readouts) summary { width: fit-content; color: var(--ui-data); cursor: pointer; }
97
+ .astraeus-shell .hud .mission-summary details > strong { display: block; margin-top: 8px; color: var(--ui-color); font-size: 13px; line-height: 1.4; }
98
+ .astraeus-shell .hud .mission-summary ul { display: grid; gap: 6px; margin: 6px 0 0; padding-left: 18px; color: var(--ui-muted); line-height: 1.4; }
99
+ .astraeus-shell .hud .spacecraft-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; min-width: 0; }
100
+ .astraeus-shell .spacecraft-card { min-width: 0; padding: 8px; border: 1px solid rgba(240, 230, 218, .12); border-radius: 7px; background: rgba(0, 0, 0, .22); }
101
+ .astraeus-shell .spacecraft-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
102
+ .astraeus-shell .spacecraft-card-header h4 { min-width: 0; margin: 0; color: var(--ui-color); font-size: 13px; line-height: 1.3; }
103
+ .astraeus-shell .telemetry-state { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 5px; color: #b9d7bd; font-size: 11px; }
104
+ .astraeus-shell .telemetry-state > span { width: 7px; height: 7px; border-radius: 50%; background: #77c58b; box-shadow: 0 0 7px rgba(119, 197, 139, .5); }
105
+ .astraeus-shell .spacecraft-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
106
+ .astraeus-shell .hud .mission-empty { margin: 0; color: var(--ui-muted); font-size: 13px; line-height: 1.4; }
107
+ .astraeus-shell .scale-controls { align-items: center; }
108
+ .astraeus-shell .scale-controls .scale-help { flex-basis: 100%; }
109
+
110
+ .astraeus-shell .scientific-instruments { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
111
+ .astraeus-shell .instrument-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
112
+ .astraeus-shell .instrument-grid .metric-phase,
113
+ .astraeus-shell .instrument-grid .metric-coordinates { grid-column: 1 / -1; }
114
+ .astraeus-shell .hud-section-clock .metric-progress { margin-top: 8px; }
115
+ .astraeus-shell .advanced-readouts { min-width: 0; }
116
+ .astraeus-shell .hud .advanced-readouts .overlay { margin-top: 8px; }
117
+
118
+ .astraeus-shell .hud .overlay,
119
+ .astraeus-shell .hud .frame-readouts {
145
120
  display: grid;
146
121
  grid-template-columns: minmax(9.5em, .36fr) minmax(0, 1fr);
147
122
  gap: 4px 10px;
@@ -152,15 +127,15 @@ body,
152
127
  font-variant-numeric: tabular-nums;
153
128
  }
154
129
 
155
- .hud .overlay div,
156
- .hud .frame-readouts div { display: contents; }
157
- .hud .overlay dt,
158
- .hud .frame-readouts dt { color: var(--ui-data); }
159
- .hud .overlay dd,
160
- .hud .frame-readouts dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
130
+ .astraeus-shell .hud .overlay div,
131
+ .astraeus-shell .hud .frame-readouts div { display: contents; }
132
+ .astraeus-shell .hud .overlay dt,
133
+ .astraeus-shell .hud .frame-readouts dt { color: var(--ui-data); }
134
+ .astraeus-shell .hud .overlay dd,
135
+ .astraeus-shell .hud .frame-readouts dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
161
136
 
162
- .anchor-labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
163
- .anchor-label {
137
+ .astraeus-shell .anchor-labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
138
+ .astraeus-shell .anchor-label {
164
139
  position: absolute;
165
140
  top: 0;
166
141
  left: 0;
@@ -173,34 +148,34 @@ body,
173
148
  }
174
149
 
175
150
  @media (max-width: 680px) {
176
- .hud { grid-template-columns: minmax(0, 1fr); }
177
- .developer-heading,
178
- .hud-section-clock { grid-column: 1; }
179
- .hud .overlay,
180
- .hud .frame-readouts { grid-template-columns: minmax(110px, .42fr) minmax(0, 1fr); }
151
+ .astraeus-shell .hud { grid-template-columns: minmax(0, 1fr); }
152
+ .astraeus-shell .developer-heading,
153
+ .astraeus-shell .hud-section-clock { grid-column: 1; }
154
+ .astraeus-shell .hud .overlay,
155
+ .astraeus-shell .hud .frame-readouts { grid-template-columns: minmax(110px, .42fr) minmax(0, 1fr); }
181
156
  }
182
157
 
183
- .hud .fps-graph { display: block; width: 100%; height: auto; margin-top: 10px; color: var(--ui-data); }
184
- .hud .tone-good { color: var(--perf-good); fill: var(--perf-good); }
185
- .hud .tone-warn { color: var(--perf-warn); fill: var(--perf-warn); }
186
- .hud .tone-bad { color: var(--perf-bad); fill: var(--perf-bad); }
187
- .hud .fps-graph line.tone-good, .hud .fps-graph line.tone-warn, .hud .fps-graph line.tone-bad { stroke: currentColor; }
188
- .hud .frame-readouts dd[class^="tone-"] { font-weight: 600; }
189
- .hud .fps-graph-key { display: flex; gap: 12px; margin: 4px 0 0; font-size: 11px; color: var(--ui-muted); }
158
+ .astraeus-shell .hud .fps-graph { display: block; width: 100%; height: auto; margin-top: 10px; color: var(--ui-data); }
159
+ .astraeus-shell .hud .tone-good { color: var(--perf-good); fill: var(--perf-good); }
160
+ .astraeus-shell .hud .tone-warn { color: var(--perf-warn); fill: var(--perf-warn); }
161
+ .astraeus-shell .hud .tone-bad { color: var(--perf-bad); fill: var(--perf-bad); }
162
+ .astraeus-shell .hud .fps-graph line.tone-good, .astraeus-shell .hud .fps-graph line.tone-warn, .astraeus-shell .hud .fps-graph line.tone-bad { stroke: currentColor; }
163
+ .astraeus-shell .hud .frame-readouts dd[class^="tone-"] { font-weight: 600; }
164
+ .astraeus-shell .hud .fps-graph-key { display: flex; gap: 12px; margin: 4px 0 0; font-size: 11px; color: var(--ui-muted); }
190
165
 
191
166
  /* Developer panel on a phone: one column, label above control, labels never squeezed to a few letters. */
192
167
  @media (max-width: 700px) {
193
- .hud { column-count: 1; }
194
- .dev-group-cards > .collapsible-body { column-count: 1; }
195
- .hud-section-frame .frame-body { display: block; }
196
- .hud .setting { grid-template-columns: minmax(0, 1fr) 3.4em; }
197
- .hud .setting-label { grid-column: 1 / -1; }
198
- .hud .setting input[type="range"] { grid-column: 1; }
199
- .hud .setting-buttons.has-label { grid-template-columns: minmax(0, 1fr); }
200
- .hud .overlay, .hud .frame-readouts { grid-template-columns: minmax(8.5em, .5fr) minmax(0, 1fr); }
168
+ .astraeus-shell .hud { column-count: 1; }
169
+ .astraeus-shell .dev-group-cards > .collapsible-body { column-count: 1; }
170
+ .astraeus-shell .hud-section-frame .frame-body { display: block; }
171
+ .astraeus-shell .hud .setting { grid-template-columns: minmax(0, 1fr) 3.4em; }
172
+ .astraeus-shell .hud .setting-label { grid-column: 1 / -1; }
173
+ .astraeus-shell .hud .setting input[type="range"] { grid-column: 1; }
174
+ .astraeus-shell .hud .setting-buttons.has-label { grid-template-columns: minmax(0, 1fr); }
175
+ .astraeus-shell .hud .overlay, .astraeus-shell .hud .frame-readouts { grid-template-columns: minmax(8.5em, .5fr) minmax(0, 1fr); }
201
176
  }
202
177
 
203
- .hud .view-link { margin: 0 0 6px; }
204
- .hud .view-link-values { margin: 2px 0 6px; color: var(--ui-muted); font-size: 12px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
205
- .hud .view-link-field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 6px; color: var(--ui-muted); font-size: 12px; }
206
- .hud .view-link-field input { width: 100%; min-width: 0; box-sizing: border-box; }
178
+ .astraeus-shell .hud .view-link { margin: 0 0 6px; }
179
+ .astraeus-shell .hud .view-link-values { margin: 2px 0 6px; color: var(--ui-muted); font-size: 12px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
180
+ .astraeus-shell .hud .view-link-field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 6px; color: var(--ui-muted); font-size: 12px; }
181
+ .astraeus-shell :where(.hud) .view-link-field input { width: 100%; min-width: 0; box-sizing: border-box; }
@@ -1,7 +1,7 @@
1
1
  import type { BodyId } from "../core/body.js";
2
2
  import type { StateResolver } from "../core/stateResolver.js";
3
3
  import { type BodyCatalogue } from "../assets/catalogue.js";
4
- import type { CenteredPosition } from "../core/state.js";
4
+ import { type CenteredPosition } from "../core/state.js";
5
5
  import { type TrackedBody, type TrackedReadout } from "./mission.js";
6
6
  import type { AltitudeMetric, DistanceMetric, Metric, MetricReference, RelativeDistanceMetric, SpeedMetric, UncertaintyMetric } from "../shell/metrics.js";
7
7
  /**
@@ -46,8 +46,15 @@ export interface PathReadouts {
46
46
  readonly body: TrackedBody;
47
47
  readonly readouts: readonly ReadoutSpec[];
48
48
  }
49
+ /** A catalogued body that asks for readouts (`addBody(x, { readouts })`): measured from `center`, the scene's centre body, like a path from its own centre. */
50
+ export interface BodyReadouts {
51
+ readonly id: BodyId;
52
+ readonly label: string;
53
+ readonly center: BodyId;
54
+ readonly readouts: readonly ReadoutSpec[];
55
+ }
49
56
  /**
50
- * The info card's bars for paths that ask for readouts, from State only. Range is from the path's centre body; a named body is read from the
57
+ * The info card's bars for paths (and catalogued bodies) that ask for readouts, from State only. Range is from the path's centre body; a named body is read from the
51
58
  * resolver about that centre, so it shares the path's frame. A path outside its bounds and any other id have none.
52
59
  */
53
- export declare function createReadoutMetrics(paths: readonly PathReadouts[], resolver: StateResolver, source?: BodyCatalogue): (objectId: string, timeUtcMs: number) => readonly Metric[];
60
+ export declare function createReadoutMetrics(paths: readonly PathReadouts[], resolver: StateResolver, source?: BodyCatalogue, bodies?: readonly BodyReadouts[]): (objectId: string, timeUtcMs: number) => readonly Metric[];
@@ -1,4 +1,5 @@
1
1
  import { catalogue as builtInCatalogue } from "../assets/catalogue.js";
2
+ import { EQJ } from "../core/state.js";
2
3
  import { discrepancyAt, trackedReadouts } from "./mission.js";
3
4
  const centreName = (center) => `${center.charAt(0).toUpperCase()}${center.slice(1)} centre`;
4
5
  /**
@@ -18,7 +19,7 @@ export function peakAnchorSpeedKmS(body) {
18
19
  }
19
20
  /** A reference marker only when it is measured from the same centre and in the same frame as the value. */
20
21
  export function referenceInSameFrame(label, row, reference) {
21
- if (reference === null || reference.center !== row.center || reference.frame !== row.frame)
22
+ if (reference === null || reference.center !== row.center || reference.plane !== row.frame)
22
23
  return null;
23
24
  return { label, value: Math.hypot(...reference.positionKm) };
24
25
  }
@@ -49,7 +50,7 @@ export function spacecraftSpeedMetric(row, peakKmS) {
49
50
  }
50
51
  /** The target's state when it shares the path's centre and frame, otherwise null. */
51
52
  export function inSameFrame(row, state) {
52
- return state !== null && state.center === row.center && state.frame === row.frame ? state : null;
53
+ return state !== null && state.center === row.center && state.plane === row.frame ? state : null;
53
54
  }
54
55
  export const separationKm = (a, b) => Math.hypot(a[0] - b[0], a[1] - b[1], a[2] - b[2]);
55
56
  /** Centre-to-centre distance from the path to a body, drawn in that body's radii. */
@@ -102,19 +103,21 @@ export function spacecraftDiscrepancyMetric(body, timeUtcMs) {
102
103
  };
103
104
  }
104
105
  const targetOf = (id, source) => ({ id, label: source.get(id).definition.label, radiusKm: source.get(id).definition.radiusKm });
106
+ /** The current-position row of a catalogued body about its centre, the shape a path's row has (speed unknown without a velocity). */
107
+ function bodyRow(resolver, { id, label, center }, timeUtcMs) {
108
+ const state = id === center ? { plane: EQJ, center, positionKm: new Float64Array(3), velocityKmS: undefined } : resolver.stateOf(id, timeUtcMs, center);
109
+ const [x, y, z] = state.positionKm;
110
+ return { id, label, positionKm: [x, y, z], rangeFromEarthKm: Math.hypot(x, y, z), speedKmS: state.velocityKmS === undefined ? null : Math.hypot(...state.velocityKmS), frame: state.plane, center: state.center };
111
+ }
105
112
  /**
106
- * The info card's bars for paths that ask for readouts, from State only. Range is from the path's centre body; a named body is read from the
113
+ * The info card's bars for paths (and catalogued bodies) that ask for readouts, from State only. Range is from the path's centre body; a named body is read from the
107
114
  * resolver about that centre, so it shares the path's frame. A path outside its bounds and any other id have none.
108
115
  */
109
- export function createReadoutMetrics(paths, resolver, source = builtInCatalogue) {
116
+ export function createReadoutMetrics(paths, resolver, source = builtInCatalogue, bodies = []) {
110
117
  const peaks = new Map(paths.map(({ body }) => [body.id, peakAnchorSpeedKmS(body)]));
111
- return (objectId, timeUtcMs) => {
112
- const path = paths.find(({ body }) => body.id === objectId);
113
- const row = path === undefined ? undefined : trackedReadouts([path.body], timeUtcMs)[0];
114
- if (path === undefined || row === undefined)
115
- return [];
116
- const stateOf = (id) => (id === row.center ? { body: id, center: row.center, timeUtcMs, frame: row.frame, positionKm: new Float64Array(3) } : resolver.stateOf(id, timeUtcMs, row.center));
117
- return path.readouts.map((spec) => {
118
+ const barsOf = (row, specs, timeUtcMs) => {
119
+ const stateOf = (id) => (id === row.center ? { body: id, center: row.center, timeUtcMs, plane: row.frame, positionKm: new Float64Array(3) } : resolver.stateOf(id, timeUtcMs, row.center));
120
+ return specs.map((spec) => {
118
121
  switch (spec.kind) {
119
122
  case "range": return spacecraftRangeMetric(row, spec.marker === undefined ? null : referenceInSameFrame(`${targetOf(spec.marker, source).label} now`, row, stateOf(spec.marker)));
120
123
  case "speed": return spacecraftSpeedMetric(row, peaks.get(row.id) ?? null);
@@ -123,4 +126,12 @@ export function createReadoutMetrics(paths, resolver, source = builtInCatalogue)
123
126
  }
124
127
  });
125
128
  };
129
+ return (objectId, timeUtcMs) => {
130
+ const body = bodies.find(({ id }) => id === objectId);
131
+ if (body !== undefined)
132
+ return barsOf(bodyRow(resolver, body, timeUtcMs), body.readouts, timeUtcMs);
133
+ const path = paths.find((candidate) => candidate.body.id === objectId);
134
+ const row = path === undefined ? undefined : trackedReadouts([path.body], timeUtcMs)[0];
135
+ return path === undefined || row === undefined ? [] : barsOf(row, path.readouts, timeUtcMs);
136
+ };
126
137
  }
@@ -1,24 +1,9 @@
1
- /**
2
- * A camera view as a short text: `?view=<focus>,<azimuthDeg>,<elevationDeg>,<distance>`, with the scale (`scale=`), up direction (`up=`)
3
- * and time (`t=`, ISO UTC) beside it. Azimuth and elevation are the scene camera's own angles about the up direction in force;
4
- * distance is the scene camera's own (scaled units, camera to focus). Pure text handling: no body is named here.
5
- */
6
- export interface StartView {
7
- /** The focus target's id (a body, group or path the scene knows). */
8
- readonly focus: string;
9
- /** Degrees, 0 up to 360, about the up direction. */
10
- readonly azimuthDeg: number;
11
- /** Degrees above the orbit plane, within ±89. */
12
- readonly elevationDeg: number;
13
- /** Camera-to-focus distance in scaled units; positive. */
14
- readonly distance: number;
15
- }
1
+ import { validateStartView, type StartView } from "../core/startView.js";
2
+ export { validateStartView, type StartView };
16
3
  /** The view as the camera reports it (radians), as a StartView rounded the way a link rounds it. */
17
4
  export declare function viewFromAngles(focus: string, azimuthRad: number, elevationRad: number, distance: number): StartView;
18
5
  /** `focus,az,el,distance`. */
19
6
  export declare function formatView(view: StartView): string;
20
- /** Checks a view's fields, naming the offending one (`where` is its path, e.g. `look.startView`). Returns the view with the azimuth wrapped. */
21
- export declare function validateStartView(raw: unknown, where?: string): StartView;
22
7
  /** Parses `focus,az,el,distance`; throws a RangeError naming the field. */
23
8
  export declare function parseView(text: string): StartView;
24
9
  /** The view in `?view=`, or undefined when absent or malformed (a bad link opens the experience's own view rather than failing). */
@@ -27,22 +12,15 @@ export declare function viewFromSearch(search: string): StartView | undefined;
27
12
  export declare function timeFromSearch(search: string): number | undefined;
28
13
  /** `?scale=<id>`, or undefined. The caller checks the id against the scale choices it offers. */
29
14
  export declare function scaleFromSearch(search: string): string | undefined;
30
- /** The address search for a view: the current search with `view`, `scale`, `up` and `t` set (other parameters kept). */
31
- export declare function viewLinkSearch(search: string, state: {
32
- view: StartView;
33
- scaleId: string;
34
- up: string;
35
- timeUtcMs: number;
36
- }): string;
37
- /**
38
- * Writes the view link into the address (so a reload keeps the view), then copies the full link. `copied` is false when the clipboard refuses; the caller then shows the link to copy by hand.
39
- */
40
- export declare function shareViewLink(state: {
15
+ /** What a copied link carries. `show` is the id of the scene view showing, left out in a scene without views. */
16
+ export interface ViewLinkState {
41
17
  view: StartView;
42
18
  scaleId: string;
43
19
  up: string;
44
20
  timeUtcMs: number;
45
- }): Promise<{
46
- readonly url: string;
47
- readonly copied: boolean;
48
- }>;
21
+ show?: string;
22
+ }
23
+ /** `?show=<view id>` (a scene's `setViews` id), or undefined. The caller checks the id against the scene's views. */
24
+ export declare function showFromSearch(search: string): string | undefined;
25
+ /** The address search for a view: the current search with `view`, `scale`, `up`, `t` and, with views, `show` set (other parameters kept). */
26
+ export declare function viewLinkSearch(search: string, state: ViewLinkState): string;
@@ -1,5 +1,5 @@
1
- const MAX_ELEVATION_DEG = 89;
2
- const wrapAzimuth = (deg) => ((deg % 360) + 360) % 360;
1
+ import { MAX_ELEVATION_DEG, validateStartView, wrapAzimuth } from "../core/startView.js";
2
+ export { validateStartView };
3
3
  const round = (value, places) => Number(value.toFixed(places));
4
4
  /** The view as the camera reports it (radians), as a StartView rounded the way a link rounds it. */
5
5
  export function viewFromAngles(focus, azimuthRad, elevationRad, distance) {
@@ -15,32 +15,6 @@ export function viewFromAngles(focus, azimuthRad, elevationRad, distance) {
15
15
  export function formatView(view) {
16
16
  return [encodeURIComponent(view.focus), view.azimuthDeg, view.elevationDeg, view.distance].join(",");
17
17
  }
18
- /** Checks a view's fields, naming the offending one (`where` is its path, e.g. `look.startView`). Returns the view with the azimuth wrapped. */
19
- export function validateStartView(raw, where = "startView") {
20
- if (typeof raw !== "object" || raw === null || Array.isArray(raw))
21
- throw new RangeError(`${where} must be an object with focus, azimuthDeg, elevationDeg and distance`);
22
- const record = raw;
23
- for (const key of Object.keys(record)) {
24
- if (!["focus", "azimuthDeg", "elevationDeg", "distance"].includes(key))
25
- throw new RangeError(`${where}.${key} is not a view field`);
26
- }
27
- if (typeof record.focus !== "string" || record.focus === "")
28
- throw new RangeError(`${where}.focus must be a non-empty id, got ${String(record.focus)}`);
29
- const number = (key) => {
30
- const value = record[key];
31
- if (typeof value !== "number" || !Number.isFinite(value))
32
- throw new RangeError(`${where}.${key} must be a finite number, got ${String(value)}`);
33
- return value;
34
- };
35
- const azimuthDeg = number("azimuthDeg");
36
- const elevationDeg = number("elevationDeg");
37
- const distance = number("distance");
38
- if (Math.abs(elevationDeg) > MAX_ELEVATION_DEG)
39
- throw new RangeError(`${where}.elevationDeg must be within ±${MAX_ELEVATION_DEG}, got ${elevationDeg}`);
40
- if (!(distance > 0))
41
- throw new RangeError(`${where}.distance must be positive, got ${distance}`);
42
- return { focus: record.focus, azimuthDeg: wrapAzimuth(azimuthDeg), elevationDeg, distance };
43
- }
44
18
  /** Parses `focus,az,el,distance`; throws a RangeError naming the field. */
45
19
  export function parseView(text) {
46
20
  const parts = text.split(",");
@@ -86,32 +60,19 @@ export function scaleFromSearch(search) {
86
60
  const raw = new URLSearchParams(search).get("scale");
87
61
  return raw === null || raw === "" ? undefined : raw;
88
62
  }
89
- /** The address search for a view: the current search with `view`, `scale`, `up` and `t` set (other parameters kept). */
63
+ /** `?show=<view id>` (a scene's `setViews` id), or undefined. The caller checks the id against the scene's views. */
64
+ export function showFromSearch(search) {
65
+ const raw = new URLSearchParams(search).get("show");
66
+ return raw === null || raw === "" ? undefined : raw;
67
+ }
68
+ /** The address search for a view: the current search with `view`, `scale`, `up`, `t` and, with views, `show` set (other parameters kept). */
90
69
  export function viewLinkSearch(search, state) {
91
70
  const params = new URLSearchParams(search);
92
71
  params.set("view", formatView(state.view));
93
72
  params.set("scale", state.scaleId);
94
73
  params.set("up", state.up);
95
74
  params.set("t", new Date(Math.round(state.timeUtcMs / 1000) * 1000).toISOString());
75
+ if (state.show !== undefined && state.show !== "")
76
+ params.set("show", state.show);
96
77
  return `?${params.toString().replace(/%2C/gi, ",").replace(/%3A/gi, ":")}`;
97
78
  }
98
- /**
99
- * Writes the view link into the address (so a reload keeps the view), then copies the full link. `copied` is false when the clipboard refuses; the caller then shows the link to copy by hand.
100
- */
101
- export async function shareViewLink(state) {
102
- const search = viewLinkSearch(window.location.search, state);
103
- try {
104
- window.history.replaceState(null, "", `${window.location.pathname}${search}${window.location.hash}`);
105
- }
106
- catch { /* the link below still works */ }
107
- const url = `${window.location.origin}${window.location.pathname}${search}`;
108
- let copied = false;
109
- try {
110
- await navigator.clipboard.writeText(url);
111
- copied = true;
112
- }
113
- catch {
114
- copied = false;
115
- }
116
- return { url, copied };
117
- }