@johnmorrisdotca/chikyu-earth 0.48.0 → 0.50.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
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.50.0 - 2026-11-13
4
+
5
+ - **The catalogue search folds kana** (MODULES-1268). `findInCatalogue` folds hiragana to katakana and small kana to full-size on both sides of the comparison (and half-width katakana by NFKC), so `はっぶる` finds `ハッブル`, in satellite names and group labels; the long-vowel mark is left alone. `foldKana(text)` is the same fold, exported from `@johnmorrisdotca/chikyu-earth/satellites` for a page's own search box.
6
+ - **A painter's model no longer adds a program to every lit material** (MODULES-1293). The scene now owns one Sun light, always there, and a satellite model made by `setSatellitePainter` is lit by it: a light the model carries (directional, point, spot, hemisphere, area) is switched off when the model is added, and its colour and strength are worn by the scene's Sun while the model is shown (an ambient light is left). Before, a model with its own light changed the number of lights in the scene the first time a ride showed it, and three kept a second program of the same code for each lit material (the clouds, the plain bodies) until it was let go: one more program at the end of a long run than at the start. The ride-along guide says a painter must not add lights and what to do to keep its look. The soak's warm-up now rides the ISS outside until its model is drawn, runs a clock past the satellites' speed limit and shows the package's own drawing once.
7
+ - **A short cross-fade when `light` changes to or from `lit`.** The Earth's night lights, and in the realistic view the direction of its light, move between the two looks over 300 ms instead of cutting, in the frames of one loop that ends by itself (nothing is drawn at rest). A reader who asked for reduced motion gets the cut. `stats.lightFade` is `{ mix, fading }`.
8
+ - **`path-priority` says whether a dot or a path is heard first** (MODULES-1332). Where a satellite's dot and a path lie under the pointer, `dots` (the default, as before) is the dot's, which at the Low level, with thousands of dots crowding a line, can leave a path unheard. `path-priority="paths"` (the property `pathPriority`) hears a path of the page's before a dot, except a dot of a satellite whose path is listed or that is chosen or ridden, which still wins. Press and hover follow the same order, and one press still has one meaning. On both elements.
9
+
10
+ ## 0.49.0 - 2026-11-13
11
+
12
+ - **Satellites far from today, as an estimate** (MODULES-1296). `estimate-far` (the property `estimateFar`, or `createSatellites(sets, { estimateFar: true })`; off by default) keeps placing a satellite beyond 30 days from its elements: the same elements carried forward or back by the same SGP4 code, drawn lighter than a dimmed one, with `estimated: true` and `estimatedDays` (how far the moment is from the elements', in days) in `placeSatellite`, `satelliteInfo` and the details of `chikyu-satellite-click` and `chikyu-satellite-visibility`, and `stats.satellites.estimated`. The docs say what an estimate is (where it would be had its orbit not changed) and where it is worst (low orbits, months away). Never before an element set's `LAUNCH_DATE` (else the year of its `OBJECT_ID`) or after its `DECAY_DATE`, both new optional fields that `parseElements` keeps; a satellite SGP4 cannot carry that far, or brings below about 120 km, is left out and not counted as placed.
13
+
3
14
  ## 0.48.0 - 2026-11-13
4
15
 
5
16
  - **Paths of a page's own, a quiet chosen orbit, and a hit test for a path line** (MODULES-1289). `selected-path="off"` (the property `selectedPath`) stops the package drawing the chosen satellite's own orbit; ring, name and ride stay. `setPaths(list)` (the property `paths`) draws up to 16 orbits at once, each `{ id, style }` (`id` a NORAD number or `group:index`, the last 16 kept), and `setPathStyles(table)` (the property `pathStyles`) changes the named looks `selected`, `hovered`, `favourite` and `path`, each a colour, a width of 0.5 to 8 px, an opacity and a dash: they differ by width and dash as well as colour. All the paths and the chosen orbit are one draw call, with a real width and dashes, and nothing is drawn at rest. `path-hit` (the property `pathHit`, 8 px, 0 to 40, off at 0; a touch has twice the reach, at least 16) makes `chikyu-path-hover` (a mouse) and `chikyu-path-click` (a press or a tap) say which path is under the pointer, `{ id, ref, style, x, y, distancePx, pointer }` with the same `ref` as `chikyu-satellite-click`; `pathAt(x, y, radiusPx?)` asks the same for any point. One press means one thing: a dot, then a path, then the sky. In a ride, the ridden satellite's own orbit is drawn in the `selected` look, and the hit test is off there unless `path-hit` is set. `stats.paths`. On both `<chikyu-space>` and `<chikyu-earth-realistic>`. The chosen satellite's orbit is now 2 px wide (the `selected` look; it was 1 px).
package/README.md CHANGED
@@ -612,7 +612,7 @@ console.log(countryList().filter((country) => country.alpha2 === null).map((coun
612
612
 
613
613
  ## How to cite
614
614
 
615
- > Morris, J. (2026). *Chikyu Earth* (version 0.48.0) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
615
+ > Morris, J. (2026). *Chikyu Earth* (version 0.50.0) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
616
616
 
617
617
  GitHub's "Cite this repository" button reads [CITATION.cff](CITATION.cff) and gives BibTeX and APA. Cite the version you used (`npm ls @johnmorrisdotca/chikyu-earth`), and credit the sources behind the numbers and pictures: [NOTICE.md](NOTICE.md) says who made each one and under what terms.
618
618
 
@@ -3,6 +3,7 @@ import type { AssetCache, Item3D } from "@johnmorrisdotca/kazoku-ui/renderer";
3
3
  import type { GeoPoint, GlobeView } from "../types.ts";
4
4
  import type { SatelliteRef } from "../satellites/types.ts";
5
5
  import { lookAt } from "../view.ts";
6
+ import { type LightFade } from "./light-fade.ts";
6
7
  import type { PathHit } from "../space/paths.ts";
7
8
  import { type SatelliteScreen, type SatelliteState } from "../space/satellite-layer.ts";
8
9
  import type { Layer } from "./tiers.ts";
@@ -65,6 +66,8 @@ export interface EarthModel {
65
66
  lights: boolean;
66
67
  /** How the Earth is lit (see `LightMode`). */
67
68
  light: LightMode;
69
+ /** The cross-fade between the true light and `lit`, stepped at each draw (src/realistic/light-fade.ts). */
70
+ lightFade: LightFade;
68
71
  /** How the camera is held (see `CameraMode`). */
69
72
  camera: CameraMode;
70
73
  /** How many times its real thickness the air is drawn, 1 to 5 (`AIR_THICKNESS_DEFAULT` until the element says otherwise); read at every draw. */
@@ -1,6 +1,8 @@
1
1
  import { HOME_VIEW, lookAt } from "../view.js";
2
2
  import { AIR_QUALITY, AIR_THICKNESS_DEFAULT, AIR_VERT, airFrag, airTop } from "./air.js";
3
3
  import { CLOUD_FRAG, SURFACE_FRAG, SURFACE_VERT } from "./shaders.js";
4
+ import { newLightFade, stepLightFade } from "./light-fade.js";
5
+ import { prefersLessMotion } from "../meteors/note.js";
4
6
  import { greenwichSidereal, subsolarPoint, unitVector } from "./sun.js";
5
7
  import { createSatelliteLayer, newSatelliteState } from "../space/satellite-layer.js";
6
8
  import { createTextureSet } from "./textures.js";
@@ -35,6 +37,7 @@ export const newModel = () => ({
35
37
  clouds: true,
36
38
  lights: true,
37
39
  light: "sun",
40
+ lightFade: newLightFade(),
38
41
  camera: "space",
39
42
  airThickness: AIR_THICKNESS_DEFAULT,
40
43
  cloudDrift: 0,
@@ -220,13 +223,26 @@ export function createEarthItem(model, deps) {
220
223
  const [sx, sy, sz] = unitVector(subsolarPoint(model.time));
221
224
  sunLocal.value.set(sx, sy, sz);
222
225
  sunDir.value.set(sx, sy, sz).applyEuler(turned.rotation);
223
- if (model.light === "lit")
224
- sunDir.value.set(0, 0, 1);
226
+ const fade = stepLightFade(model.lightFade, model.light === "lit", performance.now(), prefersLessMotion());
227
+ // one more frame while it moves, and none once it has arrived
228
+ if (fade.fading)
229
+ deps.invalidate();
230
+ if (fade.mix > 0) {
231
+ // between the true light and daylight from the camera's side: the direction is mixed, and a mix that cancels (the Sun straight behind) is the camera's side
232
+ const x = sunDir.value.x * (1 - fade.mix);
233
+ const y = sunDir.value.y * (1 - fade.mix);
234
+ const z = sunDir.value.z * (1 - fade.mix) + fade.mix;
235
+ const length = Math.hypot(x, y, z);
236
+ if (length > 1e-6)
237
+ sunDir.value.set(x / length, y / length, z / length);
238
+ else
239
+ sunDir.value.set(0, 0, 1);
240
+ }
225
241
  cloudShift.value = -(((model.time / 3_600_000) * model.cloudDrift) % 360) / 360;
226
242
  clouds.visible = model.clouds;
227
243
  atmosphere.uniforms["thick"].value = model.airThickness;
228
244
  glow.scale.setScalar(airTop(model.airThickness));
229
- surface.uniforms["lights"].value = model.lights && model.light !== "lit" ? 1 : 0;
245
+ surface.uniforms["lights"].value = model.lights ? 1 - fade.mix : 0;
230
246
  surface.uniforms["boost"].value = model.light === "boost" ? 1 : 0;
231
247
  const radius = discRadius(size.width, size.height, view.zoom);
232
248
  camera.left = (-size.width / 2 - view.panX) / radius;
@@ -61,6 +61,7 @@ type SatelliteStats = {
61
61
  hoverPath: boolean;
62
62
  hoverOpacity: number;
63
63
  selectedOpacity: number;
64
+ estimated: number;
64
65
  };
65
66
  /**
66
67
  * A `speed` attribute: how many seconds pass for each real second.
@@ -375,6 +376,11 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
375
376
  tiers: Record<EarthLayer, number>;
376
377
  tiles: TileStats;
377
378
  satellites: SatelliteStats;
379
+ /** The cross-fade when `light` changes to or from `lit` (300 ms, a cut under reduced motion): `mix` is 0 for the true light and 1 for `lit`, and `fading` is true while it moves and another frame is wanted. */
380
+ lightFade: {
381
+ mix: number;
382
+ fading: boolean;
383
+ };
378
384
  /** The page's paths: asked for, drawn (with the chosen satellite's own), left out over the cap of 16, unmatched, whether the chosen satellite's own orbit is drawn, draw calls they took at the last draw (0 or 1), the path under the mouse and the `chikyu-path-click` events sent. */
379
385
  paths: PathStats;
380
386
  draws: number;
@@ -564,6 +570,25 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
564
570
  visible: boolean;
565
571
  heightKm: number;
566
572
  } | null;
573
+ /**
574
+ * Keep placing satellites that are far from their element sets, as an estimate (the attribute `estimate-far`, off unless set; `estimate-far="off"` is off). A satellite is left out when the moment shown is more than `maxAgeDays` (30) from its elements; on, it is carried forward or back by the same SGP4 code
575
+ * instead, and drawn lighter than a dimmed one. **An estimate is where the satellite would be if its orbit had not changed since the elements were taken.** It is worst for low orbits (drag changes them within days, and a manoeuvre moves the satellite along its path, so after weeks the estimate can be far along the orbit from the truth, and a satellite that has re-entered is not there at all) and for a long time away; a high orbit changes slowly and is close for months. Never before a satellite's launch or after its decay when its elements carry `LAUNCH_DATE` and `DECAY_DATE` (else the year of its `OBJECT_ID` is the earliest);
576
+ * one SGP4 cannot carry that far, or brings down below about 120 km, is left out and is not counted as placed. Each estimated satellite is `estimated: true`, with `estimatedDays`, in `placeSatellite`, `satelliteInfo`, `chikyu-satellite-visibility` and `chikyu-satellite-click`, and `stats.satellites.estimated` counts them.
577
+ * It applies to every group, those the page made with `createSatellites(sets, { estimateFar: true })` too.
578
+ *
579
+ * @example
580
+ * ```ts
581
+ * import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
582
+ *
583
+ * const farFromToday = (space: ChikyuSpace): void => {
584
+ * space.estimateFar = true;
585
+ * space.addEventListener("chikyu-satellite-click", (event) => console.log((event as CustomEvent).detail.estimated, (event as CustomEvent).detail.estimatedDays));
586
+ * };
587
+ * console.log(typeof farFromToday);
588
+ * ```
589
+ */
590
+ get estimateFar(): boolean;
591
+ set estimateFar(value: boolean);
567
592
  /** The satellite marked by `selectSatellite` or by a press on it, if any. */
568
593
  get selectedSatellite(): SatelliteRef | null;
569
594
  /**
@@ -616,6 +641,13 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
616
641
  */
617
642
  get pathHit(): number;
618
643
  set pathHit(value: number);
644
+ /**
645
+ * Which is heard first where a satellite's dot and a path lie under the pointer (the attribute `path-priority`): `dots`, the default, or `paths`. With `dots` a press or a hover is the dot's, and a path is heard only where no dot is within 12 px: at the Low level, with thousands of dots crowding a line, a path can go unheard.
646
+ * With `paths` a path of the page's (`setPaths`, or the chosen satellite's own orbit) is heard before a dot, **except** a dot of a satellite that is itself one of the paths' satellites or the chosen or ridden one: that satellite's own dot still wins, and a press on it is `chikyu-satellite-click`.
647
+ * Either way one press has one meaning, in this order. `dots`: any dot, then a path, then the sky. `paths`: a listed or chosen satellite's dot, then a path, then any other dot, then the sky. Anything but `paths` reads as `dots`.
648
+ */
649
+ get pathPriority(): "dots" | "paths";
650
+ set pathPriority(value: "dots" | "paths");
619
651
  /**
620
652
  * The path under a point of the element, from the last draw: its id as given, the satellite (`ref`, the same shape as in `chikyu-satellite-click`), the name of its look, the nearest point on it and the distance to it, or `null`.
621
653
  *
@@ -11,7 +11,7 @@ import { createPaintState, paintedGround, paintedPeriod } from "../paint/buffer.
11
11
  import { MAX_ORBIT_GROUP, readStreakMax } from "../space/satellite-layer.js";
12
12
  import { applySatelliteFocus, satelliteEmphasis, satelliteGroupRows, shellRadiusOf, zoomForOrthographicShell } from "../space/satellite-focus.js";
13
13
  import { claimPress } from "../sky/claim.js";
14
- import { bindPaths, emptyPathStats, pointerOf } from "../space/path-controls.js";
14
+ import { bindPaths, emptyPathStats, pointerOf, readPathPriority } from "../space/path-controls.js";
15
15
  import { styleTable } from "../space/paths.js";
16
16
  import { bindSatelliteHover, hoverPathOn, hoverStyleOf, namesOnHover as namesHoverOn } from "../space/satellite-hover.js";
17
17
  import { readMeteorStrength } from "../meteors/strength.js";
@@ -165,7 +165,7 @@ export const readTime = (value) => {
165
165
  * ```
166
166
  */
167
167
  export class ChikyuEarthRealistic extends HTMLElement {
168
- static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "tiles-finer-timeout", "data", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "satellite-tint", "satellite-streak-max", "hover-path", "names-on-hover", "selected-path", "path-hit"];
168
+ static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "tiles-finer-timeout", "data", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "satellite-tint", "satellite-streak-max", "hover-path", "names-on-hover", "selected-path", "path-hit", "path-priority", "estimate-far"];
169
169
  #model = newModel();
170
170
  #paint = createPaintState();
171
171
  #mode = "now";
@@ -558,6 +558,8 @@ export class ChikyuEarthRealistic extends HTMLElement {
558
558
  this.#hover?.sync();
559
559
  else if (name === "selected-path")
560
560
  this.#pathControls?.sync();
561
+ else if (name === "estimate-far")
562
+ this.#applyEstimate();
561
563
  else if (name === "path-hit") { /* read at each press and move */ }
562
564
  else if (name === "satellite-streak-max") {
563
565
  this.#model.satellites.streakMax = readStreakMax(value);
@@ -1217,6 +1219,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
1217
1219
  state: this.#state,
1218
1220
  tiers: { ...this.#tiers },
1219
1221
  satellites: this.#satelliteStats(),
1222
+ lightFade: { mix: this.#model.lightFade.mix, fading: this.#model.lightFade.fading },
1220
1223
  paths: this.#pathControls?.stats() ?? emptyPathStats(),
1221
1224
  tiles: this.#model.tiles?.stats ?? { ready: false, level: null, held: 0, shown: 0, loading: 0, failed: 0, requested: 0, heldBytes: 0, refused: 0, used: {}, finer: null, fading: false },
1222
1225
  draws: stats?.draws ?? 0,
@@ -1341,6 +1344,8 @@ export class ChikyuEarthRealistic extends HTMLElement {
1341
1344
  orbits: (style.orbits ?? was?.orbits ?? false) && satellites.count <= MAX_ORBIT_GROUP,
1342
1345
  visible: was?.visible ?? true,
1343
1346
  });
1347
+ if (typeof this.hasAttribute === "function" && this.hasAttribute("estimate-far"))
1348
+ satellites.estimateFar = this.estimateFar;
1344
1349
  }
1345
1350
  this.#last = performance.now();
1346
1351
  this.#startTick();
@@ -1451,6 +1456,43 @@ export class ChikyuEarthRealistic extends HTMLElement {
1451
1456
  placeSatellite(ref) {
1452
1457
  return this.#model.placeSatellite?.(ref) ?? null;
1453
1458
  }
1459
+ /**
1460
+ * Keep placing satellites that are far from their element sets, as an estimate (the attribute `estimate-far`, off unless set; `estimate-far="off"` is off). A satellite is left out when the moment shown is more than `maxAgeDays` (30) from its elements; on, it is carried forward or back by the same SGP4 code
1461
+ * instead, and drawn lighter than a dimmed one. **An estimate is where the satellite would be if its orbit had not changed since the elements were taken.** It is worst for low orbits (drag changes them within days, and a manoeuvre moves the satellite along its path, so after weeks the estimate can be far along the orbit from the truth, and a satellite that has re-entered is not there at all) and for a long time away; a high orbit changes slowly and is close for months. Never before a satellite's launch or after its decay when its elements carry `LAUNCH_DATE` and `DECAY_DATE` (else the year of its `OBJECT_ID` is the earliest);
1462
+ * one SGP4 cannot carry that far, or brings down below about 120 km, is left out and is not counted as placed. Each estimated satellite is `estimated: true`, with `estimatedDays`, in `placeSatellite`, `satelliteInfo`, `chikyu-satellite-visibility` and `chikyu-satellite-click`, and `stats.satellites.estimated` counts them.
1463
+ * It applies to every group, those the page made with `createSatellites(sets, { estimateFar: true })` too.
1464
+ *
1465
+ * @example
1466
+ * ```ts
1467
+ * import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
1468
+ *
1469
+ * const farFromToday = (space: ChikyuSpace): void => {
1470
+ * space.estimateFar = true;
1471
+ * space.addEventListener("chikyu-satellite-click", (event) => console.log((event as CustomEvent).detail.estimated, (event as CustomEvent).detail.estimatedDays));
1472
+ * };
1473
+ * console.log(typeof farFromToday);
1474
+ * ```
1475
+ */
1476
+ get estimateFar() {
1477
+ return this.hasAttribute("estimate-far") && this.getAttribute("estimate-far") !== "off";
1478
+ }
1479
+ set estimateFar(value) {
1480
+ if (value)
1481
+ this.setAttribute("estimate-far", "");
1482
+ else
1483
+ this.removeAttribute("estimate-far");
1484
+ }
1485
+ /** What an event says of a satellite's place: whether it is an estimate, and how far the moment shown is from its elements' own, in days. */
1486
+ #estimateOf(ref) {
1487
+ const info = this.#model.satellites.groups.get(ref.group)?.satellites.info(ref.index, this.#model.time);
1488
+ return { estimated: info?.estimated ?? false, estimatedDays: info?.estimatedDays ?? 0 };
1489
+ }
1490
+ #applyEstimate() {
1491
+ const on = this.estimateFar;
1492
+ for (const group of this.#model.satellites.groups.values())
1493
+ group.satellites.estimateFar = on;
1494
+ this.#gate?.soon();
1495
+ }
1454
1496
  /** The satellite marked by `selectSatellite` or by a press on it, if any. */
1455
1497
  get selectedSatellite() {
1456
1498
  const chosen = this.#model.satellites.selected;
@@ -1533,6 +1575,20 @@ export class ChikyuEarthRealistic extends HTMLElement {
1533
1575
  else
1534
1576
  this.removeAttribute("path-hit");
1535
1577
  }
1578
+ /**
1579
+ * Which is heard first where a satellite's dot and a path lie under the pointer (the attribute `path-priority`): `dots`, the default, or `paths`. With `dots` a press or a hover is the dot's, and a path is heard only where no dot is within 12 px: at the Low level, with thousands of dots crowding a line, a path can go unheard.
1580
+ * With `paths` a path of the page's (`setPaths`, or the chosen satellite's own orbit) is heard before a dot, **except** a dot of a satellite that is itself one of the paths' satellites or the chosen or ridden one: that satellite's own dot still wins, and a press on it is `chikyu-satellite-click`.
1581
+ * Either way one press has one meaning, in this order. `dots`: any dot, then a path, then the sky. `paths`: a listed or chosen satellite's dot, then a path, then any other dot, then the sky. Anything but `paths` reads as `dots`.
1582
+ */
1583
+ get pathPriority() {
1584
+ return readPathPriority(this.getAttribute("path-priority"));
1585
+ }
1586
+ set pathPriority(value) {
1587
+ if (value === "paths")
1588
+ this.setAttribute("path-priority", "paths");
1589
+ else
1590
+ this.removeAttribute("path-priority");
1591
+ }
1536
1592
  /**
1537
1593
  * The path under a point of the element, from the last draw: its id as given, the satellite (`ref`, the same shape as in `chikyu-satellite-click`), the name of its look, the nearest point on it and the distance to it, or `null`.
1538
1594
  *
@@ -1569,7 +1625,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
1569
1625
  let epochMs = 0;
1570
1626
  for (const group of this.#model.satellites.groups.values())
1571
1627
  epochMs = Math.max(epochMs, group.satellites.newestEpochMs);
1572
- return { groups: this.#model.satellites.groups.size, placed: drawn.placed, segments: drawn.segments, tooFast: drawn.tooFast, dotScale: drawn.dotScale, longestStreakPx: drawn.longestStreakPx, streakCapPx: drawn.streakCapPx, weight: drawn.weight, fade: drawn.fade, earthPx: drawn.earthPx, epochMs, propagations, lastBatchMs, maxBatchMs, updateMs: drawn.updateMs, maxUpdateMs: drawn.maxUpdateMs, averageUpdateMs: drawn.updates ? drawn.totalMs / drawn.updates : 0, updates: drawn.updates, selectedRing: drawn.selectedRing, hoverPath: drawn.hoverPath, hoverOpacity: drawn.hoverOpacity, selectedOpacity: drawn.selectedOpacity };
1628
+ return { groups: this.#model.satellites.groups.size, placed: drawn.placed, segments: drawn.segments, tooFast: drawn.tooFast, dotScale: drawn.dotScale, longestStreakPx: drawn.longestStreakPx, streakCapPx: drawn.streakCapPx, weight: drawn.weight, fade: drawn.fade, earthPx: drawn.earthPx, epochMs, propagations, lastBatchMs, maxBatchMs, updateMs: drawn.updateMs, maxUpdateMs: drawn.maxUpdateMs, averageUpdateMs: drawn.updates ? drawn.totalMs / drawn.updates : 0, updates: drawn.updates, selectedRing: drawn.selectedRing, hoverPath: drawn.hoverPath, hoverOpacity: drawn.hoverOpacity, selectedOpacity: drawn.selectedOpacity, estimated: drawn.estimated };
1573
1629
  }
1574
1630
  // A press that does not turn the view (under 6 pixels) on a satellite tells the page, which chooses it with `selectSatellite` if it likes.
1575
1631
  #downX = 0;
@@ -1585,14 +1641,16 @@ export class ChikyuEarthRealistic extends HTMLElement {
1585
1641
  if (Math.hypot(event.clientX - this.#downX, event.clientY - this.#downY) > 6)
1586
1642
  return;
1587
1643
  const rect = this.getBoundingClientRect();
1588
- const satellite = this.#model.pick?.(event.clientX - rect.left, event.clientY - rect.top, 12);
1589
- if (satellite) {
1644
+ // one press, one meaning: the paths decide first, since which of a dot and a path wins depends on `path-priority` (a dot wins in the default, and the paths say so by answering no)
1645
+ if (this.#pathControls?.press(event.clientX - rect.left, event.clientY - rect.top, pointerOf(event))) {
1590
1646
  claimPress(event);
1591
- this.dispatchEvent(new CustomEvent("chikyu-satellite-click", { detail: { ...satellite, info: this.satelliteInfo(satellite) }, bubbles: true, composed: true }));
1592
1647
  return;
1593
1648
  }
1594
- if (this.#pathControls?.press(event.clientX - rect.left, event.clientY - rect.top, pointerOf(event)))
1649
+ const satellite = this.#model.pick?.(event.clientX - rect.left, event.clientY - rect.top, 12);
1650
+ if (satellite) {
1595
1651
  claimPress(event);
1652
+ this.dispatchEvent(new CustomEvent("chikyu-satellite-click", { detail: { ...satellite, info: this.satelliteInfo(satellite), ...this.#estimateOf(satellite) }, bubbles: true, composed: true }));
1653
+ }
1596
1654
  };
1597
1655
  #wheel = (event) => immersiveWheel(this, event);
1598
1656
  /** The view as it is (for a page that wants to read it back). */
@@ -0,0 +1,22 @@
1
+ /** How long the cross-fade takes, in milliseconds. */
2
+ export declare const LIGHT_FADE_MS = 300;
3
+ /** Where the fade is: `mix` is 0 for the true light and 1 for `lit`. */
4
+ export interface LightFade {
5
+ mix: number;
6
+ target: number;
7
+ from: number;
8
+ started: number;
9
+ /** Whether the last step left it still moving, so another draw is wanted. */
10
+ fading: boolean;
11
+ }
12
+ export declare const newLightFade: (lit?: boolean) => LightFade;
13
+ /**
14
+ * Step the fade to `now`. `lit` is where it is going. A change of `lit` starts a fade from where the mix is now (a fade turned round half way goes back from there); with `reduced` it jumps. Returns the same object, updated.
15
+ *
16
+ * @param fade - The fade to step.
17
+ * @param lit - Whether the light is `lit` now.
18
+ * @param now - The clock, in milliseconds.
19
+ * @param reduced - Whether the reader asked for less motion.
20
+ * @returns The fade: `mix` for this frame and `fading` true while another frame is wanted.
21
+ */
22
+ export declare function stepLightFade(fade: LightFade, lit: boolean, now: number, reduced: boolean): LightFade;
@@ -0,0 +1,36 @@
1
+ // A short cross-fade when `light` changes to or from `lit`: the Earth's night lights and (in the realistic view) the direction of its light move from one look to the other over 300 ms instead of cutting. A reader who asked for reduced motion
2
+ // gets the cut. The fade is a state the draw steps: each draw asks for the next while it moves, and when it has arrived nothing is asked for, so at rest nothing is drawn.
3
+ /** How long the cross-fade takes, in milliseconds. */
4
+ export const LIGHT_FADE_MS = 300;
5
+ export const newLightFade = (lit = false) => ({ mix: lit ? 1 : 0, target: lit ? 1 : 0, from: lit ? 1 : 0, started: 0, fading: false });
6
+ /** A smooth start and end: 0 to 1 over `t` from 0 to 1. */
7
+ const ease = (t) => t * t * (3 - 2 * t);
8
+ /**
9
+ * Step the fade to `now`. `lit` is where it is going. A change of `lit` starts a fade from where the mix is now (a fade turned round half way goes back from there); with `reduced` it jumps. Returns the same object, updated.
10
+ *
11
+ * @param fade - The fade to step.
12
+ * @param lit - Whether the light is `lit` now.
13
+ * @param now - The clock, in milliseconds.
14
+ * @param reduced - Whether the reader asked for less motion.
15
+ * @returns The fade: `mix` for this frame and `fading` true while another frame is wanted.
16
+ */
17
+ export function stepLightFade(fade, lit, now, reduced) {
18
+ const target = lit ? 1 : 0;
19
+ if (target !== fade.target) {
20
+ fade.target = target;
21
+ fade.from = fade.mix;
22
+ fade.started = now;
23
+ }
24
+ if (reduced || fade.mix === target) {
25
+ fade.mix = target;
26
+ fade.from = target;
27
+ fade.fading = false;
28
+ return fade;
29
+ }
30
+ const t = Math.min(1, Math.max(0, (now - fade.started) / LIGHT_FADE_MS));
31
+ fade.mix = fade.from + (target - fade.from) * ease(t);
32
+ if (t >= 1)
33
+ fade.mix = target;
34
+ fade.fading = fade.mix !== target;
35
+ return fade;
36
+ }
@@ -130,7 +130,7 @@ export interface CatalogueRow {
130
130
  export declare function catalogueRows(lang?: "en" | "ja"): CatalogueRow[];
131
131
  /**
132
132
  * Find catalogue entries by name, group name, NORAD number, Japanese name or a group's Japanese label: "hubble", "hst", "25544", "weather" or "ハッブル".
133
- * An English or numeric query ignores case, spaces and punctuation, as before. Kana and kanji are matched as typed: only letter case and character width are folded (NFKC), and that same width fold is applied before the English comparison.
133
+ * An English or numeric query ignores case, spaces and punctuation, as before. Japanese is folded on both sides: letter case, character width (NFKC) and kana (`foldKana`: hiragana to katakana, small kana to full-size, the long-vowel mark left alone), so `はっぶる` finds `ハッブル`; kanji are matched as typed. The width fold is applied before the English comparison too.
134
134
  * A name that starts with the text comes before one that only has it inside.
135
135
  *
136
136
  * @param text - What the reader typed.
@@ -1,5 +1,6 @@
1
1
  // A small curated catalogue of satellites worth following: the groups the demo offers as buttons and the famous ones by name. Facts (names, NORAD numbers, orbit types) and our own words;
2
2
  // no orbital elements are here, and nothing is fetched. The elements come from the page (see docs/satellite-sources.md for the sources and their terms).
3
+ import { foldKana } from "./kana.js";
3
4
  import { SHORT_NAMES } from "./names.js";
4
5
  /**
5
6
  * The groups, in the order the demo shows them. Each one is a CelesTrak list or a few single numbers; the elements are fetched by the page (or the demo's scheduled build), never by the package.
@@ -285,7 +286,7 @@ export function catalogueRows(lang) {
285
286
  }
286
287
  /**
287
288
  * Find catalogue entries by name, group name, NORAD number, Japanese name or a group's Japanese label: "hubble", "hst", "25544", "weather" or "ハッブル".
288
- * An English or numeric query ignores case, spaces and punctuation, as before. Kana and kanji are matched as typed: only letter case and character width are folded (NFKC), and that same width fold is applied before the English comparison.
289
+ * An English or numeric query ignores case, spaces and punctuation, as before. Japanese is folded on both sides: letter case, character width (NFKC) and kana (`foldKana`: hiragana to katakana, small kana to full-size, the long-vowel mark left alone), so `はっぶる` finds `ハッブル`; kanji are matched as typed. The width fold is applied before the English comparison too.
289
290
  * A name that starts with the text comes before one that only has it inside.
290
291
  *
291
292
  * @param text - What the reader typed.
@@ -302,7 +303,7 @@ export function catalogueRows(lang) {
302
303
  export function findInCatalogue(text, limit = 8) {
303
304
  const source = text.normalize("NFKC");
304
305
  const wanted = squash(source);
305
- const folded = source.toLowerCase().trim();
306
+ const folded = foldKana(source).toLowerCase().trim();
306
307
  const japanese = /[぀-ヿ一-鿿]/.test(source);
307
308
  if (!wanted && !japanese)
308
309
  return [];
@@ -312,8 +313,8 @@ export function findInCatalogue(text, limit = 8) {
312
313
  const name = squash(entry.name);
313
314
  const englishStart = wanted !== "" && (String(entry.noradId) === wanted || name.startsWith(wanted));
314
315
  const englishInside = wanted !== "" && (name.includes(wanted) || squash(entry.group).includes(wanted) || squash(entry.about).includes(wanted));
315
- const jaName = japanese ? (SHORT_NAMES[entry.noradId]?.ja ?? entry.name).normalize("NFKC").toLowerCase() : "";
316
- const labelJa = japanese ? (GROUPS_BY_ID.get(entry.group)?.labelJa ?? "").normalize("NFKC").toLowerCase() : "";
316
+ const jaName = japanese ? foldKana(SHORT_NAMES[entry.noradId]?.ja ?? entry.name).toLowerCase() : "";
317
+ const labelJa = japanese ? foldKana(GROUPS_BY_ID.get(entry.group)?.labelJa ?? "").toLowerCase() : "";
317
318
  const jaStart = japanese && folded !== "" && jaName.startsWith(folded);
318
319
  const jaInside = japanese && folded !== "" && (jaName.includes(folded) || labelJa.includes(folded));
319
320
  if (englishStart || jaStart)
@@ -3,6 +3,7 @@ export { NEAREST_COUNT, closeApproach, nearest, overheadKm, within, type Neighbo
3
3
  export { DEFAULT_DIM_AFTER_DAYS, DEFAULT_MAX_AGE_DAYS, MAX_SATELLITE_SPEED } from "./limits.ts";
4
4
  export type { ElementSet, RefusedElementSet, SatelliteInfo, SatelliteRef, Satellites } from "./types.ts";
5
5
  export { SHORT_NAMES } from "./names.ts";
6
+ export { foldKana } from "./kana.ts";
6
7
  export { OWNER_COUNTRIES, ownerCountry } from "./owners.ts";
7
8
  export { CATALOGUE, SATELLITE_GROUPS, catalogueEntry, catalogueRows, findInCatalogue, type CatalogueEntry, type CatalogueRow, type OrbitKind, type SatelliteGroupInfo } from "./catalogue.ts";
8
9
  export { ElementSourceError, fetchElements, forgetElements, parseElements, type ElementFormat, type ElementSource, type FetchElementsOptions, type ParsedElements } from "./source.ts";
@@ -3,6 +3,7 @@ export { createSatellites } from "./track.js";
3
3
  export { NEAREST_COUNT, closeApproach, nearest, overheadKm, within } from "./nearest.js";
4
4
  export { DEFAULT_DIM_AFTER_DAYS, DEFAULT_MAX_AGE_DAYS, MAX_SATELLITE_SPEED } from "./limits.js";
5
5
  export { SHORT_NAMES } from "./names.js";
6
+ export { foldKana } from "./kana.js";
6
7
  export { OWNER_COUNTRIES, ownerCountry } from "./owners.js";
7
8
  export { CATALOGUE, SATELLITE_GROUPS, catalogueEntry, catalogueRows, findInCatalogue } from "./catalogue.js";
8
9
  export { ElementSourceError, fetchElements, forgetElements, parseElements } from "./source.js";
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Fold text for a Japanese search: width and compatibility forms (NFKC: half-width katakana becomes full-width), hiragana to katakana, and a small kana (`ッ`, `ャ`, `ァ`) to its full-size one. The long-vowel mark `ー` is left as it is, and so is everything that is not kana
3
+ * (letter case is the caller's, as it is for any search). Put it on both sides of a comparison: `foldKana("はっぶる") === foldKana("ハッブル")`, and `ハッブル` is also `ハツブル` after it, so a reader who types a small kana as a full-size one still finds it.
4
+ *
5
+ * @param text - What was typed, or a name to compare it with.
6
+ * @returns The folded text.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { foldKana } from "@johnmorrisdotca/chikyu-earth/satellites";
11
+ *
12
+ * console.log(foldKana("はっぶる") === foldKana("ハッブル"));
13
+ * console.log(foldKana("ほし ー"));
14
+ * ```
15
+ */
16
+ export declare function foldKana(text: string): string;
@@ -0,0 +1,24 @@
1
+ // Kana folding for a search: hiragana and katakana are the same sounds, so a name typed in one is found in the other. Pure text, no dependency; imports on a server.
2
+ /** The small kana and the full-size kana they fold to. */
3
+ const SMALL = { ァ: "ア", ィ: "イ", ゥ: "ウ", ェ: "エ", ォ: "オ", ッ: "ツ", ャ: "ヤ", ュ: "ユ", ョ: "ヨ", ヮ: "ワ", ヵ: "カ", ヶ: "ケ" };
4
+ /**
5
+ * Fold text for a Japanese search: width and compatibility forms (NFKC: half-width katakana becomes full-width), hiragana to katakana, and a small kana (`ッ`, `ャ`, `ァ`) to its full-size one. The long-vowel mark `ー` is left as it is, and so is everything that is not kana
6
+ * (letter case is the caller's, as it is for any search). Put it on both sides of a comparison: `foldKana("はっぶる") === foldKana("ハッブル")`, and `ハッブル` is also `ハツブル` after it, so a reader who types a small kana as a full-size one still finds it.
7
+ *
8
+ * @param text - What was typed, or a name to compare it with.
9
+ * @returns The folded text.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { foldKana } from "@johnmorrisdotca/chikyu-earth/satellites";
14
+ *
15
+ * console.log(foldKana("はっぶる") === foldKana("ハッブル"));
16
+ * console.log(foldKana("ほし ー"));
17
+ * ```
18
+ */
19
+ export function foldKana(text) {
20
+ return text
21
+ .normalize("NFKC")
22
+ .replace(/[ぁ-ゖゝゞ]/g, (ch) => String.fromCharCode(ch.charCodeAt(0) + 0x60))
23
+ .replace(/[ァィゥェォッャュョヮヵヶ]/g, (ch) => SMALL[ch] ?? ch);
24
+ }
@@ -9,7 +9,7 @@ export function toElementSet(record) {
9
9
  out["OBJECT_ID"] = record["OBJECT_ID"];
10
10
  if (typeof record["CLASSIFICATION_TYPE"] === "string" && record["CLASSIFICATION_TYPE"])
11
11
  out["CLASSIFICATION_TYPE"] = record["CLASSIFICATION_TYPE"];
12
- for (const key of ["COUNTRY_CODE", "OWNER"])
12
+ for (const key of ["COUNTRY_CODE", "OWNER", "LAUNCH_DATE", "DECAY_DATE"])
13
13
  if (typeof record[key] === "string" && record[key].trim())
14
14
  out[key] = record[key].trim();
15
15
  const epoch = record["EPOCH"];
@@ -20,6 +20,11 @@ export interface SatellitesOptions {
20
20
  maxAgeDays?: number;
21
21
  /** The age, in days, past which a satellite is drawn dimmer because its place is less exact (14 by default). */
22
22
  dimAfterDays?: number;
23
+ /**
24
+ * Keep placing a satellite beyond `maxAgeDays` from its element set, as an estimate (off by default): the same elements carried forward or back by the same SGP4 code, where the satellite would be had its orbit not changed.
25
+ * Never before its launch date or after its decay date when the elements carry them (`LAUNCH_DATE`, `DECAY_DATE`; else the launch year in `OBJECT_ID` marks the earliest), and a satellite that SGP4 cannot carry that far, or brings down below about 120 km, is left out.
26
+ */
27
+ estimateFar?: boolean;
23
28
  }
24
29
  /**
25
30
  * Make a group of satellites from their element sets. Each starts SGP4 once here; one that does not (bad numbers, decayed at its own epoch) is listed in `refused` and left out.