astraeus 0.8.1 → 0.9.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 (131) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +104 -31
  3. package/package.json +1 -1
  4. package/src/api/AstraeusScene.d.ts +1 -1
  5. package/src/api/AstraeusScene.js +4 -1
  6. package/src/api/AstraeusScene.node.js +4 -1
  7. package/src/api/assembleScene.d.ts +2 -0
  8. package/src/api/assembleScene.js +28 -6
  9. package/src/api/cameraRequest.d.ts +15 -0
  10. package/src/api/cameraRequest.js +89 -0
  11. package/src/api/errors.d.ts +9 -1
  12. package/src/api/index.d.ts +6 -3
  13. package/src/api/look.d.ts +49 -0
  14. package/src/api/lookInput.d.ts +1 -1
  15. package/src/api/lookInput.js +6 -1
  16. package/src/api/planBodies.d.ts +2 -1
  17. package/src/api/planBodies.js +6 -1
  18. package/src/api/planCamera.d.ts +35 -7
  19. package/src/api/planCamera.js +94 -11
  20. package/src/api/planPaths.d.ts +2 -0
  21. package/src/api/planPaths.js +14 -9
  22. package/src/api/planSkyFigures.d.ts +22 -0
  23. package/src/api/planSkyFigures.js +145 -0
  24. package/src/api/planStory.d.ts +2 -2
  25. package/src/api/planStory.js +14 -9
  26. package/src/api/planViews.js +1 -1
  27. package/src/api/providerPathTimes.d.ts +10 -0
  28. package/src/api/providerPathTimes.js +109 -0
  29. package/src/api/scene.d.ts +23 -4
  30. package/src/api/scene.js +23 -5
  31. package/src/api/sceneReads.d.ts +21 -2
  32. package/src/api/shownDuring.d.ts +12 -0
  33. package/src/api/shownDuring.js +30 -0
  34. package/src/api/skyFigureInput.d.ts +45 -0
  35. package/src/api/skyFigureInput.js +1 -0
  36. package/src/api/skyTraceInput.d.ts +33 -0
  37. package/src/api/skyTraceInput.js +45 -0
  38. package/src/api/story.d.ts +13 -4
  39. package/src/api/story.js +45 -2
  40. package/src/api/viewerCamera.d.ts +4 -3
  41. package/src/api/viewerCamera.js +10 -32
  42. package/src/api/viewerHandle.d.ts +27 -4
  43. package/src/api/viewerHandle.js +6 -0
  44. package/src/api/viewerLink.d.ts +49 -4
  45. package/src/api/viewerLink.js +25 -0
  46. package/src/api/viewerPanels.d.ts +26 -0
  47. package/src/api/viewerPanels.js +42 -0
  48. package/src/api/viewerSelection.d.ts +1 -1
  49. package/src/api/viewerSelection.js +3 -3
  50. package/src/app/App.js +129 -30
  51. package/src/app/App.node.js +129 -30
  52. package/src/app/AstraeusScene.d.ts +20 -5
  53. package/src/app/AstraeusScene.js +3 -3
  54. package/src/app/CameraController.d.ts +19 -1
  55. package/src/app/CameraController.js +38 -11
  56. package/src/app/DeveloperSettings.d.ts +11 -3
  57. package/src/app/DeveloperSettings.js +13 -3
  58. package/src/app/SceneLabels.d.ts +20 -2
  59. package/src/app/SceneLabels.js +46 -6
  60. package/src/app/SkyFiguresView.d.ts +56 -0
  61. package/src/app/SkyFiguresView.js +242 -0
  62. package/src/app/StoryMarkers.d.ts +2 -2
  63. package/src/app/StoryMarkers.js +2 -2
  64. package/src/app/displaySwitches.d.ts +13 -3
  65. package/src/app/displaySwitches.js +17 -3
  66. package/src/app/experienceDefinition.d.ts +9 -3
  67. package/src/app/experienceDefinition.js +4 -2
  68. package/src/app/labelStyle.d.ts +17 -0
  69. package/src/app/labelStyle.js +13 -0
  70. package/src/app/liveLook.js +8 -0
  71. package/src/app/look.d.ts +9 -5
  72. package/src/app/look.js +11 -0
  73. package/src/app/lookOut.d.ts +32 -0
  74. package/src/app/lookOut.js +50 -0
  75. package/src/app/sceneCamera.d.ts +5 -3
  76. package/src/app/sceneCamera.js +66 -3
  77. package/src/app/sceneContentsHooks.d.ts +2 -1
  78. package/src/app/sceneContentsHooks.js +3 -2
  79. package/src/app/sceneFrame.d.ts +22 -4
  80. package/src/app/sceneFrame.js +67 -22
  81. package/src/app/sceneFraming.d.ts +7 -0
  82. package/src/app/sceneFraming.js +12 -0
  83. package/src/app/sceneHooks.d.ts +2 -0
  84. package/src/app/sceneHooks.js +4 -1
  85. package/src/app/scenePicking.d.ts +20 -0
  86. package/src/app/scenePicking.js +49 -0
  87. package/src/app/scenePointer.d.ts +3 -1
  88. package/src/app/scenePointer.js +3 -2
  89. package/src/app/skyFigures.d.ts +73 -0
  90. package/src/app/skyFigures.js +50 -0
  91. package/src/app/style.css +2 -1
  92. package/src/app/viewHiding.d.ts +10 -1
  93. package/src/app/viewHiding.js +30 -1
  94. package/src/app/viewLink.d.ts +8 -8
  95. package/src/app/viewLink.js +24 -4
  96. package/src/app/viewerPort.d.ts +30 -3
  97. package/src/assets/sky.d.ts +13 -4
  98. package/src/assets/sky.js +33 -8
  99. package/src/assets/stars/hyg-v42-naked-eye.json +1 -1
  100. package/src/core/bodies/moonSystem.js +1 -15
  101. package/src/core/lookValues.d.ts +9 -0
  102. package/src/core/lookValues.js +24 -0
  103. package/src/core/pacing.d.ts +38 -6
  104. package/src/core/pacing.js +141 -21
  105. package/src/core/readBytes.d.ts +1 -0
  106. package/src/core/readBytes.js +15 -0
  107. package/src/core/skyTrace.d.ts +49 -0
  108. package/src/core/skyTrace.js +39 -0
  109. package/src/core/startView.d.ts +39 -0
  110. package/src/core/startView.js +56 -0
  111. package/src/core/storyPanels.d.ts +51 -3
  112. package/src/core/storyPanels.js +52 -12
  113. package/src/shell/AstraeusShell.d.ts +17 -6
  114. package/src/shell/AstraeusShell.js +100 -26
  115. package/src/shell/AstraeusShell.node.js +100 -26
  116. package/src/shell/ObjectControls.js +11 -8
  117. package/src/shell/StoryPanelView.d.ts +12 -3
  118. package/src/shell/StoryPanelView.js +2 -2
  119. package/src/shell/experience.d.ts +31 -0
  120. package/src/shell/experience.js +4 -1
  121. package/src/shell/infoModel.js +9 -1
  122. package/src/shell/objectModel.d.ts +9 -4
  123. package/src/shell/objectModel.js +16 -5
  124. package/src/shell/phone.css +1 -1
  125. package/src/shell/storyPanels.d.ts +1 -1
  126. package/src/shell/storyPanels.js +1 -1
  127. package/src/shell/style.css +9 -1
  128. package/src/shell/topBarIcons.d.ts +1 -0
  129. package/src/shell/topBarIcons.js +1 -0
  130. package/src/shell/useStoryPanels.d.ts +9 -6
  131. package/src/shell/useStoryPanels.js +10 -6
