astraeus 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +64 -10
  3. package/data/ephemerides/planets/planets.json +1 -1
  4. package/package.json +1 -1
  5. package/src/api/AstraeusScene.d.ts +9 -1
  6. package/src/api/AstraeusScene.js +26 -4
  7. package/src/api/AstraeusScene.node.js +26 -4
  8. package/src/api/data.js +11 -1
  9. package/src/api/errors.d.ts +1 -1
  10. package/src/api/index.d.ts +2 -1
  11. package/src/api/mount.d.ts +16 -0
  12. package/src/api/mount.js +13 -1
  13. package/src/api/mount.node.js +13 -1
  14. package/src/api/pathProvenance.d.ts +10 -0
  15. package/src/api/pathProvenance.js +34 -0
  16. package/src/api/scene.d.ts +7 -1
  17. package/src/api/scene.js +103 -14
  18. package/src/api/story.d.ts +41 -1
  19. package/src/api/story.js +63 -1
  20. package/src/api/sunOrbit.d.ts +3 -3
  21. package/src/api/sunOrbit.js +92 -24
  22. package/src/api/viewerLink.d.ts +40 -0
  23. package/src/api/viewerLink.js +86 -0
  24. package/src/app/App.d.ts +4 -1
  25. package/src/app/App.js +42 -6
  26. package/src/app/App.node.js +42 -6
  27. package/src/app/AstraeusScene.d.ts +7 -0
  28. package/src/app/BodySetView.js +3 -2
  29. package/src/app/KeplerPoints.d.ts +1 -1
  30. package/src/app/KeplerPoints.js +3 -2
  31. package/src/app/PointsView.js +3 -2
  32. package/src/app/TrackedBodyView.js +3 -2
  33. package/src/app/bodyDraw.js +3 -2
  34. package/src/app/dotMaterial.d.ts +11 -0
  35. package/src/app/dotMaterial.js +38 -0
  36. package/src/app/experienceDefinition.d.ts +12 -0
  37. package/src/app/mission.d.ts +1 -1
  38. package/src/app/mission.js +1 -1
  39. package/src/app/openClock.d.ts +1 -1
  40. package/src/app/openClock.js +3 -0
  41. package/src/app/sceneContentsHooks.js +2 -1
  42. package/src/app/sceneFrame.d.ts +2 -2
  43. package/src/app/sceneFrame.js +6 -1
  44. package/src/app/sceneFraming.d.ts +1 -1
  45. package/src/app/sceneFraming.js +9 -3
  46. package/src/app/viewerPort.d.ts +33 -0
  47. package/src/app/viewerPort.js +1 -0
  48. package/src/core/bodies/io.js +1 -1
  49. package/src/core/bodies/jupiterMoons.d.ts +1 -1
  50. package/src/core/bodies/jupiterMoons.js +6 -6
  51. package/src/core/bodies/moonSystem.d.ts +15 -1
  52. package/src/core/bodies/moonSystem.js +58 -7
  53. package/src/core/bodies/outerPlanets.js +1 -1
  54. package/src/core/bodies/planetMoons.js +10 -10
  55. package/src/core/chebyshevEphemeris.d.ts +7 -1
  56. package/src/core/chebyshevEphemeris.js +24 -7
  57. package/src/core/clock.d.ts +8 -0
  58. package/src/core/clock.js +14 -0
  59. package/src/core/pacing.d.ts +24 -0
  60. package/src/core/pacing.js +35 -0
  61. package/src/core/planetModels.d.ts +4 -1
  62. package/src/core/planetModels.js +6 -1
  63. package/src/core/planetSeries.d.ts +3 -0
  64. package/src/core/planetSeries.js +8 -1
  65. package/src/core/timeWindow.d.ts +2 -0
  66. package/src/core/timeWindow.js +4 -3
  67. package/src/shell/AstraeusShell.d.ts +6 -2
  68. package/src/shell/AstraeusShell.js +3 -3
  69. package/src/shell/AstraeusShell.node.js +3 -3
  70. package/src/shell/TimelineBar.d.ts +4 -2
  71. package/src/shell/TimelineBar.js +15 -6
  72. package/src/shell/TimelineBar.node.js +15 -6
  73. package/src/shell/experience.d.ts +3 -1
  74. package/src/shell/infoModel.js +5 -4
  75. package/src/shell/timelineModel.d.ts +2 -3
  76. package/src/shell/timelineModel.js +3 -11
  77. package/src/synthetic/syntheticJourneyScene.d.ts +9 -0
  78. package/src/synthetic/syntheticJourneyScene.js +75 -0
@@ -100,9 +100,10 @@ export function rateAt(window, timeUtcMs) {
100
100
  }
101
101
  /** The provenance span covering a time (a shared boundary belongs to the later span); null if none. */
