astraeus 0.1.1 → 0.2.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 (77) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +39 -6
  3. package/package.json +9 -6
  4. package/src/api/AstraeusScene.d.ts +27 -0
  5. package/src/api/AstraeusScene.js +38 -0
  6. package/src/api/activity.d.ts +50 -0
  7. package/src/api/activity.js +62 -0
  8. package/src/api/bodies.d.ts +24 -0
  9. package/src/api/bodies.js +24 -0
  10. package/src/api/errors.d.ts +1 -1
  11. package/src/api/group.d.ts +83 -0
  12. package/src/api/group.js +121 -0
  13. package/src/api/index.d.ts +5 -1
  14. package/src/api/index.js +2 -1
  15. package/src/api/mount.d.ts +10 -1
  16. package/src/api/mount.js +12 -3
  17. package/src/api/prepared.d.ts +10 -0
  18. package/src/api/prepared.js +5 -0
  19. package/src/api/scene.d.ts +121 -8
  20. package/src/api/scene.js +464 -57
  21. package/src/api/story.d.ts +63 -0
  22. package/src/api/story.js +52 -0
  23. package/src/api/sunOrbit.d.ts +14 -0
  24. package/src/api/sunOrbit.js +61 -0
  25. package/src/api/switches.d.ts +14 -0
  26. package/src/api/switches.js +19 -0
  27. package/src/api/time.d.ts +4 -0
  28. package/src/api/time.js +8 -0
  29. package/src/app/App.js +35 -17
  30. package/src/app/AstraeusScene.d.ts +1 -1
  31. package/src/app/DebugOverlay.d.ts +3 -52
  32. package/src/app/DebugOverlay.js +2 -29
  33. package/src/app/PanelLoadBoundary.d.ts +18 -0
  34. package/src/app/PanelLoadBoundary.js +17 -0
  35. package/src/app/debugReadout.d.ts +53 -0
  36. package/src/app/debugReadout.js +30 -0
  37. package/src/app/developerPanels.d.ts +6 -0
  38. package/src/app/developerPanels.js +11 -0
  39. package/src/app/displaySwitches.d.ts +54 -0
  40. package/src/app/displaySwitches.js +48 -0
  41. package/src/app/experienceDefinition.d.ts +5 -1
  42. package/src/app/listSwitch.d.ts +16 -0
  43. package/src/{experiences/showers/showerChoice.js → app/listSwitch.js} +1 -9
  44. package/src/app/metricReadouts.d.ts +1 -1
  45. package/src/app/metricReadouts.js +1 -1
  46. package/src/app/openClock.d.ts +7 -0
  47. package/src/app/openClock.js +14 -0
  48. package/src/app/sceneContentsHooks.d.ts +3 -3
  49. package/src/app/sceneDebug.d.ts +1 -1
  50. package/src/app/sceneDebug.js +1 -1
  51. package/src/app/skyModel.js +2 -0
  52. package/src/app/trackedMetrics.d.ts +53 -0
  53. package/src/{experiences/apollo11/spacecraftMetrics.js → app/trackedMetrics.js} +40 -56
  54. package/src/assets/licence.d.ts +1 -0
  55. package/src/core/bodies/index.d.ts +3 -0
  56. package/src/core/bodies/index.js +3 -1
  57. package/src/core/planetSeries.d.ts +2 -0
  58. package/src/core/planetSeries.js +4 -0
  59. package/src/core/provenance.d.ts +2 -1
  60. package/src/core/scalePolicy.d.ts +3 -0
  61. package/src/core/scalePolicy.js +2 -0
  62. package/src/core/state.d.ts +1 -0
  63. package/src/shell/AstraeusShell.d.ts +4 -1
  64. package/src/shell/AstraeusShell.js +7 -3
  65. package/src/shell/DisplaySwitches.d.ts +16 -0
  66. package/src/shell/DisplaySwitches.js +31 -0
  67. package/src/shell/TimelineBar.css +4 -0
  68. package/src/shell/TopBar.css +20 -0
  69. package/src/shell/TopBar.d.ts +4 -1
  70. package/src/shell/TopBar.js +3 -2
  71. package/src/shell/experience.d.ts +2 -0
  72. package/src/shell/phone.css +3 -0
  73. package/src/shell/topBarIcons.d.ts +1 -0
  74. package/src/shell/topBarIcons.js +1 -0
  75. package/src/synthetic/syntheticDefinition.js +3 -3
  76. package/src/experiences/apollo11/spacecraftMetrics.d.ts +0 -34
  77. package/src/experiences/showers/showerChoice.d.ts +0 -25
