astraeus 0.7.0 → 0.8.1

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 (287) hide show
  1. package/CHANGELOG.md +189 -0
  2. package/README.md +202 -38
  3. package/data/ephemerides/planets/planets.json +1 -1
  4. package/package.json +5 -4
  5. package/src/api/AstraeusScene.d.ts +21 -5
  6. package/src/api/AstraeusScene.js +34 -10
  7. package/src/api/AstraeusScene.node.js +34 -10
  8. package/src/api/assembleScene.d.ts +36 -0
  9. package/src/api/assembleScene.js +175 -0
  10. package/src/api/bodySetChecks.d.ts +10 -0
  11. package/src/api/bodySetChecks.js +117 -0
  12. package/src/api/bodySetInput.d.ts +81 -0
  13. package/src/api/bodySetInput.js +1 -0
  14. package/src/api/containingBlock.d.ts +6 -0
  15. package/src/api/containingBlock.js +16 -0
  16. package/src/api/data.d.ts +17 -5
  17. package/src/api/data.js +28 -10
  18. package/src/api/definitionOf.d.ts +16 -0
  19. package/src/api/definitionOf.js +20 -0
  20. package/src/api/errors.d.ts +63 -1
  21. package/src/api/frozenCopy.d.ts +6 -0
  22. package/src/api/frozenCopy.js +26 -0
  23. package/src/api/group.d.ts +8 -2
  24. package/src/api/group.js +24 -5
  25. package/src/api/index.d.ts +18 -7
  26. package/src/api/index.js +2 -2
  27. package/src/api/index.node.js +2 -2
  28. package/src/api/listeners.d.ts +5 -0
  29. package/src/api/listeners.js +25 -0
  30. package/src/api/look.d.ts +47 -0
  31. package/src/api/look.js +1 -0
  32. package/src/api/lookInput.d.ts +3 -0
  33. package/src/api/lookInput.js +41 -0
  34. package/src/api/moonPanelInput.d.ts +60 -0
  35. package/src/api/moonPanelInput.js +1 -0
  36. package/src/api/mount.d.ts +9 -19
  37. package/src/api/mount.js +27 -13
  38. package/src/api/mount.node.js +27 -13
  39. package/src/api/pathProvenance.js +1 -1
  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 +162 -68
  68. package/src/api/scene.js +247 -793
  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/story.d.ts +49 -19
  74. package/src/api/story.js +54 -22
  75. package/src/api/sunOrbit.js +9 -11
  76. package/src/api/time.d.ts +2 -1
  77. package/src/api/time.js +2 -1
  78. package/src/api/viewerCamera.d.ts +22 -0
  79. package/src/api/viewerCamera.js +84 -0
  80. package/src/api/viewerClock.d.ts +30 -0
  81. package/src/api/viewerClock.js +85 -0
  82. package/src/api/viewerFirstDraw.d.ts +14 -0
  83. package/src/api/viewerFirstDraw.js +26 -0
  84. package/src/api/viewerHandle.d.ts +85 -0
  85. package/src/api/viewerHandle.js +32 -0
  86. package/src/api/viewerLink.d.ts +88 -15
  87. package/src/api/viewerLink.js +117 -75
  88. package/src/api/viewerLooks.d.ts +19 -0
  89. package/src/api/viewerLooks.js +37 -0
  90. package/src/api/viewerPicker.d.ts +22 -0
  91. package/src/api/viewerPicker.js +49 -0
  92. package/src/api/viewerSelection.d.ts +30 -0
  93. package/src/api/viewerSelection.js +46 -0
  94. package/src/api/viewerViews.d.ts +10 -0
  95. package/src/api/viewerViews.js +18 -0
  96. package/src/api/viewerZones.d.ts +20 -0
  97. package/src/api/viewerZones.js +47 -0
  98. package/src/api/views.d.ts +7 -6
  99. package/src/api/views.js +12 -6
  100. package/src/app/App.d.ts +5 -3
  101. package/src/app/App.js +211 -82
  102. package/src/app/App.node.js +211 -82
  103. package/src/app/AstraeusScene.d.ts +18 -2
  104. package/src/app/AstraeusScene.js +4 -4
  105. package/src/app/BodyView.d.ts +4 -1
  106. package/src/app/BodyView.js +2 -2
  107. package/src/app/CameraController.d.ts +6 -0
  108. package/src/app/DeveloperSettings.d.ts +1 -4
  109. package/src/app/DeveloperSettings.js +6 -10
  110. package/src/app/FeatureMarkers.d.ts +4 -3
  111. package/src/app/FeatureMarkers.js +8 -13
  112. package/src/app/FrameRateSection.js +2 -1
  113. package/src/app/OrbitSetView.js +1 -1
  114. package/src/app/SettingControls.d.ts +11 -3
  115. package/src/app/SettingControls.js +10 -2
  116. package/src/app/SkyView.d.ts +3 -10
  117. package/src/app/SkyView.js +6 -28
  118. package/src/app/address.d.ts +16 -0
  119. package/src/app/address.js +31 -0
  120. package/src/app/bodyDraw.d.ts +10 -7
  121. package/src/app/bodyDraw.js +12 -32
  122. package/src/app/bodyMetrics.js +2 -2
  123. package/src/app/bodySet.d.ts +4 -20
  124. package/src/app/bodySet.js +5 -16
  125. package/src/app/debugReadout.js +1 -1
  126. package/src/app/displaySwitches.d.ts +4 -0
  127. package/src/app/displaySwitches.js +6 -0
  128. package/src/app/experienceDefinition.d.ts +11 -23
  129. package/src/app/listSwitch.d.ts +8 -14
  130. package/src/app/listSwitch.js +3 -10
  131. package/src/app/liveLook.d.ts +39 -0
  132. package/src/app/liveLook.js +66 -0
  133. package/src/app/look.d.ts +36 -0
  134. package/src/app/look.js +61 -0
  135. package/src/app/mission.d.ts +1 -1
  136. package/src/app/mission.js +1 -1
  137. package/src/app/openClock.d.ts +3 -2
  138. package/src/app/openClock.js +3 -3
  139. package/src/app/sceneCamera.d.ts +2 -0
  140. package/src/app/sceneCamera.js +11 -1
  141. package/src/app/sceneFrame.d.ts +4 -4
  142. package/src/app/sceneFrame.js +13 -8
  143. package/src/app/sceneHooks.js +3 -2
  144. package/src/app/style.css +114 -139
  145. package/src/app/trackedMetrics.d.ts +10 -3
  146. package/src/app/trackedMetrics.js +22 -11
  147. package/src/app/viewLink.d.ts +10 -32
  148. package/src/app/viewLink.js +10 -49
  149. package/src/app/viewerPort.d.ts +52 -0
  150. package/src/app/views.d.ts +3 -0
  151. package/src/assets/bodies/galileanMoons.js +1 -2
  152. package/src/assets/bodies/io.js +2 -2
  153. package/src/assets/bodies/listedMoons.d.ts +1 -1
  154. package/src/assets/bodies/listedMoons.js +2 -3
  155. package/src/assets/bodies/planetSystemMaps.js +2 -3
  156. package/src/assets/bodies/venus.js +2 -6
  157. package/src/assets/catalogue.js +1 -2
  158. package/src/assets/licence.d.ts +3 -3
  159. package/src/assets/licence.js +3 -3
  160. package/src/assets/pictures.d.ts +15 -12
  161. package/src/assets/pictures.js +24 -20
  162. package/src/assets/sky.d.ts +6 -5
  163. package/src/assets/sky.js +6 -9
  164. package/src/assets/visual.d.ts +4 -0
  165. package/src/core/astronomyAdapter.d.ts +1 -1
  166. package/src/core/astronomyAdapter.js +3 -3
  167. package/src/core/bodies/index.d.ts +0 -4
  168. package/src/core/bodies/index.js +14 -18
  169. package/src/core/bodies/jupiter.js +1 -1
  170. package/src/core/bodies/jupiterData.d.ts +0 -1
  171. package/src/core/bodies/jupiterData.js +2 -5
  172. package/src/core/bodies/mars.js +1 -1
  173. package/src/core/bodies/mercury.js +1 -1
  174. package/src/core/bodies/moonSystem.d.ts +1 -1
  175. package/src/core/bodies/moonSystem.js +102 -55
  176. package/src/core/bodies/outerPlanetRingData.js +2 -2
  177. package/src/core/bodies/outerPlanets.d.ts +2 -3
  178. package/src/core/bodies/outerPlanets.js +4 -13
  179. package/src/core/bodies/planetMoons.d.ts +0 -2
  180. package/src/core/bodies/planetMoons.js +1 -18
  181. package/src/core/bodies/planetRecords.d.ts +8 -2
  182. package/src/core/bodies/planetRecords.js +13 -5
  183. package/src/core/bodies/planetTrajectory.d.ts +21 -4
  184. package/src/core/bodies/planetTrajectory.js +29 -5
  185. package/src/core/bodies/venus.js +1 -1
  186. package/src/core/bodySetFamilies.d.ts +20 -0
  187. package/src/core/bodySetFamilies.js +14 -0
  188. package/src/core/chebyshevEphemeris.js +1 -1
  189. package/src/core/elementsBody.d.ts +8 -4
  190. package/src/core/elementsBody.js +32 -11
  191. package/src/core/elementsGroup.d.ts +27 -0
  192. package/src/core/elementsGroup.js +85 -0
  193. package/src/core/events.d.ts +2 -0
  194. package/src/core/events.js +2 -0
  195. package/src/core/illumination.js +1 -1
  196. package/src/core/listedOrbitGroup.d.ts +2 -0
  197. package/src/core/listedOrbitGroup.js +11 -7
  198. package/src/core/moonListText.d.ts +6 -0
  199. package/src/core/moonListText.js +19 -0
  200. package/src/core/moonTrajectory.js +1 -1
  201. package/src/core/pacing.d.ts +38 -3
  202. package/src/core/pacing.js +55 -4
  203. package/src/core/planetModels.d.ts +1 -1
  204. package/src/core/planetModels.js +3 -3
  205. package/src/core/planetSeries.d.ts +10 -2
  206. package/src/core/planetSeries.js +17 -3
  207. package/src/core/pointGroup.js +1 -1
  208. package/src/core/provenance.d.ts +2 -1
  209. package/src/core/provenance.js +2 -2
  210. package/src/core/referenceCenters.js +5 -5
  211. package/src/core/sampledTrajectory.js +1 -1
  212. package/src/core/scalePolicy.d.ts +1 -0
  213. package/src/core/startView.d.ts +19 -0
  214. package/src/core/startView.js +28 -0
  215. package/src/core/state.d.ts +6 -2
  216. package/src/core/state.js +3 -3
  217. package/src/core/storyPanels.d.ts +63 -0
  218. package/src/core/storyPanels.js +111 -0
  219. package/src/core/sunCentredSources.d.ts +4 -0
  220. package/src/core/sunCentredSources.js +9 -2
  221. package/src/core/timeInput.d.ts +4 -0
  222. package/src/core/timeInput.js +4 -0
  223. package/src/shell/AstraeusShell.d.ts +18 -2
  224. package/src/shell/AstraeusShell.js +53 -14
  225. package/src/shell/AstraeusShell.node.js +53 -14
  226. package/src/shell/Collapsible.d.ts +4 -3
  227. package/src/shell/Collapsible.js +5 -5
  228. package/src/shell/ControlsDrawer.d.ts +1 -1
  229. package/src/shell/ControlsDrawer.js +3 -1
  230. package/src/shell/DisplaySwitches.js +2 -1
  231. package/src/shell/InfoPanel.d.ts +3 -1
  232. package/src/shell/InfoPanel.js +5 -4
  233. package/src/shell/MoonFamilyPanel.js +1 -1
  234. package/src/shell/ObjectControls.d.ts +3 -1
  235. package/src/shell/ObjectControls.js +2 -2
  236. package/src/shell/Sources.d.ts +5 -3
  237. package/src/shell/Sources.js +5 -5
  238. package/src/shell/StoryPanelView.d.ts +4 -3
  239. package/src/shell/StoryPanelView.js +8 -6
  240. package/src/shell/SwitchControl.d.ts +5 -11
  241. package/src/shell/SwitchControl.js +2 -20
  242. package/src/shell/TimelineBar.css +81 -81
  243. package/src/shell/TimelineBar.d.ts +5 -2
  244. package/src/shell/TimelineBar.js +9 -8
  245. package/src/shell/TimelineBar.node.js +9 -8
  246. package/src/shell/TopBar.css +22 -22
  247. package/src/shell/TopBar.d.ts +5 -1
  248. package/src/shell/TopBar.js +2 -2
  249. package/src/shell/TopBar.node.js +2 -2
  250. package/src/shell/bootLoader.d.ts +4 -10
  251. package/src/shell/bootLoader.js +6 -52
  252. package/src/shell/embedded.css +18 -18
  253. package/src/shell/experience.d.ts +1 -1
  254. package/src/shell/moonFamilies.d.ts +2 -6
  255. package/src/shell/moonFamilies.js +2 -18
  256. package/src/shell/phone.css +58 -58
  257. package/src/shell/storyPanels.d.ts +2 -53
  258. package/src/shell/storyPanels.js +1 -106
  259. package/src/shell/style.css +153 -134
  260. package/src/shell/useDrawers.d.ts +3 -2
  261. package/src/shell/useDrawers.js +4 -3
  262. package/src/shell/viewerKeys.d.ts +8 -0
  263. package/src/shell/viewerKeys.js +16 -0
  264. package/src/synthetic/syntheticDefinition.js +20 -24
  265. package/src/synthetic/syntheticJourneyScene.js +3 -3
  266. package/src/synthetic/syntheticProbeDefinition.js +2 -1
  267. package/src/synthetic/syntheticViewsDefinition.d.ts +0 -3
  268. package/src/synthetic/syntheticViewsDefinition.js +10 -16
  269. package/data/moons/jupiter.json +0 -3333
  270. package/data/moons/neptune.json +0 -555
  271. package/data/moons/pluto.json +0 -205
  272. package/data/moons/saturn.json +0 -8267
  273. package/data/moons/uranus.json +0 -887
  274. package/src/app/addressNavigation.d.ts +0 -17
  275. package/src/app/addressNavigation.js +0 -16
  276. package/src/assets/bodies/jupiterMoonCatalogue.d.ts +0 -3
  277. package/src/assets/bodies/jupiterMoonCatalogue.js +0 -4
  278. package/src/assets/bodies/outerPlanetCatalogues.d.ts +0 -7
  279. package/src/assets/bodies/outerPlanetCatalogues.js +0 -8
  280. package/src/assets/bodies/swiftTuttle.d.ts +0 -12
  281. package/src/assets/bodies/swiftTuttle.js +0 -13
  282. package/src/assets/moonCatalogue.d.ts +0 -49
  283. package/src/assets/moonCatalogue.js +0 -80
  284. package/src/core/bodies/outerPlanetData.d.ts +0 -4
  285. package/src/core/bodies/outerPlanetData.js +0 -13
  286. package/src/core/bodies/swiftTuttle.d.ts +0 -46
  287. package/src/core/bodies/swiftTuttle.js +0 -106
