@johnmorrisdotca/wakusei-planets 0.20.0 → 0.21.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 (83) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/NOTICE.md +9 -0
  3. package/README.md +34 -4
  4. package/dist/bodies/earth.js +13 -5
  5. package/dist/calendar.js +7 -6
  6. package/dist/clock.js +5 -6
  7. package/dist/coordinates.d.ts +7 -12
  8. package/dist/coordinates.js +19 -18
  9. package/dist/craft/cassini.d.ts +1 -0
  10. package/dist/craft/cassini.js +1131 -0
  11. package/dist/craft/galileo.d.ts +1 -0
  12. package/dist/craft/galileo.js +224 -0
  13. package/dist/craft/juno.d.ts +1 -0
  14. package/dist/craft/juno.js +640 -0
  15. package/dist/craft/newhorizons.d.ts +1 -0
  16. package/dist/craft/newhorizons.js +18 -0
  17. package/dist/craft/parker.d.ts +1 -0
  18. package/dist/craft/parker.js +221 -0
  19. package/dist/craft/pioneer10.d.ts +1 -0
  20. package/dist/craft/pioneer10.js +24 -0
  21. package/dist/craft/pioneer11.d.ts +1 -0
  22. package/dist/craft/pioneer11.js +34 -0
  23. package/dist/craft/voyager1.d.ts +1 -0
  24. package/dist/craft/voyager1.js +28 -0
  25. package/dist/craft/voyager2.d.ts +1 -0
  26. package/dist/craft/voyager2.js +43 -0
  27. package/dist/craft/webb.d.ts +1 -0
  28. package/dist/craft/webb.js +28 -0
  29. package/dist/data/craft.d.ts +23 -0
  30. package/dist/data/craft.js +53 -0
  31. package/dist/data/stars.d.ts +4 -0
  32. package/dist/data/stars.js +5088 -0
  33. package/dist/element.d.ts +1 -23
  34. package/dist/element.js +74 -110
  35. package/dist/ephemeris.d.ts +20 -0
  36. package/dist/ephemeris.js +51 -20
  37. package/dist/index.d.ts +1 -1
  38. package/dist/index.js +1 -1
  39. package/dist/portrait/element.d.ts +1 -0
  40. package/dist/portrait/element.js +27 -39
  41. package/dist/scene/basis.d.ts +3 -0
  42. package/dist/scene/basis.js +4 -0
  43. package/dist/scene/body.d.ts +2 -4
  44. package/dist/scene/body.js +55 -67
  45. package/dist/scene/fallback.d.ts +4 -0
  46. package/dist/scene/fallback.js +5 -0
  47. package/dist/scene/painter.js +10 -23
  48. package/dist/scene/store.d.ts +2 -2
  49. package/dist/scene/textures.d.ts +30 -0
  50. package/dist/scene/textures.js +47 -0
  51. package/dist/sidereal.d.ts +4 -0
  52. package/dist/sidereal.js +15 -9
  53. package/dist/sky/engine.d.ts +6 -15
  54. package/dist/sky/engine.js +9 -38
  55. package/dist/sky/frames.d.ts +3 -0
  56. package/dist/sky/frames.js +26 -0
  57. package/dist/sky/types.d.ts +20 -0
  58. package/dist/sky/types.js +1 -0
  59. package/dist/space/aim.d.ts +18 -0
  60. package/dist/space/aim.js +28 -0
  61. package/dist/space/element.d.ts +212 -0
  62. package/dist/space/element.js +524 -0
  63. package/dist/space/frame.d.ts +152 -0
  64. package/dist/space/frame.js +169 -0
  65. package/dist/space/index.d.ts +4 -0
  66. package/dist/space/index.js +5 -0
  67. package/dist/space/ride.d.ts +89 -0
  68. package/dist/space/ride.js +58 -0
  69. package/dist/space/scale.d.ts +126 -0
  70. package/dist/space/scale.js +139 -0
  71. package/dist/space/scene.d.ts +189 -0
  72. package/dist/space/scene.js +422 -0
  73. package/dist/spacecraft-facts.d.ts +114 -0
  74. package/dist/spacecraft-facts.js +215 -0
  75. package/dist/spacecraft.d.ts +134 -0
  76. package/dist/spacecraft.js +198 -0
  77. package/dist/stars.d.ts +160 -0
  78. package/dist/stars.js +193 -0
  79. package/dist/suncalc.js +4 -10
  80. package/dist/version.d.ts +1 -1
  81. package/dist/version.js +1 -1
  82. package/dist/when.js +6 -11
  83. package/package.json +53 -4
