@johnmorrisdotca/wakusei-planets 0.62.0 → 0.64.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.
@@ -185,3 +185,24 @@ export declare function getTimes(date: Date | number, lat: number, lng: number,
185
185
  * ```
186
186
  */
187
187
  export declare function getMoonTimes(date: Date | number, lat: number, lng: number, inUTC?: boolean): LegacyMoonTimes;
188
+ /**
189
+ * Every function of this entry as one object, for code written `import SunCalc from "suncalc"` (or `const SunCalc = require("suncalc")`) against suncalc 1.x. `SunCalc.times` is the same array as the named `times`, so `addTime` reaches both.
190
+ *
191
+ * @example
192
+ * ```ts
193
+ * import SunCalc from "@johnmorrisdotca/wakusei-planets/suncalc/legacy";
194
+ *
195
+ * const t = SunCalc.getTimes(new Date(Date.UTC(2026, 5, 21, 12)), 51.5, -0.1);
196
+ * console.log(t.sunrise instanceof Date);
197
+ * ```
198
+ */
199
+ declare const SunCalc: {
200
+ getPosition: typeof getPosition;
201
+ getTimes: typeof getTimes;
202
+ times: [number, string, string][];
203
+ addTime: typeof addTime;
204
+ getMoonPosition: typeof getMoonPosition;
205
+ getMoonIllumination: typeof getMoonIllumination;
206
+ getMoonTimes: typeof getMoonTimes;
207
+ };
208
+ export default SunCalc;
@@ -166,3 +166,16 @@ export function getMoonTimes(date, lat, lng, inUTC = false) {
166
166
  result.alwaysDown = true;
167
167
  return result;
168
168
  }
169
+ /**
170
+ * Every function of this entry as one object, for code written `import SunCalc from "suncalc"` (or `const SunCalc = require("suncalc")`) against suncalc 1.x. `SunCalc.times` is the same array as the named `times`, so `addTime` reaches both.
171
+ *
172
+ * @example
173
+ * ```ts
174
+ * import SunCalc from "@johnmorrisdotca/wakusei-planets/suncalc/legacy";
175
+ *
176
+ * const t = SunCalc.getTimes(new Date(Date.UTC(2026, 5, 21, 12)), 51.5, -0.1);
177
+ * console.log(t.sunrise instanceof Date);
178
+ * ```
179
+ */
180
+ const SunCalc = { getPosition, getTimes, times, addTime, getMoonPosition, getMoonIllumination, getMoonTimes };
181
+ export default SunCalc;
package/dist/suncalc.d.ts CHANGED
@@ -207,3 +207,24 @@ export declare function getTimes(date: Date | number, lat: number, lng: number,
207
207
  * ```
208
208
  */
209
209
  export declare function getMoonTimes(date: Date | number, lat: number, lng: number, utcOffset?: number): MoonTimes;
210
+ /**
211
+ * Every function of this entry as one object, for code written `import SunCalc from "suncalc"`. `SunCalc.times` is the same array as the named `times`, so `addTime` reaches both.
212
+ *
213
+ * @example
214
+ * ```ts
215
+ * import SunCalc from "@johnmorrisdotca/wakusei-planets/suncalc";
216
+ *
217
+ * const t = SunCalc.getTimes(new Date(Date.UTC(2026, 5, 21, 12)), 51.5, -0.1);
218
+ * console.log(t.sunrise instanceof Date);
219
+ * ```
220
+ */
221
+ declare const SunCalc: {
222
+ getPosition: typeof getPosition;
223
+ getTimes: typeof getTimes;
224
+ times: [number, string, string][];
225
+ addTime: typeof addTime;
226
+ getMoonPosition: typeof getMoonPosition;
227
+ getMoonIllumination: typeof getMoonIllumination;
228
+ getMoonTimes: typeof getMoonTimes;
229
+ };
230
+ export default SunCalc;
package/dist/suncalc.js CHANGED
@@ -122,10 +122,11 @@ export function getTimes(date, lat, lng, height = 0, utcOffset) {
122
122
  const result = { solarNoon: new Date(day.noon), nadir: new Date(day.nadir) };
123
123
  for (const [name, at] of day.events)
124
124
  result[name] = at === null ? null : new Date(at);
125
- if (day.alwaysUp)
126
- result.alwaysUp = true;
127
- if (day.alwaysDown)
128
- result.alwaysDown = true;
125
+ // suncalc's shape: when the Sun does not rise, both flags are there, one true and one false
126
+ if (result.sunrise === null) {
127
+ result.alwaysUp = day.noonHigh;
128
+ result.alwaysDown = !day.noonHigh;
129
+ }
129
130
  return result;
130
131
  }
131
132
  /**
@@ -159,9 +160,23 @@ export function getMoonTimes(date, lat, lng, utcOffset) {
159
160
  result.transit = new Date(day.transit);
160
161
  if (day.lowerTransit !== null)
161
162
  result.lowerTransit = new Date(day.lowerTransit);
162
- if (day.alwaysUp)
163
- result.alwaysUp = true;
164
- if (day.alwaysDown)
165
- result.alwaysDown = true;
163
+ // suncalc's shape: on a day with no rise and no set both flags are there, one true and one false
164
+ if (day.rise === null && day.set === null) {
165
+ result.alwaysUp = day.alwaysUp;
166
+ result.alwaysDown = !day.alwaysUp;
167
+ }
166
168
  return result;
167
169
  }
170
+ /**
171
+ * Every function of this entry as one object, for code written `import SunCalc from "suncalc"`. `SunCalc.times` is the same array as the named `times`, so `addTime` reaches both.
172
+ *
173
+ * @example
174
+ * ```ts
175
+ * import SunCalc from "@johnmorrisdotca/wakusei-planets/suncalc";
176
+ *
177
+ * const t = SunCalc.getTimes(new Date(Date.UTC(2026, 5, 21, 12)), 51.5, -0.1);
178
+ * console.log(t.sunrise instanceof Date);
179
+ * ```
180
+ */
181
+ const SunCalc = { getPosition, getTimes, times, addTime, getMoonPosition, getMoonIllumination, getMoonTimes };
182
+ export default SunCalc;
@@ -52,7 +52,7 @@ export declare class WakuseiSurface extends HTMLElement {
52
52
  /** The eyes' look now. Setting it turns the view (azimuth and pitch in degrees, `fov` the view's height in degrees); it is drawn at once. */
53
53
  get look(): Look;
54
54
  set look(value: Look);
55
- /** Where the eyes are: metres east and north of the site, and metres over the ground under them. */
55
+ /** Where the eyes are: metres east and north of the site, and metres over the ground under them. Standing, that is a person's height; while the rover is driven or the landing watched, it is the height of the view being drawn (the seat, the chase camera). */
56
56
  get position(): {
57
57
  east: number;
58
58
  north: number;
@@ -159,9 +159,11 @@ export class WakuseiSurface extends HTMLElement {
159
159
  this.#look = clampLook(value);
160
160
  this.#changed();
161
161
  }
162
- /** Where the eyes are: metres east and north of the site, and metres over the ground under them. */
162
+ /** Where the eyes are: metres east and north of the site, and metres over the ground under them. Standing, that is a person's height; while the rover is driven or the landing watched, it is the height of the view being drawn (the seat, the chase camera). */
163
163
  get position() {
164
- return { ...this.#at, up: EYE_HEIGHT };
164
+ if (this.#terrain === undefined || (this.#vehicle === undefined && this.#landing === undefined))
165
+ return { ...this.#at, up: EYE_HEIGHT };
166
+ return { ...this.#at, up: this.#eyeUp() - this.#groundAt(this.#at.east, this.#at.north) };
165
167
  }
166
168
  /** The sky now: the Sun and the Earth in it. */
167
169
  get sky() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/wakusei-planets",
3
- "version": "0.62.0",
3
+ "version": "0.64.0",
4
4
  "description": "Wakusei Planets 惑星 — The Sun, planets and moons for the web: each as a clean line drawing, a shaded realistic drawing or a painted surface map, with real sizes, axial tilt and rotation as data, and positions of the moons for any date and time. SVG for the lines, three.js (optional) for the rest.",
5
5
  "keywords": [
6
6
  "planets",
@@ -236,6 +236,11 @@
236
236
  "import": "./dist/spacecraft.js",
237
237
  "default": "./dist/spacecraft.js"
238
238
  },
239
+ "./fact-sheets": {
240
+ "types": "./dist/fact-sheets.d.ts",
241
+ "import": "./dist/fact-sheets.js",
242
+ "default": "./dist/fact-sheets.js"
243
+ },
239
244
  "./roadster": {
240
245
  "types": "./dist/roadster.d.ts",
241
246
  "import": "./dist/roadster.js",
@@ -436,6 +441,11 @@
436
441
  "import": "./dist/sky-bodies.js",
437
442
  "default": "./dist/sky-bodies.js"
438
443
  },
444
+ "./sky": {
445
+ "types": "./dist/sky.d.ts",
446
+ "import": "./dist/sky.js",
447
+ "default": "./dist/sky.js"
448
+ },
439
449
  "./suncalc": {
440
450
  "types": "./dist/suncalc.d.ts",
441
451
  "import": "./dist/suncalc.js",
@@ -715,9 +725,13 @@
715
725
  },
716
726
  "peerDependencies": {
717
727
  "@johnmorrisdotca/chikyu-earth": ">=0.10.0",
728
+ "astronomy-engine": ">=2.1.19 <3",
718
729
  "three": ">=0.160.0"
719
730
  },
720
731
  "peerDependenciesMeta": {
732
+ "astronomy-engine": {
733
+ "optional": true
734
+ },
721
735
  "three": {
722
736
  "optional": true
723
737
  },