@johnmorrisdotca/chikyu-earth 0.38.0 → 0.39.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 +8 -0
- package/README.md +2 -1
- package/dist/paint/buffer.d.ts +6 -1
- package/dist/paint/buffer.js +151 -68
- package/dist/paint/texture.d.ts +16 -6
- package/dist/paint/texture.js +46 -27
- package/dist/realistic/earth.d.ts +1 -1
- package/dist/realistic/earth.js +3 -3
- package/dist/realistic/element-base.d.ts +437 -0
- package/dist/realistic/element-base.js +1209 -0
- package/dist/realistic/element.d.ts +2 -431
- package/dist/realistic/element.js +3 -1203
- package/dist/realistic/index.d.ts +1 -1
- package/dist/realistic/no-cultures.d.ts +1 -0
- package/dist/realistic/no-cultures.js +2 -0
- package/dist/realistic/tiles.d.ts +24 -0
- package/dist/realistic/tiles.js +30 -12
- package/dist/sky/culture-source.d.ts +15 -0
- package/dist/sky/culture-source.js +15 -0
- package/dist/sky/cultures.d.ts +1 -0
- package/dist/sky/cultures.js +8 -0
- package/dist/sky/host.js +144 -18
- package/dist/space/element-base.d.ts +624 -0
- package/dist/space/element-base.js +1627 -0
- package/dist/space/element.d.ts +2 -612
- package/dist/space/element.js +3 -1597
- package/dist/space/no-cultures.d.ts +1 -0
- package/dist/space/no-cultures.js +2 -0
- package/dist/space/scene.d.ts +8 -1
- package/dist/space/scene.js +41 -3
- package/package.json +23 -3
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
import { type ViewController } from "@johnmorrisdotca/kazoku-ui/view-controls";
|
|
2
|
+
import type { GeoPoint, GlobeView } from "../types.ts";
|
|
3
|
+
import { type CameraMode, type LightMode } from "./earth.ts";
|
|
4
|
+
import { type PaintSpec } from "../paint/buffer.ts";
|
|
5
|
+
import type { SatelliteInfo, SatelliteRef, Satellites } from "../satellites/types.ts";
|
|
6
|
+
import { type SatelliteStyle } from "../space/satellite-layer.ts";
|
|
7
|
+
import type { Credit, DataSource } from "../data-door.ts";
|
|
8
|
+
import { type BodyLabelSettings } from "./body-label.ts";
|
|
9
|
+
import type { SkyKeepClear } from "../sky/keep-clear.ts";
|
|
10
|
+
import type { SkyLabelStyle } from "../sky/style.ts";
|
|
11
|
+
import { type Place, type PlaceLook } from "../markers/places.ts";
|
|
12
|
+
import { type CityNamesStyle } from "../cities/host.ts";
|
|
13
|
+
import { type BorderSets } from "../borders/lines.ts";
|
|
14
|
+
import type { BorderData, BorderStats } from "../borders/layer.ts";
|
|
15
|
+
import type { GridStats } from "../grid/layer.ts";
|
|
16
|
+
import { type CountryNamesStats, type CountryNamesStyle } from "../country-names/host.ts";
|
|
17
|
+
import { setSharedRenderer, setThreeLoader } from "./shared.ts";
|
|
18
|
+
export { setSharedRenderer, setThreeLoader };
|
|
19
|
+
export type { CameraMode };
|
|
20
|
+
import type { OverlayHost } from "../markers/layer.ts";
|
|
21
|
+
import { type Layer } from "./tiers.ts";
|
|
22
|
+
import type { TileStats } from "./tile-set.ts";
|
|
23
|
+
type EarthLayer = Extract<Layer, "day" | "night" | "clouds" | "water">;
|
|
24
|
+
/**
|
|
25
|
+
* What the realistic Earth is doing: `loading` its pictures, `live` and drawing, `unavailable` (no WebGL), `lost` (the GPU took the context; it comes back by itself) or `idle` (another view has the page's one WebGL context; press or focus it to take it).
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts no-run
|
|
29
|
+
* import type { ChikyuEarthRealistic, EarthState } from "@johnmorrisdotca/chikyu-earth/realistic/element";
|
|
30
|
+
*
|
|
31
|
+
* const describe = (earth: ChikyuEarthRealistic): EarthState => earth.stats.state;
|
|
32
|
+
* console.log(typeof describe);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export type EarthState = "loading" | "live" | "unavailable" | "lost" | "idle";
|
|
36
|
+
type SatelliteStats = {
|
|
37
|
+
groups: number;
|
|
38
|
+
placed: number;
|
|
39
|
+
segments: number;
|
|
40
|
+
tooFast: boolean;
|
|
41
|
+
dotScale: number;
|
|
42
|
+
epochMs: number;
|
|
43
|
+
propagations: number;
|
|
44
|
+
lastBatchMs: number;
|
|
45
|
+
maxBatchMs: number;
|
|
46
|
+
updateMs: number;
|
|
47
|
+
maxUpdateMs: number;
|
|
48
|
+
averageUpdateMs: number;
|
|
49
|
+
updates: number;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* A `speed` attribute: how many seconds pass for each real second.
|
|
53
|
+
*
|
|
54
|
+
* @param value - The attribute's text, or `null` when it is not there.
|
|
55
|
+
* @returns The speed, or `null` when the value is empty or not a number (the clock then follows `time`: real time for "now", held for a date).
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts no-run
|
|
59
|
+
* import { readSpeed } from "@johnmorrisdotca/chikyu-earth/realistic/element";
|
|
60
|
+
*
|
|
61
|
+
* console.log(readSpeed("86400"), readSpeed("-3600"), readSpeed(null));
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare const readSpeed: (value: string | null) => number | null;
|
|
65
|
+
/**
|
|
66
|
+
* A `time` attribute: "now" (or none) follows the clock, else an ISO date such as 2026-06-21T12:00:00Z.
|
|
67
|
+
*
|
|
68
|
+
* @param value - The attribute's text, or `null` when it is not there.
|
|
69
|
+
* @returns The moment in milliseconds since the Unix epoch, or `"now"` when the value is empty, `"now"` or not a date.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts no-run
|
|
73
|
+
* import { readTime } from "@johnmorrisdotca/chikyu-earth/realistic/element";
|
|
74
|
+
*
|
|
75
|
+
* console.log(readTime("2026-06-21T12:00:00Z"), readTime(null), readTime("tomorrow"));
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare const readTime: (value: string | null) => number | "now";
|
|
79
|
+
/**
|
|
80
|
+
* The `<chikyu-earth-realistic>` custom element: the Earth from space, drawn with three.js through kazoku-ui's shared renderer (one WebGL context for the page). It takes `center` (`"lon,lat"`), `time` (`now` or an ISO date; the real Sun at that moment), `clouds="off"`, `lights="off"`, `live-seconds`, `texture-base` (where the pictures are served from), `tiles` (where a set of finer map tiles is served from, see the Earth tiles guide: only the tiles in view are loaded, over the package's own pictures, which stay as the far view and the fallback; without it, or when a tile cannot be fetched, the Earth is drawn as before) and `max-ratio` (the most device pixels to a CSS pixel the canvas is drawn at, 2 at most, and `0.5` draws at half the size and scales it up: for a background; read when the element connects, and it is the shared renderer's cap for the whole page), and a shared view controller's camera through `setView`. It draws only when something changes, at most 30 times a second, and nothing while it is out of sight or the tab is hidden.
|
|
81
|
+
*
|
|
82
|
+
* It has a clock, like `<chikyu-space>`'s: `speed` is how many seconds pass for each real second (`1` is real time, `0` holds, `3600` is an hour a second, `86400` a day a second, a negative number runs backwards), and the clock runs from `time`, the moment shown.
|
|
83
|
+
* The Sun's light, the night side and the clouds follow it. Without a `speed`, nothing about a page from before changes: `time="now"` (or no `time`) follows the real clock, the Sun and the clouds put right every `live-seconds` (a minute by default, a second at the least),
|
|
84
|
+
* and a date holds still. A `speed` runs the clock from the moment shown at that rate (from now, when `time` is "now"); `speed="0"` holds it. At real time it steps every `live-seconds`; faster, it draws as often as the Sun's turn moves a pixel, once a second at least and 30 a second at most
|
|
85
|
+
* (a reader who prefers reduced motion gets one step a second), and nothing at all while it is held, out of sight or in a hidden tab.
|
|
86
|
+
*
|
|
87
|
+
* While time runs it sends `chikyu-timechange` with `detail: { time, running: true }` (the moment shown in milliseconds since 1970), at most four times a second however fast the picture is drawn and not from a hidden tab, and once with `running: false` when the clock holds
|
|
88
|
+
* (a date is set, or `speed` is 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.
|
|
89
|
+
*
|
|
90
|
+
* `meteors` (the attribute, with or without a value other than `off`; the property is a boolean) draws meteors as they look from space: short streaks 80 to 120 km up,
|
|
91
|
+
* only where it is dark or twilight, more of them where an active shower's radiant stands high and on the side that faces the Earth's way. Each streak's place and
|
|
92
|
+
* moment are drawn at random (and said so in a line under the picture, which `meteors-label="off"` takes away for a page that says it itself); how many there are,
|
|
93
|
+
* where they fall, their height and the showers' dates are real (`@johnmorrisdotca/chikyu-earth/meteors`). They run while the clock runs, at any speed, and not
|
|
94
|
+
* at all while it is held, out of sight, in a hidden tab, or for a reader who prefers reduced motion until the page sets a `speed` (a Play). `chikyu-meteors`
|
|
95
|
+
* is sent when the strongest active shower changes, with `detail: { shower, zhr }` (`shower` is `null` when none is active).
|
|
96
|
+
* `meteors-strength` (0 to 1, the property `meteorsStrength`; 1 when the page says nothing) makes them subtler: fewer streaks and fainter ones, none at 0, and nothing that is real changes.
|
|
97
|
+
*
|
|
98
|
+
* `borders` draws the borders on the land as thin lines that turn with the Earth: `countries` (chizu's, at any size), `regions` (provinces, states and the like, from the page's `borderData.regions`,
|
|
99
|
+
* once the Earth is large enough to tell them apart), or both with a bare attribute. The shapes are loaded only when a set is switched on; `chikyu-borders-unavailable` is sent when they cannot be.
|
|
100
|
+
*
|
|
101
|
+
* `grid` draws the meridians and parallels on the Earth (every 30 degrees while it is small on the screen, every 15 once it is large), with the equator, the tropics, the polar circles and the prime
|
|
102
|
+
* meridian picked out, light on the day side and dim on the night side. `country-names` names the countries at the middle of the part of each in view, in the page's language, never over another
|
|
103
|
+
* name, as many as fit (40 at most, or the number given); the outlines are loaded only when it is set, and `chikyu-country-names-unavailable` is sent when they cannot be.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts no-run
|
|
107
|
+
* import type { ChikyuEarthRealistic } from "@johnmorrisdotca/chikyu-earth/realistic/element";
|
|
108
|
+
*
|
|
109
|
+
* const earth = document.createElement("chikyu-earth-realistic") as ChikyuEarthRealistic;
|
|
110
|
+
* earth.setAttribute("center", "139.7,35.7");
|
|
111
|
+
* earth.setAttribute("time", "2026-06-21T03:00Z");
|
|
112
|
+
* earth.setAttribute("texture-base", "/textures/");
|
|
113
|
+
* earth.setAttribute("tiles", "/tiles/");
|
|
114
|
+
* earth.setAttribute("speed", "86400");
|
|
115
|
+
* earth.placeGroups = false; // place-groups="off": every place keeps its own ring
|
|
116
|
+
* earth.paint = { id: "25544", length: "1d", swath: "track" };
|
|
117
|
+
* earth.clearPaint();
|
|
118
|
+
* earth.setAttribute("star-names", "12");
|
|
119
|
+
* earth.addEventListener("chikyu-sky-pick", (event) => {
|
|
120
|
+
* const pick = (event as CustomEvent<{ kind: string; name?: string; abbreviation?: string }>).detail;
|
|
121
|
+
* console.log(pick.kind, pick.name ?? pick.abbreviation);
|
|
122
|
+
* });
|
|
123
|
+
* earth.addEventListener("chikyu-timechange", (event) => {
|
|
124
|
+
* const { time, running } = (event as CustomEvent<{ time: number; running: boolean }>).detail;
|
|
125
|
+
* console.log(new Date(time).toISOString(), running ? "running" : "held");
|
|
126
|
+
* });
|
|
127
|
+
* document.body.append(earth);
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
131
|
+
#private;
|
|
132
|
+
static observedAttributes: string[];
|
|
133
|
+
connectedCallback(): void;
|
|
134
|
+
disconnectedCallback(): void;
|
|
135
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
136
|
+
/**
|
|
137
|
+
* 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). The shell, and the heights over which the air thins, are that many times larger, and the
|
|
138
|
+
* air's own light is the same, so a ring that is a hair's breadth at whole-Earth zoom can be seen. While it is above 1 the element says so in a line under the picture (`air-label="off"` takes the line away, for a page that says it itself).
|
|
139
|
+
*/
|
|
140
|
+
get airThickness(): number;
|
|
141
|
+
set airThickness(value: number);
|
|
142
|
+
/**
|
|
143
|
+
* Meteors seen from space, on or off (the attribute `meteors`): see the class's description. Off by default, and nothing of theirs is made until they are first switched on.
|
|
144
|
+
*/
|
|
145
|
+
get meteors(): boolean;
|
|
146
|
+
set meteors(value: boolean);
|
|
147
|
+
/**
|
|
148
|
+
* How strongly the meteors are drawn, from 0 to 1 (the attribute `meteors-strength`; 1, the full look, when the page says nothing): it scales how bright each streak is and how many are drawn, so 0.3 is
|
|
149
|
+
* fewer and fainter and 0 draws none. It changes nothing that is real: the rates, the showers and `chikyu-meteors` are the same at every strength, and the line under the picture still says the streaks are an illustration.
|
|
150
|
+
* A number outside the range is brought to its nearest end; setting the property writes the attribute.
|
|
151
|
+
*/
|
|
152
|
+
get meteorsStrength(): number;
|
|
153
|
+
set meteorsStrength(value: number);
|
|
154
|
+
/**
|
|
155
|
+
* The name written on the Earth, as the family's body label: `EARTH` (`地球` on a Japanese page) laid on the globe so it turns with it, the surface showing through the letters. Off (`null`) unless the page sets it. The plain attributes are the family's:
|
|
156
|
+
* `body-label` (`painted`, `etched`, `outline` or `burned`; absent, no label), `body-label-strength` (0 to 1, 0.5), `body-label-repeat` (`once`, `both` or `around`), `body-label-latitude` (degrees), `body-label-facing` (present: always facing the reader),
|
|
157
|
+
* `body-label-font` (a CSS font family the page has loaded; Michroma, fetched once, when left out) and `body-label-fallback-font` (for letters the font has none of, such as Japanese). The property is the same options as an object, or `null`; setting it writes the attributes.
|
|
158
|
+
* Nothing of it is fetched or made until it is first set, it is not drawn while the Earth is under 24 pixels in radius, and nothing is drawn at rest. A three.js handed over with `setThreeLoader` must include `CanvasTexture`, `SphereGeometry`, `MeshLambertMaterial`, `SRGBColorSpace`, `NormalBlending`
|
|
159
|
+
* and `AdditiveBlending`; without them `chikyu-body-label-unavailable` is sent and the name is not drawn.
|
|
160
|
+
*/
|
|
161
|
+
get bodyLabel(): BodyLabelSettings | null;
|
|
162
|
+
set bodyLabel(value: Partial<BodyLabelSettings> | null);
|
|
163
|
+
/**
|
|
164
|
+
* The names of the brightest stars and the constellations as faint lines, laid over the sky the page draws (hoshi-stars' `sky-labels`, an optional peer loaded only when one of these is set). The plain attributes are hoshi's: `star-names` (a count of the brightest stars in view and not covered by the
|
|
165
|
+
* Earth, the Moon or the Sun; bare is 10), `star-names-magnitude` (only stars at least that bright) and `constellation-lines` (the 88 figures as lines at this strength, 0 to 1; bare is 0.16): none of them, and nothing is loaded. The figure under the pointer or touched is at full strength and shows its name. Names are in the
|
|
166
|
+
* page's language and never overlap. Nothing is redrawn at rest. `chikyu-sky-unavailable` is sent when hoshi-stars is not there. The property is the look of the names, a partial `SkyLabelStyle` (font, size, case, ring, leader and the rest).
|
|
167
|
+
*/
|
|
168
|
+
get skyStyle(): Partial<SkyLabelStyle>;
|
|
169
|
+
set skyStyle(value: Partial<SkyLabelStyle>);
|
|
170
|
+
/**
|
|
171
|
+
* The constellation that is picked, by its IAU abbreviation (`Ori`), or `null`. A reader picks one by a click or a tap on its lines or inside its figure (and with the key `C`, or `Shift`+`C` for the previous, while the element has the focus); a click on empty sky, or `Escape`, lets it go. The picked figure's lines are lit and its name is
|
|
172
|
+
* shown at the middle of the part of it in view, until another is picked or it is let go. A page sets the property to pick one itself, which sends no event. `chikyu-constellation-pick` is sent at each pick of the reader's, with `detail` `{ abbreviation, id, name, english, japanese, kind, culture }` (`culture` is `iau` unless `constellation-culture` names another), and `null` when it is let go; `chikyu-constellation-hover` is sent the same way as a mouse rests on a figure and leaves it.
|
|
173
|
+
* A press or a tap on a named star, or on a figure, also sends `chikyu-sky-pick`: a star is `{ kind: "star", hr, name, designation, x, y, pointerType }` (`name` as drawn, `x` and `y` CSS pixels inside the element) and a figure is `{ kind: "constellation", abbreviation, pointerType }`. Each named star and each figure in view is a button, so a keyboard reaches it and Enter picks it, and the pick is read out; the keys `C` and `Shift`+`C` (the next and the previous figure) send it too. Nothing is drawn at rest.
|
|
174
|
+
* Needs `constellation-lines` set. `constellation-culture` (`iau` by default, `western`, `japanese` or `chinese`; each is fetched only when asked for, and the value is exactly what the page sets) makes the figures, the pick and the names those of that sky culture. The attribute `constellation-names` (off by default) writes the name of every figure in view at the middle of the part of it that is on the picture, quieter than the star names and clear of them, of the Earth, the Moon, the Sun, the places and satellites named, and of the places kept clear (`keepClear`).
|
|
175
|
+
*/
|
|
176
|
+
get constellation(): string | null;
|
|
177
|
+
set constellation(value: string | null);
|
|
178
|
+
/**
|
|
179
|
+
* Places on the picture where the sky's names must not go: a page's own text laid over the element, say. Each is a rectangle in the element's own CSS pixels from its top left (`{ x, y, width, height }`), or an element of the page whose box is read. A star name whose box touches
|
|
180
|
+
* one is left out, and so is a star whose point is in one (the next star is named instead); the picked constellation's name is moved clear of it. The lines are still drawn. The boxes are read when the list changes, when the page or an element is resized or scrolled, and not at each frame: a
|
|
181
|
+
* page that moves its text without resizing it sets the property again. The attribute `keep-clear` takes a CSS selector for the same (`keep-clear=".hero h1, .hero .lead"`). Nothing is redrawn at rest.
|
|
182
|
+
*/
|
|
183
|
+
get keepClear(): SkyKeepClear[];
|
|
184
|
+
set keepClear(value: readonly SkyKeepClear[] | null);
|
|
185
|
+
/**
|
|
186
|
+
* 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`
|
|
187
|
+
* (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
|
|
188
|
+
* 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
|
|
189
|
+
* and keep their size in pixels at any zoom. Names never overlap one another; one with no room is left out. The element stores nothing and sends nothing: the page hands the places over and keeps them where
|
|
190
|
+
* 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 and for a reader who asked
|
|
191
|
+
* for less motion.
|
|
192
|
+
*/
|
|
193
|
+
get places(): Place[];
|
|
194
|
+
set places(value: readonly Place[]);
|
|
195
|
+
/**
|
|
196
|
+
* Turn the Earth 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
|
|
197
|
+
* and pan stay. The place is named by its `id`, or by its label in any case. The tilt is held to 90 degrees either way, so a place more than 90 degrees of latitude from `center` comes as near the middle
|
|
198
|
+
* as that allows.
|
|
199
|
+
*
|
|
200
|
+
* @param text - The place's id or label.
|
|
201
|
+
* @param options - `smooth` (true by default).
|
|
202
|
+
* @returns The place, once the turn has started; `undefined` when there is no such place.
|
|
203
|
+
*/
|
|
204
|
+
goToPlace(text: string, options?: {
|
|
205
|
+
smooth?: boolean;
|
|
206
|
+
}): Promise<Place | undefined>;
|
|
207
|
+
/**
|
|
208
|
+
* 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.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```ts no-run
|
|
212
|
+
* import type { ChikyuEarthRealistic } from "@johnmorrisdotca/chikyu-earth/realistic/element";
|
|
213
|
+
*
|
|
214
|
+
* const earth = document.querySelector("chikyu-earth-realistic") as ChikyuEarthRealistic;
|
|
215
|
+
* earth.placeGroups = false;
|
|
216
|
+
* earth.getAttribute("place-groups"); // "off"
|
|
217
|
+
* earth.placeGroups = true;
|
|
218
|
+
* earth.hasAttribute("place-groups"); // false
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
get placeGroups(): boolean;
|
|
222
|
+
set placeGroups(value: boolean);
|
|
223
|
+
/** 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
|
+
get placesLook(): PlaceLook;
|
|
225
|
+
set placesLook(value: PlaceLook);
|
|
226
|
+
/**
|
|
227
|
+
* The look of the names of cities (`city-names`): font, size, weight, colour, the outline round the text, and the dot's colour and size. Any of them may be left out; the Earth's size, the language and the data are not set here.
|
|
228
|
+
*/
|
|
229
|
+
get cityNamesStyle(): CityNamesStyle;
|
|
230
|
+
set cityNamesStyle(value: CityNamesStyle);
|
|
231
|
+
/** Whether the meridians and parallels are drawn (the attribute `grid`). Setting it writes the attribute, or takes it away. */
|
|
232
|
+
get grid(): boolean;
|
|
233
|
+
set grid(value: boolean);
|
|
234
|
+
/**
|
|
235
|
+
* 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
|
|
236
|
+
* language and the data are not set here.
|
|
237
|
+
*/
|
|
238
|
+
get countryNamesStyle(): CountryNamesStyle;
|
|
239
|
+
set countryNamesStyle(value: CountryNamesStyle);
|
|
240
|
+
/**
|
|
241
|
+
* Which borders are drawn (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.
|
|
242
|
+
* Setting it writes the attribute: both sets as `borders="countries regions"`, one as its own word, none takes the attribute away.
|
|
243
|
+
*/
|
|
244
|
+
get borders(): BorderSets;
|
|
245
|
+
set borders(value: BorderSets);
|
|
246
|
+
/**
|
|
247
|
+
* 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.
|
|
248
|
+
* Set it before `borders` is switched on: shapes already loaded are kept.
|
|
249
|
+
*/
|
|
250
|
+
get borderData(): BorderData;
|
|
251
|
+
set borderData(value: BorderData);
|
|
252
|
+
/** The controller behind the element's own hands (`set`, `fit`, `state`), while it is in a page. */
|
|
253
|
+
get controller(): ViewController | undefined;
|
|
254
|
+
/**
|
|
255
|
+
* The outside sources of map this Earth draws from (the data door): each carries its own licence and credit, and a map source for the `day` or `night` layer takes the place of the folder of tiles for that layer. Assign a list to
|
|
256
|
+
* replace them; a source that is refused (an empty credit, no licence, a clashing id, a kind the Earth does not draw, a layer it does not know) throws a `TypeError` and nothing changes. A property, never an attribute: data is not text.
|
|
257
|
+
*/
|
|
258
|
+
get sources(): readonly DataSource[];
|
|
259
|
+
set sources(list: readonly unknown[]);
|
|
260
|
+
/** Adds an outside source of map: checked at once (a `TypeError` for one that is refused), and the Earth draws from it. Returns the function that takes it away. */
|
|
261
|
+
addSource(source: unknown): () => void;
|
|
262
|
+
/** Takes a source away by its id: its loads stop, its tiles are freed, its credit goes. Returns whether there was one. */
|
|
263
|
+
removeSource(id: string): boolean;
|
|
264
|
+
/** Switches a source off (`false`) or on again, and keeps it in the Earth: a layers panel's switch. The attribute `data="own"` ignores every outside source at once. */
|
|
265
|
+
enableSource(id: string, on: boolean): void;
|
|
266
|
+
/**
|
|
267
|
+
* Whose data is in the last drawn frame: the package's own first (its pictures; its finer tiles while a window of them is in view) and then each outside source that gave a tile, with how many (`used`). `creditLine(credits, "en" | "ja")`
|
|
268
|
+
* from `@johnmorrisdotca/chikyu-earth/door` writes them as a line with the licences. `chikyu-creditschange` fires when this set changes (not at each frame), with `detail: { credits }`.
|
|
269
|
+
*/
|
|
270
|
+
credits(): Credit[];
|
|
271
|
+
/** Where the finer map tiles are served from (a folder with `manifest.json`), or `null` for none; the attribute `tiles`. The Earth loads only the tiles in view, over its own pictures. */
|
|
272
|
+
get tiles(): string | null;
|
|
273
|
+
set tiles(value: string | null);
|
|
274
|
+
/** A box laid over the Earth for markers (see `@johnmorrisdotca/chikyu-earth/markers`): where it is, the pose of the last draw, and a way to hear the next. */
|
|
275
|
+
get overlay(): OverlayHost;
|
|
276
|
+
/** Where the view starts: longitude and latitude; the shared controls' yaw and tilt turn it from there. */
|
|
277
|
+
get centre(): GeoPoint;
|
|
278
|
+
set centre(value: GeoPoint);
|
|
279
|
+
/**
|
|
280
|
+
* How the camera is held (the `camera` attribute). `space` (the default): held in the stars, looking at the place `center` names as it is at the
|
|
281
|
+
* moment the camera is set (when the element opens, and again when `time` or `center` is set), so the Earth turns beneath it as the clock runs, with the day and night line where the Sun really is. `ground`: over the place `center` names on the ground, so the Earth keeps still and the clock moves the light across it. `sun`: held on the Sun's side, `center` being the longitude and
|
|
282
|
+
* latitude from the sub-solar point (`0,0` looks straight at the noon place and shows no night), so the day and night line keeps its place on the screen while the Earth turns beneath. A drag turns the view about the same body in any of them.
|
|
283
|
+
*/
|
|
284
|
+
get camera(): CameraMode;
|
|
285
|
+
set camera(value: CameraMode);
|
|
286
|
+
/** True for the full-screen mode (the `immersive` attribute): the element fills its box in any shape, a plain wheel zooms instead of scrolling the page, and a touch drag turns the view instead of scrolling. */
|
|
287
|
+
get immersive(): boolean;
|
|
288
|
+
set immersive(value: boolean);
|
|
289
|
+
/** The moment shown: milliseconds since the epoch, or "now" while it follows the real clock. The clock runs from it at `speed`, so a number read while time runs is the moment it has reached. */
|
|
290
|
+
get time(): number | "now";
|
|
291
|
+
set time(value: number | Date | "now");
|
|
292
|
+
/**
|
|
293
|
+
* Seconds of time for each real second: `1` is real time, `0` holds, `3600` is an hour a second, `86400` a day a second, a negative number runs backwards. Without one (the attribute `speed` left out) the clock
|
|
294
|
+
* follows `time`: real time for "now", held for a date. Reading it gives the speed in force. Setting it is setting the attribute (and `null`-like, a value that is not a number, takes it off); it works out the moment shown up to now at the old speed first, so a hold keeps the moment the reader saw last.
|
|
295
|
+
*/
|
|
296
|
+
get speed(): number;
|
|
297
|
+
set speed(value: number);
|
|
298
|
+
get clouds(): boolean;
|
|
299
|
+
set clouds(value: boolean);
|
|
300
|
+
/** How the Earth is lit: `sun` (true, the default), `lit` (always lit: the night side is never a black frame) or `boost` (the true terminator with the night side raised). */
|
|
301
|
+
get light(): LightMode;
|
|
302
|
+
set light(value: LightMode);
|
|
303
|
+
get lights(): boolean;
|
|
304
|
+
set lights(value: boolean);
|
|
305
|
+
/** What the element is doing, for a page or a test: its state, the texture widths held, the map tiles held, the draws made. */
|
|
306
|
+
get stats(): {
|
|
307
|
+
state: EarthState;
|
|
308
|
+
tiers: Record<EarthLayer, number>;
|
|
309
|
+
tiles: TileStats;
|
|
310
|
+
satellites: SatelliteStats;
|
|
311
|
+
draws: number;
|
|
312
|
+
contexts: number;
|
|
313
|
+
canvas: {
|
|
314
|
+
width: number;
|
|
315
|
+
height: number;
|
|
316
|
+
pixels: number;
|
|
317
|
+
};
|
|
318
|
+
assets: {
|
|
319
|
+
entries: number;
|
|
320
|
+
refs: number;
|
|
321
|
+
};
|
|
322
|
+
/** 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. */
|
|
323
|
+
meteors: {
|
|
324
|
+
on: boolean;
|
|
325
|
+
strength: number;
|
|
326
|
+
alive: number;
|
|
327
|
+
spawned: number;
|
|
328
|
+
perSecond: number;
|
|
329
|
+
shower: string | null;
|
|
330
|
+
zhr: number;
|
|
331
|
+
};
|
|
332
|
+
/** The name written on the Earth: whether `body-label` is set, its text, the label is made, and it is showing (it is hidden while the Earth is small). */
|
|
333
|
+
bodyLabel: {
|
|
334
|
+
on: boolean;
|
|
335
|
+
text: string;
|
|
336
|
+
made: boolean;
|
|
337
|
+
showing: boolean;
|
|
338
|
+
};
|
|
339
|
+
/** The names of the stars and the constellation lines: whether one is asked for, whether hoshi-stars is loaded, the names and figures laid out at the last draw, the figure picked, how many times the layer was drawn, the language its names were last laid out in, and the named stars' own points on the screen (`stars`). */
|
|
340
|
+
sky: {
|
|
341
|
+
on: boolean;
|
|
342
|
+
loaded: boolean;
|
|
343
|
+
names: number;
|
|
344
|
+
figures: number;
|
|
345
|
+
picked: string | null;
|
|
346
|
+
pick: string | null;
|
|
347
|
+
hover: string | null;
|
|
348
|
+
constellations: number;
|
|
349
|
+
culture: string;
|
|
350
|
+
renders: number;
|
|
351
|
+
lang: string;
|
|
352
|
+
stars: {
|
|
353
|
+
text: string;
|
|
354
|
+
x: number;
|
|
355
|
+
y: number;
|
|
356
|
+
}[];
|
|
357
|
+
};
|
|
358
|
+
/** The places: how many were handed over, how many are drawn and named at the last draw, and how many times they were laid out. `sprites` is the rings in the picture's one draw call (0 when it cannot draw them); `dots` is the circles drawn in the page instead. */
|
|
359
|
+
places: {
|
|
360
|
+
places: number;
|
|
361
|
+
shown: number;
|
|
362
|
+
labels: number;
|
|
363
|
+
renders: number;
|
|
364
|
+
marks: number;
|
|
365
|
+
groups: number;
|
|
366
|
+
sprites: number;
|
|
367
|
+
dots: number;
|
|
368
|
+
omitted: number;
|
|
369
|
+
};
|
|
370
|
+
/** 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. */
|
|
371
|
+
cityNames: {
|
|
372
|
+
on: boolean;
|
|
373
|
+
max: number;
|
|
374
|
+
radius: number;
|
|
375
|
+
tiers: string[];
|
|
376
|
+
cities: number;
|
|
377
|
+
names: number;
|
|
378
|
+
renders: number;
|
|
379
|
+
};
|
|
380
|
+
/** 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. */
|
|
381
|
+
borders: BorderStats;
|
|
382
|
+
/** 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. */
|
|
383
|
+
grid: GridStats;
|
|
384
|
+
/** 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. */
|
|
385
|
+
countryNames: CountryNamesStats;
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* Apply a shared view controller's camera (yaw, tilt, zoom, pan). A change under half a pixel is not drawn, a settled change always is,
|
|
389
|
+
* and draws are at most 30 a second.
|
|
390
|
+
*/
|
|
391
|
+
setView(view: GlobeView, final?: boolean): void;
|
|
392
|
+
/**
|
|
393
|
+
* Colour each satellite by its orbit class (low, medium, geostationary, highly elliptical, other). Off by default, so a group keeps the colour it was given. The attribute is `satellite-tint="orbit"`.
|
|
394
|
+
*/
|
|
395
|
+
get satelliteTint(): "off" | "orbit";
|
|
396
|
+
set satelliteTint(value: "off" | "orbit");
|
|
397
|
+
/**
|
|
398
|
+
* Show a group of satellites (made by `createSatellites`) under a name, or take the group away with `null`. A group is one draw call however many satellites it holds, so every group of the catalogue can be shown at once. Giving the name of a group
|
|
399
|
+
* that is already shown replaces it. `style`: `color` and `size` (CSS pixels) of the dots, and `orbits` to draw every orbit (only for a group of 40 or fewer, such as the stations). The groups are placed by SGP4 about once a second and interpolated
|
|
400
|
+
* between. Above `MAX_SATELLITE_SPEED` each satellite is a short streak along its orbit instead of being hidden. They are hidden by the Earth when they are behind it, and draw at most 30 times a second and not at all while the clock holds.
|
|
401
|
+
*
|
|
402
|
+
* @param group - The group's name, for `showSatellites`, `selectSatellite` and the events.
|
|
403
|
+
* @param satellites - The group, or `null` to remove it.
|
|
404
|
+
* @param style - How to draw it.
|
|
405
|
+
*/
|
|
406
|
+
/**
|
|
407
|
+
* Paint one satellite's path on the Earth. `id` is a NORAD catalogue number or `group:index`. `length` is how long the trail is kept, in simulated time (`1d` when left out, or `1w`, `1m`). `swath` is `track` (the point under the satellite, the default) or `coverage` (where it is at least 10° above the horizon). Setting another satellite clears the trail. `null` clears it.
|
|
408
|
+
*/
|
|
409
|
+
get paint(): PaintSpec | null;
|
|
410
|
+
set paint(value: PaintSpec | null);
|
|
411
|
+
/** Take the painted trail off the Earth. */
|
|
412
|
+
clearPaint(): void;
|
|
413
|
+
/** Texels the trail has painted. 0 after `clearPaint`, and again when the painted satellite changes. */
|
|
414
|
+
get paintPixels(): number;
|
|
415
|
+
setSatellites(group: string, satellites: Satellites | null, style?: Partial<SatelliteStyle>): void;
|
|
416
|
+
/** Show or hide a group without losing it. */
|
|
417
|
+
showSatellites(group: string, on: boolean): void;
|
|
418
|
+
/** The groups now set, with how many satellites each holds and whether it is shown. */
|
|
419
|
+
get satelliteGroups(): {
|
|
420
|
+
name: string;
|
|
421
|
+
count: number;
|
|
422
|
+
visible: boolean;
|
|
423
|
+
}[];
|
|
424
|
+
/** Mark one satellite: a larger ring round it and its orbit drawn. `null` lets it go. */
|
|
425
|
+
selectSatellite(ref: SatelliteRef | null): void;
|
|
426
|
+
/** The satellite marked by `selectSatellite` or by a press on it, if any. */
|
|
427
|
+
get selectedSatellite(): SatelliteRef | null;
|
|
428
|
+
/** Facts about one satellite at the moment shown (name, number, element age, height, speed, period, and `ownerCountry` when the owner is one country); undefined if it cannot be placed then. */
|
|
429
|
+
satelliteInfo(ref: SatelliteRef): SatelliteInfo | undefined;
|
|
430
|
+
/** The view as it is (for a page that wants to read it back). */
|
|
431
|
+
get view(): GlobeView;
|
|
432
|
+
}
|
|
433
|
+
declare global {
|
|
434
|
+
interface HTMLElementTagNameMap {
|
|
435
|
+
"chikyu-earth-realistic": ChikyuEarthRealistic;
|
|
436
|
+
}
|
|
437
|
+
}
|