102
102
  export function provenanceAt(window, timeUtcMs) {
103
- const spans = window.provenance;
104
- if (spans === undefined)
105
- return null;
103
+ return window.provenance === undefined ? null : spanProvenanceAt(window.provenance, timeUtcMs);
104
+ }
105
+ /** The provenance of the span (sorted, not overlapping) covering a time; null if none. Windows and paths share it. */
106
+ export function spanProvenanceAt(spans, timeUtcMs) {
106
107
  for (let i = spans.length - 1; i >= 0; i -= 1) {
107
108
  if (timeUtcMs >= spans[i].startUtcMs && timeUtcMs < spans[i].endUtcMs)
108
109
  return spans[i].provenance;
@@ -12,13 +12,17 @@ import "./controls.css";
12
12
  import "./style.css";
13
13
  import "./phone.css";
14
14
  import "./embedded.css";
15
+ /** The object selected when the shell opens: the first one available at the clock time, else the first listed. */
16
+ export declare function initialObjectId(experience: ExperienceConfig, timeUtcMs: number): string;
15
17
  interface Props {
16
18
  readonly experience: ExperienceConfig;
17
19
  readonly snapshot: ClockSnapshot;
18
20
  readonly developerMode: boolean;
19
21
  readonly onDeveloperModeChange: (enabled: boolean) => void;
20
22
  readonly onTogglePlayback: () => void;
21
- readonly onRateChange: (rate: number) => void;
23
+ readonly onRateChange: (rate: number | "auto") => void;
24
+ /** Only for a scene with pacing: whether pacing sets the rate now (the speed menu then shows Auto). */
25
+ readonly paceAuto?: boolean | undefined;
22
26
  readonly onSeek: (timeUtcMs: number) => void;
23
27
  readonly onCameraRequest: (request: ExperienceCameraPreset["request"]) => void;
24
28
  readonly onSelectionChange: (objectId: string) => void;
@@ -65,5 +69,5 @@ interface Props {
65
69
  readonly children: ReactNode;
66
70
  }
67
71
  /** Canvas-first layout shared by astronomy experiences. Scene and diagnostics stay app-owned. */
68
- export declare function AstraeusShell({ experience, snapshot, developerMode, onDeveloperModeChange, onTogglePlayback, onRateChange, onSeek, onCameraRequest, onSelectionChange, scaleId, onScaleChange, scaleChoices, switcher, displaySwitches, metricsFor, developerTools, storyPanelSettings, timelineGlow, phoneLayout, highlightedFamily, onHighlightFamily, onSetPlaying, panelRequest, onOpenPanelChange, featureRequest, onOpenFeatureChange, pickRequest, children, }: Props): import("react").JSX.Element;
72
+ export declare function AstraeusShell({ experience, snapshot, developerMode, onDeveloperModeChange, onTogglePlayback, onRateChange, paceAuto, onSeek, onCameraRequest, onSelectionChange, scaleId, onScaleChange, scaleChoices, switcher, displaySwitches, metricsFor, developerTools, storyPanelSettings, timelineGlow, phoneLayout, highlightedFamily, onHighlightFamily, onSetPlaying, panelRequest, onOpenPanelChange, featureRequest, onOpenFeatureChange, pickRequest, children, }: Props): import("react").JSX.Element;
69
73
  export {};
@@ -32,7 +32,7 @@ function useTimelineSpace(root, phone) {
32
32
  }, [root, phone]);
33
33
  }
34
34
  /** The object selected when the shell opens: the first one available at the clock time, else the first listed. */
35
- function initialObjectId(experience, timeUtcMs) {
35
+ export function initialObjectId(experience, timeUtcMs) {
36
36
  const start = experience.cameraPresets.find((preset) => preset.id === experience.startCameraPresetId)?.request;
37
37
  if (start !== undefined && start.kind !== "overview" && experience.objects.some((object) => object.id === start.target))
38
38
  return start.target;
@@ -72,7 +72,7 @@ function infoContent(experience, info, selectedObjectId, timeUtcMs, metricsFor)
72
72
  /** The moon families load on demand: only an experience with `moonFamilies` draws them (I-089). */
73
73
  const MoonFamilyPanel = lazy(() => import("./MoonFamilyPanel.js").then((module) => ({ default: module.MoonFamilyPanel })));
74
74
  /** Canvas-first layout shared by astronomy experiences. Scene and diagnostics stay app-owned. */
75
- export function AstraeusShell({ experience, snapshot, developerMode, onDeveloperModeChange, onTogglePlayback, onRateChange, onSeek, onCameraRequest, onSelectionChange, scaleId, onScaleChange, scaleChoices, switcher, displaySwitches, metricsFor, developerTools, storyPanelSettings, timelineGlow, phoneLayout = DEFAULT_PHONE_LAYOUT, highlightedFamily = null, onHighlightFamily, onSetPlaying, panelRequest, onOpenPanelChange, featureRequest, onOpenFeatureChange, pickRequest, children, }) {
75
+ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloperModeChange, onTogglePlayback, onRateChange, paceAuto, onSeek, onCameraRequest, onSelectionChange, scaleId, onScaleChange, scaleChoices, switcher, displaySwitches, metricsFor, developerTools, storyPanelSettings, timelineGlow, phoneLayout = DEFAULT_PHONE_LAYOUT, highlightedFamily = null, onHighlightFamily, onSetPlaying, panelRequest, onOpenPanelChange, featureRequest, onOpenFeatureChange, pickRequest, children, }) {
76
76
  const [selectedObjectId, setSelectedObjectId] = useState(() => initialObjectId(experience, snapshot.timeUtcMs));
77
77
  const phone = usePhone();
78
78
  /** Fixed for the page: a frame does not appear or vanish while the app runs. */
@@ -225,5 +225,5 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
225
225
  const selectedLabel = objectLabelOr(experience, selectedObjectId, "Controls");
226
226
  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 }));
227
227
  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 }) }) }));
228
- 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(DeveloperToggle, { developerMode: developerMode, onDeveloperModeChange: onDeveloperModeChange }), _jsx("aside", { className: "developer-tools", id: "developer-tools", "data-developer-panel": "", "aria-label": "Developer diagnostics", hidden: !developerMode, children: developerMode ? developerTools : null }), _jsx(ShellTimeline, { hidden: experience.hideTimeline === true, experience: experience, snapshot: snapshot, onTogglePlayback: onTogglePlayback, onRateChange: onRateChange, 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, drawer: phone ? { open: timelineOpen, onOpenChange: openTimeline, swipeThresholdPx: phoneLayout.swipeThresholdPx } : undefined })] }));
228
+ 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(DeveloperToggle, { developerMode: developerMode, onDeveloperModeChange: onDeveloperModeChange }), _jsx("aside", { className: "developer-tools", id: "developer-tools", "data-developer-panel": "", "aria-label": "Developer diagnostics", hidden: !developerMode, children: developerMode ? developerTools : null }), _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, drawer: phone ? { open: timelineOpen, onOpenChange: openTimeline, swipeThresholdPx: phoneLayout.swipeThresholdPx } : undefined })] }));
229
229
  }
@@ -28,7 +28,7 @@ function useTimelineSpace(root, phone) {
28
28
  }, [root, phone]);
29
29
  }
30
30
  /** The object selected when the shell opens: the first one available at the clock time, else the first listed. */
31
- function initialObjectId(experience, timeUtcMs) {
31
+ export function initialObjectId(experience, timeUtcMs) {
32
32
  const start = experience.cameraPresets.find((preset) => preset.id === experience.startCameraPresetId)?.request;
33
33
  if (start !== undefined && start.kind !== "overview" && experience.objects.some((object) => object.id === start.target))
34
34
  return start.target;
@@ -68,7 +68,7 @@ function infoContent(experience, info, selectedObjectId, timeUtcMs, metricsFor)
68
68
  /** The moon families load on demand: only an experience with `moonFamilies` draws them (I-089). */
69
69
  const MoonFamilyPanel = lazy(() => import("./MoonFamilyPanel.js").then((module) => ({ default: module.MoonFamilyPanel })));
70
70
  /** Canvas-first layout shared by astronomy experiences. Scene and diagnostics stay app-owned. */
71
- export function AstraeusShell({ experience, snapshot, developerMode, onDeveloperModeChange, onTogglePlayback, onRateChange, onSeek, onCameraRequest, onSelectionChange, scaleId, onScaleChange, scaleChoices, switcher, displaySwitches, metricsFor, developerTools, storyPanelSettings, timelineGlow, phoneLayout = DEFAULT_PHONE_LAYOUT, highlightedFamily = null, onHighlightFamily, onSetPlaying, panelRequest, onOpenPanelChange, featureRequest, onOpenFeatureChange, pickRequest, children, }) {
71
+ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloperModeChange, onTogglePlayback, onRateChange, paceAuto, onSeek, onCameraRequest, onSelectionChange, scaleId, onScaleChange, scaleChoices, switcher, displaySwitches, metricsFor, developerTools, storyPanelSettings, timelineGlow, phoneLayout = DEFAULT_PHONE_LAYOUT, highlightedFamily = null, onHighlightFamily, onSetPlaying, panelRequest, onOpenPanelChange, featureRequest, onOpenFeatureChange, pickRequest, children, }) {
72
72
  const [selectedObjectId, setSelectedObjectId] = useState(() => initialObjectId(experience, snapshot.timeUtcMs));
73
73
  const phone = usePhone();
74
74
  /** Fixed for the page: a frame does not appear or vanish while the app runs. */
@@ -221,5 +221,5 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
221
221
  const selectedLabel = objectLabelOr(experience, selectedObjectId, "Controls");
222
222
  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 }));
223
223
  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 }) }) }));
