astraeus 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +41 -5
  3. package/package.json +2 -1
  4. package/src/api/AstraeusScene.js +1 -1
  5. package/src/api/AstraeusScene.node.js +37 -0
  6. package/src/api/group.d.ts +7 -1
  7. package/src/api/index.d.ts +1 -0
  8. package/src/api/index.js +1 -0
  9. package/src/api/index.node.js +8 -0
  10. package/src/api/mount.js +3 -1
  11. package/src/api/mount.node.js +36 -0
  12. package/src/api/scene.d.ts +32 -6
  13. package/src/api/scene.js +123 -26
  14. package/src/api/story.d.ts +8 -2
  15. package/src/api/story.js +11 -0
  16. package/src/api/sunOrbit.d.ts +6 -0
  17. package/src/api/sunOrbit.js +24 -0
  18. package/src/app/App.d.ts +6 -2
  19. package/src/app/App.js +8 -4
  20. package/src/app/App.node.js +401 -0
  21. package/src/app/PanelLoadBoundary.d.ts +2 -1
  22. package/src/app/PanelLoadBoundary.js +2 -2
  23. package/src/app/SkyView.d.ts +3 -3
  24. package/src/app/SkyView.js +19 -10
  25. package/src/app/experienceDefinition.d.ts +8 -0
  26. package/src/app/sceneContentsHooks.js +2 -2
  27. package/src/app/sceneFrame.js +4 -3
  28. package/src/app/sceneFraming.d.ts +13 -0
  29. package/src/app/sceneFraming.js +22 -0
  30. package/src/app/skyModel.js +1 -1
  31. package/src/assets/pictures.d.ts +1 -1
  32. package/src/assets/sky.d.ts +4 -4
  33. package/src/assets/sky.js +12 -13
  34. package/src/core/bodies/io.js +1 -1
  35. package/src/core/bodies/jupiterData.js +2 -2
  36. package/src/core/bodies/jupiterMoons.js +8 -12
  37. package/src/core/bodies/moon.d.ts +8 -0
  38. package/src/core/bodies/moon.js +28 -5
  39. package/src/core/bodies/outerPlanetData.js +7 -7
  40. package/src/core/bodies/planetMoons.js +18 -27
  41. package/src/core/bodies/swiftTuttle.js +2 -0
  42. package/src/core/elementsBody.d.ts +2 -0
  43. package/src/core/elementsBody.js +3 -0
  44. package/src/core/moonTrajectory.js +3 -5
  45. package/src/core/planetModels.js +1 -1
  46. package/src/core/provenance.d.ts +6 -2
  47. package/src/core/provenance.js +3 -1
  48. package/src/shell/AstraeusShell.js +5 -3
  49. package/src/shell/AstraeusShell.node.js +225 -0
  50. package/src/shell/DisplaySwitches.js +1 -1
  51. package/src/shell/StoryPanelView.js +3 -1
  52. package/src/shell/TimelineBar.node.js +75 -0
  53. package/src/shell/TopBar.node.js +14 -0
  54. package/src/shell/experience.d.ts +2 -0
  55. package/src/shell/infoModel.js +3 -1
  56. package/src/shell/phone.css +1 -1
  57. package/src/shell/useDrawers.js +1 -1
  58. package/src/shell/useZoomThrough.d.ts +7 -0
  59. package/src/shell/useZoomThrough.js +51 -0
@@ -35,6 +35,28 @@ function sphereRadius(focus, policy, source) {
35
35
  // A marker-kind body that also draws a self-bright sphere (emissive) has that radius too: the camera must stay outside it.
36
36
  return asset.visual.kind === "sphere" || asset.visual.emissive === true ? policy.mapRadius(asset.definition.radiusKm, asset.definition.id) : null;
37
37
  }
38
+ /** The camera's vertical field of view in degrees (the Canvas's `fov`). */
39
+ export const CAMERA_FOV_DEG = 45;
40
+ /** Room left round a fitted orbit, as a multiple. */
41
+ export const ORBIT_FIT_MARGIN = 1.1;
42
+ /** The far plane of a fitted reach, as a multiple of the reach (what `camera.setReach` uses too). */
43
+ export const FAR_PER_REACH = 2.5;
44
+ /**
45
+ * The camera-to-focus distance at which a sphere of radius `farthestUnits` about the focus fits the canvas from any view direction:
46
+ * the farthest distance divided by the sine of the narrower half field of view (vertical, or horizontal from the aspect ratio), times the margin.
47
+ */
48
+ export function fitReach(farthestUnits, aspect, fovDeg = CAMERA_FOV_DEG) {
49
+ const halfVertical = (fovDeg * Math.PI) / 360;
50
+ const halfHorizontal = Math.atan(Math.tan(halfVertical) * aspect);
51
+ return (ORBIT_FIT_MARGIN * farthestUnits) / Math.sin(Math.min(halfVertical, halfHorizontal));
52
+ }
53
+ /** The declared reach as the viewer applies it now: a fitting reach becomes a farthest zoom-out and far plane for the canvas shape `aspect` (width over height); any other is returned as is. */
54
+ export function liveReach(declared, policy, aspect) {
55
+ if (declared.fitOrbit === undefined)
56
+ return declared;
57
+ const maxFocusDistance = fitReach(scaleLength(policy, declared.fitOrbit.farthestKm()), aspect > 0 ? aspect : 1);
58
+ return { maxFocusDistance, far: maxFocusDistance * FAR_PER_REACH };
59
+ }
38
60
  /** Zoom limits per focus kind; a declared reach replaces only the farthest distance. */
