astraeus 0.9.0 → 0.9.2

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 (84) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +102 -35
  3. package/package.json +1 -1
  4. package/src/api/assembleScene.js +5 -5
  5. package/src/api/errors.d.ts +1 -1
  6. package/src/api/index.d.ts +2 -2
  7. package/src/api/look.d.ts +14 -0
  8. package/src/api/lookInput.d.ts +1 -1
  9. package/src/api/lookInput.js +6 -2
  10. package/src/api/planBodies.d.ts +2 -1
  11. package/src/api/planBodies.js +6 -1
  12. package/src/api/planCamera.d.ts +19 -2
  13. package/src/api/planCamera.js +45 -6
  14. package/src/api/planPaths.d.ts +2 -0
  15. package/src/api/planPaths.js +13 -8
  16. package/src/api/planStory.d.ts +3 -1
  17. package/src/api/planStory.js +5 -0
  18. package/src/api/planTimeline.d.ts +1 -1
  19. package/src/api/planTimeline.js +10 -1
  20. package/src/api/planViews.d.ts +3 -1
  21. package/src/api/planViews.js +4 -0
  22. package/src/api/providerPathTimes.d.ts +10 -0
  23. package/src/api/providerPathTimes.js +109 -0
  24. package/src/api/scene.d.ts +17 -5
  25. package/src/api/scene.js +16 -2
  26. package/src/api/sceneReads.d.ts +31 -1
  27. package/src/api/shownDuring.d.ts +12 -0
  28. package/src/api/shownDuring.js +30 -0
  29. package/src/api/story.d.ts +10 -3
  30. package/src/api/story.js +11 -4
  31. package/src/api/switches.d.ts +1 -0
  32. package/src/api/switches.js +3 -1
  33. package/src/api/time.d.ts +1 -1
  34. package/src/api/time.js +4 -1
  35. package/src/app/App.js +58 -21
  36. package/src/app/App.node.js +58 -21
  37. package/src/app/AstraeusScene.d.ts +8 -1
  38. package/src/app/CameraController.d.ts +4 -1
  39. package/src/app/CameraController.js +15 -3
  40. package/src/app/SkyFiguresView.d.ts +2 -2
  41. package/src/app/SkyFiguresView.js +25 -14
  42. package/src/app/displaySwitches.d.ts +2 -0
  43. package/src/app/displaySwitches.js +1 -1
  44. package/src/app/liveLook.d.ts +4 -1
  45. package/src/app/liveLook.js +29 -1
  46. package/src/app/look.d.ts +5 -0
  47. package/src/app/look.js +8 -2
  48. package/src/app/sceneCamera.js +14 -2
  49. package/src/app/sceneContentsHooks.js +1 -1
  50. package/src/app/sceneFrame.d.ts +14 -5
  51. package/src/app/sceneFrame.js +31 -21
  52. package/src/app/scenePointer.d.ts +5 -1
  53. package/src/app/scenePointer.js +8 -3
  54. package/src/app/timeLook.d.ts +7 -0
  55. package/src/app/timeLook.js +8 -0
  56. package/src/app/viewHiding.d.ts +8 -1
  57. package/src/app/viewHiding.js +23 -0
  58. package/src/core/clock.js +2 -1
  59. package/src/core/lookValues.d.ts +13 -0
  60. package/src/core/lookValues.js +39 -0
  61. package/src/core/pacing.d.ts +38 -6
  62. package/src/core/pacing.js +141 -21
  63. package/src/core/state.d.ts +2 -0
  64. package/src/core/state.js +5 -1
  65. package/src/core/storyPanels.d.ts +8 -4
  66. package/src/core/storyPanels.js +17 -5
  67. package/src/shell/AstraeusShell.d.ts +7 -1
  68. package/src/shell/AstraeusShell.js +39 -14
  69. package/src/shell/AstraeusShell.node.js +39 -14
  70. package/src/shell/ObjectControls.js +2 -2
  71. package/src/shell/TimelineBar.d.ts +6 -2
  72. package/src/shell/TimelineBar.js +17 -12
  73. package/src/shell/TimelineBar.node.js +17 -12
  74. package/src/shell/experience.d.ts +9 -0
  75. package/src/shell/infoModel.d.ts +2 -1
  76. package/src/shell/infoModel.js +10 -10
  77. package/src/shell/objectModel.d.ts +3 -2
  78. package/src/shell/objectModel.js +6 -4
  79. package/src/shell/storyPanels.d.ts +19 -1
  80. package/src/shell/storyPanels.js +34 -2
  81. package/src/shell/timelineModel.d.ts +11 -0
  82. package/src/shell/timelineModel.js +28 -0
  83. package/src/shell/useStoryPanels.d.ts +4 -0
  84. package/src/shell/useStoryPanels.js +27 -6
