astraeus 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +189 -0
- package/README.md +202 -38
- package/data/ephemerides/planets/planets.json +1 -1
- package/package.json +5 -4
- package/src/api/AstraeusScene.d.ts +21 -5
- package/src/api/AstraeusScene.js +34 -10
- package/src/api/AstraeusScene.node.js +34 -10
- package/src/api/assembleScene.d.ts +36 -0
- package/src/api/assembleScene.js +175 -0
- package/src/api/bodySetChecks.d.ts +10 -0
- package/src/api/bodySetChecks.js +117 -0
- package/src/api/bodySetInput.d.ts +81 -0
- package/src/api/bodySetInput.js +1 -0
- package/src/api/containingBlock.d.ts +6 -0
- package/src/api/containingBlock.js +16 -0
- package/src/api/data.d.ts +17 -5
- package/src/api/data.js +28 -10
- package/src/api/definitionOf.d.ts +16 -0
- package/src/api/definitionOf.js +20 -0
- package/src/api/errors.d.ts +63 -1
- package/src/api/frozenCopy.d.ts +6 -0
- package/src/api/frozenCopy.js +26 -0
- package/src/api/group.d.ts +8 -2
- package/src/api/group.js +24 -5
- package/src/api/index.d.ts +18 -7
- package/src/api/index.js +2 -2
- package/src/api/index.node.js +2 -2
- package/src/api/listeners.d.ts +5 -0
- package/src/api/listeners.js +25 -0
- package/src/api/look.d.ts +47 -0
- package/src/api/look.js +1 -0
- package/src/api/lookInput.d.ts +3 -0
- package/src/api/lookInput.js +41 -0
- package/src/api/moonPanelInput.d.ts +60 -0
- package/src/api/moonPanelInput.js +1 -0
- package/src/api/mount.d.ts +9 -19
- package/src/api/mount.js +27 -13
- package/src/api/mount.node.js +27 -13
- package/src/api/pathProvenance.js +1 -1
- package/src/api/pickerInput.d.ts +25 -0
- package/src/api/pickerInput.js +1 -0
- package/src/api/planBodies.d.ts +72 -0
- package/src/api/planBodies.js +300 -0
- package/src/api/planBodySets.d.ts +68 -0
- package/src/api/planBodySets.js +234 -0
- package/src/api/planCamera.d.ts +83 -0
- package/src/api/planCamera.js +184 -0
- package/src/api/planGroups.d.ts +36 -0
- package/src/api/planGroups.js +103 -0
- package/src/api/planMoonPanel.d.ts +19 -0
- package/src/api/planMoonPanel.js +104 -0
- package/src/api/planPaths.d.ts +40 -0
- package/src/api/planPaths.js +212 -0
- package/src/api/planPicker.d.ts +12 -0
- package/src/api/planPicker.js +40 -0
- package/src/api/planPlaces.d.ts +16 -0
- package/src/api/planPlaces.js +99 -0
- package/src/api/planStory.d.ts +26 -0
- package/src/api/planStory.js +66 -0
- package/src/api/planTimeline.d.ts +27 -0
- package/src/api/planTimeline.js +68 -0
- package/src/api/planViews.d.ts +25 -0
- package/src/api/planViews.js +35 -0
- package/src/api/prepared.js +4 -1
- package/src/api/renamedInputs.d.ts +15 -0
- package/src/api/renamedInputs.js +39 -0
- package/src/api/scene.d.ts +162 -68
- package/src/api/scene.js +247 -793
- package/src/api/sceneFreeze.d.ts +4 -0
- package/src/api/sceneFreeze.js +10 -0
- package/src/api/sceneReads.d.ts +171 -0
- package/src/api/sceneReads.js +6 -0
- package/src/api/story.d.ts +49 -19
- package/src/api/story.js +54 -22
- package/src/api/sunOrbit.js +9 -11
- package/src/api/time.d.ts +2 -1
- package/src/api/time.js +2 -1
- package/src/api/viewerCamera.d.ts +22 -0
- package/src/api/viewerCamera.js +84 -0
- package/src/api/viewerClock.d.ts +30 -0
- package/src/api/viewerClock.js +85 -0
- package/src/api/viewerFirstDraw.d.ts +14 -0
- package/src/api/viewerFirstDraw.js +26 -0
- package/src/api/viewerHandle.d.ts +85 -0
- package/src/api/viewerHandle.js +32 -0
- package/src/api/viewerLink.d.ts +88 -15
- package/src/api/viewerLink.js +117 -75
- package/src/api/viewerLooks.d.ts +19 -0
- package/src/api/viewerLooks.js +37 -0
- package/src/api/viewerPicker.d.ts +22 -0
- package/src/api/viewerPicker.js +49 -0
- package/src/api/viewerSelection.d.ts +30 -0
- package/src/api/viewerSelection.js +46 -0
- package/src/api/viewerViews.d.ts +10 -0
- package/src/api/viewerViews.js +18 -0
- package/src/api/viewerZones.d.ts +20 -0
- package/src/api/viewerZones.js +47 -0
- package/src/api/views.d.ts +7 -6
- package/src/api/views.js +12 -6
- package/src/app/App.d.ts +5 -3
- package/src/app/App.js +211 -82
- package/src/app/App.node.js +211 -82
- package/src/app/AstraeusScene.d.ts +18 -2
- package/src/app/AstraeusScene.js +4 -4
- package/src/app/BodyView.d.ts +4 -1
- package/src/app/BodyView.js +2 -2
- package/src/app/CameraController.d.ts +6 -0
- package/src/app/DeveloperSettings.d.ts +1 -4
- package/src/app/DeveloperSettings.js +6 -10
- package/src/app/FeatureMarkers.d.ts +4 -3
- package/src/app/FeatureMarkers.js +8 -13
- package/src/app/FrameRateSection.js +2 -1
- package/src/app/OrbitSetView.js +1 -1
- package/src/app/SettingControls.d.ts +11 -3
- package/src/app/SettingControls.js +10 -2
- package/src/app/SkyView.d.ts +3 -10
- package/src/app/SkyView.js +6 -28
- package/src/app/address.d.ts +16 -0
- package/src/app/address.js +31 -0
- package/src/app/bodyDraw.d.ts +10 -7
- package/src/app/bodyDraw.js +12 -32
- package/src/app/bodyMetrics.js +2 -2
- package/src/app/bodySet.d.ts +4 -20
- package/src/app/bodySet.js +5 -16
- package/src/app/debugReadout.js +1 -1
- package/src/app/displaySwitches.d.ts +4 -0
- package/src/app/displaySwitches.js +6 -0
- package/src/app/experienceDefinition.d.ts +11 -23
- package/src/app/listSwitch.d.ts +8 -14
- package/src/app/listSwitch.js +3 -10
- package/src/app/liveLook.d.ts +39 -0
- package/src/app/liveLook.js +66 -0
- package/src/app/look.d.ts +36 -0
- package/src/app/look.js +61 -0
- package/src/app/mission.d.ts +1 -1
- package/src/app/mission.js +1 -1
- package/src/app/openClock.d.ts +3 -2
- package/src/app/openClock.js +3 -3
- package/src/app/sceneCamera.d.ts +2 -0
- package/src/app/sceneCamera.js +11 -1
- package/src/app/sceneFrame.d.ts +4 -4
- package/src/app/sceneFrame.js +13 -8
- package/src/app/sceneHooks.js +3 -2
- package/src/app/style.css +114 -139
- package/src/app/trackedMetrics.d.ts +10 -3
- package/src/app/trackedMetrics.js +22 -11
- package/src/app/viewLink.d.ts +10 -32
- package/src/app/viewLink.js +10 -49
- package/src/app/viewerPort.d.ts +52 -0
- package/src/app/views.d.ts +3 -0
- package/src/assets/bodies/galileanMoons.js +1 -2
- package/src/assets/bodies/io.js +2 -2
- package/src/assets/bodies/listedMoons.d.ts +1 -1
- package/src/assets/bodies/listedMoons.js +2 -3
- package/src/assets/bodies/planetSystemMaps.js +2 -3
- package/src/assets/bodies/venus.js +2 -6
- package/src/assets/catalogue.js +1 -2
- package/src/assets/licence.d.ts +3 -3
- package/src/assets/licence.js +3 -3
- package/src/assets/pictures.d.ts +15 -12
- package/src/assets/pictures.js +24 -20
- package/src/assets/sky.d.ts +6 -5
- package/src/assets/sky.js +6 -9
- package/src/assets/visual.d.ts +4 -0
- package/src/core/astronomyAdapter.d.ts +1 -1
- package/src/core/astronomyAdapter.js +3 -3
- package/src/core/bodies/index.d.ts +0 -4
- package/src/core/bodies/index.js +14 -18
- package/src/core/bodies/jupiter.js +1 -1
- package/src/core/bodies/jupiterData.d.ts +0 -1
- package/src/core/bodies/jupiterData.js +2 -5
- package/src/core/bodies/mars.js +1 -1
- package/src/core/bodies/mercury.js +1 -1
- package/src/core/bodies/moonSystem.d.ts +1 -1
- package/src/core/bodies/moonSystem.js +102 -55
- package/src/core/bodies/outerPlanetRingData.js +2 -2
- package/src/core/bodies/outerPlanets.d.ts +2 -3
- package/src/core/bodies/outerPlanets.js +4 -13
- package/src/core/bodies/planetMoons.d.ts +0 -2
- package/src/core/bodies/planetMoons.js +1 -18
- package/src/core/bodies/planetRecords.d.ts +8 -2
- package/src/core/bodies/planetRecords.js +13 -5
- package/src/core/bodies/planetTrajectory.d.ts +21 -4
- package/src/core/bodies/planetTrajectory.js +29 -5
- package/src/core/bodies/venus.js +1 -1
- package/src/core/bodySetFamilies.d.ts +20 -0
- package/src/core/bodySetFamilies.js +14 -0
- package/src/core/chebyshevEphemeris.js +1 -1
- package/src/core/elementsBody.d.ts +8 -4
- package/src/core/elementsBody.js +32 -11
- package/src/core/elementsGroup.d.ts +27 -0
- package/src/core/elementsGroup.js +85 -0
- package/src/core/events.d.ts +2 -0
- package/src/core/events.js +2 -0
- package/src/core/illumination.js +1 -1
- package/src/core/listedOrbitGroup.d.ts +2 -0
- package/src/core/listedOrbitGroup.js +11 -7
- package/src/core/moonListText.d.ts +6 -0
- package/src/core/moonListText.js +19 -0
- package/src/core/moonTrajectory.js +1 -1
- package/src/core/pacing.d.ts +38 -3
- package/src/core/pacing.js +55 -4
- package/src/core/planetModels.d.ts +1 -1
- package/src/core/planetModels.js +3 -3
- package/src/core/planetSeries.d.ts +10 -2
- package/src/core/planetSeries.js +17 -3
- package/src/core/pointGroup.js +1 -1
- package/src/core/provenance.d.ts +2 -1
- package/src/core/provenance.js +2 -2
- package/src/core/referenceCenters.js +5 -5
- package/src/core/sampledTrajectory.js +1 -1
- package/src/core/scalePolicy.d.ts +1 -0
- package/src/core/startView.d.ts +19 -0
- package/src/core/startView.js +28 -0
- package/src/core/state.d.ts +6 -2
- package/src/core/state.js +3 -3
- package/src/core/storyPanels.d.ts +63 -0
- package/src/core/storyPanels.js +111 -0
- package/src/core/sunCentredSources.d.ts +4 -0
- package/src/core/sunCentredSources.js +9 -2
- package/src/core/timeInput.d.ts +4 -0
- package/src/core/timeInput.js +4 -0
- package/src/shell/AstraeusShell.d.ts +18 -2
- package/src/shell/AstraeusShell.js +53 -14
- package/src/shell/AstraeusShell.node.js +53 -14
- package/src/shell/Collapsible.d.ts +4 -3
- package/src/shell/Collapsible.js +5 -5
- package/src/shell/ControlsDrawer.d.ts +1 -1
- package/src/shell/ControlsDrawer.js +3 -1
- package/src/shell/DisplaySwitches.js +2 -1
- package/src/shell/InfoPanel.d.ts +3 -1
- package/src/shell/InfoPanel.js +5 -4
- package/src/shell/MoonFamilyPanel.js +1 -1
- package/src/shell/ObjectControls.d.ts +3 -1
- package/src/shell/ObjectControls.js +2 -2
- package/src/shell/Sources.d.ts +5 -3
- package/src/shell/Sources.js +5 -5
- package/src/shell/StoryPanelView.d.ts +4 -3
- package/src/shell/StoryPanelView.js +8 -6
- package/src/shell/SwitchControl.d.ts +5 -11
- package/src/shell/SwitchControl.js +2 -20
- package/src/shell/TimelineBar.css +81 -81
- package/src/shell/TimelineBar.d.ts +5 -2
- package/src/shell/TimelineBar.js +9 -8
- package/src/shell/TimelineBar.node.js +9 -8
- package/src/shell/TopBar.css +22 -22
- package/src/shell/TopBar.d.ts +5 -1
- package/src/shell/TopBar.js +2 -2
- package/src/shell/TopBar.node.js +2 -2
- package/src/shell/bootLoader.d.ts +4 -10
- package/src/shell/bootLoader.js +6 -52
- package/src/shell/embedded.css +18 -18
- package/src/shell/experience.d.ts +1 -1
- package/src/shell/moonFamilies.d.ts +2 -6
- package/src/shell/moonFamilies.js +2 -18
- package/src/shell/phone.css +58 -58
- package/src/shell/storyPanels.d.ts +2 -53
- package/src/shell/storyPanels.js +1 -106
- package/src/shell/style.css +153 -134
- package/src/shell/useDrawers.d.ts +3 -2
- package/src/shell/useDrawers.js +4 -3
- package/src/shell/viewerKeys.d.ts +8 -0
- package/src/shell/viewerKeys.js +16 -0
- package/src/synthetic/syntheticDefinition.js +20 -24
- package/src/synthetic/syntheticJourneyScene.js +3 -3
- package/src/synthetic/syntheticProbeDefinition.js +2 -1
- package/src/synthetic/syntheticViewsDefinition.d.ts +0 -3
- package/src/synthetic/syntheticViewsDefinition.js +10 -16
- package/data/moons/jupiter.json +0 -3333
- package/data/moons/neptune.json +0 -555
- package/data/moons/pluto.json +0 -205
- package/data/moons/saturn.json +0 -8267
- package/data/moons/uranus.json +0 -887
- package/src/app/addressNavigation.d.ts +0 -17
- package/src/app/addressNavigation.js +0 -16
- package/src/assets/bodies/jupiterMoonCatalogue.d.ts +0 -3
- package/src/assets/bodies/jupiterMoonCatalogue.js +0 -4
- package/src/assets/bodies/outerPlanetCatalogues.d.ts +0 -7
- package/src/assets/bodies/outerPlanetCatalogues.js +0 -8
- package/src/assets/bodies/swiftTuttle.d.ts +0 -12
- package/src/assets/bodies/swiftTuttle.js +0 -13
- package/src/assets/moonCatalogue.d.ts +0 -49
- package/src/assets/moonCatalogue.js +0 -80
- package/src/core/bodies/outerPlanetData.d.ts +0 -4
- package/src/core/bodies/outerPlanetData.js +0 -13
- package/src/core/bodies/swiftTuttle.d.ts +0 -46
- package/src/core/bodies/swiftTuttle.js +0 -106
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { lazy, Suspense, useEffect, useRef, useState } from "react";
|
|
2
|
+
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";
|
|
@@ -43,12 +43,24 @@ function ownStorySettings(storySet) {
|
|
|
43
43
|
function ShellTimeline({ hidden, ...bar }) {
|
|
44
44
|
return hidden ? null : _jsx(TimelineBar, { ...bar });
|
|
45
45
|
}
|
|
46
|
+
/** The Developer cog and its drawer; drawn only when the host gave the drawer's content (absent: neither, so an outside page never sees a developer cog). */
|
|
47
|
+
function DeveloperDrawer({ developerMode, onDeveloperModeChange, children }) {
|
|
48
|
+
const drawerId = `${useId()}-developer-tools`;
|
|
49
|
+
if (children === undefined)
|
|
50
|
+
return null;
|
|
51
|
+
return (_jsxs(_Fragment, { children: [_jsx(DeveloperToggle, { developerMode: developerMode, onDeveloperModeChange: onDeveloperModeChange, drawerId: drawerId }), _jsx("aside", { className: "developer-tools", id: drawerId, "data-developer-panel": "", "aria-label": "Developer diagnostics", hidden: !developerMode, children: developerMode ? children : null })] }));
|
|
52
|
+
}
|
|
46
53
|
/** The wide-screen moons toggle and the sheet it opens under the toolbar. */
|
|
47
54
|
function MoonsSheet({ planetLabel, open, onToggle, onClose, children }) {
|
|
48
|
-
|
|
55
|
+
const sheetId = `${useId()}-moons-panel`;
|
|
56
|
+
return (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", className: "moons-toggle ui-pill", "aria-expanded": open, "aria-controls": sheetId, onClick: onToggle, children: [planetLabel, " moons"] }), _jsx("aside", { id: sheetId, className: "moons-sheet", "data-open": open, "aria-label": "Moons by family", onKeyDown: (event) => { if (event.key === "Escape")
|
|
49
57
|
onClose(); }, children: children })] }));
|
|
50
58
|
}
|
|
51
59
|
/** The serial of a request that is asked again by sending a new one; absent request: undefined. */
|
|
60
|
+
/** 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
|
+
return !clearedByHost && (selected === undefined || !isObjectAvailable(selected, timeUtcMs));
|
|
63
|
+
}
|
|
52
64
|
function serialOf(request) {
|
|
53
65
|
return request?.serial;
|
|
54
66
|
}
|
|
@@ -80,14 +92,15 @@ function infoContent(experience, info, selectedObjectId, timeUtcMs, metricsFor)
|
|
|
80
92
|
/** The moon families load on demand: only an experience with `moonFamilies` draws them (I-089). */
|
|
81
93
|
const MoonFamilyPanel = lazy(() => import("./MoonFamilyPanel.js").then((module) => ({ default: module.MoonFamilyPanel })));
|
|
82
94
|
/** Canvas-first layout shared by astronomy experiences. Scene and diagnostics stay app-owned. */
|
|
83
|
-
export function AstraeusShell({ experience, snapshot, developerMode, onDeveloperModeChange, onTogglePlayback, onRateChange, paceAuto, onSeek, onCameraRequest, onCameraHold, 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, children, }) {
|
|
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, }) {
|
|
96
|
+
const infoPanelId = `${useId()}-info-panel`;
|
|
84
97
|
const [selectedObjectId, setSelectedObjectId] = useState(() => initialObjectId(experience, snapshot.timeUtcMs));
|
|
85
98
|
const phone = usePhone();
|
|
86
99
|
/** Fixed for the page: a frame does not appear or vanish while the app runs. */
|
|
87
100
|
const [embedded] = useState(isEmbedded);
|
|
88
101
|
const root = useRef(null);
|
|
89
102
|
// The drawer (with the moons in it) and the bottom sheets want the same screen: the drawer, being the one just asked for, takes it.
|
|
90
|
-
const { controlsOpen, timelineOpen, openControls, openTimeline } = useDrawers(phone, () => {
|
|
103
|
+
const { controlsOpen, timelineOpen, openControls, openTimeline } = useDrawers(phone, root, () => {
|
|
91
104
|
if (experience.moonFamilies !== undefined) {
|
|
92
105
|
setInfo(null);
|
|
93
106
|
story.close();
|
|
@@ -100,6 +113,10 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
100
113
|
const storySet = experience.storyPanels;
|
|
101
114
|
const storyPanels = panelsOf(storySet);
|
|
102
115
|
const story = useStoryPanels(storyPanels, storyPanelSettings ?? ownStorySettings(storySet), snapshot, onSetPlaying);
|
|
116
|
+
if (storySeekNote !== undefined)
|
|
117
|
+
storySeekNote.current = story.noteSeek;
|
|
118
|
+
useEffect(() => () => { if (storySeekNote !== undefined)
|
|
119
|
+
storySeekNote.current = null; }, [storySeekNote]);
|
|
103
120
|
const openPanelId = story.openPanel?.id ?? null;
|
|
104
121
|
useEffect(() => { onOpenPanelChange?.(openPanelId); }, [onOpenPanelChange, openPanelId]);
|
|
105
122
|
const requestedSerial = serialOf(panelRequest);
|
|
@@ -128,24 +145,31 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
128
145
|
story.open(panel.id);
|
|
129
146
|
};
|
|
130
147
|
useEffect(() => {
|
|
131
|
-
onSelectionChange(selectedObjectId);
|
|
148
|
+
onSelectionChange(selectedObjectId, "visitor");
|
|
132
149
|
}, [onSelectionChange, selectedObjectId]);
|
|
150
|
+
/** The host cleared the selection: the fallback that picks the first available object stays off until something is selected again. */
|
|
151
|
+
const hostCleared = useRef(false);
|
|
133
152
|
// A view switch is told from other changes of the experience by the view's id changing.
|
|
134
153
|
const { viewId, takeSwitchRule } = useViewSwitch(viewCamera);
|
|
135
154
|
useEffect(() => {
|
|
136
155
|
const switchRule = takeSwitchRule();
|
|
156
|
+
if (selectedObjectId !== "")
|
|
157
|
+
hostCleared.current = false;
|
|
137
158
|
const selected = experience.objects.find((object) => object.id === selectedObjectId);
|
|
138
|
-
if (
|
|
159
|
+
if (selectionLost(selected, snapshot.timeUtcMs, hostCleared.current && selectedObjectId === "")) {
|
|
139
160
|
const fallbackId = firstAvailableObject(experience, snapshot.timeUtcMs)?.id ?? "";
|
|
140
161
|
setSelectedObjectId(fallbackId);
|
|
141
|
-
onSelectionChange(fallbackId);
|
|
162
|
+
onSelectionChange(fallbackId, "move");
|
|
142
163
|
// The card of an object the view took away closes with it.
|
|
143
164
|
if (switchRule !== undefined && selected === undefined)
|
|
144
165
|
setInfo((now) => (now?.kind === "object" ? null : now));
|
|
145
166
|
}
|
|
146
167
|
const active = experience.cameraPresets.find((preset) => preset.id === activePresetId);
|
|
147
168
|
const activeRequest = active?.request;
|
|
148
|
-
if (
|
|
169
|
+
if (switchRule?.rule === "start" && switchRule.framing?.always === true) {
|
|
170
|
+
applyViewRule(switchRule); // opted in: the view's framing applies on every switch to it
|
|
171
|
+
}
|
|
172
|
+
else if (activeRequest !== undefined && activeRequest.kind !== "overview") {
|
|
149
173
|
const target = experience.objects.find((object) => object.id === activeRequest.target);
|
|
150
174
|
if (switchRule !== undefined && target === undefined) {
|
|
151
175
|
applyViewRule(switchRule);
|
|
@@ -160,6 +184,19 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
160
184
|
}
|
|
161
185
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
162
186
|
}, [activePresetId, experience, onCameraRequest, onSelectionChange, selectedObjectId, snapshot.timeUtcMs, viewId]);
|
|
187
|
+
// A host `setSelected`: runs after the view-switch effect above in the same commit, so it wins over that effect's fallback or view rule.
|
|
188
|
+
const requestedSelectSerial = serialOf(selectRequest);
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
if (selectRequest === null || selectRequest === undefined)
|
|
191
|
+
return;
|
|
192
|
+
hostCleared.current = selectRequest.id === "";
|
|
193
|
+
setSelectedObjectId(selectRequest.id);
|
|
194
|
+
// As a visitor's menu choice does: the object's card opens (the camera is left alone); a clear closes it.
|
|
195
|
+
setInfo((now) => (selectRequest.id === "" ? (now?.kind === "object" ? null : now) : { kind: "object" }));
|
|
196
|
+
onSelectRequestApplied?.();
|
|
197
|
+
// Only a new request applies.
|
|
198
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
199
|
+
}, [requestedSelectSerial]);
|
|
163
200
|
/** 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. */
|
|
164
201
|
const applyViewRule = (rule) => {
|
|
165
202
|
const asked = presetForViewRule(rule, experience);
|
|
@@ -168,9 +205,11 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
168
205
|
const preset = asked !== undefined && asked.request.kind !== "overview" && target === undefined ? findCameraPreset(experience, "overview") : asked;
|
|
169
206
|
if (target !== undefined) {
|
|
170
207
|
setSelectedObjectId(target.id);
|
|
171
|
-
onSelectionChange(target.id);
|
|
208
|
+
onSelectionChange(target.id, "move"); // only the move-driven effect applies a view rule
|
|
172
209
|
}
|
|
173
210
|
setActivePresetId(preset?.id ?? null);
|
|
211
|
+
if (hostCameraSet?.() === true)
|
|
212
|
+
return; // a host camera call made since the switch answers it and wins over the rule
|
|
174
213
|
if (preset !== undefined)
|
|
175
214
|
onCameraRequest(preset.request);
|
|
176
215
|
else
|
|
@@ -208,7 +247,7 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
208
247
|
if (object === undefined)
|
|
209
248
|
return;
|
|
210
249
|
setSelectedObjectId(id);
|
|
211
|
-
onSelectionChange(id);
|
|
250
|
+
onSelectionChange(id, "visitor");
|
|
212
251
|
setInfo({ kind: "object" });
|
|
213
252
|
const active = experience.cameraPresets.find((preset) => preset.id === activePresetId);
|
|
214
253
|
if (active?.request.kind === "focus" || active?.request.kind === "follow") {
|
|
@@ -232,14 +271,14 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
232
271
|
if (target === undefined)
|
|
233
272
|
return;
|
|
234
273
|
setSelectedObjectId(target.id);
|
|
235
|
-
onSelectionChange(target.id);
|
|
274
|
+
onSelectionChange(target.id, "visitor");
|
|
236
275
|
}
|
|
237
276
|
setActivePresetId(preset.id);
|
|
238
277
|
onCameraRequest(preset.request);
|
|
239
278
|
};
|
|
240
279
|
const seekToEvent = (event) => {
|
|
241
280
|
seek(event.timeUtcMs);
|
|
242
|
-
// The event's own object, framed as the picker's Focus does (and `camera.
|
|
281
|
+
// The event's own object, framed as the picker's Focus does (and `camera.focus` opens): the event, never a default body, names it.
|
|
243
282
|
const object = event.object === undefined ? undefined : availableObjectById(experience, event.object, event.timeUtcMs);
|
|
244
283
|
if (object !== undefined)
|
|
245
284
|
activatePreset(focusPresetFor(experience, object), event.timeUtcMs);
|
|
@@ -261,7 +300,7 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
261
300
|
useEffect(() => { if (info !== null)
|
|
262
301
|
setMoonsOpen(false); }, [info]);
|
|
263
302
|
const selectedLabel = objectLabelOr(experience, selectedObjectId, "Controls");
|
|
264
|
-
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" }), scaleId: scaleId, onScaleChange: onScaleChange, scaleChoices: scaleChoices, switcher: switcher, displaySwitches: displaySwitches, viewChoice: viewChoice }));
|
|
303
|
+
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 }));
|
|
265
304
|
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 }) }) }));
|
|
266
|
-
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) })] }), story.openPanel !== null && (_jsx(StoryPanelView, { panel: story.openPanel, holding: story.holding, onClose: story.close, onContinue: story.continuePlayback })), _jsx(
|
|
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: story.close, onContinue: story.continuePlayback })), _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 })] }));
|
|
267
306
|
}
|
|
@@ -6,10 +6,11 @@ export declare function writeStoredOpen(storage: Pick<Storage, "setItem"> | unde
|
|
|
6
6
|
/**
|
|
7
7
|
* The one folding section (STYLE-07): a heading that is a real button with `aria-expanded`, over a body that is not drawn while closed.
|
|
8
8
|
* The body is named by its heading, so it is a labelled group for assistive technology. Open or closed is remembered per viewer in
|
|
9
|
-
* browser storage under `
|
|
9
|
+
* browser storage under `fold`, and works without it. `level` is the heading level; `nested` draws a lighter fold inside another.
|
|
10
10
|
*/
|
|
11
|
-
export declare function Collapsible({
|
|
12
|
-
|
|
11
|
+
export declare function Collapsible({ fold, title, defaultOpen, level, nested, className, remember, onOpenChange, children }: {
|
|
12
|
+
/** The fold's name: its storage key and its `data-fold` hook (not a DOM id). */
|
|
13
|
+
readonly fold: string;
|
|
13
14
|
readonly title: string;
|
|
14
15
|
readonly defaultOpen?: boolean;
|
|
15
16
|
readonly level?: 3 | 4;
|
package/src/shell/Collapsible.js
CHANGED
|
@@ -29,15 +29,15 @@ function browserStorage() {
|
|
|
29
29
|
/**
|
|
30
30
|
* The one folding section (STYLE-07): a heading that is a real button with `aria-expanded`, over a body that is not drawn while closed.
|
|
31
31
|
* The body is named by its heading, so it is a labelled group for assistive technology. Open or closed is remembered per viewer in
|
|
32
|
-
* browser storage under `
|
|
32
|
+
* browser storage under `fold`, and works without it. `level` is the heading level; `nested` draws a lighter fold inside another.
|
|
33
33
|
*/
|
|
34
|
-
export function Collapsible({
|
|
34
|
+
export function Collapsible({ fold, title, defaultOpen = false, level = 3, nested = false, className = "", remember = true, onOpenChange, children }) {
|
|
35
35
|
const uid = useId();
|
|
36
|
-
const [open, setOpen] = useState(() => (remember ? readStoredOpen(browserStorage(),
|
|
36
|
+
const [open, setOpen] = useState(() => (remember ? readStoredOpen(browserStorage(), fold, defaultOpen) : defaultOpen));
|
|
37
37
|
useEffect(() => { if (remember)
|
|
38
|
-
writeStoredOpen(browserStorage(),
|
|
38
|
+
writeStoredOpen(browserStorage(), fold, open); }, [fold, open, remember]);
|
|
39
39
|
const Heading = level === 3 ? "h3" : "h4";
|
|
40
40
|
const buttonId = `${uid}-toggle`;
|
|
41
41
|
const bodyId = `${uid}-body`;
|
|
42
|
-
return (_jsxs("section", { className: `collapsible${nested ? " collapsible-nested" : ""}${className === "" ? "" : ` ${className}`}`, "data-fold":
|
|
42
|
+
return (_jsxs("section", { className: `collapsible${nested ? " collapsible-nested" : ""}${className === "" ? "" : ` ${className}`}`, "data-fold": fold, children: [_jsx(Heading, { className: "collapsible-heading", children: _jsxs("button", { type: "button", id: buttonId, className: "ui-row collapsible-toggle", "data-fold-toggle": fold, "aria-expanded": open, "aria-controls": bodyId, onClick: () => { setOpen(!open); onOpenChange?.(!open); }, children: [_jsx("span", { children: title }), _jsx("svg", { width: "14", height: "14", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.6", "aria-hidden": "true", focusable: "false", children: _jsx("path", { d: "M2 4l4 4 4-4" }) })] }) }), _jsx("div", { id: bodyId, className: "collapsible-body", role: "group", "aria-labelledby": buttonId, hidden: !open, children: open ? children : null })] }));
|
|
43
43
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
2
3
|
import { ChevronIcon } from "./topBarIcons.js";
|
|
3
4
|
import { useDrawerSwipe } from "./useDrawerSwipe.js";
|
|
4
5
|
/**
|
|
@@ -6,11 +7,12 @@ import { useDrawerSwipe } from "./useDrawerSwipe.js";
|
|
|
6
7
|
* under it closes it by a tap or a swipe up. The controls stay mounted while it is closed (state survives) but are hidden from sight and focus.
|
|
7
8
|
*/
|
|
8
9
|
export function ControlsDrawer({ label, open, onOpenChange, swipeThresholdPx, children }) {
|
|
10
|
+
const drawerId = `${useId()}-controls-drawer`;
|
|
9
11
|
const opening = useDrawerSwipe({ thresholdPx: swipeThresholdPx, onTap: () => onOpenChange(true), onSwipe: (direction) => { if (direction === "down")
|
|
10
12
|
onOpenChange(true); } });
|
|
11
13
|
const closing = useDrawerSwipe({ thresholdPx: swipeThresholdPx, onTap: () => onOpenChange(false), onSwipe: (direction) => { if (direction === "up")
|
|
12
14
|
onOpenChange(false); } });
|
|
13
|
-
return (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", className: "controls-pill ui-pill", "aria-label": `Show controls: ${label}`, "aria-expanded": open, "aria-controls":
|
|
15
|
+
return (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", className: "controls-pill ui-pill", "aria-label": `Show controls: ${label}`, "aria-expanded": open, "aria-controls": drawerId, ...opening, children: [_jsx("span", { className: "controls-pill-name", children: label }), _jsx(ChevronIcon, {})] }), _jsxs("div", { id: drawerId, className: "controls-drawer", role: "region", "aria-label": "Controls", "data-open": open,
|
|
14
16
|
// A dropdown closes the drawer on its change, not on the tap that opens it (owner bug, 2026-10-18: the drawer shut as the picker opened).
|
|
15
17
|
onClick: (event) => { const closer = event.target.closest("[data-closes-drawer]"); if (closer !== null && closer.tagName !== "SELECT")
|
|
16
18
|
onOpenChange(false); }, onChange: (event) => { if (event.target.closest("[data-closes-drawer]") !== null)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useId, useRef, useState } from "react";
|
|
3
|
+
import { keyIsForViewer } from "./viewerKeys.js";
|
|
3
4
|
import { ButtonText, OrbitIcon, SwitchesIcon } from "./topBarIcons.js";
|
|
4
5
|
/** The view choice as a button group in the bar (and the phone drawer's grid), with the look of the experience switch's options. Fewer than two views: nothing to choose. */
|
|
5
6
|
export function ViewButtons({ choice }) {
|
|
@@ -33,7 +34,7 @@ function SwitchPanel({ switches, viewChoice }) {
|
|
|
33
34
|
return undefined;
|
|
34
35
|
const outside = (event) => { if (!root.current?.contains(event.target))
|
|
35
36
|
setOpen(false); };
|
|
36
|
-
const escape = (event) => { if (!event.defaultPrevented && event.key === "Escape")
|
|
37
|
+
const escape = (event) => { if (!event.defaultPrevented && event.key === "Escape" && keyIsForViewer(event, root.current))
|
|
37
38
|
setOpen(false); };
|
|
38
39
|
document.addEventListener("pointerdown", outside);
|
|
39
40
|
document.addEventListener("keydown", escape);
|
package/src/shell/InfoPanel.d.ts
CHANGED
|
@@ -4,10 +4,12 @@ interface Props {
|
|
|
4
4
|
readonly view: InfoView;
|
|
5
5
|
readonly metrics: readonly Metric[];
|
|
6
6
|
readonly onClose: () => void;
|
|
7
|
+
/** The panel's id, made once per viewer by the shell so the buttons that open it can name it. */
|
|
8
|
+
readonly id: string;
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
9
11
|
* On-demand detail for one object or event; on a phone a bottom sheet with swipe to dismiss. Non-modal: the canvas and controls stay usable around it, and
|
|
10
12
|
* focus stays where the viewer is (choosing in the object picker must not jump into the panel).
|
|
11
13
|
*/
|
|
12
|
-
export declare function InfoPanel({ view, metrics, onClose }: Props): import("react").JSX.Element;
|
|
14
|
+
export declare function InfoPanel({ view, metrics, onClose, id }: Props): import("react").JSX.Element;
|
|
13
15
|
export {};
|
package/src/shell/InfoPanel.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useRef } from "react";
|
|
2
|
+
import { useId, useRef } from "react";
|
|
3
3
|
import { MetricVisual } from "./MetricVisual.js";
|
|
4
4
|
import { ProvenanceBadge } from "./ProvenanceBadge.js";
|
|
5
5
|
import { useSwipeToDismiss } from "./useSwipeToDismiss.js";
|
|
@@ -7,14 +7,15 @@ import { useSwipeToDismiss } from "./useSwipeToDismiss.js";
|
|
|
7
7
|
* On-demand detail for one object or event; on a phone a bottom sheet with swipe to dismiss. Non-modal: the canvas and controls stay usable around it, and
|
|
8
8
|
* focus stays where the viewer is (choosing in the object picker must not jump into the panel).
|
|
9
9
|
*/
|
|
10
|
-
export function InfoPanel({ view, metrics, onClose }) {
|
|
10
|
+
export function InfoPanel({ view, metrics, onClose, id }) {
|
|
11
|
+
const titleId = `${useId()}-title`;
|
|
11
12
|
const targetKey = `${view.target.kind}:${view.target.id}`;
|
|
12
13
|
const sheet = useRef(null);
|
|
13
14
|
useSwipeToDismiss(sheet, onClose);
|
|
14
|
-
return (_jsxs("aside", { id:
|
|
15
|
+
return (_jsxs("aside", { id: id, className: "info-panel", ref: sheet, "aria-labelledby": titleId, "data-info-kind": view.target.kind, "data-info-id": view.target.id, onKeyDown: (event) => {
|
|
15
16
|
if (event.key !== "Escape")
|
|
16
17
|
return;
|
|
17
18
|
event.stopPropagation();
|
|
18
19
|
onClose();
|
|
19
|
-
}, children: [_jsx("div", { className: "sheet-handle", "aria-hidden": "true" }), _jsxs("header", { className: "info-panel-header", children: [_jsx("h2", { id:
|
|
20
|
+
}, children: [_jsx("div", { className: "sheet-handle", "aria-hidden": "true" }), _jsxs("header", { className: "info-panel-header", children: [_jsx("h2", { id: titleId, children: view.title }), _jsx("button", { type: "button", className: "info-panel-close ui-pill", "aria-label": "Close information", onClick: onClose, children: "Close" })] }), view.subtitle !== undefined && _jsx("p", { className: "info-panel-subtitle", children: _jsx("span", { className: "info-panel-badge", children: view.subtitle }) }), view.provenance !== null && _jsx(ProvenanceBadge, { provenance: view.provenance }, targetKey), view.description !== undefined && _jsx("p", { className: "info-panel-description", children: view.description }), view.facts !== undefined && (_jsx("dl", { className: "info-panel-facts", children: view.facts.map((fact) => _jsxs("div", { className: "info-panel-fact", children: [_jsx("dt", { children: fact.label }), _jsx("dd", { children: fact.value })] }, fact.label)) })), metrics.length > 0 && (_jsx("div", { className: "info-panel-metrics", children: metrics.map((metric) => _jsx(MetricVisual, { metric: metric }, metric.id)) }))] }));
|
|
20
21
|
}
|
|
@@ -23,6 +23,6 @@ export function MoonFamilyPanel({ list, highlightedFamily, onHighlight, onSelect
|
|
|
23
23
|
const folded = list.families.filter((family) => family !== featured);
|
|
24
24
|
return (_jsxs("section", { className: "moon-panel", "aria-label": `${list.planetLabel}'s moons`, "data-highlight": highlightedFamily ?? "", children: [_jsx("p", { className: "moon-note moon-summary", "data-moon-summary": moonFamilyListSummary(list), children: moonFamilyListSummary(list) }), _jsxs("label", { className: "moon-search", htmlFor: searchId, children: [_jsx("span", { className: "moon-search-label", children: "Find a moon" }), _jsx("input", { id: searchId, type: "search", className: "moon-search-input", value: query, placeholder: "Name or designation", autoComplete: "off", spellCheck: false, onChange: (event) => setQuery(event.target.value) })] }), searching && (_jsx("div", { className: "moon-results", role: "group", "aria-label": "Search results", "aria-live": "polite", children: matches.length === 0 ? _jsxs("p", { className: "moon-note", children: ["No moon matches \u201C", query.trim(), "\u201D."] }) : (_jsx("ul", { className: "moon-list", children: matches.map(({ moon, familyLabel }) => moonButton(moon, familyLabel)) })) })), _jsxs("div", { className: "moon-families", hidden: searching, children: [featured !== undefined && (_jsxs("div", { className: "moon-featured", "data-moon-family": featured.id, "data-lit": highlightedFamily === featured.id, children: [_jsx("h3", { className: "moon-featured-heading", children: _jsxs("button", { type: "button", className: "ui-row", "aria-pressed": highlightedFamily === featured.id, "data-moon-light": featured.id, onClick: () => onHighlight(highlightedFamily === featured.id ? null : featured.id), children: [_jsx("span", { children: featured.label }), _jsx("span", { className: "moon-count", children: moonCountText(featured.moons.length) })] }) }), _jsx("p", { className: "moon-note", children: featured.description }), _jsx("ul", { className: "moon-pictures", children: featured.moons.map((moon) => (_jsx("li", { children: _jsxs("button", { type: "button", className: "ui-row moon-picture", "data-moon": moon.id, "data-closes-drawer": "", onClick: () => onSelectMoon(moon.id), children: [moon.pictureUrl !== undefined && _jsx("span", { className: "moon-disc", style: { backgroundImage: `url(${moon.pictureUrl})` }, "aria-hidden": "true" }), _jsx("span", { children: moon.label })] }) }, moon.id))) })] })), folded.map((family) => {
|
|
25
25
|
const { named, unnamed } = splitNamed(family.moons);
|
|
26
|
-
return (_jsx("div", { className: "moon-family", "data-moon-family": family.id, "data-lit": highlightedFamily === family.id, children: _jsxs(Collapsible, {
|
|
26
|
+
return (_jsx("div", { className: "moon-family", "data-moon-family": family.id, "data-lit": highlightedFamily === family.id, children: _jsxs(Collapsible, { fold: `moons-${family.id}`, title: `${family.label} (${family.moons.length})`, remember: false, nested: true, onOpenChange: (open) => toggleLight(family, open), children: [_jsx("p", { className: "moon-note", children: family.description }), named.length > 0 && _jsx("ul", { className: "moon-list", children: named.map((moon) => moonButton(moon)) }), unnamed.length > 0 && (_jsx(Collapsible, { fold: `moons-${family.id}-unnamed`, title: `+${unnamed.length} unnamed`, remember: false, level: 4, nested: true, children: _jsx("ul", { className: "moon-list", children: unnamed.map((moon) => moonButton(moon)) }) }))] }) }, family.id));
|
|
27
27
|
})] })] }));
|
|
28
28
|
}
|
|
@@ -8,6 +8,8 @@ interface Props {
|
|
|
8
8
|
readonly onCameraPreset: (preset: ExperienceCameraPreset) => void;
|
|
9
9
|
readonly infoOpen: boolean;
|
|
10
10
|
readonly onToggleInfo: () => void;
|
|
11
|
+
/** The id of the information panel the Info button opens, made once per viewer by the shell. */
|
|
12
|
+
readonly infoPanelId: string;
|
|
11
13
|
}
|
|
12
|
-
export declare function ObjectControls({ experience, timeUtcMs, selectedObjectId, activePresetId, onSelectObject, onCameraPreset, infoOpen, onToggleInfo, }: Props): import("react").JSX.Element;
|
|
14
|
+
export declare function ObjectControls({ experience, timeUtcMs, selectedObjectId, activePresetId, onSelectObject, onCameraPreset, infoOpen, onToggleInfo, infoPanelId, }: Props): import("react").JSX.Element;
|
|
13
15
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { findCameraPreset, focusPresetFor, isObjectAvailable, listedObjects, relatedObjects } from "./objectModel.js";
|
|
3
3
|
import { ButtonText, FocusIcon, FollowIcon, InfoIcon, OrbitIcon, OverviewIcon } from "./topBarIcons.js";
|
|
4
|
-
export function ObjectControls({ experience, timeUtcMs, selectedObjectId, activePresetId, onSelectObject, onCameraPreset, infoOpen, onToggleInfo, }) {
|
|
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
6
|
const selectedAvailable = selected !== undefined && isObjectAvailable(selected, timeUtcMs);
|
|
7
7
|
const overview = findCameraPreset(experience, "overview");
|
|
@@ -14,5 +14,5 @@ export function ObjectControls({ experience, timeUtcMs, selectedObjectId, active
|
|
|
14
14
|
return (_jsxs("section", { className: "object-controls", "aria-label": "Object and camera controls", children: [_jsx("select", { className: "object-picker", "data-closes-drawer": "", "aria-label": "Select object", value: selectedObjectId, onChange: (event) => onSelectObject(event.target.value), children: listedObjects(experience, selectedObjectId).map((object) => {
|
|
15
15
|
const available = isObjectAvailable(object, timeUtcMs);
|
|
16
16
|
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));
|
|
17
|
-
}) }), _jsxs("button", { type: "button", className: "top-bar-button ui-icon object-info-toggle", "data-closes-drawer": "", "aria-label": selected === undefined ? "Information" : `Information about ${selected.label}`, title: selected === undefined ? "Information" : `Information about ${selected.label}`, "aria-expanded": infoOpen, "aria-controls":
|
|
17
|
+
}) }), _jsxs("button", { type: "button", className: "top-bar-button ui-icon object-info-toggle", "data-closes-drawer": "", "aria-label": selected === undefined ? "Information" : `Information about ${selected.label}`, title: selected === undefined ? "Information" : `Information about ${selected.label}`, "aria-expanded": infoOpen, "aria-controls": infoPanelId, disabled: !selectedAvailable, onClick: onToggleInfo, children: [_jsx(InfoIcon, {}), _jsx(ButtonText, { children: "Info" })] }), _jsxs("div", { className: "object-camera-actions", children: [renderPreset(focus), renderPreset(follow), 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
18
|
}
|
package/src/shell/Sources.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A collapsible section, closed until tapped (O-020 Decision 4). The credits stay complete and one tap away (PROV-01).
|
|
3
|
-
* Shared by the information and story panels. With `details` it is "The details and sources" (O-015 Decision 5)
|
|
4
|
-
* details paragraphs
|
|
3
|
+
* Shared by the information and story panels. With `details` it is "The details and sources" (O-015 Decision 5); without, it is "Sources".
|
|
4
|
+
* Inside: the details paragraphs, then the `accuracy` and `notes` when given, then the sources.
|
|
5
5
|
*/
|
|
6
|
-
export declare function Sources({ sources, details }: {
|
|
6
|
+
export declare function Sources({ sources, details, accuracy, notes }: {
|
|
7
7
|
readonly sources: readonly string[];
|
|
8
8
|
readonly details?: readonly string[];
|
|
9
|
+
readonly accuracy?: string;
|
|
10
|
+
readonly notes?: string;
|
|
9
11
|
}): import("react").JSX.Element;
|
package/src/shell/Sources.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
3
|
* A collapsible section, closed until tapped (O-020 Decision 4). The credits stay complete and one tap away (PROV-01).
|
|
4
|
-
* Shared by the information and story panels. With `details` it is "The details and sources" (O-015 Decision 5)
|
|
5
|
-
* details paragraphs
|
|
4
|
+
* Shared by the information and story panels. With `details` it is "The details and sources" (O-015 Decision 5); without, it is "Sources".
|
|
5
|
+
* Inside: the details paragraphs, then the `accuracy` and `notes` when given, then the sources.
|
|
6
6
|
*/
|
|
7
|
-
export function Sources({ sources, details = [] }) {
|
|
8
|
-
return (_jsxs("details", { className: "sources-section", children: [_jsxs("summary", { className: "ui-button ui-row", children: [details.length > 0 ? _jsx("span", { children: "The details and sources" }) : _jsxs("span", { children: ["Sources ", _jsxs("span", { className: "sources-count", children: ["\u00B7 ", sources.length] })] }), _jsx("svg", { width: "14", height: "14", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.6", "aria-hidden": "true", focusable: "false", children: _jsx("path", { d: "M2 4l4 4 4-4" }) })] }), details.length > 0 && _jsx("div", { className: "sources-details", children: details.map((paragraph) => _jsx("p", { children: paragraph }, paragraph)) }), _jsx("ul", { children: sources.map((source) => _jsx("li", { children: source }, source)) })] }));
|
|
7
|
+
export function Sources({ sources, details = [], accuracy, notes = "" }) {
|
|
8
|
+
return (_jsxs("details", { className: "sources-section", children: [_jsxs("summary", { className: "ui-button ui-row", children: [details.length > 0 ? _jsx("span", { children: "The details and sources" }) : _jsxs("span", { children: ["Sources ", _jsxs("span", { className: "sources-count", children: ["\u00B7 ", sources.length] })] }), _jsx("svg", { width: "14", height: "14", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.6", "aria-hidden": "true", focusable: "false", children: _jsx("path", { d: "M2 4l4 4 4-4" }) })] }), details.length > 0 && _jsx("div", { className: "sources-details", children: details.map((paragraph) => _jsx("p", { children: paragraph }, paragraph)) }), accuracy !== undefined && (_jsxs("dl", { className: "provenance-detail sources-trust", children: [_jsx("dt", { children: "Accuracy" }), _jsx("dd", { children: accuracy }), notes.length > 0 && _jsxs(_Fragment, { children: [_jsx("dt", { children: "Notes" }), _jsx("dd", { children: notes })] })] })), _jsx("ul", { children: sources.map((source) => _jsx("li", { children: source }, source)) })] }));
|
|
9
9
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ProvenanceSourceType } from "../core/provenance.js";
|
|
2
|
+
import type { StoryPanel } from "./storyPanels.js";
|
|
2
3
|
/** A small pill saying how far to trust a panel's facts, after Planetary Explorer's Badge. */
|
|
3
|
-
export declare function StoryBadge({
|
|
4
|
-
readonly
|
|
4
|
+
export declare function StoryBadge({ sourceType }: {
|
|
5
|
+
readonly sourceType: ProvenanceSourceType;
|
|
5
6
|
}): import("react").JSX.Element;
|
|
6
7
|
interface Props {
|
|
7
8
|
readonly panel: StoryPanel;
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef } from "react";
|
|
2
|
+
import { useEffect, useId, useRef } from "react";
|
|
3
|
+
import { keyIsForViewer } from "./viewerKeys.js";
|
|
3
4
|
import { Sources } from "./Sources.js";
|
|
4
|
-
import {
|
|
5
|
+
import { PROVENANCE_STATUS } from "./infoModel.js";
|
|
5
6
|
import { useSwipeToDismiss } from "./useSwipeToDismiss.js";
|
|
6
7
|
import { useZoomThrough } from "./useZoomThrough.js";
|
|
7
8
|
/** A small pill saying how far to trust a panel's facts, after Planetary Explorer's Badge. */
|
|
8
|
-
export function StoryBadge({
|
|
9
|
-
return _jsx("span", { className: "story-badge", "data-badge":
|
|
9
|
+
export function StoryBadge({ sourceType }) {
|
|
10
|
+
return _jsx("span", { className: "story-badge", "data-badge": sourceType, children: PROVENANCE_STATUS[sourceType] });
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* One story panel: a side panel beside the scene on a wide screen, a bottom sheet with a grab handle on a phone
|
|
13
14
|
* (the stylesheet chooses). Closing, Escape and a swipe down all dismiss it.
|
|
14
15
|
*/
|
|
15
16
|
export function StoryPanelView({ panel, holding, onClose, onContinue }) {
|
|
17
|
+
const titleId = `${useId()}-title`;
|
|
16
18
|
const sheet = useRef(null);
|
|
17
19
|
useSwipeToDismiss(sheet, onClose);
|
|
18
20
|
useZoomThrough(sheet);
|
|
19
21
|
useEffect(() => {
|
|
20
|
-
const onKey = (event) => { if (!event.defaultPrevented && event.key === "Escape")
|
|
22
|
+
const onKey = (event) => { if (!event.defaultPrevented && event.key === "Escape" && keyIsForViewer(event, sheet.current))
|
|
21
23
|
onClose(); };
|
|
22
24
|
document.addEventListener("keydown", onKey);
|
|
23
25
|
return () => document.removeEventListener("keydown", onKey);
|
|
24
26
|
}, [onClose]);
|
|
25
|
-
return (_jsxs("aside", { className: "story-panel", ref: sheet, role: "dialog", "aria-modal": "false", "aria-labelledby":
|
|
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" })] }));
|
|
26
28
|
}
|
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
/** A choice
|
|
1
|
+
/** A choice a host offers between versions of its scene (a host's picker, `Scene.setPicker`): the control only reports a press, it never reads or writes the address. Names come from the host's data, never from the shell. */
|
|
2
2
|
export interface ExperienceSwitch {
|
|
3
3
|
/** The accessible name of the group. */
|
|
4
4
|
readonly label: string;
|
|
5
|
-
/**
|
|
5
|
+
/** Names the choice; drawn as `data-switch-param`. */
|
|
6
6
|
readonly param: string;
|
|
7
|
-
/**
|
|
8
|
-
readonly
|
|
9
|
-
/** The clock's time now, in UTC ms: when `keep` names `t`, the switch carries this time, not the one the address was opened with. Given by the app, which owns the clock. */
|
|
10
|
-
readonly currentTimeUtcMs?: () => number;
|
|
11
|
-
/** Opens the address a choice leads to inside the running page (the entry pushes it into history and rebuilds); absent: the page navigates to it. Given by the entry through the app. */
|
|
12
|
-
readonly open?: (address: string) => void;
|
|
7
|
+
/** A press of an option other than the pressed one calls this with the option's value and does nothing else. */
|
|
8
|
+
readonly choose: (value: string) => void;
|
|
13
9
|
readonly options: readonly {
|
|
14
10
|
readonly label: string;
|
|
15
11
|
readonly value: string;
|
|
16
12
|
readonly active: boolean;
|
|
17
13
|
}[];
|
|
18
14
|
}
|
|
19
|
-
/**
|
|
20
|
-
export declare function switchAddress(href: string, param: string, value: string, keep?: readonly string[], timeUtcMs?: number): string;
|
|
21
|
-
/** One button per option in the top bar (and the phone drawer); choosing one asks for the new address to be opened. Fewer than two options: nothing to choose, no control. */
|
|
15
|
+
/** One button per option in the top bar (and the phone drawer); choosing one reports it to the host. Fewer than two options: nothing to choose, no control. */
|
|
22
16
|
export declare function SwitchControl({ choice }: {
|
|
23
17
|
readonly choice: ExperienceSwitch;
|
|
24
18
|
}): import("react").JSX.Element | null;
|
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
export function switchAddress(href, param, value, keep = [], timeUtcMs) {
|
|
4
|
-
const url = new URL(href);
|
|
5
|
-
url.searchParams.set(param, value);
|
|
6
|
-
// The clock's time at the press (whole seconds, as the view link writes it) replaces whatever `t` the address was opened with.
|
|
7
|
-
if (keep.includes("t") && timeUtcMs !== undefined)
|
|
8
|
-
url.searchParams.set("t", new Date(Math.round(timeUtcMs / 1000) * 1000).toISOString());
|
|
9
|
-
for (const own of ["view", "t"])
|
|
10
|
-
if (!keep.includes(own))
|
|
11
|
-
url.searchParams.delete(own);
|
|
12
|
-
return url.toString();
|
|
13
|
-
}
|
|
14
|
-
function openAddress(choice, address) {
|
|
15
|
-
if (choice.open !== undefined)
|
|
16
|
-
choice.open(address);
|
|
17
|
-
else
|
|
18
|
-
window.location.assign(address);
|
|
19
|
-
}
|
|
20
|
-
/** One button per option in the top bar (and the phone drawer); choosing one asks for the new address to be opened. Fewer than two options: nothing to choose, no control. */
|
|
2
|
+
/** One button per option in the top bar (and the phone drawer); choosing one reports it to the host. Fewer than two options: nothing to choose, no control. */
|
|
21
3
|
export function SwitchControl({ choice }) {
|
|
22
4
|
if (choice.options.length < 2)
|
|
23
5
|
return null;
|
|
24
6
|
return (_jsx("section", { className: "switch-control", role: "group", "aria-label": choice.label, "data-switch-param": choice.param, children: choice.options.map((option) => (_jsx("button", { type: "button", className: `switch-option top-bar-button ${option.active ? "ui-accent" : ""}`, "aria-pressed": option.active, "data-switch-value": option.value, onClick: () => { if (!option.active)
|
|
25
|
-
|
|
7
|
+
choice.choose(option.value); }, children: _jsx("span", { children: option.label }) }, option.value))) }));
|
|
26
8
|
}
|