224
- 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(DeveloperToggle, { developerMode: developerMode, onDeveloperModeChange: onDeveloperModeChange }), _jsx("aside", { className: "developer-tools", id: "developer-tools", "data-developer-panel": "", "aria-label": "Developer diagnostics", hidden: !developerMode, children: developerMode ? developerTools : null }), _jsx(ShellTimeline, { hidden: experience.hideTimeline === true, experience: experience, snapshot: snapshot, onTogglePlayback: onTogglePlayback, onRateChange: onRateChange, 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, drawer: phone ? { open: timelineOpen, onOpenChange: openTimeline, swipeThresholdPx: phoneLayout.swipeThresholdPx } : undefined })] }));
224
+ 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(DeveloperToggle, { developerMode: developerMode, onDeveloperModeChange: onDeveloperModeChange }), _jsx("aside", { className: "developer-tools", id: "developer-tools", "data-developer-panel": "", "aria-label": "Developer diagnostics", hidden: !developerMode, children: developerMode ? developerTools : null }), _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, drawer: phone ? { open: timelineOpen, onOpenChange: openTimeline, swipeThresholdPx: phoneLayout.swipeThresholdPx } : undefined })] }));
225
225
  }
@@ -9,7 +9,9 @@ interface Props {
9
9
  readonly experience: ExperienceConfig;
10
10
  readonly snapshot: ClockSnapshot;
11
11
  readonly onTogglePlayback: () => void;
12
- readonly onRateChange: (rate: number) => void;
12
+ readonly onRateChange: (rate: number | "auto") => void;
13
+ /** Present only for a scene with pacing: true while pacing sets the speed. The menu then gains an Auto choice, selected while it is. */
14
+ readonly paceAuto?: boolean | undefined;
13
15
  readonly onSeek: (timeUtcMs: number) => void;
14
16
  /** Story panels drawn as markers on the track; pressing one seeks to it and opens it. */
15
17
  readonly panels?: readonly StoryPanel[];
@@ -32,7 +34,7 @@ interface Props {
32
34
  readonly swipeThresholdPx: number;
33
35
  };
34
36
  }
35
- export declare function TimelineBar({ experience, snapshot, onTogglePlayback, onRateChange, onSeek, panels, openPanelId, onPanelOpen, onEventSeek, onEventInfo, onWindowSeek, onWindowInfo, glowLook, drawer }: Props): import("react").JSX.Element;
37
+ export declare function TimelineBar({ experience, snapshot, onTogglePlayback, onRateChange, paceAuto, onSeek, panels, openPanelId, onPanelOpen, onEventSeek, onEventInfo, onWindowSeek, onWindowInfo, glowLook, drawer }: Props): import("react").JSX.Element;
36
38
  interface ExpandedProps {
37
39
  readonly experience: ExperienceConfig;
38
40
  readonly snapshot: ClockSnapshot;
@@ -1,17 +1,25 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useMemo, useState } from "react";
3
- import { eventContextAt, eventPositionPercent, formatUtcTimestamp, formatWindowRate, navigationStops, windowContextAt, timePositionPercent, mergeSpeeds, DEFAULT_PLAYBACK_SPEEDS, TIMELINE_STEP_MS, clampToBounds, formatRateCompact } from "./timelineModel.js";
3
+ import { eventContextAt, eventPositionPercent, formatUtcTimestamp, formatWindowRate, navigationStops, windowContextAt, timePositionPercent, speedsOf, TIMELINE_STEP_MS, clampToBounds, formatRateCompact, formatRate } from "./timelineModel.js";
4
4
  import { activityAt, DEFAULT_TIMELINE_GLOW, glowDescription, glowGradient, glowProfile, glowTooltip } from "./timelineGlow.js";
5
5
  import { Label } from "./Label.js";
6
6
  import { useDrawerSwipe } from "./useDrawerSwipe.js";
7
7
  import "./TimelineBar.css";
8
+ /** The Auto choice of the speed menu: just "Auto", or with the speed pacing is running at now. */
9
+ function autoLabel(showRate, rate) {
10
+ return showRate ? `Auto — ${formatRate(Math.round(rate * 10) / 10)}` : "Auto";
11
+ }
12
+ /** The speed menu: the scene's speeds, preceded by Auto in a scene with pacing (selected while pacing sets the speed). On a phone it shows each rate in a few characters; the speed slider in the drawer says it in words. */
13
+ function SpeedMenu({ speeds, rate, paceAuto, compact, onRateChange }) {
14
+ return (_jsxs("label", { className: "timeline-speed", children: [_jsx("span", { children: "Playback rate" }), _jsxs("select", { "aria-label": "Playback speed", title: "Playback speed", value: paceAuto === true ? "auto" : rate, onChange: (event) => onRateChange(event.target.value === "auto" ? "auto" : Number(event.target.value)), children: [paceAuto !== undefined && _jsx("option", { value: "auto", children: autoLabel(paceAuto && !compact, rate) }), speeds.map((speed) => _jsx("option", { value: speed.rate, children: compact ? formatRateCompact(speed.rate) : speed.label }, speed.rate))] })] }));
15
+ }
8
16
  /** The seek slider's spoken value: the time, with the activity window and its rate when one is running. */
9
17
  function seekValueText(timeUtcMs, activityNow) {
10
18
  if (activityNow === null || activityNow.window.rate === undefined)
11
19
  return formatUtcTimestamp(timeUtcMs);
12
20
  return `${formatUtcTimestamp(timeUtcMs)}, ${activityNow.window.label}: ${formatWindowRate(activityNow.rate, activityNow.window.rate.unit)}`;
13
21
  }
