@johnmorrisdotca/wakusei-planets 0.24.0 → 0.25.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 CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.25.0] - 2026-11-09
6
+
7
+ - **A star from its numbers** (MODULES-720). `<wakusei-body star="...">` (or the `star` property) draws any star in 3D (`realistic`) or as a line drawing, in the same look system as the planets and through the same shared renderer, from `temperatureK`, `radiusSun`, `luminosityClass`, `rotationDays`, `activity`, `oblateness`, `corona` and `estimated`: the black-body colour, edge darkening, a surface grained by class, boiling granulation, spots, prominences and flares on active stars, gravity darkening on flattened ones, a bloom and a soft corona. `starLook(numbers)`, `starLineSvg(numbers)`, `STAR_SUN` and `LUMINOSITY_CLASSES` in the main entry; `registerStarLook(name, numbers)` and `starLookOf(name)` in `/look`. Every star lists `parts`: measured, estimated, derived or illustrative, in English and Japanese. `quality="low"` is a cheaper star for weak devices (chosen by itself on 2 GB or two cores). The line look draws the Sun, the Earth's orbit and Jupiter's orbit round the star to its size. `embedCode({ star })` writes the code for every kind of page, `embed.html` takes the numbers in its address, and the demo has a star page. The package holds no star catalogue. The Sun is unchanged: `e2e/sun.demo.ts` compares its three shaded frames with pictures drawn before this change and `test/sun-line.test.ts` its line drawing.
8
+ - **Printable colouring sheets for children** (MODULES-684). `/sheets` has a sheet for the Sun, the eight planets, Pluto, the Moon, Io, Europa, Ganymede, Callisto, Titan, Triton and Charon, and a lineup of the eight planets at one scale: a picture in thick lines (outline 3 mm, inner lines 2.5 mm) drawn from the package's numbers, two to four squares of the body's real colours with names, and three facts worked out from the numbers (width and how it compares with Earth, spin, year or orbit, the face a moon shows), in English and plain Japanese. `kidsSvg` is a sheet's one SVG in millimetres (no browser), `kidsSheet` the whole printable page in kazoku-ui's print layout (the `kid` type, the brand "Space Program X", a Name box, credits, version and a QR code back to the demo) on A4, US Letter, A3 or Tabloid, measured so the picture prints at its drawn size. The demo has a new `kids.html`: pick a sheet and a paper, see it, press Print / save PDF. The Pages build makes a PDF of every sheet on A4 and Letter in both languages (`scripts/make-pdfs.mjs`, under `pdf/`). kazoku-ui is now `^0.22.0`. EN/JA guide `docs/guides/kids-sheets.md`.
9
+ - **Data files for other languages, and a server you host** (MODULES-690). Each release attaches `wakusei-planets-data-v<version>.zip` and its files: CSV and Parquet tables of the bodies (the Sun, planets, dwarf planets and moons: radius, flattening, mass or GM, gravity, tilt, rotation, pole, colour, kind and parent), the orbital elements (the planets' mean semi-major axes for now, the dwarf planets' osculating elements, the moons' mean elements), the spacecraft and their events, each with a `<table>.schema.json` (type, unit, meaning and source of every column), `LICENCE-DATA.md` (each table keeps its sources' terms) and `SHA256SUMS` (`pnpm export:data`, `scripts/export-parquet.py`). The theory tables (VSOP87, ELP2000, TASS, L1.2) are left out until their terms are settled. `examples/serve/server.mjs` is a 40-line `node:http` server with `/body`, `/position` and `/distance`. EN/JA guides `docs/guides/data-files.md` and `docs/guides/serve-it-yourself.md`.
10
+
5
11
  ## [0.24.0] - 2026-11-08
6
12
 
7
13
  - **Every view zooms and pans by itself** (MODULES-642). `<wakusei-body>`, `<wakusei-portrait>` and `<wakusei-space>` carry the shared view controls (kazoku-ui 0.21.1, `carryControls`): a drag, a pinch, Ctrl, Command or Alt with the wheel (the plain wheel still scrolls the page at Fit), and the arrows, `+`, `-` and `0` once focused. `controls="none"` turns them off, `live="off"` starts a body without them, `zoom-min` and `zoom-max` set the range. The ranges: the body's line look 0.1x to 50x (vector, detail at any scale), its shaded looks and the portrait 0.1x to 8x (the 2048 pixel painted maps are sharp to about 1.5x and soften after that), the space view a millionth to 3x (the camera is held 1.05 radii from the surface). A `<kazoku-view-controls>` takes over and reads the range; point its `for` at the element itself. `wakusei-view` is sent when the view changes, `space.controller` is the shared controller, and `<wakusei-portrait>` has `setView`. `embed.html` zooms with the drag, pinch, wheel, keys and + and - buttons and keeps the view in its address (`zoom=2`; the view's tilt is `vtilt`), and `embedCode` takes `zoom` for the iframe way. The code builder's picture zooms too. See the new Zoom and pan guide.
package/README.md CHANGED
@@ -15,9 +15,9 @@ A clean line drawing, a shaded realistic drawing, or a painted surface map, with
15
15
 
16
16
  <p align="center"><a href="https://johnmorrisdotca.github.io/wakusei-planets/"><strong>Open the demo →</strong></a> · <a href="https://johnmorrisdotca.github.io/wakusei-planets/embed.html">Embed page</a> · <a href="https://johnmorrisdotca.github.io/wakusei-planets/docs/">Docs</a></p>
17
17
 
18
- <p align="center"><img alt="Jupiter and Saturn drawn in the realistic look, and Saturn as a line drawing" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.24.0/docs/images/hero-desk.png" width="640"></p>
18
+ <p align="center"><img alt="Jupiter and Saturn drawn in the realistic look, and Saturn as a line drawing" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.25.0/docs/images/hero-desk.png" width="640"></p>
19
19
 
20
- <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.24.0/docs/images/lineup-desk.png" width="640"></p>
20
+ <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.25.0/docs/images/lineup-desk.png" width="640"></p>
21
21
 
22
22
  ## One minute
23
23
 
@@ -111,6 +111,17 @@ Import the element once in client code, and the entry point of each body you dra
111
111
 