@@ -3,6 +3,7 @@ import { Suspense, useCallback, useEffect, useMemo, useRef, useState, useSyncExt
3
3
  import { createOrbAstronomyAdapter } from "../core/astronomyAdapter.js";
4
4
  import { viewUpFromSearch, viewUpVector } from "./viewUp.js";
5
5
  import { activeEventZones, applyPacing, startPaceEase } from "../core/pacing.js";
6
+ import { frameTime } from "./sceneFrame.js";
6
7
  import { openClock } from "./openClock.js";
7
8
  import { createProvenance } from "../core/provenance.js";
8
9
  import { pickerSwitch } from "./listSwitch.js";
@@ -35,7 +36,9 @@ import { displaySwitchItems, hostReachable, orbitStart, skyLineStart } from "./d
35
36
  import { TRACE_FADE_SECONDS } from "../core/skyTrace.js";
36
37
  import { aimAtFigure, DEFAULT_SKY_LINES, prefersReducedMotion, skyColoursOf, skyFadeInSecondsOf } from "./skyFigures.js";
37
38
  import { labelStyleOf } from "./labelStyle.js";
38
- import { experienceInView, hiddenByView, viewById } from "./viewHiding.js";
39
+ import { timeLookOf } from "./timeLook.js";
40
+ import { experienceInView, hiddenByView, hiddenWithShownSpans, viewById } from "./viewHiding.js";
41
+ import { cameraIdsOf } from "../core/storyPanels.js";
39
42
  import { baseGlowOf, glowLookOf, markerSettingsOf } from "./bodyDraw.js";
40
43
  import { resolveLook } from "./look.js";
41
44
  import { applyLook, desktopPicturesOf, lookReadOf, presentationOf, skySettingsOf } from "./liveLook.js";
@@ -102,6 +105,10 @@ function startViewUp(definition, search) {
102
105
  function storyStartOf(storySet) {
103
106
  return { autoOpen: storySet?.autoOpen ?? false, pauseSeconds: storySet?.pauseSeconds ?? 0 };
104
107
  }
108
+ /** The story-panel settings in force: the two the Developer drawer changes live, and the close span the scene set. */
109
+ function liveStorySettings(storySet, autoOpen, pauseSeconds) {
110
+ return { autoOpen, pauseSeconds, ...(storySet?.closeAfterSeconds === undefined ? {} : { closeAfterSeconds: storySet.closeAfterSeconds }) };
111
+ }
105
112
  /** Everything one mounted experience shares: clock, resolver, catalogue and the settings read from its definition and the address. */
106
113
  function buildRuntime(definition, search) {
107
114
  const adapter = createOrbAstronomyAdapter();
@@ -175,6 +182,8 @@ function initialSceneControls(definition, runtime, experience, startScale, glowB
175
182
  skyTraces: [],
176
183
  skyFadeInSeconds: skyFadeInSecondsOf(runtime.look),
177
184
  labelStyle: labelStyleOf(runtime.look),
185
+ timeLook: timeLookOf(runtime.look),
186
+ sheetMaxPercent: runtime.look.sheetMaxPercent ?? DEFAULT_PHONE_LAYOUT.sheetMaxPercent,
178
187
  skyVisible: runtime.sky.visible,
179
188
  bodyMarker: markerSettingsOf(runtime.look),
180
189
  ...(glowBase === null ? {} : { glowLook: glowLookOf(runtime.look, glowBase) }),
@@ -260,11 +269,15 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
260
269
  const [scale, setScale] = useState(startScale);
261
270
  const [developerMode, setDeveloperMode] = useState(false);
262
271
  const [timelineGlow, setTimelineGlow] = useState(DEFAULT_TIMELINE_GLOW);
263
- const [phoneLayout, setPhoneLayout] = useState(DEFAULT_PHONE_LAYOUT);
272
+ const [phoneLayoutOwn, setPhoneLayout] = useState(DEFAULT_PHONE_LAYOUT);
273
+ // The sheet cap is a look: the live controls hold it, so `setLook`, the handle's `look` and the Developer slider are one value (STYLE-07).
274
+ const [sheetShown, setSheetShown] = useState(controls.current.sheetMaxPercent);
275
+ const phoneLayout = { ...phoneLayoutOwn, sheetMaxPercent: sheetShown };
264
276
  const [anchorLabels, setAnchorLabels] = useState(controls.current.showAnchorLabels);
265
277
  const [skyLinesShown, setSkyLinesShown] = useState(controls.current.skyLines);
266
278
  const [skyColoursShown, setSkyColoursShown] = useState(controls.current.skyColours);
267
279
  const [labelStyleShown, setLabelStyleShown] = useState(controls.current.labelStyle);
280
+ const [timeLookShown, setTimeLookShown] = useState(controls.current.timeLook);
268
281
  const [glowShown, setGlowShown] = useState(copyOfGlow(controls.current.glowLook));
269
282
  const orbitPaths = orbitPathsOf(runtime);
270
283
  const orbitDefault = useMemo(() => resolveOrbitLook(orbitPaths[0]?.look), [orbitPaths]);
@@ -311,7 +324,11 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
311
324
  const [viewNow, setViewNow] = useState(null);
312
325
  const [viewLink, setViewLink] = useState(null);
313
326
  const [fills, setFills] = useState([]);
327
+ /** The ids the camera's last request named (a preset, a host `setCamera`, a story panel's camera): the one rule below holds the camera when one of them stops being shown. */
328
+ const cameraNamed = useRef([]);
329
+ const noteCameraIds = (request) => { const { bodies, toward } = cameraIdsOf(request); cameraNamed.current = toward === undefined ? bodies : [...bodies, toward]; };
314
330
  const updateCameraRequest = useCallback((request) => {
331
+ noteCameraIds(request);
315
332
  controls.current.cameraRequest = aimAtFigure(request, runtime.skyFigures);
316
333
  }, [runtime]);
317
334
  const turnToFigure = useCallback((id) => {
@@ -319,9 +336,17 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
319
336
  if (now !== undefined && "lookOut" in now)
320
337
  updateCameraRequest({ kind: "lookOut", body: now.lookOut, direction: id });
321
338
  }, [updateCameraRequest]);
322
- const holdCamera = useCallback(() => { controls.current.cameraRequest = { kind: "hold" }; }, []);
339
+ const holdCamera = useCallback(() => { cameraNamed.current = []; controls.current.cameraRequest = { kind: "hold" }; }, []);
340
+ /** O-071 (I-175): whatever named the camera's target, once that object is not shown at `timeUtcMs` the camera keeps its pose and stops following (`shownAt`, via `hiddenWithShownSpans`). */
341
+ const holdCameraOffShown = useCallback((timeUtcMs) => {
342
+ if (cameraNamed.current.length === 0)
343
+ return;
344
+ const out = hiddenWithShownSpans(undefined, experience.objects, timeUtcMs)?.objects;
345
+ if (out !== undefined && cameraNamed.current.some((id) => out.has(id)))
346
+ holdCamera();
347
+ }, [experience, holdCamera]);
323
348
  const requestPanel = useCallback((id) => setPanelRequest((previous) => ({ id, serial: (previous?.serial ?? 0) + 1 })), []);
324
- const requestPick = useCallback((id) => setPickRequest((previous) => ({ id, serial: (previous?.serial ?? 0) + 1 })), []);
349
+ const requestPick = useCallback((id, options) => setPickRequest((previous) => ({ id, serial: (previous?.serial ?? 0) + 1, ...(options?.keepSky === true ? { keepSky: true } : {}) })), []);
325
350
  const requestFeature = useCallback((key) => setFeatureRequest((previous) => ({ key, serial: (previous?.serial ?? 0) + 1 })), []);
326
351
  const markOpenFeature = useCallback((key) => { controls.current.openFeatureKey = key; }, []);
327
352
  const setPlaying = useCallback((playing) => {
@@ -404,13 +429,8 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
404
429
  }, [host, stateNow]);
405
430
  useEffect(() => {
406
431
  const id = window.setInterval(() => {
407
- // The readout wraps with the scene, so the shown time never rests past the end while looping.
408
- if (controls.current.loop === true)
409
- runtime.clock.wrapWithin(runtime.loopWindow);
410
- else if (runtime.stopAtWindow === true && runtime.loopWindow !== undefined)
411
- runtime.clock.stopWithin(runtime.loopWindow);
412
- if (controls.current.paceAuto === true && runtime.pacing !== undefined)
413
- applyPacing(runtime.clock, runtime.pacing, controls.current.pace);
432
+ // The readout wraps, stops and paces with the scene, so the shown time never rests past the end while looping and a host's playback reports follow the slow-downs.
433
+ frameTime(runtime, controls.current);
414
434
  setClockSnapshot(runtime.clock.snapshot());
415
435
  host?.publish(stateNow(), "playback");
416
436
  }, 100);
@@ -419,6 +439,8 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
419
439
  // The host reaches the one clock through the same seek and rate handlers a visitor's timeline uses.
420
440
  const seekTo = useCallback((timeUtcMs) => {
421
441
  runtime.clock.seek(timeUtcMs);
442
+ if (controls.current.pace !== undefined)
443
+ delete controls.current.pace.last; // the paced step starts again from the new time
422
444
  // A seek lands on the paced rate for the new time at once, not through a view-switch ease.
423
445
  if (controls.current.pace !== undefined) {
424
446
  delete controls.current.pace.ease;
@@ -450,18 +472,18 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
450
472
  }, [runtime]);
451
473
  // The same play handler the visitor's button reaches, so a host and a visitor share one clock.
452
474
  const hostSetPlaying = setPlaying;
453
- // The objects a host may point the camera at: those the showing view shows (read live, so a view switch is already counted).
475
+ // The objects a host may point the camera at: those the showing view shows and that are shown at the clock time (read live, so a view switch or a time move is already counted).
454
476
  const cameraTargets = useCallback(() => {
455
- const hidden = controls.current.viewHidden?.objects;
477
+ const hidden = hiddenWithShownSpans(controls.current.viewHidden, experience.objects, runtime.clock.snapshot().timeUtcMs)?.objects;
456
478
  return experience.objects.map(({ id }) => id).filter((id) => hidden === undefined || !hidden.has(id));
457
- }, [experience]);
479
+ }, [experience, runtime]);
458
480
  const opening = useMemo(() => openingCamera(definition, runtime, search), []); // eslint-disable-line react-hooks/exhaustive-deps
459
481
  const readCamera = useCallback(() => {
460
482
  const view = controls.current.viewReadout ?? opening;
461
483
  return view === undefined ? undefined : { ...view };
462
484
  }, [opening]);
463
485
  // A host camera call is the last word: it is also kept in `hostCameraRequest`, so the opening view (first frame) and a view's own camera rule (shell) yield to it.
464
- const setCamera = useCallback((request) => { controls.current.cameraRequest = controls.current.hostCameraRequest = aimAtFigure(request, runtime.skyFigures); }, [runtime]);
486
+ const setCamera = useCallback((request) => { noteCameraIds(request); controls.current.cameraRequest = controls.current.hostCameraRequest = aimAtFigure(request, runtime.skyFigures); }, [runtime]);
465
487
  const hostCameraSet = useCallback(() => controls.current.hostCameraRequest != null, []);
466
488
  const hostScales = useMemo(() => scaleChoiceIds ?? SCALE_CHOICES.map((choice) => choice.id), [scaleChoiceIds]);
467
489
  const hostSetLook = useCallback((look) => live.current?.setLook(look), []);
@@ -473,6 +495,12 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
473
495
  const panelTrace = useRef(null);
474
496
  /** The panel whose actions were last applied (a host `setPanel` shows its panel at once, so `openStoryPanelId` cannot say whether the shell has opened it yet). */
475
497
  const actedPanel = useRef(null);
498
+ /** Whether the objects a story panel's camera names are shown at the clock time; a request toward one outside its `shownDuring` span is refused as `setCamera` refuses it. */
499
+ const shownAtClock = useCallback((request) => {
500
+ const out = hiddenWithShownSpans(undefined, experience.objects, runtime.clock.snapshot().timeUtcMs)?.objects;
501
+ const { bodies, toward } = cameraIdsOf(request);
502
+ return out === undefined || ![...bodies, ...(toward === undefined ? [] : [toward])].some((id) => out.has(id));
503
+ }, [experience, runtime]);
476
504
  /** The shell's open panel changed (a visitor, a host call already shown, playback crossing a panel, or a view switch dropping it); a change is told to the host, the opening panel is read at attach. */
477
505
  const markOpenPanel = useCallback((id, cause) => {
478
506
  const changed = (controls.current.openStoryPanelId ?? null) !== id;
@@ -491,7 +519,7 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
491
519
  if (panel === undefined)
492
520
  return;
493
521
  // The panel's actions go through the host calls, in this order: camera, select, trace.
494
- if (panel.camera !== undefined)
522
+ if (panel.camera !== undefined && shownAtClock(panel.camera))
495
523
  setCamera(panel.camera);
496
524
  if (panel.select === true && panel.objectId !== undefined)
497
525
  selectWith(panel.objectId, true);
@@ -499,7 +527,7 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
499
527
  hostTraceSkyFigure(panel.objectId, panel.trace.seconds, panel.trace.after);
500
528
  panelTrace.current = panel.objectId;
501
529
  }
502
- }, [host, stateNow, definition, setCamera, selectWith, hostTraceSkyFigure, hostClearSkyTrace]);
530
+ }, [host, stateNow, definition, setCamera, shownAtClock, selectWith, hostTraceSkyFigure, hostClearSkyTrace]);
503
531
  useEffect(() => {
504
532
  if (host === undefined)
505
533
  return undefined;
@@ -573,6 +601,8 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
573
601
  setLoadFade(read.loadFadeSeconds);
574
602
  setSkyColoursShown(controls.current.skyColours);
575
603
  setLabelStyleShown(controls.current.labelStyle);
604
+ setTimeLookShown(controls.current.timeLook);
605
+ setSheetShown(read.sheetMaxPercent);
576
606
  },
577
607
  setScale: updateScale,
578
608
  items: () => displaySwitchItems({ ...bindingsNow(), settings: hostReachable(definition.displaySwitches) }),
@@ -587,7 +617,7 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
587
617
  shownKey.current = key;
588
618
  if (changed)
589
619
  host?.publish(state, "visitor");
590
- }, [host, stateNow, scale, skyVisible, starBrightness, milkyWayBrightness, milkyWayOn, glowShown, markerPx, loadFade, orbitShown, setLook, hiddenLabels, anchorLabels, skyLinesShown, skyColoursShown, labelStyleShown]);
620
+ }, [host, stateNow, scale, skyVisible, starBrightness, milkyWayBrightness, milkyWayOn, glowShown, markerPx, loadFade, orbitShown, setLook, hiddenLabels, anchorLabels, skyLinesShown, skyColoursShown, labelStyleShown, timeLookShown, sheetShown]);
591
621
  const hasStoryPanels = (storySet?.panels.length ?? 0) > 0;