14
- export function TimelineBar({ experience, snapshot, onTogglePlayback, onRateChange, onSeek, panels = [], openPanelId = null, onPanelOpen, onEventSeek, onEventInfo, onWindowSeek, onWindowInfo, glowLook = DEFAULT_TIMELINE_GLOW, drawer }) {
22
+ export function TimelineBar({ experience, snapshot, onTogglePlayback, onRateChange, paceAuto, onSeek, panels = [], openPanelId = null, onPanelOpen, onEventSeek, onEventInfo, onWindowSeek, onWindowInfo, glowLook = DEFAULT_TIMELINE_GLOW, drawer }) {
15
23
  const windows = experience.windows ?? [];
16
24
  const profile = useMemo(() => glowProfile(windows, experience.window), [windows, experience.window]);
17
25
  const gradients = useMemo(() => ({ ahead: glowGradient(profile, glowLook, "ahead"), played: glowGradient(profile, glowLook, "played") }), [profile, glowLook]);
@@ -36,7 +44,7 @@ export function TimelineBar({ experience, snapshot, onTogglePlayback, onRateChan
36
44
  onWindowSeek(stop.window, stop.timeUtcMs);
37
45
  };
38
46
  const stopLabel = (direction, stop) => windows.length === 0 || stop === null ? `${direction} event` : `${direction}: ${stop.label}`;
39
- const speeds = mergeSpeeds(DEFAULT_PLAYBACK_SPEEDS, experience.rates);
47
+ const speeds = speedsOf(experience.rates);
40
48
  const timestamp = formatUtcTimestamp(snapshot.timeUtcMs);
41
49
  const handle = useDrawerSwipe({
42
50
  thresholdPx: drawer?.swipeThresholdPx ?? 0,
@@ -44,6 +52,7 @@ export function TimelineBar({ experience, snapshot, onTogglePlayback, onRateChan
44
52
  onSwipe: (direction) => drawer?.onOpenChange(direction === "up"),
45
53
  });
46
54
  const speedIndex = Math.max(0, speeds.findIndex((speed) => speed.rate === snapshot.rate));
55
+ const speedText = paceAuto === true ? autoLabel(true, snapshot.rate) : speeds[speedIndex]?.label;
47
56
  const scrubber = (_jsxs("div", { className: "timeline-scrubber", children: [_jsxs("div", { className: "timeline-track", title: profile === null ? undefined : hoverTitle ?? description, onPointerMove: moveOnTrack, onPointerLeave: () => setHoverTitle(null), children: [_jsxs("div", { className: "timeline-glow", ...(description === "" ? { "aria-hidden": true } : { role: "img", "aria-label": description }), style: {
48
57
  "--glow-ahead": gradients.ahead,
49
58
  "--glow-played": gradients.played,
@@ -54,9 +63,9 @@ export function TimelineBar({ experience, snapshot, onTogglePlayback, onRateChan
54
63
  onWindowSeek(window, window.peakUtcMs); onWindowInfo(window); } }, `peak-${window.id}`)))] }), _jsx("input", { type: "range", "aria-label": "Seek timeline", "aria-valuetext": valueText, min: experience.window.startUtcMs, max: experience.window.endUtcMs, step: TIMELINE_STEP_MS, value: clampToBounds(snapshot.timeUtcMs, experience.window), onChange: (event) => onSeek(Number(event.target.value)) })] }), _jsxs("div", { className: "timeline-bounds", "aria-hidden": "true", children: [_jsx("time", { dateTime: formatUtcTimestamp(experience.window.startUtcMs), children: formatUtcTimestamp(experience.window.startUtcMs).slice(0, 10) }), _jsx("time", { dateTime: formatUtcTimestamp(experience.window.endUtcMs), children: formatUtcTimestamp(experience.window.endUtcMs).slice(0, 10) })] })] }));
55
64
  return (_jsxs("section", { className: "timeline-bar", "aria-label": "Timeline controls", "data-drawer-open": drawer?.open, children: [drawer !== undefined && (_jsx("button", { type: "button", className: "drawer-handle drawer-handle-top ui-bare", "aria-label": "Timeline drawer", "aria-expanded": drawer.open, "aria-controls": "timeline-drawer", ...handle, children: _jsx("span", {}) })), _jsxs("div", { className: "timeline-main-row", children: [_jsxs("div", { className: "timeline-transport", children: [_jsx("button", { type: "button", className: "timeline-play ui-icon ui-accent", title: snapshot.playing ? "Pause" : "Play", onClick: onTogglePlayback, "aria-label": snapshot.playing ? "Pause playback" : "Play playback", children: snapshot.playing ? _jsx(Symbol, { path: "M7 5h3.5v14H7zM13.5 5H17v14h-3.5z" }) : _jsx(Symbol, { path: "M7 5v14l12-7z" }) }), _jsx("button", { type: "button", className: "timeline-previous ui-icon ui-ghost", "aria-label": stopLabel("Previous", navigation.previous), title: stopLabel("Previous", navigation.previous), disabled: navigation.previous === null, onClick: () => { if (navigation.previous !== null)
56
65
  goToStop(navigation.previous); }, children: _jsx(Symbol, { path: "M6 5h2v14H6zM19 5v14L9 12z" }) }), _jsx("button", { type: "button", className: "timeline-next ui-icon ui-ghost", "aria-label": stopLabel("Next", navigation.next), title: stopLabel("Next", navigation.next), disabled: navigation.next === null, onClick: () => { if (navigation.next !== null)
57
- goToStop(navigation.next); }, children: _jsx(Symbol, { path: "M16 5h2v14h-2zM5 5v14l10-7z" }) })] }), _jsxs("time", { className: "timeline-time", dateTime: timestamp, "aria-label": timestamp, children: [_jsx("span", { className: "timeline-time-full", children: timestamp }), _jsx("span", { className: "timeline-time-short", "aria-hidden": "true", children: timestamp.slice(0, 16).replace("T", " ") })] }), _jsxs("label", { className: "timeline-speed", children: [_jsx("span", { children: "Playback rate" }), _jsx("select", { "aria-label": "Playback speed", title: "Playback speed", value: snapshot.rate, onChange: (event) => onRateChange(Number(event.target.value)), children: speeds.map((speed) => _jsx("option", { value: speed.rate, children: drawer === undefined ? speed.label : formatRateCompact(speed.rate) }, speed.rate)) })] }), scrubber, drawer === undefined && (_jsxs("details", { className: "timeline-event-list", children: [_jsxs("summary", { className: "ui-button", title: "Events: what just happened, what is next, and the full list", children: ["Events ", _jsxs("span", { children: ["(", experience.events.length, ")"] })] }), _jsx(TimelineExpanded, { experience: experience, snapshot: snapshot, onEventSeek: onEventSeek, onEventInfo: onEventInfo, onWindowInfo: onWindowInfo })] }))] }), drawer !== undefined && (_jsx("div", { id: "timeline-drawer", className: "timeline-drawer", role: "region", "aria-label": "Timeline details", "data-open": drawer.open, onClick: (event) => { const closer = event.target.closest("[data-closes-drawer]"); if (closer !== null && closer.tagName !== "SELECT")
58
- drawer.onOpenChange(false); }, children: _jsxs("div", { className: "timeline-drawer-body", children: [_jsxs("div", { className: "timeline-speed-slider", children: [_jsx("span", { "aria-hidden": "true", children: "Playback speed" }), _jsx("input", { type: "range", "aria-label": "Speed slider", "aria-valuetext": speeds[speedIndex]?.label, min: 0, max: speeds.length - 1, step: 1, value: speedIndex, onChange: (event) => { const next = speeds[Number(event.target.value)]; if (next !== undefined)
59
- onRateChange(next.rate); } }), _jsx("output", { children: speeds[speedIndex]?.label })] }), _jsx(TimelineExpanded, { experience: experience, snapshot: snapshot, onEventSeek: onEventSeek, onEventInfo: onEventInfo, onWindowInfo: onWindowInfo })] }) }))] }));
66
+ goToStop(navigation.next); }, children: _jsx(Symbol, { path: "M16 5h2v14h-2zM5 5v14l10-7z" }) })] }), _jsxs("time", { className: "timeline-time", dateTime: timestamp, "aria-label": timestamp, children: [_jsx("span", { className: "timeline-time-full", children: timestamp }), _jsx("span", { className: "timeline-time-short", "aria-hidden": "true", children: timestamp.slice(0, 16).replace("T", " ") })] }), _jsx(SpeedMenu, { speeds: speeds, rate: snapshot.rate, paceAuto: paceAuto, compact: drawer !== undefined, onRateChange: onRateChange }), scrubber, drawer === undefined && (_jsxs("details", { className: "timeline-event-list", children: [_jsxs("summary", { className: "ui-button", title: "Events: what just happened, what is next, and the full list", children: ["Events ", _jsxs("span", { children: ["(", experience.events.length, ")"] })] }), _jsx(TimelineExpanded, { experience: experience, snapshot: snapshot, onEventSeek: onEventSeek, onEventInfo: onEventInfo, onWindowInfo: onWindowInfo })] }))] }), drawer !== undefined && (_jsx("div", { id: "timeline-drawer", className: "timeline-drawer", role: "region", "aria-label": "Timeline details", "data-open": drawer.open, onClick: (event) => { const closer = event.target.closest("[data-closes-drawer]"); if (closer !== null && closer.tagName !== "SELECT")
67
+ drawer.onOpenChange(false); }, children: _jsxs("div", { className: "timeline-drawer-body", children: [_jsxs("div", { className: "timeline-speed-slider", children: [_jsx("span", { "aria-hidden": "true", children: "Playback speed" }), _jsx("input", { type: "range", "aria-label": "Speed slider", "aria-valuetext": speedText, min: 0, max: speeds.length - 1, step: 1, value: speedIndex, onChange: (event) => { const next = speeds[Number(event.target.value)]; if (next !== undefined)
68
+ onRateChange(next.rate); } }), _jsx("output", { children: speedText })] }), _jsx(TimelineExpanded, { experience: experience, snapshot: snapshot, onEventSeek: onEventSeek, onEventInfo: onEventInfo, onWindowInfo: onWindowInfo })] }) }))] }));
60
69
  }
