@johnmorrisdotca/chikyu-earth 0.35.0 → 0.37.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/NOTICE.md +27 -1
  3. package/README.md +20 -2
  4. package/dist/borders/layer.d.ts +75 -0
  5. package/dist/borders/layer.js +136 -0
  6. package/dist/borders/lines.d.ts +138 -0
  7. package/dist/borders/lines.js +227 -0
  8. package/dist/catalogue/index.d.ts +1 -0
  9. package/dist/catalogue/index.js +3 -2
  10. package/dist/catalogue/pack.js +3 -0
  11. package/dist/cities/host.d.ts +9 -0
  12. package/dist/cities/host.js +51 -9
  13. package/dist/country-names/geometry.d.ts +264 -0
  14. package/dist/country-names/geometry.js +372 -0
  15. package/dist/country-names/host.d.ts +82 -0
  16. package/dist/country-names/host.js +212 -0
  17. package/dist/grid/layer.d.ts +45 -0
  18. package/dist/grid/layer.js +66 -0
  19. package/dist/grid/lines.d.ts +85 -0
  20. package/dist/grid/lines.js +113 -0
  21. package/dist/markers/go-to-place.d.ts +27 -0
  22. package/dist/markers/go-to-place.js +35 -0
  23. package/dist/markers/index.d.ts +2 -1
  24. package/dist/markers/index.js +2 -1
  25. package/dist/markers/layer.d.ts +7 -0
  26. package/dist/markers/layer.js +7 -0
  27. package/dist/markers/place-layer.d.ts +58 -7
  28. package/dist/markers/place-layer.js +326 -64
  29. package/dist/markers/place-sprites.d.ts +33 -0
  30. package/dist/markers/place-sprites.js +161 -0
  31. package/dist/markers/places.d.ts +91 -6
  32. package/dist/markers/places.js +135 -6
  33. package/dist/realistic/earth.d.ts +11 -0
  34. package/dist/realistic/earth.js +55 -1
  35. package/dist/realistic/element.d.ts +75 -6
  36. package/dist/realistic/element.js +221 -33
  37. package/dist/realistic/immersive.d.ts +7 -0
  38. package/dist/realistic/immersive.js +17 -0
  39. package/dist/realistic/index.d.ts +6 -0
  40. package/dist/realistic/index.js +3 -0
  41. package/dist/realistic/textures.d.ts +5 -0
  42. package/dist/satellites/index.d.ts +1 -0
  43. package/dist/satellites/index.js +1 -0
  44. package/dist/satellites/limits.d.ts +1 -1
  45. package/dist/satellites/limits.js +1 -1
  46. package/dist/satellites/owners.d.ts +26 -0
  47. package/dist/satellites/owners.js +164 -0
  48. package/dist/satellites/source.js +3 -0
  49. package/dist/satellites/track.d.ts +5 -0
  50. package/dist/satellites/track.js +128 -0
  51. package/dist/satellites/types.d.ts +19 -1
  52. package/dist/space/element.d.ts +111 -12
  53. package/dist/space/element.js +360 -26
  54. package/dist/space/index.d.ts +2 -2
  55. package/dist/space/index.js +1 -1
  56. package/dist/space/ride.d.ts +42 -0
  57. package/dist/space/ride.js +45 -3
  58. package/dist/space/satellite-layer.d.ts +8 -2
  59. package/dist/space/satellite-layer.js +138 -19
  60. package/dist/space/scene.d.ts +56 -6
  61. package/dist/space/scene.js +97 -15
  62. package/package.json +3 -3
@@ -9,6 +9,10 @@ import type { SkyKeepClear } from "../sky/keep-clear.ts";
9
9
  import type { SkyLabelStyle } from "../sky/style.ts";
10
10
  import { type Place, type PlaceLook } from "../markers/places.ts";
11
11
  import { type CityNamesStyle } from "../cities/host.ts";
12
+ import { type BorderSets } from "../borders/lines.ts";
13
+ import type { BorderData, BorderStats } from "../borders/layer.ts";
14
+ import type { GridStats } from "../grid/layer.ts";
15
+ import { type CountryNamesStats, type CountryNamesStyle } from "../country-names/host.ts";
12
16
  import { setSharedRenderer, setThreeLoader } from "./shared.ts";
13
17
  export { setSharedRenderer, setThreeLoader };
14
18
  export type { CameraMode };
