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.
- package/CHANGELOG.md +85 -0
- package/README.md +104 -31
- package/package.json +1 -1
- package/src/api/AstraeusScene.d.ts +1 -1
- package/src/api/AstraeusScene.js +4 -1
- package/src/api/AstraeusScene.node.js +4 -1
- package/src/api/assembleScene.d.ts +2 -0
- package/src/api/assembleScene.js +28 -6
- package/src/api/cameraRequest.d.ts +15 -0
- package/src/api/cameraRequest.js +89 -0
- package/src/api/errors.d.ts +9 -1
- package/src/api/index.d.ts +6 -3
- package/src/api/look.d.ts +49 -0
- package/src/api/lookInput.d.ts +1 -1
- package/src/api/lookInput.js +6 -1
- package/src/api/planBodies.d.ts +2 -1
- package/src/api/planBodies.js +6 -1
- package/src/api/planCamera.d.ts +35 -7
- package/src/api/planCamera.js +94 -11
- package/src/api/planPaths.d.ts +2 -0
- package/src/api/planPaths.js +14 -9
- package/src/api/planSkyFigures.d.ts +22 -0
- package/src/api/planSkyFigures.js +145 -0
- package/src/api/planStory.d.ts +2 -2
- package/src/api/planStory.js +14 -9
- package/src/api/planViews.js +1 -1
- package/src/api/providerPathTimes.d.ts +10 -0
- package/src/api/providerPathTimes.js +109 -0
- package/src/api/scene.d.ts +23 -4
- package/src/api/scene.js +23 -5
- package/src/api/sceneReads.d.ts +21 -2
- package/src/api/shownDuring.d.ts +12 -0
- package/src/api/shownDuring.js +30 -0
- package/src/api/skyFigureInput.d.ts +45 -0
- package/src/api/skyFigureInput.js +1 -0
- package/src/api/skyTraceInput.d.ts +33 -0
- package/src/api/skyTraceInput.js +45 -0
- package/src/api/story.d.ts +13 -4
- package/src/api/story.js +45 -2
- package/src/api/viewerCamera.d.ts +4 -3
- package/src/api/viewerCamera.js +10 -32
- package/src/api/viewerHandle.d.ts +27 -4
- package/src/api/viewerHandle.js +6 -0
- package/src/api/viewerLink.d.ts +49 -4
- package/src/api/viewerLink.js +25 -0
- package/src/api/viewerPanels.d.ts +26 -0
- package/src/api/viewerPanels.js +42 -0
- package/src/api/viewerSelection.d.ts +1 -1
- package/src/api/viewerSelection.js +3 -3
- package/src/app/App.js +129 -30
- package/src/app/App.node.js +129 -30
- package/src/app/AstraeusScene.d.ts +20 -5
- package/src/app/AstraeusScene.js +3 -3
- package/src/app/CameraController.d.ts +19 -1
- package/src/app/CameraController.js +38 -11
- package/src/app/DeveloperSettings.d.ts +11 -3
- package/src/app/DeveloperSettings.js +13 -3
- package/src/app/SceneLabels.d.ts +20 -2
- package/src/app/SceneLabels.js +46 -6
- package/src/app/SkyFiguresView.d.ts +56 -0
- package/src/app/SkyFiguresView.js +242 -0
- package/src/app/StoryMarkers.d.ts +2 -2
- package/src/app/StoryMarkers.js +2 -2
- package/src/app/displaySwitches.d.ts +13 -3
- package/src/app/displaySwitches.js +17 -3
- package/src/app/experienceDefinition.d.ts +9 -3
- package/src/app/experienceDefinition.js +4 -2
- package/src/app/labelStyle.d.ts +17 -0
- package/src/app/labelStyle.js +13 -0
- package/src/app/liveLook.js +8 -0
- package/src/app/look.d.ts +9 -5
- package/src/app/look.js +11 -0
- package/src/app/lookOut.d.ts +32 -0
- package/src/app/lookOut.js +50 -0
- package/src/app/sceneCamera.d.ts +5 -3
- package/src/app/sceneCamera.js +66 -3
- package/src/app/sceneContentsHooks.d.ts +2 -1
- package/src/app/sceneContentsHooks.js +3 -2
- package/src/app/sceneFrame.d.ts +22 -4
- package/src/app/sceneFrame.js +67 -22
- package/src/app/sceneFraming.d.ts +7 -0
- package/src/app/sceneFraming.js +12 -0
- package/src/app/sceneHooks.d.ts +2 -0
- package/src/app/sceneHooks.js +4 -1
- package/src/app/scenePicking.d.ts +20 -0
- package/src/app/scenePicking.js +49 -0
- package/src/app/scenePointer.d.ts +3 -1
- package/src/app/scenePointer.js +3 -2
- package/src/app/skyFigures.d.ts +73 -0
- package/src/app/skyFigures.js +50 -0
- package/src/app/style.css +2 -1
- package/src/app/viewHiding.d.ts +10 -1
- package/src/app/viewHiding.js +30 -1
- package/src/app/viewLink.d.ts +8 -8
- package/src/app/viewLink.js +24 -4
- package/src/app/viewerPort.d.ts +30 -3
- package/src/assets/sky.d.ts +13 -4
- package/src/assets/sky.js +33 -8
- package/src/assets/stars/hyg-v42-naked-eye.json +1 -1
- package/src/core/bodies/moonSystem.js +1 -15
- package/src/core/lookValues.d.ts +9 -0
- package/src/core/lookValues.js +24 -0
- package/src/core/pacing.d.ts +38 -6
- package/src/core/pacing.js +141 -21
- package/src/core/readBytes.d.ts +1 -0
- package/src/core/readBytes.js +15 -0
- package/src/core/skyTrace.d.ts +49 -0
- package/src/core/skyTrace.js +39 -0
- package/src/core/startView.d.ts +39 -0
- package/src/core/startView.js +56 -0
- package/src/core/storyPanels.d.ts +51 -3
- package/src/core/storyPanels.js +52 -12
- package/src/shell/AstraeusShell.d.ts +17 -6
- package/src/shell/AstraeusShell.js +100 -26
- package/src/shell/AstraeusShell.node.js +100 -26
- package/src/shell/ObjectControls.js +11 -8
- package/src/shell/StoryPanelView.d.ts +12 -3
- package/src/shell/StoryPanelView.js +2 -2
- package/src/shell/experience.d.ts +31 -0
- package/src/shell/experience.js +4 -1
- package/src/shell/infoModel.js +9 -1
- package/src/shell/objectModel.d.ts +9 -4
- package/src/shell/objectModel.js +16 -5
- package/src/shell/phone.css +1 -1
- package/src/shell/storyPanels.d.ts +1 -1
- package/src/shell/storyPanels.js +1 -1
- package/src/shell/style.css +9 -1
- package/src/shell/topBarIcons.d.ts +1 -0
- package/src/shell/topBarIcons.js +1 -0
- package/src/shell/useStoryPanels.d.ts +9 -6
- package/src/shell/useStoryPanels.js +10 -6
|
@@ -3,16 +3,20 @@ import { lazy, Suspense, useEffect, useId, useRef, useState } from "react";
|
|
|
3
3
|
import { StoryPanelView } from "./StoryPanelView.js";
|
|
4
4
|
import { useDrawers } from "./useDrawers.js";
|
|
5
5
|
import { useStoryPanels } from "./useStoryPanels.js";
|
|
6
|
+
import { neighbourStep } from "./storyPanels.js";
|
|
6
7
|
import { TimelineBar } from "./TimelineBar.node.js";
|
|
8
|
+
import { requestObjectId } from "./experience.js";
|
|
7
9
|
import { InfoPanel } from "./InfoPanel.js";
|
|
8
10
|
import { infoView } from "./infoModel.js";
|
|
9
11
|
import { PanelLoadBoundary } from "../app/PanelLoadBoundary.js";
|
|
10
12
|
import { ControlsDrawer } from "./ControlsDrawer.js";
|
|
11
13
|
import { isEmbedded } from "./embedded.js";
|
|
14
|
+
import { labelStyleVars } from "../app/labelStyle.js";
|
|
12
15
|
import { DEFAULT_PHONE_LAYOUT, phoneLayoutStyle, pickOpensInfo, usePhone } from "./phoneLayout.js";
|
|
13
16
|
import { presetForViewRule } from "./viewCamera.js";
|
|
14
17
|
import { DeveloperToggle, TopBar } from "./TopBar.node.js";
|
|
15
|
-
import {
|
|
18
|
+
import { shownAt } from "../app/viewHiding.js";
|
|
19
|
+
import { availableObjectById, findCameraPreset, firstAvailableObject, focusPresetFor, isObjectAvailable, skyFigureById } from "./objectModel.js";
|
|
16
20
|
/** Keeps `--timeline-space` at the distance from the screen's bottom to the top of the timeline bar, so a phone sheet can sit above it. */
|
|
17
21
|
function useTimelineSpace(root, phone) {
|
|
18
22
|
useEffect(() => {
|
|
@@ -31,8 +35,9 @@ function useTimelineSpace(root, phone) {
|
|
|
31
35
|
/** The object selected when the shell opens: the first one available at the clock time, else the first listed. */
|
|
32
36
|
export function initialObjectId(experience, timeUtcMs) {
|
|
33
37
|
const start = experience.cameraPresets.find((preset) => preset.id === experience.startCameraPresetId)?.request;
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
const startId = start === undefined ? undefined : requestObjectId(start);
|
|
39
|
+
if (startId !== undefined && experience.objects.some((object) => object.id === startId))
|
|
40
|
+
return startId;
|
|
36
41
|
return firstAvailableObject(experience, timeUtcMs)?.id ?? experience.objects[0]?.id ?? "";
|
|
37
42
|
}
|
|
38
43
|
/** The story-panel settings the experience carries itself, used when the app gives none live. */
|
|
@@ -58,8 +63,15 @@ function MoonsSheet({ planetLabel, open, onToggle, onClose, children }) {
|
|
|
58
63
|
}
|
|
59
64
|
/** The serial of a request that is asked again by sending a new one; absent request: undefined. */
|
|
60
65
|
/** Whether the selection has been lost and a fallback must take its place: the object is gone or not available now, unless the host cleared the selection on purpose. */
|
|
61
|
-
function selectionLost(selected, timeUtcMs, clearedByHost) {
|
|
62
|
-
|
|
66
|
+
function selectionLost(selected, timeUtcMs, clearedByHost, isFigure) {
|
|
67
|
+
// A selected sky figure is never lost: it has no availability and no view hides it.
|
|
68
|
+
return !clearedByHost && !isFigure && (selected === undefined || !isObjectAvailable(selected, timeUtcMs));
|
|
69
|
+
}
|
|
70
|
+
/** What a camera preset's object asks of the camera at `timeUtcMs`: "hold" when its shown time has ended or not begun (keep the pose), "overview" when it is gone or unavailable, else undefined. */
|
|
71
|
+
function cameraTargetLoss(target, timeUtcMs) {
|
|
72
|
+
if (target !== undefined && !shownAt(target, timeUtcMs))
|
|
73
|
+
return "hold";
|
|
74
|
+
return target === undefined || !isObjectAvailable(target, timeUtcMs) ? "overview" : undefined;
|
|
63
75
|
}
|
|
64
76
|
function serialOf(request) {
|
|
65
77
|
return request?.serial;
|
|
@@ -78,21 +90,44 @@ function useViewSwitch(viewCamera) {
|
|
|
78
90
|
function panelsOf(storySet) {
|
|
79
91
|
return storySet?.panels ?? [];
|
|
80
92
|
}
|
|
93
|
+
/** Back and Next for the open panel when it is a step: each is absent where there is no neighbour. */
|
|
94
|
+
function stepNavOf(panel, steps, open) {
|
|
95
|
+
if (panel === null || !("step" in panel))
|
|
96
|
+
return undefined;
|
|
97
|
+
const to = (by) => {
|
|
98
|
+
const neighbour = neighbourStep(steps, panel, by);
|
|
99
|
+
return neighbour === undefined ? undefined : () => open(neighbour.id);
|
|
100
|
+
};
|
|
101
|
+
return { number: panel.step, count: steps.length, onBack: to(-1), onNext: to(1) };
|
|
102
|
+
}
|
|
103
|
+
/** A request to open a panel (a marker press or the host's `setPanel`; id "" closes the open one), told with who made it. */
|
|
104
|
+
function applyPanelRequest(story, request) {
|
|
105
|
+
if (request === null || request === undefined)
|
|
106
|
+
return;
|
|
107
|
+
const by = request.host === true ? "host" : "visitor";
|
|
108
|
+
if (request.id === "")
|
|
109
|
+
story.close(by);
|
|
110
|
+
else
|
|
111
|
+
story.open(request.id, by);
|
|
112
|
+
}
|
|
113
|
+
function stepsOf(storySet) {
|
|
114
|
+
return storySet?.steps ?? [];
|
|
115
|
+
}
|
|
81
116
|
function objectLabelOr(experience, objectId, fallback) {
|
|
82
|
-
return experience.objects.find((object) => object.id === objectId)?.label ?? fallback;
|
|
117
|
+
return experience.objects.find((object) => object.id === objectId)?.label ?? skyFigureById(experience, objectId)?.label ?? fallback;
|
|
83
118
|
}
|
|
84
119
|
/** The information panel's content and, for an object, its live measurements. */
|
|
85
120
|
function infoContent(experience, info, selectedObjectId, timeUtcMs, metricsFor) {
|
|
86
121
|
const view = info === null
|
|
87
122
|
? null
|
|
88
123
|
: infoView(experience, info.kind === "object" ? { kind: "object", id: selectedObjectId } : info, timeUtcMs);
|
|
89
|
-
const metrics = view?.target.kind === "object" && metricsFor !== undefined ? metricsFor(view.target.id, timeUtcMs) : [];
|
|
124
|
+
const metrics = view?.target.kind === "object" && metricsFor !== undefined && skyFigureById(experience, view.target.id) === undefined ? metricsFor(view.target.id, timeUtcMs) : [];
|
|
90
125
|
return { view, metrics };
|
|
91
126
|
}
|
|
92
127
|
/** The moon families load on demand: only an experience with `moonFamilies` draws them (I-089). */
|
|
93
128
|
const MoonFamilyPanel = lazy(() => import("./MoonFamilyPanel.js").then((module) => ({ default: module.MoonFamilyPanel })));
|
|
94
129
|
/** Canvas-first layout shared by astronomy experiences. Scene and diagnostics stay app-owned. */
|
|
95
|
-
export function AstraeusShell({ experience, snapshot, developerMode, onDeveloperModeChange, onTogglePlayback, onRateChange, paceAuto, onSeek, onCameraRequest, onCameraHold, hostCameraSet, storySeekNote, onSelectionChange, scaleId, onScaleChange, scaleChoices, switcher, displaySwitches, viewChoice, viewCamera, metricsFor, developerTools, storyPanelSettings, timelineGlow, phoneLayout = DEFAULT_PHONE_LAYOUT, highlightedFamily = null, onHighlightFamily, onSetPlaying, panelRequest, onOpenPanelChange, featureRequest, onOpenFeatureChange, pickRequest, selectRequest, onSelectRequestApplied, children, }) {
|
|
130
|
+
export function AstraeusShell({ experience, snapshot, developerMode, onDeveloperModeChange, onTogglePlayback, onRateChange, paceAuto, onSeek, onCameraRequest, onTurnToFigure, onCameraHold, onTimeShown, hostCameraSet, storySeekNote, onSelectionChange, scaleId, onScaleChange, scaleChoices, switcher, displaySwitches, viewChoice, viewCamera, metricsFor, developerTools, storyPanelSettings, timelineGlow, phoneLayout = DEFAULT_PHONE_LAYOUT, labelStyle, highlightedFamily = null, onHighlightFamily, onSetPlaying, panelRequest, onOpenPanelChange, featureRequest, onOpenFeatureChange, pickRequest, selectRequest, onSelectRequestApplied, children, }) {
|
|
96
131
|
const infoPanelId = `${useId()}-info-panel`;
|
|
97
132
|
const [selectedObjectId, setSelectedObjectId] = useState(() => initialObjectId(experience, snapshot.timeUtcMs));
|
|
98
133
|
const phone = usePhone();
|
|
@@ -112,17 +147,23 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
112
147
|
const [info, setInfo] = useState(null);
|
|
113
148
|
const storySet = experience.storyPanels;
|
|
114
149
|
const storyPanels = panelsOf(storySet);
|
|
115
|
-
const
|
|
150
|
+
const storySteps = stepsOf(storySet);
|
|
151
|
+
const story = useStoryPanels(storyPanels, storySteps, storyPanelSettings ?? ownStorySettings(storySet), snapshot, onSetPlaying);
|
|
116
152
|
if (storySeekNote !== undefined)
|
|
117
153
|
storySeekNote.current = story.noteSeek;
|
|
118
154
|
useEffect(() => () => { if (storySeekNote !== undefined)
|
|
119
155
|
storySeekNote.current = null; }, [storySeekNote]);
|
|
120
156
|
const openPanelId = story.openPanel?.id ?? null;
|
|
121
|
-
|
|
157
|
+
const storyCause = story.cause;
|
|
158
|
+
// Only a change of the open panel is reported; the cause read then is the one that change came with.
|
|
159
|
+
const lastCause = useRef(storyCause);
|
|
160
|
+
lastCause.current = storyCause;
|
|
161
|
+
useEffect(() => { onOpenPanelChange?.(openPanelId, lastCause.current); }, [onOpenPanelChange, openPanelId]);
|
|
162
|
+
const closePanel = () => story.close();
|
|
163
|
+
const stepNav = stepNavOf(story.openPanel, storySteps, story.open);
|
|
122
164
|
const requestedSerial = serialOf(panelRequest);
|
|
123
165
|
useEffect(() => {
|
|
124
|
-
|
|
125
|
-
story.open(panelRequest.id);
|
|
166
|
+
applyPanelRequest(story, panelRequest);
|
|
126
167
|
// Only a new request opens a panel; the open function is stable.
|
|
127
168
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
128
169
|
}, [requestedSerial]);
|
|
@@ -156,7 +197,7 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
156
197
|
if (selectedObjectId !== "")
|
|
157
198
|
hostCleared.current = false;
|
|
158
199
|
const selected = experience.objects.find((object) => object.id === selectedObjectId);
|
|
159
|
-
if (selectionLost(selected, snapshot.timeUtcMs, hostCleared.current && selectedObjectId === "")) {
|
|
200
|
+
if (selectionLost(selected, snapshot.timeUtcMs, hostCleared.current && selectedObjectId === "", skyFigureById(experience, selectedObjectId) !== undefined)) {
|
|
160
201
|
const fallbackId = firstAvailableObject(experience, snapshot.timeUtcMs)?.id ?? "";
|
|
161
202
|
setSelectedObjectId(fallbackId);
|
|
162
203
|
onSelectionChange(fallbackId, "move");
|
|
@@ -164,22 +205,19 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
164
205
|
if (switchRule !== undefined && selected === undefined)
|
|
165
206
|
setInfo((now) => (now?.kind === "object" ? null : now));
|
|
166
207
|
}
|
|
208
|
+
onTimeShown?.(snapshot.timeUtcMs);
|
|
167
209
|
const active = experience.cameraPresets.find((preset) => preset.id === activePresetId);
|
|
168
210
|
const activeRequest = active?.request;
|
|
169
211
|
if (switchRule?.rule === "start" && switchRule.framing?.always === true) {
|
|
170
212
|
applyViewRule(switchRule); // opted in: the view's framing applies on every switch to it
|
|
171
213
|
}
|
|
172
214
|
else if (activeRequest !== undefined && activeRequest.kind !== "overview") {
|
|
173
|
-
const target = experience.objects.find((object) => object.id === activeRequest
|
|
215
|
+
const target = experience.objects.find((object) => object.id === requestObjectId(activeRequest));
|
|
174
216
|
if (switchRule !== undefined && target === undefined) {
|
|
175
217
|
applyViewRule(switchRule);
|
|
176
218
|
}
|
|
177
|
-
else
|
|
178
|
-
|
|
179
|
-
if (overview !== undefined) {
|
|
180
|
-
setActivePresetId(overview.id);
|
|
181
|
-
onCameraRequest(overview.request);
|
|
182
|
-
}
|
|
219
|
+
else {
|
|
220
|
+
loseCameraTarget(cameraTargetLoss(target, snapshot.timeUtcMs));
|
|
183
221
|
}
|
|
184
222
|
}
|
|
185
223
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -192,15 +230,31 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
192
230
|
hostCleared.current = selectRequest.id === "";
|
|
193
231
|
setSelectedObjectId(selectRequest.id);
|
|
194
232
|
// As a visitor's menu choice does: the object's card opens (the camera is left alone); a clear closes it.
|
|
195
|
-
|
|
233
|
+
// A story panel's select (`quiet`) follows the visitor-tap rule: on a phone it selects without opening the card, which would cover the panel's Back and Next.
|
|
234
|
+
const opens = selectRequest.quiet === true ? pickOpensInfo(phone) : true;
|
|
235
|
+
setInfo((now) => (selectRequest.id === "" ? (now?.kind === "object" ? null : now) : opens ? { kind: "object" } : now));
|
|
196
236
|
onSelectRequestApplied?.();
|
|
197
237
|
// Only a new request applies.
|
|
198
238
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
199
239
|
}, [requestedSelectSerial]);
|
|
240
|
+
/** The camera's object is gone or not shown: "hold" keeps the pose and stops following (its shown time ended or has not begun, no jump); "overview" frames the overview. */
|
|
241
|
+
const loseCameraTarget = (loss) => {
|
|
242
|
+
if (loss === "hold") {
|
|
243
|
+
setActivePresetId(null);
|
|
244
|
+
onCameraHold?.();
|
|
245
|
+
}
|
|
246
|
+
else if (loss === "overview") {
|
|
247
|
+
const overview = findCameraPreset(experience, "overview");
|
|
248
|
+
if (overview !== undefined) {
|
|
249
|
+
setActivePresetId(overview.id);
|
|
250
|
+
onCameraRequest(overview.request);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
};
|
|
200
254
|
/** The view's camera rule for a followed or focused object the new view does not show: `stay` keeps the pose and stops following; otherwise the rule's framing is requested. */
|
|
201
255
|
const applyViewRule = (rule) => {
|
|
202
256
|
const asked = presetForViewRule(rule, experience);
|
|
203
|
-
const target = asked === undefined || asked.request.kind === "overview" ? undefined : availableObjectById(experience, asked.request
|
|
257
|
+
const target = asked === undefined || asked.request.kind === "overview" ? undefined : availableObjectById(experience, requestObjectId(asked.request) ?? "", snapshot.timeUtcMs);
|
|
204
258
|
// A framing whose object is not available now falls back to the overview, like any other lost target.
|
|
205
259
|
const preset = asked !== undefined && asked.request.kind !== "overview" && target === undefined ? findCameraPreset(experience, "overview") : asked;
|
|
206
260
|
if (target !== undefined) {
|
|
@@ -227,7 +281,10 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
227
281
|
/** An object tapped or clicked in the scene: the picker's focus; on a wide screen it also opens the card, on a phone it does not (T-138). A tapped body-set member that is no listed object just flies there. */
|
|
228
282
|
const pickObject = (id) => {
|
|
229
283
|
const object = availableObjectById(experience, id, snapshot.timeUtcMs);
|
|
230
|
-
if (
|
|
284
|
+
if (skyFigureById(experience, id) !== undefined) {
|
|
285
|
+
selectFigure(id, pickOpensInfo(phone));
|
|
286
|
+
}
|
|
287
|
+
else if (object !== undefined) {
|
|
231
288
|
activatePreset(focusPresetFor(experience, object));
|
|
232
289
|
if (pickOpensInfo(phone))
|
|
233
290
|
setInfo({ kind: "object" });
|
|
@@ -242,7 +299,18 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
242
299
|
// Only a new request flies; the handler reads the current time and experience.
|
|
243
300
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
244
301
|
}, [requestedPickSerial]);
|
|
302
|
+
/** A sky figure chosen in the object menu or tapped in the scene: it becomes the selection (the one selection path) and its card opens when `open`; the camera is left alone. */
|
|
303
|
+
const selectFigure = (id, open) => {
|
|
304
|
+
setSelectedObjectId(id);
|
|
305
|
+
onSelectionChange(id, "visitor");
|
|
306
|
+
if (open)
|
|
307
|
+
setInfo({ kind: "object" });
|
|
308
|
+
};
|
|
245
309
|
const selectObject = (id) => {
|
|
310
|
+
if (skyFigureById(experience, id) !== undefined) {
|
|
311
|
+
selectFigure(id, true);
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
246
314
|
const object = availableObjectById(experience, id, snapshot.timeUtcMs);
|
|
247
315
|
if (object === undefined)
|
|
248
316
|
return;
|
|
@@ -266,8 +334,9 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
266
334
|
}
|
|
267
335
|
};
|
|
268
336
|
const activatePreset = (preset, atUtcMs = snapshot.timeUtcMs) => {
|
|
269
|
-
|
|
270
|
-
|
|
337
|
+
const objectId = requestObjectId(preset.request);
|
|
338
|
+
if (objectId !== undefined) {
|
|
339
|
+
const target = availableObjectById(experience, objectId, atUtcMs);
|
|
271
340
|
if (target === undefined)
|
|
272
341
|
return;
|
|
273
342
|
setSelectedObjectId(target.id);
|
|
@@ -282,6 +351,11 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
282
351
|
const object = event.object === undefined ? undefined : availableObjectById(experience, event.object, event.timeUtcMs);
|
|
283
352
|
if (object !== undefined)
|
|
284
353
|
activatePreset(focusPresetFor(experience, object), event.timeUtcMs);
|
|
354
|
+
// A sky figure is selected (its card stays as it is) and turned toward only while the camera looks out.
|
|
355
|
+
else if (event.object !== undefined && skyFigureById(experience, event.object) !== undefined) {
|
|
356
|
+
selectFigure(event.object, false);
|
|
357
|
+
onTurnToFigure?.(event.object);
|
|
358
|
+
}
|
|
285
359
|
if (info?.kind === "event")
|
|
286
360
|
setInfo({ kind: "event", id: event.id });
|
|
287
361
|
};
|
|
@@ -302,5 +376,5 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
302
376
|
const selectedLabel = objectLabelOr(experience, selectedObjectId, "Controls");
|
|
303
377
|
const topBar = (_jsx(TopBar, { experience: experience, timeUtcMs: snapshot.timeUtcMs, selectedObjectId: selectedObjectId, activePresetId: activePresetId, onSelectObject: selectObject, onCameraPreset: activatePreset, infoOpen: info?.kind === "object", onToggleInfo: () => setInfo(info?.kind === "object" ? null : { kind: "object" }), infoPanelId: infoPanelId, scaleId: scaleId, onScaleChange: onScaleChange, scaleChoices: scaleChoices, switcher: switcher, displaySwitches: displaySwitches, viewChoice: viewChoice }));
|
|
304
378
|
const moonPanel = experience.moonFamilies === undefined ? null : (_jsx(PanelLoadBoundary, { message: "The moon list could not load. Reload the page to try again.", children: _jsx(Suspense, { fallback: null, children: _jsx(MoonFamilyPanel, { list: experience.moonFamilies, highlightedFamily: highlightedFamily, onHighlight: (id) => onHighlightFamily?.(id), onSelectMoon: chooseMoon }) }) }));
|
|
305
|
-
return (_jsxs("main", { className: "astraeus-shell", ref: root, "data-phone": phone, "data-timeline-hidden": experience.hideTimeline === true, "data-embedded": embedded, style: phoneLayoutStyle(phoneLayout), children: [_jsx("div", { className: "shell-canvas", children: children }), phone && _jsxs(ControlsDrawer, { label: selectedLabel, open: controlsOpen, onOpenChange: openControls, swipeThresholdPx: phoneLayout.swipeThresholdPx, children: [topBar, moonPanel] }), _jsxs("div", { className: "shell-top", children: [!phone && topBar, !phone && moonPanel !== null && _jsx(MoonsSheet, { planetLabel: experience.moonFamilies?.planetLabel, open: moonsOpen, onToggle: toggleMoons, onClose: () => setMoonsOpen(false), children: moonPanel }), view !== null && _jsx(InfoPanel, { view: view, metrics: metrics, onClose: () => setInfo(null), id: infoPanelId })] }), story.openPanel !== null && (_jsx(StoryPanelView, { panel: story.openPanel, holding: story.holding, onClose:
|
|
379
|
+
return (_jsxs("main", { className: "astraeus-shell", ref: root, "data-phone": phone, "data-timeline-hidden": experience.hideTimeline === true, "data-embedded": embedded, style: { ...phoneLayoutStyle(phoneLayout), ...labelStyleVars(labelStyle) }, children: [_jsx("div", { className: "shell-canvas", children: children }), phone && _jsxs(ControlsDrawer, { label: selectedLabel, open: controlsOpen, onOpenChange: openControls, swipeThresholdPx: phoneLayout.swipeThresholdPx, children: [topBar, moonPanel] }), _jsxs("div", { className: "shell-top", children: [!phone && topBar, !phone && moonPanel !== null && _jsx(MoonsSheet, { planetLabel: experience.moonFamilies?.planetLabel, open: moonsOpen, onToggle: toggleMoons, onClose: () => setMoonsOpen(false), children: moonPanel }), view !== null && _jsx(InfoPanel, { view: view, metrics: metrics, onClose: () => setInfo(null), id: infoPanelId })] }), story.openPanel !== null && (_jsx(StoryPanelView, { panel: story.openPanel, holding: story.holding, onClose: closePanel, onContinue: story.continuePlayback, step: stepNav })), _jsx(DeveloperDrawer, { developerMode: developerMode, onDeveloperModeChange: onDeveloperModeChange, children: developerTools }), _jsx(ShellTimeline, { hidden: experience.hideTimeline === true, experience: experience, snapshot: snapshot, onTogglePlayback: onTogglePlayback, onRateChange: onRateChange, paceAuto: paceAuto, onSeek: seek, panels: storyPanels, openPanelId: openPanelId, onPanelOpen: openPanelFromTimeline, onEventSeek: seekToEvent, onEventInfo: (event) => setInfo({ kind: "event", id: event.id }), onWindowSeek: seekToWindow, onWindowInfo: (window) => setInfo({ kind: "window", id: window.id }), glowLook: timelineGlow, infoPanelId: infoPanelId, drawer: phone ? { open: timelineOpen, onOpenChange: openTimeline, swipeThresholdPx: phoneLayout.swipeThresholdPx } : undefined })] }));
|
|
306
380
|
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { findCameraPreset, focusPresetFor, isObjectAvailable, listedObjects, relatedObjects } from "./objectModel.js";
|
|
3
|
-
import { ButtonText, FocusIcon, FollowIcon, InfoIcon, OrbitIcon, OverviewIcon } from "./topBarIcons.js";
|
|
2
|
+
import { findCameraPreset, focusPresetFor, isObjectAvailable, listedFigures, listedObjects, relatedObjects, skyFigureById } from "./objectModel.js";
|
|
3
|
+
import { ButtonText, FocusIcon, LookOutIcon, FollowIcon, InfoIcon, OrbitIcon, OverviewIcon } from "./topBarIcons.js";
|
|
4
4
|
export function ObjectControls({ experience, timeUtcMs, selectedObjectId, activePresetId, onSelectObject, onCameraPreset, infoOpen, onToggleInfo, infoPanelId, }) {
|
|
5
5
|
const selected = experience.objects.find((object) => object.id === selectedObjectId);
|
|
6
|
+
const selectedFigure = skyFigureById(experience, selectedObjectId);
|
|
6
7
|
const selectedAvailable = selected !== undefined && isObjectAvailable(selected, timeUtcMs);
|
|
8
|
+
const infoLabel = selected?.label ?? selectedFigure?.label;
|
|
7
9
|
const overview = findCameraPreset(experience, "overview");
|
|
8
10
|
const focus = selected === undefined ? undefined : focusPresetFor(experience, selected);
|
|
9
11
|
const follow = selected === undefined ? undefined : findCameraPreset(experience, "follow", selected.id);
|
|
12
|
+
const lookOut = selected === undefined ? undefined : findCameraPreset(experience, "lookOut", selected.id);
|
|
10
13
|
const related = selected === undefined ? [] : relatedObjects(experience, selected.id);
|
|
11
|
-
const presetIcon = (preset) => preset.request.kind === "overview" ? _jsx(OverviewIcon, {}) : preset.request.kind === "follow" ? _jsx(FollowIcon, {}) : _jsx(FocusIcon, {});
|
|
12
|
-
const presetText = (preset) => (preset.request.kind === "overview" ? "Overview" : preset.request.kind === "follow" ? "Follow" : "Focus");
|
|
14
|
+
const presetIcon = (preset) => preset.request.kind === "overview" ? _jsx(OverviewIcon, {}) : preset.request.kind === "follow" ? _jsx(FollowIcon, {}) : preset.request.kind === "lookOut" ? _jsx(LookOutIcon, {}) : _jsx(FocusIcon, {});
|
|
15
|
+
const presetText = (preset) => (preset.request.kind === "overview" ? "Overview" : preset.request.kind === "follow" ? "Follow" : preset.request.kind === "lookOut" ? "Look out" : "Focus");
|
|
13
16
|
const renderPreset = (preset) => preset && (_jsxs("button", { type: "button", className: "top-bar-button ui-icon", "data-closes-drawer": "", "aria-label": preset.label, title: preset.label, "aria-pressed": activePresetId === preset.id, "data-camera-preset": preset.id, onClick: () => onCameraPreset(preset), disabled: preset.request.kind !== "overview" && !selectedAvailable, children: [presetIcon(preset), _jsx(ButtonText, { children: presetText(preset) })] }, preset.id));
|
|
14
|
-
return (_jsxs("section", { className: "object-controls", "aria-label": "Object and camera controls", children: [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
return (_jsxs("section", { className: "object-controls", "aria-label": "Object and camera controls", children: [_jsxs("select", { className: "object-picker", "data-closes-drawer": "", "aria-label": "Select object", value: selectedObjectId, onChange: (event) => onSelectObject(event.target.value), children: [listedObjects(experience, selectedObjectId, timeUtcMs).map((object) => {
|
|
18
|
+
const available = isObjectAvailable(object, timeUtcMs);
|
|
19
|
+
return (_jsxs("option", { value: object.id, disabled: !available, "data-available": available, "data-available-from": object.availability?.startUtcMs, "data-available-to": object.availability?.endUtcMs, children: [object.label, available ? "" : " (Unavailable)"] }, object.id));
|
|
20
|
+
}), listedFigures(experience, selectedObjectId).map((figure) => _jsx("option", { value: figure.id, "data-sky-figure": "", children: figure.label }, figure.id))] }), _jsxs("button", { type: "button", className: "top-bar-button ui-icon object-info-toggle", "data-closes-drawer": "", "aria-label": infoLabel === undefined ? "Information" : `Information about ${infoLabel}`, title: infoLabel === undefined ? "Information" : `Information about ${infoLabel}`, "aria-expanded": infoOpen, "aria-controls": infoPanelId, disabled: !selectedAvailable && selectedFigure === undefined, onClick: onToggleInfo, children: [_jsx(InfoIcon, {}), _jsx(ButtonText, { children: "Info" })] }), _jsxs("div", { className: "object-camera-actions", children: [renderPreset(focus), renderPreset(follow), renderPreset(lookOut), renderPreset(overview), related.map((object) => (_jsxs("button", { type: "button", className: "top-bar-button ui-icon object-related", "aria-label": object.label, title: object.label, "data-related-object": object.id, disabled: !isObjectAvailable(object, timeUtcMs), onClick: () => onSelectObject(object.id), children: [_jsx(OrbitIcon, {}), _jsx(ButtonText, { children: object.label })] }, object.id)))] })] }));
|
|
18
21
|
}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import type { ProvenanceSourceType } from "../core/provenance.js";
|
|
2
|
-
import type { StoryPanel } from "./storyPanels.js";
|
|
2
|
+
import type { StoryPanel, StoryStep } from "./storyPanels.js";
|
|
3
3
|
/** A small pill saying how far to trust a panel's facts, after Planetary Explorer's Badge. */
|
|
4
4
|
export declare function StoryBadge({ sourceType }: {
|
|
5
5
|
readonly sourceType: ProvenanceSourceType;
|
|
6
6
|
}): import("react").JSX.Element;
|
|
7
|
+
/** A step's place and its neighbours: `onBack` and `onNext` are absent at the first and last step. */
|
|
8
|
+
export interface StepNav {
|
|
9
|
+
readonly number: number;
|
|
10
|
+
readonly count: number;
|
|
11
|
+
readonly onBack?: (() => void) | undefined;
|
|
12
|
+
readonly onNext?: (() => void) | undefined;
|
|
13
|
+
}
|
|
7
14
|
interface Props {
|
|
8
|
-
readonly panel: StoryPanel;
|
|
15
|
+
readonly panel: StoryPanel | StoryStep;
|
|
16
|
+
/** Present when the panel is a step: shows "Step n of m", Back and Next. */
|
|
17
|
+
readonly step?: StepNav | undefined;
|
|
9
18
|
/** True while playback is held for this panel; shows the Continue button. */
|
|
10
19
|
readonly holding: boolean;
|
|
11
20
|
readonly onClose: () => void;
|
|
@@ -15,5 +24,5 @@ interface Props {
|
|
|
15
24
|
* One story panel: a side panel beside the scene on a wide screen, a bottom sheet with a grab handle on a phone
|
|
16
25
|
* (the stylesheet chooses). Closing, Escape and a swipe down all dismiss it.
|
|
17
26
|
*/
|
|
18
|
-
export declare function StoryPanelView({ panel, holding, onClose, onContinue }: Props): import("react").JSX.Element;
|
|
27
|
+
export declare function StoryPanelView({ panel, step, holding, onClose, onContinue }: Props): import("react").JSX.Element;
|
|
19
28
|
export {};
|
|
@@ -13,7 +13,7 @@ export function StoryBadge({ sourceType }) {
|
|
|
13
13
|
* One story panel: a side panel beside the scene on a wide screen, a bottom sheet with a grab handle on a phone
|
|
14
14
|
* (the stylesheet chooses). Closing, Escape and a swipe down all dismiss it.
|
|
15
15
|
*/
|
|
16
|
-
export function StoryPanelView({ panel, holding, onClose, onContinue }) {
|
|
16
|
+
export function StoryPanelView({ panel, step, holding, onClose, onContinue }) {
|
|
17
17
|
const titleId = `${useId()}-title`;
|
|
18
18
|
const sheet = useRef(null);
|
|
19
19
|
useSwipeToDismiss(sheet, onClose);
|
|
@@ -24,5 +24,5 @@ export function StoryPanelView({ panel, holding, onClose, onContinue }) {
|
|
|
24
24
|
document.addEventListener("keydown", onKey);
|
|
25
25
|
return () => document.removeEventListener("keydown", onKey);
|
|
26
26
|
}, [onClose]);
|
|
27
|
-
return (_jsxs("aside", { className: "story-panel", ref: sheet, role: "dialog", "aria-modal": "false", "aria-labelledby": titleId, "data-panel-id": panel.id, children: [_jsx("div", { className: "sheet-handle", "aria-hidden": "true" }), _jsxs("header", { className: "story-panel-header", children: [_jsx(StoryBadge, { sourceType: panel.provenance.sourceType }), _jsx("button", { type: "button", className: "story-panel-close ui-icon", "aria-label": "Close story panel", onClick: onClose, children: "\u00D7" })] }), _jsx("h2", { id: titleId, children: panel.title }), _jsx("div", { className: "story-panel-body", children: panel.body.map((paragraph) => _jsx("p", { children: paragraph }, paragraph)) }), _jsx(Sources, { sources: panel.provenance.sources, details: panel.details, accuracy: panel.provenance.accuracy, notes: panel.provenance.notes }), holding && _jsx("button", { type: "button", className: "story-panel-continue ui-accent", onClick: onContinue, children: "Continue playback" })] }));
|
|
27
|
+
return (_jsxs("aside", { className: "story-panel", ref: sheet, role: "dialog", "aria-modal": "false", "aria-labelledby": titleId, "data-panel-id": panel.id, children: [_jsx("div", { className: "sheet-handle", "aria-hidden": "true" }), _jsxs("header", { className: "story-panel-header", children: [_jsx(StoryBadge, { sourceType: panel.provenance.sourceType }), _jsx("button", { type: "button", className: "story-panel-close ui-icon", "aria-label": "Close story panel", onClick: onClose, children: "\u00D7" })] }), _jsx("h2", { id: titleId, children: panel.title }), _jsx("div", { className: "story-panel-body", children: panel.body.map((paragraph) => _jsx("p", { children: paragraph }, paragraph)) }), _jsx(Sources, { sources: panel.provenance.sources, details: panel.details, accuracy: panel.provenance.accuracy, notes: panel.provenance.notes }), step !== undefined && (_jsxs("nav", { className: "story-panel-steps", "aria-label": "Story steps", children: [_jsx("button", { type: "button", className: "story-panel-back ui-icon", disabled: step.onBack === undefined, onClick: step.onBack, children: "Back" }), _jsxs("span", { className: "story-panel-step-count", children: ["Step ", step.number, " of ", step.count] }), _jsx("button", { type: "button", className: "story-panel-next ui-accent", disabled: step.onNext === undefined, onClick: step.onNext, children: "Next" })] })), holding && _jsx("button", { type: "button", className: "story-panel-continue ui-accent", onClick: onContinue, children: "Continue playback" })] }));
|
|
28
28
|
}
|
|
@@ -5,12 +5,19 @@ import type { TimeBounds } from "../core/trajectory.js";
|
|
|
5
5
|
import type { BodyFeatureSet } from "./bodyFeatures.js";
|
|
6
6
|
import type { MoonFamilyList } from "./moonFamilies.js";
|
|
7
7
|
import type { StoryPanelSet } from "./storyPanels.js";
|
|
8
|
+
/** When an object is shown, in Unix milliseconds: `startUtcMs <= t < endUtcMs`; an absent end is unbounded. Presentation only (`shownDuring`); not the object's `availability`. */
|
|
9
|
+
export interface ShownSpan {
|
|
10
|
+
readonly startUtcMs?: number;
|
|
11
|
+
readonly endUtcMs?: number;
|
|
12
|
+
}
|
|
8
13
|
export interface ExperienceObject {
|
|
9
14
|
readonly id: string;
|
|
10
15
|
readonly label: string;
|
|
11
16
|
readonly color?: string;
|
|
12
17
|
/** Omit for objects that are always available. */
|
|
13
18
|
readonly availability?: TimeBounds;
|
|
19
|
+
/** Omit to show the object at every time. Outside the span the scene draws none of it (marker, line, label) and it cannot be picked; its state is unchanged. */
|
|
20
|
+
readonly shownDuring?: ShownSpan;
|
|
14
21
|
/** Higher values win when projected labels would overlap. */
|
|
15
22
|
readonly labelPriority?: number;
|
|
16
23
|
/**
|
|
@@ -46,13 +53,35 @@ export type ExperienceCameraRequest = {
|
|
|
46
53
|
} | {
|
|
47
54
|
readonly kind: "focus" | "follow";
|
|
48
55
|
readonly target: string;
|
|
56
|
+
}
|
|
57
|
+
/** Stand inside `body` looking out: `direction` is a unit vector in the J2000 equatorial frame, or an object id to turn toward. */
|
|
58
|
+
| {
|
|
59
|
+
readonly kind: "lookOut";
|
|
60
|
+
readonly body: string;
|
|
61
|
+
readonly direction: readonly [number, number, number] | string;
|
|
62
|
+
readonly fovDeg?: number;
|
|
49
63
|
};
|
|
64
|
+
/** The object a camera request frames or stands in: none for the overview. */
|
|
65
|
+
export declare function requestObjectId(request: ExperienceCameraRequest): string | undefined;
|
|
50
66
|
export interface ExperienceCameraPreset {
|
|
51
67
|
readonly id: string;
|
|
52
68
|
readonly label: string;
|
|
53
69
|
readonly request: ExperienceCameraRequest;
|
|
54
70
|
}
|
|
55
71
|
/** The labels and timeline data a reusable viewer shell needs from an experience. */
|
|
72
|
+
/** What the info card and object menu show for a sky figure (`Scene.addSkyFigures`); the figure's lines and name are drawn by the app, not by the shell. */
|
|
73
|
+
export interface SkyFigureCard {
|
|
74
|
+
readonly id: string;
|
|
75
|
+
readonly label: string;
|
|
76
|
+
readonly description?: string;
|
|
77
|
+
readonly facts?: readonly {
|
|
78
|
+
readonly label: string;
|
|
79
|
+
readonly value: string;
|
|
80
|
+
}[];
|
|
81
|
+
readonly provenance: Provenance;
|
|
82
|
+
/** False leaves it out of the object menu (the menu shows it while it is selected). */
|
|
83
|
+
readonly listed: boolean;
|
|
84
|
+
}
|
|
56
85
|
export interface ExperienceConfig {
|
|
57
86
|
readonly objects: readonly ExperienceObject[];
|
|
58
87
|
readonly cameraPresets: readonly ExperienceCameraPreset[];
|
|
@@ -71,6 +100,8 @@ export interface ExperienceConfig {
|
|
|
71
100
|
readonly moonFamilies?: MoonFamilyList;
|
|
72
101
|
/** Tagged places on bodies (a body package's features): drawn as markers on the body and opened in the information panel. Omit for an experience with none. */
|
|
73
102
|
readonly bodyFeatures?: readonly BodyFeatureSet[];
|
|
103
|
+
/** Sky figures a visitor can select (tap or object menu): their cards and menu flags. Omit for an experience with none. Ids are distinct from every object id. */
|
|
104
|
+
readonly skyFigures?: readonly SkyFigureCard[];
|
|
74
105
|
/** Where the event times come from, shown with every event. */
|
|
75
106
|
readonly eventProvenance?: Provenance;
|
|
76
107
|
/** Provenance of single events by event id; an event listed here shows it instead of `eventProvenance`. */
|
package/src/shell/experience.js
CHANGED
package/src/shell/infoModel.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { provenanceAt, rateAt, spanProvenanceAt } from "../core/timeWindow.js";
|
|
2
2
|
import { findFeature } from "./bodyFeatures.js";
|
|
3
|
+
import { skyFigureById } from "./objectModel.js";
|
|
3
4
|
import { formatUtcTimestamp, formatWindowRate } from "./timelineModel.js";
|
|
4
5
|
/** The badge text for each provenance status. The status is always written, never shown by colour alone. */
|
|
5
6
|
export const PROVENANCE_STATUS = {
|
|
@@ -59,7 +60,7 @@ function featureInfo(experience, target) {
|
|
|
59
60
|
function objectInfo(experience, target, timeUtcMs) {
|
|
60
61
|
const object = experience.objects.find((candidate) => candidate.id === target.id);
|
|
61
62
|
if (object === undefined)
|
|
62
|
-
return
|
|
63
|
+
return skyFigureInfo(experience, target);
|
|
63
64
|
const source = (timeUtcMs === undefined || object.provenanceSpans === undefined ? null : spanProvenanceAt(object.provenanceSpans, timeUtcMs)) ?? object.provenance;
|
|
64
65
|
return {
|
|
65
66
|
target,
|
|
@@ -81,3 +82,10 @@ function eventInfo(experience, target) {
|
|
|
81
82
|
provenance: source === undefined ? null : provenanceView(source),
|
|
82
83
|
};
|
|
83
84
|
}
|
|
85
|
+
/** The card of a selected sky figure: the same card a body has (description, facts, provenance), with the kind as its subtitle. */
|
|
86
|
+
function skyFigureInfo(experience, target) {
|
|
87
|
+
const figure = skyFigureById(experience, target.id);
|
|
88
|
+
if (figure === undefined)
|
|
89
|
+
return null;
|
|
90
|
+
return { target, title: figure.label, ...(figure.description === undefined ? {} : { description: figure.description }), ...(figure.facts === undefined ? {} : { facts: figure.facts }), provenance: provenanceView(figure.provenance) };
|
|
91
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export type CameraMode = "overview" | "focus" | "follow";
|
|
1
|
+
import { type ExperienceCameraPreset, type ExperienceConfig, type ExperienceObject, type SkyFigureCard } from "./experience.js";
|
|
2
|
+
export type CameraMode = "overview" | "focus" | "follow" | "lookOut";
|
|
3
|
+
/** Whether the object can be used at `timeUtcMs`: shown by its `shownDuring` span (the one rule, `shownAt`) and inside its `availability`. */
|
|
3
4
|
export declare function isObjectAvailable(object: ExperienceObject, timeUtcMs: number): boolean;
|
|
4
5
|
export declare function availableObjectById(experience: ExperienceConfig, id: string, timeUtcMs: number): ExperienceObject | undefined;
|
|
5
6
|
export declare function firstAvailableObject(experience: ExperienceConfig, timeUtcMs: number): ExperienceObject | undefined;
|
|
@@ -12,7 +13,11 @@ export declare function focusPresetFor(experience: ExperienceConfig, object: {
|
|
|
12
13
|
readonly label: string;
|
|
13
14
|
}): ExperienceCameraPreset;
|
|
14
15
|
export declare function findCameraPreset(experience: ExperienceConfig, mode: CameraMode, target?: string): ExperienceCameraPreset | undefined;
|
|
15
|
-
/** The objects the Object list offers: the listed ones, and the selected one even when unlisted so the list never shows a blank. */
|
|
16
|
-
export declare function listedObjects(experience: ExperienceConfig, selectedId: string): readonly ExperienceObject[];
|
|
16
|
+
/** The objects the Object list offers: the listed ones shown at `timeUtcMs` (an object outside its `shownDuring` span is absent), and the selected one even when unlisted so the list never shows a blank. */
|
|
17
|
+
export declare function listedObjects(experience: ExperienceConfig, selectedId: string, timeUtcMs?: number): readonly ExperienceObject[];
|
|
17
18
|
/** Unlisted objects that belong to `id` (an orbit line to its body), for the related buttons in the top bar. */
|
|
18
19
|
export declare function relatedObjects(experience: ExperienceConfig, id: string): readonly ExperienceObject[];
|
|
20
|
+
/** The sky figure a selected id names, or undefined (object ids and figure ids never collide: the scene checks it). */
|
|
21
|
+
export declare function skyFigureById(experience: ExperienceConfig, id: string): SkyFigureCard | undefined;
|
|
22
|
+
/** The sky figures the Object list offers, under the rule objects follow (`listed`): the listed ones, and the selected one even when unlisted. */
|
|
23
|
+
export declare function listedFigures(experience: ExperienceConfig, selectedId: string): readonly SkyFigureCard[];
|
package/src/shell/objectModel.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { shownAt } from "../app/viewHiding.js";
|
|
2
|
+
import { requestObjectId } from "./experience.js";
|
|
3
|
+
/** Whether the object can be used at `timeUtcMs`: shown by its `shownDuring` span (the one rule, `shownAt`) and inside its `availability`. */
|
|
1
4
|
export function isObjectAvailable(object, timeUtcMs) {
|
|
2
5
|
const bounds = object.availability;
|
|
3
|
-
return bounds === undefined || (timeUtcMs >= bounds.startUtcMs && timeUtcMs <= bounds.endUtcMs);
|
|
6
|
+
return shownAt(object, timeUtcMs) && (bounds === undefined || (timeUtcMs >= bounds.startUtcMs && timeUtcMs <= bounds.endUtcMs));
|
|
4
7
|
}
|
|
5
8
|
export function availableObjectById(experience, id, timeUtcMs) {
|
|
6
9
|
const object = experience.objects.find((candidate) => candidate.id === id);
|
|
@@ -21,14 +24,22 @@ export function findCameraPreset(experience, mode, target) {
|
|
|
21
24
|
const request = preset.request;
|
|
22
25
|
if (request.kind === "overview")
|
|
23
26
|
return mode === "overview";
|
|
24
|
-
return request.kind === mode && request
|
|
27
|
+
return request.kind === mode && requestObjectId(request) === target;
|
|
25
28
|
});
|
|
26
29
|
}
|
|
27
|
-
/** The objects the Object list offers: the listed ones, and the selected one even when unlisted so the list never shows a blank. */
|
|
28
|
-
export function listedObjects(experience, selectedId) {
|
|
29
|
-
return experience.objects.filter((object) => object.listed !== false || object
|
|
30
|
+
/** The objects the Object list offers: the listed ones shown at `timeUtcMs` (an object outside its `shownDuring` span is absent), and the selected one even when unlisted so the list never shows a blank. */
|
|
31
|
+
export function listedObjects(experience, selectedId, timeUtcMs) {
|
|
32
|
+
return experience.objects.filter((object) => object.id === selectedId || (object.listed !== false && (timeUtcMs === undefined || shownAt(object, timeUtcMs))));
|
|
30
33
|
}
|
|
31
34
|
/** Unlisted objects that belong to `id` (an orbit line to its body), for the related buttons in the top bar. */
|
|
32
35
|
export function relatedObjects(experience, id) {
|
|
33
36
|
return experience.objects.filter((object) => object.listed === false && object.partOf === id);
|
|
34
37
|
}
|
|
38
|
+
/** The sky figure a selected id names, or undefined (object ids and figure ids never collide: the scene checks it). */
|
|
39
|
+
export function skyFigureById(experience, id) {
|
|
40
|
+
return experience.skyFigures?.find((figure) => figure.id === id);
|
|
41
|
+
}
|
|
42
|
+
/** The sky figures the Object list offers, under the rule objects follow (`listed`): the listed ones, and the selected one even when unlisted. */
|
|
43
|
+
export function listedFigures(experience, selectedId) {
|
|
44
|
+
return (experience.skyFigures ?? []).filter((figure) => figure.listed || figure.id === selectedId);
|
|
45
|
+
}
|
package/src/shell/phone.css
CHANGED
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
padding: 9px;
|
|
173
173
|
}
|
|
174
174
|
.astraeus-shell[data-phone="true"] .shell-top { top: 8px; left: 8px; width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: none; }
|
|
175
|
-
.astraeus-shell[data-phone="true"] .astraeus-label { font-size: 12px; }
|
|
175
|
+
.astraeus-shell[data-phone="true"] .astraeus-label { font-size: var(--label-size, 12px); }
|
|
176
176
|
|
|
177
177
|
@media (prefers-reduced-motion: reduce) {
|
|
178
178
|
.astraeus-shell .controls-drawer,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StoryPanel } from "../core/storyPanels.js";
|
|
2
|
-
export { checkPanelPlayback, checkStoryPanel, DEFAULT_PANEL_PAUSE_SECONDS, MAX_PANEL_PAUSE_SECONDS, resolveStoryPanels, StoryPanelError, type PanelLookup, type StoryPanel, type StoryPanelSet, } from "../core/storyPanels.js";
|
|
2
|
+
export { checkPanelPlayback, checkStoryPanel, DEFAULT_PANEL_PAUSE_SECONDS, MAX_PANEL_PAUSE_SECONDS, resolveStoryPanels, StoryPanelError, type PanelLookup, type StoryPanel, type StoryPanelSet, type StoryStep, neighbourStep, } from "../core/storyPanels.js";
|
|
3
3
|
/**
|
|
4
4
|
* The panels forward playback just passed: those with `previousMs < time <= currentMs`, in time order.
|
|
5
5
|
* A backward step or no movement crosses nothing, so loops and rewinds never open a panel.
|
package/src/shell/storyPanels.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { checkPanelPlayback, checkStoryPanel, DEFAULT_PANEL_PAUSE_SECONDS, MAX_PANEL_PAUSE_SECONDS, resolveStoryPanels, StoryPanelError, } from "../core/storyPanels.js";
|
|
1
|
+
export { checkPanelPlayback, checkStoryPanel, DEFAULT_PANEL_PAUSE_SECONDS, MAX_PANEL_PAUSE_SECONDS, resolveStoryPanels, StoryPanelError, neighbourStep, } from "../core/storyPanels.js";
|
|
2
2
|
/**
|
|
3
3
|
* The panels forward playback just passed: those with `previousMs < time <= currentMs`, in time order.
|
|
4
4
|
* A backward step or no movement crosses nothing, so loops and rewinds never open a panel.
|
package/src/shell/style.css
CHANGED
|
@@ -94,7 +94,8 @@
|
|
|
94
94
|
border-radius: 5px;
|
|
95
95
|
background: rgba(13, 13, 13, .84);
|
|
96
96
|
color: var(--label-color, #f0e6da);
|
|
97
|
-
font-
|
|
97
|
+
font-family: var(--label-font, inherit);
|
|
98
|
+
font-size: var(--label-size, 12px);
|
|
98
99
|
line-height: 1.35;
|
|
99
100
|
text-overflow: ellipsis;
|
|
100
101
|
white-space: nowrap;
|
|
@@ -250,6 +251,13 @@
|
|
|
250
251
|
.astraeus-shell .sources-section li + li { margin-top: 3px; }
|
|
251
252
|
.astraeus-shell :where(.story-panel-close) { font-size: 20px; line-height: 1; }
|
|
252
253
|
.astraeus-shell :where(.story-panel-continue) { align-self: flex-start; }
|
|
254
|
+
/* Touch targets: Close, Back, Next and Continue are at least 44 px each way, at 375x667 and 1280x720 alike. */
|
|
255
|
+
.astraeus-shell :where(.story-panel-close, .story-panel-back, .story-panel-next, .story-panel-continue) { min-width: 44px; min-height: 44px; }
|
|
256
|
+
/* Steps: Back and Next stay at the foot of the panel as it scrolls; the count between them shrinks and wraps before either button does. */
|
|
257
|
+
.astraeus-shell .story-panel-steps { position: sticky; bottom: -14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -14px -14px; padding: 6px 14px 14px; background: var(--ui-panel, rgba(13, 13, 13, .94)); }
|
|
258
|
+
.astraeus-shell .story-panel-step-count { flex: 1 1 auto; min-width: 0; text-align: center; color: var(--ui-subtle, #a99e94); font-size: 13px; overflow-wrap: anywhere; }
|
|
259
|
+
.astraeus-shell .story-panel-steps button { flex: 0 0 auto; }
|
|
260
|
+
.astraeus-shell .story-panel-steps button:disabled { opacity: .4; cursor: default; }
|
|
253
261
|
|
|
254
262
|
/* The badge: monospace caps pill, tinted by how far to trust the facts. */
|
|
255
263
|
.astraeus-shell .story-badge {
|
|
@@ -3,6 +3,7 @@ export declare const InfoIcon: () => import("react").JSX.Element;
|
|
|
3
3
|
export declare const FocusIcon: () => import("react").JSX.Element;
|
|
4
4
|
export declare const OverviewIcon: () => import("react").JSX.Element;
|
|
5
5
|
export declare const FollowIcon: () => import("react").JSX.Element;
|
|
6
|
+
export declare const LookOutIcon: () => import("react").JSX.Element;
|
|
6
7
|
export declare const OrbitIcon: () => import("react").JSX.Element;
|
|
7
8
|
export declare const SwitchesIcon: () => import("react").JSX.Element;
|
|
8
9
|
export declare const ScaleIcon: () => import("react").JSX.Element;
|
package/src/shell/topBarIcons.js
CHANGED
|
@@ -7,6 +7,7 @@ export const InfoIcon = () => _jsxs(Icon, { children: [_jsx("circle", { cx: "12"
|
|
|
7
7
|
export const FocusIcon = () => _jsxs(Icon, { children: [_jsx("circle", { cx: "10.5", cy: "10.5", r: "6.5" }), _jsx("path", { d: "M15.5 15.5 21 21" })] });
|
|
8
8
|
export const OverviewIcon = () => _jsx(Icon, { children: _jsx("path", { d: "M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5" }) });
|
|
9
9
|
export const FollowIcon = () => _jsxs(Icon, { children: [_jsx("circle", { cx: "12", cy: "12", r: "4" }), _jsx("path", { d: "M12 3v4M12 17v4M3 12h4M17 12h4" })] });
|
|
10
|
+
export const LookOutIcon = () => _jsxs(Icon, { children: [_jsx("path", { d: "M3 17h18" }), _jsx("path", { d: "M12 14V5M8.5 8.5 12 5l3.5 3.5" })] });
|
|
10
11
|
export const OrbitIcon = () => _jsxs(Icon, { children: [_jsx("ellipse", { cx: "12", cy: "12", rx: "9", ry: "5", transform: "rotate(-20 12 12)" }), _jsx("circle", { cx: "12", cy: "12", r: "1.4", fill: "currentColor" })] });
|
|
11
12
|
export const SwitchesIcon = () => _jsxs(Icon, { children: [_jsx("path", { d: "M4 8h10M18 8h2M4 16h2M10 16h10" }), _jsx("circle", { cx: "16", cy: "8", r: "2" }), _jsx("circle", { cx: "8", cy: "16", r: "2" })] });
|
|
12
13
|
export const ScaleIcon = () => _jsxs(Icon, { size: 16, children: [_jsx("circle", { cx: "7", cy: "12", r: "2.5" }), _jsx("circle", { cx: "16", cy: "12", r: "5.5" })] });
|