@johnmorrisdotca/wakusei-planets 0.59.0 → 0.61.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 +18 -0
- package/NOTICE.md +9 -0
- package/README.md +31 -3
- package/dist/bodies/earth.js +22 -1
- package/dist/data/places-moon.d.ts +12 -9
- package/dist/data/places-moon.js +3 -3
- package/dist/element.d.ts +1 -1
- package/dist/flat/bodies.d.ts +122 -0
- package/dist/flat/bodies.js +115 -0
- package/dist/flat/define.d.ts +3 -0
- package/dist/flat/define.js +6 -0
- package/dist/flat/element.d.ts +145 -0
- package/dist/flat/element.js +1614 -0
- package/dist/flat/geometry.d.ts +127 -0
- package/dist/flat/geometry.js +121 -0
- package/dist/flat/index.d.ts +5 -0
- package/dist/flat/index.js +6 -0
- package/dist/flat/scene.d.ts +152 -0
- package/dist/flat/scene.js +195 -0
- package/dist/flat/system-define.d.ts +3 -0
- package/dist/flat/system-define.js +6 -0
- package/dist/flat/system-element.d.ts +133 -0
- package/dist/flat/system-element.js +1435 -0
- package/dist/flat/system-words.d.ts +28 -0
- package/dist/flat/system-words.js +102 -0
- package/dist/flat/system.d.ts +440 -0
- package/dist/flat/system.js +521 -0
- package/dist/flat/words.d.ts +55 -0
- package/dist/flat/words.js +133 -0
- package/dist/space/travel.js +36 -5
- package/dist/surface/drive.d.ts +5 -2
- package/dist/surface/drive.js +13 -15
- package/dist/surface/element.d.ts +38 -1
- package/dist/surface/element.js +144 -14
- package/dist/surface/index.d.ts +1 -0
- package/dist/surface/index.js +1 -0
- package/dist/surface/model.d.ts +54 -0
- package/dist/surface/model.js +147 -0
- package/dist/surface/rig.d.ts +125 -0
- package/dist/surface/rig.js +107 -0
- package/dist/surface/scene.d.ts +3 -0
- package/dist/surface/scene.js +22 -1
- package/package.json +38 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.61.0] - 2026-11-17
|
|
6
|
+
|
|
7
|
+
- **IM-2's three rovers stand on Athena, east of the prime meridian** (MODULES-1402; John Morris, 2026-11-17). GCAT's lander catalogue has the whole IM-2 landing at 84.7906 S, 29.1957 W; NASA's table, which the places take, puts Athena at 29.1957 E, but GRACE, MAPP and Yaoki, which NASA's table does not list, kept the catalogue's point on the far side of the prime meridian. `scripts/make-places-data.py` now moves a rover the catalogue puts at its lander's own point with the lander whenever a better source moves the lander more than 0.05 degree and has no position of its own for the rover; the rovers keep the catalogue's figure in `gcatPosition`. No other rover on the Moon or Mars disagrees with its lander, and a test pins both.
|
|
8
|
+
- **The `loading` state says it also waits for the picture to come into sight** (MODULES-1462; John Morris, 2026-11-17). A still is made only for a picture on the screen. On spaceprogramx.com the star card, held short by a notice above the time bar, scrolls inside itself, and its star picture below the card's fold stayed `loading` until it was scrolled to, which read as a picture that never settled. Nothing in the drawing changes. A new freeze test holds both halves: a star below the fold of a scrolling box takes no still, and once scrolled to it is `still` in about half a second in software.
|
|
9
|
+
- **The flat solar system: `<wakusei-flat-system>`** (MODULES-1396; John Morris, 2026-11-17). A top-down map in the plane of the ecliptic, in the same family as `<wakusei-flat>`: the Sun in the middle, the eight planets and Pluto at their places for the time shown with their orbits, the dwarf planets and the asteroids Vesta and Pallas and the centaurs Chiron and Pholus, the main belt, the Hildas, the Jupiter Trojans, the Centaurs and the Kuiper belt as clouds of points (the package's sample, 3,340 bodies), the 34 comets with a tail turned from the Sun, and the 19 spacecraft with their whole paths, the Tesla Roadster among them (red, named by its car, drawn as a ring because its place is a prediction). It is an element of its own, not `body="sun"` of `<wakusei-flat>`, because it has no picture, no wrap and no latitude: new entries `@johnmorrisdotca/wakusei-planets/flat/system/define` (the element) and `@johnmorrisdotca/wakusei-planets/flat/system` (the pure side, with no DOM: `systemMarks`, `systemBelts`, `systemOrbit`, `systemCometOrbit`, `craftPath`, `squeezeAu`, `radiusAu`, `systemExtent`, the view's `projectSystem`, `unprojectSystem`, `zoomSystemAbout` and `clampSystemView`, and `SYSTEM_WORDS`). Distances use the plan's logarithm (`planRadius`, 0.1 au inner, rings at 1, 5, 10, 30 and 100 au) or `spacing="true"`; the edge is the smallest of 50 to 2,000 au that holds the planets, dwarf planets and craft shown (200 au with Voyager 1), or `extent`. It has `<wakusei-flat>`'s `time`, `speed`, `paused`, `selected`, `dot-size`, `controls`, `lang`, `track` and `names`, its events `wakusei-flat-pick`, `-view`, `-filter` and `wakusei-timechange`, its pan, pinch, wheel and keyboard (arrows from body to body, Enter, Escape, plus and minus), and the game clock; `center` follows a body, `layers`, `craft`, `comets`, `belts`, `orbits` and `spacing` choose what is drawn. It draws nothing at rest, out of sight or in a hidden tab, redraws the disc only when the view or scale changes, and keeps its canvases inside 6 MP and 4096 a side. English and Japanese through `SYSTEM_WORDS`. The demo is `system.html`, the guide is "The flat solar system" in both languages, and the tests are `test/flat-system.test.ts`, `e2e/flat-system.demo.ts` and `e2e/flat-system-freeze.demo.ts`.
|
|
10
|
+
- **npm keywords from the survey** (MODULES-532; John Morris, 2026-11-17). The package keywords now carry every true name from the survey (the planets and dwarf planets, orbit, rotation, heliocentric, celestial, space, nasa, jpl, javascript, 3d, browser) and `asteroids`, `comets` and `stars`, which the `/asteroids`, `/comets` and `/stars` entry points ship today; the names of other kinds of package (astrology, zodiac, swisseph, mcp, interstellar and the like) stay out. `test/keywords.test.ts` pins the kept names, the left-out names, lower case and no repeats. The rest are added as each feature ships.
|
|
11
|
+
- **An ended event for the watched landing, and its state readable** (MODULES-1347). `<wakusei-surface watch="landing">` sends `wakusei-landing-ended` (`detail` `{ t: 725, rate, camera }`) once each time the clock arrives at the touchdown, running or by a seek, and `wakusei-landing-state` (`detail` `{ t, playing, rate, camera, ended }`) when the descent starts or stops running (play, pause, the clock arriving at the touchdown), when `landingRate` changes and when the camera changes. A page can now carry the pause state in an address without reading `landing` every second. Arriving at the touchdown by a seek while running now stops the clock at once. The `wakusei-landing-clock` event is as it was. `e2e/surface.demo.ts` tests both.
|
|
12
|
+
- **The Earth without chikyu-earth: tested, and said in the console** (MODULES-542, part 1). `<wakusei-body body="earth" look="line">` already fell back to this package's own outline when chikyu-earth's element is not on the page; that is now tested without a browser (`test/earth-fallback.test.ts`: no globe, the message once, none when the element arrives within the grace) and in a real bundle with chikyu-earth missing (`pnpm test:usage`, step `earth-without-chikyu`), and the page's console gets one `console.info` line, once, if the element has still not come two seconds after the first line Earth is drawn. Documented in "Looks and bodies" in both languages. Part 2 (chikyu-earth's `/realistic` for the shaded Earth) is not built here.
|
|
13
|
+
- **The two-packages guide says two WebGL contexts, not one** (MODULES-1483; John Morris, 2026-11-17). With a shaded wakusei body and chikyu-earth's realistic Earth or space view on one page, each package calls kazoku-ui's `createSharedRenderer` itself, so the page has two contexts (measured). The guide, in English and Japanese, now says so, and names chikyu-earth's `setSharedRenderer` (before its first element connects; one live view, the rest stills) and that wakusei-planets does not yet export or accept a renderer.
|
|
14
|
+
- **A move between two moons of one planet never passes through an empty picture** (MODULES-1228, MODULES-1254). The last case left was Phobos to Deimos at true scale in a tall picture, from one side: 15 samples of its turn showed neither moon. Every way of making that move needed the camera to back off, and the backing off of the aim-point turn (a smooth step in the log of the distance) had to go about 500 units out to be far enough early in the turn, further than the pace limits allow in the turn's share of the move, so no aim turn was taken. Where a picture is still empty after every way has been tried, each way's turn is now made once more with the backing off fitted to the two moons: the camera is no further from the aim point than keeps the nearer moon inside 0.9 of the way to the nearer edge of the picture (about 21 units for that move). Walked from ten sides at three picture shapes and both scales, the six pairs of moons (Callisto to Europa, Io to Ganymede, Titan to Enceladus, Oberon to Miranda, Phobos to Deimos, Triton to Proteus; 360 walks of 241 samples) have no empty picture, no destination lost after the turn, none drifting from its place and none jumping, so the list of cases left in `test/space-travel.test.ts` is empty. A move that had no empty picture is the move it was, sample for sample (`test/travel-baseline.test.ts`). The fitted turn is quick (one backing off for each lean and pace), so it is tried whatever the planning budget: with no time at all for the other ways, 6 of the 360 walks have a fault where 17 had (95 empty samples where 285 were). Tests: `test/space-travel.test.ts`, `test/travel-budget.test.ts`; the table is `scripts/travel-table.ts`.
|
|
15
|
+
- **A real rover model for the standing view: `drive-model`** (MODULES-1482, part). `<wakusei-surface drive="on" drive-model="/models/perseverance.glb">` loads a GLB (three.js's own glTF loader and meshopt decoder, imported only then; the whole of three.js is needed) and draws it in place of the drawn rover, over the ground, lit by the Sun of the place, with a shadow the size of its body. Its `wheel-fl|fr|ml|mr|rl|rr` nodes roll from the drive state, its `steer-fl|fr|rl|rr` pivots turn with the steering, and `eye` (or `seat-commander`) is the seat view; the drive takes the model's own wheelbase, track and wheel size (`rigOf`, `Rig`, and a `rig` argument to `driveStep` and `driveView`, the lunar rover's by default). `wakusei-model` and `wakusei-model-error` say how the load went, `driveModel` reads it, and `loadVehicleModel` (`/surface/model`) loads one for a page's own use. **Models**: NASA's Perseverance (1,020,496 bytes) and Curiosity (1,065,672 bytes), public domain, in `models/`, served by the site and in no npm package, each its own file fetched only when asked for (credits in NOTICE.md). **Not here yet**: the new sites (Perseverance and Curiosity on Mars, Apollo 15 and 16, Yutu and Yutu-2). They need ground height tiles made from source data this machine does not hold, and Mars has no standing view yet.
|
|
16
|
+
- **Test floors: a coverage floor and a size budget** (MODULES-551; John Morris, 2026-11-17). `pnpm test:coverage` runs the unit tests with Node's own coverage over `src/` and fails under a floor set just under what was measured (lines 96, branches 93, functions 95; it only goes up), and `pnpm check`, which CI runs, now uses it. `pnpm size:budget` bundles, minifies and gzips each of the 97 published entry points and fails when one grows more than 5 per cent and 256 bytes over `scripts/size-baseline.json`; `pnpm size:budget:update` records a growth on purpose. New guide, "How we test" (テストの方法), in both languages. No new dependency.
|
|
17
|
+
- **A public API snapshot test** (MODULES-552; John Morris, 2026-11-17). `test/api-snapshot.test.ts` lists every export of every published entry point with its kind and signature, read from the source with the TypeScript compiler API (no build, no new dependency), and fails when `test/api-snapshot.txt` differs: a renamed, removed or re-typed export, or a new one. A change you mean is recorded with `pnpm api:update`, in the same commit, with the reason here. Nothing in `src/` changed.
|
|
18
|
+
|
|
19
|
+
## [0.60.0] - 2026-11-17
|
|
20
|
+
|
|
21
|
+
- **Flat maps of the Moon and Mars: `<wakusei-flat body="moon|mars">`** (MODULES-1395; John Morris, 2026-11-17). A new entry, `@johnmorrisdotca/wakusei-planets/flat/define` (the element) and `@johnmorrisdotca/wakusei-planets/flat` (the pure side, with no DOM): the body's own painted picture as a flat, wrapping equirectangular map, with the night side shaded from the Sun's place for the time shown (sharp on the Moon, an 8 degree dusk on Mars), the Sun's mark, the landing, rover, crash and planned sites and the named features of the places data as marks, and the orbiters as dots that move over it for the time shown, with a coverage circle (`footprint`) and a ground track (`track`) cut at the map's edge (longitude 180) and the poles. The Moon draws LRO, Chandrayaan-2, Danuri, ARTEMIS P1 and P2 and Mars draws MRO, Odyssey, MAVEN, Mars Express, TGO and Hope; CAPSTONE and Tianwen-1 have no public path and are not drawn, and a craft whose place may be more than 2 per cent of the body's radius out is drawn as a ring. It uses the space view's game clock, so it is smooth at any speed (a short streak at a fast clock), and draws nothing at rest, out of sight or in a hidden tab. It has the same attributes and events as chikyu-earth's `<chikyu-flat>` (`center`, `home-lon`, `home-lat`, `time`, `speed`, `paused`, `footprint`, `track`, `selected`, `shade`, `dot-size`, `controls`, `lang`; `wakusei-flat-pick`, `-view`, `-filter` and `wakusei-timechange`), so one control can swap bodies. A press or tap sends one `wakusei-flat-pick` for every pressable thing (an orbiter, a place of the tables, a crater or mountain, a landing site), with `kind`, `id`, `name`, `via`, and for a place its `place` record and its `site` from `/landing-sites`; the landing sites are named by their own names and carry their country's flag as `<hata-flag>` with `site-flags` (the page imports hata; no new dependency), and the demo draws a card from the event; the marks and dots can be reached with the arrow keys; a drag pans and two fingers pinch. English and Japanese through `FLAT_WORDS`. The demo is `flat.html`, the guide is "Flat maps of the Moon and Mars" in both languages, and the tests are `test/flat.test.ts`, `e2e/flat.demo.ts` and `e2e/flat-freeze.demo.ts` (a canvas: no WebGL context, no graphics object, the canvas inside 6 MP and 4096 a side, and no draw at rest). The tiles are not used yet: the map is the 1024 and 2048 pixel pictures.
|
|
22
|
+
|
|
5
23
|
## [0.59.0] - 2026-11-17
|
|
6
24
|
|
|
7
25
|
- **A name, a ring or a note behind a nearer body is hidden, not drawn over its disc** (MODULES-1404; John Morris, 2026-11-17, from the view at Pholus on spaceprogramx.com: Jupiter, Mercury with its ring, Halley and the Hildas' name were drawn over the dark disc as if it were glass). In `<wakusei-space>` a body whose place is inside a nearer body's drawn disc now fades its floating name and ring out (the 0.35 s fade the far names already use, none under reduced motion) and back as it comes out; a body's own name stays. The disc is the one drawn, at the edge-round radius 0.57 gave it (`placeOf(id).r`), tested once per label per draw against the few discs of 6 pixels of radius or more, with nothing read back from the picture. This is the new default of the `covered` attribute and property: `hide`; `arrow` is as before and `name` is the old way, names over the disc. The Oort cloud's note and the marks of the places on a body (the body looked at, or the Earth's `earth-places`) that is itself behind another go the same way. New: `space.coveredAt(point)`, the id of the body whose disc hides a point of the scene (as `stats.camera` has it) or `null`, for a page's own labels over the view (spaceprogramx's belt names: the Hildas, the Centaurs, the Kuiper belt, the Jupiter Trojans); and `coverOf(point, discs, self?)` from `/space`, the maths, which `coveredBy` now uses. Unit tests of the maths; `e2e/space-occlude.demo.ts` goes to Pholus at 2026-11-30T06:01Z and checks that the names behind its disc are hidden and Pholus's own is not, and that `coveredAt` hides a point behind the disc and none beside or in front of it.
|
package/NOTICE.md
CHANGED
|
@@ -274,6 +274,15 @@ The height tiles of `<wakusei-surface>` (`scripts/make-moon-terrain.py`; they ar
|
|
|
274
274
|
- **Left out**: the merged LOLA and Kaguya (SELENE) height grid. The JAXA part's terms could not be found, and an MIT-licensed package can pass on only what it knows to be free to pass on.
|
|
275
275
|
- **Made, not measured**: everything below the 5 m grid (small craters from 0.5 to 20 m, the roughness of the dust, rocks of 0.1 to 1.5 m) is made by this package from a seeded random grid, by the lunar size-frequency law, and is not a picture or a measurement of any place. The picture says so under the ground.
|
|
276
276
|
|
|
277
|
+
## Rover models
|
|
278
|
+
|
|
279
|
+
Two rover models for `drive-model` on `<wakusei-surface>`, in `models/` (served beside the demo at `models/`, in no npm package; each is a GLB the page fetches only when it asks for it). Both are NASA 3D Resources, NASA content, public domain; each was prepared for this package (split into separate wheels and steering pivots, simplified, textures shrunk to WebP at 512 px, packed with meshopt) and nothing was repainted.
|
|
280
|
+
|
|
281
|
+
| File | Title | Author | Licence | Source | Size |
|
|
282
|
+
|---|---|---|---|---|---|
|
|
283
|
+
| `perseverance.glb` | Mars 2020 Perseverance Rover | NASA/Jet Propulsion Laboratory (JPL-Caltech) | Public domain (NASA 3D Resources; NASA content is not copyrighted) | https://science.nasa.gov/3d-resources/mars-2020-perseverance-rover/ | 1,020,496 bytes |
|
|
284
|
+
| `curiosity.glb` | Curiosity Rover, 3D Model | NASA/JPL-Caltech | Public domain (NASA 3D Resources; NASA content is not copyrighted) | https://science.nasa.gov/resource/curiosity-rover-3d-model/ | 1,065,672 bytes |
|
|
285
|
+
|
|
277
286
|
## Interior cutaway
|
|
278
287
|
|
|
279
288
|
The cutaway's figures were read on 2026-11-13. NASA content is not subject to copyright in the United States. Nothing was copied from the pages; the numbers and the materials they name are the pages' facts, and a figure the page gives as "about" stays marked about.
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Wakusei Planets runs in the browser of a phone, a tablet or a computer: nothing
|
|
|
19
19
|
|
|
20
20
|
<p align="center"><img alt="The demo on a desk: Saturn in the painted look, turning in the big view, with the page's links to the portrait builder, the colouring sheets, the space view, the star page and the size line-up above it, and the choice of body and its moons below" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/main/docs/images/home-desk.webp" width="620"> <img alt="The same page on a phone: the same links in rows, and Saturn in the painted look below them" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/main/docs/images/home-phone.webp" width="200"></p>
|
|
21
21
|
|
|
22
|
-
<p align="center"><img alt="Every body at one scale, the Earth among them: each small body has a magnified picture joined by a line, and the Sun shows only its edge" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.
|
|
22
|
+
<p align="center"><img alt="Every body at one scale, the Earth among them: each small body has a magnified picture joined by a line, and the Sun shows only its edge" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.61.0/docs/images/lineup-desk.png" width="640"></p>
|
|
23
23
|
|
|
24
24
|
## Who it is for
|
|
25
25
|
|
|
@@ -163,6 +163,30 @@ const io = planAt(Date.UTC(2026, 10, 11), { system: "jupiter", mark: "io", spaci
|
|
|
163
163
|
console.log(io?.distance.toFixed(1), "Jupiter radii from Jupiter");
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
+
## Flat maps of the Moon and Mars
|
|
167
|
+
|
|
168
|
+
`<wakusei-flat body="moon" track>` is the Moon on a flat map (`body="mars"` is Mars): the body's own painted picture with day and night for the time shown, the landing, rover and crash sites marked, and the spacecraft in orbit as dots that move over it with their coverage circles and ground tracks. It is a canvas with no WebGL, takes `time`, `speed` and `paused`, sends `wakusei-flat-pick` when an orbiter or a mark is pressed, works by keyboard and touch, and has the same attributes and events as chikyu-earth's `<chikyu-flat>`, so one control can swap the Earth, the Moon and Mars. It draws five lunar orbiters (LRO, Chandrayaan-2, Danuri, ARTEMIS P1 and P2) and six Martian ones (MRO, Odyssey, MAVEN, Mars Express, TGO and Hope); CAPSTONE and Tianwen-1 have no public path and are not drawn.
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
import { flatOrbiter } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
172
|
+
|
|
173
|
+
const lro = flatOrbiter("lro", Date.UTC(2026, 10, 12));
|
|
174
|
+
console.log(lro?.altitudeKm.toFixed(0), "km up");
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## The flat solar system
|
|
178
|
+
|
|
179
|
+
`<wakusei-flat-system>` is the solar system from above on a flat map: the Sun, the planets on their orbits at the time shown, the dwarf planets, the asteroid and Kuiper belts as clouds of points, 34 comets and the spacecraft with their whole paths, the Tesla Roadster among them. Distances are squeezed by the plan's logarithm so Mercury and Neptune both show, or true with `spacing="true"`. It is a canvas with no WebGL, takes `time`, `speed` and `paused`, sends `wakusei-flat-pick`, works by keyboard and touch, and has the attributes and events of `<wakusei-flat>`. [The flat solar system](docs/guides/flat-system.md) has the attributes.
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
import { loadSpacecraft } from "@johnmorrisdotca/wakusei-planets/spacecraft";
|
|
183
|
+
import { systemMarks } from "@johnmorrisdotca/wakusei-planets/flat/system";
|
|
184
|
+
|
|
185
|
+
await loadSpacecraft("roadster");
|
|
186
|
+
const car = systemMarks(Date.UTC(2026, 10, 17), { layers: ["craft"], craft: ["roadster"] }).find((mark) => mark.id === "roadster");
|
|
187
|
+
console.log(car?.distanceAu.toFixed(2), "au from the Sun");
|
|
188
|
+
```
|
|
189
|
+
|
|
166
190
|
## A name on the body
|
|
167
191
|
|
|
168
192
|
`body-label="painted"` writes the body's name on its own globe, large and in capitals, lying on the surface and turning with it, as a film lays a title over the thing it names: on `<wakusei-body>` and on every body of `<wakusei-space>`, in the page's language, in Michroma by default or a font of yours. Four looks (`painted`, `etched`, `outline`, `burned`), once or on both sides, at the equator or near a pole, turning with the body or always facing you; nothing on a body too small on the screen. [A name on the body](docs/guides/name-on-the-body.md) has the attributes.
|
|
@@ -388,7 +412,7 @@ The tiles of every body share one 48 MB budget, six loads at a time for a source
|
|
|
388
412
|
|
|
389
413
|
## The portrait builder
|
|
390
414
|
|
|
391
|
-
<p align="center"><img alt="The Sun and the planets in an arc, painted, with their names, in the portrait builder" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.
|
|
415
|
+
<p align="center"><img alt="The Sun and the planets in an arc, painted, with their names, in the portrait builder" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.61.0/docs/images/portrait-family.png" width="640"></p>
|
|
392
416
|
|
|
393
417
|
[The portrait builder](https://johnmorrisdotca.github.io/wakusei-planets/portrait.html) puts any bodies in one picture: drag them, size them, turn them, order them front to back, arrange them in a row, an arc, a grid or at true orbit distance (true or readable sizes, a planet's moons round it in orbit order), light them from one direction, and take the code, a PNG or an SVG. The scene is kept in the address, and every body is drawn in one WebGL scene, so the page holds one WebGL context. [The portrait builder](docs/guides/portrait-builder.md) is its guide.
|
|
394
418
|
|
|
@@ -444,6 +468,8 @@ The reference is a site, made from the source's own doc comments: every export h
|
|
|
444
468
|
| `.../portrait` | `<wakusei-portrait>`: many bodies in one scene. The scene model (`addBody`, `layoutPortrait`, `encodeScene`, `decodeScene`) is in the main entry. |
|
|
445
469
|
| `.../space` | Where the Sun, the Moon and the planets are for a date, in two scales, and where a camera riding along looks: `frameAt`, `createTrack`, `placeSun`, `placeAround`, `ridePose`. No browser. |
|
|
446
470
|
| `.../space/element` | `<wakusei-space>`: the Earth, the Moon, the Sun and the planets in their places. |
|
|
471
|
+
| `.../flat` | The flat maps' pure side: `flatSun`, `flatOrbiter`, `shadeNight`, `circleOutline`, `flatTrack`, the geometry and the words. `.../flat/define` is `<wakusei-flat>`, the Moon or Mars on a flat map, in a canvas with no WebGL. |
|
|
472
|
+
| `.../flat/system` | The flat solar system's pure side: `systemMarks`, `systemBelts`, `systemOrbit`, `craftPath`, `squeezeAu`, the view and the words. `.../flat/system/define` is `<wakusei-flat-system>`, in a canvas with no WebGL. |
|
|
447
473
|
| `.../plan` | The top-down plan: `planAt`, `planSvg`, `planText`. `.../plan/element` is `<wakusei-plan>`, in SVG with no WebGL. |
|
|
448
474
|
| `.../landing-sites` | The 39 soft landings on the Moon and Mars as plain data: `LANDING_SITES`, `landingSitesOf`, `findLandingSite`, `flagCodeOf`. No browser, no three.js. |
|
|
449
475
|
| `.../nearest` | The bodies nearest to a body on a date (`nearest`, `within`), when two bodies come closest (`closestApproach`, `conjunctions`) and how far apart they are (`distance`, `distanceRange`). No browser. |
|
|
@@ -479,6 +505,8 @@ Each guide has a Japanese twin in [docs/guides/ja](docs/guides/ja/getting-starte
|
|
|
479
505
|
| [The space view](docs/guides/space-view.md) | The Earth, Moon, Sun and planets in their places; two scales; time both ways |
|
|
480
506
|
| [A star from its numbers](docs/guides/star-look.md) | Any star in 3D or as lines, what is measured and what is drawn, every way to put it in a page |
|
|
481
507
|
| [The size line-up](docs/guides/size-lineup.md) | The Sun and the largest stars at true relative size, with each radius, its error and its paper, where the papers disagree, every way to put it in a page |
|
|
508
|
+
| [Flat maps of the Moon and Mars](docs/guides/flat.md) | The Moon or Mars on a flat map: day and night, the sites, the orbiters moving with their coverage and ground tracks, the same attributes and events as the Earth's flat map |
|
|
509
|
+
| [The flat solar system](docs/guides/flat-system.md) | The Sun, planets, belts, comets and spacecraft (the Tesla Roadster) from above on a flat map: squeezed or true distances, the same attributes and events as the flat maps |
|
|
482
510
|
| [The top-down plan](docs/guides/plan.md) | The solar system or one planet's moons from above, with one body marked: squeezed or to-scale distances, drawing only on change |
|
|
483
511
|
| [Zoom and pan](docs/guides/zoom-and-pan.md) | Every view zooms and moves by itself: the range of each and why it ends there, the bar, the embed page |
|
|
484
512
|
| [Close zoom and map tiles](docs/guides/close-zoom.md) | How far each body zooms and why, the finer map tiles for a close zoom (made from public-domain maps, served beside the demo, never in the package), the generic detail, what it costs |
|
|
@@ -539,7 +567,7 @@ BODIES.pluto.kind; // "dwarf-planet"
|
|
|
539
567
|
|
|
540
568
|
If this package helps a paper, a talk or a class, please cite it as software. GitHub's "Cite this repository" button reads [CITATION.cff](CITATION.cff) and gives BibTeX and APA; in plain text:
|
|
541
569
|
|
|
542
|
-
> Morris, J. (2026). *Wakusei Planets* (version 0.
|
|
570
|
+
> Morris, J. (2026). *Wakusei Planets* (version 0.61.0) [Computer software]. https://github.com/johnmorrisdotca/wakusei-planets
|
|
543
571
|
|
|
544
572
|
Cite the version you used (`npm ls @johnmorrisdotca/wakusei-planets`), and cite the sources of the numbers you use as well: [NOTICE.md](NOTICE.md) names each one, with the paper or the page it was read from (the IAU working group's report for sizes and poles, VSOP87B, ELP2000-82B, L1.2 and TASS1.7 for positions, and NASA's JPL Horizons for the fits and the spacecraft).
|
|
545
573
|
|
package/dist/bodies/earth.js
CHANGED
|
@@ -4,10 +4,31 @@ import { delegates, waiting } from "../scene/store.js";
|
|
|
4
4
|
// This entry never imports chikyu-earth itself, so a project without that optional peer still builds. The realistic and painted looks are drawn here like every other body's (earth-look.ts).
|
|
5
5
|
const CENTRE = "10,20";
|
|
6
6
|
const TAG = "chikyu-earth";
|
|
7
|
+
/** What a page's console is told, once, when the line Earth is the plain outline because chikyu-earth's element is not on the page. */
|
|
8
|
+
const MESSAGE = `wakusei-planets: the Earth's line look is drawn as a plain outline because chikyu-earth's element is not on the page. Import "@johnmorrisdotca/chikyu-earth/element" for the globe with the countries.`;
|
|
9
|
+
/** How long the element has to arrive before the page is told (an import that comes a moment after this one is not a missing package). */
|
|
10
|
+
const GRACE_MS = 2000;
|
|
11
|
+
const present = () => typeof customElements !== "undefined" && customElements.get(TAG) !== undefined;
|
|
12
|
+
let told = false;
|
|
13
|
+
let timer;
|
|
14
|
+
/** The line Earth fell back to the outline: after a grace, if the element still has not come, say so once in the console (`console.info`: a missing optional peer is not an error). */
|
|
15
|
+
function missing() {
|
|
16
|
+
if (told || timer !== undefined)
|
|
17
|
+
return;
|
|
18
|
+
timer = setTimeout(() => {
|
|
19
|
+
timer = undefined;
|
|
20
|
+
if (present() || told)
|
|
21
|
+
return;
|
|
22
|
+
told = true;
|
|
23
|
+
console.info(MESSAGE);
|
|
24
|
+
}, GRACE_MS);
|
|
25
|
+
}
|
|
7
26
|
delegates.set("earth", {
|
|
8
27
|
async line({ center, size }) {
|
|
9
|
-
if (
|
|
28
|
+
if (!present()) {
|
|
29
|
+
missing();
|
|
10
30
|
return null;
|
|
31
|
+
}
|
|
11
32
|
const globe = document.createElement(TAG);
|
|
12
33
|
globe.setAttribute("center", center || CENTRE);
|
|
13
34
|
globe.setAttribute("look", "line");
|
|
@@ -1881,18 +1881,19 @@ export declare const PLACES_MOON: readonly [{
|
|
|
1881
1881
|
};
|
|
1882
1882
|
readonly gcatName: "GRACE";
|
|
1883
1883
|
readonly lat: -84.7906;
|
|
1884
|
-
readonly lon:
|
|
1884
|
+
readonly lon: 29.1957;
|
|
1885
1885
|
readonly date: "2025-03-06T17:28Z";
|
|
1886
1886
|
readonly mission: "GRACE";
|
|
1887
1887
|
readonly operator: "INTMA";
|
|
1888
1888
|
readonly country: "US";
|
|
1889
1889
|
readonly outcome: "soft";
|
|
1890
1890
|
readonly source: {
|
|
1891
|
-
readonly id: "
|
|
1892
|
-
readonly read: "2026-11-
|
|
1891
|
+
readonly id: "nssdca";
|
|
1892
|
+
readonly read: "2026-11-11";
|
|
1893
1893
|
};
|
|
1894
1894
|
readonly note: "Rover, not deployed";
|
|
1895
1895
|
readonly until: "2025-03-07T05:43Z";
|
|
1896
|
+
readonly gcatPosition: readonly [-84.7906, -29.1957];
|
|
1896
1897
|
}, {
|
|
1897
1898
|
readonly id: "moon/mapp";
|
|
1898
1899
|
readonly kind: "rover";
|
|
@@ -1902,18 +1903,19 @@ export declare const PLACES_MOON: readonly [{
|
|
|
1902
1903
|
};
|
|
1903
1904
|
readonly gcatName: "MAPP";
|
|
1904
1905
|
readonly lat: -84.7906;
|
|
1905
|
-
readonly lon:
|
|
1906
|
+
readonly lon: 29.1957;
|
|
1906
1907
|
readonly date: "2025-03-06T17:28Z";
|
|
1907
1908
|
readonly mission: "MAPP";
|
|
1908
1909
|
readonly operator: "LOUT";
|
|
1909
1910
|
readonly country: "US";
|
|
1910
1911
|
readonly outcome: "soft";
|
|
1911
1912
|
readonly source: {
|
|
1912
|
-
readonly id: "
|
|
1913
|
-
readonly read: "2026-11-
|
|
1913
|
+
readonly id: "nssdca";
|
|
1914
|
+
readonly read: "2026-11-11";
|
|
1914
1915
|
};
|
|
1915
1916
|
readonly note: "Rover, not deployed";
|
|
1916
1917
|
readonly until: "2025-03-07T05:43Z";
|
|
1918
|
+
readonly gcatPosition: readonly [-84.7906, -29.1957];
|
|
1917
1919
|
}, {
|
|
1918
1920
|
readonly id: "moon/yaoki";
|
|
1919
1921
|
readonly kind: "rover";
|
|
@@ -1923,18 +1925,19 @@ export declare const PLACES_MOON: readonly [{
|
|
|
1923
1925
|
};
|
|
1924
1926
|
readonly gcatName: "Yaoki";
|
|
1925
1927
|
readonly lat: -84.7906;
|
|
1926
|
-
readonly lon:
|
|
1928
|
+
readonly lon: 29.1957;
|
|
1927
1929
|
readonly date: "2025-03-06T17:28Z";
|
|
1928
1930
|
readonly mission: "Yaoki";
|
|
1929
1931
|
readonly operator: "DYMON";
|
|
1930
1932
|
readonly country: "J";
|
|
1931
1933
|
readonly outcome: "soft";
|
|
1932
1934
|
readonly source: {
|
|
1933
|
-
readonly id: "
|
|
1934
|
-
readonly read: "2026-11-
|
|
1935
|
+
readonly id: "nssdca";
|
|
1936
|
+
readonly read: "2026-11-11";
|
|
1935
1937
|
};
|
|
1936
1938
|
readonly note: "Rover, not deployed";
|
|
1937
1939
|
readonly until: "2025-03-07T05:43Z";
|
|
1940
|
+
readonly gcatPosition: readonly [-84.7906, -29.1957];
|
|
1938
1941
|
}, {
|
|
1939
1942
|
readonly id: "moon/oceanus-procellarum";
|
|
1940
1943
|
readonly kind: "feature";
|
package/dist/data/places-moon.js
CHANGED
|
@@ -88,9 +88,9 @@ export const PLACES_MOON = [{ "id": "moon/luna-2", "kind": "impact", "name": { "
|
|
|
88
88
|
{ "id": "moon/resilience", "kind": "crash", "name": { "en": "Resilience", "ja": "レジリエンス" }, "gcatName": "Resilience", "lat": 60.4445, "lon": -4.588, "date": "2025-01-15T06:11Z", "mission": "Resilience", "operator": "ISPACE", "country": "J", "outcome": "hard", "source": { "id": "nssdca", "read": "2026-11-11" }, "note": "Lunar lander, crashed", "until": "2025-06-05T19:15Z", "gcatPosition": [60.5, -4.6] },
|
|
89
89
|
{ "id": "moon/blue-ghost-1", "kind": "landing", "name": { "en": "Blue Ghost 1", "ja": "ブルーゴースト ミッション1" }, "gcatName": "Blue Ghost", "lat": 18.562, "lon": 61.81, "date": "2025-03-02T08:34Z", "mission": "Blue Ghost", "operator": "FFLY", "country": "US", "outcome": "soft", "source": { "id": "nssdca", "read": "2026-11-11" }, "note": "Lander", "until": "2025-03-16T23:15Z" },
|
|
90
90
|
{ "id": "moon/im-2-athena", "kind": "landing", "name": { "en": "IM-2 Athena", "ja": "IM-2 アテナ" }, "gcatName": "IM-2 Athena", "lat": -84.7906, "lon": 29.1957, "date": "2025-03-06T17:28Z", "mission": "IM-2 Athena", "operator": "INTMA", "country": "US", "outcome": "soft", "source": { "id": "nssdca", "read": "2026-11-11" }, "note": "Lander, toppled", "until": "2025-03-07T05:43Z", "gcatPosition": [-84.7906, -29.1957] },
|
|
91
|
-
{ "id": "moon/grace", "kind": "rover", "name": { "en": "GRACE", "ja": "GRACE" }, "gcatName": "GRACE", "lat": -84.7906, "lon":
|
|
92
|
-
{ "id": "moon/mapp", "kind": "rover", "name": { "en": "MAPP", "ja": "MAPP" }, "gcatName": "MAPP", "lat": -84.7906, "lon":
|
|
93
|
-
{ "id": "moon/yaoki", "kind": "rover", "name": { "en": "Yaoki", "ja": "Yaoki" }, "gcatName": "Yaoki", "lat": -84.7906, "lon":
|
|
91
|
+
{ "id": "moon/grace", "kind": "rover", "name": { "en": "GRACE", "ja": "GRACE" }, "gcatName": "GRACE", "lat": -84.7906, "lon": 29.1957, "date": "2025-03-06T17:28Z", "mission": "GRACE", "operator": "INTMA", "country": "US", "outcome": "soft", "source": { "id": "nssdca", "read": "2026-11-11" }, "note": "Rover, not deployed", "until": "2025-03-07T05:43Z", "gcatPosition": [-84.7906, -29.1957] },
|
|
92
|
+
{ "id": "moon/mapp", "kind": "rover", "name": { "en": "MAPP", "ja": "MAPP" }, "gcatName": "MAPP", "lat": -84.7906, "lon": 29.1957, "date": "2025-03-06T17:28Z", "mission": "MAPP", "operator": "LOUT", "country": "US", "outcome": "soft", "source": { "id": "nssdca", "read": "2026-11-11" }, "note": "Rover, not deployed", "until": "2025-03-07T05:43Z", "gcatPosition": [-84.7906, -29.1957] },
|
|
93
|
+
{ "id": "moon/yaoki", "kind": "rover", "name": { "en": "Yaoki", "ja": "Yaoki" }, "gcatName": "Yaoki", "lat": -84.7906, "lon": 29.1957, "date": "2025-03-06T17:28Z", "mission": "Yaoki", "operator": "DYMON", "country": "J", "outcome": "soft", "source": { "id": "nssdca", "read": "2026-11-11" }, "note": "Rover, not deployed", "until": "2025-03-07T05:43Z", "gcatPosition": [-84.7906, -29.1957] },
|
|
94
94
|
{ "id": "moon/oceanus-procellarum", "kind": "feature", "name": { "en": "Oceanus Procellarum", "ja": "嵐の大洋" }, "lat": 20.6714, "lon": -56.6774, "feature": { "type": "Oceanus, oceani", "typeWord": { "en": "ocean", "ja": "大洋" }, "diameterKm": 2592.24, "approved": "1935-01-01" }, "source": { "id": "iau-gazetteer", "read": "2026-11-11" }, "famous": true },
|
|
95
95
|
{ "id": "moon/mare-frigoris", "kind": "feature", "name": { "en": "Mare Frigoris", "ja": "氷の海" }, "lat": 57.5923, "lon": -0.0064, "feature": { "type": "Mare, maria", "typeWord": { "en": "sea", "ja": "海" }, "diameterKm": 1446.41, "approved": "1935-01-01" }, "source": { "id": "iau-gazetteer", "read": "2026-11-11" } },
|
|
96
96
|
{ "id": "moon/mare-imbrium", "kind": "feature", "name": { "en": "Mare Imbrium", "ja": "雨の海" }, "lat": 34.7244, "lon": -14.9086, "feature": { "type": "Mare, maria", "typeWord": { "en": "sea", "ja": "海" }, "diameterKm": 1145.53, "approved": "1935-01-01" }, "source": { "id": "iau-gazetteer", "read": "2026-11-11" }, "famous": true },
|
package/dist/element.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { type PlaceLayer } from "./place-marks.ts";
|
|
|
15
15
|
export { setThreeLoader };
|
|
16
16
|
export { placeLine, setPlacesLoader } from "./scene/place-layer.ts";
|
|
17
17
|
/**
|
|
18
|
-
* What the element is doing: `line` (an SVG), `loading` (waiting for three.js or a picture), `still` (a picture of the 3D look, nothing running), `live` (drawing), `lost` (the GPU took the context; it comes back by itself) or `unavailable` (no WebGL: the line drawing is shown).
|
|
18
|
+
* What the element is doing: `line` (an SVG), `loading` (waiting for three.js or a picture, or for the element to come into sight: a still is made only for a picture on the screen, so one below the fold of a box that scrolls, a short card for instance, stays `loading` until it is scrolled to), `still` (a picture of the 3D look, nothing running), `live` (drawing), `lost` (the GPU took the context; it comes back by itself) or `unavailable` (no WebGL: the line drawing is shown).
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
21
|
* ```ts no-run
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { type OrbiterId } from "../orbiters.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The bodies the flat map draws: the Moon and Mars. They have the painted maps, the landing, rover and crash sites and the spacecraft in orbit that the package holds; the Earth's flat map is chikyu-earth's `<chikyu-flat>`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { FLAT_BODIES } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
8
|
+
*
|
|
9
|
+
* console.log(FLAT_BODIES.join(", "));
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare const FLAT_BODIES: readonly ["moon", "mars"];
|
|
13
|
+
/**
|
|
14
|
+
* A body the flat map draws.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import type { FlatBodyId } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
19
|
+
*
|
|
20
|
+
* const body: FlatBodyId = "mars";
|
|
21
|
+
* console.log(body);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export type FlatBodyId = (typeof FLAT_BODIES)[number];
|
|
25
|
+
/**
|
|
26
|
+
* What is particular to one body on the flat map.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { flatBody, type FlatBodyInfo } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
31
|
+
*
|
|
32
|
+
* const mars: FlatBodyInfo = flatBody("mars");
|
|
33
|
+
* console.log(mars.radiusKm, mars.twilightDeg);
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export interface FlatBodyInfo {
|
|
37
|
+
id: FlatBodyId;
|
|
38
|
+
/** The mean radius in kilometres (IAU): the sphere a craft's height is measured above and the footprint is worked out on. */
|
|
39
|
+
radiusKm: number;
|
|
40
|
+
/** How far the Sun is below the horizon, in degrees, when the shading has gone to full night: 1 on the Moon (no air to spread the light), 8 on Mars (its dust lights the sky for a while after sunset). */
|
|
41
|
+
twilightDeg: number;
|
|
42
|
+
/** The colour of the night side as red, green and blue, and how dark it is at most (0 to 1): the map never goes quite black, since the night side still shows its ground. */
|
|
43
|
+
night: readonly [number, number, number, number];
|
|
44
|
+
/** The colour the map shows while its picture is on its way, or when it cannot be loaded. */
|
|
45
|
+
ground: string;
|
|
46
|
+
/** The longitudes the "centre the map on" buttons go to, with the word each is called by (`FLAT_WORDS` keys). */
|
|
47
|
+
centres: readonly {
|
|
48
|
+
lon: number;
|
|
49
|
+
say: "nearSide" | "farSide" | "primeMeridian";
|
|
50
|
+
}[];
|
|
51
|
+
/** The orbiters that go round it, in the package's order. */
|
|
52
|
+
orbiters: readonly OrbiterId[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Whether a text is a body the flat map draws.
|
|
56
|
+
*
|
|
57
|
+
* @param value - Any text, in any case.
|
|
58
|
+
* @returns True for `moon` and `mars`.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* import { isFlatBody } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
63
|
+
*
|
|
64
|
+
* console.log(isFlatBody("Mars"), isFlatBody("venus"));
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare const isFlatBody: (value: string | null | undefined) => value is FlatBodyId;
|
|
68
|
+
/**
|
|
69
|
+
* What is particular to a body on the flat map.
|
|
70
|
+
*
|
|
71
|
+
* @param id - `moon` or `mars`.
|
|
72
|
+
* @returns Its numbers.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* import { flatBody } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
77
|
+
*
|
|
78
|
+
* console.log(flatBody("moon").orbiters.join(", "));
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export declare function flatBody(id: string): FlatBodyInfo;
|
|
82
|
+
/**
|
|
83
|
+
* The colour each orbiter is drawn in: colours kept for a dark map, one for each orbiter in the package's order, so an orbiter is the same colour in a list and on the map.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* import { ORBITER_COLOURS } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
88
|
+
*
|
|
89
|
+
* console.log(ORBITER_COLOURS.length, ORBITER_COLOURS[0]);
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare const ORBITER_COLOURS: readonly string[];
|
|
93
|
+
/**
|
|
94
|
+
* The colour of one orbiter on the map.
|
|
95
|
+
*
|
|
96
|
+
* @param id - The orbiter.
|
|
97
|
+
* @returns A CSS colour.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* import { orbiterColour } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
102
|
+
*
|
|
103
|
+
* console.log(orbiterColour("lro"), orbiterColour("mro"));
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export declare function orbiterColour(id: OrbiterId): string;
|
|
107
|
+
/**
|
|
108
|
+
* An orbiter's name, in a language: the craft's own, or its short form for a crowded map.
|
|
109
|
+
*
|
|
110
|
+
* @param id - The orbiter.
|
|
111
|
+
* @param lang - `en` or `ja`.
|
|
112
|
+
* @param short - True for the short name.
|
|
113
|
+
* @returns The name.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* import { orbiterName } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
118
|
+
*
|
|
119
|
+
* console.log(orbiterName("lro", "en"), "|", orbiterName("lro", "en", true), "|", orbiterName("hope", "ja", true));
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export declare const orbiterName: (id: OrbiterId, lang: "en" | "ja", short?: boolean) => string;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// The bodies the flat map draws and what is particular to each: its mean radius (for how far a craft sees), how soft its sunset is, the colour of its night, where its "centre the map" buttons point, and which orbiters go round it.
|
|
2
|
+
// Pure: no DOM.
|
|
3
|
+
import { ORBITER_FACTS, ORBITER_IDS, orbiterCentre } from "../orbiters.js";
|
|
4
|
+
/**
|
|
5
|
+
* The bodies the flat map draws: the Moon and Mars. They have the painted maps, the landing, rover and crash sites and the spacecraft in orbit that the package holds; the Earth's flat map is chikyu-earth's `<chikyu-flat>`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { FLAT_BODIES } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
10
|
+
*
|
|
11
|
+
* console.log(FLAT_BODIES.join(", "));
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export const FLAT_BODIES = ["moon", "mars"];
|
|
15
|
+
const orbitersOf = (body) => ORBITER_IDS.filter((id) => orbiterCentre(id) === body);
|
|
16
|
+
const INFO = {
|
|
17
|
+
moon: {
|
|
18
|
+
id: "moon",
|
|
19
|
+
radiusKm: 1737.4,
|
|
20
|
+
twilightDeg: 1,
|
|
21
|
+
night: [3, 5, 12, 0.78],
|
|
22
|
+
ground: "#4a4945",
|
|
23
|
+
centres: [
|
|
24
|
+
{ lon: 0, say: "nearSide" },
|
|
25
|
+
{ lon: 180, say: "farSide" },
|
|
26
|
+
],
|
|
27
|
+
orbiters: orbitersOf("moon"),
|
|
28
|
+
},
|
|
29
|
+
mars: {
|
|
30
|
+
id: "mars",
|
|
31
|
+
radiusKm: 3389.5,
|
|
32
|
+
twilightDeg: 8,
|
|
33
|
+
night: [6, 4, 14, 0.72],
|
|
34
|
+
ground: "#7a3f24",
|
|
35
|
+
centres: [{ lon: 0, say: "primeMeridian" }],
|
|
36
|
+
orbiters: orbitersOf("mars"),
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Whether a text is a body the flat map draws.
|
|
41
|
+
*
|
|
42
|
+
* @param value - Any text, in any case.
|
|
43
|
+
* @returns True for `moon` and `mars`.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { isFlatBody } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
48
|
+
*
|
|
49
|
+
* console.log(isFlatBody("Mars"), isFlatBody("venus"));
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export const isFlatBody = (value) => value !== null && value !== undefined && FLAT_BODIES.includes(value.trim().toLowerCase());
|
|
53
|
+
/**
|
|
54
|
+
* What is particular to a body on the flat map.
|
|
55
|
+
*
|
|
56
|
+
* @param id - `moon` or `mars`.
|
|
57
|
+
* @returns Its numbers.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* import { flatBody } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
62
|
+
*
|
|
63
|
+
* console.log(flatBody("moon").orbiters.join(", "));
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export function flatBody(id) {
|
|
67
|
+
const key = id.trim().toLowerCase();
|
|
68
|
+
if (!isFlatBody(key))
|
|
69
|
+
throw new RangeError(`the flat map draws ${FLAT_BODIES.join(" and ")}, not ${JSON.stringify(id)}`);
|
|
70
|
+
return INFO[key];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The colour each orbiter is drawn in: colours kept for a dark map, one for each orbiter in the package's order, so an orbiter is the same colour in a list and on the map.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* import { ORBITER_COLOURS } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
78
|
+
*
|
|
79
|
+
* console.log(ORBITER_COLOURS.length, ORBITER_COLOURS[0]);
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export const ORBITER_COLOURS = ["#ffd23f", "#4cc9f0", "#6ee7a0", "#ff7a59", "#a78bfa", "#ff9ecb", "#f4a261", "#b8e986", "#5eead4", "#7aa2ff", "#e879f9", "#fde68a", "#ffffff"];
|
|
83
|
+
/**
|
|
84
|
+
* The colour of one orbiter on the map.
|
|
85
|
+
*
|
|
86
|
+
* @param id - The orbiter.
|
|
87
|
+
* @returns A CSS colour.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* import { orbiterColour } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
92
|
+
*
|
|
93
|
+
* console.log(orbiterColour("lro"), orbiterColour("mro"));
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export function orbiterColour(id) {
|
|
97
|
+
const at = ORBITER_IDS.indexOf(id);
|
|
98
|
+
return ORBITER_COLOURS[(at < 0 ? 0 : at) % ORBITER_COLOURS.length];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* An orbiter's name, in a language: the craft's own, or its short form for a crowded map.
|
|
102
|
+
*
|
|
103
|
+
* @param id - The orbiter.
|
|
104
|
+
* @param lang - `en` or `ja`.
|
|
105
|
+
* @param short - True for the short name.
|
|
106
|
+
* @returns The name.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* import { orbiterName } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
111
|
+
*
|
|
112
|
+
* console.log(orbiterName("lro", "en"), "|", orbiterName("lro", "en", true), "|", orbiterName("hope", "ja", true));
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export const orbiterName = (id, lang, short = false) => (short ? ORBITER_FACTS[id].short[lang] : ORBITER_FACTS[id].name[lang]);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Registers <wakusei-flat>. Importing this entry point (`@johnmorrisdotca/wakusei-planets/flat/define`) defines the tag once. It needs no WebGL and no peer.
|
|
2
|
+
import { WakuseiFlat } from "./element.js";
|
|
3
|
+
export { WakuseiFlat };
|
|
4
|
+
if (typeof customElements !== "undefined" && !customElements.get("wakusei-flat")) {
|
|
5
|
+
customElements.define("wakusei-flat", WakuseiFlat);
|
|
6
|
+
}
|