@@ -1,19 +1,22 @@
1
1
  import type { ClockSnapshot } from "../core/clock.js";
2
- import { type StoryPanel } from "./storyPanels.js";
2
+ import { type StoryPanel, type StoryStep } from "./storyPanels.js";
3
3
  export interface StoryPanelSettings {
4
4
  readonly autoOpen: boolean;
5
5
  readonly pauseSeconds: number;
6
6
  }
7
+ /** Who opened or closed the panel: the visitor, the host, playback crossing a panel, or a move (a view switch dropped it; the link names whatever last moved the view). */
8
+ export type PanelCause = "visitor" | "host" | "playback" | "move";
7
9
  /**
8
10
  * Which story panel is open and whether playback is held for it. A panel opens by itself only when forward playback
9
11
  * carries the clock across its time; a seek (slider, Previous, Next, a link) re-bases the crossing check and opens nothing.
10
- * Only one panel is open at a time: the newest replaces the one before.
12
+ * Only one panel is open at a time: the newest replaces the one before. A step never opens from playback; with steps and no moment panel the first step is open at the start.
11
13
  */
12
- export declare function useStoryPanels(panels: readonly StoryPanel[], settings: StoryPanelSettings, snapshot: ClockSnapshot, setPlaying: ((playing: boolean) => void) | undefined): {
13
- openPanel: StoryPanel | null;
14
+ export declare function useStoryPanels(panels: readonly StoryPanel[], steps: readonly StoryStep[], settings: StoryPanelSettings, snapshot: ClockSnapshot, setPlaying: ((playing: boolean) => void) | undefined): {
15
+ openPanel: StoryPanel | StoryStep | null;
14
16
  holding: boolean;
15
- open: (id: string) => void;
16
- close: () => void;
17
+ open: (id: string, by?: PanelCause) => void;
18
+ close: (by?: PanelCause) => void;
17
19
  continuePlayback: () => void;
18
20
  noteSeek: (timeUtcMs: number) => void;
21
+ cause: PanelCause;
19
22
  };
@@ -3,10 +3,11 @@ import { CrossingTracker } from "./storyPanels.js";
3
3
  /**
4
4
  * Which story panel is open and whether playback is held for it. A panel opens by itself only when forward playback
5
5
  * carries the clock across its time; a seek (slider, Previous, Next, a link) re-bases the crossing check and opens nothing.
6
- * Only one panel is open at a time: the newest replaces the one before.
6
+ * Only one panel is open at a time: the newest replaces the one before. A step never opens from playback; with steps and no moment panel the first step is open at the start.
7
7
  */
8
- export function useStoryPanels(panels, settings, snapshot, setPlaying) {
9
- const [openId, setOpenId] = useState(null);
8
+ export function useStoryPanels(panels, steps, settings, snapshot, setPlaying) {
9
+ const [openId, setOpenId] = useState(() => (panels.length === 0 ? steps[0]?.id ?? null : null));
10
+ const cause = useRef("visitor");
10
11
  const [holding, setHolding] = useState(false);
11
12
  const tracker = useRef(new CrossingTracker(snapshot.timeUtcMs));
12
13
  const latest = useRef({ panels, settings, snapshot, setPlaying, holding });
@@ -16,6 +17,7 @@ export function useStoryPanels(panels, settings, snapshot, setPlaying) {
16
17
  const newest = tracker.current.advance(list, shot.timeUtcMs, shot.playing, now.autoOpen);
17
18
  if (newest === null)
18
19
  return;
20
+ cause.current = "playback";
19
21
  setOpenId(newest.id);
20
22
  if (now.pauseSeconds > 0 && control !== undefined) {
21
23
  control(false);
@@ -40,8 +42,9 @@ export function useStoryPanels(panels, settings, snapshot, setPlaying) {
40
42
  tracker.current.rebase(timeUtcMs);
41
43
  setHolding(false);
42
44
  }, []);
43
- const open = useCallback((id) => setOpenId(id), []);
44
- const close = useCallback(() => {
45
+ const open = useCallback((id, by = "visitor") => { cause.current = by; setOpenId(id); }, []);
46
+ const close = useCallback((by = "visitor") => {
47
+ cause.current = by;
45
48
  setOpenId(null);
46
49
  if (latest.current.holding)
47
50
  latest.current.setPlaying?.(true);
@@ -51,5 +54,6 @@ export function useStoryPanels(panels, settings, snapshot, setPlaying) {
51
54
  setHolding(false);
52
55
  latest.current.setPlaying?.(true);
53
56
  }, []);
54
- return { openPanel: panels.find((panel) => panel.id === openId) ?? null, holding, open, close, continuePlayback, noteSeek };
57
+ const openPanel = panels.find((panel) => panel.id === openId) ?? steps.find((step) => step.id === openId) ?? null;
58
+ return { openPanel, holding, open, close, continuePlayback, noteSeek, cause: openPanel === null && openId !== null ? "move" : cause.current };
55
59
  }