@motioncomplex/cosmos-lib 1.0.9
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/README.md +125 -0
- package/dist/api.d.ts +246 -0
- package/dist/cache.d.ts +11 -0
- package/dist/clock.d.ts +181 -0
- package/dist/constants.d.ts +43 -0
- package/dist/data/constellations.d.ts +58 -0
- package/dist/data/cutouts.d.ts +70 -0
- package/dist/data/deep-sky.d.ts +27 -0
- package/dist/data/images.d.ts +147 -0
- package/dist/data/index.d.ts +422 -0
- package/dist/data/messier.d.ts +61 -0
- package/dist/data/ps1-files.d.ts +11 -0
- package/dist/data/showers.d.ts +62 -0
- package/dist/data/solar-system.d.ts +34 -0
- package/dist/data/stars.d.ts +57 -0
- package/dist/data/textures.d.ts +67 -0
- package/dist/eclipse.d.ts +176 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +237 -0
- package/dist/index.js +713 -0
- package/dist/math.d.ts +532 -0
- package/dist/media-DVOcIMa1.js +252 -0
- package/dist/media-DlE7RKBL.cjs +1 -0
- package/dist/media.d.ts +217 -0
- package/dist/moon.d.ts +170 -0
- package/dist/planner.d.ts +224 -0
- package/dist/react/index.cjs +1 -0
- package/dist/react/index.d.ts +167 -0
- package/dist/react/index.js +163 -0
- package/dist/skymap-hittest.d.ts +69 -0
- package/dist/skymap-interactive-CLg6FA0X.js +6377 -0
- package/dist/skymap-interactive-D2OZFwJ7.cjs +1 -0
- package/dist/skymap-interactive.d.ts +153 -0
- package/dist/skymap.d.ts +172 -0
- package/dist/sun.d.ts +119 -0
- package/dist/three/factories.d.ts +160 -0
- package/dist/three/flight.d.ts +116 -0
- package/dist/three/index.cjs +20 -0
- package/dist/three/index.d.ts +21 -0
- package/dist/three/index.js +404 -0
- package/dist/three/lod.d.ts +100 -0
- package/dist/three/shaders.d.ts +22 -0
- package/dist/three/types.d.ts +169 -0
- package/dist/transitions.d.ts +246 -0
- package/dist/types.d.ts +730 -0
- package/dist/units.d.ts +132 -0
- package/package.json +93 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@motioncomplex/cosmos-lib` -- Astronomical calculation and visualisation library.
|
|
3
|
+
*
|
|
4
|
+
* This is the main entry point. It re-exports every core module as named
|
|
5
|
+
* exports so consumers can tree-shake to only what they use:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { Sun, Moon, Units, CONSTANTS } from '@motioncomplex/cosmos-lib'
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* A convenience `Cosmos` default export is also available that bundles all
|
|
12
|
+
* modules into a single namespace object (see {@link Cosmos}).
|
|
13
|
+
*
|
|
14
|
+
* Three.js scene helpers (planet/nebula factories, camera flights, LOD
|
|
15
|
+
* management) live in the separate `/three` sub-path and are **not** included
|
|
16
|
+
* here to keep the core bundle free of any Three.js dependency:
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { createPlanet, CameraFlight } from '@motioncomplex/cosmos-lib/three'
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @packageDocumentation
|
|
23
|
+
*/
|
|
24
|
+
export { CONSTANTS } from './constants.js';
|
|
25
|
+
export { Units } from './units.js';
|
|
26
|
+
export { AstroMath } from './math.js';
|
|
27
|
+
export { Sun } from './sun.js';
|
|
28
|
+
export { Moon } from './moon.js';
|
|
29
|
+
export { Eclipse } from './eclipse.js';
|
|
30
|
+
export { Planner } from './planner.js';
|
|
31
|
+
export type { VisibleObject, WhatsUpOptions, VisibilityCurvePoint, BestWindowResult, PlanetEvent, MoonInterference, AirmassPoint } from './planner.js';
|
|
32
|
+
export { AstroClock } from './clock.js';
|
|
33
|
+
export type { AstroClockOptions, AstroClockEventMap, AstroEventType } from './clock.js';
|
|
34
|
+
export type { EclipseEvent } from './eclipse.js';
|
|
35
|
+
export { Data, SOLAR_SYSTEM, DEEP_SKY_EXTRAS, BRIGHT_STARS, CONSTELLATIONS, MESSIER_CATALOG, METEOR_SHOWERS, IMAGE_FALLBACKS, resolveImages, getObjectImage, prefetchImages, computeFov, tryPanSTARRS, tryDSS } from './data/index.js';
|
|
36
|
+
export type { SolarSystemBody, BrightStar, Constellation, MessierObject, MeteorShower, ResolvedImage, ResolveImageOptions, CutoutResult, CutoutOptions } from './data/index.js';
|
|
37
|
+
export { PLANET_TEXTURES, STAR_TEXTURES } from './data/textures.js';
|
|
38
|
+
export type { TextureInfo } from './data/textures.js';
|
|
39
|
+
export { Media } from './media.js';
|
|
40
|
+
export { NASA, ESA, resolveSimbad } from './api.js';
|
|
41
|
+
export { renderSkyMap, stereographic, mollweide, gnomonic, spectralColor, SkyMap } from './skymap.js';
|
|
42
|
+
export { InteractiveSkyMap, createInteractiveSkyMap } from './skymap-interactive.js';
|
|
43
|
+
export { canvasToEquatorial } from './skymap-hittest.js';
|
|
44
|
+
export { morph, staggerIn, staggerOut, fade, crossfade, heroExpand, heroCollapse, Transitions, } from './transitions.js';
|
|
45
|
+
export type { ObjectType, DistanceUnit, Distance, CelestialObject, SearchResult, ProximityResult, EquatorialCoord, HorizontalCoord, GalacticCoord, EclipticCoord, ObserverParams, ProjectedPoint, PlanetName, PlanetPosition, NutationResult, RiseTransitSet, MoonPhaseName, MoonPhase, MoonPosition, SunPosition, TwilightTimes, NASAImageResult, APODResult, ESAHubbleResult, SimbadResult, ImageRef, ProgressiveImageOptions, CloudinaryOptions, ObjectImageResult, GetImageOptions, ProjectionName, SkyMapRenderOptions, ProjectedObject, SkyMapViewState, SkyMapEventMap, FOVOverlayOptions, HUDOptions, InteractiveSkyMapOptions, MorphOptions, StaggerOptions, HeroExpandOptions, } from './types.js';
|
|
46
|
+
import { AstroClock } from './clock.js';
|
|
47
|
+
import { resolveSimbad } from './api.js';
|
|
48
|
+
import { renderSkyMap, stereographic, mollweide, gnomonic } from './skymap.js';
|
|
49
|
+
import { InteractiveSkyMap, createInteractiveSkyMap } from './skymap-interactive.js';
|
|
50
|
+
import { morph, staggerIn, staggerOut, fade, crossfade, heroExpand, heroCollapse } from './transitions.js';
|
|
51
|
+
/**
|
|
52
|
+
* Convenience namespace object that mirrors the original `cosmos.js` API.
|
|
53
|
+
*
|
|
54
|
+
* Use the default import when you prefer a single namespace over individual
|
|
55
|
+
* named imports:
|
|
56
|
+
*
|
|
57
|
+
* ```ts
|
|
58
|
+
* import Cosmos from '@motioncomplex/cosmos-lib'
|
|
59
|
+
*
|
|
60
|
+
* const jd = Cosmos.Math.julianDate(new Date())
|
|
61
|
+
* const sunPos = Cosmos.Sun.position(jd)
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* For tree-shaking, prefer the named exports instead:
|
|
65
|
+
*
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { AstroMath, Sun } from '@motioncomplex/cosmos-lib'
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare const Cosmos: {
|
|
71
|
+
readonly CONSTANTS: {
|
|
72
|
+
readonly AU_TO_KM: 149597870.7;
|
|
73
|
+
readonly LY_TO_KM: 9460730472580.8;
|
|
74
|
+
readonly PC_TO_LY: 3.261563777;
|
|
75
|
+
readonly PC_TO_KM: 30856775810000;
|
|
76
|
+
readonly C_KM_S: 299792.458;
|
|
77
|
+
readonly G: 6.674e-11;
|
|
78
|
+
readonly SOLAR_MASS_KG: 1.989e+30;
|
|
79
|
+
readonly SOLAR_RADIUS_KM: 695700;
|
|
80
|
+
readonly EARTH_MASS_KG: 5.972e+24;
|
|
81
|
+
readonly EARTH_RADIUS_KM: 6371;
|
|
82
|
+
readonly J2000: 2451545;
|
|
83
|
+
readonly ECLIPTIC_OBL: 23.4392911;
|
|
84
|
+
readonly DEG_TO_RAD: number;
|
|
85
|
+
readonly RAD_TO_DEG: number;
|
|
86
|
+
};
|
|
87
|
+
readonly Units: {
|
|
88
|
+
readonly auToKm: (au: number) => number;
|
|
89
|
+
readonly kmToAu: (km: number) => number;
|
|
90
|
+
readonly lyToPc: (ly: number) => number;
|
|
91
|
+
readonly pcToLy: (pc: number) => number;
|
|
92
|
+
readonly pcToKm: (pc: number) => number;
|
|
93
|
+
readonly lyToKm: (ly: number) => number;
|
|
94
|
+
readonly kmToLy: (km: number) => number;
|
|
95
|
+
readonly degToRad: (d: number) => number;
|
|
96
|
+
readonly radToDeg: (r: number) => number;
|
|
97
|
+
readonly arcsecToDeg: (a: number) => number;
|
|
98
|
+
readonly degToArcsec: (d: number) => number;
|
|
99
|
+
readonly hrsToDeg: (h: number) => number;
|
|
100
|
+
readonly degToHrs: (d: number) => number;
|
|
101
|
+
readonly formatDistance: (km: number) => string;
|
|
102
|
+
readonly formatAngle: (deg: number) => string;
|
|
103
|
+
readonly formatRA: (deg: number) => string;
|
|
104
|
+
};
|
|
105
|
+
readonly Math: {
|
|
106
|
+
readonly toJulian: (date?: Date) => number;
|
|
107
|
+
readonly fromJulian: (jd: number) => Date;
|
|
108
|
+
readonly j2000Days: (date?: Date) => number;
|
|
109
|
+
readonly gmst: (date?: Date) => number;
|
|
110
|
+
readonly lst: (date: Date, longitudeDeg: number) => number;
|
|
111
|
+
readonly equatorialToHorizontal: (eq: import("./types.js").EquatorialCoord, obs: import("./types.js").ObserverParams) => import("./types.js").HorizontalCoord;
|
|
112
|
+
readonly horizontalToEquatorial: (hor: import("./types.js").HorizontalCoord, obs: import("./types.js").ObserverParams) => import("./types.js").EquatorialCoord;
|
|
113
|
+
readonly eclipticToEquatorial: (ecl: import("./types.js").EclipticCoord) => import("./types.js").EquatorialCoord;
|
|
114
|
+
readonly galacticToEquatorial: (gal: import("./types.js").GalacticCoord) => import("./types.js").EquatorialCoord;
|
|
115
|
+
readonly angularSeparation: (a: import("./types.js").EquatorialCoord, b: import("./types.js").EquatorialCoord) => number;
|
|
116
|
+
readonly apparentMagnitude: (absoluteMag: number, distancePc: number) => number;
|
|
117
|
+
readonly absoluteMagnitude: (apparentMag: number, distancePc: number) => number;
|
|
118
|
+
readonly parallaxToDistance: (parallaxArcsec: number) => number;
|
|
119
|
+
readonly solveKepler: (M: number, e: number, tol?: number) => number;
|
|
120
|
+
readonly planetEcliptic: (planet: import("./types.js").PlanetName, date?: Date) => import("./types.js").PlanetPosition;
|
|
121
|
+
readonly precess: (eq: import("./types.js").EquatorialCoord, jdFrom: number, jdTo: number) => import("./types.js").EquatorialCoord;
|
|
122
|
+
readonly nutation: (jd: number) => import("./types.js").NutationResult;
|
|
123
|
+
readonly trueObliquity: (jd: number) => number;
|
|
124
|
+
readonly gast: (date?: Date) => number;
|
|
125
|
+
readonly refraction: (apparentAlt: number, tempC?: number, pressureMb?: number) => number;
|
|
126
|
+
readonly applyProperMotion: (eq: import("./types.js").EquatorialCoord, pmRA: number, pmDec: number, fromEpoch: number, toEpoch: number) => import("./types.js").EquatorialCoord;
|
|
127
|
+
readonly riseTransitSet: (eq: import("./types.js").EquatorialCoord, obs: import("./types.js").ObserverParams, h0?: number) => import("./types.js").RiseTransitSet;
|
|
128
|
+
};
|
|
129
|
+
readonly Sun: {
|
|
130
|
+
readonly position: (date?: Date) => import("./types.js").SunPosition;
|
|
131
|
+
readonly solarNoon: (obs: import("./types.js").ObserverParams) => Date;
|
|
132
|
+
readonly equationOfTime: (date?: Date) => number;
|
|
133
|
+
readonly twilight: (obs: import("./types.js").ObserverParams) => import("./types.js").TwilightTimes;
|
|
134
|
+
};
|
|
135
|
+
readonly Moon: {
|
|
136
|
+
readonly position: (date?: Date) => import("./types.js").MoonPosition;
|
|
137
|
+
readonly phase: (date?: Date) => import("./types.js").MoonPhase;
|
|
138
|
+
readonly nextPhase: (date?: Date, targetPhase?: "new" | "first-quarter" | "full" | "last-quarter") => Date;
|
|
139
|
+
readonly riseTransitSet: (obs: import("./types.js").ObserverParams) => import("./types.js").RiseTransitSet;
|
|
140
|
+
readonly libration: (date?: Date) => {
|
|
141
|
+
l: number;
|
|
142
|
+
b: number;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
readonly Eclipse: {
|
|
146
|
+
readonly nextSolar: (date?: Date) => import("./eclipse.js").EclipseEvent | null;
|
|
147
|
+
readonly nextLunar: (date?: Date) => import("./eclipse.js").EclipseEvent | null;
|
|
148
|
+
readonly search: (startDate: Date, endDate: Date, type?: "solar" | "lunar") => import("./eclipse.js").EclipseEvent[];
|
|
149
|
+
readonly _checkSolarEclipse: (newMoon: Date) => import("./eclipse.js").EclipseEvent | null;
|
|
150
|
+
readonly _checkLunarEclipse: (fullMoon: Date) => import("./eclipse.js").EclipseEvent | null;
|
|
151
|
+
};
|
|
152
|
+
readonly Planner: {
|
|
153
|
+
readonly whatsUp: (observer: import("./types.js").ObserverParams, options?: import("./planner.js").WhatsUpOptions) => import("./planner.js").VisibleObject[];
|
|
154
|
+
readonly bestWindow: (objectId: string, observer: import("./types.js").ObserverParams, minAlt?: number) => import("./planner.js").BestWindowResult | null;
|
|
155
|
+
readonly visibilityCurve: (objectId: string, observer: import("./types.js").ObserverParams, steps?: number) => import("./planner.js").VisibilityCurvePoint[] | null;
|
|
156
|
+
readonly planetEvents: (observer: import("./types.js").ObserverParams, options?: {
|
|
157
|
+
planets?: import("./types.js").PlanetName[];
|
|
158
|
+
days?: number;
|
|
159
|
+
}) => import("./planner.js").PlanetEvent[];
|
|
160
|
+
readonly moonInterference: (objectId: string, observer: import("./types.js").ObserverParams) => import("./planner.js").MoonInterference | null;
|
|
161
|
+
readonly airmassCurve: (objectId: string, observer: import("./types.js").ObserverParams, steps?: number) => import("./planner.js").AirmassPoint[] | null;
|
|
162
|
+
};
|
|
163
|
+
readonly AstroClock: typeof AstroClock;
|
|
164
|
+
readonly Data: {
|
|
165
|
+
get(id: string): import("./types.js").CelestialObject | null;
|
|
166
|
+
getByName(name: string): import("./types.js").CelestialObject | null;
|
|
167
|
+
all(): import("./types.js").CelestialObject[];
|
|
168
|
+
getByType(type: import("./types.js").ObjectType): import("./types.js").CelestialObject[];
|
|
169
|
+
getByTag(tag: string): import("./types.js").CelestialObject[];
|
|
170
|
+
search(query: string): import("./types.js").CelestialObject[];
|
|
171
|
+
nearby(center: import("./types.js").EquatorialCoord, radiusDeg: number): import("./types.js").ProximityResult[];
|
|
172
|
+
imageUrls(id: string, width?: number): string[];
|
|
173
|
+
progressiveImage(id: string, width?: number): import("./types.js").ProgressiveImageOptions | null;
|
|
174
|
+
imageSrcset(id: string, widths?: number[]): string | null;
|
|
175
|
+
resolveImages: typeof import("./index.js").resolveImages;
|
|
176
|
+
getImage: typeof import("./index.js").getObjectImage;
|
|
177
|
+
prefetchImages: typeof import("./index.js").prefetchImages;
|
|
178
|
+
stars(): readonly import("./index.js").BrightStar[];
|
|
179
|
+
getStarByName(name: string): import("./index.js").BrightStar | null;
|
|
180
|
+
getStarsByConstellation(con: string): import("./index.js").BrightStar[];
|
|
181
|
+
nearbyStars(center: import("./types.js").EquatorialCoord, radiusDeg: number): Array<{
|
|
182
|
+
star: import("./index.js").BrightStar;
|
|
183
|
+
separation: number;
|
|
184
|
+
}>;
|
|
185
|
+
constellations(): readonly import("./index.js").Constellation[];
|
|
186
|
+
getConstellation(abbr: string): import("./index.js").Constellation | null;
|
|
187
|
+
messier(): readonly import("./index.js").MessierObject[];
|
|
188
|
+
getMessier(number: number): import("./index.js").MessierObject | null;
|
|
189
|
+
showers(): readonly import("./index.js").MeteorShower[];
|
|
190
|
+
getActiveShowers(date: Date): import("./index.js").MeteorShower[];
|
|
191
|
+
};
|
|
192
|
+
readonly Media: {
|
|
193
|
+
readonly chainLoad: (urls: string[]) => Promise<string>;
|
|
194
|
+
readonly progressive: (target: HTMLImageElement | HTMLElement, opts: import("./types.js").ProgressiveImageOptions) => Promise<void>;
|
|
195
|
+
readonly preload: (urls: string[]) => Promise<string[]>;
|
|
196
|
+
readonly wikimediaUrl: (filename: string, width?: number) => string;
|
|
197
|
+
readonly cloudinaryUrl: (cloudName: string, publicId: string, opts?: import("./types.js").CloudinaryOptions) => string;
|
|
198
|
+
readonly srcset: (widths: number[], transformer: (w: number) => string) => string;
|
|
199
|
+
readonly optimalSize: (element: Element) => {
|
|
200
|
+
width: number;
|
|
201
|
+
height: number;
|
|
202
|
+
};
|
|
203
|
+
readonly _loadImage: (url: string) => Promise<string>;
|
|
204
|
+
};
|
|
205
|
+
readonly API: {
|
|
206
|
+
readonly NASA: {
|
|
207
|
+
setApiKey(key: string): void;
|
|
208
|
+
searchImages(query: string, opts?: import("./api.js").NASASearchOptions): Promise<import("./types.js").NASAImageResult[]>;
|
|
209
|
+
getAssets(nasaId: string): Promise<string[]>;
|
|
210
|
+
getBestImageUrl(nasaId: string): Promise<string | null>;
|
|
211
|
+
apod(date?: string | Date): Promise<import("./types.js").APODResult>;
|
|
212
|
+
recentAPOD(count?: number): Promise<import("./types.js").APODResult[]>;
|
|
213
|
+
};
|
|
214
|
+
readonly ESA: {
|
|
215
|
+
searchHubble(query: string, limit?: number): Promise<import("./types.js").ESAHubbleResult[]>;
|
|
216
|
+
};
|
|
217
|
+
readonly resolveSimbad: typeof resolveSimbad;
|
|
218
|
+
};
|
|
219
|
+
readonly SkyMap: {
|
|
220
|
+
readonly render: typeof renderSkyMap;
|
|
221
|
+
readonly stereographic: typeof stereographic;
|
|
222
|
+
readonly mollweide: typeof mollweide;
|
|
223
|
+
readonly gnomonic: typeof gnomonic;
|
|
224
|
+
readonly Interactive: typeof InteractiveSkyMap;
|
|
225
|
+
readonly create: typeof createInteractiveSkyMap;
|
|
226
|
+
};
|
|
227
|
+
readonly Transitions: {
|
|
228
|
+
readonly morph: typeof morph;
|
|
229
|
+
readonly staggerIn: typeof staggerIn;
|
|
230
|
+
readonly staggerOut: typeof staggerOut;
|
|
231
|
+
readonly fade: typeof fade;
|
|
232
|
+
readonly crossfade: typeof crossfade;
|
|
233
|
+
readonly heroExpand: typeof heroExpand;
|
|
234
|
+
readonly heroCollapse: typeof heroCollapse;
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
export default Cosmos;
|