@@ -42,6 +42,10 @@ function initialObjectId(experience, timeUtcMs) {
42
42
  function ownStorySettings(storySet) {
43
43
  return { autoOpen: storySet?.autoOpen ?? false, pauseSeconds: storySet?.pauseSeconds ?? 0 };
44
44
  }
45
+ /** The timeline bar, or nothing when the experience says it has no timeline. */
46
+ function ShellTimeline({ hidden, ...bar }) {
47
+ return hidden ? null : _jsx(TimelineBar, { ...bar });
48
+ }
45
49
  /** The wide-screen moons toggle and the sheet it opens under the toolbar. */
46
50
  function MoonsSheet({ planetLabel, open, onToggle, onClose, children }) {
47
51
  return (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", className: "moons-toggle ui-pill", "aria-expanded": open, "aria-controls": "moons-panel", onClick: onToggle, children: [planetLabel, " moons"] }), _jsx("aside", { id: "moons-panel", className: "moons-sheet", "data-open": open, "aria-label": "Moons by family", onKeyDown: (event) => { if (event.key === "Escape")
@@ -66,7 +70,7 @@ function infoContent(experience, info, selectedObjectId, timeUtcMs, metricsFor)
66
70
  return { view, metrics };
67
71
  }
68
72
  /** Canvas-first layout shared by astronomy experiences. Scene and diagnostics stay app-owned. */
69
- export function AstraeusShell({ experience, snapshot, developerMode, onDeveloperModeChange, onTogglePlayback, onRateChange, onSeek, onCameraRequest, onSelectionChange, scaleId, onScaleChange, scaleChoices, switcher, metricsFor, developerTools, storyPanelSettings, timelineGlow, phoneLayout = DEFAULT_PHONE_LAYOUT, highlightedFamily = null, onHighlightFamily, onSetPlaying, panelRequest, onOpenPanelChange, featureRequest, onOpenFeatureChange, pickRequest, children, }) {
73
+ 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, }) {
70
74
  const [selectedObjectId, setSelectedObjectId] = useState(() => initialObjectId(experience, snapshot.timeUtcMs));
71
75
  const phone = usePhone();
72
76
  /** Fixed for the page: a frame does not appear or vanish while the app runs. */
@@ -217,7 +221,7 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
217
221
  useEffect(() => { if (info !== null)
218
222
  setMoonsOpen(false); }, [info]);
219
223
  const selectedLabel = objectLabelOr(experience, selectedObjectId, "Controls");
220
- 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 }));
224
+ 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 }));
221
225
  const moonPanel = experience.moonFamilies === undefined ? null : (_jsx(MoonFamilyPanel, { list: experience.moonFamilies, highlightedFamily: highlightedFamily, onHighlight: (id) => onHighlightFamily?.(id), onSelectMoon: chooseMoon }));
222
- return (_jsxs("main", { className: "astraeus-shell", ref: root, "data-phone": phone, "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(TimelineBar, { 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 })] }));
226
+ 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 })] }));
223
227
  }
