astraeus 0.0.0-stage → 0.1.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.
- package/CHANGELOG.md +14 -0
- package/LICENSE +21 -0
- package/NOTICE +14 -0
- package/README.md +108 -2
- package/data/ephemerides/planets/planets.json +1 -0
- package/data/moons/jupiter.json +3097 -0
- package/data/moons/neptune.json +517 -0
- package/data/moons/pluto.json +189 -0
- package/data/moons/saturn.json +7677 -0
- package/data/moons/uranus.json +825 -0
- package/data/orbits/callisto.json +192 -0
- package/data/orbits/charon.json +96 -0
- package/data/orbits/dione.json +102 -0
- package/data/orbits/enceladus.json +102 -0
- package/data/orbits/europa.json +189 -0
- package/data/orbits/ganymede.json +186 -0
- package/data/orbits/iapetus.json +102 -0
- package/data/orbits/io.json +181 -0
- package/data/orbits/mimas.json +170 -0
- package/data/orbits/rhea.json +170 -0
- package/data/orbits/tethys.json +170 -0
- package/data/orbits/titan.json +170 -0
- package/data/orbits/triton.json +230 -0
- package/data/rings/jupiter.json +24 -0
- package/data/rings/neptune.json +73 -0
- package/data/rings/saturn.json +69 -0
- package/data/rings/uranus.json +80 -0
- package/licenses/ERFA.txt +50 -0
- package/licenses/orbjs-MIT.txt +21 -0
- package/licenses/python-sgp4.txt +20 -0
- package/package.json +45 -4
- package/src/api/bodies.d.ts +40 -0
- package/src/api/bodies.js +35 -0
- package/src/api/data.d.ts +24 -0
- package/src/api/data.js +34 -0
- package/src/api/errors.d.ts +7 -0
- package/src/api/errors.js +9 -0
- package/src/api/index.d.ts +8 -0
- package/src/api/index.js +6 -0
- package/src/api/mount.d.ts +15 -0
- package/src/api/mount.js +26 -0
- package/src/api/scene.d.ts +76 -0
- package/src/api/scene.js +194 -0
- package/src/app/AnchorLabels.d.ts +17 -0
- package/src/app/AnchorLabels.js +46 -0
- package/src/app/App.d.ts +13 -0
- package/src/app/App.js +379 -0
- package/src/app/AstraeusScene.d.ts +133 -0
- package/src/app/AstraeusScene.js +47 -0
- package/src/app/AtmosphereGlow.d.ts +6 -0
- package/src/app/AtmosphereGlow.js +38 -0
- package/src/app/BodyMesh.d.ts +14 -0
- package/src/app/BodyMesh.js +20 -0
- package/src/app/BodySetLabels.d.ts +17 -0
- package/src/app/BodySetLabels.js +98 -0
- package/src/app/BodySetView.d.ts +50 -0
- package/src/app/BodySetView.js +206 -0
- package/src/app/BodyView.d.ts +37 -0
- package/src/app/BodyView.js +58 -0
- package/src/app/CameraController.d.ts +51 -0
- package/src/app/CameraController.js +163 -0
- package/src/app/DebugOverlay.d.ts +58 -0
- package/src/app/DebugOverlay.js +72 -0
- package/src/app/DeveloperSettings.d.ts +80 -0
- package/src/app/DeveloperSettings.js +40 -0
- package/src/app/FeatureMarkers.d.ts +76 -0
- package/src/app/FeatureMarkers.js +205 -0
- package/src/app/FrameRateSection.d.ts +16 -0
- package/src/app/FrameRateSection.js +35 -0
- package/src/app/KeplerPoints.d.ts +18 -0
- package/src/app/KeplerPoints.js +64 -0
- package/src/app/LayeredRender.d.ts +14 -0
- package/src/app/LayeredRender.js +35 -0
- package/src/app/OrbitSetView.d.ts +65 -0
- package/src/app/OrbitSetView.js +519 -0
- package/src/app/PathView.d.ts +135 -0
- package/src/app/PathView.js +574 -0
- package/src/app/PointsView.d.ts +103 -0
- package/src/app/PointsView.js +552 -0
- package/src/app/RingView.d.ts +34 -0
- package/src/app/RingView.js +96 -0
- package/src/app/SceneLabels.d.ts +22 -0
- package/src/app/SceneLabels.js +81 -0
- package/src/app/SettingControls.d.ts +32 -0
- package/src/app/SettingControls.js +19 -0
- package/src/app/SkyView.d.ts +63 -0
- package/src/app/SkyView.js +237 -0
- package/src/app/StoryMarkers.d.ts +38 -0
- package/src/app/StoryMarkers.js +81 -0
- package/src/app/TrackedBodyView.d.ts +36 -0
- package/src/app/TrackedBodyView.js +175 -0
- package/src/app/addressNavigation.d.ts +17 -0
- package/src/app/addressNavigation.js +16 -0
- package/src/app/bodyDraw.d.ts +118 -0
- package/src/app/bodyDraw.js +171 -0
- package/src/app/bodyMetrics.d.ts +19 -0
- package/src/app/bodyMetrics.js +85 -0
- package/src/app/bodySet.d.ts +113 -0
- package/src/app/bodySet.js +79 -0
- package/src/app/catalogueItem.d.ts +9 -0
- package/src/app/catalogueItem.js +17 -0
- package/src/app/ephemerisProvenance.d.ts +2 -0
- package/src/app/ephemerisProvenance.js +1 -0
- package/src/app/experienceDefinition.d.ts +265 -0
- package/src/app/experienceDefinition.js +257 -0
- package/src/app/floatingOrigin.d.ts +14 -0
- package/src/app/floatingOrigin.js +32 -0
- package/src/app/frameStats.d.ts +28 -0
- package/src/app/frameStats.js +68 -0
- package/src/app/keplerShader.d.ts +45 -0
- package/src/app/keplerShader.js +112 -0
- package/src/app/lighting.d.ts +9 -0
- package/src/app/lighting.js +24 -0
- package/src/app/metricReadouts.d.ts +10 -0
- package/src/app/metricReadouts.js +67 -0
- package/src/app/mission.d.ts +78 -0
- package/src/app/mission.js +80 -0
- package/src/app/pathRules.d.ts +52 -0
- package/src/app/pathRules.js +104 -0
- package/src/app/planetNeeds.d.ts +3 -0
- package/src/app/planetNeeds.js +6 -0
- package/src/app/renderCoordinates.d.ts +13 -0
- package/src/app/renderCoordinates.js +14 -0
- package/src/app/sceneBodies.d.ts +42 -0
- package/src/app/sceneBodies.js +58 -0
- package/src/app/sceneBodySets.d.ts +5 -0
- package/src/app/sceneBodySets.js +45 -0
- package/src/app/sceneCamera.d.ts +34 -0
- package/src/app/sceneCamera.js +110 -0
- package/src/app/sceneContentsHooks.d.ts +102 -0
- package/src/app/sceneContentsHooks.js +127 -0
- package/src/app/sceneDebug.d.ts +55 -0
- package/src/app/sceneDebug.js +76 -0
- package/src/app/sceneFrame.d.ts +175 -0
- package/src/app/sceneFrame.js +272 -0
- package/src/app/sceneFraming.d.ts +57 -0
- package/src/app/sceneFraming.js +99 -0
- package/src/app/sceneHooks.d.ts +28 -0
- package/src/app/sceneHooks.js +68 -0
- package/src/app/sceneLayout.d.ts +59 -0
- package/src/app/sceneLayout.js +97 -0
- package/src/app/sceneLights.d.ts +13 -0
- package/src/app/sceneLights.js +13 -0
- package/src/app/scenePicking.d.ts +97 -0
- package/src/app/scenePicking.js +102 -0
- package/src/app/scenePointer.d.ts +15 -0
- package/src/app/scenePointer.js +35 -0
- package/src/app/sceneSky.d.ts +9 -0
- package/src/app/sceneSky.js +17 -0
- package/src/app/sceneTargets.d.ts +34 -0
- package/src/app/sceneTargets.js +58 -0
- package/src/app/skyModel.d.ts +62 -0
- package/src/app/skyModel.js +114 -0
- package/src/app/style.css +206 -0
- package/src/app/useBodyTexture.d.ts +2 -0
- package/src/app/useBodyTexture.js +25 -0
- package/src/app/viewLink.d.ts +48 -0
- package/src/app/viewLink.js +117 -0
- package/src/app/viewUp.d.ts +24 -0
- package/src/app/viewUp.js +36 -0
- package/src/assets/bodies/earth.d.ts +18 -0
- package/src/assets/bodies/earth.js +33 -0
- package/src/assets/bodies/galileanMoons.d.ts +9 -0
- package/src/assets/bodies/galileanMoons.js +18 -0
- package/src/assets/bodies/io.d.ts +9 -0
- package/src/assets/bodies/io.js +12 -0
- package/src/assets/bodies/jupiter.d.ts +19 -0
- package/src/assets/bodies/jupiter.js +33 -0
- package/src/assets/bodies/jupiterMoonCatalogue.d.ts +3 -0
- package/src/assets/bodies/jupiterMoonCatalogue.js +4 -0
- package/src/assets/bodies/jupiterRings.d.ts +3 -0
- package/src/assets/bodies/jupiterRings.js +4 -0
- package/src/assets/bodies/mars.d.ts +15 -0
- package/src/assets/bodies/mars.js +29 -0
- package/src/assets/bodies/mercury.d.ts +15 -0
- package/src/assets/bodies/mercury.js +29 -0
- package/src/assets/bodies/moon.d.ts +16 -0
- package/src/assets/bodies/moon.js +30 -0
- package/src/assets/bodies/outerPlanetCatalogues.d.ts +11 -0
- package/src/assets/bodies/outerPlanetCatalogues.js +12 -0
- package/src/assets/bodies/planetSystemMaps.d.ts +18 -0
- package/src/assets/bodies/planetSystemMaps.js +65 -0
- package/src/assets/bodies/sun.d.ts +21 -0
- package/src/assets/bodies/sun.js +32 -0
- package/src/assets/bodies/swiftTuttle.d.ts +12 -0
- package/src/assets/bodies/swiftTuttle.js +13 -0
- package/src/assets/bodies/venus.d.ts +20 -0
- package/src/assets/bodies/venus.js +37 -0
- package/src/assets/catalogue.d.ts +37 -0
- package/src/assets/catalogue.js +106 -0
- package/src/assets/compositions.d.ts +52 -0
- package/src/assets/compositions.js +91 -0
- package/src/assets/licence.d.ts +44 -0
- package/src/assets/licence.js +20 -0
- package/src/assets/moonCatalogue.d.ts +47 -0
- package/src/assets/moonCatalogue.js +79 -0
- package/src/assets/orbitLook.d.ts +94 -0
- package/src/assets/orbitLook.js +46 -0
- package/src/assets/pictures.d.ts +17 -0
- package/src/assets/pictures.js +23 -0
- package/src/assets/rings.d.ts +31 -0
- package/src/assets/rings.js +45 -0
- package/src/assets/sky.d.ts +91 -0
- package/src/assets/sky.js +139 -0
- package/src/assets/stars/hyg-v42-naked-eye.json +1 -0
- package/src/assets/textures/earth-bmng-july-4k.jpg +0 -0
- package/src/assets/textures/jupiter-2k.jpg +0 -0
- package/src/assets/textures/mars-2k.jpg +0 -0
- package/src/assets/textures/mercury-2k.jpg +0 -0
- package/src/assets/textures/moon-lroc-2k.jpg +0 -0
- package/src/assets/textures/neptune-2k.jpg +0 -0
- package/src/assets/textures/saturn-2k.jpg +0 -0
- package/src/assets/textures/sun-2k.jpg +0 -0
- package/src/assets/textures/uranus-2k.jpg +0 -0
- package/src/assets/textures/venus-2k-balanced.jpg +0 -0
- package/src/assets/visual.d.ts +56 -0
- package/src/assets/visual.js +1 -0
- package/src/core/astronomyAdapter.d.ts +13 -0
- package/src/core/astronomyAdapter.js +88 -0
- package/src/core/bodies/earth.d.ts +7 -0
- package/src/core/bodies/earth.js +38 -0
- package/src/core/bodies/index.d.ts +16 -0
- package/src/core/bodies/index.js +45 -0
- package/src/core/bodies/io.d.ts +54 -0
- package/src/core/bodies/io.js +120 -0
- package/src/core/bodies/jupiter.d.ts +8 -0
- package/src/core/bodies/jupiter.js +40 -0
- package/src/core/bodies/jupiterData.d.ts +2 -0
- package/src/core/bodies/jupiterData.js +9 -0
- package/src/core/bodies/jupiterMoons.d.ts +31 -0
- package/src/core/bodies/jupiterMoons.js +44 -0
- package/src/core/bodies/mars.d.ts +6 -0
- package/src/core/bodies/mars.js +34 -0
- package/src/core/bodies/mercury.d.ts +6 -0
- package/src/core/bodies/mercury.js +32 -0
- package/src/core/bodies/moon.d.ts +3 -0
- package/src/core/bodies/moon.js +36 -0
- package/src/core/bodies/moonSystem.d.ts +98 -0
- package/src/core/bodies/moonSystem.js +151 -0
- package/src/core/bodies/outerPlanetData.d.ts +7 -0
- package/src/core/bodies/outerPlanetData.js +19 -0
- package/src/core/bodies/outerPlanets.d.ts +23 -0
- package/src/core/bodies/outerPlanets.js +68 -0
- package/src/core/bodies/planetMoons.d.ts +28 -0
- package/src/core/bodies/planetMoons.js +86 -0
- package/src/core/bodies/planetRecords.d.ts +8 -0
- package/src/core/bodies/planetRecords.js +19 -0
- package/src/core/bodies/planetTrajectory.d.ts +10 -0
- package/src/core/bodies/planetTrajectory.js +31 -0
- package/src/core/bodies/sun.d.ts +3 -0
- package/src/core/bodies/sun.js +25 -0
- package/src/core/bodies/swiftTuttle.d.ts +46 -0
- package/src/core/bodies/swiftTuttle.js +104 -0
- package/src/core/bodies/venus.d.ts +6 -0
- package/src/core/bodies/venus.js +34 -0
- package/src/core/body.d.ts +45 -0
- package/src/core/body.js +8 -0
- package/src/core/bodyOrientation.d.ts +8 -0
- package/src/core/bodyOrientation.js +92 -0
- package/src/core/chebyshev.d.ts +12 -0
- package/src/core/chebyshev.js +38 -0
- package/src/core/chebyshevEphemeris.d.ts +93 -0
- package/src/core/chebyshevEphemeris.js +344 -0
- package/src/core/chebyshevSeries.d.ts +30 -0
- package/src/core/chebyshevSeries.js +89 -0
- package/src/core/clock.d.ts +28 -0
- package/src/core/clock.js +98 -0
- package/src/core/elementsBody.d.ts +94 -0
- package/src/core/elementsBody.js +201 -0
- package/src/core/ephemerisGroup.d.ts +36 -0
- package/src/core/ephemerisGroup.js +51 -0
- package/src/core/events.d.ts +9 -0
- package/src/core/events.js +18 -0
- package/src/core/fieldReaders.d.ts +14 -0
- package/src/core/fieldReaders.js +32 -0
- package/src/core/iauRotation.d.ts +59 -0
- package/src/core/iauRotation.js +72 -0
- package/src/core/illumination.d.ts +9 -0
- package/src/core/illumination.js +54 -0
- package/src/core/keplerAnomaly.d.ts +2 -0
- package/src/core/keplerAnomaly.js +8 -0
- package/src/core/keplerElements.d.ts +35 -0
- package/src/core/keplerElements.js +87 -0
- package/src/core/listedOrbitGroup.d.ts +64 -0
- package/src/core/listedOrbitGroup.js +221 -0
- package/src/core/moonTrajectory.d.ts +11 -0
- package/src/core/moonTrajectory.js +28 -0
- package/src/core/orbitGroup.d.ts +41 -0
- package/src/core/orbitGroup.js +141 -0
- package/src/core/orbitPeriod.d.ts +25 -0
- package/src/core/orbitPeriod.js +58 -0
- package/src/core/planetModels.d.ts +7 -0
- package/src/core/planetModels.js +43 -0
- package/src/core/planetSeries.d.ts +26 -0
- package/src/core/planetSeries.js +22 -0
- package/src/core/pointGroup.d.ts +51 -0
- package/src/core/pointGroup.js +49 -0
- package/src/core/provenance.d.ts +9 -0
- package/src/core/provenance.js +14 -0
- package/src/core/referenceCenters.d.ts +6 -0
- package/src/core/referenceCenters.js +55 -0
- package/src/core/sampledTrajectory.d.ts +28 -0
- package/src/core/sampledTrajectory.js +127 -0
- package/src/core/satelliteMeanElements.d.ts +78 -0
- package/src/core/satelliteMeanElements.js +81 -0
- package/src/core/scalePolicy.d.ts +44 -0
- package/src/core/scalePolicy.js +58 -0
- package/src/core/state.d.ts +30 -0
- package/src/core/state.js +66 -0
- package/src/core/stateResolver.d.ts +16 -0
- package/src/core/stateResolver.js +126 -0
- package/src/core/sunCentredSources.d.ts +61 -0
- package/src/core/sunCentredSources.js +179 -0
- package/src/core/timeScale.d.ts +28 -0
- package/src/core/timeScale.js +81 -0
- package/src/core/timeWindow.d.ts +33 -0
- package/src/core/timeWindow.js +112 -0
- package/src/core/trajectory.d.ts +13 -0
- package/src/core/trajectory.js +1 -0
- package/src/core/twoBodyAdapter.d.ts +30 -0
- package/src/core/twoBodyAdapter.js +45 -0
- package/src/experiences/apollo11/spacecraftMetrics.d.ts +34 -0
- package/src/experiences/apollo11/spacecraftMetrics.js +142 -0
- package/src/experiences/settingsFields.d.ts +8 -0
- package/src/experiences/settingsFields.js +12 -0
- package/src/experiences/showers/showerChoice.d.ts +25 -0
- package/src/experiences/showers/showerChoice.js +19 -0
- package/src/shell/AstraeusShell.d.ts +66 -0
- package/src/shell/AstraeusShell.js +223 -0
- package/src/shell/Collapsible.d.ts +23 -0
- package/src/shell/Collapsible.js +43 -0
- package/src/shell/ControlsDrawer.d.ts +16 -0
- package/src/shell/ControlsDrawer.js +18 -0
- package/src/shell/InfoPanel.d.ts +13 -0
- package/src/shell/InfoPanel.js +20 -0
- package/src/shell/Label.d.ts +10 -0
- package/src/shell/Label.js +15 -0
- package/src/shell/MetricVisual.d.ts +5 -0
- package/src/shell/MetricVisual.js +114 -0
- package/src/shell/MoonFamilyPanel.d.ts +16 -0
- package/src/shell/MoonFamilyPanel.js +28 -0
- package/src/shell/ObjectControls.d.ts +13 -0
- package/src/shell/ObjectControls.js +18 -0
- package/src/shell/ProvenanceBadge.d.ts +5 -0
- package/src/shell/ProvenanceBadge.js +9 -0
- package/src/shell/ScaleControl.d.ts +14 -0
- package/src/shell/ScaleControl.js +99 -0
- package/src/shell/Sources.d.ts +9 -0
- package/src/shell/Sources.js +9 -0
- package/src/shell/StoryPanelView.d.ts +18 -0
- package/src/shell/StoryPanelView.js +24 -0
- package/src/shell/SwitchControl.d.ts +24 -0
- package/src/shell/SwitchControl.js +26 -0
- package/src/shell/TimelineBar.css +120 -0
- package/src/shell/TimelineBar.d.ts +48 -0
- package/src/shell/TimelineBar.js +76 -0
- package/src/shell/TopBar.css +74 -0
- package/src/shell/TopBar.d.ts +28 -0
- package/src/shell/TopBar.js +14 -0
- package/src/shell/bodyFeatures.d.ts +51 -0
- package/src/shell/bodyFeatures.js +24 -0
- package/src/shell/bootLoader.d.ts +17 -0
- package/src/shell/bootLoader.js +73 -0
- package/src/shell/controls.css +108 -0
- package/src/shell/embedded.css +36 -0
- package/src/shell/embedded.d.ts +2 -0
- package/src/shell/embedded.js +15 -0
- package/src/shell/experience.d.ts +72 -0
- package/src/shell/experience.js +1 -0
- package/src/shell/infoModel.d.ts +43 -0
- package/src/shell/infoModel.js +80 -0
- package/src/shell/metrics.d.ts +202 -0
- package/src/shell/metrics.js +224 -0
- package/src/shell/moonFamilies.d.ts +51 -0
- package/src/shell/moonFamilies.js +34 -0
- package/src/shell/objectModel.d.ts +18 -0
- package/src/shell/objectModel.js +34 -0
- package/src/shell/phone.css +179 -0
- package/src/shell/phoneLayout.d.ts +29 -0
- package/src/shell/phoneLayout.js +48 -0
- package/src/shell/scaleModel.d.ts +16 -0
- package/src/shell/scaleModel.js +42 -0
- package/src/shell/storyPanels.d.ts +69 -0
- package/src/shell/storyPanels.js +134 -0
- package/src/shell/style.css +378 -0
- package/src/shell/timelineGlow.d.ts +43 -0
- package/src/shell/timelineGlow.js +86 -0
- package/src/shell/timelineModel.d.ts +65 -0
- package/src/shell/timelineModel.js +153 -0
- package/src/shell/topBarIcons.d.ts +13 -0
- package/src/shell/topBarIcons.js +15 -0
- package/src/shell/useDrawerSwipe.d.ts +22 -0
- package/src/shell/useDrawerSwipe.js +35 -0
- package/src/shell/useDrawers.d.ts +11 -0
- package/src/shell/useDrawers.js +29 -0
- package/src/shell/useStoryPanels.d.ts +19 -0
- package/src/shell/useStoryPanels.js +55 -0
- package/src/shell/useSwipeToDismiss.d.ts +6 -0
- package/src/shell/useSwipeToDismiss.js +46 -0
- package/src/synthetic/syntheticDefinition.d.ts +5 -0
- package/src/synthetic/syntheticDefinition.js +183 -0
- package/src/synthetic/syntheticEccentricDefinition.d.ts +18 -0
- package/src/synthetic/syntheticEccentricDefinition.js +50 -0
- package/src/synthetic/syntheticListedDefinition.d.ts +20 -0
- package/src/synthetic/syntheticListedDefinition.js +135 -0
- package/src/synthetic/syntheticRingDefinition.d.ts +20 -0
- package/src/synthetic/syntheticRingDefinition.js +215 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metric Visuals: compact, numbers-first readouts. An experience supplies each value with its unit,
|
|
3
|
+
* reference and any meaningful range; these helpers only map those values onto shapes and words.
|
|
4
|
+
*/
|
|
5
|
+
/** Glyphs that draw a value in a body's radii show this many radii; farther values are drawn broken. */
|
|
6
|
+
export const RADII_WINDOW = 6;
|
|
7
|
+
const SYSTEM_NAMES = {
|
|
8
|
+
xyz: "Cartesian XYZ",
|
|
9
|
+
radec: "Right ascension / declination",
|
|
10
|
+
latlon: "Latitude / longitude",
|
|
11
|
+
};
|
|
12
|
+
const clamp01 = (value) => Math.min(1, Math.max(0, value));
|
|
13
|
+
export function formatMetricNumber(value, digits) {
|
|
14
|
+
return value.toLocaleString("en-US", { minimumFractionDigits: digits, maximumFractionDigits: digits });
|
|
15
|
+
}
|
|
16
|
+
/** Arc position for a speed, or null when there is no value or no usable range (numeric-only). */
|
|
17
|
+
export function speedGauge(metric) {
|
|
18
|
+
const { value, range } = metric;
|
|
19
|
+
if (value === null || range === undefined || !(range.max > range.min))
|
|
20
|
+
return null;
|
|
21
|
+
const raw = (value - range.min) / (range.max - range.min);
|
|
22
|
+
return { fraction: clamp01(raw), outside: raw < 0 || raw > 1 };
|
|
23
|
+
}
|
|
24
|
+
/** Proportional bar from the origin, or null without a value or reference markers (numeric-only). */
|
|
25
|
+
export function distanceScale(metric) {
|
|
26
|
+
const { value, markers } = metric;
|
|
27
|
+
if (value === null || markers === undefined || markers.length === 0 || value < 0)
|
|
28
|
+
return null;
|
|
29
|
+
const span = Math.max(value, ...markers.map((marker) => marker.value));
|
|
30
|
+
if (!(span > 0))
|
|
31
|
+
return null;
|
|
32
|
+
return {
|
|
33
|
+
span,
|
|
34
|
+
valueFraction: value / span,
|
|
35
|
+
markers: markers.map((marker) => ({ ...marker, fraction: clamp01(marker.value / span) })),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Bar for a rate against its stated limits or peak, or null without a value or either (numeric-only). */
|
|
39
|
+
export function rateScale(metric) {
|
|
40
|
+
const { value, range, peak } = metric;
|
|
41
|
+
if (value === null)
|
|
42
|
+
return null;
|
|
43
|
+
if (range !== undefined && range.max > range.min) {
|
|
44
|
+
const at = (v) => clamp01((v - range.min) / (range.max - range.min));
|
|
45
|
+
return { span: range.max - range.min, valueFraction: at(value), markers: peak === undefined ? [] : [{ ...peak, fraction: at(peak.value) }] };
|
|
46
|
+
}
|
|
47
|
+
if (peak === undefined || value < 0 || peak.value < 0)
|
|
48
|
+
return null;
|
|
49
|
+
const span = Math.max(value, peak.value);
|
|
50
|
+
if (!(span > 0))
|
|
51
|
+
return null;
|
|
52
|
+
return { span, valueFraction: value / span, markers: [{ ...peak, fraction: peak.value / span }] };
|
|
53
|
+
}
|
|
54
|
+
/** Journey line from start to total, or null without a value or a positive total. */
|
|
55
|
+
export function progressScale(metric) {
|
|
56
|
+
if (metric.value === null || !(metric.total > 0))
|
|
57
|
+
return null;
|
|
58
|
+
return {
|
|
59
|
+
span: metric.total,
|
|
60
|
+
valueFraction: clamp01(metric.value / metric.total),
|
|
61
|
+
markers: (metric.markers ?? []).map((marker) => ({ ...marker, fraction: clamp01(marker.value / metric.total) })),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Gap to the target in its own radii, or null without a value or radius (numeric-only). */
|
|
65
|
+
export function relationGlyph(metric) {
|
|
66
|
+
const { value, targetRadius } = metric;
|
|
67
|
+
if (value === null || targetRadius === undefined || !(targetRadius > 0) || value < 0)
|
|
68
|
+
return null;
|
|
69
|
+
const radii = value / targetRadius;
|
|
70
|
+
return { radii, beyondWindow: radii > RADII_WINDOW };
|
|
71
|
+
}
|
|
72
|
+
/** Height above the datum in body radii, or null without a value or radius (numeric-only). */
|
|
73
|
+
export function altitudeGlyph(metric) {
|
|
74
|
+
const { value, bodyRadius } = metric;
|
|
75
|
+
if (value === null || bodyRadius === undefined || !(bodyRadius > 0))
|
|
76
|
+
return null;
|
|
77
|
+
const radii = value / bodyRadius;
|
|
78
|
+
return { radii, beyondWindow: radii > 1 };
|
|
79
|
+
}
|
|
80
|
+
/** Width of the ± band as a fraction of the largest half-width, or null without a scale. */
|
|
81
|
+
export function uncertaintyBand(metric) {
|
|
82
|
+
if (metric.value === null || metric.scale === undefined || !(metric.scale.max > 0) || metric.value < 0)
|
|
83
|
+
return null;
|
|
84
|
+
return clamp01(metric.value / metric.scale.max);
|
|
85
|
+
}
|
|
86
|
+
/** Top (x–y) and side (x–z) projections on one scale; every point fits inside the round top view and the z tick. */
|
|
87
|
+
export function planViews(metric) {
|
|
88
|
+
const { components, planViews: config } = metric;
|
|
89
|
+
if (config === undefined || metric.system !== "xyz" || components === null || components.length !== 3)
|
|
90
|
+
return null;
|
|
91
|
+
const object = components.map((c) => c.value);
|
|
92
|
+
const all = [object, ...config.references.map((r) => r.xyz)];
|
|
93
|
+
const halfSpan = Math.max(...all.flatMap((xyz) => [Math.hypot(xyz[0], xyz[1]), Math.abs(xyz[2])]));
|
|
94
|
+
if (!(halfSpan > 0))
|
|
95
|
+
return null;
|
|
96
|
+
const project = (xyz, second) => [xyz[0] / halfSpan, xyz[second] / halfSpan];
|
|
97
|
+
const view = (name, second) => ({
|
|
98
|
+
name,
|
|
99
|
+
axes: ["x", second === 1 ? "y" : "z"],
|
|
100
|
+
object: project(object, second),
|
|
101
|
+
references: config.references.map((r) => ({ label: r.label, point: project(r.xyz, second) })),
|
|
102
|
+
});
|
|
103
|
+
return { halfSpan, unit: components[0].unit, views: [view("top", 1), view("side", 2)] };
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* SVG path of the lit part of a unit disc (radius 1, centre 0,0) lit from the right.
|
|
107
|
+
* The terminator is an ellipse whose half-width is |2k − 1|: it bulges away from the lit limb when
|
|
108
|
+
* gibbous and towards it when crescent.
|
|
109
|
+
*/
|
|
110
|
+
export function litDiscPath(fraction) {
|
|
111
|
+
const k = clamp01(fraction);
|
|
112
|
+
if (k === 0)
|
|
113
|
+
return "";
|
|
114
|
+
if (k === 1)
|
|
115
|
+
return "M 0 -1 A 1 1 0 1 1 0 1 A 1 1 0 1 1 0 -1 Z";
|
|
116
|
+
const rx = Math.abs(2 * k - 1);
|
|
117
|
+
const terminatorSweep = k > 0.5 ? 1 : 0;
|
|
118
|
+
return `M 0 -1 A 1 1 0 0 1 0 1 A ${rx.toFixed(4)} 1 0 0 ${terminatorSweep} 0 -1 Z`;
|
|
119
|
+
}
|
|
120
|
+
/** Phase glyph when the lit side is known, otherwise a 0–100% band; null without a fraction. */
|
|
121
|
+
export function phaseVisual(metric) {
|
|
122
|
+
if (metric.fraction === null)
|
|
123
|
+
return null;
|
|
124
|
+
if (metric.litLimb === undefined)
|
|
125
|
+
return { kind: "band", fraction: clamp01(metric.fraction) };
|
|
126
|
+
return { kind: "glyph", litPath: litDiscPath(metric.fraction), mirrored: metric.litLimb === "left" };
|
|
127
|
+
}
|
|
128
|
+
const unavailableReading = (metric) => ({ value: "—", unit: metric.unavailable ?? "unavailable" });
|
|
129
|
+
/** The headline number and its unit, as shown first. Coordinates read as one row per component. */
|
|
130
|
+
export function metricReadings(metric) {
|
|
131
|
+
switch (metric.kind) {
|
|
132
|
+
case "phase":
|
|
133
|
+
return [metric.fraction === null ? unavailableReading(metric) : { value: formatMetricNumber(metric.fraction * 100, 1), unit: "%" }];
|
|
134
|
+
case "progress":
|
|
135
|
+
return [metric.value === null || !(metric.total > 0)
|
|
136
|
+
? unavailableReading(metric)
|
|
137
|
+
: { value: formatMetricNumber(clamp01(metric.value / metric.total) * 100, 1), unit: "%" }];
|
|
138
|
+
case "uncertainty":
|
|
139
|
+
return [metric.value === null ? unavailableReading(metric) : { value: `±${formatMetricNumber(metric.value, metric.digits)}`, unit: metric.unit }];
|
|
140
|
+
case "coordinates":
|
|
141
|
+
return metric.components === null
|
|
142
|
+
? [unavailableReading(metric)]
|
|
143
|
+
: metric.components.map((c) => ({ value: `${c.label} ${formatMetricNumber(c.value, c.digits)}`, unit: c.unit }));
|
|
144
|
+
default:
|
|
145
|
+
return [metric.value === null ? unavailableReading(metric) : { value: formatMetricNumber(metric.value, metric.digits), unit: metric.unit }];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const note = (value, digits) => formatMetricNumber(value, digits);
|
|
149
|
+
function speedNotes(metric) {
|
|
150
|
+
const gauge = speedGauge(metric);
|
|
151
|
+
if (gauge === null || metric.range === undefined)
|
|
152
|
+
return [];
|
|
153
|
+
const { min, max, basis, digits = metric.digits } = metric.range;
|
|
154
|
+
return [`${note(min, digits)}–${note(max, digits)} ${metric.unit}${gauge.outside ? " · value outside this range" : ""}`, basis];
|
|
155
|
+
}
|
|
156
|
+
function rateNotes(metric) {
|
|
157
|
+
const { range, value } = metric;
|
|
158
|
+
const limits = range === undefined || value === null || !(range.max > range.min)
|
|
159
|
+
? []
|
|
160
|
+
: [`${note(range.min, range.digits ?? metric.digits)}–${note(range.max, range.digits ?? metric.digits)} ${metric.unit}${value < range.min || value > range.max ? " · value outside this range" : ""}`, range.basis];
|
|
161
|
+
const peak = metric.peak === undefined || value === null ? [] : [`${metric.peak.label} ${note(metric.peak.value, metric.digits)} ${metric.unit}`];
|
|
162
|
+
return [...limits, ...peak];
|
|
163
|
+
}
|
|
164
|
+
function distanceNotes(metric) {
|
|
165
|
+
const scale = distanceScale(metric);
|
|
166
|
+
const origin = metric.origin === undefined ? [] : [`from ${metric.origin}`];
|
|
167
|
+
if (scale === null)
|
|
168
|
+
return origin;
|
|
169
|
+
return [...origin, ...scale.markers.map((m) => `${m.label} ${note(m.value, metric.digits)} ${metric.unit}`)];
|
|
170
|
+
}
|
|
171
|
+
function relativeDistanceNotes(metric) {
|
|
172
|
+
const glyph = relationGlyph(metric);
|
|
173
|
+
const between = `${metric.from} → ${metric.to}`;
|
|
174
|
+
return glyph === null ? [between] : [between, `${note(glyph.radii, 1)} × ${metric.to} radius`];
|
|
175
|
+
}
|
|
176
|
+
function altitudeNotes(metric) {
|
|
177
|
+
if (metric.value === null)
|
|
178
|
+
return [];
|
|
179
|
+
const side = metric.value < 0 ? "below" : "above";
|
|
180
|
+
const radius = metric.bodyRadius === undefined ? "" : ` (${note(metric.bodyRadius, 1)} ${metric.unit})`;
|
|
181
|
+
return [`${side} ${metric.body} ${metric.datum}${radius}`];
|
|
182
|
+
}
|
|
183
|
+
function progressNotes(metric) {
|
|
184
|
+
if (metric.value === null)
|
|
185
|
+
return [];
|
|
186
|
+
const ends = metric.startLabel !== undefined && metric.endLabel !== undefined ? ` · ${metric.startLabel} → ${metric.endLabel}` : "";
|
|
187
|
+
return [`${note(metric.value, metric.digits)} of ${note(metric.total, metric.digits)} ${metric.unit}${ends}`];
|
|
188
|
+
}
|
|
189
|
+
function uncertaintyNotes(metric) {
|
|
190
|
+
if (uncertaintyBand(metric) === null || metric.scale === undefined)
|
|
191
|
+
return [];
|
|
192
|
+
return [`largest ±${note(metric.scale.max, metric.digits)} ${metric.unit} · ${metric.scale.basis}`];
|
|
193
|
+
}
|
|
194
|
+
function coordinatesNotes(metric) {
|
|
195
|
+
const system = `${SYSTEM_NAMES[metric.system]} · ${metric.frame} · from ${metric.origin}`;
|
|
196
|
+
const views = planViews(metric);
|
|
197
|
+
if (views === null)
|
|
198
|
+
return [system];
|
|
199
|
+
const references = metric.planViews?.references.map((r) => r.label).join(", ");
|
|
200
|
+
return [
|
|
201
|
+
system,
|
|
202
|
+
`round: top view x–y · tick: z · rim ±${formatMetricNumber(views.halfSpan, 0)} ${views.unit}${references ? ` · lavender: ${references}` : ""}`,
|
|
203
|
+
];
|
|
204
|
+
}
|
|
205
|
+
/** Caption lines naming the reference the visual is drawn against, in the order they are shown. */
|
|
206
|
+
export function metricNotes(metric) {
|
|
207
|
+
switch (metric.kind) {
|
|
208
|
+
case "speed": return speedNotes(metric);
|
|
209
|
+
case "rate": return rateNotes(metric);
|
|
210
|
+
case "distance": return distanceNotes(metric);
|
|
211
|
+
case "relative-distance": return relativeDistanceNotes(metric);
|
|
212
|
+
case "altitude": return altitudeNotes(metric);
|
|
213
|
+
case "progress": return progressNotes(metric);
|
|
214
|
+
case "uncertainty": return uncertaintyNotes(metric);
|
|
215
|
+
case "phase":
|
|
216
|
+
return metric.fraction !== null && metric.litLimb !== undefined ? [`lit on the ${metric.litLimb}`] : [];
|
|
217
|
+
case "coordinates": return coordinatesNotes(metric);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/** A sentence carrying the value and what the visual shows, so nothing depends on seeing the shape. */
|
|
221
|
+
export function describeMetric(metric) {
|
|
222
|
+
const reading = metricReadings(metric).map((r) => `${r.value} ${r.unit}`).join(", ");
|
|
223
|
+
return [`${metric.label}: ${reading}`, ...(metric.context === undefined ? [] : [metric.context]), ...metricNotes(metric)].join("; ") + ".";
|
|
224
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the moon browser (the sliding panel of a planet's moons by family) needs, as plain data any experience can hand the shell
|
|
3
|
+
* (ARCH-01): families with a one-line description, and each family's moons. The panel shows named moons first and folds the unnamed away.
|
|
4
|
+
*/
|
|
5
|
+
export interface MoonListing {
|
|
6
|
+
/** The id the scene knows the moon by (also its object id in the experience). */
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly label: string;
|
|
9
|
+
/** False for a provisional designation. */
|
|
10
|
+
readonly named: boolean;
|
|
11
|
+
/** A small picture for a moon the panel shows large (the big four); absent for the rest. */
|
|
12
|
+
readonly pictureUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface MoonFamilyListing {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly label: string;
|
|
17
|
+
/** One plain line. */
|
|
18
|
+
readonly description: string;
|
|
19
|
+
readonly moons: readonly MoonListing[];
|
|
20
|
+
}
|
|
21
|
+
export interface MoonFamilyList {
|
|
22
|
+
/** The planet's name, for the panel heading. */
|
|
23
|
+
readonly planetLabel: string;
|
|
24
|
+
/** Family ids whose moons the panel lists first with pictures (the big four); the others fold. */
|
|
25
|
+
readonly featuredFamilyId?: string;
|
|
26
|
+
readonly families: readonly MoonFamilyListing[];
|
|
27
|
+
/** Where the list of moons comes from, e.g. "JPL Horizons"; with listDate, the panel says how many moons the list held and when it was taken. */
|
|
28
|
+
readonly listSource?: string;
|
|
29
|
+
/** The day the list was taken (YYYY-MM-DD, from the data). */
|
|
30
|
+
readonly listDate?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface MoonSplit {
|
|
33
|
+
readonly named: readonly MoonListing[];
|
|
34
|
+
readonly unnamed: readonly MoonListing[];
|
|
35
|
+
}
|
|
36
|
+
/** Named moons first (as listed), provisional designations apart. */
|
|
37
|
+
export declare function splitNamed(moons: readonly MoonListing[]): MoonSplit;
|
|
38
|
+
/** A family's heading count: "5 moons", "1 moon". */
|
|
39
|
+
export declare function moonCountText(count: number): string;
|
|
40
|
+
/** A date from the data (YYYY-MM-DD, or an ISO timestamp) as "18 October 2026"; the text itself when it is not a date. */
|
|
41
|
+
export declare function moonListDateText(date: string): string;
|
|
42
|
+
/** "115 moons in the JPL Horizons list of 18 October 2026": the count is the moons the list holds, the source and date come from the data. */
|
|
43
|
+
export declare function moonListSummary(count: number, source?: string, date?: string): string;
|
|
44
|
+
/** The summary of a whole moon list: every moon in every family, counted live. */
|
|
45
|
+
export declare const moonFamilyListSummary: (list: MoonFamilyList) => string;
|
|
46
|
+
export interface MoonMatch {
|
|
47
|
+
readonly moon: MoonListing;
|
|
48
|
+
readonly familyLabel: string;
|
|
49
|
+
}
|
|
50
|
+
/** The moons whose name or designation contains the query, ignoring case, spaces and punctuation ("s2003 j19" finds "S/2003 J 19"); none for an empty query. */
|
|
51
|
+
export declare function searchMoons(list: MoonFamilyList, query: string): readonly MoonMatch[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Named moons first (as listed), provisional designations apart. */
|
|
2
|
+
export function splitNamed(moons) {
|
|
3
|
+
return { named: moons.filter((moon) => moon.named), unnamed: moons.filter((moon) => !moon.named) };
|
|
4
|
+
}
|
|
5
|
+
const squash = (text) => text.toLowerCase().replace(/[^a-z0-9]+/g, "");
|
|
6
|
+
/** A family's heading count: "5 moons", "1 moon". */
|
|
7
|
+
export function moonCountText(count) {
|
|
8
|
+
return count === 1 ? "1 moon" : `${count} moons`;
|
|
9
|
+
}
|
|
10
|
+
/** A date from the data (YYYY-MM-DD, or an ISO timestamp) as "18 October 2026"; the text itself when it is not a date. */
|
|
11
|
+
export function moonListDateText(date) {
|
|
12
|
+
const parsed = /^\d{4}-\d{2}-\d{2}/.test(date) ? new Date(`${date.slice(0, 10)}T00:00:00Z`) : new Date(Number.NaN);
|
|
13
|
+
return Number.isNaN(parsed.getTime()) ? date : parsed.toLocaleDateString("en-GB", { day: "numeric", month: "long", year: "numeric", timeZone: "UTC" });
|
|
14
|
+
}
|
|
15
|
+
/** "115 moons in the JPL Horizons list of 18 October 2026": the count is the moons the list holds, the source and date come from the data. */
|
|
16
|
+
export function moonListSummary(count, source, date) {
|
|
17
|
+
const head = moonCountText(count);
|
|
18
|
+
if (source !== undefined && date !== undefined)
|
|
19
|
+
return `${head} in the ${source} list of ${moonListDateText(date)}`;
|
|
20
|
+
if (date !== undefined)
|
|
21
|
+
return `${head}, list of ${moonListDateText(date)}`;
|
|
22
|
+
return head;
|
|
23
|
+
}
|
|
24
|
+
/** The summary of a whole moon list: every moon in every family, counted live. */
|
|
25
|
+
export const moonFamilyListSummary = (list) => moonListSummary(list.families.reduce((total, family) => total + family.moons.length, 0), list.listSource, list.listDate);
|
|
26
|
+
/** The moons whose name or designation contains the query, ignoring case, spaces and punctuation ("s2003 j19" finds "S/2003 J 19"); none for an empty query. */
|
|
27
|
+
export function searchMoons(list, query) {
|
|
28
|
+
const wanted = squash(query);
|
|
29
|
+
if (wanted === "")
|
|
30
|
+
return [];
|
|
31
|
+
return list.families.flatMap((family) => family.moons
|
|
32
|
+
.filter((moon) => squash(moon.label).includes(wanted) || squash(moon.id).includes(wanted))
|
|
33
|
+
.map((moon) => ({ moon, familyLabel: family.label })));
|
|
34
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ExperienceCameraPreset, ExperienceConfig, ExperienceObject } from "./experience.js";
|
|
2
|
+
export type CameraMode = "overview" | "focus" | "follow";
|
|
3
|
+
export declare function isObjectAvailable(object: ExperienceObject, timeUtcMs: number): boolean;
|
|
4
|
+
export declare function availableObjectById(experience: ExperienceConfig, id: string, timeUtcMs: number): ExperienceObject | undefined;
|
|
5
|
+
export declare function firstAvailableObject(experience: ExperienceConfig, timeUtcMs: number): ExperienceObject | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* The Focus button for an object: the experience's own focus preset when it has one, otherwise a plain focus on the object, so every
|
|
8
|
+
* listed object can be focused from the top bar (owner, 2026-10-18: the big moons had no focus button).
|
|
9
|
+
*/
|
|
10
|
+
export declare function focusPresetFor(experience: ExperienceConfig, object: {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly label: string;
|
|
13
|
+
}): ExperienceCameraPreset;
|
|
14
|
+
export declare function findCameraPreset(experience: ExperienceConfig, mode: CameraMode, target?: string): ExperienceCameraPreset | undefined;
|
|
15
|
+
/** The objects the Object list offers: the listed ones, and the selected one even when unlisted so the list never shows a blank. */
|
|
16
|
+
export declare function listedObjects(experience: ExperienceConfig, selectedId: string): readonly ExperienceObject[];
|
|
17
|
+
/** Unlisted objects that belong to `id` (an orbit line to its body), for the related buttons in the top bar. */
|
|
18
|
+
export declare function relatedObjects(experience: ExperienceConfig, id: string): readonly ExperienceObject[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export function isObjectAvailable(object, timeUtcMs) {
|
|
2
|
+
const bounds = object.availability;
|
|
3
|
+
return bounds === undefined || (timeUtcMs >= bounds.startUtcMs && timeUtcMs <= bounds.endUtcMs);
|
|
4
|
+
}
|
|
5
|
+
export function availableObjectById(experience, id, timeUtcMs) {
|
|
6
|
+
const object = experience.objects.find((candidate) => candidate.id === id);
|
|
7
|
+
return object !== undefined && isObjectAvailable(object, timeUtcMs) ? object : undefined;
|
|
8
|
+
}
|
|
9
|
+
export function firstAvailableObject(experience, timeUtcMs) {
|
|
10
|
+
return experience.objects.find((object) => isObjectAvailable(object, timeUtcMs));
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The Focus button for an object: the experience's own focus preset when it has one, otherwise a plain focus on the object, so every
|
|
14
|
+
* listed object can be focused from the top bar (owner, 2026-10-18: the big moons had no focus button).
|
|
15
|
+
*/
|
|
16
|
+
export function focusPresetFor(experience, object) {
|
|
17
|
+
return findCameraPreset(experience, "focus", object.id) ?? { id: `focus-${object.id}`, label: `Focus ${object.label}`, request: { kind: "focus", target: object.id } };
|
|
18
|
+
}
|
|
19
|
+
export function findCameraPreset(experience, mode, target) {
|
|
20
|
+
return experience.cameraPresets.find((preset) => {
|
|
21
|
+
const request = preset.request;
|
|
22
|
+
if (request.kind === "overview")
|
|
23
|
+
return mode === "overview";
|
|
24
|
+
return request.kind === mode && request.target === target;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/** The objects the Object list offers: the listed ones, and the selected one even when unlisted so the list never shows a blank. */
|
|
28
|
+
export function listedObjects(experience, selectedId) {
|
|
29
|
+
return experience.objects.filter((object) => object.listed !== false || object.id === selectedId);
|
|
30
|
+
}
|
|
31
|
+
/** Unlisted objects that belong to `id` (an orbit line to its body), for the related buttons in the top bar. */
|
|
32
|
+
export function relatedObjects(experience, id) {
|
|
33
|
+
return experience.objects.filter((object) => object.listed === false && object.partOf === id);
|
|
34
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The phone layout (T-081, O-020): the scene fills the screen; a name pill and the cog sit at the top, the two-line timeline at the bottom.
|
|
3
|
+
* The pill opens the top drawer (the full controls); the timeline's handle opens its drawer (speed slider, events). Information and story
|
|
4
|
+
* panels are bottom sheets. The shell sets data-phone from phoneLayout.ts (a narrow screen, or a short touch screen turned sideways), so the
|
|
5
|
+
* breakpoint is written once. The numbers (--drawer-ms, --*-max) are live settings. How a control looks is controls.css's job, not this file's.
|
|
6
|
+
*/
|
|
7
|
+
.astraeus-shell[data-phone="true"] {
|
|
8
|
+
--safe-top: env(safe-area-inset-top, 0px);
|
|
9
|
+
--safe-bottom: env(safe-area-inset-bottom, 0px);
|
|
10
|
+
--safe-left: env(safe-area-inset-left, 0px);
|
|
11
|
+
--safe-right: env(safe-area-inset-right, 0px);
|
|
12
|
+
--drawer-ease: cubic-bezier(0.32, 0.72, 0, 1);
|
|
13
|
+
--panel-bg: rgba(13, 13, 13, .94);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* ---- Top: the pill and the cog ---- */
|
|
17
|
+
[data-phone="true"] .controls-pill {
|
|
18
|
+
position: absolute;
|
|
19
|
+
z-index: 5;
|
|
20
|
+
top: calc(8px + var(--safe-top));
|
|
21
|
+
left: calc(8px + var(--safe-left));
|
|
22
|
+
max-width: calc(100% - 72px - var(--safe-left) - var(--safe-right));
|
|
23
|
+
gap: 8px;
|
|
24
|
+
/* A vertical swipe on the pill is ours (it opens the drawer), not a page pan. */
|
|
25
|
+
touch-action: none;
|
|
26
|
+
}
|
|
27
|
+
[data-phone="true"] .controls-pill-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
28
|
+
[data-phone="true"] .controls-pill[aria-expanded="true"] { visibility: hidden; }
|
|
29
|
+
[data-phone="true"] .developer-mode-toggle { z-index: 9; top: calc(8px + var(--safe-top)); right: calc(8px + var(--safe-right)); }
|
|
30
|
+
|
|
31
|
+
/* ---- The drawers ---- */
|
|
32
|
+
.drawer-handle { position: absolute; left: 50%; display: flex; width: 140px; height: 44px; transform: translateX(-50%); touch-action: none; }
|
|
33
|
+
.drawer-handle span { display: block; width: 36px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--ui-color, #f0e6da) 28%, transparent); }
|
|
34
|
+
.drawer-handle:hover span { background: color-mix(in srgb, var(--ui-color, #f0e6da) 50%, transparent); }
|
|
35
|
+
/* The hit area (44 px) reaches past the panel's edge so a thumb finds it; the grip is drawn inside the panel. */
|
|
36
|
+
.drawer-handle-top { top: -28px; align-items: flex-end; justify-content: center; padding-bottom: 10px; }
|
|
37
|
+
.drawer-handle-bottom { bottom: -20px; align-items: flex-start; justify-content: center; padding-top: 12px; }
|
|
38
|
+
|
|
39
|
+
[data-phone="true"] .controls-drawer {
|
|
40
|
+
position: absolute;
|
|
41
|
+
z-index: 7;
|
|
42
|
+
top: 0;
|
|
43
|
+
right: 0;
|
|
44
|
+
left: 0;
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
max-height: var(--controls-drawer-max, 60dvh);
|
|
47
|
+
overflow: visible;
|
|
48
|
+
/* The right edge reserves the Developer button's column (8 px gap + 44 px target + 8 px gap) so the button never sits over the controls (I-044). */
|
|
49
|
+
padding: calc(8px + var(--safe-top)) calc(60px + var(--safe-right)) 28px calc(12px + var(--safe-left));
|
|
50
|
+
border-bottom: 1px solid var(--ui-border, rgba(240, 230, 218, .18));
|
|
51
|
+
border-radius: 0 0 20px 20px;
|
|
52
|
+
background: var(--panel-bg);
|
|
53
|
+
backdrop-filter: blur(12px);
|
|
54
|
+
transform: translateY(-100%);
|
|
55
|
+
visibility: hidden;
|
|
56
|
+
transition: transform var(--drawer-ms, 240ms) var(--drawer-ease), visibility 0s linear var(--drawer-ms, 240ms);
|
|
57
|
+
}
|
|
58
|
+
[data-phone="true"] .controls-drawer[data-open="true"] {
|
|
59
|
+
transform: none;
|
|
60
|
+
visibility: visible;
|
|
61
|
+
transition: transform var(--drawer-ms, 240ms) var(--drawer-ease), visibility 0s;
|
|
62
|
+
}
|
|
63
|
+
[data-phone="true"] .controls-drawer .shell-toolbar { max-width: none; }
|
|
64
|
+
[data-phone="true"] .controls-drawer .top-bar {
|
|
65
|
+
display: grid;
|
|
66
|
+
grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
|
|
67
|
+
gap: 8px;
|
|
68
|
+
padding: 0;
|
|
69
|
+
border: 0;
|
|
70
|
+
background: none;
|
|
71
|
+
box-shadow: none;
|
|
72
|
+
backdrop-filter: none;
|
|
73
|
+
}
|
|
74
|
+
[data-phone="true"] .controls-drawer .object-camera-actions { display: contents; }
|
|
75
|
+
[data-phone="true"] .controls-drawer .top-bar-divider { display: none; }
|
|
76
|
+
/* The object list takes the first row, leaving room for the cog at the right. */
|
|
77
|
+
[data-phone="true"] .controls-drawer .object-picker { grid-column: 1 / -1; width: calc(100% - 52px); max-width: none; }
|
|
78
|
+
/* Each button: icon over a short word. */
|
|
79
|
+
[data-phone="true"] .controls-drawer .top-bar-button { width: auto; flex-direction: column; gap: 2px; padding: 0 4px; }
|
|
80
|
+
[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
|
+
[data-phone="true"] .controls-drawer .switch-control { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 8px; }
|
|
82
|
+
[data-phone="true"] .controls-drawer .scale-toggle { padding: 0 4px; }
|
|
83
|
+
[data-phone="true"] .controls-drawer .scale-toggle > span { font-size: 11px; }
|
|
84
|
+
[data-phone="true"] .controls-drawer .scale-menu,
|
|
85
|
+
[data-phone="true"] .controls-drawer .scale-explanation-panel { top: calc(100% + 6px); right: auto; left: 0; width: min(320px, calc(100vw - 32px)); }
|
|
86
|
+
[data-phone="true"] .controls-drawer .top-bar { position: relative; }
|
|
87
|
+
[data-phone="true"] .controls-drawer .scale-control { position: static; }
|
|
88
|
+
|
|
89
|
+
/* ---- Bottom: the two-line timeline and its drawer ---- */
|
|
90
|
+
[data-phone="true"] .timeline-bar {
|
|
91
|
+
right: calc(8px + var(--safe-right));
|
|
92
|
+
bottom: calc(8px + var(--safe-bottom));
|
|
93
|
+
left: calc(8px + var(--safe-left));
|
|
94
|
+
/* Slimmer (owner, 2026-10-18: "quite a bit of space above the pause play buttons same below the timeline"): the grip sits in the top
|
|
95
|
+
16 px, the handle's hit area ends where the buttons begin, and the 44 px track keeps its touch height. */
|
|
96
|
+
padding: 16px 10px 2px;
|
|
97
|
+
border-radius: 18px;
|
|
98
|
+
}
|
|
99
|
+
[data-phone="true"] .timeline-bar[data-drawer-open="true"] { z-index: 6; background: var(--panel-bg); }
|
|
100
|
+
[data-phone="true"] .timeline-main-row { gap: 4px; }
|
|
101
|
+
[data-phone="true"] .timeline-time { flex-basis: auto; width: auto; }
|
|
102
|
+
[data-phone="true"] .timeline-time-full { display: none; }
|
|
103
|
+
[data-phone="true"] .timeline-time-short { display: inline; }
|
|
104
|
+
[data-phone="true"] .timeline-bar .timeline-speed select { width: 96px; }
|
|
105
|
+
[data-phone="true"] .timeline-scrubber { flex-basis: 100%; }
|
|
106
|
+
|
|
107
|
+
.timeline-drawer {
|
|
108
|
+
display: grid;
|
|
109
|
+
grid-template-rows: 0fr;
|
|
110
|
+
visibility: hidden;
|
|
111
|
+
transition: grid-template-rows var(--drawer-ms, 240ms) var(--drawer-ease), visibility 0s linear var(--drawer-ms, 240ms);
|
|
112
|
+
}
|
|
113
|
+
.timeline-drawer[data-open="true"] {
|
|
114
|
+
grid-template-rows: 1fr;
|
|
115
|
+
visibility: visible;
|
|
116
|
+
transition: grid-template-rows var(--drawer-ms, 240ms) var(--drawer-ease), visibility 0s;
|
|
117
|
+
}
|
|
118
|
+
.timeline-drawer-body {
|
|
119
|
+
display: flex;
|
|
120
|
+
flex-direction: column;
|
|
121
|
+
gap: 10px;
|
|
122
|
+
min-height: 0;
|
|
123
|
+
max-height: calc(var(--timeline-drawer-max, 55dvh) - 130px);
|
|
124
|
+
overflow-y: auto;
|
|
125
|
+
overscroll-behavior: contain;
|
|
126
|
+
}
|
|
127
|
+
.timeline-drawer[data-open="true"] .timeline-drawer-body { padding-top: 10px; }
|
|
128
|
+
.timeline-speed-slider { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0 10px; color: var(--ui-muted, #c7bdb3); font-size: 13px; }
|
|
129
|
+
.timeline-speed-slider input { grid-column: 1 / -1; grid-row: 2; width: 100%; min-height: 44px; margin: 0; accent-color: var(--ui-accent, #fc6323); }
|
|
130
|
+
.timeline-speed-slider output { color: var(--ui-color, #f0e6da); font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; text-align: right; }
|
|
131
|
+
/* Inside the drawer the events list is plain content, not a pop-up. */
|
|
132
|
+
.timeline-drawer .timeline-expanded { position: static; width: auto; max-height: none; overflow: visible; padding: 0; border: 0; background: none; box-shadow: none; }
|
|
133
|
+
|
|
134
|
+
/* An event row is two short lines (the time, then its name) so the name is not cut off. */
|
|
135
|
+
.timeline-drawer .timeline-expanded li button { flex-direction: column; align-items: flex-start; gap: 0; padding-top: 4px; padding-bottom: 4px; }
|
|
136
|
+
.timeline-drawer .timeline-expanded li span { max-width: 100%; white-space: normal; }
|
|
137
|
+
|
|
138
|
+
/* ---- Sheets: information and story panels ---- */
|
|
139
|
+
[data-phone="true"] .sheet-handle { display: block; flex: 0 0 auto; align-self: center; width: 40px; height: 4px; border-radius: 999px; background: color-mix(in srgb, var(--ui-accent, #fc6323) 45%, transparent); }
|
|
140
|
+
/* Both sheets ride above the timeline bar, so the Play button is never covered (C-053 Observation 2, O-020 Decision 13). */
|
|
141
|
+
[data-phone="true"] .info-panel,
|
|
142
|
+
[data-phone="true"] .story-panel {
|
|
143
|
+
position: fixed;
|
|
144
|
+
top: auto;
|
|
145
|
+
bottom: calc(var(--timeline-space, 150px) + 8px);
|
|
146
|
+
right: calc(8px + var(--safe-right));
|
|
147
|
+
left: calc(8px + var(--safe-left));
|
|
148
|
+
box-sizing: border-box;
|
|
149
|
+
width: auto;
|
|
150
|
+
max-height: min(var(--sheet-max, 50dvh), calc(100dvh - var(--timeline-space, 150px) - 8px - 64px - var(--safe-top)));
|
|
151
|
+
overflow-y: auto;
|
|
152
|
+
overscroll-behavior: contain;
|
|
153
|
+
padding: 6px 14px 14px;
|
|
154
|
+
border-width: 1px;
|
|
155
|
+
border-radius: 16px;
|
|
156
|
+
animation: story-sheet-in var(--drawer-ms, 240ms) var(--drawer-ease);
|
|
157
|
+
}
|
|
158
|
+
[data-phone="true"] .info-panel { z-index: 8; background: #0e0e13; }
|
|
159
|
+
[data-phone="true"] .story-panel { z-index: 4; }
|
|
160
|
+
[data-phone="true"] .info-panel-header h2 { margin: 0; font-size: 22px; }
|
|
161
|
+
|
|
162
|
+
/* ---- The Developer panel below the pill, above the timeline ---- */
|
|
163
|
+
[data-phone="true"] .developer-tools {
|
|
164
|
+
top: calc(60px + var(--safe-top));
|
|
165
|
+
right: calc(8px + var(--safe-right));
|
|
166
|
+
left: calc(8px + var(--safe-left));
|
|
167
|
+
width: auto;
|
|
168
|
+
max-height: max(160px, calc(100dvh - 60px - var(--safe-top) - var(--timeline-space, 150px) - 16px));
|
|
169
|
+
padding: 9px;
|
|
170
|
+
}
|
|
171
|
+
[data-phone="true"] .shell-top { top: 8px; left: 8px; width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: none; }
|
|
172
|
+
[data-phone="true"] .astraeus-label { font-size: 12px; }
|
|
173
|
+
|
|
174
|
+
@media (prefers-reduced-motion: reduce) {
|
|
175
|
+
.controls-drawer,
|
|
176
|
+
.timeline-drawer,
|
|
177
|
+
.info-panel,
|
|
178
|
+
.story-panel { transition: none !important; animation: none !important; }
|
|
179
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type CSSProperties } from "react";
|
|
2
|
+
/** Phone: a narrow screen, or a short touch screen (a phone turned sideways, which is wider than 700 px). */
|
|
3
|
+
export declare const PHONE_QUERY = "(max-width: 700px), (max-height: 500px) and (pointer: coarse)";
|
|
4
|
+
/** A body tapped or clicked in the scene opens its information card on a wide screen (T-138); on a phone the tap only flies there, so the card does not cover the view. */
|
|
5
|
+
export declare function pickOpensInfo(phone: boolean): boolean;
|
|
6
|
+
/** How the phone drawers and sheets move and how tall they grow. */
|
|
7
|
+
export interface PhoneLayoutSettings {
|
|
8
|
+
/** How long a drawer or sheet takes to slide, in milliseconds; 0 for none. */
|
|
9
|
+
readonly animationMs: number;
|
|
10
|
+
/** The most the timeline drawer grows to, as a percent of the screen height. */
|
|
11
|
+
readonly timelineDrawerMaxPercent: number;
|
|
12
|
+
/** The most the top drawer grows to, as a percent of the screen height. */
|
|
13
|
+
readonly controlsDrawerMaxPercent: number;
|
|
14
|
+
/** The most an information or story sheet grows to, as a percent of the screen height. */
|
|
15
|
+
readonly sheetMaxPercent: number;
|
|
16
|
+
/** How far (px) a drag on a handle must travel to count as a swipe rather than a tap. */
|
|
17
|
+
readonly swipeThresholdPx: number;
|
|
18
|
+
}
|
|
19
|
+
export declare const DEFAULT_PHONE_LAYOUT: PhoneLayoutSettings;
|
|
20
|
+
/** The range each setting's live control offers. */
|
|
21
|
+
export declare const PHONE_LAYOUT_LIMITS: Readonly<Record<keyof PhoneLayoutSettings, {
|
|
22
|
+
readonly min: number;
|
|
23
|
+
readonly max: number;
|
|
24
|
+
readonly step: number;
|
|
25
|
+
}>>;
|
|
26
|
+
/** The settings as the custom properties the stylesheet reads. */
|
|
27
|
+
export declare function phoneLayoutStyle(settings: PhoneLayoutSettings): CSSProperties;
|
|
28
|
+
/** Whether the screen is a phone right now; follows a resize or a turn. */
|
|
29
|
+
export declare function usePhone(): boolean;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// The phone layout's live numbers and the one place that decides "this is a phone" (T-081, O-020). The shell sets `data-phone` from this and the
|
|
2
|
+
// stylesheet keys on that attribute, so the breakpoint is written once. Every number is a setting with a live control in Developer > Display settings.
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
/** Phone: a narrow screen, or a short touch screen (a phone turned sideways, which is wider than 700 px). */
|
|
5
|
+
export const PHONE_QUERY = "(max-width: 700px), (max-height: 500px) and (pointer: coarse)";
|
|
6
|
+
/** A body tapped or clicked in the scene opens its information card on a wide screen (T-138); on a phone the tap only flies there, so the card does not cover the view. */
|
|
7
|
+
export function pickOpensInfo(phone) {
|
|
8
|
+
return !phone;
|
|
9
|
+
}
|
|
10
|
+
export const DEFAULT_PHONE_LAYOUT = {
|
|
11
|
+
animationMs: 240,
|
|
12
|
+
timelineDrawerMaxPercent: 55,
|
|
13
|
+
controlsDrawerMaxPercent: 60,
|
|
14
|
+
sheetMaxPercent: 50,
|
|
15
|
+
swipeThresholdPx: 30,
|
|
16
|
+
};
|
|
17
|
+
/** The range each setting's live control offers. */
|
|
18
|
+
export const PHONE_LAYOUT_LIMITS = {
|
|
19
|
+
animationMs: { min: 0, max: 800, step: 20 },
|
|
20
|
+
timelineDrawerMaxPercent: { min: 25, max: 80, step: 5 },
|
|
21
|
+
controlsDrawerMaxPercent: { min: 25, max: 80, step: 5 },
|
|
22
|
+
sheetMaxPercent: { min: 30, max: 85, step: 5 },
|
|
23
|
+
swipeThresholdPx: { min: 10, max: 120, step: 5 },
|
|
24
|
+
};
|
|
25
|
+
/** The settings as the custom properties the stylesheet reads. */
|
|
26
|
+
export function phoneLayoutStyle(settings) {
|
|
27
|
+
return {
|
|
28
|
+
"--drawer-ms": `${settings.animationMs}ms`,
|
|
29
|
+
"--timeline-drawer-max": `${settings.timelineDrawerMaxPercent}dvh`,
|
|
30
|
+
"--controls-drawer-max": `${settings.controlsDrawerMaxPercent}dvh`,
|
|
31
|
+
"--sheet-max": `${settings.sheetMaxPercent}dvh`,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const query = () => (typeof window === "undefined" || typeof window.matchMedia !== "function" ? null : window.matchMedia(PHONE_QUERY));
|
|
35
|
+
/** Whether the screen is a phone right now; follows a resize or a turn. */
|
|
36
|
+
export function usePhone() {
|
|
37
|
+
const [phone, setPhone] = useState(() => query()?.matches ?? false);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
const list = query();
|
|
40
|
+
if (list === null)
|
|
41
|
+
return undefined;
|
|
42
|
+
const update = () => setPhone(list.matches);
|
|
43
|
+
update();
|
|
44
|
+
list.addEventListener("change", update);
|
|
45
|
+
return () => list.removeEventListener("change", update);
|
|
46
|
+
}, []);
|
|
47
|
+
return phone;
|
|
48
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ScalePolicy } from "../core/scalePolicy.js";
|
|
2
|
+
export type ScaleId = string;
|
|
3
|
+
export interface ScaleChoice {
|
|
4
|
+
readonly id: ScaleId;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly explanation: string;
|
|
7
|
+
}
|
|
8
|
+
/** Viewer wording for the engine's two scale policies. Neither changes what the readouts say. */
|
|
9
|
+
export declare const SCALE_CHOICES: readonly ScaleChoice[];
|
|
10
|
+
/** The choices an application offers, in its order, with the engine's wording. An unknown id is a mistake, not a fallback. */
|
|
11
|
+
export declare function scaleChoicesFor(ids: readonly ScaleId[]): readonly ScaleChoice[];
|
|
12
|
+
export declare const SCALE_NOTE = "Only the picture changes. Positions, distances, speeds and times in the readouts are the same under both.";
|
|
13
|
+
/** The policy a choice selects: one the application supplies, else True or Readable (the default is True). */
|
|
14
|
+
export declare function scalePolicyFor(id: ScaleId, supplied?: readonly ScalePolicy[]): ScalePolicy;
|
|
15
|
+
/** The scale to start in: the address's, when this experience offers it, else the experience's first (True when it states none). */
|
|
16
|
+
export declare function startScaleFor(linked: ScaleId | undefined, offered: readonly ScaleId[] | undefined): ScaleId;
|