@johnmorrisdotca/wakusei-planets 0.69.0 → 0.71.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 +55 -0
- package/NOTICE.md +29 -1
- package/README.md +20 -8
- package/dist/bodies/moons-jupiter.js +2 -0
- package/dist/bodies/moons-mars.js +2 -2
- package/dist/bodies/moons-neptune.js +2 -1
- package/dist/bodies/moons-pluto.js +2 -2
- package/dist/bodies/moons-saturn.js +14 -2
- package/dist/data/discovery.js +225 -0
- package/dist/data/moon-catalogue.js +15 -15
- package/dist/data/orbits.js +15 -0
- package/dist/data/shapes/amalthea.d.ts +2 -0
- package/dist/data/shapes/amalthea.js +1 -0
- package/dist/data/shapes/atlas.d.ts +2 -0
- package/dist/data/shapes/atlas.js +1 -0
- package/dist/data/shapes/calypso.d.ts +2 -0
- package/dist/data/shapes/calypso.js +1 -0
- package/dist/data/shapes/daphnis.d.ts +2 -0
- package/dist/data/shapes/daphnis.js +1 -0
- package/dist/data/shapes/deimos.d.ts +2 -0
- package/dist/data/shapes/deimos.js +1 -0
- package/dist/data/shapes/epimetheus.d.ts +2 -0
- package/dist/data/shapes/epimetheus.js +1 -0
- package/dist/data/shapes/helene.d.ts +2 -0
- package/dist/data/shapes/helene.js +1 -0
- package/dist/data/shapes/hydra.d.ts +2 -0
- package/dist/data/shapes/hydra.js +1 -0
- package/dist/data/shapes/hyperion.d.ts +2 -0
- package/dist/data/shapes/hyperion.js +1 -0
- package/dist/data/shapes/janus.d.ts +2 -0
- package/dist/data/shapes/janus.js +1 -0
- package/dist/data/shapes/larissa.d.ts +2 -0
- package/dist/data/shapes/larissa.js +1 -0
- package/dist/data/shapes/nix.d.ts +2 -0
- package/dist/data/shapes/nix.js +1 -0
- package/dist/data/shapes/pan.d.ts +2 -0
- package/dist/data/shapes/pan.js +1 -0
- package/dist/data/shapes/pandora.d.ts +2 -0
- package/dist/data/shapes/pandora.js +1 -0
- package/dist/data/shapes/phobos.d.ts +2 -0
- package/dist/data/shapes/phobos.js +1 -0
- package/dist/data/shapes/phoebe.d.ts +2 -0
- package/dist/data/shapes/phoebe.js +1 -0
- package/dist/data/shapes/prometheus.d.ts +2 -0
- package/dist/data/shapes/prometheus.js +1 -0
- package/dist/data/shapes/proteus.d.ts +2 -0
- package/dist/data/shapes/proteus.js +1 -0
- package/dist/data/shapes/telesto.d.ts +2 -0
- package/dist/data/shapes/telesto.js +1 -0
- package/dist/data/shapes/thebe.d.ts +2 -0
- package/dist/data/shapes/thebe.js +1 -0
- package/dist/discovery.d.ts +1 -1
- package/dist/earth-places.d.ts +7 -6
- package/dist/earth-places.js +11 -8
- package/dist/facts.d.ts +21 -4
- package/dist/facts.js +71 -38
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/moon-catalogue.d.ts +1 -1
- package/dist/moon-pages/data.d.ts +157 -0
- package/dist/moon-pages/data.js +138 -0
- package/dist/moon-pages/element.d.ts +82 -0
- package/dist/moon-pages/element.js +670 -0
- package/dist/moon-pages/index.d.ts +1 -0
- package/dist/moon-pages/index.js +2 -0
- package/dist/moon-pages/words.d.ts +115 -0
- package/dist/moon-pages/words.js +116 -0
- package/dist/nearest.js +2 -0
- package/dist/picture-credits.js +3 -0
- package/dist/scene/body-places.js +4 -5
- package/dist/scene/body.js +10 -5
- package/dist/scene/earth-places.d.ts +110 -2
- package/dist/scene/earth-places.js +149 -9
- package/dist/scene/glsl.d.ts +2 -2
- package/dist/scene/glsl.js +11 -0
- package/dist/scene/look.d.ts +7 -0
- package/dist/scene/look.js +1 -0
- package/dist/scene/painter.js +18 -3
- package/dist/scene/recipes.js +6 -2
- package/dist/scene/rings.js +11 -2
- package/dist/scene/shape.d.ts +50 -0
- package/dist/scene/shape.js +110 -0
- package/dist/shape-basis.d.ts +43 -0
- package/dist/shape-basis.js +45 -0
- package/dist/space/all-moons.d.ts +6 -1
- package/dist/space/all-moons.js +5 -1
- package/dist/space/element.d.ts +28 -3
- package/dist/space/element.js +169 -40
- package/dist/space/orbit-lines.d.ts +66 -0
- package/dist/space/orbit-lines.js +118 -0
- package/dist/space/scale.d.ts +1 -1
- package/dist/space/scale.js +20 -5
- package/dist/space/scene.d.ts +8 -0
- package/dist/space/scene.js +116 -9
- package/dist/stops.js +12 -0
- package/dist/surface/element.js +3 -3
- package/dist/surface/glsl.d.ts +2 -2
- package/dist/surface/glsl.js +15 -3
- package/dist/surface/height.d.ts +7 -0
- package/dist/surface/height.js +10 -0
- package/dist/textures/deimos-1024.webp +0 -0
- package/dist/textures/deimos-512.webp +0 -0
- package/dist/textures/phobos-1024.webp +0 -0
- package/dist/textures/phobos-512.webp +0 -0
- package/dist/textures/phoebe-1024.webp +0 -0
- package/dist/textures/phoebe-512.webp +0 -0
- package/package.json +13 -1
package/dist/facts.js
CHANGED
|
@@ -34,7 +34,7 @@ export const DWARF_IDS = ["ceres", "orcus", "haumea", "quaoar", "makemake", "gon
|
|
|
34
34
|
*/
|
|
35
35
|
export const MINOR_IDS = ["vesta", "pallas", "chiron", "pholus", "halley"];
|
|
36
36
|
/**
|
|
37
|
-
* The moons the package draws, by planet or dwarf planet.
|
|
37
|
+
* The moons the package draws, by planet or dwarf planet. The moons it drew first come first, from the nearest out, and the small ones that came later with their real shapes (Amalthea and Thebe, Saturn's small moons, Hyperion, Phoebe and Larissa) follow in the same order, so a page that takes the first moon of a planet, or goes through them one by one, still meets the big ones first.
|
|
38
38
|
*
|
|
39
39
|
* @example
|
|
40
40
|
* ```ts
|
|
@@ -46,10 +46,10 @@ export const MINOR_IDS = ["vesta", "pallas", "chiron", "pholus", "halley"];
|
|
|
46
46
|
export const MOONS_OF = {
|
|
47
47
|
earth: ["moon"],
|
|
48
48
|
mars: ["phobos", "deimos"],
|
|
49
|
-
jupiter: ["io", "europa", "ganymede", "callisto"],
|
|
50
|
-
saturn: ["mimas", "enceladus", "tethys", "dione", "rhea", "titan", "iapetus"],
|
|
49
|
+
jupiter: ["io", "europa", "ganymede", "callisto", "amalthea", "thebe"],
|
|
50
|
+
saturn: ["mimas", "enceladus", "tethys", "dione", "rhea", "titan", "iapetus", "pan", "daphnis", "atlas", "prometheus", "pandora", "epimetheus", "janus", "telesto", "calypso", "helene", "hyperion", "phoebe"],
|
|
51
51
|
uranus: ["miranda", "ariel", "umbriel", "titania", "oberon"],
|
|
52
|
-
neptune: ["proteus", "triton", "nereid"],
|
|
52
|
+
neptune: ["proteus", "triton", "nereid", "larissa"],
|
|
53
53
|
pluto: ["charon", "nix", "hydra"],
|
|
54
54
|
orcus: ["vanth"],
|
|
55
55
|
haumea: ["hiiaka", "namaka"],
|
|
@@ -71,40 +71,58 @@ const f = (id, kind, en, ja, radiusKm, flattening, tiltDeg, ra, dec, w0, rate, r
|
|
|
71
71
|
const bandsAt = (lats) => lats.map((lat) => ({ kind: "band", lat }));
|
|
72
72
|
const dots = (list) => list.map(([lon, lat, radius]) => ({ kind: "circle", lon, lat, radius }));
|
|
73
73
|
// The IAU north poles and prime meridians (J2000) are Archinal et al. 2018 (Celestial Mechanics and Dynamical Astronomy 130:22). A moon that keeps one face to its planet is oriented from the geometry, so its own pole is its planet's.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
//
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
]
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
74
|
+
/**
|
|
75
|
+
* The share of light a ring band stops when it is seen from above, from its normal optical depth: 1 − exp(−tau). This is the opacity a band is drawn with, before the drawing's floor (`ringStrip` keeps a whole system just visible).
|
|
76
|
+
*
|
|
77
|
+
* @param tau - The band's normal optical depth.
|
|
78
|
+
* @returns The opacity, from 0 to 1.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* import { ringOpacity } from "@johnmorrisdotca/wakusei-planets";
|
|
83
|
+
*
|
|
84
|
+
* console.log(ringOpacity(1.45).toFixed(2), ringOpacity(5e-6));
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export const ringOpacity = (tau) => 1 - Math.exp(-tau);
|
|
88
|
+
const ringSystem = (rows) => rows.map(([from, to, tau, tone]) => ({ from, to, tau, alpha: ringOpacity(tau), tone }));
|
|
89
|
+
// Each row is from (km), to (km), normal optical depth, tone. The optical depths are NASA NSSDCA's ring fact sheets (D. R. Williams; Jupiter, Saturn, Neptune, Uranus, read 2026-11-19), which send on to the PDS Ring-Moon Systems Node's
|
|
90
|
+
// vital statistics; where the sheet gives a range the middle of it is used. Saturn: D 1e-5, C 0.05-0.35, B 0.4-2.5, Cassini Division 0-0.1, A 0.4-1.0, F 0.1.
|
|
91
|
+
const SATURN_RINGS = ringSystem([
|
|
92
|
+
[66900, 74510, 1e-5, 0.3],
|
|
93
|
+
[74658, 91975, 0.2, 0.45],
|
|
94
|
+
[91975, 117507, 1.45, 0.8],
|
|
95
|
+
[117507, 122340, 0.05, 0.4],
|
|
96
|
+
[122340, 133570, 0.7, 0.7],
|
|
97
|
+
[133610, 136775, 0.7, 0.65],
|
|
98
|
+
[140100, 140260, 0.1, 0.8],
|
|
99
|
+
]);
|
|
100
|
+
// Jupiter: the halo inside the main ring, the main ring, and the gossamer rings out to about 226,000 km (NASA). Halo 3e-6, main ring 5e-6, Amalthea and Thebe rings 1e-7 on the sheet: the main ring is a thin dusty line.
|
|
101
|
+
const JUPITER_RINGS = ringSystem([
|
|
102
|
+
[92000, 122500, 3e-6, 0.25],
|
|
103
|
+
[122800, 129200, 5e-6, 0.7],
|
|
104
|
+
[129200, 181350, 1e-7, 0.3],
|
|
105
|
+
[181350, 226000, 1e-7, 0.25],
|
|
106
|
+
]);
|
|
107
|
+
// Neptune: Galle 1e-4, Le Verrier 0.01, the Lassell sheet 1e-4 and Adams 0.01-0.1. Adams's arcs (0.12) sit on that radius; a strip has no longitude, so they are the same band.
|
|
108
|
+
const NEPTUNE_RINGS = ringSystem([
|
|
109
|
+
[40900, 42900, 1e-4, 0.35],
|
|
110
|
+
[53150, 53300, 0.01, 0.55],
|
|
111
|
+
[53300, 57200, 1e-4, 0.25],
|
|
112
|
+
[62890, 62980, 0.055, 0.65],
|
|
113
|
+
]);
|
|
114
|
+
// Uranus: rings 6, 5, 4, alpha, beta, eta, gamma, delta (0.3 to 0.5) and epsilon (0.5-2.3).
|
|
115
|
+
const URANUS_RINGS = ringSystem([
|
|
116
|
+
[41800, 41880, 0.3, 0.2],
|
|
117
|
+
[42200, 42270, 0.5, 0.2],
|
|
118
|
+
[42540, 42610, 0.3, 0.2],
|
|
119
|
+
[44680, 44760, 0.4, 0.2],
|
|
120
|
+
[45620, 45700, 0.3, 0.2],
|
|
121
|
+
[47140, 47210, 0.4, 0.2],
|
|
122
|
+
[47590, 47660, 0.3, 0.2],
|
|
123
|
+
[48260, 48340, 0.5, 0.2],
|
|
124
|
+
[51100, 51200, 1.4, 0.3],
|
|
125
|
+
]);
|
|
108
126
|
/**
|
|
109
127
|
* Every body's facts, by name: sizes, flattening, axial tilt, poles and rotation from the IAU and NASA.
|
|
110
128
|
*
|
|
@@ -214,6 +232,8 @@ export const BODIES = {
|
|
|
214
232
|
europa: f("europa", "moon", "Europa", "エウロパ", 1560.8, 0, 0, 268.08, 64.51, 36.022, 101.3747235, 85.23, "#dcd2c0", { parent: "jupiter", synchronous: true, features: [{ kind: "line", points: [[-120, -10], [-60, 8], [0, -4], [50, 16], [110, 4]] }, { kind: "line", points: [[-90, 40], [-30, 24], [40, 36], [100, 20]] }, { kind: "line", points: [[-100, -40], [-40, -26], [30, -42], [90, -30]] }, { kind: "line", points: [[20, 60], [30, 20], [10, -20], [30, -60]] }, { kind: "circle", lon: -70, lat: -10, radius: 7 }] }),
|
|
215
233
|
ganymede: f("ganymede", "moon", "Ganymede", "ガニメデ", 2634.1, 0, 0, 268.2, 64.57, 44.064, 50.3176081, 171.7, "#a09484", { parent: "jupiter", synchronous: true, features: [{ kind: "oval", lon: -140, lat: 20, rx: 40, ry: 55, fill: true }, { kind: "oval", lon: 20, lat: 25, rx: 25, ry: 30, fill: true }, { kind: "oval", lon: 60, lat: -35, rx: 20, ry: 16, fill: true }, { kind: "circle", lon: 128, lat: -22, radius: 6 }, ...bandsAt([62, -62])] }),
|
|
216
234
|
callisto: f("callisto", "moon", "Callisto", "カリスト", 2410.3, 0, 0, 268.72, 64.83, 259.51, 21.5710715, 400.5, "#70675d", { parent: "jupiter", synchronous: true, features: [{ kind: "circle", lon: 55, lat: 15, radius: 8 }, { kind: "circle", lon: 55, lat: 15, radius: 16 }, { kind: "circle", lon: 55, lat: 15, radius: 26 }, ...dots([[-40, 30, 4], [-70, -20, 5], [0, -40, 4], [-20, 5, 3], [100, -30, 4], [-100, 40, 3]])] }),
|
|
235
|
+
amalthea: f("amalthea", "moon", "Amalthea", "アマルテア", 83.5, 0.488, 0, 268.05, 64.49, 231.67, 722.631456, 11.9563, "#8c5f4d", { parent: "jupiter", synchronous: true, axesKm: [125, 73, 64], features: dots([[-40, 10, 14], [70, -20, 10]]) }),
|
|
236
|
+
thebe: f("thebe", "moon", "Thebe", "テーベ", 49.3, 0.276, 0, 268.05, 64.49, 8.56, 533.70041, 16.1889, "#745a4b", { parent: "jupiter", synchronous: true, axesKm: [58, 49, 42], features: dots([[30, 15, 12]]) }),
|
|
217
237
|
mimas: f("mimas", "moon", "Mimas", "ミマス", 198.2, 0.02, 0, 40.66, 83.52, 333.46, 381.994555, 22.6, "#bdbab4", { parent: "saturn", synchronous: true, features: [{ kind: "circle", lon: -60, lat: 0, radius: 33 }, ...dots([[30, 30, 12], [60, -25, 10], [-130, 40, 9], [120, 5, 10], [10, -50, 9]])] }),
|
|
218
238
|
enceladus: f("enceladus", "moon", "Enceladus", "エンケラドス", 252.1, 0.003, 0, 40.66, 83.52, 6.32, 262.7318996, 32.9, "#f1f4f6", { parent: "saturn", synchronous: true, features: [{ kind: "line", points: [[-40, -72], [-20, -76], [0, -78], [20, -76], [40, -72]] }, { kind: "line", points: [[-30, -66], [-10, -70], [10, -70], [30, -66]] }, ...dots([[-60, 20, 8], [60, 30, 7], [110, -10, 6]])] }),
|
|
219
239
|
tethys: f("tethys", "moon", "Tethys", "テティス", 531.1, 0.001, 0, 40.66, 83.52, 8.95, 190.6979085, 45.3, "#d6d3ce", { parent: "saturn", synchronous: true, features: [{ kind: "circle", lon: 140, lat: 10, radius: 22 }, { kind: "line", points: [[-180, 0], [-120, 4], [-60, -2], [0, 3], [60, -3]] }, ...dots([[-40, 30, 7], [30, -30, 6], [70, 40, 5]])] }),
|
|
@@ -221,12 +241,25 @@ export const BODIES = {
|
|
|
221
241
|
rhea: f("rhea", "moon", "Rhea", "レア", 763.8, 0.001, 0, 40.38, 83.55, 235.16, 79.6900478, 108.4, "#c7c4be", { parent: "saturn", synchronous: true, features: [...dots([[-60, 15, 10], [20, -30, 9], [60, 40, 8], [110, -10, 9], [-20, 50, 7], [-100, -25, 8], [160, 20, 7]])] }),
|
|
222
242
|
titan: f("titan", "moon", "Titan", "タイタン", 2574.7, 0, 0, 36.41, 83.94, 189.64, 22.5769768, 382.69, "#dba84a", { parent: "saturn", synchronous: true, features: [...bandsAt([60, 30, 0, -30, -60]), { kind: "oval", lon: 0, lat: 85, rx: 60, ry: 6 }] }),
|
|
223
243
|
iapetus: f("iapetus", "moon", "Iapetus", "イアペトゥス", 734.3, 0.02, 0, 318.16, 75.03, 355.2, 4.5379572, 1903.7, "#a89f93", { parent: "saturn", synchronous: true, features: [{ kind: "line", points: [[-90, -85], [-90, -40], [-90, 0], [-90, 40], [-90, 85]] }, { kind: "line", points: [[90, -85], [90, -40], [90, 0], [90, 40], [90, 85]] }, { kind: "oval", lon: 0, lat: 0, rx: 100, ry: 25, fill: true }, { kind: "line", points: [[-180, 0], [-120, 0], [-60, 0], [0, 0], [60, 0], [120, 0]], close: true }] }),
|
|
244
|
+
hyperion: f("hyperion", "moon", "Hyperion", "ハイペリオン", 135, 0.43, 0, 40.6, 83.5, 0, 0, 0, "#a8947f", { parent: "saturn", axesKm: [180.1, 133, 102.7], features: dots([[-30, 20, 30], [60, -10, 22], [120, 30, 18]]) }),
|
|
245
|
+
phoebe: f("phoebe", "moon", "Phoebe", "フェーベ", 106.5, 0.069, 23.7, 356.9, 77.8, 178.58, 931.639, 9.274, "#5d5a57", { parent: "saturn", axesKm: [109.4, 108.5, 101.8], features: dots([[-30, 10, 14], [80, -25, 11], [160, 35, 9]]) }),
|
|
246
|
+
janus: f("janus", "moon", "Janus", "ヤヌス", 89.5, 0.25, 0, 40.58, 83.52, 58.83, 518.2359876, 16.6719, "#c1bdb5", { parent: "saturn", synchronous: true, axesKm: [101.7, 93, 76.3], features: dots([[-30, 20, 14], [70, -30, 12]]) }),
|
|
247
|
+
epimetheus: f("epimetheus", "moon", "Epimetheus", "エピメテウス", 58.1, 0.183, 0, 40.58, 83.52, 293.87, 518.4907239, 16.6638, "#c3bfb8", { parent: "saturn", synchronous: true, axesKm: [64.9, 57.3, 53], features: dots([[40, 10, 14], [-80, -20, 11]]) }),
|
|
248
|
+
prometheus: f("prometheus", "moon", "Prometheus", "プロメテウス", 43.1, 0.587, 0, 40.58, 83.53, 296.14, 587.289, 14.7117, "#cbc8c2", { parent: "saturn", synchronous: true, axesKm: [68.2, 41.6, 28.2], features: dots([[30, 10, 9]]) }),
|
|
249
|
+
pandora: f("pandora", "moon", "Pandora", "パンドラ", 40.7, 0.397, 0, 40.58, 83.53, 162.92, 572.7891, 15.0841, "#c9c6c0", { parent: "saturn", synchronous: true, axesKm: [52.2, 40.8, 31.5], features: dots([[-50, 15, 10]]) }),
|
|
250
|
+
atlas: f("atlas", "moon", "Atlas", "アトラス", 15.1, 0.541, 0, 40.58, 83.53, 137.88, 598.306, 14.4408, "#cfccc6", { parent: "saturn", synchronous: true, axesKm: [20.5, 17.8, 9.4] }),
|
|
251
|
+
pan: f("pan", "moon", "Pan", "パン", 14.1, 0.395, 0, 40.6, 83.5, 48.8, 626.044, 13.8009, "#d0cdc7", { parent: "saturn", synchronous: true, axesKm: [17.2, 15.4, 10.4] }),
|
|
252
|
+
daphnis: f("daphnis", "moon", "Daphnis", "ダフニス", 3.8, 0.391, 0, 40.6, 83.5, 0, 0, 0, "#d0cdc7", { parent: "saturn", axesKm: [4.6, 4.5, 2.8] }),
|
|
253
|
+
helene: f("helene", "moon", "Helene", "ヘレネ", 17.6, 0.409, 0, 40.85, 83.34, 245.12, 131.6174056, 65.6448, "#cdcac5", { parent: "saturn", synchronous: true, axesKm: [22.5, 19.6, 13.3], features: dots([[20, 10, 8]]) }),
|
|
254
|
+
telesto: f("telesto", "moon", "Telesto", "テレスト", 12.4, 0.399, 0, 50.51, 84.06, 56.88, 190.6979332, 45.3073, "#e2e0dc", { parent: "saturn", synchronous: true, axesKm: [16.3, 11.8, 9.8] }),
|
|
255
|
+
calypso: f("calypso", "moon", "Calypso", "カリプソ", 9.5, 0.588, 0, 36.41, 85.04, 153.51, 190.6742373, 45.3129, "#d9d7d3", { parent: "saturn", synchronous: true, axesKm: [15.3, 9.3, 6.3] }),
|
|
224
256
|
miranda: f("miranda", "moon", "Miranda", "ミランダ", 235.8, 0, 0, 257.43, -15.08, 30.7, 254.6906924, 33.9, "#b8b5b0", { parent: "uranus", synchronous: true, features: [{ kind: "oval", lon: 30, lat: -60, rx: 40, ry: 20, fill: true }, { kind: "circle", lon: -30, lat: 10, radius: 20 }, { kind: "line", points: [[60, 30], [75, 5], [80, -20]] }, ...dots([[-80, -30, 8], [100, 40, 7]])] }),
|
|
225
257
|
ariel: f("ariel", "moon", "Ariel", "アリエル", 578.9, 0, 0, 257.43, -15.1, 156.22, 142.8356681, 60.5, "#bcb9b3", { parent: "uranus", synchronous: true, features: [{ kind: "line", points: [[-80, 20], [-50, 8], [-20, 26], [10, 10]] }, { kind: "line", points: [[40, -20], [70, -34], [100, -20]] }, { kind: "oval", lon: -10, lat: -30, rx: 30, ry: 12, fill: true }, ...dots([[60, 30, 7], [-100, 0, 6]])] }),
|
|
226
258
|
umbriel: f("umbriel", "moon", "Umbriel", "ウンブリエル", 584.7, 0, 0, 257.43, -15.1, 108.05, 86.8688923, 99.5, "#807d79", { parent: "uranus", synchronous: true, features: [{ kind: "circle", lon: 50, lat: 85, radius: 8 }, { kind: "circle", lon: 80, lat: 80, radius: 14, fill: false }, ...dots([[-70, 20, 8], [20, -30, 9], [-20, 40, 7], [110, -10, 7]])] }),
|
|
227
259
|
titania: f("titania", "moon", "Titania", "ティタニア", 788.9, 0, 0, 257.43, -15.1, 77.74, 41.3514246, 208.9, "#aaa59d", { parent: "uranus", synchronous: true, features: [{ kind: "line", points: [[-120, -10], [-80, -30], [-40, -10], [0, -34]] }, { kind: "line", points: [[-60, 36], [-20, 20], [20, 40]] }, ...dots([[40, 20, 9], [80, -25, 8], [-100, 30, 7]])] }),
|
|
228
260
|
oberon: f("oberon", "moon", "Oberon", "オベロン", 761.4, 0, 0, 257.43, -15.1, 6.77, 26.7394932, 323.1, "#918981", { parent: "uranus", synchronous: true, features: [{ kind: "circle", lon: 40, lat: -15, radius: 12 }, ...dots([[-60, 20, 9], [90, 30, 8], [-110, -25, 8], [10, 45, 7]])] }),
|
|
229
261
|
proteus: f("proteus", "moon", "Proteus", "プロテウス", 210, 0.1, 0, 299.36, 43.36, 93.38, 320.7654228, 26.9, "#6e6c6a", { parent: "neptune", synchronous: true, axesKm: [218, 208, 201], features: [{ kind: "circle", lon: 0, lat: -5, radius: 28 }, ...dots([[60, 30, 10], [-70, 20, 9], [110, -20, 8]])] }),
|
|
262
|
+
larissa: f("larissa", "moon", "Larissa", "ラリッサ", 97, 0.114, 0, 299.36, 43.41, 179.41, 649.053447, 13.3117, "#7e7c7a", { parent: "neptune", synchronous: true, axesKm: [100.5, 96, 89], features: dots([[0, 10, 14], [100, -20, 10]]) }),
|
|
230
263
|
triton: f("triton", "moon", "Triton", "トリトン", 1353.4, 0, 0, 299.36, 41.17, 296.53, -61.2572638, -141.04, "#cdbbac", { parent: "neptune", synchronous: true, features: [{ kind: "band", lat: -30 }, { kind: "oval", lon: 20, lat: -70, rx: 80, ry: 25, fill: true }, ...dots([[-40, -40, 3], [10, -45, 3], [50, -35, 3], [100, -42, 3]])] }),
|
|
231
264
|
nereid: f("nereid", "moon", "Nereid", "ネレイド", 178.5, 0, 0, 299.36, 43.46, 0, 0, 0, "#9b9b9b", { parent: "neptune", features: dots([[-40, 20, 12], [50, -20, 10]]) }),
|
|
232
265
|
charon: f("charon", "moon", "Charon", "カロン", 606, 0, 0, 132.993, -6.163, 122.695, 56.3625225, 153.2935, "#9c9189", { parent: "pluto", synchronous: true, features: [{ kind: "oval", lon: 0, lat: 76, rx: 90, ry: 14, fill: true }, { kind: "circle", lon: 40, lat: -15, radius: 12 }, ...dots([[-60, 10, 8], [120, 30, 7]])] }),
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BODIES, BODY_IDS, DWARF_IDS, MINOR_IDS, MOONS_OF, PLANET_IDS, ringReach, type BodyFacts, type BodyId, type DwarfId, type Feature, type HostId, type Look, type MinorId, type MoonId, type PlanetId, type RingBand } from "./facts.ts";
|
|
1
|
+
export { BODIES, BODY_IDS, DWARF_IDS, MINOR_IDS, MOONS_OF, PLANET_IDS, ringOpacity, ringReach, type BodyFacts, type BodyId, type DwarfId, type Feature, type HostId, type Look, type MinorId, type MoonId, type PlanetId, type RingBand } from "./facts.ts";
|
|
2
2
|
export { apparent, heliocentric, heliocentricModel, meanSunAu, moonGeocentric, orbitPath, system, type Apparent, type MoonPlace, type Pose, type System } from "./ephemeris.ts";
|
|
3
3
|
export { JOURNEY_STOPS, journeyStop, stopPlaceAu, type JourneyStop } from "./stops.ts";
|
|
4
4
|
export { drawnTilt, portrait, type PortraitOptions } from "./pose.ts";
|
|
@@ -7,6 +7,7 @@ export { interiorLegend, interiorOf } from "./interior.ts";
|
|
|
7
7
|
export { ringStrip, type RingStrip } from "./scene/rings.ts";
|
|
8
8
|
export { embedCode, embedCredit, EMBED_KINDS, lineupCode, lineupCredit, portraitCode, type EmbedKind, type EmbedOptions, type EmbedSettings, type LineupEmbed, type PortraitEmbed } from "./embed.ts";
|
|
9
9
|
export { mercuryTilesCredit, PICTURE_CREDITS, picturesCredit, type PictureCredit } from "./picture-credits.ts";
|
|
10
|
+
export { shapeBasis, shapeNote, type ShapeBasis } from "./shape-basis.ts";
|
|
10
11
|
export { addBody, decodeScene, defaultPortrait, encodeScene, PRESETS as PORTRAIT_PRESETS, resolve as layoutPortrait, type Item as PortraitItem, type Placed as PlacedItem, type Portrait, type Preset as PortraitPreset, type Resolved as PortraitLayout } from "./portrait/model.ts";
|
|
11
12
|
export { LUMINOSITY_CLASSES, STAR_SUN, starLook, type LuminosityClass, type StarLook, type StarNumberName, type StarNumbers, type StarPart, type StarStatus } from "./star.ts";
|
|
12
13
|
export { starLineSvg } from "./star-line.ts";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BODIES, BODY_IDS, DWARF_IDS, MINOR_IDS, MOONS_OF, PLANET_IDS, ringReach } from "./facts.js";
|
|
1
|
+
export { BODIES, BODY_IDS, DWARF_IDS, MINOR_IDS, MOONS_OF, PLANET_IDS, ringOpacity, ringReach } from "./facts.js";
|
|
2
2
|
export { apparent, heliocentric, heliocentricModel, meanSunAu, moonGeocentric, orbitPath, system } from "./ephemeris.js";
|
|
3
3
|
export { JOURNEY_STOPS, journeyStop, stopPlaceAu } from "./stops.js";
|
|
4
4
|
export { drawnTilt, portrait } from "./pose.js";
|
|
@@ -7,6 +7,7 @@ export { interiorLegend, interiorOf } from "./interior.js";
|
|
|
7
7
|
export { ringStrip } from "./scene/rings.js";
|
|
8
8
|
export { embedCode, embedCredit, EMBED_KINDS, lineupCode, lineupCredit, portraitCode } from "./embed.js";
|
|
9
9
|
export { mercuryTilesCredit, PICTURE_CREDITS, picturesCredit } from "./picture-credits.js";
|
|
10
|
+
export { shapeBasis, shapeNote } from "./shape-basis.js";
|
|
10
11
|
export { addBody, decodeScene, defaultPortrait, encodeScene, PRESETS as PORTRAIT_PRESETS, resolve as layoutPortrait } from "./portrait/model.js";
|
|
11
12
|
export { LUMINOSITY_CLASSES, STAR_SUN, starLook } from "./star.js";
|
|
12
13
|
export { starLineSvg } from "./star-line.js";
|
package/dist/moon-catalogue.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare const MOON_GROUPS: readonly MoonGroup[];
|
|
|
32
32
|
/**
|
|
33
33
|
* How well the catalogue places a moon, by the worst angle (seen from the planet's centre) between `catalogueMoonPosition` and JPL Horizons on 2025-07-02, 2026-07-02 and 2027-07-02, dates the orbit was not set from:
|
|
34
34
|
* `close` under 1 degree, `rough` under 10 degrees, `loose` 10 degrees or more (the moon is on the right orbit but not at the right place on it), `unmeasured` when Horizons has no position to measure against, and `none`
|
|
35
|
-
* when there is no orbit. Every grade is below the package's own
|
|
35
|
+
* when there is no orbit. Every grade is below the package's own 44 moons (`full`), which the main entry point places within arc-seconds to minutes (see the accuracy guide).
|
|
36
36
|
*
|
|
37
37
|
* @example
|
|
38
38
|
* ```ts
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { type MoonKeyEntry, type MoonNames } from "../moon-catalogue.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The planets that have moon pages: the four giant planets.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { MOON_PAGE_HOSTS } from "@johnmorrisdotca/wakusei-planets/moon-pages";
|
|
8
|
+
*
|
|
9
|
+
* console.log(MOON_PAGE_HOSTS.join(", "));
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare const MOON_PAGE_HOSTS: readonly ["jupiter", "saturn", "uranus", "neptune"];
|
|
13
|
+
/**
|
|
14
|
+
* One of the four giant planets: `jupiter`, `saturn`, `uranus` or `neptune`.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import type { MoonPageHost } from "@johnmorrisdotca/wakusei-planets/moon-pages";
|
|
19
|
+
*
|
|
20
|
+
* const host: MoonPageHost = "saturn";
|
|
21
|
+
* console.log(host);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export type MoonPageHost = (typeof MOON_PAGE_HOSTS)[number];
|
|
25
|
+
/**
|
|
26
|
+
* The pages' day, in milliseconds since 1970: 2026-12-01, the day the irregular moons' osculating orbits were taken (`MOON_OSCULATING_EPOCH_JD`), where the catalogue places them best.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { MOON_PAGE_TIME } from "@johnmorrisdotca/wakusei-planets/moon-pages";
|
|
31
|
+
*
|
|
32
|
+
* console.log(new Date(MOON_PAGE_TIME).toISOString());
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare const MOON_PAGE_TIME: number;
|
|
36
|
+
/**
|
|
37
|
+
* One moon of the catalogue as the pages use it: its names, family, radius (`est` when it is worked out from the brightness), semi-major axis and period, direction, discovery, colours, and its orbit and place seen from
|
|
38
|
+
* above the planet's north pole, in the page's `unit` of kilometres, rounded.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { moonPage, type PageMoon } from "@johnmorrisdotca/wakusei-planets/moon-pages";
|
|
43
|
+
*
|
|
44
|
+
* const carme: PageMoon = moonPage("jupiter").moons.find((m) => m.id === "carme")!;
|
|
45
|
+
* console.log(carme.en, carme.retro === 1 ? "retrograde" : "prograde", carme.year);
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export interface PageMoon {
|
|
49
|
+
id: string;
|
|
50
|
+
en: string;
|
|
51
|
+
ja: string | null;
|
|
52
|
+
family: string;
|
|
53
|
+
/** Radius in km, or null when no source gives one; `est` when it is worked out from the brightness. */
|
|
54
|
+
r: number | null;
|
|
55
|
+
est: boolean;
|
|
56
|
+
/** Semi-major axis (km) and period (days), or null with no orbit. */
|
|
57
|
+
a: number | null;
|
|
58
|
+
p: number | null;
|
|
59
|
+
/** 1 retrograde, 0 prograde, null with no orbit. */
|
|
60
|
+
retro: 0 | 1 | null;
|
|
61
|
+
year: number | null;
|
|
62
|
+
by: string | null;
|
|
63
|
+
where: string | null;
|
|
64
|
+
full: boolean;
|
|
65
|
+
colour: {
|
|
66
|
+
direction: string;
|
|
67
|
+
group: string;
|
|
68
|
+
};
|
|
69
|
+
/** The orbit seen from above the planet's north pole: x, y, z for each point, in `unit` km. */
|
|
70
|
+
orbit: number[] | null;
|
|
71
|
+
/** Where it is on the page's day, the same way. */
|
|
72
|
+
at: [number, number, number] | null;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A moon the package draws in full, for a card: its names, radius and axes, orbit, discovery and the line about its measured shape (null for a body drawn from its facts).
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* import { moonPage, type PageCard } from "@johnmorrisdotca/wakusei-planets/moon-pages";
|
|
80
|
+
*
|
|
81
|
+
* const first: PageCard = moonPage("saturn").cards[0]!;
|
|
82
|
+
* console.log(first.name.en, first.axesKm?.join(" x "), first.shape?.en);
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export interface PageCard {
|
|
86
|
+
id: string;
|
|
87
|
+
name: MoonNames;
|
|
88
|
+
radiusKm: number;
|
|
89
|
+
axesKm: readonly number[] | null;
|
|
90
|
+
a: number | null;
|
|
91
|
+
p: number | null;
|
|
92
|
+
retro: boolean;
|
|
93
|
+
date: string | null;
|
|
94
|
+
where: string | null;
|
|
95
|
+
by: string | null;
|
|
96
|
+
shape: {
|
|
97
|
+
en: string;
|
|
98
|
+
ja: string;
|
|
99
|
+
} | null;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Everything one planet's moon pages show: the planet, the day, the unit of the orbit points, the reach of its regular moons, its families, the colour keys, every catalogue moon, the moons drawn in full and the counts.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* import { moonPage, type MoonPage } from "@johnmorrisdotca/wakusei-planets/moon-pages";
|
|
107
|
+
*
|
|
108
|
+
* const page: MoonPage = moonPage("neptune");
|
|
109
|
+
* console.log(page.counts.total, "moons,", page.counts.retrograde, "retrograde");
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export interface MoonPage {
|
|
113
|
+
host: MoonPageHost;
|
|
114
|
+
name: MoonNames;
|
|
115
|
+
radiusKm: number;
|
|
116
|
+
colour: string;
|
|
117
|
+
time: number;
|
|
118
|
+
fetched: string;
|
|
119
|
+
unit: number;
|
|
120
|
+
/** The reach of the regular moons (the inner view), in `unit` km. */
|
|
121
|
+
inner: number;
|
|
122
|
+
families: {
|
|
123
|
+
id: string;
|
|
124
|
+
names: MoonNames;
|
|
125
|
+
count: number;
|
|
126
|
+
}[];
|
|
127
|
+
key: {
|
|
128
|
+
direction: readonly MoonKeyEntry[];
|
|
129
|
+
group: readonly MoonKeyEntry[];
|
|
130
|
+
};
|
|
131
|
+
moons: PageMoon[];
|
|
132
|
+
cards: PageCard[];
|
|
133
|
+
counts: {
|
|
134
|
+
total: number;
|
|
135
|
+
named: number;
|
|
136
|
+
retrograde: number;
|
|
137
|
+
prograde: number;
|
|
138
|
+
estimated: number;
|
|
139
|
+
featured: number;
|
|
140
|
+
shaped: number;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Work out one giant planet's moon pages from the package's data (`/moon-catalogue`, the discovery records and the facts). It takes a few milliseconds and the same planet gives the same object again.
|
|
145
|
+
*
|
|
146
|
+
* @param host - `jupiter`, `saturn`, `uranus` or `neptune`.
|
|
147
|
+
* @returns The pages' numbers.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* import { moonPage } from "@johnmorrisdotca/wakusei-planets/moon-pages";
|
|
152
|
+
*
|
|
153
|
+
* const saturn = moonPage("saturn");
|
|
154
|
+
* console.log(saturn.counts.total, "moons of Saturn,", saturn.moons.filter((m) => m.orbit !== null).length, "orbits drawn");
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
export declare function moonPage(host: MoonPageHost): MoonPage;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// The numbers of a giant planet's moon pages, worked out from the package's own data when they are asked for, so nothing is typed by hand: every orbit of /moon-catalogue as points seen from the
|
|
2
|
+
// planet's pole, where each moon is on the pages' day, the key to the orbit colours, every catalogue moon for the table and the moons drawn in full for the cards. Pure: no DOM, no clock reads, no three.js.
|
|
3
|
+
import { discoveryOf } from "../discovery.js";
|
|
4
|
+
import { BODIES, MOONS_OF } from "../facts.js";
|
|
5
|
+
import { catalogueMoonOrbit, catalogueMoonPosition, catalogueMoonsOf, findCatalogueMoon, moonFamilies, moonOrbitColor, moonOrbitKey, MOON_CATALOGUE_FETCHED, MOON_OSCULATING_EPOCH_JD } from "../moon-catalogue.js";
|
|
6
|
+
import { shapeBasis, shapeNote } from "../shape-basis.js";
|
|
7
|
+
import { cross, dot, fromRaDec, toEcliptic } from "../vec.js";
|
|
8
|
+
/**
|
|
9
|
+
* The planets that have moon pages: the four giant planets.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { MOON_PAGE_HOSTS } from "@johnmorrisdotca/wakusei-planets/moon-pages";
|
|
14
|
+
*
|
|
15
|
+
* console.log(MOON_PAGE_HOSTS.join(", "));
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export const MOON_PAGE_HOSTS = ["jupiter", "saturn", "uranus", "neptune"];
|
|
19
|
+
/**
|
|
20
|
+
* The pages' day, in milliseconds since 1970: 2026-12-01, the day the irregular moons' osculating orbits were taken (`MOON_OSCULATING_EPOCH_JD`), where the catalogue places them best.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { MOON_PAGE_TIME } from "@johnmorrisdotca/wakusei-planets/moon-pages";
|
|
25
|
+
*
|
|
26
|
+
* console.log(new Date(MOON_PAGE_TIME).toISOString());
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export const MOON_PAGE_TIME = (MOON_OSCULATING_EPOCH_JD - 2440587.5) * 86_400_000;
|
|
30
|
+
const POINTS = 48;
|
|
31
|
+
/** The axes of the planet's north pole in the J2000 ecliptic (the plan's own): x along its equator, y a quarter turn on, z up the pole. */
|
|
32
|
+
function poleBasis(host) {
|
|
33
|
+
const { ra, dec } = BODIES[host].pole;
|
|
34
|
+
const z = toEcliptic(fromRaDec(ra, dec));
|
|
35
|
+
const x = toEcliptic(fromRaDec(ra + 90, 0));
|
|
36
|
+
return [x, cross(z, x), z];
|
|
37
|
+
}
|
|
38
|
+
const made = new Map();
|
|
39
|
+
/**
|
|
40
|
+
* Work out one giant planet's moon pages from the package's data (`/moon-catalogue`, the discovery records and the facts). It takes a few milliseconds and the same planet gives the same object again.
|
|
41
|
+
*
|
|
42
|
+
* @param host - `jupiter`, `saturn`, `uranus` or `neptune`.
|
|
43
|
+
* @returns The pages' numbers.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { moonPage } from "@johnmorrisdotca/wakusei-planets/moon-pages";
|
|
48
|
+
*
|
|
49
|
+
* const saturn = moonPage("saturn");
|
|
50
|
+
* console.log(saturn.counts.total, "moons of Saturn,", saturn.moons.filter((m) => m.orbit !== null).length, "orbits drawn");
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export function moonPage(host) {
|
|
54
|
+
const held = made.get(host);
|
|
55
|
+
if (held !== undefined)
|
|
56
|
+
return held;
|
|
57
|
+
const catalogue = catalogueMoonsOf(host);
|
|
58
|
+
const basis = poleBasis(host);
|
|
59
|
+
const smallest = Math.min(...catalogue.flatMap((m) => (m.orbit === null ? [] : [m.orbit.a])));
|
|
60
|
+
const unit = 10 ** Math.floor(Math.log10(smallest / 100));
|
|
61
|
+
const turn = (v) => [Math.round(dot(v, basis[0]) / unit), Math.round(dot(v, basis[1]) / unit), Math.round(dot(v, basis[2]) / unit)];
|
|
62
|
+
const families = moonFamilies(host);
|
|
63
|
+
const familyOf = new Map();
|
|
64
|
+
for (const family of families)
|
|
65
|
+
for (const moon of family.moons)
|
|
66
|
+
familyOf.set(moon.id, family.id);
|
|
67
|
+
const moons = catalogue.map((m) => {
|
|
68
|
+
const record = discoveryOf(m.id);
|
|
69
|
+
const orbit = catalogueMoonOrbit(m, MOON_PAGE_TIME, POINTS);
|
|
70
|
+
const at = catalogueMoonPosition(m, MOON_PAGE_TIME);
|
|
71
|
+
return {
|
|
72
|
+
id: m.id,
|
|
73
|
+
en: m.label,
|
|
74
|
+
ja: m.ja,
|
|
75
|
+
family: familyOf.get(m.id) ?? "",
|
|
76
|
+
r: m.radiusKm,
|
|
77
|
+
est: m.radiusFrom === "derived",
|
|
78
|
+
a: m.orbit?.a ?? null,
|
|
79
|
+
p: m.orbit?.periodDays ?? null,
|
|
80
|
+
retro: m.orbit === null ? null : m.retrograde ? 1 : 0,
|
|
81
|
+
year: m.discovery.year,
|
|
82
|
+
by: m.discovery.by,
|
|
83
|
+
where: record?.place?.value ?? null,
|
|
84
|
+
full: m.full,
|
|
85
|
+
colour: { direction: moonOrbitColor(m, "direction"), group: moonOrbitColor(m, "group") },
|
|
86
|
+
orbit: orbit === undefined ? null : orbit.slice(0, POINTS).flatMap(turn),
|
|
87
|
+
at: at === undefined ? null : turn(at),
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
const regular = catalogue.filter((m) => m.orbit !== null && ["major", "inner", "regular"].includes(m.group) && m.id !== "phoebe");
|
|
91
|
+
const cards = [...MOONS_OF[host]]
|
|
92
|
+
.map((id) => ({ id, row: findCatalogueMoon(id) }))
|
|
93
|
+
.sort((p, q) => (p.row?.orbit?.a ?? Infinity) - (q.row?.orbit?.a ?? Infinity))
|
|
94
|
+
.map(({ id, row }) => {
|
|
95
|
+
const facts = BODIES[id];
|
|
96
|
+
const record = discoveryOf(id);
|
|
97
|
+
const basisOf = shapeBasis(id);
|
|
98
|
+
return {
|
|
99
|
+
id,
|
|
100
|
+
name: facts.name,
|
|
101
|
+
radiusKm: facts.radiusKm,
|
|
102
|
+
axesKm: "axesKm" in facts ? facts.axesKm : null,
|
|
103
|
+
a: row?.orbit?.a ?? null,
|
|
104
|
+
p: row?.orbit?.periodDays ?? null,
|
|
105
|
+
retro: row?.retrograde ?? false,
|
|
106
|
+
date: record?.date?.value ?? (row?.discovery.year === null || row === undefined ? null : String(row.discovery.year)),
|
|
107
|
+
where: record?.place?.value ?? null,
|
|
108
|
+
by: record?.by?.value.join(", ") ?? row?.discovery.by ?? null,
|
|
109
|
+
shape: basisOf === undefined ? null : { en: shapeNote(id, "en"), ja: shapeNote(id, "ja") },
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
const direction = moonOrbitKey("direction", [host]);
|
|
113
|
+
const page = {
|
|
114
|
+
host,
|
|
115
|
+
name: BODIES[host].name,
|
|
116
|
+
radiusKm: BODIES[host].radiusKm,
|
|
117
|
+
colour: BODIES[host].colour,
|
|
118
|
+
time: MOON_PAGE_TIME,
|
|
119
|
+
fetched: MOON_CATALOGUE_FETCHED,
|
|
120
|
+
unit,
|
|
121
|
+
inner: Math.round(Math.max(...regular.map((m) => m.orbit.a * (1 + m.orbit.e))) / unit),
|
|
122
|
+
families: families.map((f) => ({ id: f.id, names: f.names, count: f.count })),
|
|
123
|
+
key: { direction, group: moonOrbitKey("group", [host]) },
|
|
124
|
+
moons,
|
|
125
|
+
cards,
|
|
126
|
+
counts: {
|
|
127
|
+
total: catalogue.length,
|
|
128
|
+
named: catalogue.filter((m) => m.named).length,
|
|
129
|
+
retrograde: direction.find((d) => d.id === "retrograde")?.count ?? 0,
|
|
130
|
+
prograde: direction.find((d) => d.id === "prograde")?.count ?? 0,
|
|
131
|
+
estimated: catalogue.filter((m) => m.radiusFrom === "derived").length,
|
|
132
|
+
featured: cards.length,
|
|
133
|
+
shaped: cards.filter((c) => c.shape !== null).length,
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
made.set(host, page);
|
|
137
|
+
return page;
|
|
138
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type MoonPage, type MoonPageHost } from "./data.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The four tabs of `<wakusei-moon-pages>`, in their order: `orbits`, `views` (the map and the portrait), `cards` (the moons drawn in full) and `table` (every moon).
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts no-run
|
|
7
|
+
* import { MOON_PAGE_TABS } from "@johnmorrisdotca/wakusei-planets/moon-pages/element";
|
|
8
|
+
*
|
|
9
|
+
* console.log(MOON_PAGE_TABS.join(", "));
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare const MOON_PAGE_TABS: readonly ["orbits", "views", "cards", "table"];
|
|
13
|
+
declare const VIEWS: readonly ["above", "tilted", "side"];
|
|
14
|
+
declare const REACHES: readonly ["all", "inner"];
|
|
15
|
+
declare const COLOURS: readonly ["direction", "group"];
|
|
16
|
+
declare const COLUMNS: readonly ["name", "family", "size", "distance", "period", "year", "where", "by", "direction"];
|
|
17
|
+
/**
|
|
18
|
+
* What `<wakusei-moon-pages>` shows, as its attributes say it and as `wakusei-moon-pages-change` sends it: the planet, the tab, how the orbits are seen (`above`, `tilted` or `side`), how far (`all` or `inner`) and
|
|
19
|
+
* coloured (`direction` or `group`), and the table's column and order (`up` or `down`).
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts no-run
|
|
23
|
+
* import type { MoonPagesState } from "@johnmorrisdotca/wakusei-planets/moon-pages/element";
|
|
24
|
+
*
|
|
25
|
+
* const pages = document.querySelector("wakusei-moon-pages")!;
|
|
26
|
+
* pages.addEventListener("wakusei-moon-pages-change", (event) => {
|
|
27
|
+
* const state: MoonPagesState = (event as CustomEvent<MoonPagesState>).detail;
|
|
28
|
+
* console.log(state.planet, state.tab, state.sort, state.order);
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export interface MoonPagesState {
|
|
33
|
+
planet: MoonPageHost;
|
|
34
|
+
tab: (typeof MOON_PAGE_TABS)[number];
|
|
35
|
+
view: (typeof VIEWS)[number];
|
|
36
|
+
reach: (typeof REACHES)[number];
|
|
37
|
+
colour: (typeof COLOURS)[number];
|
|
38
|
+
sort: (typeof COLUMNS)[number];
|
|
39
|
+
order: "up" | "down";
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The `<wakusei-moon-pages>` custom element: one giant planet's moons in four tabs, each one screen.
|
|
43
|
+
*
|
|
44
|
+
* - **Orbits**: every orbit of `/moon-catalogue` in SVG, seen from above the planet's pole, at an angle or from the side, every moon or the inner ones, coloured prograde and retrograde or by family, with the key and a dot
|
|
45
|
+
* where each moon is on `MOON_PAGE_TIME`; pointing at an orbit, or a press on it, says whose it is.
|
|
46
|
+
* - **Map and portrait**: `<wakusei-plan>` from above the pole and a `<wakusei-portrait>` of the planet with the moons drawn in full.
|
|
47
|
+
* - **Main moons**: a card with a painted picture for each moon drawn in full, its size (three axes for a shaped one), distance, period, discovery and how its shape is known.
|
|
48
|
+
* - **Every moon**: the whole list in a table that sorts by any column, both ways; a size worked out from brightness is marked ≈, and — is a value no source gives.
|
|
49
|
+
*
|
|
50
|
+
* Attributes: `planet` (`jupiter`, the default, `saturn`, `uranus` or `neptune`; a change draws the other planet), `lang` (`en` or `ja`; the nearest `lang` up the page when left out, and it follows that one),
|
|
51
|
+
* `tab`, `view` (`above`, `tilted` or `side`), `reach` (`all` or `inner`), `colour` (`direction` or `group`), `sort` (`name`, `family`, `size`, `distance`, `period`, `year`, `where`, `by` or `direction`) and `order`
|
|
52
|
+
* (`up` or `down`), and `texture-base` and `texture-far-base`, handed to the bodies it draws. A slot named `planets` sits under the title, for a page's own row of links to the other planets.
|
|
53
|
+
*
|
|
54
|
+
* It never writes the page's address. A choice made in it is reflected on its attribute and sent as `wakusei-moon-pages-change` (bubbling, composed) with `detail` the whole `MoonPagesState`; a page that keeps its
|
|
55
|
+
* address writes the detail there and sets the attributes back from it when it loads. Setting an attribute sends no event. The numbers are `moonPage(planet)`'s, worked out in a few milliseconds. The plan, the
|
|
56
|
+
* portrait, the cards' bodies and the planet's looks are fetched only when their tab is first opened, so a page that shows only the orbits and the table loads no WebGL. Nothing runs on a timer; the orbits are drawn
|
|
57
|
+
* again only when a choice, the language or the element's width changes. `data-state` is `ready` once it has drawn.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts no-run
|
|
61
|
+
* import "@johnmorrisdotca/wakusei-planets/moon-pages/element";
|
|
62
|
+
* import type { MoonPagesState, WakuseiMoonPages } from "@johnmorrisdotca/wakusei-planets/moon-pages/element";
|
|
63
|
+
*
|
|
64
|
+
* const pages = document.createElement("wakusei-moon-pages") as WakuseiMoonPages;
|
|
65
|
+
* pages.setAttribute("planet", "saturn");
|
|
66
|
+
* pages.setAttribute("tab", "table");
|
|
67
|
+
* pages.addEventListener("wakusei-moon-pages-change", (event) => console.log((event as CustomEvent<MoonPagesState>).detail));
|
|
68
|
+
* document.body.append(pages);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export declare class WakuseiMoonPages extends HTMLElement {
|
|
72
|
+
#private;
|
|
73
|
+
static observedAttributes: string[];
|
|
74
|
+
/** What it shows now. */
|
|
75
|
+
get state(): MoonPagesState;
|
|
76
|
+
/** The numbers it draws: `moonPage(planet)`. */
|
|
77
|
+
get page(): MoonPage;
|
|
78
|
+
connectedCallback(): void;
|
|
79
|
+
disconnectedCallback(): void;
|
|
80
|
+
attributeChangedCallback(name: string, before: string | null, after: string | null): void;
|
|
81
|
+
}
|
|
82
|
+
export {};
|