@johnmorrisdotca/wakusei-planets 0.68.0 → 0.70.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 +56 -0
- package/NOTICE.md +29 -1
- package/README.md +7 -7
- 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 +23 -6
- package/dist/earth-places.js +29 -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/nearest.js +2 -0
- package/dist/picture-credits.js +3 -0
- package/dist/place-search.d.ts +22 -0
- package/dist/place-search.js +25 -0
- package/dist/places/search.d.ts +19 -2
- package/dist/places/search.js +50 -1
- package/dist/scene/body-places.d.ts +98 -0
- package/dist/scene/body-places.js +112 -0
- package/dist/scene/body.js +10 -5
- package/dist/scene/earth-places.d.ts +114 -1
- package/dist/scene/earth-places.js +200 -7
- 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 +52 -2
- package/dist/space/element.js +279 -33
- 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 +13 -0
- package/dist/space/scene.js +137 -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 +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { BodyId } from "./facts.ts";
|
|
2
|
+
/**
|
|
3
|
+
* How a moon's picture is known: `shape-and-map` (its shape model and its surface map are from a spacecraft), or `shape` (its shape model is, and its colour is from its measured brightness, as no map of it exists).
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { shapeBasis, type ShapeBasis } from "@johnmorrisdotca/wakusei-planets";
|
|
8
|
+
*
|
|
9
|
+
* const basis: ShapeBasis | undefined = shapeBasis("nix");
|
|
10
|
+
* console.log(basis);
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export type ShapeBasis = "shape-and-map" | "shape";
|
|
14
|
+
/**
|
|
15
|
+
* How the picture of a body rests on measurement, or `undefined` for a body drawn from its facts alone (a sphere or an ellipsoid).
|
|
16
|
+
*
|
|
17
|
+
* @param id - The body.
|
|
18
|
+
* @returns The basis, or `undefined` for a body drawn from its facts alone.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { shapeBasis } from "@johnmorrisdotca/wakusei-planets";
|
|
23
|
+
*
|
|
24
|
+
* console.log(shapeBasis("phobos"), shapeBasis("mars"));
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function shapeBasis(id: BodyId): ShapeBasis | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* The line a card says about how the body is drawn: for a moon drawn with its measured shape, "shape measured; colour from its measured brightness" when it has no map, and "shape and surface measured by spacecraft" when it has one.
|
|
30
|
+
* An empty string for any other body.
|
|
31
|
+
*
|
|
32
|
+
* @param id - The body.
|
|
33
|
+
* @param lang - `en` or `ja`.
|
|
34
|
+
* @returns The line.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* import { shapeNote } from "@johnmorrisdotca/wakusei-planets";
|
|
39
|
+
*
|
|
40
|
+
* console.log(shapeNote("hydra", "en"));
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function shapeNote(id: BodyId, lang: "en" | "ja"): string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const NOTE = {
|
|
2
|
+
shape: { en: "shape measured; colour from its measured brightness", ja: "形は測定したもの。色は測定した明るさから" },
|
|
3
|
+
"shape-and-map": { en: "shape and surface measured by spacecraft", ja: "形も表面も探査機が測定したもの" },
|
|
4
|
+
};
|
|
5
|
+
// The moons drawn with a measured shape (their looks carry `shape`), and whether a mission map is drawn on them too. test/shape.test.ts holds this table to the looks.
|
|
6
|
+
const BASIS = {
|
|
7
|
+
phobos: "shape-and-map", deimos: "shape-and-map", phoebe: "shape-and-map",
|
|
8
|
+
nix: "shape", hydra: "shape", proteus: "shape", larissa: "shape", amalthea: "shape", thebe: "shape", hyperion: "shape", janus: "shape", epimetheus: "shape", prometheus: "shape", pandora: "shape",
|
|
9
|
+
atlas: "shape", pan: "shape", daphnis: "shape", helene: "shape", telesto: "shape", calypso: "shape",
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* How the picture of a body rests on measurement, or `undefined` for a body drawn from its facts alone (a sphere or an ellipsoid).
|
|
13
|
+
*
|
|
14
|
+
* @param id - The body.
|
|
15
|
+
* @returns The basis, or `undefined` for a body drawn from its facts alone.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { shapeBasis } from "@johnmorrisdotca/wakusei-planets";
|
|
20
|
+
*
|
|
21
|
+
* console.log(shapeBasis("phobos"), shapeBasis("mars"));
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export function shapeBasis(id) {
|
|
25
|
+
return BASIS[id];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The line a card says about how the body is drawn: for a moon drawn with its measured shape, "shape measured; colour from its measured brightness" when it has no map, and "shape and surface measured by spacecraft" when it has one.
|
|
29
|
+
* An empty string for any other body.
|
|
30
|
+
*
|
|
31
|
+
* @param id - The body.
|
|
32
|
+
* @param lang - `en` or `ja`.
|
|
33
|
+
* @returns The line.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* import { shapeNote } from "@johnmorrisdotca/wakusei-planets";
|
|
38
|
+
*
|
|
39
|
+
* console.log(shapeNote("hydra", "en"));
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export function shapeNote(id, lang) {
|
|
43
|
+
const basis = shapeBasis(id);
|
|
44
|
+
return basis === undefined ? "" : NOTE[basis][lang];
|
|
45
|
+
}
|
|
@@ -73,11 +73,16 @@ export interface MoonLayerDrawn {
|
|
|
73
73
|
/** The dots and the orbits of the view. */
|
|
74
74
|
export interface MoonLayer {
|
|
75
75
|
update(input: MoonLayerInput): MoonLayerDrawn;
|
|
76
|
-
/** The moons whose orbits a planet's `LineSegments` holds, in order, each with how many segments it has
|
|
76
|
+
/** The moons whose orbits a planet's `LineSegments` holds, in order, each with how many segments it has and its orbit's `#rrggbb`: segment number n of the object belongs to the moon where the running total passes n. For a hover on a line. */
|
|
77
77
|
orbitMoons(host: string): readonly {
|
|
78
78
|
id: string;
|
|
79
79
|
segments: number;
|
|
80
|
+
colour: string;
|
|
80
81
|
}[];
|
|
82
|
+
/** The planet's orbits, in the planet's radii round its centre, moved and scaled with the planet; `undefined` before they are built. For a hover on a line. */
|
|
83
|
+
orbitObject(host: string): THREE.LineSegments | undefined;
|
|
84
|
+
/** The opacity every orbit is drawn at, from `MOON_ORBIT_OPACITY` made fainter as the view crowds and goes out. Nothing is drawn by it. */
|
|
85
|
+
setOrbitOpacity(opacity: number): void;
|
|
81
86
|
dispose(): void;
|
|
82
87
|
}
|
|
83
88
|
/** The most dots drawn: more than every known moon, with room for the years of finds to come. */
|
package/dist/space/all-moons.js
CHANGED
|
@@ -96,7 +96,7 @@ export function createMoonLayer(T, parent) {
|
|
|
96
96
|
entry.geometry.setAttribute("position", new T.BufferAttribute(array, 3));
|
|
97
97
|
entry.geometry.setAttribute("color", new T.BufferAttribute(tint, 3));
|
|
98
98
|
entry.count = rings.length;
|
|
99
|
-
entry.moons = rings.map((ring) => ({ id: ring.moon.id, segments: ring.points.length - 1 }));
|
|
99
|
+
entry.moons = rings.map((ring) => ({ id: ring.moon.id, segments: ring.points.length - 1, colour: ring.moon.colors[input.by] }));
|
|
100
100
|
total += rings.length;
|
|
101
101
|
}
|
|
102
102
|
built = { source: input.source, key: orbitsKey(input), time: input.time };
|
|
@@ -152,6 +152,10 @@ export function createMoonLayer(T, parent) {
|
|
|
152
152
|
return { dots: count, orbits: orbitsDrawn, spots };
|
|
153
153
|
},
|
|
154
154
|
orbitMoons: (host) => lines.get(host)?.moons ?? [],
|
|
155
|
+
orbitObject: (host) => lines.get(host)?.object,
|
|
156
|
+
setOrbitOpacity(opacity) {
|
|
157
|
+
lineMaterial.opacity = opacity;
|
|
158
|
+
},
|
|
155
159
|
dispose() {
|
|
156
160
|
parent.remove(dots);
|
|
157
161
|
for (const entry of lines.values())
|
package/dist/space/element.d.ts
CHANGED
|
@@ -20,11 +20,13 @@ import { type MoonsChoice } from "./moon-settings.ts";
|
|
|
20
20
|
import { type Place } from "../places.ts";
|
|
21
21
|
import { type PlaceLayer } from "../place-marks.ts";
|
|
22
22
|
import { type EarthPlace, type EarthPlaceLook, type EarthPlaceMark } from "../scene/earth-places.ts";
|
|
23
|
+
import { type PlaceOnBody, type PlaceOnBodyMark } from "../scene/body-places.ts";
|
|
23
24
|
import { SPACE_BODIES, type BodyPlace, type RidePoint, type RideState, type RideTarget, type SpaceBody, type SpaceLight } from "./scene.ts";
|
|
24
25
|
import { type PaintSpec } from "../paint/trail.ts";
|
|
25
26
|
export type { PaintSpec };
|
|
26
27
|
export { setPlacesLoader } from "../scene/place-layer.ts";
|
|
27
|
-
export { EARTH_PLACE_LOOKS, EARTH_PLACE_MARKS, type EarthPlace, type EarthPlaceKind, type EarthPlaceLook, type EarthPlaceMark } from "../scene/earth-places.ts";
|
|
28
|
+
export { EARTH_PLACE_LOOKS, EARTH_PLACE_MARKS, type EarthPlace, type EarthPlaceClickDetail, type EarthPlaceKind, type EarthPlaceLook, type EarthPlaceMark, type EarthPlaceNamePriority, type EarthPlaceSize } from "../scene/earth-places.ts";
|
|
29
|
+
export type { PlaceOnBody, PlaceOnBodyMark } from "../scene/body-places.ts";
|
|
28
30
|
export { setThreeLoader, SPACE_BODIES, type RidePoint, type RideTarget, type Sight, type SightEdge, type SpaceBody, type SpaceLight };
|
|
29
31
|
/** Where a body is on the screen, in CSS pixels in the element: its centre and its radius. */
|
|
30
32
|
export type { BodyPlace };
|
|
@@ -256,10 +258,53 @@ export declare class WakuseiSpace extends HTMLElement {
|
|
|
256
258
|
/** How the places on the Earth are drawn (the attribute `earth-places-look`): `beam` (the default), `pin` or `ring`. Setting it writes the attribute. */
|
|
257
259
|
get earthPlacesLook(): EarthPlaceLook;
|
|
258
260
|
set earthPlacesLook(look: EarthPlaceLook | null);
|
|
259
|
-
/**
|
|
261
|
+
/**
|
|
262
|
+
* Which layers of places are shown (the attribute `earth-place-layers`, a JSON object of a layer's name to true or false), for `earthPlaces` and `bodyPlaces` alike: a place whose `layer` is named `false` is left out, with its name, and cannot be pressed; any other place,
|
|
263
|
+
* and any layer not named, is shown. The page hands over every place once and switches the layers, instead of building a list for each switch. Setting the property writes the attribute; an empty object takes it away. `earthPlacesShown.hidden` counts the places left out.
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```ts no-run
|
|
267
|
+
* import "@johnmorrisdotca/wakusei-planets/earth-places";
|
|
268
|
+
* import type { WakuseiSpace } from "@johnmorrisdotca/wakusei-planets/space/element";
|
|
269
|
+
*
|
|
270
|
+
* const space = document.querySelector<WakuseiSpace>("wakusei-space")!;
|
|
271
|
+
* space.earthPlaceLayers = { harbours: false };
|
|
272
|
+
* space.setEarthPlaceLayer("harbours", true);
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
get earthPlaceLayers(): Record<string, boolean>;
|
|
276
|
+
set earthPlaceLayers(layers: Readonly<Record<string, boolean>> | null);
|
|
277
|
+
/** Show or hide one layer of places and leave the others as they are: `earthPlaceLayers` with that layer changed. */
|
|
278
|
+
setEarthPlaceLayer(name: string, shown: boolean): void;
|
|
279
|
+
/** The markers laid on the Earth now, as the last draw left them: each place's id and kind, where its foot is in CSS pixels from the view's top left and whether its name is drawn; `omitted` counts the places in sight beyond the first `EARTH_PLACE_MARKS`, and `hidden` the places left out because their layer is off. */
|
|
260
280
|
get earthPlacesShown(): {
|
|
261
281
|
marks: readonly EarthPlaceMark[];
|
|
262
282
|
omitted: number;
|
|
283
|
+
hidden: number;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* The places laid on the bodies other than the Earth wherever the camera looks, drawn as the Earth's are (`earthPlaces`): a list of `{ body, id, lon, lat, label, kind, color }`, `body` being `moon`, `mars`, `ceres` and so on (an entry for `earth` is not drawn:
|
|
287
|
+
* the Earth has `earthPlaces`). Each is a beam, a pin or a ring (`earthPlacesLook`) on the ground of its body, hidden on the far side, named beside it when there is room, never over a body's name. A body smaller than 40 CSS pixels of radius carries none, and at most
|
|
288
|
+
* `EARTH_PLACE_MARKS` stand up in all, the reader's `here` places first. `loadPlaceHits` and `hitToBodyPlace` from `@johnmorrisdotca/wakusei-planets/places/search` make the list from saved ids. Like the Earth's, it needs
|
|
289
|
+
* `@johnmorrisdotca/wakusei-planets/earth-places` imported (chikyu-earth's layout, an optional peer). A press that did not move on a drawn name or a foot ring is the event `wakusei-body-place`. Setting it writes the attribute `body-places`.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```ts no-run
|
|
293
|
+
* import "@johnmorrisdotca/wakusei-planets/space/element";
|
|
294
|
+
* import "@johnmorrisdotca/wakusei-planets/earth-places";
|
|
295
|
+
*
|
|
296
|
+
* const space = document.querySelector("wakusei-space")!;
|
|
297
|
+
* space.bodyPlaces = [{ body: "moon", id: "moon/apollo-11-lunar-module", lon: 23.4731, lat: 0.6742, label: "Apollo 11 lunar module" }];
|
|
298
|
+
* space.addEventListener("wakusei-body-place", (event) => console.log((event as CustomEvent).detail));
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
301
|
+
get bodyPlaces(): PlaceOnBody[];
|
|
302
|
+
set bodyPlaces(list: readonly PlaceOnBody[] | null);
|
|
303
|
+
/** The markers laid on the other bodies now, as the last draw left them: each place's body, id and kind, where its foot is in CSS pixels from the view's top left and whether its name is drawn; `omitted` counts the places in sight beyond the first `EARTH_PLACE_MARKS`, and `hidden` the places left out because their layer is off. */
|
|
304
|
+
get bodyPlacesShown(): {
|
|
305
|
+
marks: readonly PlaceOnBodyMark[];
|
|
306
|
+
omitted: number;
|
|
307
|
+
hidden: number;
|
|
263
308
|
};
|
|
264
309
|
/**
|
|
265
310
|
* Go to a place on a body: the view glides to the body (as `goTo` does), or on the body looked at turns round it, and the camera comes to rest straight above the place. The place is an id (`mars/perseverance`) or an English or Japanese name, on the body looked at
|
|
@@ -838,6 +883,11 @@ export declare class WakuseiSpace extends HTMLElement {
|
|
|
838
883
|
miss: Record<string, number>;
|
|
839
884
|
hidden: string[];
|
|
840
885
|
faded: string[];
|
|
886
|
+
fade: {
|
|
887
|
+
crowd: number;
|
|
888
|
+
outness: number;
|
|
889
|
+
opacity: number;
|
|
890
|
+
};
|
|
841
891
|
};
|
|
842
892
|
/** The arrowheads on the orbit lines at the last draw, by line (`earth`, the planets, `moon`): where each is and the way it points, the way the body goes (not the way the clock runs). */
|
|
843
893
|
arrows: Record<string, {
|