61
70
  /** A 24x24 filled symbol; the button around it carries the accessible name and tooltip. */
62
71
  function Symbol({ path }) {
@@ -1,16 +1,24 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useMemo, useState } from "react";
3
- import { eventContextAt, eventPositionPercent, formatUtcTimestamp, formatWindowRate, navigationStops, windowContextAt, timePositionPercent, mergeSpeeds, DEFAULT_PLAYBACK_SPEEDS, TIMELINE_STEP_MS, clampToBounds, formatRateCompact } from "./timelineModel.js";
3
+ import { eventContextAt, eventPositionPercent, formatUtcTimestamp, formatWindowRate, navigationStops, windowContextAt, timePositionPercent, speedsOf, TIMELINE_STEP_MS, clampToBounds, formatRateCompact, formatRate } from "./timelineModel.js";
4
4
  import { activityAt, DEFAULT_TIMELINE_GLOW, glowDescription, glowGradient, glowProfile, glowTooltip } from "./timelineGlow.js";
5
5
  import { Label } from "./Label.js";
6
6
  import { useDrawerSwipe } from "./useDrawerSwipe.js";
7
+ /** The Auto choice of the speed menu: just "Auto", or with the speed pacing is running at now. */
8
+ function autoLabel(showRate, rate) {
9
+ return showRate ? `Auto — ${formatRate(Math.round(rate * 10) / 10)}` : "Auto";
10
+ }
11
+ /** The speed menu: the scene's speeds, preceded by Auto in a scene with pacing (selected while pacing sets the speed). On a phone it shows each rate in a few characters; the speed slider in the drawer says it in words. */
12
+ function SpeedMenu({ speeds, rate, paceAuto, compact, onRateChange }) {
13
+ return (_jsxs("label", { className: "timeline-speed", children: [_jsx("span", { children: "Playback rate" }), _jsxs("select", { "aria-label": "Playback speed", title: "Playback speed", value: paceAuto === true ? "auto" : rate, onChange: (event) => onRateChange(event.target.value === "auto" ? "auto" : Number(event.target.value)), children: [paceAuto !== undefined && _jsx("option", { value: "auto", children: autoLabel(paceAuto && !compact, rate) }), speeds.map((speed) => _jsx("option", { value: speed.rate, children: compact ? formatRateCompact(speed.rate) : speed.label }, speed.rate))] })] }));
14
+ }
7
15
  /** The seek slider's spoken value: the time, with the activity window and its rate when one is running. */
8
16
  function seekValueText(timeUtcMs, activityNow) {
9
17
  if (activityNow === null || activityNow.window.rate === undefined)
10
18
  return formatUtcTimestamp(timeUtcMs);
11
19
  return `${formatUtcTimestamp(timeUtcMs)}, ${activityNow.window.label}: ${formatWindowRate(activityNow.rate, activityNow.window.rate.unit)}`;
12
20
  }