@@ -0,0 +1,16 @@
1
+ /** One display switch a story placed: where it shows, and whether it is on now. */
2
+ export interface DisplaySwitchItem {
3
+ readonly id: string;
4
+ readonly label: string;
5
+ /** "top-bar": its own button in the bar; "panel": a row in the switch panel opened from the bar. */
6
+ readonly place: "top-bar" | "panel";
7
+ readonly on: boolean;
8
+ readonly onToggle: () => void;
9
+ }
10
+ /**
11
+ * The switches a story placed. Top-bar ones are buttons in the bar (and in the phone drawer's grid); panel ones sit in one small panel opened by a "Display" button
12
+ * beside them. Nothing placed: nothing drawn, so the bar is exactly as it was. The panel closes on an outside press or Escape.
13
+ */
14
+ export declare function DisplaySwitches({ switches }: {
15
+ readonly switches: readonly DisplaySwitchItem[];
16
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useId, useRef, useState } from "react";
3
+ import { ButtonText, OrbitIcon, SwitchesIcon } from "./topBarIcons.js";
4
+ /**
5
+ * The switches a story placed. Top-bar ones are buttons in the bar (and in the phone drawer's grid); panel ones sit in one small panel opened by a "Display" button
6
+ * beside them. Nothing placed: nothing drawn, so the bar is exactly as it was. The panel closes on an outside press or Escape.
7
+ */
8
+ export function DisplaySwitches({ switches }) {
9
+ const barSwitches = switches.filter((item) => item.place === "top-bar");
10
+ const panelSwitches = switches.filter((item) => item.place === "panel");
11
+ if (switches.length === 0)
12
+ return null;
13
+ return (_jsxs("section", { className: "display-switches", role: "group", "aria-label": "Display switches", children: [barSwitches.map((item) => (_jsxs("button", { type: "button", className: "display-switch top-bar-button ui-icon", "aria-label": item.label, title: item.label, "aria-pressed": item.on, "data-display-switch": item.id, "data-closes-drawer": "", onClick: item.onToggle, children: [item.id === "orbitLines" ? _jsx(OrbitIcon, {}) : _jsx(SwitchesIcon, {}), _jsx(ButtonText, { children: item.label })] }, item.id))), panelSwitches.length > 0 && _jsx(SwitchPanel, { switches: panelSwitches })] }));
14
+ }
15
+ function SwitchPanel({ switches }) {
16
+ const [open, setOpen] = useState(false);
17
+ const panelId = useId();
18
+ const root = useRef(null);
19
+ useEffect(() => {
20
+ if (!open)
21
+ return undefined;
22
+ const outside = (event) => { if (!root.current?.contains(event.target))
23
+ setOpen(false); };
24
+ const escape = (event) => { if (event.key === "Escape")
25
+ setOpen(false); };
26
+ document.addEventListener("pointerdown", outside);
27
+ document.addEventListener("keydown", escape);
28
+ return () => { document.removeEventListener("pointerdown", outside); document.removeEventListener("keydown", escape); };
29
+ }, [open]);
30
+ return (_jsxs("div", { className: "switch-panel-host", ref: root, children: [_jsxs("button", { type: "button", className: "switch-panel-toggle top-bar-button ui-icon", "aria-label": "Switch panel", title: "Switch panel", "aria-expanded": open, "aria-controls": panelId, onClick: () => setOpen(!open), children: [_jsx(SwitchesIcon, {}), _jsx(ButtonText, { children: "Display" })] }), _jsx("div", { id: panelId, className: "switch-panel", role: "group", "aria-label": "Switches in the panel", hidden: !open, children: switches.map((item) => (_jsx("button", { type: "button", className: "switch-panel-row ui-row", "aria-pressed": item.on, "data-display-switch": item.id, onClick: item.onToggle, children: item.label }, item.id))) })] }));
31
+ }
@@ -118,3 +118,7 @@
118
118
  @media (prefers-reduced-motion: reduce) {
119
119
  .timeline-bar { scroll-behavior: auto; transition: none !important; }
120
120
  }
121
+
122
+ /* No timeline (experience.hideTimeline): nothing sits at the bottom, so nothing is reserved for it on a wide or a phone screen. */
123
+ main.astraeus-shell[data-timeline-hidden="true"] { --timeline-space: 0px; }
124
+ main.astraeus-shell[data-timeline-hidden="true"] .shell-top { --shell-timeline-space: 0px; }
@@ -72,3 +72,23 @@
72
72
  @media (min-width: 701px) and (max-width: 900px) {
73
73
  .shell-toolbar { max-width: calc(100vw - 72px); }
74
74
  }
75
+
76
+ /* Display switches a story placed: buttons in the bar, and one small panel opened from a Display button (same look as the scale menu). */
77
+ .top-bar .display-switches,
78
+ .top-bar .switch-panel-host { display: contents; }
79
+ .switch-panel {
80
+ position: absolute;
81
+ z-index: 6;
82
+ top: calc(100% + 8px);
83
+ right: 0;
84
+ display: flex;
85
+ flex-direction: column;
86
+ gap: 4px;
87
+ min-width: 190px;
88
+ padding: 6px;
89
+ border: 1px solid var(--ui-border, rgba(240, 230, 218, .18));
90
+ border-radius: 12px;
91
+ background: rgba(13, 13, 13, .97);
92
+ box-shadow: 0 8px 24px rgba(0, 0, 0, .42);
93
+ }
94
+ .switch-panel[hidden] { display: none !important; }
@@ -1,4 +1,5 @@
1
1
  import type { ExperienceCameraPreset, ExperienceConfig } from "./experience.js";
2
+ import { type DisplaySwitchItem } from "./DisplaySwitches.js";
2
3
  import { type ExperienceSwitch } from "./SwitchControl.js";
3
4
  import type { ScaleChoice, ScaleId } from "./scaleModel.js";
4
5
  import "./TopBar.css";
@@ -16,13 +17,15 @@ interface Props {
16
17
  readonly scaleChoices?: readonly ScaleChoice[];
17
18
  /** A choice between versions of the experience, shown first in the bar; absent: none. */
18
19
  readonly switcher?: ExperienceSwitch;
20
+ /** Display switches a story placed in the bar or its panel; absent or empty: none, the bar as it was. */
21
+ readonly displaySwitches?: readonly DisplaySwitchItem[];
19
22
  }
20
23
  interface DeveloperProps {
21
24
  readonly developerMode: boolean;
22
25
  readonly onDeveloperModeChange: (enabled: boolean) => void;
23
26
  }
24
27
  /** The single compact bar: body picker, Info, camera buttons and Scale in one row. */
25
- export declare function TopBar({ scaleId, onScaleChange, scaleChoices, switcher, ...objectControls }: Props): import("react").JSX.Element;
28
+ export declare function TopBar({ scaleId, onScaleChange, scaleChoices, switcher, displaySwitches, ...objectControls }: Props): import("react").JSX.Element;
26
29
  /** Developer mode stays public, as a cog on its own at the top right of the shell. */
27
30
  export declare function DeveloperToggle({ developerMode, onDeveloperModeChange }: DeveloperProps): import("react").JSX.Element;
28
31
  export {};
@@ -1,12 +1,13 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ObjectControls } from "./ObjectControls.js";
3
3
  import { ScaleControl } from "./ScaleControl.js";