592
622
  const showDisplay = showsDisplayControls(definition, runtime, skyVisible, orbitPaths.length, storyMarkerSpecs.length);
593
623
  // Orbit-line sliders: the first four stay in view, the rest sit in a nested "Fine-tune" fold (T-090).
@@ -649,7 +679,14 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
649
679
  ["timelineDrawerMaxPercent", "Timeline drawer height (% of screen)", "Phone timeline drawer height", "phone-timeline-height-value"],
650
680
  ["sheetMaxPercent", "Sheet height (% of screen)", "Phone sheet height", "phone-sheet-height-value"],
651
681
  ["swipeThresholdPx", "Swipe distance (px)", "Phone swipe distance", "phone-swipe-value"],
652
- ].map(([key, label, ariaLabel, testId]) => (_jsx(SettingSlider, { label: label, ariaLabel: ariaLabel, testId: testId, display: String(phoneLayout[key]), min: PHONE_LAYOUT_LIMITS[key].min, max: PHONE_LAYOUT_LIMITS[key].max, step: PHONE_LAYOUT_LIMITS[key].step, value: phoneLayout[key], onChange: (value) => setPhoneLayout({ ...phoneLayout, [key]: value }) }, key))), _jsx(SettingButtons, { children: _jsx("button", { onClick: () => setPhoneLayout(DEFAULT_PHONE_LAYOUT), children: "Reset phone layout" }) })] })),
682
+ ].map(([key, label, ariaLabel, testId]) => (_jsx(SettingSlider, { label: label, ariaLabel: ariaLabel, testId: testId, display: String(phoneLayout[key]), min: PHONE_LAYOUT_LIMITS[key].min, max: PHONE_LAYOUT_LIMITS[key].max, step: PHONE_LAYOUT_LIMITS[key].step, value: phoneLayout[key], onChange: (value) => {
683
+ if (key === "sheetMaxPercent") {
684
+ controls.current.sheetMaxPercent = value;
685
+ setSheetShown(value);
686
+ }
687
+ else
688
+ setPhoneLayout({ ...phoneLayoutOwn, [key]: value });
689
+ } }, key))), _jsx(SettingButtons, { children: _jsx("button", { onClick: () => { setPhoneLayout(DEFAULT_PHONE_LAYOUT); controls.current.sheetMaxPercent = DEFAULT_PHONE_LAYOUT.sheetMaxPercent; setSheetShown(DEFAULT_PHONE_LAYOUT.sheetMaxPercent); }, children: "Reset phone layout" }) })] })),
653
690
  },