13
- export function TimelineBar({ experience, snapshot, onTogglePlayback, onRateChange, onSeek, panels = [], openPanelId = null, onPanelOpen, onEventSeek, onEventInfo, onWindowSeek, onWindowInfo, glowLook = DEFAULT_TIMELINE_GLOW, drawer }) {
21
+ export function TimelineBar({ experience, snapshot, onTogglePlayback, onRateChange, paceAuto, onSeek, panels = [], openPanelId = null, onPanelOpen, onEventSeek, onEventInfo, onWindowSeek, onWindowInfo, glowLook = DEFAULT_TIMELINE_GLOW, drawer }) {
14
22
  const windows = experience.windows ?? [];
15
23
  const profile = useMemo(() => glowProfile(windows, experience.window), [windows, experience.window]);
16
24
  const gradients = useMemo(() => ({ ahead: glowGradient(profile, glowLook, "ahead"), played: glowGradient(profile, glowLook, "played") }), [profile, glowLook]);
@@ -35,7 +43,7 @@ export function TimelineBar({ experience, snapshot, onTogglePlayback, onRateChan
35
43
  onWindowSeek(stop.window, stop.timeUtcMs);
36
44
  };
37
45
  const stopLabel = (direction, stop) => windows.length === 0 || stop === null ? `${direction} event` : `${direction}: ${stop.label}`;
38
- const speeds = mergeSpeeds(DEFAULT_PLAYBACK_SPEEDS, experience.rates);
46
+ const speeds = speedsOf(experience.rates);
39
47
  const timestamp = formatUtcTimestamp(snapshot.timeUtcMs);
40
48
  const handle = useDrawerSwipe({
41
49
  thresholdPx: drawer?.swipeThresholdPx ?? 0,
@@ -43,6 +51,7 @@ export function TimelineBar({ experience, snapshot, onTogglePlayback, onRateChan
43
51
  onSwipe: (direction) => drawer?.onOpenChange(direction === "up"),
44
52
  });
45
53
  const speedIndex = Math.max(0, speeds.findIndex((speed) => speed.rate === snapshot.rate));
54
+ const speedText = paceAuto === true ? autoLabel(true, snapshot.rate) : speeds[speedIndex]?.label;
46
55
  const scrubber = (_jsxs("div", { className: "timeline-scrubber", children: [_jsxs("div", { className: "timeline-track", title: profile === null ? undefined : hoverTitle ?? description, onPointerMove: moveOnTrack, onPointerLeave: () => setHoverTitle(null), children: [_jsxs("div", { className: "timeline-glow", ...(description === "" ? { "aria-hidden": true } : { role: "img", "aria-label": description }), style: {
47
56
  "--glow-ahead": gradients.ahead,
48
57
  "--glow-played": gradients.played,
@@ -53,9 +62,9 @@ export function TimelineBar({ experience, snapshot, onTogglePlayback, onRateChan
53
62
  onWindowSeek(window, window.peakUtcMs); onWindowInfo(window); } }, `peak-${window.id}`)))] }), _jsx("input", { type: "range", "aria-label": "Seek timeline", "aria-valuetext": valueText, min: experience.window.startUtcMs, max: experience.window.endUtcMs, step: TIMELINE_STEP_MS, value: clampToBounds(snapshot.timeUtcMs, experience.window), onChange: (event) => onSeek(Number(event.target.value)) })] }), _jsxs("div", { className: "timeline-bounds", "aria-hidden": "true", children: [_jsx("time", { dateTime: formatUtcTimestamp(experience.window.startUtcMs), children: formatUtcTimestamp(experience.window.startUtcMs).slice(0, 10) }), _jsx("time", { dateTime: formatUtcTimestamp(experience.window.endUtcMs), children: formatUtcTimestamp(experience.window.endUtcMs).slice(0, 10) })] })] }));
54
63
  return (_jsxs("section", { className: "timeline-bar", "aria-label": "Timeline controls", "data-drawer-open": drawer?.open, children: [drawer !== undefined && (_jsx("button", { type: "button", className: "drawer-handle drawer-handle-top ui-bare", "aria-label": "Timeline drawer", "aria-expanded": drawer.open, "aria-controls": "timeline-drawer", ...handle, children: _jsx("span", {}) })), _jsxs("div", { className: "timeline-main-row", children: [_jsxs("div", { className: "timeline-transport", children: [_jsx("button", { type: "button", className: "timeline-play ui-icon ui-accent", title: snapshot.playing ? "Pause" : "Play", onClick: onTogglePlayback, "aria-label": snapshot.playing ? "Pause playback" : "Play playback", children: snapshot.playing ? _jsx(Symbol, { path: "M7 5h3.5v14H7zM13.5 5H17v14h-3.5z" }) : _jsx(Symbol, { path: "M7 5v14l12-7z" }) }), _jsx("button", { type: "button", className: "timeline-previous ui-icon ui-ghost", "aria-label": stopLabel("Previous", navigation.previous), title: stopLabel("Previous", navigation.previous), disabled: navigation.previous === null, onClick: () => { if (navigation.previous !== null)
55
64
  goToStop(navigation.previous); }, children: _jsx(Symbol, { path: "M6 5h2v14H6zM19 5v14L9 12z" }) }), _jsx("button", { type: "button", className: "timeline-next ui-icon ui-ghost", "aria-label": stopLabel("Next", navigation.next), title: stopLabel("Next", navigation.next), disabled: navigation.next === null, onClick: () => { if (navigation.next !== null)
56
- goToStop(navigation.next); }, children: _jsx(Symbol, { path: "M16 5h2v14h-2zM5 5v14l10-7z" }) })] }), _jsxs("time", { className: "timeline-time", dateTime: timestamp, "aria-label": timestamp, children: [_jsx("span", { className: "timeline-time-full", children: timestamp }), _jsx("span", { className: "timeline-time-short", "aria-hidden": "true", children: timestamp.slice(0, 16).replace("T", " ") })] }), _jsxs("label", { className: "timeline-speed", children: [_jsx("span", { children: "Playback rate" }), _jsx("select", { "aria-label": "Playback speed", title: "Playback speed", value: snapshot.rate, onChange: (event) => onRateChange(Number(event.target.value)), children: speeds.map((speed) => _jsx("option", { value: speed.rate, children: drawer === undefined ? speed.label : formatRateCompact(speed.rate) }, speed.rate)) })] }), scrubber, drawer === undefined && (_jsxs("details", { className: "timeline-event-list", children: [_jsxs("summary", { className: "ui-button", title: "Events: what just happened, what is next, and the full list", children: ["Events ", _jsxs("span", { children: ["(", experience.events.length, ")"] })] }), _jsx(TimelineExpanded, { experience: experience, snapshot: snapshot, onEventSeek: onEventSeek, onEventInfo: onEventInfo, onWindowInfo: onWindowInfo })] }))] }), drawer !== undefined && (_jsx("div", { id: "timeline-drawer", className: "timeline-drawer", role: "region", "aria-label": "Timeline details", "data-open": drawer.open, onClick: (event) => { const closer = event.target.closest("[data-closes-drawer]"); if (closer !== null && closer.tagName !== "SELECT")
57
- drawer.onOpenChange(false); }, children: _jsxs("div", { className: "timeline-drawer-body", children: [_jsxs("div", { className: "timeline-speed-slider", children: [_jsx("span", { "aria-hidden": "true", children: "Playback speed" }), _jsx("input", { type: "range", "aria-label": "Speed slider", "aria-valuetext": speeds[speedIndex]?.label, min: 0, max: speeds.length - 1, step: 1, value: speedIndex, onChange: (event) => { const next = speeds[Number(event.target.value)]; if (next !== undefined)
58
- onRateChange(next.rate); } }), _jsx("output", { children: speeds[speedIndex]?.label })] }), _jsx(TimelineExpanded, { experience: experience, snapshot: snapshot, onEventSeek: onEventSeek, onEventInfo: onEventInfo, onWindowInfo: onWindowInfo })] }) }))] }));
65
+ goToStop(navigation.next); }, children: _jsx(Symbol, { path: "M16 5h2v14h-2zM5 5v14l10-7z" }) })] }), _jsxs("time", { className: "timeline-time", dateTime: timestamp, "aria-label": timestamp, children: [_jsx("span", { className: "timeline-time-full", children: timestamp }), _jsx("span", { className: "timeline-time-short", "aria-hidden": "true", children: timestamp.slice(0, 16).replace("T", " ") })] }), _jsx(SpeedMenu, { speeds: speeds, rate: snapshot.rate, paceAuto: paceAuto, compact: drawer !== undefined, onRateChange: onRateChange }), scrubber, drawer === undefined && (_jsxs("details", { className: "timeline-event-list", children: [_jsxs("summary", { className: "ui-button", title: "Events: what just happened, what is next, and the full list", children: ["Events ", _jsxs("span", { children: ["(", experience.events.length, ")"] })] }), _jsx(TimelineExpanded, { experience: experience, snapshot: snapshot, onEventSeek: onEventSeek, onEventInfo: onEventInfo, onWindowInfo: onWindowInfo })] }))] }), drawer !== undefined && (_jsx("div", { id: "timeline-drawer", className: "timeline-drawer", role: "region", "aria-label": "Timeline details", "data-open": drawer.open, onClick: (event) => { const closer = event.target.closest("[data-closes-drawer]"); if (closer !== null && closer.tagName !== "SELECT")
66
+ drawer.onOpenChange(false); }, children: _jsxs("div", { className: "timeline-drawer-body", children: [_jsxs("div", { className: "timeline-speed-slider", children: [_jsx("span", { "aria-hidden": "true", children: "Playback speed" }), _jsx("input", { type: "range", "aria-label": "Speed slider", "aria-valuetext": speedText, min: 0, max: speeds.length - 1, step: 1, value: speedIndex, onChange: (event) => { const next = speeds[Number(event.target.value)]; if (next !== undefined)
67
+ onRateChange(next.rate); } }), _jsx("output", { children: speedText })] }), _jsx(TimelineExpanded, { experience: experience, snapshot: snapshot, onEventSeek: onEventSeek, onEventInfo: onEventInfo, onWindowInfo: onWindowInfo })] }) }))] }));
59
68
  }