@@ -31,7 +35,10 @@ export type EarthState = "loading" | "live" | "unavailable" | "lost" | "idle";
31
35
  type SatelliteStats = {
32
36
  groups: number;
33
37
  placed: number;
38
+ segments: number;
34
39
  tooFast: boolean;
40
+ dotScale: number;
41
+ epochMs: number;
35
42
  propagations: number;
36
43
  lastBatchMs: number;
37
44
  maxBatchMs: number;
@@ -87,6 +94,13 @@ export declare const readTime: (value: string | null) => number | "now";
87
94
  * is sent when the strongest active shower changes, with `detail: { shower, zhr }` (`shower` is `null` when none is active).
88
95
  * `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.
89
96
  *
97
+ * `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`,
98
+ * 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.
99
+ *
100
+ * `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
101
+ * 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
102
+ * 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.
103
+ *
90
104
  * @example
91
105
  * ```ts no-run
92
106
  * import type { ChikyuEarthRealistic } from "@johnmorrisdotca/chikyu-earth/realistic/element";
@@ -159,13 +173,32 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
159
173
  get keepClear(): SkyKeepClear[];
160
174
  set keepClear(value: readonly SkyKeepClear[] | null);
161
175
  /**
162
- * 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`
163
- * (the default: quieter). Each stands up out of the ground, turns with the Earth, is hidden on its far side and keeps its size in pixels at any zoom. Names go at the top, `here` first, and never overlap
164
- * 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 it likes. Setting the property writes the attribute; at most
165
- * `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 for less motion.
176
+ * 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`
177
+ * (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
178
+ * 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
179
+ * 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
180
+ * 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
181
+ * for less motion.
166
182
  */
167
183
  get places(): Place[];
168
184
  set places(value: readonly Place[]);
185
+ /**
186
+ * 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
187
+ * 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
188
+ * as that allows.
189
+ *
190
+ * @param text - The place's id or label.
191
+ * @param options - `smooth` (true by default).
192
+ * @returns The place, once the turn has started; `undefined` when there is no such place.
193
+ */
194
+ goToPlace(text: string, options?: {
195
+ smooth?: boolean;
196
+ }): Promise<Place | undefined>;
197
+ /**
198
+ * 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.
199
+ */
200
+ get placeGroups(): boolean;
201
+ set placeGroups(value: boolean);
169
202
  /** 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). */
170
203
  get placesLook(): PlaceLook;
171
204
  set placesLook(value: PlaceLook);
@@ -174,6 +207,27 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
174
207
  */
175
208
  get cityNamesStyle(): CityNamesStyle;
176
209
  set cityNamesStyle(value: CityNamesStyle);
210
+ /** Whether the meridians and parallels are drawn (the attribute `grid`). Setting it writes the attribute, or takes it away. */
211
+ get grid(): boolean;
212
+ set grid(value: boolean);
213
+ /**
214
+ * 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
215
+ * language and the data are not set here.
216
+ */
217
+ get countryNamesStyle(): CountryNamesStyle;
218
+ set countryNamesStyle(value: CountryNamesStyle);
219
+ /**
220
+ * 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.
221
+ * Setting it writes the attribute: both sets as `borders="countries regions"`, one as its own word, none takes the attribute away.
222
+ */
223
+ get borders(): BorderSets;
224
+ set borders(value: BorderSets);
225
+ /**
226
+ * 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.
227
+ * Set it before `borders` is switched on: shapes already loaded are kept.
228
+ */
229
+ get borderData(): BorderData;
230
+ set borderData(value: BorderData);
177
231
  /** The controller behind the element's own hands (`set`, `fit`, `state`), while it is in a page. */
178
232
  get controller(): ViewController | undefined;
179
233
  /**
@@ -286,6 +340,10 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
286
340
  shown: number;
287
341
  labels: number;
288
342
  renders: number;
343
+ marks: number;
344
+ groups: number;
345
+ sprites: number;
346
+ omitted: number;
289
347
  };
290
348
  /** 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. */
291
349
  cityNames: {
@@ -297,16 +355,27 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
297
355
  names: number;
298
356
  renders: number;
299
357
  };
358
+ /** 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. */
359
+ borders: BorderStats;
360
+ /** 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. */
361
+ grid: GridStats;
362
+ /** 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. */
363
+ countryNames: CountryNamesStats;
300
364
  };
301
365
  /**
302
366
  * 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,
303
367
  * and draws are at most 30 a second.
304
368
  */
305
369
  setView(view: GlobeView, final?: boolean): void;
370
+ /**
371
+ * 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"`.
372
+ */
373
+ get satelliteTint(): "off" | "orbit";
374
+ set satelliteTint(value: "off" | "orbit");
306
375
  /**
307
376
  * 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
308
377
  * 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
309
- * between, are hidden while the clock runs faster than `MAX_SATELLITE_SPEED`, 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.
378
+ * 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.
310
379
  *
311
380
  * @param group - The group's name, for `showSatellites`, `selectSatellite` and the events.
312
381
  * @param satellites - The group, or `null` to remove it.
@@ -325,7 +394,7 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
325
394
  selectSatellite(ref: SatelliteRef | null): void;
326
395
  /** The satellite marked by `selectSatellite` or by a press on it, if any. */
327
396
  get selectedSatellite(): SatelliteRef | null;
328
- /** Facts about one satellite at the moment shown (name, number, element age, height, speed, period); undefined if it cannot be placed then. */
397
+ /** 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. */
329
398
  satelliteInfo(ref: SatelliteRef): SatelliteInfo | undefined;
330
399
  /** The view as it is (for a page that wants to read it back). */
331
400
  get view(): GlobeView;
@@ -4,9 +4,9 @@
4
4
  import { carryControls } from "@johnmorrisdotca/kazoku-ui/view-controls";
5
5
  import { adoptStyles } from "../adopt.js";
6
6
  import { airFor, readAirThickness } from "./air.js";
7
+ import { IMMERSIVE_STYLE, immersiveWheel } from "./immersive.js";
7
8
  import { NOTES_STYLE, setAirNote } from "./air-note.js";
8
9
  import { cameraCentre, createEarthItem, discRadius, lookAt, newModel } from "./earth.js";
9
- import { MAX_SATELLITE_SPEED } from "../satellites/limits.js";
10
10
  import { MAX_ORBIT_GROUP } from "../space/satellite-layer.js";
11
11
  import { readMeteorStrength } from "../meteors/strength.js";
12
12
  import { METEOR_NOTE_STYLE, prefersLessMotion, setMeteorNote } from "../meteors/note.js";
@@ -15,15 +15,21 @@ import { folderSource } from "../door/map.js";
15
15
  import { ownCredit } from "../door/own.js";
16
16
  import { BODY_LABEL_ATTRIBUTES, bodyLabelText, loadMichroma, readBodyLabel } from "./body-label.js";
17
17
  import { createSkyHost, SKY_ATTRIBUTES, SKY_STYLE } from "../sky/host.js";
18
- import { cleanPlaces, orthoView, readPlaces } from "../markers/places.js";
18
+ import { cleanPlaces, orthoView, readPlaceGroups, readPlaces } from "../markers/places.js";
19
19
  import { createPlaceLayer, PLACE_STYLE, readPlaceLook } from "../markers/place-layer.js";
20
+ import { aimAt, findPlace, glideView } from "../markers/go-to-place.js";
21
+ import { subsolarPoint } from "./sun.js";
20
22
  import { CITY_NAMES_ATTRIBUTES, CITY_NAMES_STYLE, createCityHost } from "../cities/host.js";
21
23
  import { project } from "../markers/project.js";
24
+ import { BORDER_ATTRIBUTES, readBorders } from "../borders/lines.js";
25
+ import { GRID_ATTRIBUTES, readGrid } from "../grid/lines.js";
26
+ import { COUNTRY_NAMES_ATTRIBUTES } from "../country-names/geometry.js";
27
+ import { COUNTRY_NAMES_STYLE, createCountryHost } from "../country-names/host.js";
22
28
  import { createGate, frameCap } from "./gate.js";
23
29
  import { setSharedRenderer, setThreeLoader, takeRenderer } from "./shared.js";
24
30
  export { setSharedRenderer, setThreeLoader };
25
31
  import { MAX_TEXTURE, TIERS } from "./tiers.js";
26
- const STYLE = ":host{display:block;aspect-ratio:1/1;position:relative;isolation:isolate}:host([immersive]){aspect-ratio:auto;width:100%;height:100%;touch-action:none!important;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}#stage,#overlay{position:absolute;inset:0}#overlay{pointer-events:none}" + PLACE_STYLE + SKY_STYLE + CITY_NAMES_STYLE + METEOR_NOTE_STYLE + NOTES_STYLE;
32
+ const STYLE = ":host{display:block;aspect-ratio:1/1;position:relative;isolation:isolate}" + IMMERSIVE_STYLE + "#stage,#overlay{position:absolute;inset:0}#overlay{pointer-events:none}" + PLACE_STYLE + SKY_STYLE + COUNTRY_NAMES_STYLE + CITY_NAMES_STYLE + METEOR_NOTE_STYLE + NOTES_STYLE;
27
33
  const RAD = Math.PI / 180;
28
34
  /** The Sun and the clouds are re-placed this often at real time: 15 degrees an hour is 0.25 degree a minute. */
29
35
  const LIVE_TICK_MS = 60_000;
@@ -48,8 +54,6 @@ const readCentre = (value) => {
48
54
  const readCamera = (value) => (value === "ground" || value === "sun" ? value : "space");
49
55
  /** A `cloud-drift` attribute: degrees an hour the clouds are made to move eastward against the ground (0, the default: where the picture has them). */
50
56
  const readDrift = (value) => (value !== null && Number.isFinite(Number(value)) ? Number(value) : 0);
51
- /** The plain wheel in an immersive view is a pinch of this share: a notch (100) zooms about 1.2 times, as the family's mouse wheel does with Alt. */
52
- const WHEEL_AS_PINCH = 0.2;
53
57
  /** The quickest a satellite goes round, degrees a second (a low orbit: 88 minutes). */
54
58
  const SATELLITE_RATE = 360 / (88 * 60);
55
59
  const SATELLITE_COLORS = ["#ffd54f", "#7fd4ff", "#ff8fa3", "#9ef0a8"];
@@ -116,6 +120,13 @@ export const readTime = (value) => {
116
120
  * is sent when the strongest active shower changes, with `detail: { shower, zhr }` (`shower` is `null` when none is active).
117
121
  * `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.
118
122
  *
123
+ * `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`,
124
+ * 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.
125
+ *
126
+ * `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
127
+ * 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
128
+ * 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.
129
+ *
119
130
  * @example
120
131
  * ```ts no-run
121
132
  * import type { ChikyuEarthRealistic } from "@johnmorrisdotca/chikyu-earth/realistic/element";
@@ -134,7 +145,7 @@ export const readTime = (value) => {
134
145
  * ```
135
146
  */
136
147
  export class ChikyuEarthRealistic extends HTMLElement {
137
- static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "data", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look"];
148
+ static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "data", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "satellite-tint"];
138
149
  #model = newModel();
139
150
  #mode = "now";
140
151
  #view;
@@ -161,9 +172,14 @@ export class ChikyuEarthRealistic extends HTMLElement {
161
172
  /** The names of cities on the Earth (`city-names`), and the look of the names. */
162
173
  #cities;
163
174
  #citiesStyle = {};
175
+ /** The names of the countries on the Earth (`country-names`), and the look of the names. */
176
+ #countries;
177
+ #countriesStyle = {};
164
178
  #listeners = new Set();
165
179
  #placeLayer;
166
180
  #placeList = [];
181
+ /** Counts the turns to a place, so a new one stops the one before. */
182
+ #placeGlide = 0;
167
183
  #hands;
168
184
  #reach = null;
169
185
  /** The page has set a `speed` since the element came into the page: for a reader who prefers reduced motion, that is the Play that lets meteors start. */
@@ -220,13 +236,26 @@ export class ChikyuEarthRealistic extends HTMLElement {
220
236
  this.#placeList = readPlaces(this.getAttribute("places"));
221
237
  this.#placeLayer.set(this.#placeList);
222
238
  this.#placeLayer.look = readPlaceLook(this.getAttribute("places-look"));
239
+ this.#placeLayer.grouping = readPlaceGroups(this.getAttribute("place-groups"));
223
240
  this.#cities = createCityHost({
224
241
  root,
225
242
  attribute: (name) => this.getAttribute(name),
226
243
  language: () => ((this.closest("[lang]")?.getAttribute("lang") ?? "").toLowerCase().startsWith("ja") ? "ja" : "en"),
227
244
  onError: (error) => this.dispatchEvent(new CustomEvent("chikyu-city-names-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } })),
245
+ onLayout: () => this.#countryFrame(),
228
246
  });
229
247
  this.#cities.setStyle(this.#citiesStyle);
248
+ Object.assign(this.#model.borders, readBorders(this.getAttribute("borders")));
249
+ this.#model.borders.onError = (error) => this.dispatchEvent(new CustomEvent("chikyu-borders-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } }));
250
+ this.#model.grid.on = readGrid(this.getAttribute("grid"));
251
+ this.#model.grid.onError = (error) => this.dispatchEvent(new CustomEvent("chikyu-grid-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } }));
252
+ this.#countries = createCountryHost({
253
+ root,
254
+ attribute: (name) => this.getAttribute(name),
255
+ language: () => ((this.closest("[lang]")?.getAttribute("lang") ?? "").toLowerCase().startsWith("ja") ? "ja" : "en"),
256
+ onError: (error) => this.dispatchEvent(new CustomEvent("chikyu-country-names-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } })),
257
+ });
258
+ this.#countries.setStyle(this.#countriesStyle);
230
259
  this.#played = false;
231
260
  this.#model.meteors.on = this.#meteorsAsked();
232
261
  this.#model.meteors.strength = readMeteorStrength(this.getAttribute("meteors-strength"));
@@ -268,16 +297,24 @@ export class ChikyuEarthRealistic extends HTMLElement {
268
297
  onTiled: () => this.#door.announce(),
269
298
  onSky: (sky) => this.#sky?.frame(sky),
270
299
  onLabelError: (error) => this.dispatchEvent(new CustomEvent("chikyu-body-label-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } })),
300
+ placeSprites: () => this.#placeLayer?.sprites ?? null,
271
301
  onPose: (pose) => {
272
302
  if (this.#hands)
273
303
  this.#hands.controller.grabRadius = discRadius(pose.width, pose.height, 1);
274
304
  this.#pose = { ...pose, transform: "" };
275
- for (const listener of this.#listeners)
276
- listener(this.#pose);
305
+ this.#posing = true;
306
+ try {
307
+ for (const listener of this.#listeners)
308
+ listener(this.#pose);
309
+ }
310
+ finally {
311
+ this.#posing = false;
312
+ }
277
313
  if (this.#placeLayer && (this.#placeList.length > 0 || this.#placeLayer.stats.shown > 0))
278
- this.#placeLayer.frame(orthoView(pose));
314
+ this.#placeLayer.frame(orthoView(pose), [], [], this.#model.light === "lit" ? null : subsolarPoint(this.#model.time));
279
315
  this.#cityFrame();
280
316
  },
317
+ onPlaceRings: (drawn) => this.#ringsDrawn(drawn),
281
318
  onSatellitesError: (error) => this.dispatchEvent(new CustomEvent("chikyu-satellites-unavailable", { detail: { reason: error instanceof Error ? error.message : String(error) } })),
282
319
  onError: (error) => this.#fail(error instanceof Error ? error.message : String(error)),
283
320
  onTier: (layer, width) => {
@@ -331,6 +368,8 @@ export class ChikyuEarthRealistic extends HTMLElement {
331
368
  this.#placeLayer = undefined;
332
369
  this.#cities?.dispose();
333
370
  this.#cities = undefined;
371
+ this.#countries?.dispose();
372
+ this.#countries = undefined;
334
373
  }
335
374
  attributeChangedCallback(name, _old, value) {
336
375
  if (name === "center")
@@ -373,6 +412,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
373
412
  this.#applyBodyLabel();
374
413
  this.#sky?.refresh();
375
414
  this.#cities?.refresh();
415
+ this.#countries?.refresh();
376
416
  }
377
417
  }
378
418
  else if (BODY_LABEL_ATTRIBUTES.includes(name))
@@ -388,8 +428,26 @@ export class ChikyuEarthRealistic extends HTMLElement {
388
428
  this.#placeLayer.look = readPlaceLook(value);
389
429
  this.#gate?.soon();
390
430
  }
431
+ else if (name === "place-groups" && this.#placeLayer) {
432
+ this.#placeLayer.grouping = readPlaceGroups(value);
433
+ this.#gate?.soon();
434
+ }
391
435
  else if (CITY_NAMES_ATTRIBUTES.includes(name))
392
436
  this.#cities?.refresh();
437
+ else if (name === "borders") {
438
+ Object.assign(this.#model.borders, readBorders(value));
439
+ this.#gate?.soon();
440
+ }
441
+ else if (name === "grid") {
442
+ this.#model.grid.on = readGrid(value);
443
+ this.#gate?.soon();
444
+ }
445
+ else if (COUNTRY_NAMES_ATTRIBUTES.includes(name))
446
+ this.#countries?.refresh();
447
+ else if (name === "satellite-tint") {
448
+ this.#model.satellites.orbitTint = value === "orbit";
449
+ this.#gate?.soon();
450
+ }
393
451
  if (name === "air-thickness" || name === "air-label" || name === "lang")
394
452
  setAirNote(this.#airNote, this, this.#model.airThickness);
395
453
  }
@@ -504,10 +562,12 @@ export class ChikyuEarthRealistic extends HTMLElement {
504
562
  this.#sky?.setKeepClear(this.#keepClear);
505
563
  }
506
564
  /**
507
- * 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`
508
- * (the default: quieter). Each stands up out of the ground, turns with the Earth, is hidden on its far side and keeps its size in pixels at any zoom. Names go at the top, `here` first, and never overlap
509
- * 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 it likes. Setting the property writes the attribute; at most
510
- * `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 for less motion.
565
+ * 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`
566
+ * (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
567
+ * 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
568
+ * 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
569
+ * 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
570
+ * for less motion.
511
571
  */
512
572
  get places() {
513
573
  return this.#placeList.map((place) => ({ ...place }));
@@ -519,6 +579,55 @@ export class ChikyuEarthRealistic extends HTMLElement {
519
579
  else
520
580
  this.setAttribute("places", JSON.stringify(clean));
521
581
  }
582
+ /**
583
+ * 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
584
+ * 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
585
+ * as that allows.
586
+ *
587
+ * @param text - The place's id or label.
588
+ * @param options - `smooth` (true by default).
589
+ * @returns The place, once the turn has started; `undefined` when there is no such place.
590
+ */
591
+ async goToPlace(text, options = {}) {
592
+ const place = findPlace(this.#placeList, text);
593
+ if (!place)
594
+ return undefined;
595
+ const view = this.#model.view;
596
+ const from = { yaw: view.yaw, tilt: view.tilt };
597
+ const to = aimAt(cameraCentre(this.#model), place, from);
598
+ const bar = this.hasAttribute("data-kazoku-bar") && this.id ? this.getRootNode().querySelector?.(`kazoku-view-controls[for="${CSS.escape(this.id)}"]`) : null;
599
+ const controls = (bar ? Reflect.get(bar, "controller") : undefined) ?? this.#hands?.controller;
600
+ const glide = (this.#placeGlide += 1);
601
+ const set = (yaw, tilt, final) => {
602
+ if (controls)
603
+ controls.set({ yaw, tilt }, final, "place");
604
+ else
605
+ this.setView({ ...this.#model.view, yaw, tilt }, final);
606
+ };
607
+ glideView(set, from, to, options.smooth !== false && !prefersLessMotion() && this.#view?.live === true, () => glide === this.#placeGlide && this.isConnected);
608
+ return { ...place };
609
+ }
610
+ /**
611
+ * 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.
612
+ */
613
+ get placeGroups() {
614
+ return this.#placeLayer?.grouping ?? readPlaceGroups(this.getAttribute("place-groups"));
615
+ }
616
+ set placeGroups(value) {
617
+ if (value)
618
+ this.removeAttribute("place-groups");
619
+ else
620
+ this.setAttribute("place-groups", "off");
621
+ }
622
+ /** The picture said whether it can draw the rings of the places that are not markers of their own. Without `Points` the places' layer draws them itself and the page is told once, so no place is lost without a word. */
623
+ #ringsDrawn(drawn) {
624
+ if (!this.#placeLayer || this.#placeLayer.ringsInPicture === drawn)
625
+ return;
626
+ this.#placeLayer.ringsInPicture = drawn;
627
+ if (!drawn)
628
+ this.dispatchEvent(new CustomEvent("chikyu-places-unavailable", { detail: { reason: "the three.js parts handed over lack Points: the places' rings are drawn as small circles in the page, at most 600, and stats.places.omitted counts the rest" } }));
629
+ this.#gate?.soon();
630
+ }
522
631
  /** 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). */
523
632
  get placesLook() {
524
633
  return this.#placeLayer?.look ?? readPlaceLook(this.getAttribute("places-look"));
@@ -536,22 +645,81 @@ export class ChikyuEarthRealistic extends HTMLElement {
536
645
  this.#citiesStyle = { ...value };
537
646
  this.#cities?.setStyle(this.#citiesStyle);
538
647
  }
539
- /** Tells the names of cities where the Earth is in the picture just drawn: the orthographic view the markers share. */
648
+ /** Whether the meridians and parallels are drawn (the attribute `grid`). Setting it writes the attribute, or takes it away. */
649
+ get grid() {
650
+ return readGrid(this.getAttribute("grid"));
651
+ }
652
+ set grid(value) {
653
+ if (value)
654
+ this.setAttribute("grid", "");
655
+ else
656
+ this.removeAttribute("grid");
657
+ }
658
+ /**
659
+ * 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
660
+ * language and the data are not set here.
661
+ */
662
+ get countryNamesStyle() {
663
+ return { ...this.#countriesStyle };
664
+ }
665
+ set countryNamesStyle(value) {
666
+ this.#countriesStyle = { ...value };
667
+ this.#countries?.setStyle(this.#countriesStyle);
668
+ }
669
+ /**
670
+ * 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.
671
+ * Setting it writes the attribute: both sets as `borders="countries regions"`, one as its own word, none takes the attribute away.
672
+ */
673
+ get borders() {
674
+ return readBorders(this.getAttribute("borders"));
675
+ }
676
+ set borders(value) {
677
+ const words = [value.countries ? "countries" : "", value.regions ? "regions" : ""].filter(Boolean);
678
+ if (words.length === 0)
679
+ this.removeAttribute("borders");
680
+ else
681
+ this.setAttribute("borders", words.join(" "));
682
+ }
683
+ /**
684
+ * 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.
685
+ * Set it before `borders` is switched on: shapes already loaded are kept.
686
+ */
687
+ get borderData() {
688
+ return { ...this.#model.borders.data };
689
+ }
690
+ set borderData(value) {
691
+ this.#model.borders.data = { ...value };
692
+ this.#gate?.soon();
693
+ }
694
+ /** Tells the names of cities, then of countries, where the Earth is in the picture just drawn (the orthographic view the markers share); the countries' names keep clear of the places' and the cities'. */
540
695
  #cityFrame() {
541
696
  const pose = this.#pose;
542
697
  if (!this.#cities || !pose)
543
698
  return;
544
- this.#cities.frame({
699
+ const frame = {
545
700
  width: pose.width,
546
701
  height: pose.height,
547
702
  radius: pose.radius,
703
+ disc: { x: pose.cx, y: pose.cy, radius: pose.radius },
548
704
  project: (lon, lat, out) => {
549
705
  const at = project(lon, lat, pose);
550
706
  out.x = at.x;
551
707
  out.y = at.y;
552
708
  return at.z;
553
709
  },
554
- });
710
+ };
711
+ this.#cities.frame(frame);
712
+ this.#nameFrame = frame;
713
+ this.#countryFrame();
714
+ }
715
+ /** The frame the names were last laid out on. */
716
+ #nameFrame = null;
717
+ /** Lays the countries' names out on the last frame, clear of the places' and the cities' names as they are now. */
718
+ #countryFrame() {
719
+ const countries = this.#countries;
720
+ if (!countries || !this.#nameFrame)
721
+ return;
722
+ countries.frame(this.#nameFrame, countries.stats.on ? [...(this.#placeLayer?.boxes ?? []), ...(this.#cities?.boxes ?? []), ...[...this.#claims.values()].flat()] : []);
555
723
  }
556
724
  /** Puts the name's settings and text right from the attributes (`body-label` and its family, `lang`). */
557
725
  #applyBodyLabel() {
@@ -631,8 +799,21 @@ export class ChikyuEarthRealistic extends HTMLElement {
631
799
  this.#listeners.add(listener);
632
800
  return () => this.#listeners.delete(listener);
633
801
  },
802
+ claim: (owner, boxes) => {
803
+ if (boxes.length === 0)
804
+ this.#claims.delete(owner);
805
+ else
806
+ this.#claims.set(owner, boxes);
807
+ // laid out again only when the overlay changed between draws: at a draw the names are laid out after it anyway
808
+ if (!this.#posing)
809
+ this.#countryFrame();
810
+ },
634
811
  };
635
812
  }
813
+ /** The boxes overlays on the element (markers) take, by overlay. */
814
+ #claims = new Map();
815
+ /** True while the overlays are told of a draw. */
816
+ #posing = false;
636
817
  /** Where the view starts: longitude and latitude; the shared controls' yaw and tilt turn it from there. */
637
818
  get centre() {
638
819
  return { ...this.#model.centre };
@@ -739,8 +920,11 @@ export class ChikyuEarthRealistic extends HTMLElement {
739
920
  meteors: { on: this.#model.meteors.on, strength: this.#model.meteors.strength, ...this.#model.meteors.drawn },
740
921
  bodyLabel: { on: this.#model.bodyLabel.settings !== null, text: this.#model.bodyLabel.text, ...this.#model.bodyLabel.drawn },
741
922
  sky: this.#sky?.stats ?? { on: false, loaded: false, names: 0, figures: 0, picked: null, pick: null, hover: null, constellations: 0, culture: "iau", renders: 0, lang: "", stars: [] },
742
- places: { ...(this.#placeLayer?.stats ?? { places: 0, shown: 0, labels: 0, renders: 0 }) },
923
+ places: { ...(this.#placeLayer?.stats ?? { places: 0, shown: 0, labels: 0, renders: 0, marks: 0, groups: 0, sprites: 0, omitted: 0 }) },
743
924
  cityNames: this.#cities?.stats ?? { on: false, max: 0, radius: 0, tiers: [], cities: 0, names: 0, renders: 0 },
925
+ borders: { ...this.#model.borders.stats, shown: { ...this.#model.borders.stats.shown }, loaded: [...this.#model.borders.stats.loaded] },
926
+ grid: { ...this.#model.grid.stats },
927
+ countryNames: this.#countries?.stats ?? { on: false, max: 0, countries: 0, names: 0, renders: 0, failed: false },
744
928
  };
745
929
  }
746
930
  /**
@@ -762,10 +946,22 @@ export class ChikyuEarthRealistic extends HTMLElement {
762
946
  this.#gate?.soon();
763
947
  }
764
948
  // --- satellites ---------------------------------------------------------------------------------------------------------------------------------
949
+ /**
950
+ * 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"`.
951
+ */
952
+ get satelliteTint() {
953
+ return this.#model.satellites.orbitTint ? "orbit" : "off";
954
+ }
955
+ set satelliteTint(value) {
956
+ if (value === "orbit")
957
+ this.setAttribute("satellite-tint", "orbit");
958
+ else
959
+ this.removeAttribute("satellite-tint");
960
+ }
765
961
  /**
766
962
  * 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
767
963
  * 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
768
- * between, are hidden while the clock runs faster than `MAX_SATELLITE_SPEED`, 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.
964
+ * 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.
769
965
  *
770
966
  * @param group - The group's name, for `showSatellites`, `selectSatellite` and the events.
771
967
  * @param satellites - The group, or `null` to remove it.
@@ -816,7 +1012,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
816
1012
  const chosen = this.#model.satellites.selected;
817
1013
  return chosen ? { ...chosen } : null;
818
1014
  }
819
- /** Facts about one satellite at the moment shown (name, number, element age, height, speed, period); undefined if it cannot be placed then. */
1015
+ /** 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. */
820
1016
  satelliteInfo(ref) {
821
1017
  return this.#model.satellites.groups.get(ref.group)?.satellites.info(ref.index, this.#model.time);
822
1018
  }
@@ -830,7 +1026,10 @@ export class ChikyuEarthRealistic extends HTMLElement {
830
1026
  lastBatchMs = Math.max(lastBatchMs, group.satellites.timing.lastBatchMs);
831
1027
  maxBatchMs = Math.max(maxBatchMs, group.satellites.timing.maxBatchMs);
832
1028
  }
833
- return { groups: this.#model.satellites.groups.size, placed: drawn.placed, tooFast: drawn.tooFast, propagations, lastBatchMs, maxBatchMs, updateMs: drawn.updateMs, maxUpdateMs: drawn.maxUpdateMs, averageUpdateMs: drawn.updates ? drawn.totalMs / drawn.updates : 0, updates: drawn.updates };
1029
+ let epochMs = 0;
1030
+ for (const group of this.#model.satellites.groups.values())
1031
+ epochMs = Math.max(epochMs, group.satellites.newestEpochMs);
1032
+ return { groups: this.#model.satellites.groups.size, placed: drawn.placed, segments: drawn.segments, tooFast: drawn.tooFast, dotScale: drawn.dotScale, epochMs, propagations, lastBatchMs, maxBatchMs, updateMs: drawn.updateMs, maxUpdateMs: drawn.maxUpdateMs, averageUpdateMs: drawn.updates ? drawn.totalMs / drawn.updates : 0, updates: drawn.updates };
834
1033
  }
835
1034
  // 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.
836
1035
  #downX = 0;
@@ -850,16 +1049,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
850
1049
  if (satellite)
851
1050
  this.dispatchEvent(new CustomEvent("chikyu-satellite-click", { detail: { ...satellite, info: this.satelliteInfo(satellite) }, bubbles: true, composed: true }));
852
1051
  };
853
- // In an immersive view a plain wheel zooms. It is passed on to the shared hands as the wheel's own pinch (Ctrl and a small step), so whichever hands hold the view (the element's, or a bar bound to it) apply it with their limits;
854
- // Ctrl, Command, Alt and Shift with the wheel are the family's own and are left alone.
855
- #wheel = (event) => {
856
- if (!this.hasAttribute("immersive") || event.ctrlKey || event.metaKey || event.altKey || event.shiftKey)
857
- return;
858
- event.preventDefault();
859
- event.stopImmediatePropagation();
860
- const pixels = event.deltaMode === 1 ? event.deltaY * 33 : event.deltaMode === 2 ? event.deltaY * 800 : event.deltaY;
861
- this.dispatchEvent(new WheelEvent("wheel", { deltaY: Math.max(-250, Math.min(250, pixels)) * WHEEL_AS_PINCH, deltaMode: 0, clientX: event.clientX, clientY: event.clientY, ctrlKey: true, bubbles: true, cancelable: true, composed: true }));
862
- };
1052
+ #wheel = (event) => immersiveWheel(this, event);
863
1053
  /** The view as it is (for a page that wants to read it back). */
864
1054
  get view() {
865
1055
  return { ...this.#model.view };
@@ -886,10 +1076,8 @@ export class ChikyuEarthRealistic extends HTMLElement {
886
1076
  const radius = this.#model.drawn?.radius ?? 200;
887
1077
  return Math.min(live, 1000 / Math.min(30, Math.max(1, (satellites ? SATELLITE_RATE : SUN_RATE) * RAD * speed * radius)));
888
1078
  }
889
- /** Is anything on show that moves faster than the Earth turns: a group of satellites the clock is slow enough to place? */
1079
+ /** Is anything on show that moves faster than the Earth turns: a group of satellites, including above the interpolation limit where they are drawn as streaks? */
890
1080
  #satellitesMoving() {
891
- if (Math.abs(this.speed) > MAX_SATELLITE_SPEED)
892
- return false;
893
1081
  for (const group of this.#model.satellites.groups.values())
894
1082
  if (group.visible && group.satellites.count > 0)
895
1083
  return true;
@@ -0,0 +1,7 @@
1
+ /** The host's styles in the immersive mode: any shape of box, and a touch drag that turns the view instead of scrolling the page. */
2
+ export declare const IMMERSIVE_STYLE = ":host([immersive]){aspect-ratio:auto;width:100%;height:100%;touch-action:none!important;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}";
3
+ /**
4
+ * In an immersive view a plain wheel zooms. It is passed on to the shared hands as the wheel's own pinch (Ctrl and a small step), so whichever hands hold the view (the element's, or a bar bound to it) apply it with their
5
+ * limits; Ctrl, Command, Alt and Shift with the wheel are the family's own and are left alone. Listen with `{ capture: true, passive: false }`, before the shared hands.
6
+ */
7
+ export declare function immersiveWheel(host: HTMLElement, event: WheelEvent): void;
@@ -0,0 +1,17 @@
1
+ // The full-screen mode of the 3D elements (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.
2
+ /** The plain wheel in an immersive view is a pinch of this share: a notch (100) zooms about 1.2 times, as the family's mouse wheel does with Alt. */
3
+ const WHEEL_AS_PINCH = 0.2;
4
+ /** The host's styles in the immersive mode: any shape of box, and a touch drag that turns the view instead of scrolling the page. */
5
+ export const IMMERSIVE_STYLE = ":host([immersive]){aspect-ratio:auto;width:100%;height:100%;touch-action:none!important;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}";
6
+ /**
7
+ * In an immersive view a plain wheel zooms. It is passed on to the shared hands as the wheel's own pinch (Ctrl and a small step), so whichever hands hold the view (the element's, or a bar bound to it) apply it with their
8
+ * limits; Ctrl, Command, Alt and Shift with the wheel are the family's own and are left alone. Listen with `{ capture: true, passive: false }`, before the shared hands.
9
+ */
10
+ export function immersiveWheel(host, event) {
11
+ if (!host.hasAttribute("immersive") || event.ctrlKey || event.metaKey || event.altKey || event.shiftKey)
12
+ return;
13
+ event.preventDefault();
14
+ event.stopImmediatePropagation();
15
+ const pixels = event.deltaMode === 1 ? event.deltaY * 33 : event.deltaMode === 2 ? event.deltaY * 800 : event.deltaY;
16
+ host.dispatchEvent(new WheelEvent("wheel", { deltaY: Math.max(-250, Math.min(250, pixels)) * WHEEL_AS_PINCH, deltaMode: 0, clientX: event.clientX, clientY: event.clientY, ctrlKey: true, bubbles: true, cancelable: true, composed: true }));
17
+ }