@@ -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
- }
@@ -1,4 +1,8 @@
1
+ import type { TimelineEvent } from "../core/events.js";
1
2
  import type { TimeBounds } from "../core/trajectory.js";
3
+ import type { CameraRequest } from "./CameraController.js";
4
+ import type { StartView } from "./viewLink.js";
5
+ import type { LookInput, LookRead } from "../api/look.js";
2
6
  /** The one clock's reading as a host sees it. */
3
7
  export interface ViewerState {
4
8
  readonly timeUtcMs: number;
@@ -9,12 +13,24 @@ export interface ViewerState {
9
13
  readonly auto?: boolean;
10
14
  /** Only in a scene with views: the id of the view showing. */
11
15
  readonly view?: string;
16
+ /** Only in a scene with event zones: the ids of the events whose zone holds the time, among the zones the showing view has. */
17
+ readonly zones?: readonly string[];
18
+ /** The id of the object whose information the viewer has selected; absent when nothing is selected. */
19
+ readonly selected?: string;
20
+ /** The id of the scale showing. */
21
+ readonly scale: string;
22
+ /** The looks in force, every one filled in. */
23
+ readonly look: LookRead;
24
+ /** The display switches the scene placed (those with something to act on), each on or off; empty when it placed none. */
25
+ readonly switches: Readonly<Record<string, boolean>>;
12
26
  }
13
27
  /** Who moved the clock: the clock running (`playback`), a person at the controls (`visitor`) or the host page (`host`). */
14
28
  export type ViewerChangeCause = "playback" | "visitor" | "host";
15
29
  /** What a mounted viewer lets the host do to its one clock. Seeking and rate changes go through the viewer's own handlers, so there is no second clock. */
16
30
  export interface ViewerControl {
17
31
  readonly window: TimeBounds;
32
+ /** The scene's events, which name what a zone is about (`type`, `object`). */
33
+ readonly events: readonly TimelineEvent[];
18
34
  /** The speeds the timeline offers. */
19
35
  readonly rates: readonly number[];
20
36
  read(): ViewerState;
@@ -23,10 +39,36 @@ export interface ViewerControl {
23
39
  readonly paced: boolean;
24
40
  /** A number is a chosen speed; `"auto"` gives the rate back to the scene's pacing. */
25
41
  setRate(rate: number | "auto"): void;
42
+ /** True: the visitor has a play control; false in a scene without a timeline (`setTimeline({ none: true })`), where `setPlaying` is refused. */
43
+ readonly playable: boolean;
44
+ /** Plays or pauses the one clock, as the visitor's play button does. */
45
+ setPlaying(playing: boolean): void;
26
46
  /** The ids of the scene's views, in order; empty without views. */
27
47
  readonly views: readonly string[];
28
48
  /** Switches to the view with this id (one of `views`), as a visitor's button does. */
29
49
  setView(id: string): void;
50
+ /** The ids of the scales the viewer offers, in order. */
51
+ readonly scales: readonly string[];
52
+ /** Switches to the scale with this id (one of `scales`), as a visitor's scale buttons do. */
53
+ setScale(id: string): void;
54
+ /** Sets the whole look (already checked); a look not named takes its default. A live set wins over the page address, which only starts the viewer. */
55
+ setLook(look: LookInput): void;
56
+ /** Turns the display switch `id` (one of the keys of `read().switches`) on or off, as a visitor's switch does. */
57
+ setSwitch(id: string, on: boolean): void;
58
+ /** The host's picker (`Scene.setPicker`): its id, the option values and the one pressed at the start; absent without a picker. */
59
+ readonly picker?: {
60
+ readonly id: string;
61
+ readonly values: readonly string[];
62
+ readonly start: string;
63
+ };
64
+ /** The ids of the objects the showing view shows, which a host may point the camera at. */
65
+ cameraTargets(): readonly string[];
66
+ /** The camera as the viewer's view link writes it; undefined until the scene has drawn its first frame. */
67
+ readCamera(): StartView | undefined;
68
+ /** Selects the object with this id (one of `cameraTargets()`), or clears the selection (`undefined`); `read()` shows it at once. */
69
+ setSelected(id: string | undefined): void;
70
+ /** Asks the scene camera for a follow, focus or pose through its own request path (the same one a view's camera rule uses). */
71
+ setCamera(request: CameraRequest): void;
30
72
  }
31
73
  /** The viewer's side of the host link; the public API supplies the implementation (`ViewerLink`). */
32
74
  export interface ViewerPort {
@@ -36,4 +78,14 @@ export interface ViewerPort {
36
78
  detach(): void;
37
79
  /** The viewer reports the clock's current reading; the link tells the host only when it differs from the last one. */
38
80
  publish(state: ViewerState, cause: ViewerChangeCause): void;
81
+ /** The viewer's selected object changed. `byMove`: the selection followed a move of the clock or the view (a drop, or a view rule's framing target; the cause is whatever last moved them); otherwise the visitor chose it. */
82
+ publishSelection(state: ViewerState, byMove: boolean): void;
83
+ /** The pressed option of the host's picker now (undefined until attached and without a picker). */
84
+ pickNow(): string | undefined;
85
+ /** Calls `watcher` when the pressed option moves (the host's `setPick`, or an attach or detach); returns the function that stops it. */
86
+ watchPick(watcher: () => void): () => void;
87
+ /** A visitor pressed an option of the picker other than the pressed one; the link tells the host's `onPick` listeners. */
88
+ picked(value: string): void;
89
+ /** The scene has drawn its first frame; the link tells the host's `onFirstDraw` listeners. */
90
+ firstDraw(): void;
39
91
  }
@@ -1,5 +1,6 @@
1
1
  /** Where the view choice shows: a button group in the top bar, or a row in the one switch panel opened from the bar (as for the display switches). */
2
2
  export declare const VIEW_PLACES: readonly ["top-bar", "panel"];
3
+ /** Where the view choice shows: "top-bar" or "panel". */
3
4
  export type ViewPlace = (typeof VIEW_PLACES)[number];
4
5
  /** What the camera does when it switches to a view whose members no longer include what it follows or focuses on. `stay`: keep the pose and stop following. `start`: take the view's own framing, else the scene's start. */
5
6
  export type ViewCameraRule = {
@@ -8,8 +9,10 @@ export type ViewCameraRule = {
8
9
  readonly rule: "start";
9
10
  readonly framing?: {
10
11
  readonly follow: string;
12
+ readonly always?: true;
11
13
  } | {
12
14
  readonly focus: string;
15
+ readonly always?: true;
13
16
  };
14
17
  };
15
18
  /** One view, resolved once when the scene is built. The sets hold every id of that kind the view shows (an id no view names is in every view's set); switching only changes which set is read. */
@@ -1,12 +1,11 @@
1
1
  import { CALLISTO, EUROPA, GANYMEDE } from "../../core/bodies/jupiterMoons.js";
2
- import { withPicture } from "../pictures.js";
3
2
  /**
4
3
  * Europa, Ganymede and Callisto as Planetary Explorer draws them (the owner's own project, donor commit 84f8d3e): the donor's 2048x1024
5
4
  * maps copied byte for byte (SHA-256 equal to data/bodies/<moon>/map.json) and the donor materials, lit like Io. Sources and licences are
6
5
  * the donor's public/textures/README.md entries, read 2026-10-18 from the local donor checkout; the USGS pages were not opened.
7
6
  */
8
7
  const LIGHT = Object.freeze({ ambient: 0.08, directional: 1.4 });
9
- const visual = (picture, material, textureYawRad) => withPicture(picture, { kind: "sphere", material: Object.freeze(material), textureYawRad, light: LIGHT });
8
+ const visual = (picture, material, textureYawRad) => Object.freeze({ kind: "sphere", picture, material: Object.freeze(material), textureYawRad, light: LIGHT });
10
9
  export const EUROPA_VISUAL = visual("europa", { color: "#c8b898", roughness: 0.96, metalness: 0 }, Math.PI);
11
10
  /** The donor's Ganymede picture is recentred by 180 degrees against the mosaic (data/bodies/ganymede/map.json textureRecentringDeg), so it is centred on 0 E like Io's and needs no turn (O-039 T-131). Europa and Callisto are centred on 180 E and turn half a revolution. */
12
11
  export const GANYMEDE_VISUAL = visual("ganymede", { color: "#887868", roughness: 0.95, metalness: 0 }, 0);
@@ -1,10 +1,10 @@
1
1
  import { IO } from "../../core/bodies/io.js";
2
- import { withPicture } from "../pictures.js";
3
2
  /** Donor material (src/entities/io.ts), used as the flat colour while the texture loads and as the shell colour. */
4
3
  export const IO_MATERIAL = Object.freeze({ color: "#d4b840", roughness: 0.92, metalness: 0 });
5
4
  /** Io's picture (and its licence) ships in astraeus-data under the name "io". */
6
- export const IO_VISUAL = withPicture("io", {
5
+ export const IO_VISUAL = Object.freeze({
7
6
  kind: "sphere",
7
+ picture: "io",
8
8
  material: IO_MATERIAL,
9
9
  textureYawRad: 0,
10
10
  light: Object.freeze({ ambient: 0.08, directional: 1.4 }),
@@ -1,4 +1,4 @@
1
1
  import type { ListedMoonBody } from "../../core/bodies/listedMoonBodies.js";
2
2
  import type { VisualEntry } from "../catalogue.js";
3
- /** A listed moon's look (O-049 T-211): a grey sphere, or its picture when the picture pack holds one under the moon's id (read when asked for, so a pack registered later still shows). */
3
+ /** A listed moon's look (O-049 T-211): a grey sphere, or its picture when the picture pack holds one under the moon's id (named here, resolved from the pictures the viewer is given). */
4
4
  export declare const listedMoonEntry: ({ definition }: ListedMoonBody) => VisualEntry;
@@ -1,7 +1,6 @@
1
- import { withPicture } from "../pictures.js";
2
1
  const LIGHT = Object.freeze({ ambient: 0.08, directional: 1.4 });
3
- /** A listed moon's look (O-049 T-211): a grey sphere, or its picture when the picture pack holds one under the moon's id (read when asked for, so a pack registered later still shows). */
2
+ /** A listed moon's look (O-049 T-211): a grey sphere, or its picture when the picture pack holds one under the moon's id (named here, resolved from the pictures the viewer is given). */
4
3
  export const listedMoonEntry = ({ definition }) => ({
5
4
  body: definition.id,
6
- visual: withPicture(definition.id, { kind: "sphere", material: Object.freeze({ color: "#a8a8a8", roughness: 0.95, metalness: 0 }), light: LIGHT }),
5
+ visual: Object.freeze({ kind: "sphere", picture: definition.id, material: Object.freeze({ color: "#a8a8a8", roughness: 0.95, metalness: 0 }), light: LIGHT }),
7
6
  });
@@ -1,6 +1,5 @@
1
1
  import { NEPTUNE, PLUTO, SATURN, URANUS } from "../../core/bodies/outerPlanets.js";
2
2
  import { CHARON, DEIMOS, DIONE, ENCELADUS, IAPETUS, MIMAS, PHOBOS, RHEA, TETHYS, TITAN, TRITON } from "../../core/bodies/planetMoons.js";
3
- import { withPicture } from "../pictures.js";
4
3
  const neptuneUrl = new URL("../textures/neptune-2k.jpg", import.meta.url).href;
5
4
  const saturnUrl = new URL("../textures/saturn-2k.jpg", import.meta.url).href;
6
5
  const uranusUrl = new URL("../textures/uranus-2k.jpg", import.meta.url).href;
@@ -30,10 +29,10 @@ const sphere = (url, widthPx, heightPx, licence, color, roughness, textureYawRad
30
29
  textureYawRad,
31
30
  light: LIGHT,
32
31
  });
33
- /** A sphere whose picture (and its licence) ships in astraeus-data and is registered by name; without it the sphere is a flat colour. */
32
+ /** A sphere whose picture (and its licence) ships in astraeus-data and is named by the look; without it in the viewer's pictures the sphere is a flat colour. */
34
33
  /** A planet drawn with its rings: the ring bands (and their recorded sources) belong to the planet's one catalogue definition. */
35
34
  const ringed = (visual, rings) => Object.freeze({ ...visual, rings });
36
- const pictured = (picture, color, roughness, textureYawRad = 0) => withPicture(picture, { kind: "sphere", material: Object.freeze({ color, roughness, metalness: 0 }), textureYawRad, light: LIGHT });
35
+ const pictured = (picture, color, roughness, textureYawRad = 0) => Object.freeze({ kind: "sphere", picture, material: Object.freeze({ color, roughness, metalness: 0 }), textureYawRad, light: LIGHT });
37
36
  /** Phobos and Deimos: grey spheres at their mean radius, with no map (the donor draws them as dots; no map of either is shipped). */
38
37
  const greyBall = (color) => Object.freeze({ kind: "sphere", material: Object.freeze({ color, roughness: 0.97, metalness: 0 }), light: LIGHT });
39
38
  export const SATURN_VISUAL = ringed(sphere(saturnUrl, 2048, 1024, solarSystemScope("Saturn", "Solar System Scope Saturn texture (donor saturn-2k.jpg, derived locally from its saturn-4k.jpg, which is the 4096x2048 file the Solar System Scope download endpoint gave; donor README: License CC BY 4.0 per the Solar System Scope textures page)"), "#d8c090", 0.85), SATURN_RINGS);
@@ -1,6 +1,5 @@
1
1
  import { VENUS } from "../../core/bodies/venus.js";
2
2
  const venus2kUrl = new URL("../textures/venus-2k-balanced.jpg", import.meta.url).href;
3
- import { pictureOf } from "../pictures.js";
4
3
  /** Donor material (planetary-explorer src/entities/venus.ts, commit 84f8d3ee). */
5
4
  export const VENUS_MATERIAL = Object.freeze({ color: "#f6e1b9", emissive: "#4f2e16", emissiveIntensity: 0.04, roughness: 0.9, metalness: 0.04 });
6
5
  /** Donor lighting, same file. */
@@ -21,15 +20,12 @@ export const VENUS_TEXTURE = Object.freeze({
21
20
  widthPx: 2048,
22
21
  heightPx: 1024,
23
22
  licence: VENUS_TEXTURE_LICENCE,
24
- /** The 8k file ships in astraeus-data (name "venus-8k"); without it the 2k file is used at every width. */
25
- get desktop() {
26
- const large = pictureOf("venus-8k");
27
- return large === undefined ? undefined : { url: large.url, widthPx: large.widthPx, heightPx: large.heightPx, minViewportWidth: 768 };
28
- },
29
23
  });
30
24
  export const VENUS_VISUAL = Object.freeze({
31
25
  kind: "sphere",
32
26
  texture: VENUS_TEXTURE,
27
+ /** The 8k file ships in astraeus-data (name "venus-8k"); a viewer without it uses the 2k file at every width. */
28
+ desktopPicture: "venus-8k",
33
29
  material: VENUS_MATERIAL,
34
30
  textureYawRad: 0,
35
31
  light: VENUS_LIGHT,
@@ -10,7 +10,6 @@ import { MERCURY_ENTRY } from "./bodies/mercury.js";
10
10
  import { MOON_ENTRY } from "./bodies/moon.js";
11
11
  import { PLANET_SYSTEM_ENTRIES } from "./bodies/planetSystemMaps.js";
12
12
  import { SUN_ENTRY } from "./bodies/sun.js";
13
- import { SWIFT_TUTTLE_ENTRY } from "./bodies/swiftTuttle.js";
14
13
  import { VENUS_ENTRY } from "./bodies/venus.js";
15
14
  import { textureRightsProblem } from "./licence.js";
16
15
  export class AssetCatalogueError extends RangeError {
@@ -111,4 +110,4 @@ export function rootBodyId(source = catalogue) {
111
110
  return root.id;
112
111
  }
113
112
  /** Explicit, import-built, no discovery. */
114
- export const catalogue = createCatalogue(BUILT_IN_BODIES, BUILT_IN_BINDINGS, [SUN_ENTRY, EARTH_ENTRY, MOON_ENTRY, MERCURY_ENTRY, VENUS_ENTRY, MARS_ENTRY, JUPITER_ENTRY, IO_ENTRY, ...GALILEAN_ENTRIES, ...PLANET_SYSTEM_ENTRIES, SWIFT_TUTTLE_ENTRY]);
113
+ export const catalogue = createCatalogue(BUILT_IN_BODIES, BUILT_IN_BINDINGS, [SUN_ENTRY, EARTH_ENTRY, MOON_ENTRY, MERCURY_ENTRY, VENUS_ENTRY, MARS_ENTRY, JUPITER_ENTRY, IO_ENTRY, ...GALILEAN_ENTRIES, ...PLANET_SYSTEM_ENTRIES]);
@@ -30,7 +30,7 @@ export interface TextureRef {
30
30
  readonly url: string;
31
31
  readonly widthPx: number;
32
32
  readonly heightPx: number;
33
- readonly minViewportWidth: number;
33
+ readonly minViewportWidthPx: number;
34
34
  };
35
35
  /** Rights for public distribution. Required unless the texture is declared local-only. */
36
36
  readonly licence?: AssetLicence;
@@ -39,7 +39,7 @@ export interface TextureRef {
39
39
  /** Why a texture fails the rights rule, or null when it has exactly one of licence and localOnly. */
40
40
  export declare function textureRightsProblem(texture: TextureRef): string | null;
41
41
  /**
42
- * The file to load for a viewport width, as the donor's usePlanetTexture does: the desktop variant from its minimum width up, the base file
42
+ * The file to load for a viewport width in CSS pixels (`window.innerWidth`), as the donor's usePlanetTexture does: the desktop variant from its minimum width up, the base file
43
43
  * below it. No width (no window) means the widest, as in the donor.
44
44
  */
45
- export declare function textureUrlFor(texture: TextureRef, viewportWidth?: number): string;
45
+ export declare function textureUrlFor(texture: TextureRef, viewportWidthPx?: number): string;
@@ -11,10 +11,10 @@ export function textureRightsProblem(texture) {
11
11
  return null;
12
12
  }
13
13
  /**
14
- * The file to load for a viewport width, as the donor's usePlanetTexture does: the desktop variant from its minimum width up, the base file
14
+ * The file to load for a viewport width in CSS pixels (`window.innerWidth`), as the donor's usePlanetTexture does: the desktop variant from its minimum width up, the base file
15
15
  * below it. No width (no window) means the widest, as in the donor.
16
16
  */
17
- export function textureUrlFor(texture, viewportWidth = Number.POSITIVE_INFINITY) {
17
+ export function textureUrlFor(texture, viewportWidthPx = Number.POSITIVE_INFINITY) {
18
18
  const { desktop } = texture;
19
- return desktop !== undefined && viewportWidth >= desktop.minViewportWidth ? desktop.url : texture.url;
19
+ return desktop !== undefined && viewportWidthPx >= desktop.minViewportWidthPx ? desktop.url : texture.url;
20
20
  }
@@ -1,17 +1,20 @@
1
- import type { TextureRef } from "./licence.js";
1
+ import { type TextureRef } from "./licence.js";
2
2
  import type { BodyVisual } from "./visual.js";
3
3
  /**
4
4
  * Pictures that ship in a data package (`astraeus-data`) rather than in the engine, by name: a body id (`titan`), `venus-8k`, `milky-way`.
5
- * Each carries its own licence record, so the credit travels with the file (PROV-02). A picture that was never registered is simply absent:
6
- * the body is drawn as a flat colour, the sky without its Milky Way (DATA-01: nothing is invented to fill the gap).
5
+ * Each carries its own licence record, so the credit travels with the file (PROV-02). A viewer draws only the pictures of the packages passed to it
6
+ * (its definition's `pictures`): a picture that was not passed is simply absent, so the body is drawn as a flat colour and the sky without its
7
+ * Milky Way (DATA-01: nothing is invented to fill the gap), and one viewer's pictures never reach another's.
7
8
  */
8
9
  export type Pictures = Readonly<Record<string, TextureRef>>;
9
- /** Makes a package's pictures known; later calls add to or replace earlier ones of the same name. */
10
- export declare function registerPictures(set: Pictures): void;
11
- export declare function pictureOf(name: string): TextureRef | undefined;
12
- /** The names registered so far, for tests and error messages. */
13
- export declare function registeredPictures(): readonly string[];
14
- /** Forgets every registered picture (tests only). */
15
- export declare function clearPictures(): void;
16
- /** A visual whose `texture` is read from the registered picture when asked for, so it picks the picture up whenever the data package is registered. */
17
- export declare function withPicture(name: string, visual: Omit<BodyVisual, "texture">): BodyVisual;
10
+ /** No pictures: what a viewer given no data package draws with. */
11
+ export declare const NO_PICTURES: Pictures;
12
+ /** The pictures of several packages as one set; a later package's picture of the same name replaces an earlier one's. */
13
+ export declare function mergePictures(sets: readonly (Pictures | undefined)[]): Pictures;
14
+ /** The first picture in the set that fails the rights rule, as "<name> <problem>", or null when every one has exactly one of licence and local-only. */
15
+ export declare function picturesProblem(pictures: Pictures): string | null;
16
+ /**
17
+ * The picture a look draws with, from the pictures this viewer was given: the look's own texture (an engine file) when it has one, else the picture it
18
+ * names. A named large variant (`desktopPicture`) is added to the texture as its desktop file when the viewer holds it. Undefined: flat colour.
19
+ */
20
+ export declare function textureOf(visual: BodyVisual, pictures: Pictures): TextureRef | undefined;
@@ -1,23 +1,27 @@
1
- const book = new Map();
2
- /** Makes a package's pictures known; later calls add to or replace earlier ones of the same name. */
3
- export function registerPictures(set) {
4
- for (const [name, texture] of Object.entries(set))
5
- book.set(name, texture);
1
+ import { textureRightsProblem } from "./licence.js";
2
+ /** No pictures: what a viewer given no data package draws with. */
3
+ export const NO_PICTURES = Object.freeze({});
4
+ /** The pictures of several packages as one set; a later package's picture of the same name replaces an earlier one's. */
5
+ export function mergePictures(sets) {
6
+ return Object.freeze(Object.assign({}, ...sets.map((set) => set ?? {})));
6
7
  }
7
- export function pictureOf(name) {
8
- return book.get(name);
8
+ /** The first picture in the set that fails the rights rule, as "<name> <problem>", or null when every one has exactly one of licence and local-only. */
9
+ export function picturesProblem(pictures) {
10
+ for (const [name, texture] of Object.entries(pictures)) {
11
+ const problem = textureRightsProblem(texture);
12
+ if (problem !== null)
13
+ return `the picture "${name}" ${problem}`;
14
+ }
15
+ return null;
9
16
  }
10
- /** The names registered so far, for tests and error messages. */
11
- export function registeredPictures() {
12
- return [...book.keys()];
13
- }
14
- /** Forgets every registered picture (tests only). */
15
- export function clearPictures() {
16
- book.clear();
17
- }
18
- /** A visual whose `texture` is read from the registered picture when asked for, so it picks the picture up whenever the data package is registered. */
19
- export function withPicture(name, visual) {
20
- const look = { ...visual };
21
- Object.defineProperty(look, "texture", { enumerable: true, get: () => pictureOf(name) });
22
- return Object.freeze(look);
17
+ /**
18
+ * The picture a look draws with, from the pictures this viewer was given: the look's own texture (an engine file) when it has one, else the picture it
19
+ * names. A named large variant (`desktopPicture`) is added to the texture as its desktop file when the viewer holds it. Undefined: flat colour.
20
+ */
21
+ export function textureOf(visual, pictures) {
22
+ const base = visual.texture ?? (visual.picture === undefined ? undefined : pictures[visual.picture]);
23
+ if (base === undefined || visual.desktopPicture === undefined)
24
+ return base;
25
+ const large = pictures[visual.desktopPicture];
26
+ return large === undefined ? base : { ...base, desktop: { url: large.url, widthPx: large.widthPx, heightPx: large.heightPx, minViewportWidthPx: 768 } };
23
27
  }
@@ -1,4 +1,5 @@
1
1
  import type { AssetLicence, TextureRef } from "./licence.js";
2
+ import type { Pictures } from "./pictures.js";
2
3
  /** IAU 1958 galactic frame carried to J2000 (Astropy `galactic.py`, citing Blaauw et al. 1960; read 2026-10-13). */
3
4
  export declare const GALACTIC_NORTH_POLE: Readonly<{
4
5
  raDeg: 192.8594812065348;
@@ -71,12 +72,12 @@ export declare function starAppearance(vMag: number): {
71
72
  readonly brightness: number;
72
73
  };
73
74
  /**
74
- * The picture, one 3840x1920 image (under every GPU's texture limit). The file ships in astraeus-data (name "milky-way");
75
- * without that package the list is empty and no picture is drawn.
75
+ * The picture, one 3840x1920 image (under every GPU's texture limit). The file ships in astraeus-data (name "milky-way"); a viewer
76
+ * that was not given it has an empty list and no picture is drawn.
76
77
  */
77
- export declare const milkyWayTiles: () => readonly TextureRef[];
78
- /** The Gaia EDR3 render (stars removed) as a one-tile galactic picture: the one Milky Way picture. */
79
- export declare const MILKY_WAY_PICTURE: PictureSet;
78
+ export declare const milkyWayTiles: (pictures: Pictures) => readonly TextureRef[];
79
+ /** The Gaia EDR3 render (stars removed) as a one-tile galactic picture, from the pictures this viewer was given: the one Milky Way picture (no tiles without it). */
80
+ export declare const milkyWayPicture: (pictures: Pictures) => PictureSet;
80
81
  export declare const SKY_SOURCES: readonly string[];
81
82
  /** What an experience may say about the sky: all fields optional, default on at full brightness, with the Milky Way picture off. */
82
83
  export interface SkySettings {
package/src/assets/sky.js CHANGED
@@ -1,5 +1,4 @@
1
1
  const hygStarsUrl = new URL("./stars/hyg-v42-naked-eye.json", import.meta.url).href;
2
- import { pictureOf } from "./pictures.js";
3
2
  const RAD = Math.PI / 180;
4
3
  // ---------------------------------------------------------------- galactic frame
5
4
  /** IAU 1958 galactic frame carried to J2000 (Astropy `galactic.py`, citing Blaauw et al. 1960; read 2026-10-13). */
@@ -116,18 +115,16 @@ export function starAppearance(vMag) {
116
115
  }
117
116
  // ---------------------------------------------------------------- sources and the shell item
118
117
  /**
119
- * The picture, one 3840x1920 image (under every GPU's texture limit). The file ships in astraeus-data (name "milky-way");
120
- * without that package the list is empty and no picture is drawn.
118
+ * The picture, one 3840x1920 image (under every GPU's texture limit). The file ships in astraeus-data (name "milky-way"); a viewer
119
+ * that was not given it has an empty list and no picture is drawn.
121
120
  */
122
- export const milkyWayTiles = () => ["milky-way"].flatMap((name) => pictureOf(name) ?? []);
123
- /** The Gaia EDR3 render (stars removed) as a one-tile galactic picture: the one Milky Way picture. */
124
- export const MILKY_WAY_PICTURE = Object.freeze({
121
+ export const milkyWayTiles = (pictures) => ["milky-way"].flatMap((name) => pictures[name] ?? []);
122
+ /** The Gaia EDR3 render (stars removed) as a one-tile galactic picture, from the pictures this viewer was given: the one Milky Way picture (no tiles without it). */
123
+ export const milkyWayPicture = (pictures) => Object.freeze({
125
124
  name: "Milky Way, Gaia EDR3 render without foreground stars (Kevinmloch)",
126
125
  columns: 1,
127
126
  rows: 1,
128
- get tiles() {
129
- return milkyWayTiles().map((tile) => Object.freeze({ column: 0, row: 0, url: tile.url, widthPx: tile.widthPx, heightPx: tile.heightPx }));
130
- },
127
+ tiles: milkyWayTiles(pictures).map((tile) => Object.freeze({ column: 0, row: 0, url: tile.url, widthPx: tile.widthPx, heightPx: tile.heightPx })),
131
128
  credit: "Kevinmloch (bsrender), Gaia EDR3, ESA/Gaia/DPAC",
132
129
  licence: "CC BY-SA 4.0",
133
130
  source: "https://commons.wikimedia.org/wiki/File:Milky_Way_360_equirectangular_rendering_with_foreground_stars_removed.png",
@@ -24,6 +24,10 @@ export interface BodyVisual {
24
24
  readonly kind: "sphere" | "marker";
25
25
  /** Sphere only; absent means a flat colour from the material. */
26
26
  readonly texture?: TextureRef;
27
+ /** Sphere only: the name of a picture the viewer is given by a data package (`titan`), used when there is no `texture`; absent from the viewer's pictures means a flat colour. */
28
+ readonly picture?: string;
29
+ /** Sphere only: the name of a larger picture for wide viewports (`venus-8k`), used as the texture's desktop file when the viewer holds it. */
30
+ readonly desktopPicture?: string;
27
31
  readonly material: BodyMaterialConfig;
28
32
  /** Presentation-only yaw about the body's pole, aligning the image to the body-fixed axes. */
29
33
  readonly textureYawRad?: number;
@@ -5,7 +5,7 @@ export interface AstronomyAdapter {
5
5
  earthPositionFromSunKm(timeUtcMs: number): Float64Array;
6
6
  sunPositionFromEarthKm(timeUtcMs: number): Float64Array;
7
7
  earthFixedToEqjMatrix(timeUtcMs: number): Float64Array;
8
- /** Planet position about the Sun in EQJ km (VSOP87A); throws for a planet the adapter has no model for. */
8
+ /** Planet system barycentre about the Sun in EQJ km (the planet series, JPL Horizons); throws for a planet the adapter has no model for. */
9
9
  planetPositionFromSunKm(planet: PlanetId, timeUtcMs: number): Float64Array;
10
10
  /** Days of terrestrial time since J2000 (JD 2451545.0 TT), the epoch the IAU rotation models count from. */
11
11
  daysSinceJ2000Tt(timeUtcMs: number): number;
@@ -61,7 +61,7 @@ export function createOrbAstronomyAdapter() {
61
61
  const model = planetModels()[planet];
62
62
  const ecliptic = model.xyz(new Date(timeUtcMs));
63
63
  if (ecliptic.coordinate_keywords !== "ecliptic rectangular j2000" || ecliptic.unit_keywords !== "au") {
64
- throw new TypeError("Orb VSOP87A result changed its heliocentric ecliptic-J2000 au contract");
64
+ throw new TypeError("the planet series result changed its heliocentric ecliptic-J2000 au contract (JPL Horizons fit)");
65
65
  }
66
66
  const state = makeState({
67
67
  t: instant,
@@ -71,8 +71,8 @@ export function createOrbAstronomyAdapter() {
71
71
  });
72
72
  const eqj = transform(state, { frame: "equatorial-j2000" });
73
73
  if (eqj.center !== "sun")
74
- throw new TypeError("Orb VSOP87A transform changed its center");
75
- return finiteVector(eqj.r, `${planet} VSOP87A`);
74
+ throw new TypeError("Orb ecliptic-to-equatorial transform of the planet series changed its center");
75
+ return finiteVector(eqj.r, `${planet} Horizons planet series`);
76
76
  },
77
77
  daysSinceJ2000Tt(timeUtcMs) {
78
78
  const [jd1, jd2] = instantAt(timeUtcMs).jd2parts("tt");
@@ -1,9 +1,7 @@
1
1
  import type { CelestialBodyDefinition, StateSourceBinding } from "../body.js";
2
- import type { EccentricSampling } from "../sunCentredSources.js";
3
2
  export { EARTH, EARTH_EPHEMERIS } from "./earth.js";
4
3
  export { MOON, MOON_EPHEMERIS } from "./moon.js";
5
4
  export { SUN } from "./sun.js";
6
- export { SWIFT_TUTTLE, SWIFT_TUTTLE_SAMPLING } from "./swiftTuttle.js";
7
5
  export { IO } from "./io.js";
8
6
  export { CALLISTO, EUROPA, GANYMEDE } from "./jupiterMoons.js";
9
7
  export { JUPITER, JUPITER_EPHEMERIS, JUPITER_ROTATION } from "./jupiter.js";
@@ -15,5 +13,3 @@ export { VENUS, VENUS_EPHEMERIS, VENUS_ROTATION } from "./venus.js";
15
13
  export declare const BUILT_IN_BODIES: readonly CelestialBodyDefinition[];
16
14
  /** One state source per non-root body; the Sun is the root and has none. */
17
15
  export declare const BUILT_IN_BINDINGS: readonly StateSourceBinding[];
18
- /** Built-in bodies whose period and periapsis the catalogue knows (a comet's century-long orbit), so their whole orbit can be drawn from periapsis. */
19
- export declare const BUILT_IN_SAMPLING: Readonly<Record<string, EccentricSampling>>;
@@ -1,22 +1,20 @@
1
1
  import { MoonTrajectory } from "../moonTrajectory.js";
2
- import { createPlanetSunTrajectory } from "./planetTrajectory.js";
2
+ import { planetBinding } from "./planetTrajectory.js";
3
3
  import { createEarthSunTrajectory } from "../sunCentredSources.js";
4
4
  import { EARTH } from "./earth.js";
5
5
  import { MOON } from "./moon.js";
6
6
  import { IO, IO_BINDING } from "./io.js";
7
- import { CALLISTO, EUROPA, GANYMEDE, MAPPED_MOON_BINDINGS } from "./jupiterMoons.js";
7
+ import { CALLISTO, EUROPA, GANYMEDE, JUPITER_MOON_SYSTEM, MAPPED_MOON_BINDINGS } from "./jupiterMoons.js";
8
8
  import { JUPITER, JUPITER_ROTATION } from "./jupiter.js";
9
9
  import { MARS, MARS_ROTATION } from "./mars.js";
10
10
  import { MERCURY, MERCURY_ROTATION } from "./mercury.js";
11
- import { NEPTUNE, NEPTUNE_ROTATION, PLUTO, SATURN, SATURN_ROTATION, URANUS, URANUS_ROTATION } from "./outerPlanets.js";
12
- import { PLANET_MOON_BINDINGS, PLANET_MOON_DEFINITIONS, PLUTO_BINDING } from "./planetMoons.js";
11
+ import { NEPTUNE, NEPTUNE_ROTATION, PLUTO, PLUTO_ROTATION, SATURN, SATURN_ROTATION, URANUS, URANUS_ROTATION } from "./outerPlanets.js";
12
+ import { MARS_MOON_SYSTEM, NEPTUNE_MOON_SYSTEM, PLANET_MOON_BINDINGS, PLANET_MOON_DEFINITIONS, PLUTO_MOON_SYSTEM, SATURN_MOON_SYSTEM, URANUS_MOON_SYSTEM } from "./planetMoons.js";
13
13
  import { SUN } from "./sun.js";
14
- import { SWIFT_TUTTLE, SWIFT_TUTTLE_BINDING, SWIFT_TUTTLE_SAMPLING } from "./swiftTuttle.js";
15
14
  import { VENUS, VENUS_ROTATION } from "./venus.js";
16
15
  export { EARTH, EARTH_EPHEMERIS } from "./earth.js";
17
16
  export { MOON, MOON_EPHEMERIS } from "./moon.js";
18
17
  export { SUN } from "./sun.js";
19
- export { SWIFT_TUTTLE, SWIFT_TUTTLE_SAMPLING } from "./swiftTuttle.js";
20
18
  export { IO } from "./io.js";
21
19
  export { CALLISTO, EUROPA, GANYMEDE } from "./jupiterMoons.js";
22
20
  export { JUPITER, JUPITER_EPHEMERIS, JUPITER_ROTATION } from "./jupiter.js";
@@ -25,23 +23,21 @@ export { MERCURY, MERCURY_EPHEMERIS, MERCURY_ROTATION } from "./mercury.js";
25
23
  export { NEPTUNE, PLUTO, SATURN, URANUS } from "./outerPlanets.js";
26
24
  export { VENUS, VENUS_EPHEMERIS, VENUS_ROTATION } from "./venus.js";
27
25
  /** Every body the engine knows, defined once. */
28
- export const BUILT_IN_BODIES = Object.freeze([SUN, EARTH, MOON, MERCURY, VENUS, MARS, JUPITER, IO, EUROPA, GANYMEDE, CALLISTO, SATURN, URANUS, NEPTUNE, PLUTO, ...PLANET_MOON_DEFINITIONS, SWIFT_TUTTLE]);
26
+ export const BUILT_IN_BODIES = Object.freeze([SUN, EARTH, MOON, MERCURY, VENUS, MARS, JUPITER, IO, EUROPA, GANYMEDE, CALLISTO, SATURN, URANUS, NEPTUNE, PLUTO, ...PLANET_MOON_DEFINITIONS]);
29
27
  /** One state source per non-root body; the Sun is the root and has none. */
30
28
  export const BUILT_IN_BINDINGS = Object.freeze([
31
29
  Object.freeze({ body: EARTH.id, create: createEarthSunTrajectory }),
32
30
  Object.freeze({ body: MOON.id, create: (adapter) => new MoonTrajectory(adapter) }),
33
- Object.freeze({ body: MERCURY.id, create: (adapter) => createPlanetSunTrajectory("mercury", MERCURY_ROTATION, adapter) }),
34
- Object.freeze({ body: VENUS.id, create: (adapter) => createPlanetSunTrajectory("venus", VENUS_ROTATION, adapter) }),
35
- Object.freeze({ body: MARS.id, create: (adapter) => createPlanetSunTrajectory("mars", MARS_ROTATION, adapter) }),
36
- Object.freeze({ body: JUPITER.id, create: (adapter) => createPlanetSunTrajectory("jupiter", JUPITER_ROTATION, adapter) }),
37
- Object.freeze({ body: SATURN.id, create: (adapter) => createPlanetSunTrajectory("saturn", SATURN_ROTATION, adapter) }),
38
- Object.freeze({ body: URANUS.id, create: (adapter) => createPlanetSunTrajectory("uranus", URANUS_ROTATION, adapter) }),
39
- Object.freeze({ body: NEPTUNE.id, create: (adapter) => createPlanetSunTrajectory("neptune", NEPTUNE_ROTATION, adapter) }),
40
- PLUTO_BINDING,
31
+ // Each planet is its system barycentre plus, with its moon system loaded, its own offset from it (O-063 T-290).
32
+ planetBinding("mercury", MERCURY_ROTATION),
33
+ planetBinding("venus", VENUS_ROTATION),
34
+ planetBinding("mars", MARS_ROTATION, MARS_MOON_SYSTEM),
35
+ planetBinding("jupiter", JUPITER_ROTATION, JUPITER_MOON_SYSTEM),
36
+ planetBinding("saturn", SATURN_ROTATION, SATURN_MOON_SYSTEM),
37
+ planetBinding("uranus", URANUS_ROTATION, URANUS_MOON_SYSTEM),
38
+ planetBinding("neptune", NEPTUNE_ROTATION, NEPTUNE_MOON_SYSTEM),
39
+ planetBinding("pluto", PLUTO_ROTATION, PLUTO_MOON_SYSTEM),
41
40
  IO_BINDING,
42
41
  ...MAPPED_MOON_BINDINGS,
43
42
  ...PLANET_MOON_BINDINGS,
44
- SWIFT_TUTTLE_BINDING,
45
43
  ]);
46
- /** Built-in bodies whose period and periapsis the catalogue knows (a comet's century-long orbit), so their whole orbit can be drawn from periapsis. */
47
- export const BUILT_IN_SAMPLING = Object.freeze({ [SWIFT_TUTTLE.id]: SWIFT_TUTTLE_SAMPLING });
@@ -1,6 +1,6 @@
1
1
  import { createProvenance } from "../provenance.js";
2
2
  import { IAU_REPORT, PLANET_VALIDATED_UTC, planetEphemeris, ROTATION_LIMITATION } from "./planetRecords.js";
3
- export const JUPITER_EPHEMERIS = planetEphemeris("Jupiter", "at most 1269 km (0.33 arcsec) from Horizons", ["The largest sampled difference from the Horizons body centre is about 1.3 thousand km, larger than the inner planets because the series is fitted to the planet as a system."]);
3
+ export const JUPITER_EPHEMERIS = planetEphemeris("Jupiter", "599", "DE441 with the Jupiter satellite ephemeris jup365_merged", "With the Jupiter moon package loaded (it covers 1950 to 2029), within 0.5 km of Horizons' Jupiter on 2 January of each year 1972 to 2029 and 0.22 to 0.24 km at the Voyager 1 and 2 closest approaches (O-063 T-290).", "Until the Jupiter moon package is loaded for the date Jupiter sits at its system barycentre, up to 216 km from its centre (measured 1972 to 2044).");
4
4
  /** Jupiter pole and prime meridian from the IAU 2015 report: degrees, pole per Julian century, W per day, from J2000 TDB. */
5
5
  export const JUPITER_ROTATION = Object.freeze({
6
6
  poleRaDeg: [268.056595, -0.006499],