60
69
  /** A 24x24 filled symbol; the button around it carries the accessible name and tooltip. */
61
70
  function Symbol({ path }) {
@@ -1,6 +1,6 @@
1
1
  import type { TimelineEvent } from "../core/events.js";
2
2
  import type { Provenance } from "../core/provenance.js";
3
- import type { TimelineWindow } from "../core/timeWindow.js";
3
+ import type { TimelineWindow, WindowProvenanceSpan } from "../core/timeWindow.js";
4
4
  import type { TimeBounds } from "../core/trajectory.js";
5
5
  import type { BodyFeatureSet } from "./bodyFeatures.js";
6
6
  import type { MoonFamilyList } from "./moonFamilies.js";
@@ -31,6 +31,8 @@ export interface ExperienceObject {
31
31
  readonly description?: string;
32
32
  /** Where this object's data comes from. Anything reconstructed or illustrative must carry one. */
33
33
  readonly provenance?: Provenance;
34
+ /** Provenance by time: while a span covers the clock its provenance shows in place of `provenance`. */
35
+ readonly provenanceSpans?: readonly WindowProvenanceSpan[];
34
36
  /** Labelled values for the info panel (a moon's family, size, discovery and sources). */
35
37
  readonly facts?: readonly {
36
38
  readonly label: string;
@@ -1,4 +1,4 @@
1
- import { provenanceAt, rateAt } from "../core/timeWindow.js";
1
+ import { provenanceAt, rateAt, spanProvenanceAt } from "../core/timeWindow.js";
2
2
  import { findFeature } from "./bodyFeatures.js";
3
3
  import { formatUtcTimestamp, formatWindowRate } from "./timelineModel.js";
4
4
  /** The badge text for each provenance status. The status is always written, never shown by colour alone. */
@@ -22,7 +22,7 @@ export function infoView(experience, target, timeUtcMs) {
22
22
  if (target.kind === "feature")
23
23
  return featureInfo(experience, target);
24
24
  if (target.kind === "object")
25
- return objectInfo(experience, target);
25
+ return objectInfo(experience, target, timeUtcMs);
26
26
  return eventInfo(experience, target);
27
27
  }
28
28
  function windowInfo(experience, target, timeUtcMs) {
@@ -56,16 +56,17 @@ function featureInfo(experience, target) {
56
56
  provenance: provenanceView(set.provenance, set.knownLimitations),
57
57
  };
58
58
  }
59
- function objectInfo(experience, target) {
59
+ function objectInfo(experience, target, timeUtcMs) {
60
60
  const object = experience.objects.find((candidate) => candidate.id === target.id);
61
61
  if (object === undefined)
62
62
  return null;
63
+ const source = (timeUtcMs === undefined || object.provenanceSpans === undefined ? null : spanProvenanceAt(object.provenanceSpans, timeUtcMs)) ?? object.provenance;
63
64
  return {
64
65
  target,
65
66
  title: object.label,
66
67
  ...(object.description === undefined ? {} : { description: object.description }),
67
68
  ...(object.facts === undefined ? {} : { facts: object.facts }),
68
- provenance: object.provenance === undefined ? null : provenanceView(object.provenance, object.knownLimitations),
69
+ provenance: source === undefined ? null : provenanceView(source, object.knownLimitations),
69
70
  };
70
71
  }
71
72
  function eventInfo(experience, target) {
@@ -5,15 +5,14 @@ export interface PlaybackSpeed {
5
5
  readonly label: string;
6
6
  readonly rate: number;
7
7
  }
8
- export declare const DEFAULT_PLAYBACK_SPEEDS: readonly PlaybackSpeed[];
9
8
  export declare const TIMELINE_STEP_MS = 60000;
10
9
  export declare function formatRate(rate: number): string;
11
10
  /** A rate in a few characters for a narrow picker: simulated time per real second ("1 h/s"), or the plain rate when no whole unit fits. */
12
11
  export declare function formatRateCompact(rate: number): string;
13
12
  /** Every rate explains how much simulated time passes during one real second. */
14
13
  export declare function describePlaybackRate(rate: number): string;
15
- /** Existing speeds plus experience rates not already offered, in ascending order. */
16
- export declare function mergeSpeeds(base: readonly PlaybackSpeed[], rates: readonly number[]): readonly PlaybackSpeed[];
14
+ /** The speeds the timeline offers: exactly the experience's rates (no speed is added), ascending, each once. */
15
+ export declare function speedsOf(rates: readonly number[]): readonly PlaybackSpeed[];
17
16
  export interface EventContext {
18
17
  /** Most recent event at or before the current time. */
19
18
  readonly current: TimelineEvent | null;
@@ -1,10 +1,4 @@
1
1
  import { rateAt } from "../core/timeWindow.js";
2
- export const DEFAULT_PLAYBACK_SPEEDS = [
3
- { label: describePlaybackRate(1), rate: 1 },
4
- { label: describePlaybackRate(3_600), rate: 3_600 },
5
- { label: describePlaybackRate(86_400), rate: 86_400 },
6
- { label: describePlaybackRate(604_800), rate: 604_800 },
7
- ];
8
2
  export const TIMELINE_STEP_MS = 60_000;
9
3
  export function formatRate(rate) {
10
4
  return `${rate.toLocaleString("en-US")}×`;
@@ -41,11 +35,9 @@ export function describePlaybackRate(rate) {
41
35
  return `${formatRate(rate)} — real time`;
42
36
  return `${formatRate(rate)} — ${formatSimulatedDuration(rate)} per real second`;
43
37
  }
44
- /** Existing speeds plus experience rates not already offered, in ascending order. */
45
- export function mergeSpeeds(base, rates) {
46
- const extra = rates.filter((rate) => !base.some((speed) => speed.rate === rate))
47
- .map((rate) => ({ label: describePlaybackRate(rate), rate }));
48
- return [...base, ...extra].sort((a, b) => a.rate - b.rate);
38
+ /** The speeds the timeline offers: exactly the experience's rates (no speed is added), ascending, each once. */
39
+ export function speedsOf(rates) {
40
+ return [...new Set(rates)].sort((a, b) => a - b).map((rate) => ({ label: describePlaybackRate(rate), rate }));
49
41
  }
50
42
  /** Finds the story event just reached and the next event without changing the event model. */
51
43
  export function eventContextAt(events, timeUtcMs) {
@@ -0,0 +1,9 @@
1
+ import { Scene } from "../api/scene.js";
2
+ export declare const JOURNEY_LAUNCH_UTC_MS: number;
3
+ export declare const JOURNEY_JUPITER_UTC_MS: number;
4
+ export declare const JOURNEY_SATURN_UTC_MS: number;
5
+ export declare const JOURNEY_END_UTC_MS: number;
6
+ /** The distance the journey ends at, AU (I-114). */
7
+ export declare const JOURNEY_END_AU = 170;
8
+ /** The made-up journey as a Scene. Needs the planet series loaded (it reads Earth, Jupiter and Saturn from the Sun). */
9
+ export declare function buildSyntheticJourneyScene(): Scene;
@@ -0,0 +1,75 @@
1
+ // O-047 T-203: a made-up probe journey from 1977 out to 170 AU, built only through the public Scene API (ARCH-01: no real mission, name or data).
2
+ // It leaves Earth's place on 5 September 1977, passes Jupiter on 5 March 1979 and Saturn on 12 November 1980, then flies straight out to 170 AU by 1 January 2026.
3
+ // In one scene it proves: moons at historical dates (the data packages are handed to `toDefinition`), Saturn's orbit line, paced playback, provenance that changes along the path,
4
+ // the opening selection and a camera that zooms out to the whole path (I-114). The planets' places come from the planet series, so the series must be loaded before this builds (the site does).
5
+ import { Scene } from "../api/scene.js";
6
+ import { callisto, dione, earth, enceladus, europa, ganymede, iapetus, io, jupiter, mimas, rhea, saturn, sun, tethys, titan } from "../api/bodies.js";
7
+ import { solarSystemScale } from "../core/scalePolicy.js";
8
+ const DAY_MS = 86_400_000;
9
+ const YEAR_S = 31_557_600;
10
+ const AU_KM = 149_597_870.7;
11
+ export const JOURNEY_LAUNCH_UTC_MS = Date.UTC(1977, 8, 5);
12
+ export const JOURNEY_JUPITER_UTC_MS = Date.UTC(1979, 2, 5);
13
+ export const JOURNEY_SATURN_UTC_MS = Date.UTC(1980, 10, 12);
14
+ export const JOURNEY_END_UTC_MS = Date.UTC(2026, 0, 1);
15
+ /** The distance the journey ends at, AU (I-114). */
16
+ export const JOURNEY_END_AU = 170;
17
+ /** How far past each giant planet the made-up probe passes, km (outward from the Sun). */
18
+ const PASS_KM = 1_500_000;
19
+ const length = (a) => Math.hypot(a[0], a[1], a[2]);
20
+ const mix = (a, b, f) => [a[0] + (b[0] - a[0]) * f, a[1] + (b[1] - a[1]) * f, a[2] + (b[2] - a[2]) * f];
21
+ const scaled = (a, k) => [a[0] * k, a[1] * k, a[2] * k];
22
+ const made = (stretch, accuracy, sourceType) => ({ sourceType, sources: [`Made up for the journey test (${stretch}); not a real spacecraft`], accuracy, notes: "Exists to prove a long recorded path, moons at their dates and paced playback." });
23
+ /** The made-up journey as a Scene. Needs the planet series loaded (it reads Earth, Jupiter and Saturn from the Sun). */
24
+ export function buildSyntheticJourneyScene() {
25
+ const scene = new Scene().addBody(sun).addBody(earth, { enlarge: 60, orbit: true }).addBody(jupiter, { orbit: true }).addBody(io, { orbit: true }).addBody(europa).addBody(ganymede).addBody(callisto)
26
+ .addBody(saturn, { orbit: true }).addBody(mimas).addBody(enceladus).addBody(tethys).addBody(dione).addBody(rhea).addBody(titan).addBody(iapetus).setTime(JOURNEY_LAUNCH_UTC_MS);
27
+ const place = (id, time) => [...scene.stateOf(id, time).positionKm];
28
+ const pass = (id, time) => { const p = place(id, time); return scaled(p, 1 + PASS_KM / length(p)); };
29
+ const launch = place("earth", JOURNEY_LAUNCH_UTC_MS);
30
+ const atJupiter = pass("jupiter", JOURNEY_JUPITER_UTC_MS);
31
+ const atSaturn = pass("saturn", JOURNEY_SATURN_UTC_MS);
32
+ const out = scaled(atSaturn, (JOURNEY_END_AU * AU_KM) / length(atSaturn));
33
+ const leg = (from, to, t0, t1, stepMs) => {
34
+ const n = Math.max(1, Math.round((t1 - t0) / stepMs));
35
+ return Array.from({ length: n }, (_, i) => ({ time: Math.round(t0 + ((t1 - t0) * i) / n), positionKm: mix(from, to, i / n) }));
36
+ };
37
+ const samples = [
38
+ ...leg(launch, atJupiter, JOURNEY_LAUNCH_UTC_MS, JOURNEY_JUPITER_UTC_MS, 15 * DAY_MS),
39
+ ...leg(atJupiter, atSaturn, JOURNEY_JUPITER_UTC_MS, JOURNEY_SATURN_UTC_MS, 15 * DAY_MS),
40
+ ...leg(atSaturn, out, JOURNEY_SATURN_UTC_MS, JOURNEY_END_UTC_MS, 365.25 * DAY_MS),
41
+ { time: JOURNEY_END_UTC_MS, positionKm: out },
42
+ ];
43
+ scene.addTrajectory({
44
+ id: "traveller",
45
+ label: "Made-up traveller",
46
+ samples,
47
+ center: "sun",
48
+ lineFixedTo: "sun",
49
+ provenance: made("whole journey", "None claimed.", "illustrative"),
50
+ provenanceSpans: [
51
+ { start: JOURNEY_LAUNCH_UTC_MS, end: JOURNEY_SATURN_UTC_MS + 90 * DAY_MS, provenance: made("planet passes", "None claimed. Straight legs between two planets' places.", "reconstructed") },
52
+ { start: JOURNEY_SATURN_UTC_MS + 90 * DAY_MS, end: JOURNEY_END_UTC_MS, provenance: made("outbound cruise", "None claimed. A straight line out to 170 AU.", "illustrative") },
53
+ ],
54
+ description: "An invented probe that leaves Earth in 1977, passes Jupiter in 1979 and Saturn in 1980, then flies straight out to 170 AU by 2026.",
55
+ knownLimitations: ["Made up; not a real spacecraft.", "Straight legs: it ignores gravity and does not follow any real trajectory."],
56
+ anchors: [{ id: "traveller-jupiter", time: JOURNEY_JUPITER_UTC_MS }, { id: "traveller-saturn", time: JOURNEY_SATURN_UTC_MS }],
57
+ });
58
+ scene.addEvents([
59
+ { id: "traveller-jupiter", label: "Made-up pass of Jupiter", time: JOURNEY_JUPITER_UTC_MS, type: "encounter" },
60
+ { id: "traveller-saturn", label: "Made-up pass of Saturn", time: JOURNEY_SATURN_UTC_MS, type: "encounter" },
61
+ ], { provenance: { sourceType: "illustrative", sources: ["Made up"], accuracy: "None claimed.", notes: "Not real passes." } });
62
+ scene.setTimeline({
63
+ start: JOURNEY_LAUNCH_UTC_MS,
64
+ end: JOURNEY_END_UTC_MS,
65
+ rates: [DAY_MS / 1000, 30 * DAY_MS / 1000, YEAR_S],
66
+ rate: 30 * DAY_MS / 1000,
67
+ pacing: [
68
+ { near: { type: "encounter", within: 30 * DAY_MS / 1000 }, rate: DAY_MS / 1000 },
69
+ { from: JOURNEY_SATURN_UTC_MS + 120 * DAY_MS, to: JOURNEY_END_UTC_MS, rate: YEAR_S },
70
+ ],
71
+ });
72
+ scene.setScale(solarSystemScale);
73
+ scene.camera.follow("traveller", { distance: 20_000 });
74
+ return scene;
75
+ }