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
@@ -0,0 +1,84 @@
1
+ import { validateStartView } from "../core/startView.js";
2
+ import { SceneError } from "./errors.js";
3
+ import { callListeners } from "./listeners.js";
4
+ /** The shortest time between two reports, a little under the viewer's 100 ms tick so a tick is never skipped. */
5
+ const MIN_GAP_MS = 80;
6
+ /** The host link's camera: the pose read and `setCamera`, with its request check. */
7
+ export class ViewerCamera {
8
+ access;
9
+ #listeners = new Set();
10
+ /** The pose last read or reported; undefined until the viewer is attached and has drawn a frame. */
11
+ #last;
12
+ /** When the last report went out (`performance.now()`), so a burst of publishes reports at most about ten times a second. */
13
+ #reportedAt = -Infinity;
14
+ constructor(access) {
15
+ this.access = access;
16
+ }
17
+ /** The viewer attached (the opening pose is read, not reported) or detached (nothing is known). */
18
+ reset() { this.#last = this.access.control()?.readCamera(); }
19
+ clearListeners() { this.#listeners.clear(); }
20
+ /** Calls `listener` with the new pose when the camera's object, angles or distance change (at most about ten times a second); returns the function that stops it. */
21
+ onCameraChange(listener) {
22
+ this.#listeners.add(listener);
23
+ return () => { this.#listeners.delete(listener); };
24
+ }
25
+ /** A viewer publish (its tick, or a host or visitor action): reports the pose when it differs from the last one. */
26
+ publish() {
27
+ const control = this.access.control();
28
+ if (control === undefined)
29
+ return;
30
+ const pose = control.readCamera();
31
+ if (pose === undefined)
32
+ return;
33
+ const last = this.#last;
34
+ if (last === undefined) {
35
+ this.#last = pose;
36
+ return;
37
+ } // the first frame's pose is the opening one
38
+ if (pose.focus === last.focus && pose.azimuthDeg === last.azimuthDeg && pose.elevationDeg === last.elevationDeg && pose.distance === last.distance)
39
+ return;
40
+ const now = performance.now();
41
+ if (now - this.#reportedAt < MIN_GAP_MS)
42
+ return; // the next tick reports it
43
+ this.#last = pose;
44
+ this.#reportedAt = now;
45
+ callListeners(this.#listeners, pose);
46
+ }
47
+ /** The camera pose, or undefined before the viewer is drawn and after it is gone; before its first frame it is the opening camera. */
48
+ get camera() { return this.access.control()?.readCamera(); }
49
+ /**
50
+ * Points the camera: `{ follow: id }` keeps the distance, `{ focus: id }` frames the object, a pose (from `camera`) puts the camera back where it was read,
51
+ * relative to its object. The id must be an object the showing view shows; an unknown or hidden id, or a malformed argument, throws `bad-camera`.
52
+ * Before the viewer is drawn or after it is gone, `not-mounted`. The move eases in as a view's camera rule does.
53
+ */
54
+ setCamera(target) {
55
+ const control = this.access.open("setCamera");
56
+ const request = this.#request(target);
57
+ const id = request.kind === "pose" ? request.view.focus : request.kind === "overview" || request.kind === "hold" ? "" : request.target;
58
+ if (!control.cameraTargets().includes(id)) {
59
+ throw new SceneError("bad-camera", `setCamera: "${id}" is not an object the showing view shows (${control.cameraTargets().join(", ")})`);
60
+ }
61
+ control.setCamera(request);
62
+ }
63
+ #request(target) {
64
+ const bad = (why) => new SceneError("bad-camera", `setCamera: ${why}; give { follow: id }, { focus: id } or a pose from camera`);
65
+ if (typeof target !== "object" || target === null || Array.isArray(target))
66
+ throw bad(`${String(target)} is not an object`);
67
+ const record = target;
68
+ // A pose names its object with `focus` too; its angle and distance fields tell it from `{ focus: id }`.
69
+ const isPose = ["azimuthDeg", "elevationDeg", "distance"].some((key) => key in record) || !("follow" in record || "focus" in record);
70
+ const named = ["follow", "focus"].filter((key) => key in record);
71
+ if (isPose) {
72
+ try {
73
+ return { kind: "pose", view: validateStartView(record, "pose") };
74
+ }
75
+ catch (cause) {
76
+ throw bad(cause instanceof Error ? cause.message : "a malformed pose");
77
+ }
78
+ }
79
+ const id = record[named[0]];
80
+ if (named.length > 1 || Object.keys(record).length > 1 || typeof id !== "string" || id === "")
81
+ throw bad("the target must be exactly one of follow or focus, naming a non-empty id");
82
+ return { kind: named[0], target: id };
83
+ }
84
+ }
@@ -0,0 +1,30 @@
1
+ import type { ViewerChangeCause, ViewerState } from "../app/viewerPort.js";
2
+ import { type TimeInput } from "./time.js";
3
+ import type { LinkAccess, RateSource, ViewerChange } from "./viewerLink.js";
4
+ /** The host link's clock: time, rate and playing reads, `setTime`, `setRate`, the rate source and the `onChange` callbacks. */
5
+ export declare class ViewerClock {
6
+ #private;
7
+ private readonly access;
8
+ constructor(access: LinkAccess);
9
+ /** The viewer attached (its first reading) or detached (undefined): the rate source goes back to the scene's. */
10
+ reset(first: ViewerState | undefined): void;
11
+ clearListeners(): void;
12
+ get rateSource(): RateSource;
13
+ /** The viewer's time (Unix milliseconds UTC), or undefined before it is drawn or after it is gone. */
14
+ get timeUtcMs(): number | undefined;
15
+ get rate(): number | undefined;
16
+ get playing(): boolean | undefined;
17
+ setTime(time: TimeInput): void;
18
+ /**
19
+ * Only a speed the timeline offers is taken, so the speed picker always shows what is running; any other number throws `bad-timeline`.
20
+ * `"auto"` hands the rate back to the scene's pacing (`setTimeline({ pacing })`) and throws `bad-timeline` when the scene has none. The in-between speeds pacing
21
+ * runs at are never set through here; they arrive in `onChange` and `rate`.
22
+ */
23
+ setRate(rate: number | "auto"): void;
24
+ /** Plays or pauses the viewer through its own play handler. Throws `bad-timeline` for a non-boolean and in a scene without a timeline (`setTimeline({ none: true })`), where a visitor has no play control either. */
25
+ setPlaying(playing: boolean): void;
26
+ /** Calls `listener` whenever the time, speed or playing state changes; returns the function that stops it. */
27
+ onChange(listener: (change: ViewerChange) => void): () => void;
28
+ /** Tells the listeners of a change in the reading; returns whether there was one. */
29
+ publish(state: ViewerState, cause: ViewerChangeCause): boolean;
30
+ }
@@ -0,0 +1,85 @@
1
+ import { SceneError } from "./errors.js";
2
+ import { callListeners } from "./listeners.js";
3
+ import { toUtcMs } from "./time.js";
4
+ /** Whether two readings agree on the scale, the looks and the switches (small values, compared by content). */
5
+ function sameLooks(a, b) {
6
+ return a.scale === b.scale && JSON.stringify(a.look) === JSON.stringify(b.look) && JSON.stringify(a.switches) === JSON.stringify(b.switches);
7
+ }
8
+ /** The host link's clock: time, rate and playing reads, `setTime`, `setRate`, the rate source and the `onChange` callbacks. */
9
+ export class ViewerClock {
10
+ access;
11
+ #last;
12
+ #rateSource = "scene";
13
+ #listeners = new Set();
14
+ constructor(access) {
15
+ this.access = access;
16
+ }
17
+ /** The viewer attached (its first reading) or detached (undefined): the rate source goes back to the scene's. */
18
+ reset(first) {
19
+ this.#last = first;
20
+ if (first !== undefined)
21
+ this.#rateSource = "scene";
22
+ }
23
+ clearListeners() { this.#listeners.clear(); }
24
+ get rateSource() { return this.#rateSource; }
25
+ /** The viewer's time (Unix milliseconds UTC), or undefined before it is drawn or after it is gone. */
26
+ get timeUtcMs() { return this.access.control()?.read().timeUtcMs; }
27
+ get rate() { return this.access.control()?.read().rate; }
28
+ get playing() { return this.access.control()?.read().playing; }
29
+ setTime(time) {
30
+ const control = this.access.open("setTime");
31
+ const timeUtcMs = toUtcMs(time, "setTime");
32
+ const { startUtcMs, endUtcMs } = control.window;
33
+ if (timeUtcMs < startUtcMs || timeUtcMs > endUtcMs) {
34
+ throw new SceneError("bad-time", `setTime: ${new Date(timeUtcMs).toISOString()} is outside the timeline (${new Date(startUtcMs).toISOString()} to ${new Date(endUtcMs).toISOString()})`);
35
+ }
36
+ control.seek(timeUtcMs);
37
+ }
38
+ /**
39
+ * Only a speed the timeline offers is taken, so the speed picker always shows what is running; any other number throws `bad-timeline`.
40
+ * `"auto"` hands the rate back to the scene's pacing (`setTimeline({ pacing })`) and throws `bad-timeline` when the scene has none. The in-between speeds pacing
41
+ * runs at are never set through here; they arrive in `onChange` and `rate`.
42
+ */
43
+ setRate(rate) {
44
+ const control = this.access.open("setRate");
45
+ if (rate === "auto") {
46
+ if (!control.paced)
47
+ throw new SceneError("bad-timeline", "setRate: \"auto\" needs a scene with pacing; give setTimeline({ pacing })");
48
+ control.setRate("auto");
49
+ this.#rateSource = "scene";
50
+ return;
51
+ }
52
+ if (!control.rates.includes(rate))
53
+ throw new SceneError("bad-timeline", `setRate: ${String(rate)} is not one of the offered speeds (${control.rates.join(", ")}); offer it with setTimeline({ rates })`);
54
+ control.setRate(rate);
55
+ this.#rateSource = "chosen";
56
+ }
57
+ /** Plays or pauses the viewer through its own play handler. Throws `bad-timeline` for a non-boolean and in a scene without a timeline (`setTimeline({ none: true })`), where a visitor has no play control either. */
58
+ setPlaying(playing) {
59
+ const control = this.access.open("setPlaying");
60
+ if (typeof playing !== "boolean")
61
+ throw new SceneError("bad-timeline", `setPlaying: expected true or false, got ${String(playing)}`);
62
+ if (!control.playable)
63
+ throw new SceneError("bad-timeline", "setPlaying: the scene has no timeline (setTimeline({ none: true })), so there is no play control; a visitor cannot play or pause it either");
64
+ control.setPlaying(playing);
65
+ }
66
+ /** Calls `listener` whenever the time, speed or playing state changes; returns the function that stops it. */
67
+ onChange(listener) {
68
+ this.#listeners.add(listener);
69
+ return () => { this.#listeners.delete(listener); };
70
+ }
71
+ /** Tells the listeners of a change in the reading; returns whether there was one. */
72
+ publish(state, cause) {
73
+ const last = this.#last;
74
+ if (last !== undefined && last.timeUtcMs === state.timeUtcMs && last.rate === state.rate && last.playing === state.playing && last.auto === state.auto && last.view === state.view && sameLooks(last, state))
75
+ return false;
76
+ if (state.auto !== undefined)
77
+ this.#rateSource = state.auto ? "scene" : "chosen";
78
+ else if (cause === "visitor" && last !== undefined && last.rate !== state.rate)
79
+ this.#rateSource = "chosen";
80
+ this.#last = state;
81
+ const change = { timeUtcMs: state.timeUtcMs, rate: state.rate, playing: state.playing, ...(state.view === undefined ? {} : { view: state.view }), scale: state.scale, look: state.look, ...(Object.keys(state.switches).length === 0 ? {} : { switches: state.switches }), cause };
82
+ callListeners(this.#listeners, change);
83
+ return true;
84
+ }
85
+ }
@@ -0,0 +1,14 @@
1
+ /** The host link's first-frame signal: the `onFirstDraw` callbacks and whether the viewer on show has drawn its first frame. */
2
+ export declare class ViewerFirstDraw {
3
+ #private;
4
+ clearListeners(): void;
5
+ /** The viewer is going away (or being rebuilt): the next one has drawn nothing yet. */
6
+ reset(): void;
7
+ /**
8
+ * Calls `listener()` once when a scene's first frame has been drawn; returns the function that stops it. A listener added after that frame is called at once, so one added after `ready` is not left waiting.
9
+ * A viewer rebuild (`AstraeusScene` given a new scene) draws a new first frame, which calls the listeners that are still added again.
10
+ */
11
+ onFirstDraw(listener: () => void): () => void;
12
+ /** The scene drew its first frame. */
13
+ publish(): void;
14
+ }
@@ -0,0 +1,26 @@
1
+ import { callListeners } from "./listeners.js";
2
+ /** The host link's first-frame signal: the `onFirstDraw` callbacks and whether the viewer on show has drawn its first frame. */
3
+ export class ViewerFirstDraw {
4
+ #listeners = new Set();
5
+ #drawn = false;
6
+ clearListeners() { this.#listeners.clear(); }
7
+ /** The viewer is going away (or being rebuilt): the next one has drawn nothing yet. */
8
+ reset() { this.#drawn = false; }
9
+ /**
10
+ * Calls `listener()` once when a scene's first frame has been drawn; returns the function that stops it. A listener added after that frame is called at once, so one added after `ready` is not left waiting.
11
+ * A viewer rebuild (`AstraeusScene` given a new scene) draws a new first frame, which calls the listeners that are still added again.
12
+ */
13
+ onFirstDraw(listener) {
14
+ this.#listeners.add(listener);
15
+ if (this.#drawn)
16
+ callListeners(new Set([listener]), undefined);
17
+ return () => { this.#listeners.delete(listener); };
18
+ }
19
+ /** The scene drew its first frame. */
20
+ publish() {
21
+ if (this.#drawn)
22
+ return;
23
+ this.#drawn = true;
24
+ callListeners(this.#listeners, undefined);
25
+ }
26
+ }
@@ -0,0 +1,79 @@
1
+ import type { LookInput, LookRead } from "./look.js";
2
+ import type { PickChange } from "./pickerInput.js";
3
+ import type { TimeInput } from "./time.js";
4
+ import type { SelectionChange } from "./viewerSelection.js";
5
+ import type { CameraPose, CameraTarget, EventZoneChange, ViewerChange, ViewerLink } from "./viewerLink.js";
6
+ /** Everything a host reads, sets and listens to on a drawn viewer: the handle `mount` returns (as `MountedScene`). Every call before the viewer is drawn or after it is gone throws `not-mounted`; reads are then undefined. */
7
+ export interface ViewerHandle {
8
+ /** The viewer's time in Unix milliseconds UTC; undefined until `ready` has resolved and after `unmount`. */
9
+ readonly timeUtcMs: number | undefined;
10
+ /** The playback speed (simulated seconds per real second); undefined like `timeUtcMs`. */
11
+ readonly rate: number | undefined;
12
+ /** Whether the viewer is playing; undefined until `ready` has resolved and after `unmount`. */
13
+ readonly playing: boolean | undefined;
14
+ /** Plays or pauses the viewer, as its play button does. A non-boolean, or a scene without a timeline (`setTimeline({ none: true })`, which has no play control), throws `bad-timeline`; before `ready` or after `unmount` throws `not-mounted`. `onChange` hears it with `cause: "host"`. */
15
+ setPlaying(playing: boolean): void;
16
+ /** The id of the view showing; undefined until `ready` has resolved, after `unmount`, and in a scene without views. */
17
+ readonly view: string | undefined;
18
+ /** Moves the viewer to `time` (ISO text, a `Date` or Unix milliseconds). Outside the timeline throws `bad-time`; before `ready` or after `unmount` throws `not-mounted`. */
19
+ setTime(time: TimeInput): void;
20
+ /** Sets the playback speed to one of the speeds the timeline offers (`setTimeline({ rates })`); any other number throws `bad-timeline`. `"auto"` gives the speed back to the scene's `setTimeline({ pacing })` (throws `bad-timeline` when it has none). Before `ready` or after `unmount` throws `not-mounted`. */
21
+ setRate(rate: number | "auto"): void;
22
+ /** Switches to the view with this id (`setViews`). An unknown id, or a scene without views, throws `bad-view`; before `ready` or after `unmount` throws `not-mounted`. `onChange` hears it with `cause: "host"`. */
23
+ setView(id: string): void;
24
+ /** The camera as a plain value ({ focus, azimuthDeg, elevationDeg, distance }, the pose a copied view link carries); undefined until `ready` and after `unmount`; before the first frame is drawn it is the opening camera. Keep it and hand it to `setCamera` to put the camera back. */
25
+ readonly camera: CameraPose | undefined;
26
+ /** Points the camera: `{ follow: id }` keeps the distance, `{ focus: id }` frames the object, or a pose from `camera` puts it back where it was read (relative to its object, which a moving object carries along). The object must be one the showing view shows; an unknown or hidden id, or a malformed argument, throws `bad-camera`; before `ready` or after `unmount`, `not-mounted`. The camera eases there. */
27
+ setCamera(target: CameraTarget): void;
28
+ /** The ids of the events whose zone (`withinSeconds` of an event, or a pacing rule) holds the viewer's time now, among the zones the showing view has (an empty list in a scene without event zones); undefined until `ready` and after `unmount`. */
29
+ readonly eventZones: readonly string[] | undefined;
30
+ /**
31
+ * Calls `listener({ event, type?, object?, entered, timeUtcMs, cause })` when playback enters or leaves the zone of an event the showing view has (its `withinSeconds`, or a pacing event rule `setTimeline({ pacing: [{ near }] })`); returns the function that stops it.
32
+ * `cause` is `playback` (the clock ran), `visitor` (timeline or view choice) or `host` (`setTime`, `setView`); overlapping zones report separately. A zone already active when the viewer opens reports `entered` once, with the first report after `ready` (within a tenth of a second), so a listener added right after `await ready` hears it. The engine moves nothing in response: a host composes its own behaviour, for example `setCamera`. No callbacks arrive after `unmount`. A listener that throws is reported to the page (`reportError`) and does not stop the listeners after it.
33
+ */
34
+ onEventZone(listener: (change: EventZoneChange) => void): () => void;
35
+ /** The id of the object whose information the viewer has open (the one the object menu, a click or a view switch chose); undefined until `ready` has resolved, after `unmount`, and when nothing is selected. Read only: the host cannot select. */
36
+ readonly selected: string | undefined;
37
+ /**
38
+ * Calls `listener({ object?, timeUtcMs, cause })` when the selected object changes: `object` is the new id, absent when the selection was dropped (a view switch that no longer shows it, with nothing to take its place).
39
+ * `cause` is `visitor` (the object menu, a click, or a time, speed or view the visitor chose), `host` (a drop caused by the host's own `setTime`, `setRate`, `setPlaying` or `setView`) or `playback` (a drop caused by the clock running); a drop takes the cause `onChange` reported for the move that caused it. The selection the viewer opens with is read from `selected`, not reported. The engine moves nothing in response.
40
+ * No callbacks arrive after `unmount`. A listener that throws is reported to the page (`reportError`) and does not stop the listeners after it. Returns the function that stops it.
41
+ */
42
+ onSelect(listener: (change: SelectionChange) => void): () => void;
43
+ /**
44
+ * Calls `listener(pose)` with the camera as a plain value ({ focus, azimuthDeg, elevationDeg, distance }, what `camera` reads) when it changes: a visitor's drag, zoom or pick, a view's camera rule, or your own `setCamera`
45
+ * (it reports as the camera eases, then stops when the pose settles). At most about ten times a second; an unchanged pose reports nothing, and neither does a camera following a moving object at a fixed pose.
46
+ * The pose the viewer opens with is read from `camera`, not reported. The engine moves nothing in response. No callbacks arrive after `unmount`. A listener that throws is reported to the page (`reportError`) and does not stop the listeners after it. Returns the function that stops it.
47
+ */
48
+ onCameraChange(listener: (camera: CameraPose) => void): () => void;
49
+ /** The looks in force, every one filled in (the scene's `setLook`, the page address and the Developer drawer over the defaults); undefined until `ready` has resolved and after `unmount`. */
50
+ readonly look: LookRead | undefined;
51
+ /** Sets the whole look, checked as `Scene.setLook` checks it (a look not named takes its default; a bad one throws `bad-look`); before `ready` or after `unmount` throws `not-mounted`. It wins over the same look in the page address, which only starts the viewer. Presentation only. `onChange` hears it with `cause: "host"`. */
52
+ setLook(look: LookInput): void;
53
+ /** The id of the scale showing; undefined until `ready` has resolved and after `unmount`. */
54
+ readonly scale: string | undefined;
55
+ /** Switches to one of the scales the viewer offers (`Scene.scales`); any other id throws `bad-scale`; before `ready` or after `unmount`, `not-mounted`. `onChange` hears it with `cause: "host"`. */
56
+ setScale(id: string): void;
57
+ /** The display switches the scene placed (`setSwitches`, wherever it placed them) that have something to act on, each on or off, by id (`orbitLines`, `labels`, `milkyWay`); empty when it placed none; undefined until `ready` has resolved and after `unmount`. */
58
+ readonly switches: Readonly<Record<string, boolean>> | undefined;
59
+ /** Turns a display switch the scene placed on or off, as the visitor's switch does; an id it did not place, or a non-boolean, throws `bad-switch`; before `ready` or after `unmount`, `not-mounted`. `onChange` hears it with `cause: "host"`. */
60
+ setSwitch(id: string, on: boolean): void;
61
+ /**
62
+ * Calls `listener()` once when the scene's first frame has been drawn (not `ready`, which resolves when the clock attaches, a moment before); returns the function that stops it. A listener added after that frame is called at once.
63
+ * A viewer rebuild (`AstraeusScene` given a new scene) draws a new first frame and calls the listeners still added again. A listener that throws is reported to the page (`reportError`) and does not stop the listeners after it. No callbacks arrive after `unmount`.
64
+ */
65
+ onFirstDraw(listener: () => void): () => void;
66
+ /** The value of the option the picker shows pressed (`Scene.setPicker`); undefined until `ready` has resolved, after `unmount`, and in a scene without a picker. */
67
+ readonly pick: string | undefined;
68
+ /** Moves the pressed option to the option with this value, and does nothing else: no signal, no other change. A scene without a picker, or a value that is not one of its options, throws `bad-picker`; before `ready` or after `unmount`, `not-mounted`. */
69
+ setPick(value: string): void;
70
+ /**
71
+ * Calls `listener({ picker, value })` when a visitor presses an option other than the pressed one; returns the function that stops it. The viewer only reports the press: the pressed option stays where it was until the host calls `setPick` (or mounts a new scene),
72
+ * and the viewer never navigates or touches the page address. To keep the clock across a choice, read `timeUtcMs` inside the listener and set it on the next scene (`setTime`). No callbacks arrive after `unmount`. A listener that throws is reported to the page (`reportError`) and does not stop the listeners after it.
73
+ */
74
+ onPick(listener: (change: PickChange) => void): () => void;
75
+ /** Calls `listener` on every change (see `MountOptions.onChange`); returns the function that stops it. No callbacks arrive after `unmount`. A listener that throws is reported to the page (`reportError`) and does not stop the listeners after it. */
76
+ onChange(listener: (change: ViewerChange) => void): () => void;
77
+ }
78
+ /** The handle a host holds for `link`: one object whose reads and calls go straight to the link, so `mount` and `AstraeusScene` hand out the same thing and cannot drift apart. */
79
+ export declare function viewerHandleOf(link: ViewerLink): ViewerHandle;
@@ -0,0 +1,31 @@
1
+ /** The handle a host holds for `link`: one object whose reads and calls go straight to the link, so `mount` and `AstraeusScene` hand out the same thing and cannot drift apart. */
2
+ export function viewerHandleOf(link) {
3
+ return {
4
+ get timeUtcMs() { return link.timeUtcMs; },
5
+ get rate() { return link.rate; },
6
+ get playing() { return link.playing; },
7
+ get view() { return link.view; },
8
+ get camera() { return link.camera; },
9
+ get eventZones() { return link.eventZones; },
10
+ get selected() { return link.selected; },
11
+ get look() { return link.look; },
12
+ get scale() { return link.scale; },
13
+ get switches() { return link.switches; },
14
+ get pick() { return link.pick; },
15
+ setPick: (value) => link.setPick(value),
16
+ onPick: (listener) => link.onPick(listener),
17
+ setLook: (look) => link.setLook(look),
18
+ setScale: (id) => link.setScale(id),
19
+ setSwitch: (id, on) => link.setSwitch(id, on),
20
+ setView: (id) => link.setView(id),
21
+ setCamera: (target) => link.setCamera(target),
22
+ setTime: (time) => link.setTime(time),
23
+ setRate: (rate) => link.setRate(rate),
24
+ setPlaying: (playing) => link.setPlaying(playing),
25
+ onChange: (listener) => link.onChange(listener),
26
+ onFirstDraw: (listener) => link.onFirstDraw(listener),
27
+ onEventZone: (listener) => link.onEventZone(listener),
28
+ onSelect: (listener) => link.onSelect(listener),
29
+ onCameraChange: (listener) => link.onCameraChange(listener),
30
+ };
31
+ }
@@ -1,40 +1,118 @@
1
- import type { ViewerChangeCause, ViewerControl, ViewerPort, ViewerState } from "../app/viewerPort.js";
2
- import { type TimeInput } from "./time.js";
1
+ import type { ViewerChangeCause, ViewerPort, ViewerState } from "../app/viewerPort.js";
2
+ import type { ViewerControl } from "../app/viewerPort.js";
3
+ import type { LookInput, LookRead } from "./look.js";
4
+ import { type SelectionChange } from "./viewerSelection.js";
5
+ import type { PickChange } from "./pickerInput.js";
6
+ import type { TimeInput } from "./time.js";
3
7
  /** What a host is told when the viewer's time, speed or playing state changes. */
4
8
  export interface ViewerChange {
5
9
  /** The viewer's time, Unix milliseconds UTC. */
6
- readonly time: number;
10
+ readonly timeUtcMs: number;
7
11
  /** Simulated seconds per real second. */
8
12
  readonly rate: number;
9
13
  readonly playing: boolean;
10
- /** `playback`: the clock ran on; `visitor`: someone used the timeline; `host`: the host page called `setTime` or `setRate`. */
14
+ /** Only in a scene with views: the id of the view showing. */
15
+ readonly view?: string;
16
+ /** The id of the scale showing. */
17
+ readonly scale: string;
18
+ /** The looks in force, every one filled in (what `look` reads). */
19
+ readonly look: LookRead;
20
+ /** Only in a scene that placed display switches: each placed switch, on or off (what `switches` reads). */
21
+ readonly switches?: Readonly<Record<string, boolean>>;
22
+ /** `playback`: the clock ran on; `visitor`: someone used the timeline, the view choice, the scale, a display switch or the Developer drawer's looks; `host`: the host page called `setTime`, `setRate`, `setPlaying`, `setView`, `setScale`, `setSwitch` or `setLook`. */
11
23
  readonly cause: ViewerChangeCause;
12
24
  }
25
+ /** What a host is told when playback enters or leaves the zone of an event the showing view has. */
26
+ export interface EventZoneChange {
27
+ /** The id of the event whose zone it is. */
28
+ readonly event: string;
29
+ /** The event's `type` and `object`, when it has them. */
30
+ readonly type?: string;
31
+ readonly object?: string;
32
+ /** True on entering the zone, false on leaving it. */
33
+ readonly entered: boolean;
34
+ /** The viewer's time at the report, Unix milliseconds UTC. */
35
+ readonly timeUtcMs: number;
36
+ /** What moved it across: `playback` (the clock ran, or the zone was already active when the viewer opened), `visitor` (the timeline or the view choice), `host` (`setTime` or `setView`). */
37
+ readonly cause: ViewerChangeCause;
38
+ /** What the report is about: `time` (playback crossed the zone, or a seek moved the clock across it) or `view` (a view switch showed or hid the zone). After a `view` leave the view's own camera rule owns the camera, so a host that restores a camera should do it only for `time`. */
39
+ readonly via: "time" | "view";
40
+ }
41
+ /** The camera as a plain value: the object it is centred on and where it stands from it. Read from `MountedScene.camera`, put back with `setCamera`. */
42
+ export interface CameraPose {
43
+ /** The id of the object the camera is centred on (and follows as it moves). */
44
+ readonly focus: string;
45
+ /** Degrees about the up direction, 0 up to 360 (rounded to 0.01). */
46
+ readonly azimuthDeg: number;
47
+ /** Degrees above the orbit plane, within ±89 (rounded to 0.01). */
48
+ readonly elevationDeg: number;
49
+ /** Camera-to-object distance in the scene's scaled units (Earth radii), to five significant figures. */
50
+ readonly distance: number;
51
+ }
52
+ /** What `setCamera` takes: follow an object (keep the distance), focus it (frame it), or put the camera back on a pose from `camera`. */
53
+ export type CameraTarget = {
54
+ readonly follow: string;
55
+ } | {
56
+ readonly focus: string;
57
+ } | CameraPose;
13
58
  /** Where the playback rate comes from. `scene` is the rate the scene opened at; `chosen` is one a visitor or the host picked, which stays until it is released. */
14
59
  export type RateSource = "scene" | "chosen";
60
+ /** What the host-link parts share: the one attached control, read through here so no part keeps a copy of it. */
61
+ export interface LinkAccess {
62
+ /** The attached control, or undefined before the viewer is drawn and after it is gone. */
63
+ control(): ViewerControl | undefined;
64
+ /** The attached control; before the viewer is drawn or after it is gone, throws `not-mounted` naming `what`. */
65
+ open(what: string): ViewerControl;
66
+ }
15
67
  /**
16
68
  * Joins a host page to a mounted viewer's one clock: reads, sets and change callbacks. Created by `mount` and `AstraeusScene`; the viewer attaches
17
- * its clock controls when it opens and detaches when it closes.
69
+ * its clock controls when it opens and detaches when it closes. The clock, views, camera, zones and selection are separate parts it delegates to.
18
70
  */
19
71
  export declare class ViewerLink implements ViewerPort {
20
72
  #private;
21
73
  attach(control: ViewerControl): void;
22
74
  detach(): void;
75
+ /** Takes a closed link back into use: a host effect that was cleaned up and replayed (React StrictMode) before the viewer drew. Waits for the next attach, never for the earlier one. */
76
+ reopen(): void;
23
77
  /** Stops all callbacks for good (the host unmounted). */
24
78
  close(): void;
79
+ /**
80
+ * Resolves once the viewer has attached its clock, so every read and call works from then on; at once when it already has. A `close` before it attached rejects it with
81
+ * `not-mounted` (a closed link is not usable); it never stays pending. A detach (the viewer rebuilt) arms a fresh wait.
82
+ */
83
+ whenAttached(): Promise<void>;
25
84
  get rateSource(): RateSource;
26
- /** The viewer's time (Unix milliseconds UTC), or undefined before it is drawn or after it is gone. */
27
- get time(): number | undefined;
85
+ get timeUtcMs(): number | undefined;
28
86
  get rate(): number | undefined;
29
87
  get playing(): boolean | undefined;
88
+ get eventZones(): readonly string[] | undefined;
89
+ get view(): string | undefined;
90
+ get selected(): string | undefined;
91
+ get camera(): CameraPose | undefined;
92
+ get pick(): string | undefined;
93
+ get look(): LookRead | undefined;
94
+ get scale(): string | undefined;
95
+ get switches(): Readonly<Record<string, boolean>> | undefined;
96
+ setView(id: string): void;
30
97
  setTime(time: TimeInput): void;
31
- /**
32
- * Only a speed the timeline offers is taken, so the speed picker always shows what is running; any other number throws `bad-timeline`.
33
- * `"auto"` hands the rate back to the scene's pacing (`setTimeline({ pacing })`) and throws `bad-timeline` when the scene has none. The in-between speeds pacing
34
- * runs at are never set through here; they arrive in `onChange` and `rate`.
35
- */
36
98
  setRate(rate: number | "auto"): void;
37
- /** Calls `listener` whenever the time, speed or playing state changes; returns the function that stops it. */
99
+ setPlaying(playing: boolean): void;
100
+ setCamera(target: CameraTarget): void;
101
+ setLook(look: LookInput): void;
102
+ setScale(id: string): void;
103
+ setSwitch(id: string, on: boolean): void;
38
104
  onChange(listener: (change: ViewerChange) => void): () => void;
105
+ onEventZone(listener: (change: EventZoneChange) => void): () => void;
106
+ setPick(value: string): void;
107
+ onPick(listener: (change: PickChange) => void): () => void;
108
+ pickNow(): string | undefined;
109
+ watchPick(watcher: () => void): () => void;
110
+ picked(value: string): void;
111
+ onFirstDraw(listener: () => void): () => void;
112
+ firstDraw(): void;
113
+ onSelect(listener: (change: SelectionChange) => void): () => void;
114
+ onCameraChange(listener: (camera: CameraPose) => void): () => void;
39
115
  publish(state: ViewerState, cause: ViewerChangeCause): void;
116
+ /** The selection changed. A drop by time or the view names whatever last moved them (`onChange` names the same), so the cause is never a second opinion. */
117
+ publishSelection(state: ViewerState, byMove: boolean): void;
40
118
  }