astraeus 0.6.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 (288) hide show
  1. package/CHANGELOG.md +192 -0
  2. package/README.md +205 -34
  3. package/package.json +5 -4
  4. package/src/api/AstraeusScene.d.ts +24 -6
  5. package/src/api/AstraeusScene.js +46 -19
  6. package/src/api/AstraeusScene.node.js +46 -19
  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 +19 -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 +10 -16
  36. package/src/api/mount.js +27 -11
  37. package/src/api/mount.node.js +27 -11
  38. package/src/api/pathProvenance.d.ts +15 -6
  39. package/src/api/pathProvenance.js +23 -11
  40. package/src/api/pickerInput.d.ts +25 -0
  41. package/src/api/pickerInput.js +1 -0
  42. package/src/api/planBodies.d.ts +72 -0
  43. package/src/api/planBodies.js +300 -0
  44. package/src/api/planBodySets.d.ts +68 -0
  45. package/src/api/planBodySets.js +234 -0
  46. package/src/api/planCamera.d.ts +83 -0
  47. package/src/api/planCamera.js +184 -0
  48. package/src/api/planGroups.d.ts +36 -0
  49. package/src/api/planGroups.js +103 -0
  50. package/src/api/planMoonPanel.d.ts +19 -0
  51. package/src/api/planMoonPanel.js +104 -0
  52. package/src/api/planPaths.d.ts +40 -0
  53. package/src/api/planPaths.js +212 -0
  54. package/src/api/planPicker.d.ts +12 -0
  55. package/src/api/planPicker.js +40 -0
  56. package/src/api/planPlaces.d.ts +16 -0
  57. package/src/api/planPlaces.js +99 -0
  58. package/src/api/planStory.d.ts +26 -0
  59. package/src/api/planStory.js +66 -0
  60. package/src/api/planTimeline.d.ts +27 -0
  61. package/src/api/planTimeline.js +68 -0
  62. package/src/api/planViews.d.ts +25 -0
  63. package/src/api/planViews.js +35 -0
  64. package/src/api/prepared.js +4 -1
  65. package/src/api/renamedInputs.d.ts +15 -0
  66. package/src/api/renamedInputs.js +39 -0
  67. package/src/api/scene.d.ts +176 -65
  68. package/src/api/scene.js +257 -725
  69. package/src/api/sceneFreeze.d.ts +4 -0
  70. package/src/api/sceneFreeze.js +10 -0
  71. package/src/api/sceneReads.d.ts +171 -0
  72. package/src/api/sceneReads.js +6 -0
  73. package/src/api/sphereOfInfluence.d.ts +20 -0
  74. package/src/api/sphereOfInfluence.js +48 -0
  75. package/src/api/story.d.ts +49 -19
  76. package/src/api/story.js +54 -22
  77. package/src/api/sunOrbit.js +9 -11
  78. package/src/api/time.d.ts +2 -1
  79. package/src/api/time.js +2 -1
  80. package/src/api/viewerCamera.d.ts +22 -0
  81. package/src/api/viewerCamera.js +84 -0
  82. package/src/api/viewerClock.d.ts +30 -0
  83. package/src/api/viewerClock.js +85 -0
  84. package/src/api/viewerFirstDraw.d.ts +14 -0
  85. package/src/api/viewerFirstDraw.js +26 -0
  86. package/src/api/viewerHandle.d.ts +79 -0
  87. package/src/api/viewerHandle.js +31 -0
  88. package/src/api/viewerLink.d.ts +91 -13
  89. package/src/api/viewerLink.js +111 -64
  90. package/src/api/viewerLooks.d.ts +19 -0
  91. package/src/api/viewerLooks.js +37 -0
  92. package/src/api/viewerPicker.d.ts +22 -0
  93. package/src/api/viewerPicker.js +49 -0
  94. package/src/api/viewerSelection.d.ts +25 -0
  95. package/src/api/viewerSelection.js +31 -0
  96. package/src/api/viewerViews.d.ts +10 -0
  97. package/src/api/viewerViews.js +18 -0
  98. package/src/api/viewerZones.d.ts +20 -0
  99. package/src/api/viewerZones.js +47 -0
  100. package/src/api/views.d.ts +41 -0
  101. package/src/api/views.js +82 -0
  102. package/src/app/App.d.ts +5 -3
  103. package/src/app/App.js +211 -75
  104. package/src/app/App.node.js +211 -75
  105. package/src/app/AstraeusScene.d.ts +19 -2
  106. package/src/app/AstraeusScene.js +4 -4
  107. package/src/app/BodyView.d.ts +4 -1
  108. package/src/app/BodyView.js +2 -2
  109. package/src/app/CameraController.d.ts +12 -0
  110. package/src/app/CameraController.js +3 -1
  111. package/src/app/DeveloperSettings.d.ts +1 -4
  112. package/src/app/DeveloperSettings.js +6 -10
  113. package/src/app/FeatureMarkers.d.ts +4 -3
  114. package/src/app/FeatureMarkers.js +8 -13
  115. package/src/app/FrameRateSection.js +2 -1
  116. package/src/app/OrbitSetView.js +1 -1
  117. package/src/app/SettingControls.d.ts +11 -3
  118. package/src/app/SettingControls.js +10 -2
  119. package/src/app/SkyView.d.ts +3 -10
  120. package/src/app/SkyView.js +6 -28
  121. package/src/app/StoryMarkers.d.ts +4 -1
  122. package/src/app/StoryMarkers.js +3 -2
  123. package/src/app/TrackedBodyView.d.ts +1 -1
  124. package/src/app/TrackedBodyView.js +20 -11
  125. package/src/app/address.d.ts +16 -0
  126. package/src/app/address.js +31 -0
  127. package/src/app/bodyDraw.d.ts +10 -7
  128. package/src/app/bodyDraw.js +12 -32
  129. package/src/app/bodyMetrics.js +2 -2
  130. package/src/app/bodySet.d.ts +4 -20
  131. package/src/app/bodySet.js +5 -16
  132. package/src/app/debugReadout.js +1 -1
  133. package/src/app/displaySwitches.d.ts +4 -0
  134. package/src/app/displaySwitches.js +6 -0
  135. package/src/app/experienceDefinition.d.ts +14 -23
  136. package/src/app/listSwitch.d.ts +8 -14
  137. package/src/app/listSwitch.js +3 -10
  138. package/src/app/liveLook.d.ts +39 -0
  139. package/src/app/liveLook.js +66 -0
  140. package/src/app/look.d.ts +36 -0
  141. package/src/app/look.js +61 -0
  142. package/src/app/mission.d.ts +16 -3
  143. package/src/app/mission.js +16 -1
  144. package/src/app/openClock.d.ts +3 -2
  145. package/src/app/openClock.js +3 -3
  146. package/src/app/sceneCamera.d.ts +2 -0
  147. package/src/app/sceneCamera.js +23 -0
  148. package/src/app/sceneFrame.d.ts +6 -4
  149. package/src/app/sceneFrame.js +55 -14
  150. package/src/app/sceneHooks.js +3 -2
  151. package/src/app/style.css +114 -139
  152. package/src/app/trackedMetrics.d.ts +10 -3
  153. package/src/app/trackedMetrics.js +22 -11
  154. package/src/app/viewHiding.d.ts +13 -0
  155. package/src/app/viewHiding.js +37 -0
  156. package/src/app/viewLink.d.ts +10 -32
  157. package/src/app/viewLink.js +10 -49
  158. package/src/app/viewerPort.d.ts +56 -0
  159. package/src/app/views.d.ts +32 -0
  160. package/src/app/views.js +2 -0
  161. package/src/assets/bodies/galileanMoons.js +1 -2
  162. package/src/assets/bodies/io.js +2 -2
  163. package/src/assets/bodies/listedMoons.d.ts +1 -1
  164. package/src/assets/bodies/listedMoons.js +2 -3
  165. package/src/assets/bodies/planetSystemMaps.js +2 -3
  166. package/src/assets/bodies/venus.js +2 -6
  167. package/src/assets/catalogue.js +1 -2
  168. package/src/assets/licence.d.ts +3 -3
  169. package/src/assets/licence.js +3 -3
  170. package/src/assets/pictures.d.ts +15 -12
  171. package/src/assets/pictures.js +24 -20
  172. package/src/assets/sky.d.ts +6 -5
  173. package/src/assets/sky.js +6 -9
  174. package/src/assets/visual.d.ts +4 -0
  175. package/src/core/bodies/index.d.ts +0 -4
  176. package/src/core/bodies/index.js +1 -6
  177. package/src/core/bodies/jupiterData.d.ts +0 -1
  178. package/src/core/bodies/jupiterData.js +2 -5
  179. package/src/core/bodies/moonSystem.d.ts +1 -1
  180. package/src/core/bodies/moonSystem.js +102 -55
  181. package/src/core/bodies/outerPlanetRingData.js +2 -2
  182. package/src/core/bodies/planetTrajectory.js +1 -1
  183. package/src/core/bodySetFamilies.d.ts +20 -0
  184. package/src/core/bodySetFamilies.js +14 -0
  185. package/src/core/chebyshevEphemeris.js +1 -1
  186. package/src/core/elementsBody.d.ts +8 -4
  187. package/src/core/elementsBody.js +32 -11
  188. package/src/core/elementsGroup.d.ts +27 -0
  189. package/src/core/elementsGroup.js +85 -0
  190. package/src/core/events.d.ts +2 -0
  191. package/src/core/events.js +2 -0
  192. package/src/core/illumination.js +1 -1
  193. package/src/core/listedOrbitGroup.d.ts +2 -0
  194. package/src/core/listedOrbitGroup.js +11 -7
  195. package/src/core/moonListText.d.ts +6 -0
  196. package/src/core/moonListText.js +19 -0
  197. package/src/core/moonTrajectory.js +1 -1
  198. package/src/core/pacing.d.ts +38 -3
  199. package/src/core/pacing.js +55 -4
  200. package/src/core/planetModels.js +2 -2
  201. package/src/core/planetSeries.d.ts +8 -0
  202. package/src/core/planetSeries.js +16 -2
  203. package/src/core/pointGroup.js +1 -1
  204. package/src/core/provenance.d.ts +2 -1
  205. package/src/core/provenance.js +2 -2
  206. package/src/core/referenceCenters.js +5 -5
  207. package/src/core/sampledTrajectory.js +1 -1
  208. package/src/core/scalePolicy.d.ts +1 -0
  209. package/src/core/startView.d.ts +19 -0
  210. package/src/core/startView.js +28 -0
  211. package/src/core/state.d.ts +6 -2
  212. package/src/core/state.js +3 -3
  213. package/src/core/storyPanels.d.ts +63 -0
  214. package/src/core/storyPanels.js +111 -0
  215. package/src/core/sunCentredSources.d.ts +4 -0
  216. package/src/core/sunCentredSources.js +9 -2
  217. package/src/core/timeInput.d.ts +4 -0
  218. package/src/core/timeInput.js +4 -0
  219. package/src/shell/AstraeusShell.d.ts +17 -3
  220. package/src/shell/AstraeusShell.js +60 -13
  221. package/src/shell/AstraeusShell.node.js +60 -13
  222. package/src/shell/Collapsible.d.ts +4 -3
  223. package/src/shell/Collapsible.js +5 -5
  224. package/src/shell/ControlsDrawer.d.ts +1 -1
  225. package/src/shell/ControlsDrawer.js +3 -1
  226. package/src/shell/DisplaySwitches.d.ts +18 -1
  227. package/src/shell/DisplaySwitches.js +20 -6
  228. package/src/shell/InfoPanel.d.ts +3 -1
  229. package/src/shell/InfoPanel.js +5 -4
  230. package/src/shell/MoonFamilyPanel.js +1 -1
  231. package/src/shell/ObjectControls.d.ts +3 -1
  232. package/src/shell/ObjectControls.js +2 -2
  233. package/src/shell/Sources.d.ts +5 -3
  234. package/src/shell/Sources.js +5 -5
  235. package/src/shell/StoryPanelView.d.ts +4 -3
  236. package/src/shell/StoryPanelView.js +8 -6
  237. package/src/shell/SwitchControl.d.ts +5 -11
  238. package/src/shell/SwitchControl.js +2 -20
  239. package/src/shell/TimelineBar.css +84 -66
  240. package/src/shell/TimelineBar.d.ts +5 -2
  241. package/src/shell/TimelineBar.js +37 -11
  242. package/src/shell/TimelineBar.node.js +37 -11
  243. package/src/shell/TopBar.css +22 -22
  244. package/src/shell/TopBar.d.ts +9 -3
  245. package/src/shell/TopBar.js +5 -5
  246. package/src/shell/TopBar.node.js +5 -5
  247. package/src/shell/bootLoader.d.ts +4 -10
  248. package/src/shell/bootLoader.js +6 -52
  249. package/src/shell/embedded.css +18 -18
  250. package/src/shell/experience.d.ts +1 -1
  251. package/src/shell/moonFamilies.d.ts +2 -6
  252. package/src/shell/moonFamilies.js +2 -18
  253. package/src/shell/phone.css +58 -58
  254. package/src/shell/storyPanels.d.ts +2 -53
  255. package/src/shell/storyPanels.js +1 -106
  256. package/src/shell/style.css +153 -134
  257. package/src/shell/timelineModel.d.ts +13 -0
  258. package/src/shell/timelineModel.js +25 -0
  259. package/src/shell/useDrawers.d.ts +3 -2
  260. package/src/shell/useDrawers.js +4 -3
  261. package/src/shell/viewCamera.d.ts +4 -0
  262. package/src/shell/viewCamera.js +13 -0
  263. package/src/shell/viewerKeys.d.ts +8 -0
  264. package/src/shell/viewerKeys.js +16 -0
  265. package/src/synthetic/syntheticDefinition.js +20 -24
  266. package/src/synthetic/syntheticJourneyScene.js +14 -4
  267. package/src/synthetic/syntheticProbeDefinition.js +2 -1
  268. package/src/synthetic/syntheticViewsDefinition.d.ts +3 -0
  269. package/src/synthetic/syntheticViewsDefinition.js +38 -0
  270. package/data/moons/jupiter.json +0 -3333
  271. package/data/moons/neptune.json +0 -555
  272. package/data/moons/pluto.json +0 -205
  273. package/data/moons/saturn.json +0 -8267
  274. package/data/moons/uranus.json +0 -887
  275. package/src/app/addressNavigation.d.ts +0 -17
  276. package/src/app/addressNavigation.js +0 -16
  277. package/src/assets/bodies/jupiterMoonCatalogue.d.ts +0 -3
  278. package/src/assets/bodies/jupiterMoonCatalogue.js +0 -4
  279. package/src/assets/bodies/outerPlanetCatalogues.d.ts +0 -7
  280. package/src/assets/bodies/outerPlanetCatalogues.js +0 -8
  281. package/src/assets/bodies/swiftTuttle.d.ts +0 -12
  282. package/src/assets/bodies/swiftTuttle.js +0 -13
  283. package/src/assets/moonCatalogue.d.ts +0 -49
  284. package/src/assets/moonCatalogue.js +0 -80
  285. package/src/core/bodies/outerPlanetData.d.ts +0 -4
  286. package/src/core/bodies/outerPlanetData.js +0 -13
  287. package/src/core/bodies/swiftTuttle.d.ts +0 -46
  288. package/src/core/bodies/swiftTuttle.js +0 -106
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
  }