@@ -2,45 +2,16 @@
2
2
  // Written from the standard methods (Meeus, "Astronomical Algorithms", chapters 12, 21, 22, 40, 48; the IAU 1976 precession; IAU 1980 nutation, its largest terms) on this package's own positions: the Sun from the Earth's VSOP87B place,
3
3
  // the Moon from ELP2000-82B. Pure: no DOM, no three.js. Time is UTC in milliseconds; UT1 is taken as UTC (up to 0.9 s, 0.004 degrees of turn of the Earth); the theories run in terrestrial time.
4
4
  import { earthPosition, moonGeocentric } from "../theory.js";
5
- import { toTerrestrialTime } from "../clock.js";
6
- import { greenwichApparentSiderealTime, nutation } from "../sidereal.js";
5
+ import { julianCenturies } from "../clock.js";
6
+ import { greenwichApparentSiderealTime as greenwichSiderealTime, nutation } from "../sidereal.js";
7
+ import { eclipticJ2000ToTrueEquatorialOfDate } from "./frames.js";
7
8
  const RAD = Math.PI / 180;
8
9
  const DEG = 180 / Math.PI;
9
- const ARCSEC = Math.PI / 648000;
10
- const DAY_MS = 86_400_000;
11
- const J2000_MS = Date.UTC(2000, 0, 1, 12);
12
10
  const AU_KM = 149597870.7;
13
11
  const LIGHT_KM_S = 299792.458;
14
- /** The mean obliquity of the ecliptic at J2000 in the IAU 1976 value the VSOP87 and ELP frames use (84381.448 arc-seconds). */
15
- const OBLIQUITY_J2000 = 84381.448 * ARCSEC;
16
12
  /** The Earth's equatorial radius in kilometres and its flattening (WGS 84). */
17
13
  const EARTH_RADIUS_KM = 6378.137;
18
14
  const EARTH_FLATTENING = 1 / 298.257223563;
