@johnmorrisdotca/chikyu-earth 0.35.0 → 0.36.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 +13 -0
- package/NOTICE.md +23 -1
- package/README.md +20 -2
- package/dist/borders/layer.d.ts +75 -0
- package/dist/borders/layer.js +136 -0
- package/dist/borders/lines.d.ts +138 -0
- package/dist/borders/lines.js +227 -0
- package/dist/cities/host.d.ts +9 -0
- package/dist/cities/host.js +14 -2
- package/dist/country-names/geometry.d.ts +264 -0
- package/dist/country-names/geometry.js +372 -0
- package/dist/country-names/host.d.ts +82 -0
- package/dist/country-names/host.js +212 -0
- package/dist/grid/layer.d.ts +45 -0
- package/dist/grid/layer.js +66 -0
- package/dist/grid/lines.d.ts +85 -0
- package/dist/grid/lines.js +113 -0
- package/dist/markers/go-to-place.d.ts +27 -0
- package/dist/markers/go-to-place.js +35 -0
- package/dist/markers/index.d.ts +2 -1
- package/dist/markers/index.js +2 -1
- package/dist/markers/layer.d.ts +7 -0
- package/dist/markers/layer.js +7 -0
- package/dist/markers/place-layer.d.ts +58 -7
- package/dist/markers/place-layer.js +326 -64
- package/dist/markers/place-sprites.d.ts +33 -0
- package/dist/markers/place-sprites.js +161 -0
- package/dist/markers/places.d.ts +91 -6
- package/dist/markers/places.js +135 -6
- package/dist/realistic/earth.d.ts +11 -0
- package/dist/realistic/earth.js +54 -0
- package/dist/realistic/element.d.ts +65 -4
- package/dist/realistic/element.js +198 -26
- package/dist/realistic/immersive.d.ts +7 -0
- package/dist/realistic/immersive.js +17 -0
- package/dist/realistic/index.d.ts +6 -0
- package/dist/realistic/index.js +3 -0
- package/dist/realistic/textures.d.ts +3 -0
- package/dist/space/element.d.ts +81 -7
- package/dist/space/element.js +246 -16
- package/dist/space/index.d.ts +1 -1
- package/dist/space/scene.d.ts +53 -5
- package/dist/space/scene.js +88 -8
- package/package.json +3 -3
package/dist/space/element.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ import type { SkyKeepClear } from "../sky/keep-clear.ts";
|
|
|
5
5
|
import type { SkyLabelStyle } from "../sky/style.ts";
|
|
6
6
|
import { type Place, type PlaceLook } from "../markers/places.ts";
|
|
7
7
|
import { type CityNamesStyle } from "../cities/host.ts";
|
|
8
|
+
import { type BorderSets } from "../borders/lines.ts";
|
|
9
|
+
import type { BorderData, BorderStats } from "../borders/layer.ts";
|
|
10
|
+
import type { GridStats } from "../grid/layer.ts";
|
|
11
|
+
import { type CountryNamesStats, type CountryNamesStyle } from "../country-names/host.ts";
|
|
8
12
|
import { setThreeLoader } from "../realistic/shared.ts";
|
|
9
13
|
import type { LightMode } from "../realistic/earth.ts";
|
|
10
14
|
import type { SatelliteInfo, SatelliteRef, Satellites } from "../satellites/types.ts";
|
|
@@ -138,13 +142,21 @@ type SatelliteStats = {
|
|
|
138
142
|
/**
|
|
139
143
|
* The `<chikyu-space>` custom element: the Earth, the Moon, the Sun and the planets where they are at a date and time, drawn with three.js through the shared renderer. It takes `center`, `time` (`now` or an ISO date), `speed` (1 is real time, 0 holds, 86400 is a day a second, negative runs backwards), `scale` (`compressed` or `true`), `labels` and `orbits` (`off` hides them); positions are computed in the browser by astronomy-engine, an optional peer dependency. It draws only when something changes, and nothing while it is out of sight.
|
|
140
144
|
*
|
|
141
|
-
* It carries kazoku-ui's controls itself: a drag turns the view, two fingers pinch, Ctrl and the wheel zoom (a plain wheel at Fit scrolls the page) and the arrow keys, + and - work once it is focused. The zoom runs from a millionth of Fit (the whole solar system) to 2.5 times, and from 0.5 to 6 times while riding from a body. `controls="none"` turns the hands off; `zoom-min` and `zoom-max` change the range. A `<kazoku-view-controls for="...">` on the element takes the hands over, and the page applies its events with `setView`.
|
|
145
|
+
* It carries kazoku-ui's controls itself: a drag turns the view, two fingers pinch, Ctrl and the wheel zoom (a plain wheel at Fit scrolls the page) and the arrow keys, + and - work once it is focused. The zoom runs from a millionth of Fit (the whole solar system) to 2.5 times, and from 0.5 to 6 times while riding from a body. `controls="none"` turns the hands off; `zoom-min` and `zoom-max` change the range. A `<kazoku-view-controls for="...">` on the element takes the hands over, and the page applies its events with `setView`. `immersive` is the full-screen mode: any shape of box, a plain wheel zooms and a drag anywhere turns.
|
|
146
|
+
*
|
|
147
|
+
* With a body painter that carries a `credit` (`setBodyPainter`), the credit of its pictures is written under the picture while it draws the bodies; `bodies-credit="off"` takes the line away.
|
|
142
148
|
*
|
|
143
149
|
* While time runs (`speed` is not 0) it sends `chikyu-timechange` with `detail: { time, running: true }`, `time` being the moment shown in milliseconds since 1970, at most four times a second however fast the picture is
|
|
144
150
|
* drawn (and, with the clock at real time, as often as it steps: once a minute, or once a second with satellites or a ride on show), only while the tab is shown, and once with `running: false` when the clock holds
|
|
145
151
|
* (`speed` set to 0): a page writes the date into its date box from it. It is not sent for a `time` the page sets itself. `chikyu-time` is the older event of every step the clock takes (up to thirty a second):
|
|
146
152
|
* it is kept for pages that use it, but a page that shows the date wants `chikyu-timechange`.
|
|
147
153
|
*
|
|
154
|
+
* `borders` draws the borders on the Earth's land as thin lines that turn with it, as on `<chikyu-earth-realistic>`: `countries`, `regions` (from the page's `borderData.regions`, once the Earth is
|
|
155
|
+
* large enough), or both with a bare attribute; `chikyu-borders-unavailable` is sent when the shapes cannot be loaded.
|
|
156
|
+
*
|
|
157
|
+
* `grid` draws the meridians and parallels on the Earth, and `country-names` names its countries, as on `<chikyu-earth-realistic>`: the names keep clear of the bodies', the places' and the
|
|
158
|
+
* cities' names and stay on the Earth's disc; `chikyu-country-names-unavailable` is sent when the outlines cannot be loaded.
|
|
159
|
+
*
|
|
148
160
|
* @example
|
|
149
161
|
* ```ts no-run
|
|
150
162
|
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space/element";
|
|
@@ -167,6 +179,12 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
167
179
|
connectedCallback(): void;
|
|
168
180
|
disconnectedCallback(): void;
|
|
169
181
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
182
|
+
/**
|
|
183
|
+
* True for the full-screen mode (the `immersive` attribute): the element fills its box in any shape (the Earth fits the shorter side with its glow inside it, `earth-size`), a plain wheel zooms instead of scrolling
|
|
184
|
+
* the page, a drag anywhere on it turns the view, and a touch drag turns it instead of scrolling. A notch of the wheel is about 1.2 times; out far enough the Moon, the Sun and the planets come into view.
|
|
185
|
+
*/
|
|
186
|
+
get immersive(): boolean;
|
|
187
|
+
set immersive(value: boolean);
|
|
170
188
|
/**
|
|
171
189
|
* Meteors seen from space, on or off (the attribute `meteors`): short streaks where meteors burn, on the dark side of the Earth and in its twilight, more of them under an active shower, only while the
|
|
172
190
|
* clock runs, and for a reader who prefers reduced motion only once the page has set a `speed` (a Play). Each streak's place and moment are drawn at random, and a line under the picture says so
|
|
@@ -213,13 +231,32 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
213
231
|
get keepClear(): SkyKeepClear[];
|
|
214
232
|
set keepClear(value: readonly SkyKeepClear[] | null);
|
|
215
233
|
/**
|
|
216
|
-
* Places marked on the Earth (the attribute `places`, a JSON array): each `{ id, lon, lat, label, kind }`, `kind` being `here` (where the reader is: drawn bright and taller, with a quiet pulse) or `favourite`
|
|
217
|
-
* (the default: quieter)
|
|
218
|
-
*
|
|
219
|
-
*
|
|
234
|
+
* Places marked on the Earth (the attribute `places`, a JSON array): each `{ id, lon, lat, label, kind, color }`, `kind` being `here` (where the reader is: drawn bright and taller, with a quiet pulse) or `favourite`
|
|
235
|
+
* (the default: quieter), and `color` an optional CSS colour of its own. The first `PLACE_MARKS` in sight (`here` first, then in the order given) stand up out of the ground with their names; every other place
|
|
236
|
+
* is a ring on the ground, all of them one draw call, and places that crowd are gathered into one ring with their count. They turn with the Earth, are hidden on its far side, are dimmer on its night side
|
|
237
|
+
* and keep their size in pixels at any zoom. Names never overlap one another or the bodies' names; one with no room is left out. The element stores nothing and sends nothing: the page hands the places
|
|
238
|
+
* over and keeps them where it likes. Setting the property writes the attribute; at most `MAX_PLACES` are drawn. Nothing is drawn again at rest: the pulse is the page's own animation, stopped out of sight
|
|
239
|
+
* and for a reader who asked for less motion.
|
|
220
240
|
*/
|
|
221
241
|
get places(): Place[];
|
|
222
242
|
set places(value: readonly Place[]);
|
|
243
|
+
/**
|
|
244
|
+
* Turn the view so a place of `places` is in the middle, at a pace a reader can follow (at once with `smooth: false`, for a reader who asked for less motion, or before the picture is live); the zoom stays.
|
|
245
|
+
* The place is named by its `id`, or by its label in any case. The camera must be looking at the Earth: while it rides along or looks at another body nothing moves. The tilt is held to 90 degrees either
|
|
246
|
+
* way, so a place more than 90 degrees of latitude from `center` comes as near the middle as that allows.
|
|
247
|
+
*
|
|
248
|
+
* @param text - The place's id or label.
|
|
249
|
+
* @param options - `smooth` (true by default).
|
|
250
|
+
* @returns The place, once the turn has started; `undefined` when there is no such place or the camera is not looking at the Earth.
|
|
251
|
+
*/
|
|
252
|
+
goToPlace(text: string, options?: {
|
|
253
|
+
smooth?: boolean;
|
|
254
|
+
}): Promise<Place | undefined>;
|
|
255
|
+
/**
|
|
256
|
+
* Whether places that crowd are gathered into one ring with their count (the attribute `place-groups`): on by default, `off` leaves every place its own ring. Setting the property writes the attribute.
|
|
257
|
+
*/
|
|
258
|
+
get placeGroups(): boolean;
|
|
259
|
+
set placeGroups(value: boolean);
|
|
223
260
|
/** How the places are drawn (the attribute `places-look`): `beam` (a light rising out of the ground with a ring at its foot, the default), `pin` (a thin stick with a round head) or `ring` (only the ring on the ground). */
|
|
224
261
|
get placesLook(): PlaceLook;
|
|
225
262
|
set placesLook(value: PlaceLook);
|
|
@@ -228,6 +265,27 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
228
265
|
*/
|
|
229
266
|
get cityNamesStyle(): CityNamesStyle;
|
|
230
267
|
set cityNamesStyle(value: CityNamesStyle);
|
|
268
|
+
/** Whether the meridians and parallels are drawn on the Earth (the attribute `grid`). Setting it writes the attribute, or takes it away. */
|
|
269
|
+
get grid(): boolean;
|
|
270
|
+
set grid(value: boolean);
|
|
271
|
+
/**
|
|
272
|
+
* The look of the names of countries (`country-names`): font, weight, colour, the outline round the text, and the smallest and largest text size. Any of them may be left out; the Earth's size, the
|
|
273
|
+
* language and the data are not set here.
|
|
274
|
+
*/
|
|
275
|
+
get countryNamesStyle(): CountryNamesStyle;
|
|
276
|
+
set countryNamesStyle(value: CountryNamesStyle);
|
|
277
|
+
/**
|
|
278
|
+
* Which borders are drawn on the Earth (the attribute `borders`): the countries' at any size, and the regions' (provinces, states, prefectures) once the Earth is large enough on the screen to tell them apart.
|
|
279
|
+
* Setting it writes the attribute: both sets as `borders="countries regions"`, one as its own word, none takes the attribute away.
|
|
280
|
+
*/
|
|
281
|
+
get borders(): BorderSets;
|
|
282
|
+
set borders(value: BorderSets);
|
|
283
|
+
/**
|
|
284
|
+
* Where the borders' shapes come from (see `BorderData`): `countries` in place of chizu's `world-geo`, and `regions`, a country's regions by its code, which draws the regions; without it none are drawn.
|
|
285
|
+
* Set it before `borders` is switched on: shapes already loaded are kept.
|
|
286
|
+
*/
|
|
287
|
+
get borderData(): BorderData;
|
|
288
|
+
set borderData(value: BorderData);
|
|
231
289
|
/**
|
|
232
290
|
* How many times its real thickness the air is drawn, from 1 (the true thickness) to 5 (the attribute `air-thickness`; 3 when the page says nothing): see `<chikyu-earth-realistic>`. While it is above 1 the element says so in a line
|
|
233
291
|
* under the picture (`air-label="off"` takes the line away, for a page that says it itself).
|
|
@@ -411,11 +469,14 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
411
469
|
quaternion: [number, number, number, number];
|
|
412
470
|
fov: number;
|
|
413
471
|
};
|
|
414
|
-
/** What the body painter has made at the last draw: the Sun and planets with a drawing,
|
|
472
|
+
/** What the body painter has made at the last draw: the Sun and planets with a drawing, the moons shown round a planet that is near and the moons held (shown, or gone from the view for less than four seconds), whether the Moon is the painter's (`moon`), and the bodies with finer map tiles on them (`tiles`). */
|
|
415
473
|
bodies: {
|
|
416
474
|
look: string;
|
|
417
475
|
painted: number;
|
|
418
476
|
moons: number;
|
|
477
|
+
held: number;
|
|
478
|
+
moon: boolean;
|
|
479
|
+
tiles: number;
|
|
419
480
|
};
|
|
420
481
|
/** The meteors: whether they are on, the streaks alive now and started so far, the streaks a second being drawn, and the strongest active shower's code and rate. */
|
|
421
482
|
meteors: {
|
|
@@ -460,7 +521,10 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
460
521
|
shown: boolean;
|
|
461
522
|
parts: number;
|
|
462
523
|
} | null;
|
|
463
|
-
/**
|
|
524
|
+
/**
|
|
525
|
+
* The places: how many were handed over, how many are in sight at the last draw (`shown`, those gathered into groups included), how many stand up as markers of their own (`marks`) and are named (`labels`),
|
|
526
|
+
* how many rings the one draw call draws (`sprites`) and how many of those are groups (`groups`), the satellites ringed and named, and how many times they were laid out.
|
|
527
|
+
*/
|
|
464
528
|
places: {
|
|
465
529
|
places: number;
|
|
466
530
|
shown: number;
|
|
@@ -468,6 +532,10 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
468
532
|
renders: number;
|
|
469
533
|
rings: number;
|
|
470
534
|
satelliteNames: number;
|
|
535
|
+
marks: number;
|
|
536
|
+
groups: number;
|
|
537
|
+
sprites: number;
|
|
538
|
+
omitted: number;
|
|
471
539
|
};
|
|
472
540
|
/** The names of cities: whether `city-names` is set and the most it asks for, the Earth's radius on the screen, the tiers of kuni's cities that have arrived and how many cities, the names shown at the last draw and how many times the layer was drawn. */
|
|
473
541
|
cityNames: {
|
|
@@ -479,6 +547,12 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
479
547
|
names: number;
|
|
480
548
|
renders: number;
|
|
481
549
|
};
|
|
550
|
+
/** The borders: the segments of each set, whether each was drawn at the last draw, the countries whose regions have arrived, how many times a set's lines were made, and whether a set could not be loaded. */
|
|
551
|
+
borders: BorderStats;
|
|
552
|
+
/** The grid: whether it was drawn at the last draw, whether every 15 degrees (else 30), its segments then, how many times its lines were made, and whether it could not be made. */
|
|
553
|
+
grid: GridStats;
|
|
554
|
+
/** The names of countries: whether `country-names` is set and the most it asks for, the countries loaded, the names shown at the last draw, how many times they were laid out, and whether the outlines could not be loaded. */
|
|
555
|
+
countryNames: CountryNamesStats;
|
|
482
556
|
};
|
|
483
557
|
}
|
|
484
558
|
declare global {
|