@johnmorrisdotca/chikyu-earth 0.23.0 → 0.24.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,12 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.24.0 - 2026-11-10
|
|
6
|
+
|
|
7
|
+
- **The demo's views open moving** (MODULES-815). A link that says nothing about the clock (no `play`, no `speed`, no `time`) opens the space view and the realistic Earth running from now at an hour a second (`speed` 3600, the first step of the Time row where motion shows; real time looks frozen), with the date box running with it. They opened held (the space view) or following the real clock (the realistic Earth) before. Links that say something work as they say: `speed=0` and `play=off` hold, a date (`time`) is shown as it says and held until Play, a speed other than 0 with no `play` runs at it, and a reader's Pause, written to the address as `time`, stays held. A hold with no date to write (Back to a date that was "now" on the realistic Earth, Now pressed while held) is written as `play=off`. Changing look keeps the clock as the reader left it: a view that was running goes on running from the date reached, one that was paused stays paused. The line and thick globes already turn on their own when the page opens (the view controls' Auto-turn, at the Earth's own rate). **A reader who prefers reduced motion still gets a still view with Play off**: John has not decided whether that changes, and the one place to change is `OPEN_MOVING_WITH_REDUCED_MOTION` in `demo/demo.ts` (kazoku-ui's replay bar also turns Play off under reduced motion, so the change needs an option there first). Nothing is drawn while held, out of sight or in a hidden tab, and never more than 30 frames a second, as before. The package's elements are unchanged (`<chikyu-space>` still defaults to real time and `<chikyu-earth-realistic>` to following the real clock), and so is the embed page. Guide in English and Japanese: `docs/guides/time-and-play.md`. Tests: `e2e/date-play.demo.ts` (the space view and the globes) and `e2e/realistic-play.demo.ts`; "nothing at all opens held" became "opens moving".
|
|
8
|
+
|
|
5
9
|
## 0.23.0 - 2026-11-10
|
|
6
10
|
|
|
7
11
|
- **The date follows the clock, and the demo has Play, Pause and Back** (MODULES-784, MODULES-755). `<chikyu-space>` sends `chikyu-timechange` with `detail: { time, running }`: while the clock runs (`speed` not 0) four times a second at most however fast the picture is drawn (as often as the clock steps at real time), only while the tab is shown, and once with `running: false` when the clock holds, so a page can write the date it stopped on. `<chikyu-earth-realistic>` sends it too while its `time="now"` clock steps (every `live-seconds`) and once when it is given a date. `chikyu-time` stays as the every-step event and is documented so. Setting `speed` to 0 now keeps the moment the reader last saw, and the clock goes on from there.
|
|
8
12
|
- **The demo's Time row is kazoku-ui's `<kazoku-replay-bar>`** next to the date field, in place of the Time speed buttons: Play runs from the date shown and the box follows it (never while the reader is typing in it), Pause holds it and writes the date reached into `time`, Back to the date returns to the date chosen, and riding along starts the clock. `play=on` and `speed` stay in the address, and the date when the clock stops or the reader leaves. The space view opens held; `speed=0` links stay held, links that name a speed and no `play` keep running, and a reader who prefers reduced motion gets Play left off. Guide in English and Japanese: `docs/guides/time-and-play.md`. Test: `e2e/date-play.demo.ts`.
|
|
9
13
|
|
|
10
14
|
- **Play for the realistic Earth: `<chikyu-earth-realistic>` has a `speed`** (MODULES-799), with `<chikyu-space>`'s name and rules. `speed` is how many seconds pass for each real second (`0` holds, `3600` an hour a second, `86400` a day a second, negative runs backwards); the clock runs on from the date shown, and the Sun's light, the night side and the clouds follow it. Draws are at most 30 a second (as often as the Sun's turn moves a pixel, once a second at least, one step a second for a reader who prefers reduced motion), and nothing is drawn while it holds, is out of sight or is in a hidden tab. `chikyu-timechange` follows the same rules as the space view's: four a second at most while it runs, and once with `running: false` when it holds (a date set, or `speed` set to 0). Old links keep working: with no `speed`, `time="now"` still follows the real clock (the Sun and clouds put right every `live-seconds`) and a date still holds. `time` now reads the moment reached while the clock runs. New export `readSpeed`. The demo's Play bar runs the realistic look too: Play from `now` starts from the moment shown and writes it into `time`, Back returns to following the real clock when the date was `now`, and `play` and `speed` stay in the address. Guide section in English and Japanese: `docs/guides/time-and-play.md`. Tests: `e2e/realistic-play.demo.ts`, and the clock added to `e2e/freeze.demo.ts`.
|
|
15
|
+
- **A flaky test mended, and one empty draw removed** (MODULES-808). `e2e/tiles.gl.ts` "tiles that arrive one after another are a few draws" failed in CI with 7 draws against a limit under 7 (4 tiles, and the limit was the tiles requested plus 3). Measured frame by frame, with the tiles answered after different waits (the slow route that reproduces it: 7 or 8 draws in 4 runs of 10): the element draws at most once in a frame, never faster than 30 a second, and a tile that arrives in its own frame is one draw. The test was wrong in two ways. It counted from before the zoom, and the same zoom also swaps the package's own pictures for sharper ones (day, night, clouds and water, a draw each, up to four, within the first 100 ms and before any tile has arrived), which are draws the tiles did not ask for; and "requested plus 3" is a fixed number for a count that depends on how the arrivals fall across frames. It now checks the rule itself, for tiles answered at once, one after another and in clumps, watching the page's frames: at most one draw in any frame, no more draws than the frames that had something new to show (a tile arrived, or a sharper picture was swapped in) plus the zoom's own draw, and at most 30 a second. A second CI run of the new test showed the rule was not yet exact: 6 draws against 4 frames with news plus 1. The extra was a draw with nothing new in it. When a second tile arrived a few milliseconds after the first and before the draw the first had asked for, the draw gate set a timer and drew again 33 ms later, after the first draw had already shown both tiles. `Gate` has a new `drawn()`, which `<chikyu-earth-realistic>` calls at the start of every draw; from then on an ask made after a run and before its draw begins is dropped, since that draw reads the state as it is when it runs, so what arrives in one frame is one draw. A draw that never begins no longer holds asks back for more than the gap. The space view's gate is unchanged. Tests: `test/realistic.test.ts` and, with the frames listed in its failure message, `e2e/tiles.gl.ts`. The other tests that count draws (`e2e/realistic.gl.ts`, `e2e/freeze.demo.ts`, `e2e/markers.gl.ts`) count rest, bursts of asks in one task or a rate over a fixed time, none of them by how arrivals fall.
|
|
11
16
|
- **A flaky test mended** (MODULES-800). `e2e/ride.gl.ts` "a reader who asked for reduced motion gets a jump and one step a second" failed about 3 runs in 4 on a loaded Mac: `freezeClock` paused the page's clock 50 ms past the time it had just read, and by then the clock had moved on, so `pauseAt` threw "Cannot fast-forward to the past". The pause is now 3 s ahead of the page's own time, and the glide test uses the same helper. The same sweep: a hold (Pause, a speed of 0) leaves one last frame already queued, and drawing it is right, but on a loaded Mac it landed after the 800 ms the "nothing is drawn while paused" tests allowed (`e2e/date-play.demo.ts` failed 2 runs in 3; the freeze test of the space clock had the same wait). `untilStill` in `e2e/gl.ts` waits until the draw and frame-request counts are the same a second apart (and fails after 20 s if frames keep coming) before the test measures rest; the element was not at fault.
|
|
12
17
|
- **Two more flaky tests mended** (MODULES-804, MODULES-805); the element and its pages are unchanged. `e2e/passes.demo.ts` "the satellite, the days, all passes and the darker sky change the list" ran out of its 5 s waits in CI. The list was never slow (worked out in 30 to 150 ms): in the desk and phone Chromium projects, which draw WebGL in software, the page's own pictures were drawn by the same emulated GPU too, and the passes page's world map alone kept that GPU busy for 5 to 10 s, from about a second after the page opened, in which the page drew no frame and answered no click (a click took 6 s; the whole test, 9 to 12 s, now takes under 1 s). Those two projects now rasterize the page on the CPU (`--disable-gpu-rasterization`; WebGL is still drawn in software), and the test waits for the count the page sets when it has made the list (`#data-note[data-passes]`), for up to 20 s, not for the `days` attribute that changes the moment the button is pressed. `e2e/ride.gl.ts` "paused it rests, and out of sight or in a hidden tab it draws nothing while the clock runs" took 20 to 60 s of its 60: 15 s of its own waits, and up to 44 s of waiting for the software GPU to finish the 33 s of frames the test before it (the frame-rate test) had asked for, which the browser made this test wait for with its clock running. That test now ends with `drainGpu` (a one-pixel read, in `e2e/gl.ts`), draws 2.5 s windows instead of 4 s, and the paused, out-of-sight and hidden-tab checks are three tests on the test's own clock (about 6 s each); the out-of-sight and hidden-tab tests now prove the ride is drawing in sight at 60x first, and the hidden-tab test no longer leaves the globe scrolled out of sight (it was checking the same thing twice). "riding, stopping and riding again" spent 45 s of its 60 on fixed waits and now runs the glides and the four seconds on the test's own clock.
|
|
13
18
|
|
|
@@ -69,6 +69,8 @@ export interface EarthDeps {
|
|
|
69
69
|
invalidate: () => void;
|
|
70
70
|
onError?: (error: unknown) => void;
|
|
71
71
|
onTier?: (layer: Layer, width: number) => void;
|
|
72
|
+
/** Told at the start of every draw, before anything is read for it. */
|
|
73
|
+
onDraw?: () => void;
|
|
72
74
|
/** Told at every draw where the disc is, for what is laid over it (markers). */
|
|
73
75
|
onPose?: (pose: {
|
|
74
76
|
lon: number;
|
package/dist/realistic/earth.js
CHANGED
|
@@ -177,6 +177,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
177
177
|
},
|
|
178
178
|
drift: 1.5,
|
|
179
179
|
invalidate: () => this.#gate?.soon(),
|
|
180
|
+
onDraw: () => this.#gate?.drawn(),
|
|
180
181
|
onPose: (pose) => {
|
|
181
182
|
if (this.#hands)
|
|
182
183
|
this.#hands.controller.grabRadius = discRadius(pose.width, pose.height, 1);
|
package/dist/realistic/gate.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const browserTimers: Timers;
|
|
|
13
13
|
*
|
|
14
14
|
* const gate: Gate = createGate(33, () => console.log("draw"));
|
|
15
15
|
* gate.request();
|
|
16
|
+
* gate.drawn();
|
|
16
17
|
* gate.cancel();
|
|
17
18
|
* ```
|
|
18
19
|
*/
|
|
@@ -25,6 +26,12 @@ export interface Gate {
|
|
|
25
26
|
cancel(): void;
|
|
26
27
|
/** Change the least time between runs (a lower frame rate on a battery). */
|
|
27
28
|
setMinMs(minMs: number): void;
|
|
29
|
+
/**
|
|
30
|
+
* Tell the gate a draw has begun (call it first thing in the draw). From the first call, an ask made after a run and before the draw it asked for is dropped, since that draw reads the state as it is
|
|
31
|
+
* when it runs and so shows the change too: two tiles that arrive a few milliseconds apart are one draw, not a draw and a second, empty one 33 ms later. A draw that does not come within `minMs`
|
|
32
|
+
* (a hidden tab, a busy machine) no longer holds asks back.
|
|
33
|
+
*/
|
|
34
|
+
drawn(): void;
|
|
28
35
|
}
|
|
29
36
|
/**
|
|
30
37
|
* A rate gate for the draw: asks that come faster than `minMs` apart become one, and the last ask is never lost, so a burst of changes costs one draw.
|
package/dist/realistic/gate.js
CHANGED
|
@@ -28,15 +28,21 @@ export function createGate(minMs, fire, timers = browserTimers) {
|
|
|
28
28
|
let last = -Infinity;
|
|
29
29
|
let waiting;
|
|
30
30
|
let soon = false;
|
|
31
|
+
let tracking = false;
|
|
32
|
+
let undrawn = false;
|
|
31
33
|
const run = () => {
|
|
32
34
|
waiting = undefined;
|
|
33
35
|
last = timers.now();
|
|
36
|
+
undrawn = true;
|
|
34
37
|
fire();
|
|
35
38
|
};
|
|
36
39
|
const request = () => {
|
|
37
40
|
if (waiting !== undefined)
|
|
38
41
|
return;
|
|
39
|
-
const
|
|
42
|
+
const now = timers.now();
|
|
43
|
+
if (tracking && undrawn && now - last < least)
|
|
44
|
+
return;
|
|
45
|
+
const wait = last + least - now;
|
|
40
46
|
if (wait <= 0)
|
|
41
47
|
run();
|
|
42
48
|
else
|
|
@@ -61,6 +67,10 @@ export function createGate(minMs, fire, timers = browserTimers) {
|
|
|
61
67
|
setMinMs(value) {
|
|
62
68
|
least = value;
|
|
63
69
|
},
|
|
70
|
+
drawn() {
|
|
71
|
+
tracking = true;
|
|
72
|
+
undrawn = false;
|
|
73
|
+
},
|
|
64
74
|
};
|
|
65
75
|
}
|
|
66
76
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/chikyu-earth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Chikyu Earth 地球 — A line-drawn globe for the web: country outlines that turn at the Earth's own rate, centred on where you are, with an optional realistic Earth from space (three.js), the Sun, Moon and planets, satellites on their orbits, and markers for any place. A web component and an SVG string.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"earth",
|