@@ -0,0 +1,13 @@
1
+ import type { ExperienceConfig } from "../shell/experience.js";
2
+ import type { ResolvedView, ViewSettings } from "./views.js";
3
+ /** The ids the current view hides: objects (bodies, paths, groups) and story panels. Empty sets: everything shows. */
4
+ export interface ViewHidden {
5
+ readonly objects: ReadonlySet<string>;
6
+ readonly panels: ReadonlySet<string>;
7
+ }
8
+ /** The view with this id, else the opening one; undefined for a scene without views. */
9
+ export declare function viewById(settings: ViewSettings | undefined, id: string): ResolvedView | undefined;
10
+ /** What `view` hides. A scene without views hides nothing. An object that belongs to a hidden one (`partOf`: a body's Sun-orbit line) is hidden with it, so a view never names orbit lines. */
11
+ export declare function hiddenByView(settings: ViewSettings | undefined, view: ResolvedView | undefined, experience?: ExperienceConfig): ViewHidden;
12
+ /** The experience as the view shows it: its objects, timeline events and story panels. The same object when there are no views, so a scene without views is untouched. */
13
+ export declare function experienceInView(experience: ExperienceConfig, settings: ViewSettings | undefined, view: ResolvedView | undefined): ExperienceConfig;
@@ -0,0 +1,37 @@
1
+ /** The view with this id, else the opening one; undefined for a scene without views. */
2
+ export function viewById(settings, id) {
3
+ return settings?.views.find((view) => view.id === id) ?? settings?.views.find((view) => view.id === settings.start);
4
+ }
5
+ /** The ids of `kind` some view shows and `view` does not. An id no view's set holds (the sky, an orbit line) is never the views' to hide. */
6
+ function hiddenIds(settings, view, kind) {
7
+ const hidden = new Set();
8
+ for (const other of settings.views)
9
+ for (const id of other[kind])
10
+ if (!view[kind].has(id))
11
+ hidden.add(id);
12
+ return hidden;
13
+ }
14
+ /** What `view` hides. A scene without views hides nothing. An object that belongs to a hidden one (`partOf`: a body's Sun-orbit line) is hidden with it, so a view never names orbit lines. */
15
+ export function hiddenByView(settings, view, experience) {
16
+ if (settings === undefined || view === undefined)
17
+ return { objects: new Set(), panels: new Set() };
18
+ const objects = new Set(hiddenIds(settings, view, "objects"));
19
+ for (const object of experience?.objects ?? [])
20
+ if (object.partOf !== undefined && objects.has(object.partOf))
21
+ objects.add(object.id);
22
+ return { objects, panels: hiddenIds(settings, view, "panels") };
23
+ }
24
+ /** The experience as the view shows it: its objects, timeline events and story panels. The same object when there are no views, so a scene without views is untouched. */
25
+ export function experienceInView(experience, settings, view) {
26
+ if (settings === undefined || view === undefined)
27
+ return experience;
28
+ const hiddenEvents = hiddenIds(settings, view, "events");
29
+ const { objects, panels } = hiddenByView(settings, view, experience);
30
+ const storySet = experience.storyPanels;
31
+ return {
32
+ ...experience,
33
+ objects: experience.objects.filter((object) => !objects.has(object.id)),
34
+ events: experience.events.filter((event) => !hiddenEvents.has(event.id)),
35
+ ...(storySet === undefined ? {} : { storyPanels: { ...storySet, panels: storySet.panels.filter((panel) => !panels.has(panel.id)) } }),
36
+ };
37
+ }
@@ -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
- }