4
+ import { DisplaySwitches } from "./DisplaySwitches.js";
4
5
  import { SwitchControl } from "./SwitchControl.js";
5
6
  import { CogIcon } from "./topBarIcons.js";
6
7
  import "./TopBar.css";
7
8
  /** The single compact bar: body picker, Info, camera buttons and Scale in one row. */
8
- export function TopBar({ scaleId, onScaleChange, scaleChoices, switcher, ...objectControls }) {
9
- return (_jsx("div", { className: "shell-toolbar", children: _jsxs("div", { className: "top-bar", children: [switcher !== undefined && switcher.options.length > 1 && (_jsxs(_Fragment, { children: [_jsx(SwitchControl, { choice: switcher }), _jsx("span", { className: "top-bar-divider", "aria-hidden": "true" })] })), _jsx(ObjectControls, { ...objectControls }), _jsx("span", { className: "top-bar-divider", "aria-hidden": "true" }), _jsx(ScaleControl, { scaleId: scaleId, onScaleChange: onScaleChange, choices: scaleChoices })] }) }));
9
+ export function TopBar({ scaleId, onScaleChange, scaleChoices, switcher, displaySwitches = [], ...objectControls }) {
10
+ return (_jsx("div", { className: "shell-toolbar", children: _jsxs("div", { className: "top-bar", children: [switcher !== undefined && switcher.options.length > 1 && (_jsxs(_Fragment, { children: [_jsx(SwitchControl, { choice: switcher }), _jsx("span", { className: "top-bar-divider", "aria-hidden": "true" })] })), _jsx(ObjectControls, { ...objectControls }), _jsx("span", { className: "top-bar-divider", "aria-hidden": "true" }), _jsx(ScaleControl, { scaleId: scaleId, onScaleChange: onScaleChange, choices: scaleChoices }), displaySwitches.length > 0 && (_jsxs(_Fragment, { children: [_jsx("span", { className: "top-bar-divider", "aria-hidden": "true" }), _jsx(DisplaySwitches, { switches: displaySwitches })] }))] }) }));
10
11
  }
11
12
  /** Developer mode stays public, as a cog on its own at the top right of the shell. */
12
13
  export function DeveloperToggle({ developerMode, onDeveloperModeChange }) {
@@ -61,6 +61,8 @@ export interface ExperienceConfig {
61
61
  readonly windows?: readonly TimelineWindow[];
62
62
  readonly window: TimeBounds;
63
63
  readonly rates: readonly number[];
64
+ /** True draws no timeline bar (and no phone timeline drawer or reserved space); the clock then runs or stays frozen as the definition says. Absent: the bar is shown. */
65
+ readonly hideTimeline?: boolean;
64
66
  /** Short story panels that open as playback reaches their time; see `parseStoryPanels`. Omit for an experience with none. */
65
67
  readonly storyPanels?: StoryPanelSet;
66
68
  /** A planet's moons by family for the sliding moon panel; omit for an experience with none. Every moon listed must also be an object. */
@@ -76,6 +76,7 @@
76
76
  /* The object list takes the first row, leaving room for the cog at the right. */
77
77
  [data-phone="true"] .controls-drawer .object-picker { grid-column: 1 / -1; width: calc(100% - 52px); max-width: none; }
78
78
  /* Each button: icon over a short word. */
79
+ [data-phone="true"] .controls-drawer .display-switches { display: contents; }
79
80
  [data-phone="true"] .controls-drawer .top-bar-button { width: auto; flex-direction: column; gap: 2px; padding: 0 4px; }
80
81
  [data-phone="true"] .controls-drawer .top-bar-button-text { display: block; max-width: 100%; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
81
82
  [data-phone="true"] .controls-drawer .switch-control { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 8px; }
@@ -83,6 +84,8 @@
83
84
  [data-phone="true"] .controls-drawer .scale-toggle > span { font-size: 11px; }
84
85
  [data-phone="true"] .controls-drawer .scale-menu,
85
86
  [data-phone="true"] .controls-drawer .scale-explanation-panel { top: calc(100% + 6px); right: auto; left: 0; width: min(320px, calc(100vw - 32px)); }
87
+ /* The switch panel stays clear of the cog's column (60 px at the right) and the drawer's edge. */
88
+ [data-phone="true"] .controls-drawer .switch-panel { top: calc(100% + 6px); right: auto; left: 0; width: min(260px, calc(100vw - 84px)); min-width: 0; }
86
89
  [data-phone="true"] .controls-drawer .top-bar { position: relative; }
87
90
  [data-phone="true"] .controls-drawer .scale-control { position: static; }
88
91
 
@@ -4,6 +4,7 @@ export declare const FocusIcon: () => import("react").JSX.Element;
4
4
  export declare const OverviewIcon: () => import("react").JSX.Element;
5
5
  export declare const FollowIcon: () => import("react").JSX.Element;
6
6
  export declare const OrbitIcon: () => import("react").JSX.Element;
7
+ export declare const SwitchesIcon: () => import("react").JSX.Element;
7
8
  export declare const ScaleIcon: () => import("react").JSX.Element;
8
9
  export declare const ChevronIcon: () => import("react").JSX.Element;
9
10
  export declare const CogIcon: () => import("react").JSX.Element;
@@ -8,6 +8,7 @@ export const FocusIcon = () => _jsxs(Icon, { children: [_jsx("circle", { cx: "10
8
8
  export const OverviewIcon = () => _jsx(Icon, { children: _jsx("path", { d: "M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5" }) });
9
9
  export const FollowIcon = () => _jsxs(Icon, { children: [_jsx("circle", { cx: "12", cy: "12", r: "4" }), _jsx("path", { d: "M12 3v4M12 17v4M3 12h4M17 12h4" })] });
10
10
  export const OrbitIcon = () => _jsxs(Icon, { children: [_jsx("ellipse", { cx: "12", cy: "12", rx: "9", ry: "5", transform: "rotate(-20 12 12)" }), _jsx("circle", { cx: "12", cy: "12", r: "1.4", fill: "currentColor" })] });
11
+ export const SwitchesIcon = () => _jsxs(Icon, { children: [_jsx("path", { d: "M4 8h10M18 8h2M4 16h2M10 16h10" }), _jsx("circle", { cx: "16", cy: "8", r: "2" }), _jsx("circle", { cx: "8", cy: "16", r: "2" })] });
11
12
  export const ScaleIcon = () => _jsxs(Icon, { size: 16, children: [_jsx("circle", { cx: "7", cy: "12", r: "2.5" }), _jsx("circle", { cx: "16", cy: "12", r: "5.5" })] });
12
13
  export const ChevronIcon = () => _jsx("svg", { width: "12", height: "12", 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" }) });
13
14
  export const CogIcon = () => (_jsxs(Icon, { size: 19, strokeWidth: 1.7, children: [_jsx("circle", { cx: "12", cy: "12", r: "3" }), _jsx("path", { d: "M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z" })] }));
@@ -1,5 +1,5 @@
1
- import { bodyMetrics, resolverTrajectory } from "../app/bodyMetrics.js";
2
- import { createTrackedMetrics } from "../experiences/apollo11/spacecraftMetrics.js";
1
+ import { bodyMetrics } from "../app/bodyMetrics.js";
2
+ import { createReadoutMetrics } from "../app/trackedMetrics.js";
3
3
  import { earthMoonSystem } from "../assets/compositions.js";
4
4
  import { createEvents } from "../core/events.js";
5
5
  import { createProvenance } from "../core/provenance.js";
@@ -164,7 +164,7 @@ export const syntheticDefinition = {
164
164
  trackedBodies: [marker],
165
165
  createMetrics: ({ resolver }) => {
166
166
  const catalogued = bodyMetrics(resolver, earthMoonSystem.bodies, ["distance"]);
167
- const tracked = createTrackedMetrics({ bodies: [marker], moon: resolverTrajectory(resolver, "moon", "earth") });
167
+ const tracked = createReadoutMetrics([{ body: marker, readouts: [{ kind: "range", marker: "moon" }, { kind: "speed" }, { kind: "distance", to: "moon" }] }], resolver);
168
168
  return (objectId, timeUtcMs) => objectId === marker.id ? [...tracked(objectId, timeUtcMs), contactRateMetric(timeUtcMs)] : catalogued(objectId, timeUtcMs);
169
169
  },
170
170
  };
@@ -1,34 +0,0 @@
1
- import type { CenteredPosition } from "../../core/state.js";
2
- import type { Trajectory } from "../../core/trajectory.js";
3
- import { type TrackedBody, type TrackedReadout } from "../../app/mission.js";
4
- import type { AltitudeMetric, CoordinatesMetric, DistanceMetric, Metric, MetricReference, RelativeDistanceMetric, SpeedMetric, UncertaintyMetric } from "../../shell/metrics.js";
5
- /**
6
- * Highest speed at the body's NASA source anchors, the honest top of its speed gauge. Anchors rather
7
- * than reconstructed samples, because a smoothed join can carry a known non-physical spike (I-008).
8
- * Null when the body has no anchors or the trajectory carries no velocity.
9
- */
10
- export declare function peakAnchorSpeedKmS(body: TrackedBody): number | null;
11
- /** A reference marker only when it is measured from the same centre and in the same frame as the value. */
12
- export declare function referenceInSameFrame(label: string, row: Pick<TrackedReadout, "frame" | "center">, reference: CenteredPosition | null): MetricReference | null;
13
- export declare function spacecraftRangeMetric(row: TrackedReadout, moon: MetricReference | null): DistanceMetric;
14
- export declare function spacecraftSpeedMetric(row: TrackedReadout, peakKmS: number | null): SpeedMetric;
15
- /** Centre-to-centre distance from the spacecraft to the Moon, drawn in Moon radii. */
16
- export declare function spacecraftMoonMetric(row: TrackedReadout, moon: CenteredPosition | null): RelativeDistanceMetric;
17
- /**
18
- * Height above the mean radius of whichever of Earth and the Moon is closer to the surface.
19
- * Mean radius, not terrain: on the lunar surface the value can be negative.
20
- */
21
- export declare function spacecraftAltitudeMetric(row: TrackedReadout, moon: CenteredPosition | null): AltitudeMetric;
22
- export declare function spacecraftPositionMetric(row: TrackedReadout, moon: CenteredPosition | null): CoordinatesMetric;
23
- /** The data's own discrepancy for the segment at this time, compared with the vehicle's largest. */
24
- export declare function spacecraftDiscrepancyMetric(body: TrackedBody, timeUtcMs: number): UncertaintyMetric;
25
- export interface TrackedMetricSources {
26
- readonly bodies: readonly TrackedBody[];
27
- /** Earth-centred Moon trajectory, the reference every Earth-centred tracked body is measured against. */
28
- readonly moon: Trajectory;
29
- }
30
- /**
31
- * The info panel's range, speed and Moon-distance rows for one tracked body, from State only: scale policy and camera never
32
- * enter. A tracked body outside its bounds and any other id have none. The catalogued bodies' own rows are `bodyMetrics`'.
33
- */
34
- export declare function createTrackedMetrics({ bodies, moon }: TrackedMetricSources): (objectId: string, timeUtcMs: number) => readonly Metric[];
@@ -1,25 +0,0 @@
1
- import type { ExperienceSwitch } from "../../shell/SwitchControl.js";
2
- /** The address parameter that names the shower (`?experience=showers&shower=<name>`). */
3
- export declare const SHOWER_PARAM = "shower";
4
- /** The label the switch carries as its accessible name. */
5
- export declare const SHOWER_SWITCH_LABEL = "Shower";
6
- /** One shower the experience can open: its settings file's name, its label, and its place in the switch (the lowest `order` is the default). */
7
- export interface ShowerEntry {
8
- readonly name: string;
9
- readonly label: string;
10
- readonly order: number;
11
- }
12
- /** The entry to open (the requested one when it exists, else `preferred`, else the first by `order`, then name) and the switch listing every entry. Undefined when there are none. Shared by the experiences that offer such a switch. */
13
- export declare function chooseSwitch<T extends ShowerEntry>(entries: readonly T[], requested: string | null, switchOf: {
14
- readonly label: string;
15
- readonly param: string;
16
- readonly keep?: readonly string[];
17
- }, preferred?: string): {
18
- readonly name: string;
19
- readonly switcher: ExperienceSwitch;
20
- } | undefined;
21
- /** The shower to open (the requested one when it exists, else the first by `order`, then name) and the switch listing every shower. Undefined when there are no showers. */
22
- export declare function chooseShower(entries: readonly ShowerEntry[], requested: string | null): {
23
- readonly name: string;
24
- readonly switcher: ExperienceSwitch;
25
- } | undefined;