39
61
  export function focusLimits(focus, frame, policy, declared) {
40
62
  const max = declared.maxFocusDistance ?? Math.max(30, frame.span * 3.5);
@@ -32,7 +32,7 @@ export function skyObject(status) {
32
32
  const provenance = createProvenance({
33
33
  sourceType: "observed",
34
34
  sources: SKY_SOURCES,
35
- accuracy: "Star directions are the catalogue's J2000 positions to about an arcsecond. The Milky Way picture is the ESO photographic panorama, placed by its galactic coordinates (agrees with the stars only to a few degrees).",
35
+ accuracy: "Star directions are the catalogue's J2000 positions to about an arcsecond. The Milky Way picture is a Gaia EDR3 render with the foreground stars removed, placed by its galactic coordinates (the Magellanic Clouds land within half a degree).",
36
36
  notes: starLine,
37
37
  });
38
38
  return {
@@ -1,7 +1,7 @@
1
1
  import type { TextureRef } from "./licence.js";
2
2
  import type { BodyVisual } from "./visual.js";
3
3
  /**
4
- * Pictures that ship in a data package (`astraeus-data`) rather than in the engine, by name: a body id (`titan`), `venus-8k`, `milky-way-left`.
4
+ * Pictures that ship in a data package (`astraeus-data`) rather than in the engine, by name: a body id (`titan`), `venus-8k`, `milky-way`.
5
5
  * Each carries its own licence record, so the credit travels with the file (PROV-02). A picture that was never registered is simply absent:
6
6
  * the body is drawn as a flat colour, the sky without its Milky Way (DATA-01: nothing is invented to fill the gap).
7
7
  */
@@ -71,12 +71,12 @@ export declare function starAppearance(vMag: number): {
71
71
  readonly brightness: number;
72
72
  };
73
73
  /**
74
- * The picture in two square halves, left (longitude 180 to 0, running to the centre) then right; each is under every GPU's texture limit.
75
- * The files ship in astraeus-data (names "milky-way-left", "milky-way-right"); without that package the list is empty and no picture is drawn.
74
+ * The picture, one 3840x1920 image (under every GPU's texture limit). The file ships in astraeus-data (name "milky-way");
75
+ * without that package the list is empty and no picture is drawn.
76
76
  */
77
77
  export declare const milkyWayTiles: () => readonly TextureRef[];
78
- /** The ESO panorama as a two-tile galactic picture: the one Milky Way picture. */
79
- export declare const ESO_PICTURE: PictureSet;
78
+ /** The Gaia EDR3 render (stars removed) as a one-tile galactic picture: the one Milky Way picture. */
79
+ export declare const MILKY_WAY_PICTURE: PictureSet;
80
80
  export declare const SKY_SOURCES: readonly string[];
81
81
  /** What an experience may say about the sky: all fields optional, default on at full brightness, with the Milky Way picture off. */
82
82
  export interface SkySettings {
package/src/assets/sky.js CHANGED
@@ -116,24 +116,23 @@ export function starAppearance(vMag) {
116
116
  }
117
117
  // ---------------------------------------------------------------- sources and the shell item
118
118
  /**
119
- * The picture in two square halves, left (longitude 180 to 0, running to the centre) then right; each is under every GPU's texture limit.
120
- * The files ship in astraeus-data (names "milky-way-left", "milky-way-right"); without that package the list is empty and no picture is drawn.
119
+ * The picture, one 3840x1920 image (under every GPU's texture limit). The file ships in astraeus-data (name "milky-way");
120
+ * without that package the list is empty and no picture is drawn.
121
121
  */
122
- export const milkyWayTiles = () => ["milky-way-left", "milky-way-right"].flatMap((name) => pictureOf(name) ?? []);
123
- /** The ESO panorama as a two-tile galactic picture: the one Milky Way picture. */
124
- export const ESO_PICTURE = Object.freeze({
125
- name: "ESO Milky Way panorama (eso0932a)",
126
- columns: 2,
122
+ export const milkyWayTiles = () => ["milky-way"].flatMap((name) => pictureOf(name) ?? []);
123
+ /** The Gaia EDR3 render (stars removed) as a one-tile galactic picture: the one Milky Way picture. */
124
+ export const MILKY_WAY_PICTURE = Object.freeze({
125
+ name: "Milky Way, Gaia EDR3 render without foreground stars (Kevinmloch)",
126
+ columns: 1,
127
127
  rows: 1,
128
128
  get tiles() {
129
- const halves = milkyWayTiles();
130
- return halves.length < 2 ? [] : halves.map((tile, column) => Object.freeze({ column, row: 0, url: tile.url, widthPx: tile.widthPx, heightPx: tile.heightPx }));
129
+ return milkyWayTiles().map((tile) => Object.freeze({ column: 0, row: 0, url: tile.url, widthPx: tile.widthPx, heightPx: tile.heightPx }));
131
130
  },
132
- credit: "ESO/S. Brunier",
133
- licence: "CC BY 4.0",
134
- source: "https://www.eso.org/public/images/eso0932a/",
131
+ credit: "Kevinmloch (bsrender), Gaia EDR3, ESA/Gaia/DPAC",
132
+ licence: "CC BY-SA 4.0",
133
+ source: "https://commons.wikimedia.org/wiki/File:Milky_Way_360_equirectangular_rendering_with_foreground_stars_removed.png",
135
134
  });
136
135
  export const SKY_SOURCES = Object.freeze([
137
136
  "HYG star database v4.2 (Hipparcos, Yale Bright Star, Gliese catalogues), astronexus (https://www.astronexus.com/projects/hyg), CC BY-SA 4.0. The star file only; the code is MIT.",
138
- "The Milky Way panorama, ESO/S. Brunier (https://www.eso.org/public/images/eso0932a/), CC BY 4.0.",
137
+ "The Milky Way picture: Milky Way render by Kevinmloch (bsrender) from Gaia EDR3, ESA/Gaia/DPAC (https://commons.wikimedia.org/wiki/File:Milky_Way_360_equirectangular_rendering_with_foreground_stars_removed.png), CC BY-SA 4.0. Resized.",
139
138
  ]);
@@ -6,7 +6,7 @@ import { createOrbTwoBodyAdapter } from "../twoBodyAdapter.js";
6
6
  import { JUPITER } from "./jupiter.js";
7
7
  import { trueAnomalyFromMean } from "../keplerAnomaly.js";
8
8
  import { fittedMoonPosition, IO_FITTED_BINDING, JUPITER_MOON_FIT_SPAN } from "./jupiterMoons.js";
9
- import ioRecord from "../../../data/orbits/io.json";
9
+ import ioRecord from "../../../data/orbits/io.json" with { type: "json" };
10
10
  export { trueAnomalyFromMean };
11
11
  const DEGREES = Math.PI / 180;
12
12
  const ORIENTATION_SAMPLE_SECONDS = 1800;
@@ -3,7 +3,7 @@
3
3
  * T-097) and the ring bands (data/rings/jupiter.json). Raw JSON: src/assets parses and checks them (layer rule: assets reach data
4
4
  * through core).
5
5
  */
6
- import moonCatalogueFile from "../../../data/moons/jupiter.json";
7
- import ringFile from "../../../data/rings/jupiter.json";
6
+ import moonCatalogueFile from "../../../data/moons/jupiter.json" with { type: "json" };
7
+ import ringFile from "../../../data/rings/jupiter.json" with { type: "json" };
8
8
  export const JUPITER_MOON_CATALOGUE_FILE = moonCatalogueFile;
9
9
  export const JUPITER_RING_FILE = ringFile;
@@ -1,14 +1,10 @@
1
1
  import { iauElementsFromRecord } from "../iauRotation.js";
2
2
  import { JUPITER } from "./jupiter.js";
3
3
  import { chunksNeeded, createMoonSystem, MOON_FIT_SPAN, moonFitSource } from "./moonSystem.js";
4
- import json1 from "../../../data/orbits/callisto.json";
5
- const { rotation: callistoRotation } = json1;
6
- import json2 from "../../../data/orbits/europa.json";
7
- const { rotation: europaRotation } = json2;
8
- import json3 from "../../../data/orbits/ganymede.json";
9
- const { rotation: ganymedeRotation } = json3;
10
- import json4 from "../../../data/orbits/io.json";
11
- const { rotation: ioRotation } = json4;
4
+ import callistoOrbit from "../../../data/orbits/callisto.json" with { type: "json" };
5
+ import europaOrbit from "../../../data/orbits/europa.json" with { type: "json" };
6
+ import ganymedeOrbit from "../../../data/orbits/ganymede.json" with { type: "json" };
7
+ import ioOrbit from "../../../data/orbits/io.json" with { type: "json" };
12
8
  /** The span the committed fits cover (T-096: 2010-01-01 to 2030-01-01 TDB, chunked per calendar year). */
13
9
  export const JUPITER_MOON_FIT_SPAN = MOON_FIT_SPAN;
14
10
  export const JUPITER_MOON_FIT_SOURCE = moonFitSource("Jupiter");
@@ -30,7 +26,7 @@ export const FITTED_MOON_TIDAL_LOCK = JUPITER_MOON_SYSTEM.tidalLockNote;
30
26
  /** What every mapped Jupiter moon's record says about its position, with its own worst figure from T-096. */
31
27
  export const fittedMoonPosition = JUPITER_MOON_SYSTEM.position;
32
28
  /** The Galilean moons turn synchronously: their prime meridians are the IAU records saved with their orbits (`data/orbits/`), the one source. */
33
- export const IO_ROTATION = iauElementsFromRecord(ioRotation);
29
+ export const IO_ROTATION = iauElementsFromRecord(ioOrbit.rotation);
34
30
  const jupiterMoon = (id, label, radiusKm, gmKm3S2, worstM, header) => JUPITER_MOON_SYSTEM.mappedMoon({ id, label, radiusKm, gmKm3S2, worstM, header });
35
31
  export const EUROPA = jupiterMoon("europa", "Europa", 1560.8, 3202.7121, 0.0755, "Mean radius (km) = 1560.8 +- 0.3, GM (km^3/s^2) = 3202.7121 +- 0.0054");
36
32
  export const GANYMEDE = jupiterMoon("ganymede", "Ganymede", 2631.2, 9887.8328, 0.0662, "Mean radius (km) = 2631.2 +- 1.7, GM (km^3/s^2) = 9887.8328 +- 0.0074");
@@ -38,7 +34,7 @@ export const CALLISTO = jupiterMoon("callisto", "Callisto", 2410.3, 7179.2834, 0
38
34
  /** Io's binding is in `io.ts` with its definition; the three below are the same pattern. */
39
35
  export const IO_FITTED_BINDING = JUPITER_MOON_SYSTEM.binding("io", IO_ROTATION);
40
36
  export const MAPPED_MOON_BINDINGS = Object.freeze([
41
- JUPITER_MOON_SYSTEM.binding(EUROPA.id, iauElementsFromRecord(europaRotation)),
42
- JUPITER_MOON_SYSTEM.binding(GANYMEDE.id, iauElementsFromRecord(ganymedeRotation)),
43
- JUPITER_MOON_SYSTEM.binding(CALLISTO.id, iauElementsFromRecord(callistoRotation)),
37
+ JUPITER_MOON_SYSTEM.binding(EUROPA.id, iauElementsFromRecord(europaOrbit.rotation)),
38
+ JUPITER_MOON_SYSTEM.binding(GANYMEDE.id, iauElementsFromRecord(ganymedeOrbit.rotation)),
39
+ JUPITER_MOON_SYSTEM.binding(CALLISTO.id, iauElementsFromRecord(callistoOrbit.rotation)),
44
40
  ]);
@@ -1,3 +1,11 @@
1
1
  import type { CelestialBodyDefinition, EphemerisRecord } from "../body.js";
2
+ import type { IauRotationElements } from "../iauRotation.js";
3
+ /** Source of the Moon's rotation constants (PROV-01). The 2015 report gives none for the Moon, so these are the 2009 report's, as NAIF saved them. */
4
+ export declare const MOON_IAU_REPORT = "Archinal et al., Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2009, Celestial Mechanics and Dynamical Astronomy 109, 101 (2011), as transcribed in NAIF pck00011.tpc (2022-12-27), BODY301 and BODY3_NUT_PREC_ANGLES";
5
+ /**
6
+ * The Moon's pole and prime meridian, including the report's libration terms E1 to E13 (the pole and W terms the report lists): degrees, pole per Julian
7
+ * century, W per day, from J2000 TDB. The report's -1.4e-12 d^2 term in W is left out (0.0005 degrees at 50 years from J2000). Body +X is longitude 0, +Z the pole.
8
+ */
9
+ export declare const MOON_ROTATION: IauRotationElements;
2
10
  export declare const MOON_EPHEMERIS: EphemerisRecord;
3
11
  export declare const MOON: CelestialBodyDefinition;
@@ -1,6 +1,29 @@
1
1
  import { createProvenance } from "../provenance.js";
2
- const TIDAL_LOCK_LIMITATION = "The Moon's orientation is an approximate tidal lock that keeps its near side towards Earth, with no libration, so surface features can sit several degrees from their true place.";
3
- const LANDING_SITE_OFFSET = "Because there is no libration, an IAU-placed landing site (measured at the Sea of Tranquility in Spike 02) sits 254 km (8.4°) from the same selenographic coordinates on this Moon at touchdown (docs/ASTRAEUS_SPIKE_02.md).";
2
+ /** Source of the Moon's rotation constants (PROV-01). The 2015 report gives none for the Moon, so these are the 2009 report's, as NAIF saved them. */
3
+ export const MOON_IAU_REPORT = "Archinal et al., Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2009, Celestial Mechanics and Dynamical Astronomy 109, 101 (2011), as transcribed in NAIF pck00011.tpc (2022-12-27), BODY301 and BODY3_NUT_PREC_ANGLES";
4
+ /**
5
+ * The Moon's pole and prime meridian, including the report's libration terms E1 to E13 (the pole and W terms the report lists): degrees, pole per Julian
6
+ * century, W per day, from J2000 TDB. The report's -1.4e-12 d^2 term in W is left out (0.0005 degrees at 50 years from J2000). Body +X is longitude 0, +Z the pole.
7
+ */
8
+ export const MOON_ROTATION = Object.freeze({
9
+ poleRaDeg: [269.9949, 0.0031],
10
+ poleDecDeg: [66.5392, 0.013],
11
+ primeMeridianDeg: [38.3213, 13.17635815],
12
+ periodic: Object.freeze({
13
+ anglesDeg: [
14
+ [125.045, -1935.5364525], [250.089, -3871.072905], [260.008, 475263.3328725], [176.625, 487269.629985],
15
+ [357.529, 35999.0509575], [311.589, 964468.49931], [134.963, 477198.869325], [276.617, 12006.300765],
16
+ [34.226, 63863.5132425], [15.134, -5806.6093575], [119.743, 131.84064], [239.961, 6003.1503825],
17
+ [25.053, 473327.79642],
18
+ ],
19
+ poleRaDeg: [-3.8787, -0.1204, 0.07, -0.0172, 0, 0.0072, 0, 0, 0, -0.0052, 0, 0, 0.0043],
20
+ poleDecDeg: [1.5419, 0.0239, -0.0278, 0.0068, 0, -0.0029, 0.0009, 0, 0, 0.0008, 0, 0, -0.0009],
21
+ primeMeridianDeg: [3.561, 0.1208, -0.0642, 0.0158, 0.0252, -0.0066, -0.0047, -0.0046, 0.0028, 0.0052, 0.004, 0.0019, -0.0044],
22
+ }),
23
+ citation: MOON_IAU_REPORT,
24
+ });
25
+ const ROTATION_LIMITATION = "The Moon's orientation is the IAU mean-Earth rotation model with its libration terms, so the Moon shows libration in longitude and latitude. It is a published series, not the JPL lunar ephemeris: its sub-Earth point and pole differ from Horizons' by at most 0.01 degrees (about 0.3 km on the surface) at the seven dates from 1969 to 2050 that were checked, and its accuracy elsewhere is not stated by the source.";
26
+ const LANDING_SITE_OFFSET = "A landing site placed by the IAU model (a mission reconstruction's, measured at the Sea of Tranquility) sits 0.01 km (under 0.001 degrees) from the same selenographic coordinates on this Moon at touchdown, because the reconstruction and the drawn Moon use the same IAU model (docs/ASTRAEUS_SPIKE_02.md measured 254 km, 8.4 degrees, under the earlier tidal lock).";
4
27
  export const MOON_EPHEMERIS = {
5
28
  provenance: createProvenance({
6
29
  sourceType: "ephemeris",
@@ -9,7 +32,7 @@ export const MOON_EPHEMERIS = {
9
32
  notes: "Body size is the volumetric mean radius (NASA NSSDC fact sheet).",
10
33
  }),
11
34
  knownLimitations: [
12
- TIDAL_LOCK_LIMITATION,
35
+ ROTATION_LIMITATION,
13
36
  "No velocity is modelled for the Moon, so it has no speed readout.",
14
37
  ],
15
38
  };
@@ -20,7 +43,7 @@ export const MOON = Object.freeze({
20
43
  radiusKm: 1737.4,
21
44
  gmKm3S2: 4902.800066,
22
45
  parentId: "earth",
23
- orientation: "tidal-lock",
46
+ orientation: "iau-rotation",
24
47
  accuracy: Object.freeze({
25
48
  dimensions: createProvenance({
26
49
  sourceType: "observed",
@@ -31,6 +54,6 @@ export const MOON = Object.freeze({
31
54
  position: MOON_EPHEMERIS.provenance,
32
55
  // The sampled Horizons comparison range (tests/fixtures/moon-horizons.json); the truncated series states no validity range of its own.
33
56
  validUtc: Object.freeze({ startUtcMs: Date.UTC(2022, 5, 1), endUtcMs: Date.UTC(2025, 5, 1) }),
34
- orientationLimitations: Object.freeze([TIDAL_LOCK_LIMITATION, LANDING_SITE_OFFSET]),
57
+ orientationLimitations: Object.freeze([ROTATION_LIMITATION, LANDING_SITE_OFFSET]),
35
58
  }),
36
59
  });
@@ -3,13 +3,13 @@
3
3
  * (data/moons/<planet>.json, T-115) and the ring bands (data/rings/<planet>.json). Raw JSON: src/assets parses and checks them (layer rule:
4
4
  * assets reach data through core), as `jupiterData.ts` does for Jupiter.
5
5
  */
6
- import neptuneMoons from "../../../data/moons/neptune.json";
7
- import plutoMoons from "../../../data/moons/pluto.json";
8
- import saturnMoons from "../../../data/moons/saturn.json";
9
- import uranusMoons from "../../../data/moons/uranus.json";
10
- import neptuneRings from "../../../data/rings/neptune.json";
11
- import saturnRings from "../../../data/rings/saturn.json";
12
- import uranusRings from "../../../data/rings/uranus.json";
6
+ import neptuneMoons from "../../../data/moons/neptune.json" with { type: "json" };
7
+ import plutoMoons from "../../../data/moons/pluto.json" with { type: "json" };
8
+ import saturnMoons from "../../../data/moons/saturn.json" with { type: "json" };
9
+ import uranusMoons from "../../../data/moons/uranus.json" with { type: "json" };
10
+ import neptuneRings from "../../../data/rings/neptune.json" with { type: "json" };
11
+ import saturnRings from "../../../data/rings/saturn.json" with { type: "json" };
12
+ import uranusRings from "../../../data/rings/uranus.json" with { type: "json" };
13
13
  export const SATURN_MOON_CATALOGUE_FILE = saturnMoons;
14
14
  export const URANUS_MOON_CATALOGUE_FILE = uranusMoons;
15
15
  export const NEPTUNE_MOON_CATALOGUE_FILE = neptuneMoons;
@@ -3,24 +3,15 @@ import { createPlanetSunTrajectory } from "./planetTrajectory.js";
3
3
  import { MARS } from "./mars.js";
4
4
  import { createMoonSystem, moonFitSource } from "./moonSystem.js";
5
5
  import { NEPTUNE, PLUTO, PLUTO_ROTATION, SATURN, URANUS } from "./outerPlanets.js";
6
- import json5 from "../../../data/orbits/charon.json";
7
- const { rotation: charonRotation } = json5;
8
- import json6 from "../../../data/orbits/dione.json";
9
- const { rotation: dioneRotation } = json6;
10
- import json7 from "../../../data/orbits/enceladus.json";
11
- const { rotation: enceladusRotation } = json7;
12
- import json8 from "../../../data/orbits/iapetus.json";
13
- const { rotation: iapetusRotation } = json8;
14
- import json9 from "../../../data/orbits/mimas.json";
15
- const { rotation: mimasRotation } = json9;
16
- import json10 from "../../../data/orbits/rhea.json";
17
- const { rotation: rheaRotation } = json10;
18
- import json11 from "../../../data/orbits/tethys.json";
19
- const { rotation: tethysRotation } = json11;
20
- import json12 from "../../../data/orbits/titan.json";
21
- const { rotation: titanRotation } = json12;
22
- import json13 from "../../../data/orbits/triton.json";
23
- const { rotation: tritonRotation } = json13;
6
+ import charonOrbit from "../../../data/orbits/charon.json" with { type: "json" };
7
+ import dioneOrbit from "../../../data/orbits/dione.json" with { type: "json" };
8
+ import enceladusOrbit from "../../../data/orbits/enceladus.json" with { type: "json" };
9
+ import iapetusOrbit from "../../../data/orbits/iapetus.json" with { type: "json" };
10
+ import mimasOrbit from "../../../data/orbits/mimas.json" with { type: "json" };
11
+ import rheaOrbit from "../../../data/orbits/rhea.json" with { type: "json" };
12
+ import tethysOrbit from "../../../data/orbits/tethys.json" with { type: "json" };
13
+ import titanOrbit from "../../../data/orbits/titan.json" with { type: "json" };
14
+ import tritonOrbit from "../../../data/orbits/triton.json" with { type: "json" };
24
15
  export const MARS_MOON_SYSTEM = createMoonSystem({
25
16
  centre: "mars", centreLabel: "Mars", centreGmKm3S2: MARS.gmKm3S2, ephemerisName: "mar099", fitSource: moonFitSource("Mars")
26
17
  });
@@ -58,15 +49,15 @@ export const PLANET_MOON_DEFINITIONS = Object.freeze([PHOBOS, DEIMOS, MIMAS, ENC
58
49
  export const PLANET_MOON_BINDINGS = Object.freeze([
59
50
  MARS_MOON_SYSTEM.binding(PHOBOS.id),
60
51
  MARS_MOON_SYSTEM.binding(DEIMOS.id),
61
- SATURN_MOON_SYSTEM.binding(MIMAS.id, iauElementsFromRecord(mimasRotation)),
62
- SATURN_MOON_SYSTEM.binding(ENCELADUS.id, iauElementsFromRecord(enceladusRotation)),
63
- SATURN_MOON_SYSTEM.binding(TETHYS.id, iauElementsFromRecord(tethysRotation)),
64
- SATURN_MOON_SYSTEM.binding(DIONE.id, iauElementsFromRecord(dioneRotation)),
65
- SATURN_MOON_SYSTEM.binding(RHEA.id, iauElementsFromRecord(rheaRotation)),
66
- SATURN_MOON_SYSTEM.binding(TITAN.id, iauElementsFromRecord(titanRotation)),
67
- SATURN_MOON_SYSTEM.binding(IAPETUS.id, iauElementsFromRecord(iapetusRotation)),
68
- NEPTUNE_MOON_SYSTEM.binding(TRITON.id, iauElementsFromRecord(tritonRotation)),
69
- PLUTO_MOON_SYSTEM.binding(CHARON.id, iauElementsFromRecord(charonRotation)),
52
+ SATURN_MOON_SYSTEM.binding(MIMAS.id, iauElementsFromRecord(mimasOrbit.rotation)),
53
+ SATURN_MOON_SYSTEM.binding(ENCELADUS.id, iauElementsFromRecord(enceladusOrbit.rotation)),
54
+ SATURN_MOON_SYSTEM.binding(TETHYS.id, iauElementsFromRecord(tethysOrbit.rotation)),
55
+ SATURN_MOON_SYSTEM.binding(DIONE.id, iauElementsFromRecord(dioneOrbit.rotation)),
56
+ SATURN_MOON_SYSTEM.binding(RHEA.id, iauElementsFromRecord(rheaOrbit.rotation)),
57
+ SATURN_MOON_SYSTEM.binding(TITAN.id, iauElementsFromRecord(titanOrbit.rotation)),
58
+ SATURN_MOON_SYSTEM.binding(IAPETUS.id, iauElementsFromRecord(iapetusOrbit.rotation)),
59
+ NEPTUNE_MOON_SYSTEM.binding(TRITON.id, iauElementsFromRecord(tritonOrbit.rotation)),
60
+ PLUTO_MOON_SYSTEM.binding(CHARON.id, iauElementsFromRecord(charonOrbit.rotation)),
70
61
  ]);
71
62
  /**
72
63
  * Pluto's own offset from the system barycentre at `timeUtcMs`, from its system's centre series, or null while the system is not loaded or the
@@ -96,6 +96,8 @@ export const SWIFT_TUTTLE = Object.freeze({
96
96
  sources: [SWIFT_TUTTLE_ELEMENTS.citation, "Two-body motion about the Sun's gravitational parameter (catalogue)", "Compared with JPL Horizons, target DES=109P;CAP (solution JPL#32), centre 500@10, ICRF"],
97
97
  accuracy: `Position was compared with JPL Horizons at eight dates from 1990 to 2030: the largest Sun-centred difference is about ${SWIFT_TUTTLE_MAX_ERROR_KM.toLocaleString("en-US")} km (${(SWIFT_TUTTLE_MAX_ERROR_FRACTION * 100).toFixed(2)}% of its distance from the Sun at that date), so this is an approximate position for drawing the orbit and the comet's place on it, not an ephemeris. This is the largest difference at the eight dates compared, not a bound for every date.`,
98
98
  notes: "Geometric position about the Sun's centre; no light-time. Elements are osculating at the epoch.",
99
+ accuracyClass: "approximate",
100
+ maxErrorFraction: SWIFT_TUTTLE_MAX_ERROR_FRACTION,
99
101
  }),
100
102
  validUtc: COMPARED_UTC,
101
103
  orientationLimitations: SWIFT_TUTTLE_LIMITATIONS,
@@ -9,10 +9,12 @@ export declare const DEFAULT_ELEMENTS_MARKER_SIZE_PX = 7;
9
9
  * within the larger one, "indicative". Both are good enough to draw where the body is on its orbit at overview scale and neither is an ephemeris.
10
10
  */
11
11
  export declare const APPROXIMATE_LIMIT_FRACTION = 0.01;
12
+ /** The larger limit of the same rule: within 5% of the body's distance from the Sun at every compared date is "indicative". */
12
13
  export declare const INDICATIVE_LIMIT_FRACTION = 0.05;
13
14
  /** The classification a largest error fraction earns, or null when it earns neither (the body should not be drawn from its elements alone). */
14
15
  export declare function classifyPositionError(maxFraction: number): AccuracyClassification | null;
15
16
  export type ElementsTimeScale = "TDB" | "TT" | "UTC";
17
+ /** The class a position comparison earns: `"approximate"` or `"indicative"` (see `classifyPositionError`). */
16
18
  export type AccuracyClassification = "approximate" | "indicative";
17
19
  /** A cited fact: the solution it came from, where it was read, and when. */
18
20
  export interface ElementsSource {
@@ -15,6 +15,7 @@ export const DEFAULT_ELEMENTS_MARKER_SIZE_PX = 7;
15
15
  * within the larger one, "indicative". Both are good enough to draw where the body is on its orbit at overview scale and neither is an ephemeris.
16
16
  */
17
17
  export const APPROXIMATE_LIMIT_FRACTION = 0.01;
18
+ /** The larger limit of the same rule: within 5% of the body's distance from the Sun at every compared date is "indicative". */
18
19
  export const INDICATIVE_LIMIT_FRACTION = 0.05;
19
20
  /** The classification a largest error fraction earns, or null when it earns neither (the body should not be drawn from its elements alone). */
20
21
  export function classifyPositionError(maxFraction) {
@@ -183,6 +184,8 @@ export function buildElementsBody(input, centre) {
183
184
  sources: [citation, `Two-body motion about the gravitational parameter of "${centre.id}" (catalogue)`],
184
185
  accuracy: `${body.accuracy.classification}: ${body.accuracy.statement}`,
185
186
  notes: "Geometric position about the Sun's centre; no light-time. Elements are osculating at the epoch.",
187
+ accuracyClass: body.accuracy.classification,
188
+ maxErrorFraction: body.accuracy.classification === "approximate" ? APPROXIMATE_LIMIT_FRACTION : INDICATIVE_LIMIT_FRACTION,
186
189
  }),
187
190
  validUtc: Object.freeze({ startUtcMs: Date.parse(body.accuracy.validFromUtc), endUtcMs: Date.parse(body.accuracy.validToUtc) }),
188
191
  orientationLimitations: Object.freeze([
@@ -1,6 +1,6 @@
1
- import { moonOrientationFromOrbit } from "./bodyOrientation.js";
1
+ import { MOON_ROTATION } from "./bodies/moon.js";
2
+ import { iauOrientation } from "./iauRotation.js";
2
3
  import { assertUtcUnixMs, createState, EQJ } from "./state.js";
3
- const ORIENTATION_SAMPLE_SECONDS = 1800;
4
4
  /** The Moon in its one native centre, Earth. Any other centre is the state resolver's composition, not this provider's. */
5
5
  export class MoonTrajectory {
6
6
  adapter;
@@ -13,9 +13,7 @@ export class MoonTrajectory {
13
13
  if (center !== "earth")
14
14
  throw new RangeError("Moon trajectory center must be Earth; the state resolver recentres it");
15
15
  const moonFromEarthKm = this.adapter.moonPositionKm(timeUtcMs);
16
- const earlier = this.adapter.moonPositionKm(timeUtcMs - ORIENTATION_SAMPLE_SECONDS * 1000);
17
- const later = this.adapter.moonPositionKm(timeUtcMs + ORIENTATION_SAMPLE_SECONDS * 1000);
18
- const orientation = moonOrientationFromOrbit(moonFromEarthKm, earlier, later);
16
+ const orientation = iauOrientation(MOON_ROTATION, this.adapter.daysSinceJ2000Tt(timeUtcMs));
19
17
  return createState({
20
18
  body: "moon",
21
19
  center: "earth",
@@ -1,4 +1,4 @@
1
- import fits from "../../data/ephemerides/planets/planets.json";
1
+ import fits from "../../data/ephemerides/planets/planets.json" with { type: "json" };
2
2
  import { chunkCovers, chunkPositionInto, decodeChunk } from "./chebyshevSeries.js";
3
3
  import { PLANET_IDS } from "./planetSeries.js";
4
4
  import { assertTimeScaleTable, ttMinusUtcSeconds } from "./timeScale.js";
@@ -1,10 +1,14 @@
1
- /** What kind of source a path or body position comes from. */
2
- export type ProvenanceSourceType = "ephemeris" | "observed" | "reconstructed" | "illustrative";
1
+ /** What kind of source a path or body position comes from. `"modelled"` is a computed result of a stated model (shown as "Modelled", the same word as the story-panel badge). */
2
+ export type ProvenanceSourceType = "ephemeris" | "observed" | "reconstructed" | "modelled" | "illustrative";
3
3
  /** Where a path or body position came from and how far to trust it: `sourceType`, the `sources`, the `accuracy` and `notes`. Pass one as `addTrajectory({ provenance })`. Never affects State. */
4
4
  export interface Provenance {
5
5
  readonly sourceType: ProvenanceSourceType;
6
6
  readonly sources: readonly string[];
7
7
  readonly accuracy: string;
8
8
  readonly notes: string;
9
+ /** For a position compared with an independent ephemeris: the class the comparison earned (`"approximate"` within 1% of the body's distance from the Sun, `"indicative"` within 5%). Absent for a body that has no such comparison. */
10
+ readonly accuracyClass?: "approximate" | "indicative";
11
+ /** The largest difference found, or the limit of the class, as a fraction of the body's distance from the Sun at the compared date (0.00857 is 0.857%). Absent with `accuracyClass`. */
12
+ readonly maxErrorFraction?: number;
9
13
  }
10
14
  export declare function createProvenance(input: Provenance): Provenance;
@@ -1,4 +1,4 @@
1
- const SOURCE_TYPES = ["ephemeris", "observed", "reconstructed", "illustrative"];
1
+ const SOURCE_TYPES = ["ephemeris", "observed", "reconstructed", "modelled", "illustrative"];
2
2
  export function createProvenance(input) {
3
3
  if (!SOURCE_TYPES.includes(input.sourceType))
4
4
  throw new RangeError("provenance sourceType is not recognised");
@@ -10,5 +10,7 @@ export function createProvenance(input) {
10
10
  sources: Object.freeze([...input.sources]),
11
11
  accuracy: input.accuracy,
12
12
  notes: input.notes,
13
+ ...(input.accuracyClass === undefined ? {} : { accuracyClass: input.accuracyClass }),
14
+ ...(input.maxErrorFraction === undefined ? {} : { maxErrorFraction: input.maxErrorFraction }),
13
15
  });
14
16
  }
@@ -1,12 +1,12 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useRef, useState } from "react";
2
+ import { lazy, Suspense, useEffect, useRef, useState } from "react";
3
3
  import { StoryPanelView } from "./StoryPanelView.js";
4
4
  import { useDrawers } from "./useDrawers.js";
5
5
  import { useStoryPanels } from "./useStoryPanels.js";
6
6
  import { TimelineBar } from "./TimelineBar.js";
7
7
  import { InfoPanel } from "./InfoPanel.js";
8
8
  import { infoView } from "./infoModel.js";
9
- import { MoonFamilyPanel } from "./MoonFamilyPanel.js";
9
+ import { PanelLoadBoundary } from "../app/PanelLoadBoundary.js";
10
10
  import { ControlsDrawer } from "./ControlsDrawer.js";
11
11
  import { isEmbedded } from "./embedded.js";
12
12
  import { DEFAULT_PHONE_LAYOUT, phoneLayoutStyle, pickOpensInfo, usePhone } from "./phoneLayout.js";
@@ -69,6 +69,8 @@ function infoContent(experience, info, selectedObjectId, timeUtcMs, metricsFor)
69
69
  const metrics = view?.target.kind === "object" && metricsFor !== undefined ? metricsFor(view.target.id, timeUtcMs) : [];
70
70
  return { view, metrics };
71
71
  }
72
+ /** The moon families load on demand: only an experience with `moonFamilies` draws them (I-089). */
73
+ const MoonFamilyPanel = lazy(() => import("./MoonFamilyPanel.js").then((module) => ({ default: module.MoonFamilyPanel })));
72
74
  /** Canvas-first layout shared by astronomy experiences. Scene and diagnostics stay app-owned. */
73
75
  export function AstraeusShell({ experience, snapshot, developerMode, onDeveloperModeChange, onTogglePlayback, onRateChange, onSeek, onCameraRequest, onSelectionChange, scaleId, onScaleChange, scaleChoices, switcher, displaySwitches, metricsFor, developerTools, storyPanelSettings, timelineGlow, phoneLayout = DEFAULT_PHONE_LAYOUT, highlightedFamily = null, onHighlightFamily, onSetPlaying, panelRequest, onOpenPanelChange, featureRequest, onOpenFeatureChange, pickRequest, children, }) {
74
76
  const [selectedObjectId, setSelectedObjectId] = useState(() => initialObjectId(experience, snapshot.timeUtcMs));
@@ -222,6 +224,6 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
222
224
  setMoonsOpen(false); }, [info]);
223
225
  const selectedLabel = objectLabelOr(experience, selectedObjectId, "Controls");
224
226
  const topBar = (_jsx(TopBar, { experience: experience, timeUtcMs: snapshot.timeUtcMs, selectedObjectId: selectedObjectId, activePresetId: activePresetId, onSelectObject: selectObject, onCameraPreset: activatePreset, infoOpen: info?.kind === "object", onToggleInfo: () => setInfo(info?.kind === "object" ? null : { kind: "object" }), scaleId: scaleId, onScaleChange: onScaleChange, scaleChoices: scaleChoices, switcher: switcher, displaySwitches: displaySwitches }));
225
- const moonPanel = experience.moonFamilies === undefined ? null : (_jsx(MoonFamilyPanel, { list: experience.moonFamilies, highlightedFamily: highlightedFamily, onHighlight: (id) => onHighlightFamily?.(id), onSelectMoon: chooseMoon }));
227
+ const moonPanel = experience.moonFamilies === undefined ? null : (_jsx(PanelLoadBoundary, { message: "The moon list could not load. Reload the page to try again.", children: _jsx(Suspense, { fallback: null, children: _jsx(MoonFamilyPanel, { list: experience.moonFamilies, highlightedFamily: highlightedFamily, onHighlight: (id) => onHighlightFamily?.(id), onSelectMoon: chooseMoon }) }) }));
226
228
  return (_jsxs("main", { className: "astraeus-shell", ref: root, "data-phone": phone, "data-timeline-hidden": experience.hideTimeline === true, "data-embedded": embedded, style: phoneLayoutStyle(phoneLayout), children: [_jsx("div", { className: "shell-canvas", children: children }), phone && _jsxs(ControlsDrawer, { label: selectedLabel, open: controlsOpen, onOpenChange: openControls, swipeThresholdPx: phoneLayout.swipeThresholdPx, children: [topBar, moonPanel] }), _jsxs("div", { className: "shell-top", children: [!phone && topBar, !phone && moonPanel !== null && _jsx(MoonsSheet, { planetLabel: experience.moonFamilies?.planetLabel, open: moonsOpen, onToggle: toggleMoons, onClose: () => setMoonsOpen(false), children: moonPanel }), view !== null && _jsx(InfoPanel, { view: view, metrics: metrics, onClose: () => setInfo(null) })] }), story.openPanel !== null && (_jsx(StoryPanelView, { panel: story.openPanel, holding: story.holding, onClose: story.close, onContinue: story.continuePlayback })), _jsx(DeveloperToggle, { developerMode: developerMode, onDeveloperModeChange: onDeveloperModeChange }), _jsx("aside", { className: "developer-tools", id: "developer-tools", "data-developer-panel": "", "aria-label": "Developer diagnostics", hidden: !developerMode, children: developerMode ? developerTools : null }), _jsx(ShellTimeline, { hidden: experience.hideTimeline === true, experience: experience, snapshot: snapshot, onTogglePlayback: onTogglePlayback, onRateChange: onRateChange, onSeek: seek, panels: storyPanels, openPanelId: openPanelId, onPanelOpen: openPanelFromTimeline, onEventSeek: seekToEvent, onEventInfo: (event) => setInfo({ kind: "event", id: event.id }), onWindowSeek: seekToWindow, onWindowInfo: (window) => setInfo({ kind: "window", id: window.id }), glowLook: timelineGlow, drawer: phone ? { open: timelineOpen, onOpenChange: openTimeline, swipeThresholdPx: phoneLayout.swipeThresholdPx } : undefined })] }));
227
229
  }