@interstellar-tools/types 0.63.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.
@@ -1,9 +1,10 @@
1
+ import type { DistanceInterface } from '../distance.js';
1
2
  import type { DisplayInterface } from './display.js';
2
3
  /**
3
4
  * Represents an asteroid belt within the solar system simulation.
4
5
  *
5
6
  * **Asteroid Belt Properties:**
6
- * - **Inner and Outer Radius**: Defines the spatial boundaries of the belt in **Astronomical Units (AU)**.
7
+ * - **Inner and Outer Radius**: The belt's boundaries, as distances from the parent.
7
8
  * - **Drawing (`display`)**: colour, opacity, and density (how many asteroids to draw); see
8
9
  * {@link DisplayInterface}.
9
10
  *
@@ -16,10 +17,10 @@ export interface AsteroidBeltInterface {
16
17
  name: string;
17
18
  /** Id of the star the belt orbits (e.g., `'sun'`). */
18
19
  parent: string;
19
- /** Inner radius of the belt in Astronomical Units (AU). */
20
- innerRadius: number;
21
- /** Outer radius of the belt in Astronomical Units (AU). */
22
- outerRadius: number;
20
+ /** Inner radius of the belt, from the parent. */
21
+ innerRadius: DistanceInterface;
22
+ /** Outer radius of the belt, from the parent. */
23
+ outerRadius: DistanceInterface;
23
24
  /** How to draw the belt: colour, opacity and density, and state a renderer computes. */
24
25
  display?: DisplayInterface;
25
26
  }
@@ -33,8 +34,8 @@ export interface AsteroidBeltInterface {
33
34
  * id: 'main-asteroid-belt',
34
35
  * name: 'Main Belt',
35
36
  * parent: 'sun',
36
- * innerRadius: 2.1,
37
- * outerRadius: 3.3,
37
+ * innerRadius: { value: 2.1, unit: 'au' },
38
+ * outerRadius: { value: 3.3, unit: 'au' },
38
39
  * display: { color: '#888888', opacity: 0.5, density: 100 }
39
40
  * }];
40
41
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"asteroid-belts.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/asteroid-belts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;GASG;AACH,MAAM,WAAW,qBAAqB;IACpC,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,wFAAwF;IACxF,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"asteroid-belts.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/asteroid-belts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;GASG;AACH,MAAM,WAAW,qBAAqB;IACpC,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,WAAW,EAAE,iBAAiB,CAAC;IAC/B,iDAAiD;IACjD,WAAW,EAAE,iBAAiB,CAAC;IAC/B,wFAAwF;IACxF,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,EAAE,CAAC"}
@@ -1,29 +1,22 @@
1
- import { AsteroidInterface, AsteroidsType } from './asteroids.js';
2
- import { CometInterface, CometsType } from './comets.js';
3
- import { MoonInterface, MoonsType } from './moons.js';
4
- import { PlanetInterface, PlanetsType } from './planets.js';
5
- import { StarInterface, StarsType } from './stars.js';
1
+ import type { AsteroidInterface } from './asteroids.js';
2
+ import type { CometInterface } from './comets.js';
3
+ import type { MoonInterface } from './moons.js';
4
+ import type { PlanetInterface } from './planets.js';
5
+ import type { StarInterface } from './stars.js';
6
6
  /**
7
- * Type alias representing a collection of celestial bodies.
8
- *
9
- * Includes:
10
- * - **Stars** (`StarsType`)
11
- * - **Planets** (`PlanetsType`)
12
- * - **Moons** (`MoonsType`)
13
- * - **Comets** (`CometsType`)
14
- *
15
- * @typedef {StarsType | PlanetsType | MoonsType | CometsType | AsteroidsType} CelestialBodiesType
7
+ * A list of celestial bodies of any kind: stars, planets, moons, comets and
8
+ * asteroids, mixed.
16
9
  *
17
10
  * @example
18
11
  * ```ts
19
- * const celestialObjects: CelestialBodiesType = [
20
- * { name: 'Sun', type: 'star', mass: 1.989e30 },
21
- * { name: 'Earth', type: 'planet', mass: 5.972e24 }
22
- * ];
12
+ * import { MOONS, PLANETS, STARS } from '@interstellar-tools/constants';
13
+ *
14
+ * const solarSystem: CelestialBodiesType = [...STARS, ...PLANETS, ...MOONS];
15
+ * const earth = solarSystem.find((body) => body.id === 'earth');
23
16
  * ```
24
17
  * @group Celestial Bodies
25
18
  */
26
- export type CelestialBodiesType = StarsType | PlanetsType | MoonsType | CometsType | AsteroidsType;
19
+ export type CelestialBodiesType = CelestialBodyType[];
27
20
  /**
28
21
  * Type alias representing a single celestial body.
29
22
  *
@@ -37,7 +30,7 @@ export type CelestialBodiesType = StarsType | PlanetsType | MoonsType | CometsTy
37
30
  *
38
31
  * @example
39
32
  * ```ts
40
- * const earth: CelestialBodyType = { name: 'Earth', type: 'planet', mass: 5.972e24 };
33
+ * const describe = (body: CelestialBodyType) => `${body.name}, bound to ${body.parent}`;
41
34
  * ```
42
35
  * @group Celestial Bodies
43
36
  */