654
691
  {
655
692
  id: "under-the-hood", title: "Under the hood",
@@ -658,7 +695,7 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
658
695
  ];
659
696
  const presentGroups = groups.filter((group) => group !== null);
660
697
  const drawer = (_jsx(PanelLoadBoundary, { children: _jsx(Suspense, { fallback: _jsx("p", { className: "developer-loading", role: "status", children: "Loading developer tools..." }), children: _jsxs("div", { className: "hud", children: [_jsxs("header", { className: "developer-heading", children: [_jsx("h2", { children: "Developer tools" }), _jsx("p", { children: "Live readouts, controls and diagnostics for this scene." })] }), presentGroups.map((group, index) => (_jsx(Collapsible, { fold: group.id, title: group.title, defaultOpen: index === 0, className: `dev-group${group.className === undefined ? "" : ` ${group.className}`}`, children: group.body }, group.id)))] }) }) }));
661
- return (_jsx(AstraeusShell, { experience: shellExperience, snapshot: clockSnapshot, paceAuto: runtime.pacing === undefined ? undefined : paceAuto, developerMode: developerMode, labelStyle: labelStyleShown, onDeveloperModeChange: setDeveloperMode, onTogglePlayback: () => {
698
+ return (_jsx(AstraeusShell, { experience: shellExperience, snapshot: clockSnapshot, paceAuto: runtime.pacing === undefined ? undefined : paceAuto, developerMode: developerMode, labelStyle: labelStyleShown, timeLook: timeLookShown, onDeveloperModeChange: setDeveloperMode, onTogglePlayback: () => {
662
699
  if (runtime.clock.playing)
663
700
  runtime.clock.pause();
664
701
  else
@@ -671,5 +708,5 @@ export function App({ definition, writeTitle = true, address, developerTools, ho
671
708
  }, onSeek: (timeUtcMs) => {
672
709
  seekTo(timeUtcMs);
673
710
  host?.publish(stateNow(), "visitor");
674
- }, onCameraRequest: updateCameraRequest, onTurnToFigure: turnToFigure, onCameraHold: holdCamera, hostCameraSet: hostCameraSet, storySeekNote: storySeekNote, onSelectionChange: updateSelectedObject, scaleId: scale, onScaleChange: updateScale, scaleChoices: scaleChoices, switcher: definition.picker === undefined ? undefined : pickerSwitch(definition.picker, hostPick ?? definition.picker.value, choosePick), displaySwitches: displaySwitches, viewChoice: viewChoice, viewCamera: currentView === undefined ? undefined : { id: currentView.id, rule: currentView.camera }, metricsFor: metricsFor, developerTools: drawerWhen(developerTools, drawer), storyPanelSettings: { autoOpen: storyAutoOpen, pauseSeconds: storyPauseSeconds }, timelineGlow: timelineGlow, phoneLayout: phoneLayout, highlightedFamily: setLook.highlightFamily, onHighlightFamily: highlightFamily, onSetPlaying: setPlaying, panelRequest: panelRequest, onOpenPanelChange: markOpenPanel, featureRequest: featureRequest, pickRequest: pickRequest, selectRequest: selectRequest, onSelectRequestApplied: hostSelectApplied, onOpenFeatureChange: markOpenFeature, children: _jsx("div", { className: "canvas-host", children: _jsx(AstraeusScene, { runtime: runtime, controls: controls.current, readout: readout, scaleId: scale, onFirstDraw: host === undefined ? undefined : told }) }) }));
711
+ }, onCameraRequest: updateCameraRequest, onTurnToFigure: turnToFigure, onCameraHold: holdCamera, onTimeShown: holdCameraOffShown, hostCameraSet: hostCameraSet, storySeekNote: storySeekNote, onSelectionChange: updateSelectedObject, scaleId: scale, onScaleChange: updateScale, scaleChoices: scaleChoices, switcher: definition.picker === undefined ? undefined : pickerSwitch(definition.picker, hostPick ?? definition.picker.value, choosePick), displaySwitches: displaySwitches, viewChoice: viewChoice, viewCamera: currentView === undefined ? undefined : { id: currentView.id, rule: currentView.camera }, metricsFor: metricsFor, developerTools: drawerWhen(developerTools, drawer), storyPanelSettings: liveStorySettings(storySet, storyAutoOpen, storyPauseSeconds), timelineGlow: timelineGlow, phoneLayout: phoneLayout, highlightedFamily: setLook.highlightFamily, onHighlightFamily: highlightFamily, onSetPlaying: setPlaying, panelRequest: panelRequest, onOpenPanelChange: markOpenPanel, featureRequest: featureRequest, pickRequest: pickRequest, selectRequest: selectRequest, onSelectRequestApplied: hostSelectApplied, onOpenFeatureChange: markOpenFeature, children: _jsx("div", { className: "canvas-host", children: _jsx(AstraeusScene, { runtime: runtime, controls: controls.current, readout: readout, scaleId: scale, onFirstDraw: host === undefined ? undefined : told }) }) }));
675
712
  }
@@ -19,6 +19,7 @@ import type { FrameStats } from "./frameStats.js";
19
19
  import type { GroupFill } from "./FrameRateSection.js";
20
20
  import { type BodySetLayer, type BodySetLook } from "./bodySet.js";
21
21
  import type { LabelStyle } from "./labelStyle.js";
22
+ import type { TimeLook } from "./timeLook.js";
22
23
  import type { SkyColours, SkyClearRequest, SkyFigureLayer, SkyLineSwitches, SkyTraceRequest } from "./skyFigures.js";
23
24
  import type { RingLook } from "../assets/rings.js";
24
25
  import type { Pictures } from "../assets/pictures.js";
@@ -96,6 +97,10 @@ export interface SceneControls {
96
97
  skyFadeInSeconds: number;
97
98
  /** Presentation only: the label font and size (the look `labels`; live). The viewer root carries it to every label as CSS variables. */
98
99
  labelStyle: LabelStyle;
100
+ /** Presentation only: the zone and precision of every visitor-facing time (the look `time`; live). */
101
+ timeLook: TimeLook;
102
+ /** Presentation only: the phone sheet's height cap, percent of the screen (the look `sheetMaxPercent`; live). The Developer drawer's slider and the look are this one value. */
103
+ sheetMaxPercent: number;
99
104
  /** Presentation only: when a sphere is too small to see it is drawn as a marker (see `drawsAsMarker`). */
100
105
  bodyMarker: BodyMarkerSettings;
101
106
  /** Presentation only: the live halo settings of a body whose record has a glow (the Sun). */
@@ -135,7 +140,9 @@ export interface SceneControls {
135
140
  /** The story panel now open, so its marker reads as pressed. */
136
141
  openStoryPanelId?: string | null;
137
142
  /** Called with an object's id when a tap or click lands on a body, a body-set member or a shown name. The shell flies to it like its picker does. */
138
- onPickObject?: (id: string) => void;
143
+ onPickObject?: (id: string, options?: {
144
+ readonly keepSky?: boolean;
145
+ }) => void;
139
146
  /** Tagged places on bodies (a body package's features); each gets a marker drawn on its body that opens the place's information. */
140
147
  readonly featureMarkers?: readonly FeatureMarkerSpec[];
141
148
  /** Called with the place's key when a feature marker is pressed. */
@@ -51,6 +51,8 @@ export interface OrbitCameraState {
51
51
  transition: [number, number, number];
52
52
  /** Set while the camera stands inside `focus` looking out: the field of view, with azimuth and elevation as the look direction. Null is the orbit camera. */
53
53
  lookOut: LookOutState | null;
54
+ /** A look-out field of view the camera is easing toward; null when none is pending (a visitor's zoom clears it). */
55
+ targetFovDeg: number | null;
54
56
  /** Scaled absolute camera/target positions (Float64, render axes) for the latest frame. */
55
57
  cameraAbsolute: [number, number, number];
56
58
  targetAbsolute: [number, number, number];
@@ -74,7 +76,8 @@ export declare function switchFocus(state: OrbitCameraState, focus: FocusId, new
74
76
  * Step 1 (before bodies are placed): computes the absolute target/camera in Float64 render axes
75
77
  * and rebases the floating origin when the target drifts away from it, so bodies and camera
76
78
  * always use the same origin within a frame. Scientific state is never read or written here.
79
+ * With `reducedMotion` the distance, angles and focus tween land on their targets in one frame.
77
80
  */
78
- export declare function resolveCamera(state: OrbitCameraState, focusAbsolute: RenderVector, origin: FloatingOrigin, deltaSeconds: number, rebaseThreshold: number, up?: RenderVector): void;
81
+ export declare function resolveCamera(state: OrbitCameraState, focusAbsolute: RenderVector, origin: FloatingOrigin, deltaSeconds: number, rebaseThreshold: number, up?: RenderVector, reducedMotion?: boolean): void;
79
82
  /** Step 2: writes the origin-relative camera pose and clipping planes. */
80
83
  export declare function poseCamera(camera: PerspectiveCamera, state: OrbitCameraState, focusRadius: number, origin: FloatingOrigin, far?: number, up?: RenderVector): void;
@@ -14,6 +14,7 @@ export function createOrbitCameraState(distance, focus) {
14
14
  fixedPoint: null,
15
15
  transition: [0, 0, 0],
16
16
  lookOut: null,
17
+ targetFovDeg: null,
17
18
  cameraAbsolute: [0, 0, 0],
18
19
  targetAbsolute: [0, 0, 0],
19
20
  };
@@ -110,8 +111,10 @@ export function attachOrbitGestures(element, state, getLimits, onTap) {
110
111
  }
111
112
  /** A wheel or pinch step: the distance in orbit, the field of view while looking out. */
112
113
  function zoomBy(state, factor, limits) {
113
- if (state.lookOut !== null)
114
+ if (state.lookOut !== null) {
115
+ state.targetFovDeg = null;
114
116
  zoomLookOut(state.lookOut, factor);
117
+ }
115
118
  else
116
119
  state.distance = clampDistance(state.distance * factor, limits);
117
120
  cancelCameraTransition(state);
@@ -140,15 +143,24 @@ export function switchFocus(state, focus, newTargetAbsolute) {
140
143
  * Step 1 (before bodies are placed): computes the absolute target/camera in Float64 render axes
141
144
  * and rebases the floating origin when the target drifts away from it, so bodies and camera
142
145
  * always use the same origin within a frame. Scientific state is never read or written here.
146
+ * With `reducedMotion` the distance, angles and focus tween land on their targets in one frame.
143
147
  */
144
- export function resolveCamera(state, focusAbsolute, origin, deltaSeconds, rebaseThreshold, up = EQUATORIAL_UP) {
145
- const decay = Math.exp(-TRANSITION_RATE_PER_S * deltaSeconds);
148
+ export function resolveCamera(state, focusAbsolute, origin, deltaSeconds, rebaseThreshold, up = EQUATORIAL_UP, reducedMotion = false) {
149
+ // Reduced motion: every eased move arrives within this frame (decay 0, blend 1).
150
+ const decay = reducedMotion ? 0 : Math.exp(-TRANSITION_RATE_PER_S * deltaSeconds);
146
151
  const blend = 1 - decay;
147
152
  state.distance += (state.targetDistance - state.distance) * blend;
148
153
  if (Math.abs(state.targetDistance - state.distance) < 1e-9)
149
154
  state.distance = state.targetDistance;
150
155
  state.azimuth += shortestAngleDelta(state.azimuth, state.targetAzimuth) * blend;
151
156
  state.elevation += (state.targetElevation - state.elevation) * blend;
157
+ if (state.lookOut !== null && state.targetFovDeg !== null) {
158
+ state.lookOut.fovDeg += (state.targetFovDeg - state.lookOut.fovDeg) * blend;
159
+ if (Math.abs(state.targetFovDeg - state.lookOut.fovDeg) < 1e-6) {
160
+ state.lookOut.fovDeg = state.targetFovDeg;
161
+ state.targetFovDeg = null;
162
+ }
163
+ }
152
164
  for (let i = 0; i < 3; i += 1) {
153
165
  state.transition[i] *= decay;
154
166
  if (Math.abs(state.transition[i]) < 1e-9)
@@ -36,8 +36,8 @@ export declare class SkyFiguresView {
36
36
  }): readonly SkyPickFigure[];
37
37
  /** Begins tracing the figure `request.id` (a trace already on it restarts). The trace is a separate set of lines drawn over the figure (the whole drawing of a figure shown only when traced); the figure itself is untouched. An id the view does not hold does nothing. */
38
38
  startTrace(request: SkyTraceRequest): void;
39
- /** Removes the trace of `request.id` over `request.seconds` (at once for 0 or reduced motion), keeping what it had drawn; a figure with no trace, or an id the view does not hold, is left alone. */
40
- clearTrace(request: SkyClearRequest): void;
39
+ /** Removes the trace of `request.id` over `request.seconds` (at once for 0 or reduced motion), keeping what it had drawn; a figure with no trace, or an id the view does not hold, is left alone. Returns true when it removed the trace at once, so the caller wakes the draw rule (a timed clear wakes through `advanceTraces`). */
40
+ clearTrace(request: SkyClearRequest): boolean;
41
41
  /**
42
42
  * Moves every trace on by `deltaSeconds` of real time (the scene clock never enters): draws the segments reached so far, the last one part-grown from its first end, in the traced colour (the faded colour while fading),
43
43
  * shows each with its figure's switch, and removes finished ones. Returns true while anything changed, so the caller wakes the draw rule.
@@ -1,5 +1,6 @@
1
1
  import { BufferAttribute, BufferGeometry, Color, Group, LineBasicMaterial, LineSegments, Vector3 } from "three";
2
2
  import { celestialEquatorSegments, eclipticSegments } from "./skyFigures.js";
3
+ import { splitColourAlpha } from "../core/lookValues.js";
3
4
  import { stepFadeIn, stepHide, stepTrace } from "../core/skyTrace.js";
4
5
  import { eqjToRenderVector } from "./renderCoordinates.js";
5
6
  import { TRACK_LAYER } from "./TrackedBodyView.js";
@@ -10,6 +11,12 @@ const TRACE_OPACITY = 0.85;
10
11
  const TRACE_LABEL_IN_SHARE = 0.5;
11
12
  /** The opacity of an always-shown line once it has faded in. */
12
13
  const LINE_OPACITY = 0.85;
14
+ /** Paints a material in a CSS colour's opaque part and returns the colour's alpha for the caller to multiply into the opacity. */
15
+ function paint(material, colour) {
16
+ const { colour: opaque, alpha } = splitColourAlpha(colour);
17
+ material.color.set(opaque);
18
+ return alpha;
19
+ }
13
20
  function lines(segments, color, key) {
14
21
  const positions = new Float32Array(segments.length * 6);
15
22
  segments.forEach(([from, to], i) => positions.set([...eqjToRenderVector(from), ...eqjToRenderVector(to)], i * 6));
@@ -17,8 +24,9 @@ function lines(segments, color, key) {
17
24
  geometry.setAttribute("position", new BufferAttribute(positions, 3));
18
25
  // Depth is tested (a body in front of the sky hides the line) but never written. The lines are on the last render pass (TRACK_LAYER), after every body's pass, so the Sun's halo
19
26
  // (drawn earlier, without depth) never covers them (owner decision 3, O-065).
20
- const material = new LineBasicMaterial({ color, transparent: true, opacity: LINE_OPACITY, depthTest: true, depthWrite: false });
27
+ const material = new LineBasicMaterial({ transparent: true, opacity: LINE_OPACITY, depthTest: true, depthWrite: false });
21
28
  const object = new LineSegments(geometry, material);
29
+ object.userData.alpha = paint(material, color);
22
30
  object.name = key;
23
31
  object.layers.set(TRACK_LAYER);
24
32
  object.frustumCulled = false;
@@ -47,7 +55,7 @@ export class SkyFiguresView {
47
55
  if (segments.length === 0)
48
56
  return;
49
57
  const object = lines(segments, own ?? "#ffffff", key);
50
- this.#drawn.push({ object, shows, colour, own: own !== undefined });
58
+ this.#drawn.push({ object, shows, colour, own: own !== undefined, alpha: object.userData.alpha });
51
59
  this.group.add(object);
52
60
  };
53
61
  // Figures that take the look's colour share one set of lines per kind; a figure with its own colour is drawn on its own so a live look change leaves it alone.
@@ -71,7 +79,7 @@ export class SkyFiguresView {
71
79
  for (const [shows, colour, make, key] of [["ecliptic", "ecliptic", eclipticSegments, "sky-ecliptic"], ["celestialEquator", "equator", celestialEquatorSegments, "sky-celestial-equator"]]) {
72
80
  if (on[shows] && !this.#drawn.some((entry) => entry.shows === shows)) {
73
81
  const object = lines(make(), "#ffffff", key);
74
- this.#drawn.push({ object, shows, colour, own: false });
82
+ this.#drawn.push({ object, shows, colour, own: false, alpha: 1 });
75
83
  this.group.add(object);
76
84
  this.#applied = null;
77
85
  }
@@ -79,7 +87,7 @@ export class SkyFiguresView {
79
87
  if (this.#applied === null || Object.keys(colours).some((name) => colours[name] !== this.#applied[name])) {
80
88
  for (const entry of this.#drawn)
81
89
  if (!entry.own)
82
- entry.object.material.color.set(colours[entry.colour]);
90
+ entry.alpha = paint(entry.object.material, colours[entry.colour]);
83
91
  this.#applied = { ...colours };
84
92
  }
85
93
  for (const entry of this.#drawn)
@@ -113,8 +121,7 @@ export class SkyFiguresView {
113
121
  this.#selected = { id: layer.id, object };
114
122
  }
115
123
  const material = this.#selected.object.material;
116
- material.color.set(colours.selected);
117
- material.opacity = LINE_OPACITY * (layer.whenTraced === true ? 1 : this.#shownShare[layer.kind === "figure" ? "figures" : "boundaries"]);
124
+ material.opacity = paint(material, colours.selected) * LINE_OPACITY * (layer.whenTraced === true ? 1 : this.#shownShare[layer.kind === "figure" ? "figures" : "boundaries"]);
118
125
  // While the figure's trace is still drawing, the trace itself grows in the selected colour (`advanceTraces`) and the whole-figure emphasis waits, so it never covers the growing line (owner, T-306).
119
126
  this.#selected.object.visible = this.#tappable(layer, on) && !this.#drawing(layer.id);
120
127
  }
@@ -147,15 +154,17 @@ export class SkyFiguresView {
147
154
  this.group.add(object);
148
155
  this.#traces.set(request.id, { object, full, kind: layer.kind, run: { seconds: request.seconds, after: request.after, reduced: request.reduced, elapsed: 0 }, drawn: 0, fade: 0 });
149
156
  }
150
- /** Removes the trace of `request.id` over `request.seconds` (at once for 0 or reduced motion), keeping what it had drawn; a figure with no trace, or an id the view does not hold, is left alone. */
157
+ /** Removes the trace of `request.id` over `request.seconds` (at once for 0 or reduced motion), keeping what it had drawn; a figure with no trace, or an id the view does not hold, is left alone. Returns true when it removed the trace at once, so the caller wakes the draw rule (a timed clear wakes through `advanceTraces`). */
151
158
  clearTrace(request) {
152
159
  const trace = this.#traces.get(request.id);
153
160
  if (trace === undefined)
154
- return;
155
- if (request.reduced || request.seconds <= 0)
161
+ return false;
162
+ if (request.reduced || request.seconds <= 0) {
156
163
  this.#removeTrace(request.id);
157
- else
158
- trace.hide = { seconds: request.seconds, from: trace.fade, elapsed: 0 };
164
+ return true;
165
+ }
166
+ trace.hide = { seconds: request.seconds, from: trace.fade, elapsed: 0 };
167
+ return false;
159
168
  }
160
169
  /**
161
170
  * Moves every trace on by `deltaSeconds` of real time (the scene clock never enters): draws the segments reached so far, the last one part-grown from its first end, in the traced colour (the faded colour while fading),
@@ -185,8 +194,10 @@ export class SkyFiguresView {
185
194
  positions.needsUpdate = true;
186
195
  trace.object.geometry.setDrawRange(0, (last + 1) * 2);
187
196
  const material = trace.object.material;
188
- material.color.set(id === selectedId && frame.drawn < 1 && trace.hide === undefined ? colours.selected : colours.traced).lerp(FADED.set(colours.faded), frame.fade);
189
- material.opacity = TRACE_OPACITY * (1 - frame.fade);
197
+ const base = splitColourAlpha(id === selectedId && frame.drawn < 1 && trace.hide === undefined ? colours.selected : colours.traced);
198
+ const faded = splitColourAlpha(colours.faded);
199
+ material.color.set(base.colour).lerp(FADED.set(faded.colour), frame.fade);
200
+ material.opacity = TRACE_OPACITY * (1 - frame.fade) * (base.alpha + (faded.alpha - base.alpha) * frame.fade);
190
201
  trace.object.visible = on[trace.kind === "figure" ? "figures" : "boundaries"];
191
202
  }
192
203
  return moving;
@@ -205,7 +216,7 @@ export class SkyFiguresView {
205
216
  moving = true;
206
217
  }
207
218
  for (const entry of this.#drawn)
208
- entry.object.material.opacity = LINE_OPACITY * this.#shownShare[entry.shows];
219
+ entry.object.material.opacity = LINE_OPACITY * entry.alpha * this.#shownShare[entry.shows];
209
220
  return moving;
210
221
  }
211
222
  /** How much of a label shows, 0 to 1: for a figure that is always shown, how far its kind has faded in; for one shown only when traced, 0 until a trace starts, then rising with the trace to 1 at half drawn (fading to 0 with a `fade` trace; 0 again once the trace is removed). */
@@ -14,6 +14,8 @@ export type DisplaySwitchPlace = (typeof DISPLAY_SWITCH_PLACES)[number];
14
14
  export interface DisplaySwitchSetting {
15
15
  readonly place: DisplaySwitchPlace;
16
16
  readonly on?: boolean;
17
+ /** The switch's own name in the top bar and the switch panel; absent: the built-in one. */
18
+ readonly label?: string;
17
19
  }
18
20
  export type DisplaySwitchSettings = Readonly<Partial<Record<DisplaySwitchId, DisplaySwitchSetting>>>;
19
21
  export declare const DISPLAY_SWITCH_LABELS: Readonly<Record<DisplaySwitchId, string>>;
@@ -57,7 +57,7 @@ export function displaySwitchItems(bindings) {
57
57
  const place = settings[id]?.place;
58
58
  if ((place !== "top-bar" && place !== "panel") || !state[id].applies)
59
59
  return [];
60
- return [{ id, label: DISPLAY_SWITCH_LABELS[id], place, on: state[id].on, onToggle: state[id].toggle }];
60
+ return [{ id, label: settings[id]?.label ?? DISPLAY_SWITCH_LABELS[id], place, on: state[id].on, onToggle: state[id].toggle }];
61
61
  });
62
62
  }
63
63
  /** The settings with every placed switch counted as shown: a host reads and sets a switch placed only in the Developer drawer too. */
@@ -3,12 +3,13 @@
3
3
  * (the one place the Developer drawer, the host's `setLook` and the page address all end up), every one filled in; `applyLook` replaces the whole look. Presentation only (ARCH-02).
4
4
  */
5
5
  import type { LookInput, LookRead } from "../api/look.js";
6
+ import type { BodyAsset } from "../assets/catalogue.js";
6
7
  import type { SceneControls } from "./AstraeusScene.js";
7
8
  import { type GlowLook } from "./bodyDraw.js";
8
9
  import type { ExperienceDefinition } from "./experienceDefinition.js";
9
10
  import type { DisplaySwitchItem } from "../shell/DisplaySwitches.js";
10
11
  /** The sky settings in force: the experience's own, then the look (the scene's `setLook`, with the address over it). The Milky Way switch's start sits between the two. */
11
- export declare function skySettingsOf(definition: ExperienceDefinition, look: LookInput): {
12
+ export declare function skySettingsOf(definition: Pick<ExperienceDefinition, "sky" | "displaySwitches">, look: LookInput): {
12
13
  milkyWay: boolean;
13
14
  starBrightness: number;
14
15
  milkyWayBrightness: number;
@@ -19,6 +20,8 @@ export declare function skySettingsOf(definition: ExperienceDefinition, look: Lo
19
20
  export declare function desktopPicturesOf(definition: Pick<ExperienceDefinition, "desktopTextures">, look: LookInput): boolean;
20
21
  /** The looks the scene's live controls hold now, every one filled in. */
21
22
  export declare function lookReadOf(controls: SceneControls): LookRead;
23
+ /** The looks a fresh viewer opens with, every one filled in, from the resolved look alone (no browser, no controls): the same resolvers `initialSceneControls` uses. `bodies` are the scene's mounted bodies, whose first halo (the Sun's) sets `sunGlow`. */
24
+ export declare function lookReadFrom(look: LookInput, definition: Pick<ExperienceDefinition, "sky" | "displaySwitches">, bodies: readonly BodyAsset[]): LookRead;
22
25
  /**
23
26
  * Replaces the whole look in the live controls with `input` (a look not named takes its default) and returns the looks now in force. The one resolver (`resolveLook`) takes it with no page address:
24
27
  * a host's live set wins over the address, which only starts the viewer.
@@ -1,9 +1,11 @@
1
+ import { DEFAULT_PHONE_LAYOUT } from "../shell/phoneLayout.js";
1
2
  import { bootFadeSeconds } from "../shell/bootLoader.js";
2
- import { glowLookOf, markerSettingsOf } from "./bodyDraw.js";
3
+ import { baseGlowOf, glowLookOf, markerSettingsOf } from "./bodyDraw.js";
3
4
  import { featureMinBodyPxOf } from "./FeatureMarkers.js";
4
5
  import { resolveLook } from "./look.js";
5
6
  import { resolveSkySettings } from "./skyModel.js";
6
7
  import { labelStyleOf } from "./labelStyle.js";
8
+ import { timeLookOf } from "./timeLook.js";
7
9
  import { skyColoursOf, skyFadeInSecondsOf } from "./skyFigures.js";
8
10
  /** The sky settings in force: the experience's own, then the look (the scene's `setLook`, with the address over it). The Milky Way switch's start sits between the two. */
9
11
  export function skySettingsOf(definition, look) {
@@ -36,6 +38,30 @@ export function lookReadOf(controls) {
36
38
  desktopPictures: controls.desktopPictures,
37
39
  skyLines: { ...controls.skyColours },
38
40
  labels: { ...controls.labelStyle },
41
+ time: { ...controls.timeLook },
42
+ sheetMaxPercent: controls.sheetMaxPercent,
43
+ };
44
+ }
45
+ /** The looks a fresh viewer opens with, every one filled in, from the resolved look alone (no browser, no controls): the same resolvers `initialSceneControls` uses. `bodies` are the scene's mounted bodies, whose first halo (the Sun's) sets `sunGlow`. */
46
+ export function lookReadFrom(look, definition, bodies) {
47
+ const glowBase = baseGlowOf(bodies);
48
+ const sky = skySettingsOf(definition, look);
49
+ const glow = glowBase === null ? undefined : glowLookOf(look, glowBase);
50
+ return {
51
+ starBrightness: sky.starBrightness,
52
+ milkyWay: sky.milkyWay,
53
+ milkyWayBrightness: sky.milkyWayBrightness,
54
+ skyVisible: sky.visible,
55
+ ...(glow === undefined ? {} : { sunGlow: { sizePx: glow.sizePx, brightness: glow.brightness, scale: glow.scale } }),
56
+ markerSwapRadiusPx: markerSettingsOf(look).minSpherePx,
57
+ featureMinBodyPx: featureMinBodyPxOf(look),
58
+ loadFadeSeconds: bootFadeSeconds(look),
59
+ skyFadeInSeconds: skyFadeInSecondsOf(look),
60
+ desktopPictures: desktopPicturesOf({ desktopTextures: undefined }, look),
61
+ skyLines: { ...skyColoursOf(look) },
62
+ labels: { ...labelStyleOf(look) },
63
+ time: { ...timeLookOf(look) },
64
+ sheetMaxPercent: look.sheetMaxPercent ?? DEFAULT_PHONE_LAYOUT.sheetMaxPercent,
39
65
  };
40
66
  }
41
67
  /**
@@ -57,6 +83,8 @@ export function applyLook(controls, definition, glowBase, input) {
57
83
  controls.skyColours = skyColoursOf(look);
58
84
  controls.skyFadeInSeconds = skyFadeInSecondsOf(look);
59
85
  controls.labelStyle = labelStyleOf(look);
86
+ controls.timeLook = timeLookOf(look);
87
+ controls.sheetMaxPercent = look.sheetMaxPercent ?? DEFAULT_PHONE_LAYOUT.sheetMaxPercent;
60
88
  return lookReadOf(controls);
61
89
  }
62
90
  /** The host's view of the presentation: `items` (read fresh each time) are the display switches the scene placed (those with something to act on), so a switch is read and set exactly as its visible button does. */
package/src/app/look.d.ts CHANGED
@@ -20,6 +20,11 @@ export type LookKind = {
20
20
  readonly kind: "colour";
21
21
  } | {
22
22
  readonly kind: "font";
23
+ } | {
24
+ readonly kind: "zone";
25
+ } | {
26
+ readonly kind: "choice";
27
+ readonly values: readonly string[];
23
28
  };
24
29
  /** One look: where it sits in `LookInput` (`["sunGlow", "sizePx"]` for a nested one), its address parameter (null: the look has none, it is set only with `setLook`) and how it is written. */
25
30
  export interface LookField {
package/src/app/look.js CHANGED
@@ -1,4 +1,5 @@
1
- import { LABEL_SIZE_LIMITS } from "../core/lookValues.js";
1
+ import { PHONE_LAYOUT_LIMITS } from "../shell/phoneLayout.js";
2
+ import { LABEL_SIZE_LIMITS, TIME_PRECISIONS } from "../core/lookValues.js";
2
3
  const range = (path, param, min, max) => ({ path, param, spec: { kind: "range", min, max } });
3
4
  const colour = (name) => ({ path: ["skyLines", name], param: null, spec: { kind: "colour" } });
4
5
  /** Every look. The one table; the order is the order of `LookInput`. */
@@ -19,6 +20,11 @@ export const LOOK_FIELDS = [
19
20
  colour("figure"), colour("label"), colour("boundary"), colour("ecliptic"), colour("equator"), colour("traced"), colour("faded"), colour("selected"),
20
21
  { path: ["labels", "fontFamily"], param: null, spec: { kind: "font" } },
21
22
  range(["labels", "sizePx"], null, LABEL_SIZE_LIMITS.min, LABEL_SIZE_LIMITS.max),
23
+ // The zone and precision of the viewer's times (O-074 T-316) have no address parameter either: the address `t` stays UTC.
24
+ { path: ["time", "zone"], param: null, spec: { kind: "zone" } },
25
+ { path: ["time", "precision"], param: null, spec: { kind: "choice", values: TIME_PRECISIONS } },
26
+ // The tallest a phone's information or story sheet grows (O-075 T-317, review F-18): no address parameter; the Developer drawer's "Sheet height" slider is this same value.
27
+ range(["sheetMaxPercent"], null, PHONE_LAYOUT_LIMITS.sheetMaxPercent.min, PHONE_LAYOUT_LIMITS.sheetMaxPercent.max),
22
28
  ];
23
29
  /** The name a look is called in a message: `sunGlow.sizePx`. */
24
30
  export const lookName = (field) => field.path.join(".");
@@ -47,7 +53,7 @@ function fromAddress(search, field) {
47
53
  if (raw === null)
48
54
  return undefined;
49
55
  const { spec } = field;
50
- if (spec.kind === "colour" || spec.kind === "font")
56
+ if (spec.kind === "colour" || spec.kind === "font" || spec.kind === "zone" || spec.kind === "choice")
51
57
  return undefined;
52
58
  if (spec.kind === "onoff")
53
59
  return raw === "on" ? true : raw === "off" ? false : undefined;
@@ -113,17 +113,29 @@ function applyLookOut(input, request) {
113
113
  camState.focus = request.body;
114
114
  camState.fixedPoint = null;
115
115
  camState.transition.fill(0);
116
- if (angles !== null && !keep) {
116
+ const fovDeg = clampFov(request.fovDeg ?? camState.targetFovDeg ?? camState.lookOut?.fovDeg ?? LOOK_OUT_OPENING_FOV_DEG);
117
+ if (camState.lookOut !== null) {
118
+ // Already looking out: only the targets move, and resolveCamera eases the turn and the zoom (at once under reduced motion).
119
+ if (angles !== null && !keep) {
120
+ camState.targetAzimuth = angles.azimuth;
121
+ camState.targetElevation = clampLookElevation(angles.elevation);
122
+ }
123
+ camState.targetFovDeg = fovDeg;
124
+ return;
125
+ }
126
+ if (angles !== null) {
117
127
  camState.azimuth = camState.targetAzimuth = angles.azimuth;
118
128
  camState.elevation = camState.targetElevation = clampLookElevation(angles.elevation);
119
129
  }
120
- camState.lookOut = { fovDeg: clampFov(request.fovDeg ?? camState.lookOut?.fovDeg ?? LOOK_OUT_OPENING_FOV_DEG) };
130
+ camState.targetFovDeg = null;
131
+ camState.lookOut = { fovDeg };
121
132
  }
122
133
  /** Back to the orbit camera: the target tween starts from where the camera stood, not from the aiming point one unit out. */
123
134
  function leaveLookOut(camState) {
124
135
  if (camState.lookOut === null)
125
136
  return;
126
137
  camState.lookOut = null;
138
+ camState.targetFovDeg = null;
127
139
  for (let i = 0; i < 3; i += 1)
128
140
  camState.targetAbsolute[i] = camState.cameraAbsolute[i];
129
141
  }