19
- const matrixTimes = (a, b) => [0, 1, 2].map((i) => [0, 1, 2].map((j) => a[i][0] * b[0][j] + a[i][1] * b[1][j] + a[i][2] * b[2][j]));
20
- const apply = (m, v) => [m[0][0] * v[0] + m[0][1] * v[1] + m[0][2] * v[2], m[1][0] * v[0] + m[1][1] * v[1] + m[1][2] * v[2], m[2][0] * v[0] + m[2][1] * v[1] + m[2][2] * v[2]];
21
- /** The matrix that re-expresses a vector in axes turned by `a` radians about x, y or z (a frame turn, not a vector turn). */
22
- const frameTurn = (axis, a) => {
23
- const c = Math.cos(a);
24
- const s = Math.sin(a);
25
- if (axis === 1)
26
- return [[1, 0, 0], [0, c, s], [0, -s, c]];
27
- if (axis === 2)
28
- return [[c, 0, -s], [0, 1, 0], [s, 0, c]];
29
- return [[c, s, 0], [-s, c, 0], [0, 0, 1]];
30
- };
31
- /** Julian centuries of terrestrial time from J2000 for a UTC instant in milliseconds. */
32
- const centuries = (ms) => (toTerrestrialTime(ms) - J2000_MS) / (36525 * DAY_MS);
33
- /** A J2000 mean-ecliptic vector turned into the true equator and equinox of date: obliquity of J2000, IAU 1976 precession, then nutation. */
34
- function trueOfDate(ecliptic, T) {
35
- const equatorial = apply(frameTurn(1, -OBLIQUITY_J2000), ecliptic);
36
- const zeta = (2306.2181 * T + 0.30188 * T * T + 0.017998 * T * T * T) * ARCSEC;
37
- const z = (2306.2181 * T + 1.09468 * T * T + 0.018203 * T * T * T) * ARCSEC;
38
- const theta = (2004.3109 * T - 0.42665 * T * T - 0.041833 * T * T * T) * ARCSEC;
39
- const precession = matrixTimes(frameTurn(3, -z), matrixTimes(frameTurn(2, theta), frameTurn(3, -zeta)));
40
- const n = nutation(T);
41
- const nutate = matrixTimes(frameTurn(1, -(n.meanObliquity + n.obliquity)), matrixTimes(frameTurn(3, -n.longitude), frameTurn(1, n.meanObliquity)));
42
- return apply(nutate, apply(precession, equatorial));
43
- }
44
15
  const toEquatorial = (v, distanceKm) => ({
45
16
  rightAscension: ((Math.atan2(v[1], v[0]) * DEG) % 360 + 360) % 360,
46
17
  declination: Math.asin(Math.max(-1, Math.min(1, v[2] / Math.hypot(v[0], v[1], v[2])))) * DEG,
@@ -53,7 +24,7 @@ const fromEquatorial = (e) => {
53
24
  };
54
25
  /** The Sun as seen from the Earth's centre: the apparent place of date, with the annual aberration (the Earth's speed over the speed of light, about 20 arc-seconds) and nutation. */
55
26
  export function sunEquatorial(ms) {
56
- const T = centuries(ms);
27
+ const T = julianCenturies(ms);
57
28
  const earth = earthPosition(ms);
58
29
  const later = earthPosition(ms + 60_000);
59
30
  const sun = [-earth[0], -earth[1], -earth[2]];
@@ -61,18 +32,18 @@ export function sunEquatorial(ms) {
61
32
  // the Earth's velocity in au per second, over the speed of light in au per second, moves the apparent direction toward where the Earth is heading
62
33
  const beta = [(later[0] - earth[0]) / 60 / (LIGHT_KM_S / AU_KM), (later[1] - earth[1]) / 60 / (LIGHT_KM_S / AU_KM), (later[2] - earth[2]) / 60 / (LIGHT_KM_S / AU_KM)];
63
34
  const aberrated = [sun[0] / distanceAu + beta[0], sun[1] / distanceAu + beta[1], sun[2] / distanceAu + beta[2]];
64
- return toEquatorial(trueOfDate(aberrated, T), distanceAu * AU_KM);
35
+ return toEquatorial(eclipticJ2000ToTrueEquatorialOfDate(aberrated, T), distanceAu * AU_KM);
65
36
  }
66
37
  /** The Moon as seen from the Earth's centre: the apparent place of date, with the light time (the Moon is about 1.3 seconds away) and nutation. */
67
38
  export function moonEquatorial(ms) {
68
- const T = centuries(ms);
39
+ const T = julianCenturies(ms);
69
40
  const first = moonGeocentric(ms);
70
41
  const distance = Math.hypot(first[0], first[1], first[2]);
71
42
  const geometric = moonGeocentric(ms - (distance / LIGHT_KM_S) * 1000);
72
- return toEquatorial(trueOfDate(geometric, T), Math.hypot(geometric[0], geometric[1], geometric[2]));
43
+ return toEquatorial(eclipticJ2000ToTrueEquatorialOfDate(geometric, T), Math.hypot(geometric[0], geometric[1], geometric[2]));
73
44
  }
74
45
  /** The apparent sidereal time at Greenwich in degrees, from the UTC instant taken as UT1. */
75
- export const greenwichSiderealTime = (ms) => greenwichApparentSiderealTime(ms);
46
+ export { greenwichSiderealTime };
76
47
  /** The observer's place from the Earth's centre in the true equator of date, in kilometres, with the turn of the Earth (Meeus ch. 11). */
77
48
  function observerVector(observer, ms) {
78
49
  const lat = observer.latitude * RAD;
@@ -135,7 +106,7 @@ export function moonPhase(ms) {
135
106
  const d = moon.declination * RAD;
136
107
  const angle = Math.atan2(Math.cos(d0) * Math.sin(a0 - a), Math.sin(d0) * Math.cos(d) - Math.cos(d0) * Math.sin(d) * Math.cos(a0 - a)) * DEG;
137
108
  // waxing while the Moon is east of the Sun along the ecliptic: its longitude is ahead by under half a turn
138
- const n = nutation(centuries(ms));
109
+ const n = nutation(julianCenturies(ms));
139
110
  const epsilon = n.meanObliquity + n.obliquity;
140
111
  const longitudeOf = (v) => Math.atan2(v[1] * Math.cos(epsilon) + v[2] * Math.sin(epsilon), v[0]) * DEG;
141
112
  const ahead = (((longitudeOf(moonV) - longitudeOf(sunV)) % 360) + 360) % 360;
@@ -0,0 +1,3 @@
1
+ import type { Vec3 as Vec } from "../vec.ts";
2
+ /** A J2000 mean-ecliptic vector turned into the true equator and equinox of date: obliquity of J2000, IAU 1976 precession, then nutation. */
3
+ export declare function eclipticJ2000ToTrueEquatorialOfDate(ecliptic: Vec, T: number): Vec;
@@ -0,0 +1,26 @@
1
+ const ARCSEC = Math.PI / 648000;
2
+ import { meanObliquityArcseconds, nutation } from "../sidereal.js";
3
+ const OBLIQUITY_J2000 = meanObliquityArcseconds(0) * ARCSEC;
4
+ const matrixTimes = (a, b) => [0, 1, 2].map((i) => [0, 1, 2].map((j) => a[i][0] * b[0][j] + a[i][1] * b[1][j] + a[i][2] * b[2][j]));
5
+ const apply = (matrix, vector) => matrix.map((row) => row[0] * vector[0] + row[1] * vector[1] + row[2] * vector[2]);
6
+ /** The matrix that re-expresses a vector in axes turned by `a` radians about x, y or z (a frame turn, not a vector turn). */
7
+ const frameTurn = (axis, a) => {
8
+ const c = Math.cos(a);
9
+ const s = Math.sin(a);
10
+ if (axis === 1)
11
+ return [[1, 0, 0], [0, c, s], [0, -s, c]];
12
+ if (axis === 2)
13
+ return [[c, 0, -s], [0, 1, 0], [s, 0, c]];
14
+ return [[c, s, 0], [-s, c, 0], [0, 0, 1]];
15
+ };
16
+ /** A J2000 mean-ecliptic vector turned into the true equator and equinox of date: obliquity of J2000, IAU 1976 precession, then nutation. */
17
+ export function eclipticJ2000ToTrueEquatorialOfDate(ecliptic, T) {
18
+ const equatorial = apply(frameTurn(1, -OBLIQUITY_J2000), ecliptic);
19
+ const zeta = (2306.2181 * T + 0.30188 * T * T + 0.017998 * T * T * T) * ARCSEC;
20
+ const z = (2306.2181 * T + 1.09468 * T * T + 0.018203 * T * T * T) * ARCSEC;
21
+ const theta = (2004.3109 * T - 0.42665 * T * T - 0.041833 * T * T * T) * ARCSEC;
22
+ const precession = matrixTimes(frameTurn(3, -z), matrixTimes(frameTurn(2, theta), frameTurn(3, -zeta)));
23
+ const n = nutation(T);
24
+ const nutate = matrixTimes(frameTurn(1, -(n.meanObliquity + n.obliquity)), matrixTimes(frameTurn(3, -n.longitude), frameTurn(1, n.meanObliquity)));
25
+ return apply(nutate, apply(precession, equatorial));
26
+ }
@@ -0,0 +1,20 @@
1
+ /** Geodetic degrees north/east and optional metres above the WGS 84 ellipsoid.
2
+ * Direction-only rotations ignore height. Parallax uses ellipsoidal height.
3
+ * Event dip retains the supplied height as height above the visible horizon;
4
+ * no geoid or terrain correction is inferred from these coordinates.
5
+ */
6
+ export interface Observer {
7
+ latitude: number;
8
+ longitude: number;
9
+ heightM?: number;
10
+ }
11
+ /** Right ascension [0,360) and declination [-90,90], in degrees; frame belongs to the caller. */
12
+ export interface EquatorialAngles {
13
+ rightAscension: number;
14
+ declination: number;
15
+ }
16
+ /** Azimuth clockwise from north and altitude, both in degrees. */
17
+ export interface HorizontalAngles {
18
+ azimuth: number;
19
+ altitude: number;
20
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import { type Vec3 } from "../vec.ts";
2
+ /**
3
+ * The unit direction, in the scene's axes, of a longitude and latitude on the Earth as the stars see it at `ms`: the camera fixed to the stars looks at the same place on the ground only at that moment, and the Earth turns away under it as time runs.
4
+ *
5
+ * @param lon - Degrees east.
6
+ * @param lat - Degrees north.
7
+ * @param ms - The moment, in milliseconds since the Unix epoch.
8
+ * @returns The direction from the Earth's centre.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { groundDirection } from "@johnmorrisdotca/wakusei-planets/space";
13
+ *
14
+ * const [x, y, z] = groundDirection(0, 90, Date.UTC(2026, 10, 2));
15
+ * console.log(y.toFixed(2));
16
+ * ```
17
+ */
18
+ export declare function groundDirection(lon: number, lat: number, ms: number): Vec3;
@@ -0,0 +1,28 @@
1
+ // Which way the camera sits from the body it looks at: over a place on the Earth's surface as the stars saw it at one moment. Pure.
2
+ import { orientation } from "../scene/orient.js";
3
+ import { cross, RAD } from "../vec.js";
4
+ /**
5
+ * The unit direction, in the scene's axes, of a longitude and latitude on the Earth as the stars see it at `ms`: the camera fixed to the stars looks at the same place on the ground only at that moment, and the Earth turns away under it as time runs.
6
+ *
7
+ * @param lon - Degrees east.
8
+ * @param lat - Degrees north.
9
+ * @param ms - The moment, in milliseconds since the Unix epoch.
10
+ * @returns The direction from the Earth's centre.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { groundDirection } from "@johnmorrisdotca/wakusei-planets/space";
15
+ *
16
+ * const [x, y, z] = groundDirection(0, 90, Date.UTC(2026, 10, 2));
17
+ * console.log(y.toFixed(2));
18
+ * ```
19
+ */
20
+ export function groundDirection(lon, lat, ms) {
21
+ const { pole, meridian } = orientation("earth", ms);
22
+ const east = cross(pole, meridian);
23
+ const c = Math.cos(lat * RAD);
24
+ const along = c * Math.cos(lon * RAD);
25
+ const across = c * Math.sin(lon * RAD);
26
+ const up = Math.sin(lat * RAD);
27
+ return [meridian[0] * along + east[0] * across + pole[0] * up, meridian[1] * along + east[1] * across + pole[1] * up, meridian[2] * along + east[2] * across + pole[2] * up];
28
+ }
@@ -0,0 +1,212 @@
1
+ import { setThreeLoader } from "../scene/shared.ts";
2
+ import { type SpacePlanet } from "./frame.ts";
3
+ import { type ScaleMode } from "./scale.ts";
4
+ import type { RideLook } from "./ride.ts";
5
+ import { SPACE_BODIES, type RidePoint, type RideState, type RideTarget, type SpaceBody, type SpaceLight } from "./scene.ts";
6
+ export { setThreeLoader, SPACE_BODIES, type RidePoint, type RideTarget, type SpaceBody, type SpaceLight };
7
+ /**
8
+ * What a page can tell a reader about a body now.
9
+ *
10
+ * @example
11
+ * ```ts no-run
12
+ * import type { BodyInfo } from "@johnmorrisdotca/wakusei-planets/space/element";
13
+ *
14
+ * const info: BodyInfo = { id: "mars", name: "Mars", radiusKm: 3389.5, distanceKm: 225_000_000 };
15
+ * console.log(`${info.name}: ${info.radiusKm} km`);
16
+ * ```
17
+ */
18
+ export interface BodyInfo {
19
+ id: SpaceBody;
20
+ /** The name shown beside the body. */
21
+ name: string;
22
+ /** Mean radius, kilometres. */
23
+ radiusKm: number;
24
+ /** Distance from the Earth's centre now, kilometres (0 for the Earth). */
25
+ distanceKm: number;
26
+ }
27
+ /**
28
+ * What the space view is doing: `loading`, `live`, `unavailable` (no WebGL), `lost` (the GPU took the context; it comes back by itself).
29
+ *
30
+ * @example
31
+ * ```ts no-run
32
+ * import type { SpaceState, WakuseiSpace } from "@johnmorrisdotca/wakusei-planets/space/element";
33
+ *
34
+ * const stateOf = (space: WakuseiSpace): SpaceState => space.stats.state;
35
+ * console.log(typeof stateOf);
36
+ * ```
37
+ */
38
+ export type SpaceState = "loading" | "live" | "unavailable" | "lost";
39
+ /**
40
+ * A named distance for `zoomFor`: the Earth, the Moon, the Sun, the inner planets, the whole solar system, or a planet with its nearer moons (`jupiter-moons`).
41
+ *
42
+ * @example
43
+ * ```ts no-run
44
+ * import type { SpacePreset, WakuseiSpace } from "@johnmorrisdotca/wakusei-planets/space/element";
45
+ *
46
+ * const zoomTo = (space: WakuseiSpace, preset: SpacePreset): number => space.zoomFor(preset);
47
+ * console.log(typeof zoomTo);
48
+ * ```
49
+ */
50
+ export type SpacePreset = "earth" | "moon" | "sun" | "inner" | "solar-system" | `${Exclude<SpacePlanet, "mercury" | "venus">}-moons`;
51
+ /**
52
+ * How a ride along is done: `view` `from` (the default) puts the camera at the target looking at the body it goes round, `follow` keeps it a distance from the target looking at it (`distanceKm`,
53
+ * 3000 by default, for a point of your own; a body or a moon is kept at the distance the zoom says); `look` `down` (the default) or `horizon` is where a camera at the target points; `around` is the
54
+ * body a point of your own goes round (the Earth by default); `smooth` (the default) glides from the old camera to the new one in about a second and a bit, and jumps instead for a reader who asked for reduced motion.
55
+ *
56
+ * @example
57
+ * ```ts no-run
58
+ * import type { RideOptions } from "@johnmorrisdotca/wakusei-planets/space/element";
59
+ *
60
+ * const options: RideOptions = { view: "from", look: "horizon", around: "mars" };
61
+ * console.log(options.look);
62
+ * ```
63
+ */
64
+ export interface RideOptions {
65
+ view?: "from" | "follow";
66
+ look?: RideLook;
67
+ distanceKm?: number;
68
+ around?: SpaceBody;
69
+ smooth?: boolean;
70
+ }
71
+ /**
72
+ * What the camera is riding along with now: the target, the body it goes round, how (`from` or `follow`), where it looks, and the distance kept for a point.
73
+ *
74
+ * @example
75
+ * ```ts no-run
76
+ * import type { Riding } from "@johnmorrisdotca/wakusei-planets/space/element";
77
+ *
78
+ * const describe = (ride: Riding | null): string => (ride ? `${ride.view} ${typeof ride.target === "string" ? ride.target : "a point"}` : "not riding");
79
+ * console.log(typeof describe);
80
+ * ```
81
+ */
82
+ export type Riding = RideState;
83
+ /**
84
+ * The `<wakusei-space>` custom element: the Earth, the Moon, the Sun and the planets where they are at a date and time, drawn with three.js through the shared renderer. It takes `center`
85
+ * (`"lon,lat"`), `time` (`now` or an ISO date), `speed` (1 is real time, 0 holds, 86400 is a day a second, negative runs backwards), `scale` (`compressed` or `true`), `look` (`realistic` or `painted`),
86
+ * `light` (`sun` or `lit`), `lang` (`en` or `ja`: the names), `labels` and `orbits` (`off` hides them), and `texture-base`, `texture-far-base` and `max-texture`. Positions come from this package's own models. It draws
87
+ * only when something changes, and nothing while it is out of sight.
88
+ *
89
+ * @example
90
+ * ```ts no-run
91
+ * import type { WakuseiSpace } from "@johnmorrisdotca/wakusei-planets/space/element";
92
+ *
93
+ * const space = document.createElement("wakusei-space") as WakuseiSpace;
94
+ * space.setAttribute("time", "2026-11-02T12:00Z");
95
+ * space.setAttribute("speed", "0");
96
+ * document.body.append(space);
97
+ * ```
98
+ */
99
+ export declare class WakuseiSpace extends HTMLElement {
100
+ #private;
101
+ static observedAttributes: string[];
102
+ connectedCallback(): void;
103
+ disconnectedCallback(): void;
104
+ attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
105
+ /** The home place the camera starts above, as longitude and latitude in degrees. */
106
+ get centre(): {
107
+ lon: number;
108
+ lat: number;
109
+ };
110
+ set centre(value: {
111
+ lon: number;
112
+ lat: number;
113
+ });
114
+ /** The moment shown: milliseconds since the epoch, or "now" to follow the clock. Setting it points the camera at the same place on the ground again. */
115
+ get time(): number;
116
+ set time(value: number | Date | "now");
117
+ /** Seconds of game time per second: 1 is real time, 0 holds still, negative runs backwards. */
118
+ get speed(): number;
119
+ set speed(value: number);
120
+ /** `compressed` (the default: every direction real, the distances squeezed) or `true` (real distances and sizes). */
121
+ get scale(): ScaleMode;
122
+ set scale(value: ScaleMode);
123
+ get labels(): boolean;
124
+ set labels(value: boolean);
125
+ get orbits(): boolean;
126
+ set orbits(value: boolean);
127
+ /** How the bodies are drawn: `realistic` (shaded from the body's real colours and features) or `painted` (public-domain surface maps). */
128
+ get look(): "realistic" | "painted";
129
+ set look(value: "realistic" | "painted");
130
+ /** How the Earth is lit: `sun` (true, the default) or `lit` (as if by daylight from the camera's side, so the night side is never a black frame). The Sun, the Moon and the planets keep their true places. */
131
+ get light(): SpaceLight;
132
+ set light(value: SpaceLight);
133
+ /**
134
+ * The shared controls' camera: yaw and tilt turn the view (the Earth's surface moves right for a drag right and up for a drag up), zoom brings the camera in (1 shows the body looked at, less shows the sky round it). Pan is not used. A turn that
135
+ * moves nothing on the screen by half a pixel is kept for the next draw but does not cause one unless `final` is true (the default).
136
+ *
137
+ * @param view - The controls' yaw and tilt in degrees and zoom.
138
+ * @param final - False for the frames of a turn that is still going on (Auto-turn, a drag); true when it has settled.
139
+ */
140
+ setView(view: {
141
+ yaw: number;
142
+ tilt: number;
143
+ zoom: number;
144
+ }, final?: boolean): void;
145
+ /** The body the camera looks at (`earth`, `sun`, `moon`, `mercury` to `neptune`, `pluto`): at zoom 1 it fills the view; the yaw and tilt turn the camera round it. */
146
+ get body(): SpaceBody;
147
+ set body(name: SpaceBody);
148
+ /** The words shown beside each body, for a page in another language (`{ mars: "火星" }`). A body left out keeps its name in the element's `lang`. */
149
+ get bodyNames(): Partial<Record<SpaceBody, string>>;
150
+ set bodyNames(value: Partial<Record<SpaceBody, string>>);
151
+ /** What a screen reader hears after a body's name: "choose to look at it" by default, or the page's own words. */
152
+ get bodyHint(): string;
153
+ set bodyHint(value: string);
154
+ /** The name, radius and distance from the Earth of a body now, for a page's own caption. */
155
+ bodyInfo(id: SpaceBody): BodyInfo;
156
+ /**
157
+ * Ride along with a body, a moon or a moving point of your own. By default the camera sits at it and looks at the body it goes round, with the way it is going at the top of the picture, at its real place for the moment shown,
158
+ * so the ground slides beneath as it moves along its orbit. A drag looks about from there (a drag right turns the camera to its left and a drag up tips it towards the bottom of its picture, so the ground follows the pointer), the shared
159
+ * controls' zoom narrows the view. A body of the view (`"moon"`, `"mars"`) goes round the Earth; a moon (`"io"`) goes round its planet; a point of your own (`{ at(ms) }`, a satellite, a probe) goes round `around` (the Earth by default) and the
160
+ * element knows nothing of what it is. Another call switches smoothly; `null` stops. The draw rate follows how fast the picture moves, never more than 30 a second (one a second for a reader who asked for reduced motion), and nothing is drawn out of sight.
161
+ *
162
+ * @param target - A body name, a moon name, a point, or `null` to stop.
163
+ * @param options - `view`, `look`, `distanceKm`, `around`, `smooth` (see `RideOptions`).
164
+ */
165
+ ride(target: RideTarget | null, options?: RideOptions): void;
166
+ /** What the camera is riding along with now, or null. */
167
+ get riding(): Riding | null;
168
+ /** The zoom that shows a part of the sky: the Earth alone, the Moon's orbit, the Sun, the planets out to Mars, all of them, or a planet's nearer moons, at this scale and moment. */
169
+ zoomFor(preset: SpacePreset): number;
170
+ /** What the element is doing, for a page or a test. */
171
+ get stats(): {
172
+ state: SpaceState;
173
+ draws: number;
174
+ contexts: number;
175
+ canvas: {
176
+ width: number;
177
+ height: number;
178
+ pixels: number;
179
+ };
180
+ /** How far the camera is from the body it looks at, in that body's radii. */
181
+ distance: number;
182
+ assets: {
183
+ entries: number;
184
+ refs: number;
185
+ };
186
+ time: number;
187
+ /** How many frames the ephemeris has worked out. */
188
+ lookups: number;
189
+ /** The camera as the last draw left it: its place in Earth radii from the Earth's centre, and its field of view in degrees. */
190
+ camera: {
191
+ position: [number, number, number];
192
+ fov: number;
193
+ };
194
+ /** What the painter has made at the last draw: the bodies with a drawing, the moons shown round a planet that is near, and the moons made and not yet let go. */
195
+ bodies: {
196
+ look: string;
197
+ painted: number;
198
+ moons: number;
199
+ held: number;
200
+ };
201
+ ride: {
202
+ riding: boolean;
203
+ lost: boolean;
204
+ gliding: boolean;
205
+ };
206
+ };
207
+ }
208
+ declare global {
209
+ interface HTMLElementTagNameMap {
210
+ "wakusei-space": WakuseiSpace;
211
+ }
212
+ }