@johnmorrisdotca/chikyu-earth 0.31.0 → 0.33.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 (46) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/NOTICE.md +10 -1
  3. package/README.md +32 -2
  4. package/dist/catalogue/fleets.d.ts +70 -0
  5. package/dist/catalogue/fleets.js +66 -0
  6. package/dist/catalogue/index.d.ts +5 -0
  7. package/dist/catalogue/index.js +7 -0
  8. package/dist/catalogue/kinds.d.ts +143 -0
  9. package/dist/catalogue/kinds.js +121 -0
  10. package/dist/catalogue/omm.d.ts +44 -0
  11. package/dist/catalogue/omm.js +92 -0
  12. package/dist/catalogue/orbit.d.ts +95 -0
  13. package/dist/catalogue/orbit.js +91 -0
  14. package/dist/catalogue/pack.d.ts +193 -0
  15. package/dist/catalogue/pack.js +327 -0
  16. package/dist/data/meteor-iau.d.ts +79 -0
  17. package/dist/data/meteor-iau.js +77 -0
  18. package/dist/data/meteor-showers.js +24 -20
  19. package/dist/data-door.d.ts +2 -0
  20. package/dist/data-door.js +4 -2
  21. package/dist/door/index.d.ts +1 -0
  22. package/dist/door/index.js +1 -0
  23. package/dist/door/packed.d.ts +64 -0
  24. package/dist/door/packed.js +91 -0
  25. package/dist/meteors/index.d.ts +2 -0
  26. package/dist/meteors/index.js +2 -0
  27. package/dist/meteors/parents.d.ts +45 -0
  28. package/dist/meteors/parents.js +67 -0
  29. package/dist/realistic/body-label.d.ts +126 -0
  30. package/dist/realistic/body-label.js +187 -0
  31. package/dist/realistic/earth.d.ts +8 -0
  32. package/dist/realistic/earth.js +29 -0
  33. package/dist/realistic/element.d.ts +35 -0
  34. package/dist/realistic/element.js +78 -2
  35. package/dist/realistic/index.d.ts +1 -0
  36. package/dist/realistic/index.js +1 -0
  37. package/dist/realistic/textures.d.ts +8 -0
  38. package/dist/satellites/source.d.ts +4 -0
  39. package/dist/satellites/source.js +2 -2
  40. package/dist/sky/host.d.ts +55 -0
  41. package/dist/sky/host.js +382 -0
  42. package/dist/space/element.d.ts +35 -0
  43. package/dist/space/element.js +78 -2
  44. package/dist/space/scene.d.ts +8 -0
  45. package/dist/space/scene.js +34 -0
  46. package/package.json +12 -2
@@ -6,6 +6,7 @@ import { createTrack, orbitPath, PLANETS } from "./ephemeris.js";
6
6
  import { placeAround, placeMoon, placeSun, RADIUS } from "./scale.js";
7
7
  import { ridePose } from "./ride.js";
8
8
  import { createSatelliteLayer, newSatelliteState } from "./satellite-layer.js";
9
+ import { createBodyLabelLayer, newBodyLabelState } from "../realistic/body-label.js";
9
10
  import { createMeteorLayer, newMeteorState } from "../meteors/layer.js";
10
11
  import { subsolarPoint, unitVector } from "../realistic/sun.js";
11
12
  const RAD = Math.PI / 180;
@@ -81,6 +82,7 @@ export const newSpaceModel = () => ({
81
82
  rideMotion: 0,
82
83
  satellites: newSatelliteState(),
83
84
  meteors: newMeteorState(),
85
+ bodyLabel: newBodyLabelState(),
84
86
  pick: null,
85
87
  ratio: () => Math.min(globalThis.devicePixelRatio || 1, 2),
86
88
  });
@@ -263,6 +265,7 @@ export function createSpaceItem(model, deps) {
263
265
  let releaseTimer;
264
266
  let meteors = null;
265
267
  let meteorTimer;
268
+ let nameOn = null;
266
269
  let layer;
267
270
  const rideState = new Float64Array(6);
268
271
  let selectedShown = false;
@@ -587,6 +590,36 @@ export function createSpaceItem(model, deps) {
587
590
  }
588
591
  deps.onLabels(places);
589
592
  }