112
112
  Every body has its real size relative to the others (`scale-to="jupiter"`), its axial tilt and its rotation. The Sun, Mercury, Venus, Mars, Jupiter, Saturn, Uranus, Neptune and Pluto are drawn, and so are the eight other dwarf planets (Ceres, Orcus, Haumea, Quaoar, Makemake, Gonggong, Eris and Sedna; Haumea and Quaoar as the long shapes they are, and Ceres with a painted map from Dawn) and 29 moons (the Moon, Phobos and Deimos, the four Galilean moons, Saturn's seven larger moons, Uranus's five, Proteus, Triton and Nereid, Charon, Nix and Hydra, and Vanth, Hiʻiaka, Namaka and Dysnomia, the moons of the dwarf planets whose orbits are published with a date). The Earth is drawn like the rest in the realistic and painted looks (NASA's Blue Marble), and its line look is [chikyu-earth](https://github.com/johnmorrisdotca/chikyu-earth)'s own globe: `import "@johnmorrisdotca/wakusei-planets/earth"` (it needs `@johnmorrisdotca/chikyu-earth` 0.10.0 or later installed). The painted looks cover the Sun, the planets from Mercury to Earth and Pluto, Ceres, the Moon, the four Galilean moons, Saturn's Mimas, Enceladus, Tethys, Dione, Rhea, Titan and Iapetus, Triton and Charon, and Saturn's rings are Cassini's own picture of them.
113
113
 
114
+ ## A star from its numbers
115
+
116
+ `<wakusei-body star="Betelgeuse" temperature-k="3600" radius-sun="764" luminosity-class="Iab">` draws any star in 3D or as a line drawing, from a few numbers and with no catalogue: the temperature gives the colour, the radius the size beside the Sun, the luminosity class the grain of the surface, the rotation how it turns, and a flattened star such as Vega or Altair is squashed with hotter poles. Granulation boils, an active star has spots, prominences and flares, and a soft corona glows round it, all through the same shared renderer, with a cheaper `quality="low"` for weak devices. Every star says which parts are measured and which are drawn for looks: *drawn from its numbers, not a photo*. The Sun keeps its own look. See [A star from its numbers](docs/guides/star-look.md) and the [star page](https://johnmorrisdotca.github.io/wakusei-planets/star.html).
117
+
118
+ ```ts
119
+ import { starLook } from "@johnmorrisdotca/wakusei-planets";
120
+
121
+ const vega = starLook({ name: "Vega", temperatureK: 9602, radiusSun: 2.362, oblateness: 0.11, rotationDays: 0.68 });
122
+ console.log(vega.colour, vega.parts.map((part) => part.status).join(", "));
123
+ ```
124
+
114
125
  ## Two packages: this one and chikyu-earth
115
126
 
116
127
  This package is the Sun, the planets, the dwarf planets and the moons, and where they are. [chikyu-earth](https://github.com/johnmorrisdotca/chikyu-earth) is the Earth in detail: its countries, day and night, places and satellites. Each works alone; install both and the Earth's line look becomes chikyu-earth's globe with the countries. The dependency runs one way: this package may use chikyu-earth, never the reverse. [Why two packages](docs/guides/two-packages.md) has the rule, a table of what lives where and how to use them together.
@@ -182,6 +193,8 @@ The pure side has no DOM: `BODIES`, `apparent(id, time)`, `system(planet, time)`
182
193
 
183
194
  Sizes, flattening, poles and rotation are the IAU's and NASA's; Mercury to Neptune are VSOP87B, cut down, and Pluto is a table fitted to Horizons; the Moon's are the lunar solution ELP2000-82B cut down; Jupiter's four big moons are the theory L1.2 and Saturn's seven inner ones TASS1.7, and the others are fitted to JPL Horizons' positions, and every body is tested against Horizons ([accuracy](docs/guides/accuracy.md)). Nothing is fetched at run time by the line and shaded looks, which use no pictures. See [NOTICE.md](NOTICE.md).
184
195
 
196
+ The same data comes as files for other languages: every release attaches CSV and Parquet tables of the bodies, their orbital elements, the spacecraft and their events, each with a schema, the data licence and checksums, for pandas, polars, R or Rust ([data files](docs/guides/data-files.md)). [Serve it yourself](docs/guides/serve-it-yourself.md) is a small Node server that answers a body's facts, its position on a date and the distance between two bodies; we host nothing, you run it.
197
+
185
198
  ## Examples
186
199
 
187
200
  Every `ts` block in this README is type-checked and run against the package as npm packs it (`pnpm test:readme`).
@@ -277,7 +290,7 @@ A body that turns by itself and a moving sky, in HTML:
277
290
 
278
291
  ## The portrait builder
279
292
 
280
- <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.24.0/docs/images/portrait-family.png" width="640"></p>
293
+ <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.25.0/docs/images/portrait-family.png" width="640"></p>
281
294
 
282
295
  [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.
283
296
 
@@ -328,12 +341,13 @@ The reference is a site, made from the source's own doc comments: every export h
328
341
 
329
342
  | Entry point | What it gives |
330
343
  | --- | --- |
331
- | `@johnmorrisdotca/wakusei-planets` | The pure side: `BODIES`, `apparent`, `system`, `orbitPath`, `portrait`, `lineSvg`, `embedCode`. No browser. |
344
+ | `@johnmorrisdotca/wakusei-planets` | The pure side: `BODIES`, `apparent`, `system`, `orbitPath`, `portrait`, `lineSvg`, `embedCode`, `starLook`, `starLineSvg`. No browser. |
332
345
  | `.../element` | `<wakusei-body>`; three.js is loaded only for a shaded look. |
333
346
  | `.../portrait` | `<wakusei-portrait>`: many bodies in one scene. The scene model (`addBody`, `layoutPortrait`, `encodeScene`, `decodeScene`) is in the main entry. |
334
347
  | `.../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. |
335
348
  | `.../space/element` | `<wakusei-space>`: the Earth, the Moon, the Sun and the planets in their places. |
336
349
  | `.../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. |
350
+ | `.../sheets` | Printable colouring sheets for children: the Sun, the planets and the big moons in thick lines with the real colours and three facts, and all the planets at one scale, in English and Japanese (`kidsSvg`, `kidsSheet`, `kidsFacts`). |
337
351
  | `.../look` | What a body needs to be drawn with three.js. |
338
352
  | `.../painter` | The bodies as objects for a scene of your own. |
339
353
  | `.../all` | Every body's shaded look, at once. |
@@ -362,6 +376,7 @@ Each guide has a Japanese twin in [docs/guides/ja](docs/guides/ja/getting-starte
362
376
  | [Why two packages](docs/guides/two-packages.md) | This package and chikyu-earth: which to install, alone or together |
363
377
  | [Moons and time](docs/guides/moons-and-time.md) | The sky on a date, time that runs fast |
364
378
  | [The space view](docs/guides/space-view.md) | The Earth, Moon, Sun and planets in their places; two scales; time both ways |
379
+ | [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 |
365
380
  | [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 |
366
381
  | [Riding along](docs/guides/ride-along.md) | The camera on a moon, a planet or any moving point, looking at what it goes round |
367
382
  | [Accuracy](docs/guides/accuracy.md) | How far each body is from JPL Horizons |
@@ -369,7 +384,10 @@ Each guide has a Japanese twin in [docs/guides/ja](docs/guides/ja/getting-starte
369
384
  | [Time](docs/guides/time.md) | Julian dates, calendars, time scales, sidereal time, Mars time |
370
385
  | [The stars you can see without a telescope](docs/guides/stars.md) | 5,080 stars with names, positions, proper motion, distance and colour |
371
386
  | [What is nearby, and when bodies come close](docs/guides/nearest.md) | The nearest bodies to a body on a date, closest approaches and conjunctions, and how close they are to Horizons |
387
+ | [Colouring sheets for children](docs/guides/kids-sheets.md) | Printable sheets of the Sun, planets and big moons, A4 and US Letter, English and Japanese, and the ready-made PDFs |
372
388
  | [Famous spacecraft](docs/guides/spacecraft.md) | Voyager, New Horizons, Pioneer, Cassini, Galileo, Juno, Parker and Webb: where they are and their whole voyage |
389
+ | [Data files](docs/guides/data-files.md) | CSV and Parquet tables of the bodies, orbits and spacecraft, for Python, R and Rust |
390
+ | [Serve it yourself](docs/guides/serve-it-yourself.md) | A small Node server over the package, that you host |
373
391
  | [The Sun and Moon from a place](docs/guides/suncalc.md) | Position, sunrise and sunset, Moon rise, set and phase; a drop-in for suncalc |
374
392
  | [Coordinate conversions](docs/guides/coordinates.md) | Pure spherical, ecliptic, equatorial and horizontal coordinate conversions |
375
393
  | [TypeScript and Node](docs/guides/typescript-and-node.md) | Types and the pure side |
@@ -476,7 +494,7 @@ Wakusei (惑星, わくせい) is Japanese for a planet.
476
494
  ## The family
477
495
 
478
496
  <!-- family:start (made by scripts/family-readme.mjs from scripts/family-template.mjs; change those, not this) -->
479
- Wakusei Planets is one of thirty-four packages, each made for the same site, each at
497
+ Wakusei Planets is one of forty-one packages, each made for the same site, each at
480
498
  [github.com/johnmorrisdotca](https://github.com/johnmorrisdotca) or [github.com/spxis](https://github.com/spxis). The code of every one is MIT.
481
499
 
482
500
  **Games — board**
@@ -489,6 +507,7 @@ Wakusei Planets is one of thirty-four packages, each made for the same site, eac
489
507
 
490
508
  **Games — cards & tiles**
491
509
 
510
+ - [Fuda Cards](https://github.com/johnmorrisdotca/fuda-cards) (札): collectible card frames with a true thickness, foil, stacks, wear and a binder, as two web components. [Demo](https://johnmorrisdotca.github.io/fuda-cards/).
492
511
  - [Hitotsu](https://github.com/johnmorrisdotca/hitotsu) (一つ): a colour-card shedding game for two to eight, with the house rules people play. [Demo](https://johnmorrisdotca.github.io/hitotsu/).
493
512
  - [Jarajara](https://github.com/johnmorrisdotca/jarajara) (ジャラジャラ): mahjong tiles drawn as SVG, stacked layouts, and the matching solitaire Awase. [Demo](https://johnmorrisdotca.github.io/jarajara/).
494
513
  - [Kumimoji](https://github.com/johnmorrisdotca/kumimoji) (組み文字): a crossword tile race, in English and Japanese kana. [Demo](https://johnmorrisdotca.github.io/kumimoji/).
@@ -515,21 +534,30 @@ Wakusei Planets is one of thirty-four packages, each made for the same site, eac
515
534
 
516
535
  - [Bushu](https://github.com/johnmorrisdotca/bushu) (部首): find a kanji by the parts it is made of. [Demo](https://johnmorrisdotca.github.io/bushu/).
517
536
  - [Hikidashi](https://github.com/johnmorrisdotca/hikidashi) (引き出し): a drawer of small Japanese text tools: era dates, kanji numerals, readings and sentence difficulty. [Demo](https://johnmorrisdotca.github.io/hikidashi/).
537
+ - [Jisho](https://github.com/johnmorrisdotca/jisho) (辞書): words of Japanese looked up by reading or written form, and the grades, JLPT levels, readings and look-alike pairs of 2,999 kanji. [Demo](https://johnmorrisdotca.github.io/jisho/).
518
538
  - [Kotoba](https://github.com/johnmorrisdotca/kotoba) (言葉): word lists and word-game rules in English, French, German and Japanese. [Demo](https://johnmorrisdotca.github.io/kotoba/).
519
539
 
540
+ **Space Program X**
541
+
542
+ - [Chikyu Earth](https://github.com/johnmorrisdotca/chikyu-earth) (地球): a line-drawn globe that turns at the Earth's own rate, with an optional realistic Earth from space and markers for any place. [Demo](https://johnmorrisdotca.github.io/chikyu-earth/).
543
+ - [Hoshi Stars](https://github.com/johnmorrisdotca/hoshi-stars) (星): the stars you can see without a telescope, with names, colours and distances, the constellations with their lines and boundaries, and the Messier objects, drawn on any of seven sky maps. [Demo](https://johnmorrisdotca.github.io/hoshi-stars/).
544
+ - [Uchusen Rockets](https://github.com/johnmorrisdotca/uchusen-rockets) (宇宙船): rockets drawn from sourced sizes, as line drawings and 3D views you can take apart and turn, with a check that a rocket really goes together. [Demo](https://johnmorrisdotca.github.io/uchusen-rockets/).
545
+ - [Wakusei Planets](https://github.com/johnmorrisdotca/wakusei-planets) (惑星): the Sun, the planets and their moons, as line drawings, shaded drawings and painted surface maps, with their real sizes, tilt and rotation. [Demo](https://johnmorrisdotca.github.io/wakusei-planets/).
546
+
520
547
  **Geography & data**
521
548
 
522
549
  - [address-plus](https://github.com/johnmorrisdotca/address-plus) (アドレスプラス): parse and format addresses in the United States, Canada, Japan, Australia, France, Germany and the United Kingdom. [Demo](https://johnmorrisdotca.github.io/address-plus/).
523
- - [Chikyu Earth](https://github.com/johnmorrisdotca/chikyu-earth) (地球): a line-drawn globe that turns at the Earth's own rate, with an optional realistic Earth from space and markers for any place. [Demo](https://johnmorrisdotca.github.io/chikyu-earth/).
524
550
  - [Chizu](https://github.com/johnmorrisdotca/chizu) (地図): maps of the world and of countries' regions, in English and Japanese, with a quiz and callouts. [Demo](https://johnmorrisdotca.github.io/chizu/).
551
+ - [Hako Devices](https://github.com/johnmorrisdotca/hako-devices) (箱): line drawings and 3D views of computers, phones, consoles and NAS boxes, from published sizes. [Demo](https://johnmorrisdotca.github.io/hako-devices/).
525
552
  - [Hata](https://github.com/johnmorrisdotca/hata) (旗): country and regional flags as SVG, at their true proportions and keyed by ISO code. [Demo](https://johnmorrisdotca.github.io/hata/).
553
+ - [Koyomi Calendars](https://github.com/johnmorrisdotca/koyomi-calendars) (暦): calendar-page icons and whole months as SVG, in light and dark, with page-turning from one day to the next. [Demo](https://johnmorrisdotca.github.io/koyomi-calendars/).
526
554
  - [Kuni](https://github.com/johnmorrisdotca/kuni) (国): countries and their regions, with ISO codes and names in English and Japanese. [Demo](https://johnmorrisdotca.github.io/kuni/).
527
- - [Wakusei Planets](https://github.com/johnmorrisdotca/wakusei-planets) (惑星): the Sun, the planets and their moons, as line drawings, shaded drawings and painted surface maps, with their real sizes, tilt and rotation. [Demo](https://johnmorrisdotca.github.io/wakusei-planets/).
528
555
 
529
556
  **Sports**
530
557
 
531
558
  - [Dougu Sports](https://github.com/johnmorrisdotca/dougu-sports) (道具): sports emblems as SVG: trophies, medals, crests, and the ball and gear of every sport, with optional 3D turning. [Demo](https://johnmorrisdotca.github.io/dougu-sports/).
532
559
  - [Kyogijo Stadiums](https://github.com/johnmorrisdotca/kyogijo-stadiums) (競技場): sports fields, rinks, courts and ballparks drawn to scale as SVG, with each team and the score on them. [Demo](https://johnmorrisdotca.github.io/kyogijo-stadiums/).
560
+ - [Meigen Sports](https://github.com/johnmorrisdotca/meigen-sports) (名言): sports quotations and on-this-day history. [Demo](https://johnmorrisdotca.github.io/meigen-sports/).
533
561
  - [Senshu Jerseys](https://github.com/johnmorrisdotca/senshu-jerseys) (選手): sports jerseys, sweaters, kits, caps, helmets and retired-number banners as SVG, front and back, with optional 2.5D turning. [Demo](https://johnmorrisdotca.github.io/senshu-jerseys/).
534
562
  - [Taisen Brackets](https://github.com/johnmorrisdotca/taisen-brackets) (対戦): a sport-agnostic tournament bracket, drawn as SVG, from a list of ties. [Demo](https://johnmorrisdotca.github.io/taisen-brackets/).
535
563
 
@@ -538,5 +566,5 @@ Wakusei Planets is one of thirty-four packages, each made for the same site, eac
538
566
  - [REST in Pieces](https://github.com/spxis/rest-in-pieces) (レスト・イン・ピーシーズ): seeded test data and REST APIs for frontend development, with latency and error drills. [Demo](https://spxis.github.io/rest-in-pieces/).
539
567
 
540
568
 
541
- **This package is Wakusei Planets.** The demos of all thirty-four share one header and footer, so each links the rest.
569
+ **This package is Wakusei Planets.** The demos of all forty-one share one header and footer, so each links the rest.
542
570
  <!-- family:end -->
@@ -0,0 +1,2 @@
1
+ /** Red, green and blue, 0 to 255, of a black body at `kelvin` (held between 1,000 and 40,000). */
2
+ export declare function blackBodyRgb(kelvin: number): [number, number, number];
@@ -0,0 +1,10 @@
1
+ // The colour of a black body, as red, green and blue from 0 to 255 (Tanner Helland's fit of the black-body locus, good to a few percent from 1,000 to 40,000 K). Shared by the star drawings and the star catalogue.
2
+ /** Red, green and blue, 0 to 255, of a black body at `kelvin` (held between 1,000 and 40,000). */
3
+ export function blackBodyRgb(kelvin) {
4
+ const t = Math.min(40_000, Math.max(1_000, kelvin)) / 100;
5
+ const red = t <= 66 ? 255 : 329.698727446 * (t - 60) ** -0.1332047592;
6
+ const green = t <= 66 ? 99.4708025861 * Math.log(t) - 161.1195681661 : 288.1221695283 * (t - 60) ** -0.0755148492;
7
+ const blue = t >= 66 ? 255 : t <= 19 ? 0 : 138.5177312231 * Math.log(t - 10) - 305.0447927307;
8
+ const clamp = (v) => Math.min(255, Math.max(0, v));
9
+ return [clamp(red), clamp(green), clamp(blue)];
10
+ }
package/dist/element.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { SharedRenderer } from "@johnmorrisdotca/kazoku-ui/renderer";
2
2
  import "./tables/ceres.ts";
3
3
  import "./tables/dwarfs.ts";
4
4
  import { type BodyId, type Look } from "./facts.ts";
5
+ import { type StarLook, type StarNumbers } from "./star.ts";
5
6
  export { TEXTURE_BASE, TEXTURE_FAR_BASE } from "./scene/textures.ts";
6
7
  import { type ThreeParts } from "./scene/body.ts";
7
8
  import { setThreeLoader } from "./scene/shared.ts";
@@ -46,6 +47,13 @@ export declare class WakuseiBody extends HTMLElement {
46
47
  /** The radius of the body's disc on the screen in CSS pixels, at the picture's own size: what `grab-radius` on the shared view controls wants for a drag that keeps the touched point under the pointer. */
47
48
  get discRadius(): number;
48
49
  get body(): BodyId;
50
+ /**
51
+ * The star drawn instead of a body, when the `star` attribute is there: its numbers with the defaults filled in, its colour, the turn it shows, and `parts`, which says what is measured and what is invented.
52
+ * `undefined` for a body, or while the star's numbers are not complete (`data-error` says what is wrong). Set it to an object of numbers to draw a star, or to `null` to go back to the body.
53
+ */
54
+ get starLook(): StarLook | undefined;
55
+ set star(numbers: StarNumbers | string | null | undefined);
56
+ get star(): StarNumbers | undefined;
49
57
  get look(): Look;
50
58
  /** What the element is doing now. */
51
59
  get state(): WakuseiState;
package/dist/element.js CHANGED
@@ -6,6 +6,9 @@ import { orbitPath, nearMoons } from "./ephemeris.js";
6
6
  import { BODIES, ringReach } from "./facts.js";
7
7
  import { createGate, frameCap } from "./gate.js";
8
8
  import { lineSvg } from "./line.js";
9
+ import { starLook } from "./star.js";
10
+ import { starLineSvg } from "./star-line.js";
11
+ import { starLookOf } from "./scene/look.js";
9
12
  import { createLive, defaultTurn, REDUCED_TURN } from "./live.js";
10
13
  import { texturePaths } from "./scene/textures.js";
11
14
  export { TEXTURE_BASE, TEXTURE_FAR_BASE } from "./scene/textures.js";
@@ -20,6 +23,13 @@ const num = (value, fallback) => {
20
23
  const n = Number(value);
21
24
  return Number.isFinite(n) ? n : fallback;
22
25
  };
26
+ /** A device that should get the cheaper star: little memory or two cores or fewer. `quality="full"` or `quality="low"` on the element decides it instead. */
27
+ const weakDevice = () => {
28
+ const nav = typeof navigator === "undefined" ? undefined : navigator;
29
+ return nav !== undefined && ((nav.deviceMemory ?? 8) <= 2 || (nav.hardwareConcurrency ?? 8) <= 2);
30
+ };
31
+ /** The attributes that carry a star's numbers beside `star`, and the number each is. */
32
+ const STAR_ATTRS = ["temperature-k", "radius-sun", "luminosity-class", "rotation-days", "activity", "oblateness", "corona", "estimated"];
23
33
  const readLook = (value) => (value === "realistic" || value === "painted" || value === "illustrated" ? value : "line");
24
34
  const readTime = (value) => {
25
35
  if (value === null || value === "")
@@ -37,10 +47,9 @@ function turnPose(pose, axis, degrees) {
37
47
  }
38
48
  /** The half-width of a body's picture, in its radii, when it has no scale of its own: the globe takes a little under half the height, so its rings, glow and haze have room round it. */
39
49
  const ROOM = 2.2;
40
- function extentOf(id, options) {
41
- const f = BODIES[id];
42
- if (options.moons === true && id in BODIES && f.parent === undefined && id !== "sun") {
43
- const near = nearMoons(id);
50
+ function extentOf(f, options) {
51
+ if (options.moons === true && f.parent === undefined && f.id !== "sun") {
52
+ const near = nearMoons(f.id);
44
53
  const far = Math.max(1.8, ringReach(f) * 1.15, ...near.map((m) => m.reach * 1.1));
45
54
  return options.range ?? far;
46
55
  }
@@ -95,7 +104,7 @@ const TEMPLATE = `<style>
95
104
  * ```
96
105
  */
97
106
  export class WakuseiBody extends HTMLElement {
98
- static observedAttributes = ["body", "look", "size", "time", "tilt", "pitch", "phase", "meridian", "turn", "rate", "moons", "range", "scale-to", "span-km", "fit", "live", "texture-base", "texture-far-base", "lang", "labels"];
107
+ static observedAttributes = ["body", "star", "quality", ...STAR_ATTRS, "look", "size", "time", "tilt", "pitch", "phase", "meridian", "turn", "rate", "moons", "range", "scale-to", "span-km", "fit", "live", "texture-base", "texture-far-base", "lang", "labels"];
99
108
  #stage;
100
109
  #state = "line";
101
110
  #renderer;
@@ -151,9 +160,27 @@ export class WakuseiBody extends HTMLElement {
151
160
  return (this.getBoundingClientRect().width / 2) * this.#fill();
152
161
  }
153
162
  get body() {
163
+ if (this.hasAttribute("star"))
164
+ return "sun";
154
165
  const id = this.getAttribute("body");
155
166
  return id !== null && id in BODIES ? id : "earth";
156
167
  }
168
+ /**
169
+ * The star drawn instead of a body, when the `star` attribute is there: its numbers with the defaults filled in, its colour, the turn it shows, and `parts`, which says what is measured and what is invented.
170
+ * `undefined` for a body, or while the star's numbers are not complete (`data-error` says what is wrong). Set it to an object of numbers to draw a star, or to `null` to go back to the body.
171
+ */
172
+ get starLook() {
173
+ return this.#star();
174
+ }
175
+ set star(numbers) {
176
+ if (numbers === null || numbers === undefined)
177
+ this.removeAttribute("star");
178
+ else
179
+ this.setAttribute("star", typeof numbers === "string" ? numbers : JSON.stringify(numbers));
180
+ }
181
+ get star() {
182
+ return this.#star()?.numbers;
183
+ }
157
184
  get look() {
158
185
  return readLook(this.getAttribute("look"));
159
186
  }
@@ -292,6 +319,51 @@ export class WakuseiBody extends HTMLElement {
292
319
  controller.grabRadius = disc;
293
320
  controller.objectSize = { width: disc * 2, height: disc * 2 };
294
321
  };
322
+ // --- the star ---------------------------------------------------------------------------------------------------------------------------------------
323
+ #starKey = "";
324
+ #starMade;
325
+ /** The star the attributes describe: `star` is a JSON object of numbers, the name of a star registered with `registerStarLook`, or empty with the numbers in the other attributes, which are laid over it. */
326
+ #star() {
327
+ if (!this.hasAttribute("star"))
328
+ return undefined;
329
+ const quality = this.getAttribute("quality") === "low" || (this.getAttribute("quality") !== "full" && weakDevice()) ? "low" : "full";
330
+ const key = JSON.stringify([quality, this.getAttribute("star"), ...STAR_ATTRS.map((name) => this.getAttribute(name)), starLookOf(this.getAttribute("star") ?? "")?.key]);
331
+ if (key === this.#starKey)
332
+ return this.#starMade;
333
+ this.#starKey = key;
334
+ this.#starMade = undefined;
335
+ this.removeAttribute("data-error");
336
+ try {
337
+ const value = (this.getAttribute("star") ?? "").trim();
338
+ let base = {};
339
+ if (value.startsWith("{"))
340
+ base = JSON.parse(value);
341
+ else if (value !== "")
342
+ base = starLookOf(value)?.numbers ?? { name: value };
343
+ const pick = (name) => this.getAttribute(name);
344
+ const number = (name) => (pick(name) === null ? undefined : Number(pick(name)));
345
+ const numbers = {
346
+ ...base,
347
+ ...(pick("temperature-k") !== null ? { temperatureK: number("temperature-k") } : {}),
348
+ ...(pick("radius-sun") !== null ? { radiusSun: number("radius-sun") } : {}),
349
+ ...(pick("luminosity-class") !== null ? { luminosityClass: pick("luminosity-class") } : {}),
350
+ ...(pick("rotation-days") !== null ? { rotationDays: number("rotation-days") } : {}),
351
+ ...(pick("activity") !== null ? { activity: number("activity") } : {}),
352
+ ...(pick("oblateness") !== null ? { oblateness: number("oblateness") } : {}),
353
+ ...(pick("corona") !== null ? { corona: number("corona") } : {}),
354
+ ...(pick("estimated") !== null ? { estimated: pick("estimated").split(",").map((part) => part.trim()).filter((part) => part !== "") } : {}),
355
+ };
356
+ this.#starMade = starLook(numbers, { quality });
357
+ }
358
+ catch (error) {
359
+ this.setAttribute("data-error", `star: ${error instanceof Error ? error.message : String(error)}`);
360
+ }
361
+ return this.#starMade;
362
+ }
363
+ /** The facts of what is drawn: the body's, or the star's (the Sun's with its own size, shape and outlines). */
364
+ #facts() {
365
+ return this.#star()?.facts ?? BODIES[this.body];
366
+ }
295
367
  // --- the clock ------------------------------------------------------------------------------------------------------------------------------------
296
368
  #clockFromAttributes() {
297
369
  const t = readTime(this.getAttribute("time"));
@@ -299,10 +371,11 @@ export class WakuseiBody extends HTMLElement {
299
371
  this.#start = t === "now" ? Date.now() : t;
300
372
  }
301
373
  #request() {
302
- const moons = this.hasAttribute("moons");
374
+ const star = this.#star();
375
+ const moons = this.hasAttribute("moons") && !this.hasAttribute("star");
303
376
  return {
304
377
  id: this.body,
305
- start: this.#start ?? (moons ? Date.now() : undefined),
378
+ start: this.hasAttribute("star") ? undefined : (this.#start ?? (moons ? Date.now() : undefined)),
306
379
  startedAt: this.#startedAt,
307
380
  rate: Math.max(-1e7, Math.min(1e7, num(this.getAttribute("rate"), 1))),
308
381
  moons,
@@ -312,13 +385,13 @@ export class WakuseiBody extends HTMLElement {
312
385
  phase: this.hasAttribute("phase") ? num(this.getAttribute("phase"), 0) : undefined,
313
386
  spin: this.hasAttribute("meridian") ? num(this.getAttribute("meridian"), 0) : undefined,
314
387
  },
315
- turn: (this.hasAttribute("turn") ? num(this.getAttribute("turn"), 0) : this.getAttribute("live") === "off" ? 0 : defaultTurn(this.body)) * (this.#reduce ? REDUCED_TURN : 1),
388
+ turn: (this.hasAttribute("turn") ? num(this.getAttribute("turn"), 0) : this.getAttribute("live") === "off" ? 0 : star !== undefined ? star.turn.degreesPerSecond : defaultTurn(this.body)) * (this.#reduce ? REDUCED_TURN : 1),
316
389
  };
317
390
  }
318
391
  /** The picture moves on its own: a turn, or time running faster than the clock. */
319
392
  get #moving() {
320
393
  const r = this.#request();
321
- const turning = r.turn !== 0 || ((this.#start !== undefined || r.moons) && r.rate !== 1);
394
+ const turning = r.turn !== 0 || (r.start !== undefined && r.rate !== 1);
322
395
  return this.#reduce ? r.turn !== 0 : turning;
323
396
  }
324
397
  // --- the state of the scene --------------------------------------------------------------------------------------------------------------------
@@ -336,7 +409,7 @@ export class WakuseiBody extends HTMLElement {
336
409
  const scaleTo = this.getAttribute("scale-to");
337
410
  const range = this.hasAttribute("range") ? num(this.getAttribute("range"), 0) : undefined;
338
411
  const span = num(this.getAttribute("span-km"), 0);
339
- const extent = extentOf(this.body, {
412
+ const extent = extentOf(this.#facts(), {
340
413
  tight: this.getAttribute("fit") === "tight",
341
414
  spanKm: span > 0 ? span : undefined,
342
415
  scaleTo: scaleTo !== null && scaleTo in BODIES ? scaleTo : undefined,
@@ -427,6 +500,12 @@ export class WakuseiBody extends HTMLElement {
427
500
  this.setAttribute("aria-label", this.#label());
428
501
  if (this.hasAttribute("size"))
429
502
  this.style.setProperty("--wakusei-size", `${num(this.getAttribute("size"), 320)}px`);
503
+ if (this.hasAttribute("star") && this.#star() === undefined) {
504
+ this.#disposeView(true);
505
+ this.#stage.innerHTML = "";
506
+ this.#set("line");
507
+ return;
508
+ }
430
509
  const delegate = this.look === "line" ? delegates.get(this.body) : undefined;
431
510
  if (delegate !== undefined && (await this.#delegated(delegate)))
432
511
  return;
@@ -444,7 +523,7 @@ export class WakuseiBody extends HTMLElement {
444
523
  this.#set("line");
445
524
  return;
446
525
  }
447
- const sig = `${this.body}|${this.look}`;
526
+ const sig = `${this.#star()?.key ?? this.body}|${this.look}`;
448
527
  if (this.#view !== undefined && this.#viewSig !== sig) {
449
528
  if (this.#view.live)
450
529
  this.#wantLive = true;
@@ -480,8 +559,11 @@ export class WakuseiBody extends HTMLElement {
480
559
  }
481
560
  }
482
561
  #label() {
483
- const f = BODIES[this.body];
562
+ const star = this.#star();
484
563
  const ja = this.getAttribute("lang") === "ja";
564
+ if (star !== undefined)
565
+ return this.look === "line" ? (ja ? `${star.facts.name.ja}の線画。${star.disclaimer.ja}` : `${star.facts.name.en}, line drawing. ${star.disclaimer.en}`) : ja ? `${star.facts.name.ja}の陰影つきの絵。${star.disclaimer.ja}` : `${star.facts.name.en}, shaded star. ${star.disclaimer.en}`;
566
+ const f = BODIES[this.body];
485
567
  const looks = { line: ja ? "線画" : "line drawing", realistic: ja ? "表面の地図" : "painted surface", painted: ja ? "表面の地図" : "painted surface", illustrated: ja ? "イラスト" : "illustrated drawing" };
486
568
  return ja ? `${f.name.ja}の${looks[this.look]}` : `${f.name.en}, ${looks[this.look]}`;
487
569
  }
@@ -493,7 +575,9 @@ export class WakuseiBody extends HTMLElement {
493
575
  const paper = getComputedStyle(this).getPropertyValue("--wakusei-paper").trim();
494
576
  const scene = this.#sceneOf(frame);
495
577
  const size = 480;
496
- const html = lineSvg(this.body, {
578
+ const star = this.#star();
579
+ const draw = star === undefined ? (options) => lineSvg(this.body, options) : (options) => starLineSvg(star, options);
580
+ const html = draw({
497
581
  size,
498
582
  pose: scene.pose,
499
583
  ...(r.moons ? { moons: true, ...(frame.time !== undefined ? { time: frame.time } : {}), range: scene.extent, moonsAt: (scene.moons ?? []).map((m) => ({ id: m.id, x: m.x, y: m.y, z: m.z, distance: Math.hypot(m.x, m.y, m.z) })), orbits: new Map((scene.moons ?? []).filter((m) => m.orbit !== undefined).map((m) => [m.id, m.orbit])) } : {}),
@@ -508,7 +592,7 @@ export class WakuseiBody extends HTMLElement {
508
592
  }
509
593
  #key(state) {
510
594
  const moons = (state.moons ?? []).map((m) => `${m.id}:${m.x.toFixed(1)},${m.y.toFixed(1)}`).join(";");
511
- return `${this.body}|${this.look}|${vectorKey(state.pose.pole)}|${vectorKey(state.pose.meridian)}|${vectorKey(state.pose.light)}|${state.extent.toFixed(2)}|${state.zoom.toFixed(2)}|${state.panX.toFixed(2)},${state.panY.toFixed(2)}|${moons}`;
595
+ return `${this.#star()?.key ?? this.body}|${this.look}|${vectorKey(state.pose.pole)}|${vectorKey(state.pose.meridian)}|${vectorKey(state.pose.light)}|${state.extent.toFixed(2)}|${state.zoom.toFixed(2)}|${state.panX.toFixed(2)},${state.panY.toFixed(2)}|${moons}`;
512
596
  }
513
597
  // Replacing a view keeps the renderer lease; leaving 3D gives it back.
514
598
  #disposeView(releaseRenderer = false) {
@@ -536,11 +620,13 @@ export class WakuseiBody extends HTMLElement {
536
620
  const state = this.#sceneOf(frame);
537
621
  this.#sceneState = state;
538
622
  this.#viewKey = this.#key(state);
539
- this.#viewSig = `${this.body}|${this.look}`;
623
+ this.#viewSig = `${this.#star()?.key ?? this.body}|${this.look}`;
540
624
  this.#stilled = false;
541
625
  this.#stage.innerHTML = "";
626
+ const star = this.#star();
542
627
  const item = createBodyItem({
543
628
  id: this.body,
629
+ ...(star === undefined ? {} : { shaded: star.look, facts: star.facts, assetKey: `star:${star.key}` }),
544
630
  look: this.look === "illustrated" ? "realistic" : "painted",
545
631
  key: this.#viewKey,
546
632
  state: () => this.#sceneState ?? state,
@@ -588,7 +674,7 @@ export class WakuseiBody extends HTMLElement {
588
674
  const scaleTo = this.getAttribute("scale-to");
589
675
  const span = num(this.getAttribute("span-km"), 0);
590
676
  const half = span > 0 ? span : scaleTo !== null && scaleTo in BODIES ? BODIES[scaleTo].radiusKm * 1.06 : 0;
591
- return half > 0 ? Math.max(0.01, Math.min(1, BODIES[this.body].radiusKm / half)) : this.getAttribute("fit") === "tight" ? 1 : 1 / ROOM;
677
+ return half > 0 ? Math.max(this.hasAttribute("star") ? 0.001 : 0.01, Math.min(1, this.#facts().radiusKm / half)) : this.getAttribute("fit") === "tight" ? 1 : 1 / ROOM;
592
678
  }
593
679
  /** Make the view's still, once, when it is in sight. */
594
680
  #still() {
package/dist/embed.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { type BodyId, type Look } from "./facts.ts";
2
+ import type { StarNumbers } from "./star.ts";
2
3
  /**
3
4
  * The ways `embedCode` writes a body into a page.
4
5
  *
@@ -35,6 +36,8 @@ export type EmbedKind = (typeof EMBED_KINDS)[number];
35
36
  */
36
37
  export interface EmbedOptions {
37
38
  body: BodyId;
39
+ /** A star drawn from numbers instead of the body (`body` is then ignored: give `sun`, the one star among the bodies): the `star` attribute and the numbers' attributes (`temperature-k`, `radius-sun` and the rest) are written, and no entry point besides the element is loaded. `time` and `moons` do not apply to it. */
40
+ star?: StarNumbers;
38
41
  look?: Look;
39
42
  /** The date and time as an ISO string, or `now`: the body as the Earth sees it then. Left out, a portrait. */
40
43
  time?: string;
package/dist/embed.js CHANGED
@@ -25,14 +25,33 @@ export function entryOf(id) {
25
25
  return DWARF_IDS.includes(id) ? "dwarfs" : id;
26
26
  return DWARF_IDS.includes(parent) ? "moons-dwarf" : `moons-${parent}`;
27
27
  }
28
+ /** A star's numbers as the attributes that carry them, in the order they are written: the same names are the iframe's address keys. */
29
+ function starAttributes(star) {
30
+ const out = [["temperature-k", String(star.temperatureK)], ["radius-sun", String(star.radiusSun)]];
31
+ if (star.luminosityClass !== undefined)
32
+ out.push(["luminosity-class", star.luminosityClass]);
33
+ if (star.rotationDays !== undefined)
34
+ out.push(["rotation-days", String(star.rotationDays)]);
35
+ if (star.activity !== undefined)
36
+ out.push(["activity", String(star.activity)]);
37
+ if (star.oblateness !== undefined)
38
+ out.push(["oblateness", String(star.oblateness)]);
39
+ if (star.corona !== undefined)
40
+ out.push(["corona", String(star.corona)]);
41
+ if (star.estimated !== undefined && star.estimated.length > 0)
42
+ out.push(["estimated", star.estimated.join(",")]);
43
+ return out;
44
+ }
28
45
  /** The attributes of the element for these choices, in the order they are written. */
29
46
  function attributesOf(o) {
30
- const out = [["body", o.body], ["look", o.look ?? "realistic"]];
47
+ const out = o.star !== undefined ? [["star", o.star.name ?? ""], ["look", o.look ?? "realistic"]] : [["body", o.body], ["look", o.look ?? "realistic"]];
31
48
  if (o.size !== undefined && o.size !== 320)
32
49
  out.push(["size", String(o.size)]);
33
- if (o.time !== undefined)
50
+ if (o.star !== undefined)
51
+ out.push(...starAttributes(o.star));
52
+ if (o.time !== undefined && o.star === undefined)
34
53
  out.push(["time", o.time]);
35
- if (o.moons === true && o.time !== undefined)
54
+ if (o.moons === true && o.time !== undefined && o.star === undefined)
36
55
  out.push(["moons", ""]);
37
56
  if (o.turn !== undefined && o.turn > 0)
38
57
  out.push(["turn", String(o.turn)]);
@@ -61,10 +80,11 @@ export function embedCode(options, kind = "html", settings = {}) {
61
80
  const cdn = settings.cdn ?? CDN;
62
81
  const site = settings.site ?? SITE;
63
82
  const size = options.size ?? 320;
64
- const query = new URLSearchParams({ body: options.body, look: options.look ?? "realistic" });
65
- if (options.time !== undefined)
83
+ const body = options.body;
84
+ const query = new URLSearchParams(options.star !== undefined ? { ...(options.star.name !== undefined ? { star: options.star.name } : { star: "" }), look: options.look ?? "realistic", ...Object.fromEntries(starAttributes(options.star)) } : { body, look: options.look ?? "realistic" });
85
+ if (options.time !== undefined && options.star === undefined)
66
86
  query.set("time", options.time);
67
- if (options.moons === true && options.time !== undefined)
87
+ if (options.moons === true && options.time !== undefined && options.star === undefined)
68
88
  query.set("moons", "1");
69
89
  if (options.turn !== undefined && options.turn > 0)
70
90
  query.set("turn", String(options.turn));
@@ -73,10 +93,10 @@ export function embedCode(options, kind = "html", settings = {}) {
73
93
  return snippet(kind, {
74
94
  tag: "wakusei-body",
75
95
  element: "element",
76
- entries: needsShading(options) ? [entryOf(options.body)] : [],
96
+ entries: needsShading(options) && options.star === undefined ? [entryOf(body)] : [],
77
97
  attrs: attributesOf(options),
78
98
  name: "planet",
79
- iframe: { src: `${site}embed.html?${query.toString()}`, title: BODIES[options.body].name.en, width: size, height: size },
99
+ iframe: { src: `${site}embed.html?${query.toString()}`, title: options.star !== undefined ? (options.star.name ?? "Star") : BODIES[body].name.en, width: size, height: size },
80
100
  }, cdn);
81
101
  }
82
102
  /**
@@ -121,6 +141,8 @@ export function portraitCode(options, kind = "html", settings = {}) {
121
141
  * ```
122
142
  */
123
143
  export function embedCredit(options) {
144
+ if (options.star !== undefined)
145
+ return "Wakusei Planets by John Morris (MIT). A star drawn from its numbers, not a photo: the colour from its temperature, the size from its radius; the surface cells, spots and glow are illustrative.";
124
146
  const base = "Wakusei Planets by John Morris (MIT). Sizes, tilt and rotation: IAU and NASA fact sheets.";
125
147
  const photos = options.look !== "line" && options.look !== "illustrated";
126
148
  const painted = photos ? " Surface pictures: NASA, USGS and JPL imagery in the public domain (details in the package's NOTICE.md)." : "";
package/dist/index.d.ts CHANGED
@@ -6,3 +6,5 @@ export { lineSvg, mix, type LineOptions } from "./line.ts";
6
6
  export { ringStrip, type RingStrip } from "./scene/rings.ts";
7
7
  export { embedCode, embedCredit, EMBED_KINDS, portraitCode, type EmbedKind, type EmbedOptions, type EmbedSettings, type PortraitEmbed } from "./embed.ts";
8
8
  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";
9
+ export { LUMINOSITY_CLASSES, STAR_SUN, starLook, type LuminosityClass, type StarLook, type StarNumberName, type StarNumbers, type StarPart, type StarStatus } from "./star.ts";
10
+ export { starLineSvg } from "./star-line.ts";
package/dist/index.js CHANGED
@@ -6,3 +6,5 @@ export { lineSvg, mix } from "./line.js";
6
6
  export { ringStrip } from "./scene/rings.js";
7
7
  export { embedCode, embedCredit, EMBED_KINDS, portraitCode } from "./embed.js";
8
8
  export { addBody, decodeScene, defaultPortrait, encodeScene, PRESETS as PORTRAIT_PRESETS, resolve as layoutPortrait } from "./portrait/model.js";
9
+ export { LUMINOSITY_CLASSES, STAR_SUN, starLook } from "./star.js";
10
+ export { starLineSvg } from "./star-line.js";