@@ -1 +1 @@
1
- {"version":3,"file":"celestial-bodies.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/celestial-bodies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,mBAAmB,GAC7B,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,CAAC;AAEnE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,iBAAiB,GACzB,aAAa,GACb,eAAe,GACf,aAAa,GACb,cAAc,GACd,iBAAiB,CAAC"}
1
+ {"version":3,"file":"celestial-bodies.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/celestial-bodies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,EAAE,CAAC;AAEtD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,iBAAiB,GACzB,aAAa,GACb,eAAe,GACf,aAAa,GACb,cAAc,GACd,iBAAiB,CAAC"}
@@ -44,6 +44,11 @@ export interface MoonInterface {
44
44
  orbit: OrbitInterface;
45
45
  /** Physical radius of the moon in kilometres. */
46
46
  radius: DistanceInterface;
47
+ /**
48
+ * Standard gravitational parameter $\mu = G M$ of the body alone, in m³/s²,
49
+ * as the orbit equations take it. Given where JPL publishes one.
50
+ */
51
+ mu?: number;
47
52
  /** X-coordinate in a distance-based system (optional). */
48
53
  x?: DistanceInterface;
49
54
  /** Y-coordinate in a distance-based system (optional). */
@@ -1 +1 @@
1
- {"version":3,"file":"moons.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/moons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,kCAAkC;IAClC,QAAQ,EACN,mBAAmB,GAAG,qBAAqB,GAAG,sBAAsB,CAAC;IACvE,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,KAAK,EAAE,cAAc,CAAC;IACtB,iDAAiD;IACjD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,uEAAuE;IACvE,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"moons.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/moons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,kCAAkC;IAClC,QAAQ,EACN,mBAAmB,GAAG,qBAAqB,GAAG,sBAAsB,CAAC;IACvE,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,KAAK,EAAE,cAAc,CAAC;IACtB,iDAAiD;IACjD,MAAM,EAAE,iBAAiB,CAAC;IAC1B;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0DAA0D;IAC1D,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,uEAAuE;IACvE,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC"}
@@ -52,6 +52,11 @@ export interface PlanetInterface {
52
52
  orbit?: OrbitInterface;
53
53
  /** Physical radius of the planet in kilometres. */
54
54
  radius: DistanceInterface;
55
+ /**
56
+ * Standard gravitational parameter $\mu = G M$ of the body alone, in m³/s²,
57
+ * as the orbit equations take it. Given where JPL publishes one.
58
+ */
59
+ mu?: number;
55
60
  /** X-coordinate in the parent's frame. Optional: a rogue planet or an exoplanet may have no known position. */
56
61
  x?: DistanceInterface;
57
62
  /** Y-coordinate in the parent's frame. */
@@ -1 +1 @@
1
- {"version":3,"file":"planets.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/planets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,IAAI,EACA,kBAAkB,GAClB,eAAe,GACf,iBAAiB,GACjB,eAAe,GACf,WAAW,GACX,WAAW,GACX,eAAe,GACf,eAAe,GACf,WAAW,GACX,YAAY,GACZ,aAAa,GACb,aAAa,GACb,cAAc,GACd,cAAc,GACd,cAAc,GACd,YAAY,GACZ,iBAAiB,GACjB,oBAAoB,CAAC;IACzB,6DAA6D;IAC7D,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAAC;IACjC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,mDAAmD;IACnD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,+GAA+G;IAC/G,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,yEAAyE;IACzE,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"planets.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/planets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,IAAI,EACA,kBAAkB,GAClB,eAAe,GACf,iBAAiB,GACjB,eAAe,GACf,WAAW,GACX,WAAW,GACX,eAAe,GACf,eAAe,GACf,WAAW,GACX,YAAY,GACZ,aAAa,GACb,aAAa,GACb,cAAc,GACd,cAAc,GACd,cAAc,GACd,YAAY,GACZ,iBAAiB,GACjB,oBAAoB,CAAC;IACzB,6DAA6D;IAC7D,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAAC;IACjC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,mDAAmD;IACnD,MAAM,EAAE,iBAAiB,CAAC;IAC1B;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,+GAA+G;IAC/G,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,yEAAyE;IACzE,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,eAAe,EAAE,CAAC"}
@@ -49,6 +49,11 @@ export interface StarInterface {
49
49
  orbit?: OrbitInterface;
50
50
  /** Mass in solar masses ($M_\odot$). */
51
51
  mass?: number;
52
+ /**
53
+ * Standard gravitational parameter $\mu = G M$ of the body alone, in m³/s²,
54
+ * as the orbit equations take it. Given where JPL publishes one.
55
+ */
56
+ mu?: number;
52
57
  /** Physical radius of the star. */
53
58
  radius: DistanceInterface;
54
59
  /** X-coordinate in the parent's frame. */
@@ -1 +1 @@
1
- {"version":3,"file":"stars.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/stars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,uEAAuE;IACvE,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"stars.d.ts","sourceRoot":"","sources":["../../src/celestial-bodies/stars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mCAAmC;IACnC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,0CAA0C;IAC1C,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACtB,uEAAuE;IACvE,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interstellar-tools/types",
3
- "version": "0.63.0",
3
+ "version": "0.64.0",
4
4
  "description": "Shared TypeScript types (e.g., 3D tuples, equation result interfaces) used across the monorepo to keep APIs predictable and safe.",
5
5
  "keywords": [
6
6
  "types",