593
+ // the name written on the Earth: made the first time the settings ask for it; none while a ride along a body hides the Earth
594
+ if (model.bodyLabel.settings && !nameOn)
595
+ nameOn = createBodyLabelLayer(three, earth, model.bodyLabel, { invalidate: () => deps.invalidate(), ...(deps.onLabelError ? { onError: deps.onLabelError } : {}) });
596
+ nameOn?.sync(camera, rideFrom ? 0 : Math.min(px.Earth, 1e5));
597
+ if (deps.onSky) {
598
+ const sky = new three.Vector3();
599
+ // stars are directions: a point far along the direction from the camera, in the scene's axes (x to the vernal equinox, y north, z completing the hand), seen through the camera
600
+ const reach = Math.max(10, Math.min(camera.far * 0.5, 1000));
601
+ const discs = [];
602
+ for (const name of ["Earth", "Moon", "Sun"]) {
603
+ const at = pos[name];
604
+ sky.set(at[0], at[1], at[2]).project(camera);
605
+ if (sky.z > 1 || sky.z < -1)
606
+ continue;
607
+ discs.push({ x: ((sky.x + 1) / 2) * size.width, y: ((1 - sky.y) / 2) * size.height, radius: Math.min(px[name], 1e5) });
608
+ }
609
+ deps.onSky({
610
+ width: size.width,
611
+ height: size.height,
612
+ discs,
613
+ project(rightAscension, declination, out) {
614
+ const r = rightAscension * RAD;
615
+ const d = declination * RAD;
616
+ sky.set(Math.cos(d) * Math.cos(r), Math.sin(d), -Math.cos(d) * Math.sin(r)).multiplyScalar(reach).add(camera.position).project(camera);
617
+ out.x = ((sky.x + 1) / 2) * size.width;
618
+ out.y = ((1 - sky.y) / 2) * size.height;
619
+ return sky.z > -1 && sky.z < 1;
620
+ },
621
+ });
622
+ }
590
623
  if (layer && deps.onSelected) {
591
624
  const at = model.satellites.selected ? layer.place(camera, size) : null;
592
625
  if (at || selectedShown)
@@ -622,6 +655,7 @@ export function createSpaceItem(model, deps) {
622
655
  if (meteorTimer !== undefined)
623
656
  clearTimeout(meteorTimer);
624
657
  meteors?.dispose();
658
+ nameOn?.dispose();
625
659
  layer?.dispose();
626
660
  model.pick = null;
627
661
  textures.dispose();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/chikyu-earth",
3
- "version": "0.31.0",
3
+ "version": "0.33.0",
4
4
  "description": "Chikyu Earth 地球 — A line-drawn globe for the web: country outlines that turn at the Earth's own rate, centred on where you are, with an optional realistic Earth from space (three.js), the Sun, Moon and planets, satellites on their orbits, and markers for any place. A web component and an SVG string.",
5
5
  "keywords": [
6
6
  "earth",
@@ -149,6 +149,11 @@
149
149
  "import": "./dist/sheets/index.js",
150
150
  "default": "./dist/sheets/index.js"
151
151
  },
152
+ "./catalogue": {
153
+ "types": "./dist/catalogue/index.d.ts",
154
+ "import": "./dist/catalogue/index.js",
155
+ "default": "./dist/catalogue/index.js"
156
+ },
152
157
  "./package.json": "./package.json"
153
158
  },
154
159
  "files": [
@@ -190,10 +195,11 @@
190
195
  },
191
196
  "dependencies": {
192
197
  "@johnmorrisdotca/chizu": "^1.6.0",
193
- "@johnmorrisdotca/kazoku-ui": "^0.27.0",
198
+ "@johnmorrisdotca/kazoku-ui": "^0.36.0",
194
199
  "d3-geo": "^3.1.1"
195
200
  },
196
201
  "peerDependencies": {
202
+ "@johnmorrisdotca/hoshi-stars": ">=0.30.0",
197
203
  "@johnmorrisdotca/wakusei-planets": ">=0.5.0",
198
204
  "astronomy-engine": ">=2.1.0",
199
205
  "satellite.js": ">=6.0.0",
@@ -211,6 +217,9 @@
211
217
  },
212
218
  "@johnmorrisdotca/wakusei-planets": {
213
219
  "optional": true
220
+ },
221
+ "@johnmorrisdotca/hoshi-stars": {
222
+ "optional": true
214
223
  }
215
224
  },
216
225
  "devDependencies": {
@@ -220,6 +229,7 @@
220
229
  "@angular/platform-browser": "^22.2.4",
221
230
  "@eslint/js": "^9.0.0",
222
231
  "@johnmorrisdotca/hata": "^1.8.0",
232
+ "@johnmorrisdotca/hoshi-stars": "^0.30.0",
223
233
  "@johnmorrisdotca/kuni": "^1.5.0",
224
234
  "@johnmorrisdotca/wakusei-planets": "^0.5.0",
225
235
  "@playwright/test": "1.64.0",