@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.
Files changed (47) hide show
  1. package/README.md +125 -0
  2. package/dist/api.d.ts +246 -0
  3. package/dist/cache.d.ts +11 -0
  4. package/dist/clock.d.ts +181 -0
  5. package/dist/constants.d.ts +43 -0
  6. package/dist/data/constellations.d.ts +58 -0
  7. package/dist/data/cutouts.d.ts +70 -0
  8. package/dist/data/deep-sky.d.ts +27 -0
  9. package/dist/data/images.d.ts +147 -0
  10. package/dist/data/index.d.ts +422 -0
  11. package/dist/data/messier.d.ts +61 -0
  12. package/dist/data/ps1-files.d.ts +11 -0
  13. package/dist/data/showers.d.ts +62 -0
  14. package/dist/data/solar-system.d.ts +34 -0
  15. package/dist/data/stars.d.ts +57 -0
  16. package/dist/data/textures.d.ts +67 -0
  17. package/dist/eclipse.d.ts +176 -0
  18. package/dist/index.cjs +1 -0
  19. package/dist/index.d.ts +237 -0
  20. package/dist/index.js +713 -0
  21. package/dist/math.d.ts +532 -0
  22. package/dist/media-DVOcIMa1.js +252 -0
  23. package/dist/media-DlE7RKBL.cjs +1 -0
  24. package/dist/media.d.ts +217 -0
  25. package/dist/moon.d.ts +170 -0
  26. package/dist/planner.d.ts +224 -0
  27. package/dist/react/index.cjs +1 -0
  28. package/dist/react/index.d.ts +167 -0
  29. package/dist/react/index.js +163 -0
  30. package/dist/skymap-hittest.d.ts +69 -0
  31. package/dist/skymap-interactive-CLg6FA0X.js +6377 -0
  32. package/dist/skymap-interactive-D2OZFwJ7.cjs +1 -0
  33. package/dist/skymap-interactive.d.ts +153 -0
  34. package/dist/skymap.d.ts +172 -0
  35. package/dist/sun.d.ts +119 -0
  36. package/dist/three/factories.d.ts +160 -0
  37. package/dist/three/flight.d.ts +116 -0
  38. package/dist/three/index.cjs +20 -0
  39. package/dist/three/index.d.ts +21 -0
  40. package/dist/three/index.js +404 -0
  41. package/dist/three/lod.d.ts +100 -0
  42. package/dist/three/shaders.d.ts +22 -0
  43. package/dist/three/types.d.ts +169 -0
  44. package/dist/transitions.d.ts +246 -0
  45. package/dist/types.d.ts +730 -0
  46. package/dist/units.d.ts +132 -0
  47. package/package.json +93 -0
@@ -0,0 +1,730 @@
1
+ /**
2
+ * Classification of celestial objects in the catalog.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * import { Data } from '@motioncomplex/cosmos-lib'
7
+ * const stars = Data.getByType('star')
8
+ * ```
9
+ */
10
+ export type ObjectType = 'star' | 'planet' | 'nebula' | 'galaxy' | 'cluster' | 'black-hole' | 'moon';
11
+ /** Unit of measurement for astronomical distances. */
12
+ export type DistanceUnit = 'km' | 'AU' | 'ly' | 'pc' | 'kpc' | 'Mpc';
13
+ /**
14
+ * A distance value paired with its unit of measurement.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const d: Distance = { value: 8.6, unit: 'ly' } // Sirius
19
+ * ```
20
+ */
21
+ export interface Distance {
22
+ /** Numeric distance value. */
23
+ value: number;
24
+ /** Unit of the distance measurement. */
25
+ unit: DistanceUnit;
26
+ }
27
+ /**
28
+ * A celestial object in the catalog — star, planet, nebula, galaxy, cluster, or moon.
29
+ *
30
+ * This is the unified type returned by all `Data` query methods. Objects from
31
+ * different catalogs (Messier, bright stars, solar system) are normalised into
32
+ * this shape.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * import { Data } from '@motioncomplex/cosmos-lib'
37
+ * const obj = Data.getByName('Sirius')
38
+ * if (obj) console.log(obj.type, obj.magnitude) // 'star', -1.46
39
+ * ```
40
+ */
41
+ export interface CelestialObject {
42
+ /** Unique identifier (e.g. `'sirius'`, `'m42'`, `'earth'`). */
43
+ id: string;
44
+ /** Primary display name. */
45
+ name: string;
46
+ /** Alternative names or catalog designations. */
47
+ aliases: string[];
48
+ /** Object classification. */
49
+ type: ObjectType;
50
+ /** Optional sub-classification (e.g. `'emission'` for a nebula). */
51
+ subtype?: string;
52
+ /** Right Ascension in degrees (J2000). Null for solar-system bodies. */
53
+ ra: number | null;
54
+ /** Declination in degrees (J2000). Null for solar-system bodies. */
55
+ dec: number | null;
56
+ /** Apparent visual magnitude. Null if unknown. */
57
+ magnitude: number | null;
58
+ /** Distance from Earth. */
59
+ distance?: Distance;
60
+ /** Human-readable description. */
61
+ description: string;
62
+ /** Searchable tags (e.g. `['star', 'binary']`). */
63
+ tags: string[];
64
+ /** Equatorial diameter in kilometres. */
65
+ diameter_km?: number;
66
+ /** Mass in kilograms. */
67
+ mass_kg?: number;
68
+ /** Number of known natural satellites. */
69
+ moons?: number;
70
+ /** Mean surface temperature in Kelvin. */
71
+ surface_temp_K?: number;
72
+ /** Spectral type (e.g. `'A1V'` for Sirius). */
73
+ spectral?: string;
74
+ /** Whether the object is a known binary system. */
75
+ binary?: boolean;
76
+ /** Whether the object is a known triple system. */
77
+ triple?: boolean;
78
+ /** Angular diameter in arcminutes (for extended objects like nebulae, clusters, galaxies). */
79
+ size_arcmin?: number;
80
+ }
81
+ /**
82
+ * A search result with a relevance score, returned by {@link Data.search}.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * const results = Data.search('orion')
87
+ * results[0].score // higher = better match
88
+ * ```
89
+ */
90
+ export interface SearchResult {
91
+ /** The matched celestial object. */
92
+ object: CelestialObject;
93
+ /** Relevance score (higher is better). */
94
+ score: number;
95
+ }
96
+ /**
97
+ * A proximity-search result returned by {@link Data.nearby}.
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * const near = Data.nearby({ ra: 83.8, dec: -5.4 }, 10)
102
+ * near[0].separation // angular distance in degrees
103
+ * ```
104
+ */
105
+ export interface ProximityResult {
106
+ /** The matched celestial object. */
107
+ object: CelestialObject;
108
+ /** Angular separation in degrees from the search centre. */
109
+ separation: number;
110
+ }
111
+ /**
112
+ * Equatorial coordinate pair (J2000 epoch).
113
+ *
114
+ * The standard reference frame for star catalogues and telescope pointing.
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * const sirius: EquatorialCoord = { ra: 101.287, dec: -16.716 }
119
+ * ```
120
+ */
121
+ export interface EquatorialCoord {
122
+ /** Right Ascension in degrees (0–360). */
123
+ ra: number;
124
+ /** Declination in degrees (-90 to +90). */
125
+ dec: number;
126
+ }
127
+ /**
128
+ * Horizontal (topocentric) coordinate pair relative to an observer.
129
+ *
130
+ * @example
131
+ * ```ts
132
+ * const pos: HorizontalCoord = { alt: 42.3, az: 180 } // due south, 42° up
133
+ * ```
134
+ */
135
+ export interface HorizontalCoord {
136
+ /** Altitude in degrees (+ = above horizon, - = below). */
137
+ alt: number;
138
+ /** Azimuth in degrees (0 = North, 90 = East, 180 = South, 270 = West). */
139
+ az: number;
140
+ }
141
+ /**
142
+ * Galactic coordinate pair in the IAU 1958 system.
143
+ *
144
+ * @example
145
+ * ```ts
146
+ * const gc: GalacticCoord = { l: 0, b: 0 } // galactic centre
147
+ * ```
148
+ */
149
+ export interface GalacticCoord {
150
+ /** Galactic longitude in degrees (0–360). */
151
+ l: number;
152
+ /** Galactic latitude in degrees (-90 to +90). */
153
+ b: number;
154
+ }
155
+ /**
156
+ * Ecliptic coordinate pair referred to the mean ecliptic of J2000.
157
+ *
158
+ * @example
159
+ * ```ts
160
+ * const ec: EclipticCoord = { lon: 79.3, lat: 1.2 }
161
+ * ```
162
+ */
163
+ export interface EclipticCoord {
164
+ /** Ecliptic longitude in degrees (0–360). */
165
+ lon: number;
166
+ /** Ecliptic latitude in degrees (-90 to +90). */
167
+ lat: number;
168
+ }
169
+ /**
170
+ * Geographic location and time of an observer, required by functions
171
+ * that compute topocentric positions (e.g. rise/set, alt/az).
172
+ *
173
+ * @example
174
+ * ```ts
175
+ * const lucerne: ObserverParams = { lat: 47.05, lng: 8.31, date: new Date() }
176
+ * ```
177
+ */
178
+ export interface ObserverParams {
179
+ /** Geographic latitude in degrees (-90 to +90). */
180
+ lat: number;
181
+ /** Geographic longitude in degrees (east positive, -180 to +180). */
182
+ lng: number;
183
+ /** Observation date/time. Defaults to `new Date()` when omitted. */
184
+ date?: Date;
185
+ }
186
+ /**
187
+ * A 2-D projected point on a sky map canvas.
188
+ */
189
+ export interface ProjectedPoint {
190
+ /** Horizontal pixel offset. */
191
+ x: number;
192
+ /** Vertical pixel offset. */
193
+ y: number;
194
+ /** Whether the point is on the visible side of the projection. */
195
+ visible: boolean;
196
+ }
197
+ /**
198
+ * Name of a planet supported by {@link AstroMath.planetEcliptic}.
199
+ */
200
+ export type PlanetName = 'mercury' | 'venus' | 'earth' | 'mars' | 'jupiter' | 'saturn' | 'uranus' | 'neptune';
201
+ /**
202
+ * Heliocentric ecliptic position of a planet, returned by
203
+ * {@link AstroMath.planetEcliptic}.
204
+ */
205
+ export interface PlanetPosition extends EclipticCoord {
206
+ /** Heliocentric distance in AU. */
207
+ r: number;
208
+ /** Mean anomaly in degrees. */
209
+ M: number;
210
+ /** True anomaly in degrees. */
211
+ nu: number;
212
+ }
213
+ /**
214
+ * Nutation corrections returned by {@link AstroMath.nutation}.
215
+ */
216
+ export interface NutationResult {
217
+ /** Nutation in longitude (degrees). */
218
+ dPsi: number;
219
+ /** Nutation in obliquity (degrees). */
220
+ dEpsilon: number;
221
+ }
222
+ /**
223
+ * Rise, transit, and set times for a celestial object at a given location.
224
+ *
225
+ * `rise` and `set` are `null` for circumpolar objects or objects that never
226
+ * rise above the horizon.
227
+ *
228
+ * @example
229
+ * ```ts
230
+ * const rts = AstroMath.riseTransitSet(sirius, observer)
231
+ * if (rts.rise) console.log('Rises at', rts.rise.toLocaleTimeString())
232
+ * ```
233
+ */
234
+ export interface RiseTransitSet {
235
+ /** Rise time, or `null` if the object is circumpolar or never rises. */
236
+ rise: Date | null;
237
+ /** Transit (meridian crossing) time. */
238
+ transit: Date;
239
+ /** Set time, or `null` if the object is circumpolar or never sets. */
240
+ set: Date | null;
241
+ }
242
+ /**
243
+ * Human-readable lunar phase name.
244
+ */
245
+ export type MoonPhaseName = 'new' | 'waxing-crescent' | 'first-quarter' | 'waxing-gibbous' | 'full' | 'waning-gibbous' | 'last-quarter' | 'waning-crescent';
246
+ /**
247
+ * Lunar phase information returned by {@link Moon.phase}.
248
+ *
249
+ * @example
250
+ * ```ts
251
+ * const p = Moon.phase()
252
+ * console.log(p.name, `${(p.illumination * 100).toFixed(0)}%`)
253
+ * ```
254
+ */
255
+ export interface MoonPhase {
256
+ /** Phase angle 0–1 (0 = new, 0.25 = first quarter, 0.5 = full, 0.75 = last quarter). */
257
+ phase: number;
258
+ /** Illuminated fraction 0–1. */
259
+ illumination: number;
260
+ /** Days since last new moon (0–29.5). */
261
+ age: number;
262
+ /** Human-readable phase name. */
263
+ name: MoonPhaseName;
264
+ }
265
+ /**
266
+ * Geocentric equatorial position of the Moon, returned by {@link Moon.position}.
267
+ */
268
+ export interface MoonPosition extends EquatorialCoord {
269
+ /** Distance from Earth's centre in kilometres. */
270
+ distance_km: number;
271
+ /** Ecliptic longitude in degrees. */
272
+ eclipticLon: number;
273
+ /** Ecliptic latitude in degrees. */
274
+ eclipticLat: number;
275
+ /** Horizontal parallax in degrees. */
276
+ parallax: number;
277
+ }
278
+ /**
279
+ * Geocentric equatorial position of the Sun, returned by {@link Sun.position}.
280
+ */
281
+ export interface SunPosition extends EquatorialCoord {
282
+ /** Distance from Earth in AU. */
283
+ distance_AU: number;
284
+ /** Ecliptic longitude in degrees. */
285
+ eclipticLon: number;
286
+ }
287
+ /**
288
+ * Civil, nautical, and astronomical twilight times for a given observer,
289
+ * returned by {@link Sun.twilight}.
290
+ *
291
+ * Values are `null` for polar locations where that twilight phase does not
292
+ * occur on the given date.
293
+ *
294
+ * @example
295
+ * ```ts
296
+ * const tw = Sun.twilight({ lat: 51.5, lng: -0.1 })
297
+ * console.log('Sunrise:', tw.sunrise?.toLocaleTimeString())
298
+ * ```
299
+ */
300
+ export interface TwilightTimes {
301
+ /** Sun centre at -18° altitude (earliest meaningful dawn). */
302
+ astronomicalDawn: Date | null;
303
+ /** Sun centre at -12° altitude. */
304
+ nauticalDawn: Date | null;
305
+ /** Sun centre at -6° altitude. */
306
+ civilDawn: Date | null;
307
+ /** Upper limb crosses the horizon (accounting for refraction). */
308
+ sunrise: Date | null;
309
+ /** Sun transits the local meridian. */
310
+ solarNoon: Date;
311
+ /** Upper limb crosses the horizon. */
312
+ sunset: Date | null;
313
+ /** Sun centre at -6° altitude. */
314
+ civilDusk: Date | null;
315
+ /** Sun centre at -12° altitude. */
316
+ nauticalDusk: Date | null;
317
+ /** Sun centre at -18° altitude (full darkness). */
318
+ astronomicalDusk: Date | null;
319
+ }
320
+ /**
321
+ * A single result from the NASA Image and Video Library search,
322
+ * returned by {@link NASA.searchImages}.
323
+ */
324
+ export interface NASAImageResult {
325
+ /** NASA-assigned unique identifier. */
326
+ nasaId: string;
327
+ /** Title of the image or video. */
328
+ title: string;
329
+ /** Full description text. */
330
+ description: string;
331
+ /** ISO-8601 date string of the asset. */
332
+ date: string;
333
+ /** Originating NASA centre (e.g. `'JPL'`, `'GSFC'`). */
334
+ center: string;
335
+ /** Associated keywords. */
336
+ keywords: string[];
337
+ /** Preview image URL, or `null` if unavailable. */
338
+ previewUrl: string | null;
339
+ /** Collection asset URL. */
340
+ href: string;
341
+ }
342
+ /**
343
+ * Astronomy Picture of the Day result, returned by {@link NASA.apod}.
344
+ */
345
+ export interface APODResult {
346
+ /** Title of today's picture. */
347
+ title: string;
348
+ /** ISO-8601 date string. */
349
+ date: string;
350
+ /** Explanatory text written by a professional astronomer. */
351
+ explanation: string;
352
+ /** Standard-resolution media URL. */
353
+ url: string;
354
+ /** High-definition media URL. */
355
+ hdUrl: string;
356
+ /** Whether the APOD is an image or a video (e.g. YouTube embed). */
357
+ mediaType: 'image' | 'video';
358
+ /** Copyright holder, or empty string for public-domain images. */
359
+ copyright: string;
360
+ }
361
+ /**
362
+ * A result from the ESA/Hubble image archive, returned by {@link ESA.searchHubble}.
363
+ */
364
+ export interface ESAHubbleResult {
365
+ /** ESA-assigned identifier. */
366
+ id: string;
367
+ /** Title of the observation. */
368
+ title: string;
369
+ /** Description text. */
370
+ description: string;
371
+ /** Image credit / attribution. */
372
+ credit: string;
373
+ /** ISO-8601 date string. */
374
+ date: string;
375
+ /** Full-resolution image URL, or `null` if unavailable. */
376
+ imageUrl: string | null;
377
+ /** Thumbnail URL, or `null` if unavailable. */
378
+ thumbUrl: string | null;
379
+ /** Descriptive tags. */
380
+ tags: string[];
381
+ }
382
+ /**
383
+ * A resolved object from the CDS Simbad service, returned by {@link resolveSimbad}.
384
+ */
385
+ export interface SimbadResult {
386
+ /** Simbad main identifier. */
387
+ id: string;
388
+ /** Right Ascension in degrees (J2000). */
389
+ ra: number;
390
+ /** Declination in degrees (J2000). */
391
+ dec: number;
392
+ /** Simbad object type code. */
393
+ type: string;
394
+ }
395
+ /**
396
+ * A reference to a Wikimedia Commons image with attribution.
397
+ */
398
+ export interface ImageRef {
399
+ /** Wikimedia Commons filename (no URL prefix). */
400
+ filename: string;
401
+ /** Attribution / credit string. */
402
+ credit: string;
403
+ }
404
+ /**
405
+ * Configuration for {@link Media.progressive} blur-up image loading.
406
+ *
407
+ * @example
408
+ * ```ts
409
+ * await Media.progressive(imgEl, {
410
+ * placeholder: 'data:image/jpeg;base64,/9j/4A...',
411
+ * src: 'nebula-800w.jpg',
412
+ * srcHD: 'nebula-4k.jpg',
413
+ * })
414
+ * ```
415
+ */
416
+ export interface ProgressiveImageOptions {
417
+ /** Tiny blurred base64 or low-res URL shown immediately. */
418
+ placeholder?: string;
419
+ /** Medium-quality URL (shown while HD loads). */
420
+ src: string;
421
+ /** Full-resolution URL loaded last. */
422
+ srcHD?: string;
423
+ }
424
+ /**
425
+ * Cloudinary transformation options passed to {@link Media.cloudinaryUrl}.
426
+ */
427
+ export interface CloudinaryOptions {
428
+ /** Width in pixels. */
429
+ w?: number;
430
+ /** Height in pixels. */
431
+ h?: number;
432
+ /** Quality (1–100) or `'auto'` for adaptive quality. */
433
+ q?: number | 'auto';
434
+ /** Format (e.g. `'webp'`) or `'auto'` for automatic format. */
435
+ f?: string | 'auto';
436
+ /** Crop mode (e.g. `'fill'`, `'fit'`). */
437
+ crop?: string;
438
+ }
439
+ /**
440
+ * Unified image result returned by the {@link Data.getImage} pipeline.
441
+ *
442
+ * Contains everything a consumer needs to display an optimized, responsive
443
+ * image with proper attribution — regardless of which source it came from.
444
+ */
445
+ export interface ObjectImageResult {
446
+ /** Primary image URL at the requested width. */
447
+ src: string;
448
+ /** Responsive `srcset` string (e.g. `'...640w, ...1024w, ...1600w'`), or `null`. */
449
+ srcset: string | null;
450
+ /** Tiny placeholder URL for blur-up loading, or `null`. */
451
+ placeholder: string | null;
452
+ /** Attribution / credit string. */
453
+ credit: string;
454
+ /** Where the image came from. */
455
+ source: 'static' | 'panstarrs' | 'dss' | 'nasa' | 'esa';
456
+ }
457
+ /**
458
+ * Options for {@link Data.getImage}.
459
+ */
460
+ export interface GetImageOptions {
461
+ /** Desired image width in pixels. @defaultValue `1200` */
462
+ width?: number;
463
+ /** Widths for the responsive `srcset`. @defaultValue `[640, 1024, 1600]` */
464
+ srcsetWidths?: number[];
465
+ /** Which API sources to search if no static image exists. @defaultValue `'all'` */
466
+ source?: 'nasa' | 'esa' | 'all';
467
+ /** Timeout in ms for coordinate-based cutout requests. @defaultValue `15000` */
468
+ cutoutTimeout?: number;
469
+ /** Skip coordinate-based cutout sources (Pan-STARRS, DSS) entirely. @defaultValue `true` */
470
+ skipCutouts?: boolean;
471
+ /**
472
+ * Auto-prefetch nearby objects after resolving. Set `false` to disable.
473
+ * When enabled, nearby objects are fetched in the background so spatial
474
+ * browsing feels instant.
475
+ * @defaultValue `{ radius: 5, limit: 8 }`
476
+ */
477
+ prefetch?: false | {
478
+ radius?: number;
479
+ limit?: number;
480
+ };
481
+ }
482
+ /** Map projection type supported by the sky map renderer. */
483
+ export type ProjectionName = 'stereographic' | 'mollweide' | 'gnomonic';
484
+ /**
485
+ * Configuration for {@link renderSkyMap}.
486
+ *
487
+ * @example
488
+ * ```ts
489
+ * renderSkyMap(canvas, Data.all(), {
490
+ * projection: 'stereographic',
491
+ * center: { ra: 83.8, dec: -5.4 },
492
+ * scale: 300,
493
+ * showGrid: true,
494
+ * showMagnitudeLimit: 8,
495
+ * })
496
+ * ```
497
+ */
498
+ export interface SkyMapRenderOptions {
499
+ /** Projection type. @defaultValue `'stereographic'` */
500
+ projection?: ProjectionName;
501
+ /** Centre point of the map in equatorial coordinates. */
502
+ center?: EquatorialCoord;
503
+ /** Zoom scale factor (pixels per radian). @defaultValue `200` */
504
+ scale?: number;
505
+ /** Draw an RA/Dec coordinate grid. @defaultValue `false` */
506
+ showGrid?: boolean;
507
+ /** Label stars and objects by name. @defaultValue `false` */
508
+ showLabels?: boolean;
509
+ /** Only render objects brighter than this magnitude. */
510
+ showMagnitudeLimit?: number;
511
+ /** Canvas background CSS colour. @defaultValue `'#000'` */
512
+ background?: string;
513
+ /** Grid line CSS colour. */
514
+ gridColor?: string;
515
+ /** Label text CSS colour. */
516
+ labelColor?: string;
517
+ /** Show constellation stick-figure lines. Requires constellation data. */
518
+ showConstellationLines?: boolean;
519
+ /** Show constellation name labels at centre positions. */
520
+ showConstellationLabels?: boolean;
521
+ /** CSS colour for constellation stick-figure lines. */
522
+ constellationLineColor?: string;
523
+ /** CSS colour for constellation name labels. */
524
+ constellationLabelColor?: string;
525
+ /** Constellation data to render. Pass `CONSTELLATIONS` from the data module. */
526
+ constellations?: Array<{
527
+ ra: number;
528
+ dec: number;
529
+ name: string;
530
+ stickFigure: number[][];
531
+ }>;
532
+ }
533
+ /**
534
+ * A projected celestial object cached for hit-testing during interaction.
535
+ *
536
+ * Built internally by {@link InteractiveSkyMap} each render frame; not
537
+ * normally constructed by consumers.
538
+ */
539
+ export interface ProjectedObject {
540
+ /** The source catalog object. */
541
+ object: CelestialObject;
542
+ /** Projected x pixel coordinate on the canvas. */
543
+ x: number;
544
+ /** Projected y pixel coordinate on the canvas. */
545
+ y: number;
546
+ /** Visual radius in pixels (used for hit-detection threshold). */
547
+ radius: number;
548
+ }
549
+ /**
550
+ * Mutable view state tracked by {@link InteractiveSkyMap}.
551
+ */
552
+ export interface SkyMapViewState {
553
+ /** Current centre of the view in equatorial coordinates. */
554
+ center: EquatorialCoord;
555
+ /** Current zoom scale factor. */
556
+ scale: number;
557
+ /** Active projection type. */
558
+ projection: ProjectionName;
559
+ }
560
+ /**
561
+ * Event map for {@link InteractiveSkyMap}.
562
+ *
563
+ * Use with the `on()` / `off()` methods to subscribe to interaction events.
564
+ *
565
+ * @example
566
+ * ```ts
567
+ * skymap.on('select', ({ object }) => console.log(object.name))
568
+ * skymap.on('viewchange', ({ center, scale }) => updateURL(center, scale))
569
+ * ```
570
+ */
571
+ export interface SkyMapEventMap {
572
+ /** Fired when a celestial object is clicked / tapped. */
573
+ select: {
574
+ object: CelestialObject;
575
+ point: ProjectedPoint;
576
+ event: PointerEvent;
577
+ };
578
+ /** Fired when the hovered object changes (or becomes `null`). */
579
+ hover: {
580
+ object: CelestialObject | null;
581
+ point: ProjectedPoint | null;
582
+ event: PointerEvent;
583
+ };
584
+ /** Fired when the view centre or scale changes (pan, zoom, or programmatic). */
585
+ viewchange: {
586
+ center: EquatorialCoord;
587
+ scale: number;
588
+ projection: ProjectionName;
589
+ };
590
+ }
591
+ /**
592
+ * Configuration for a field-of-view indicator overlay drawn on the sky map.
593
+ *
594
+ * @example
595
+ * ```ts
596
+ * const fov: FOVOverlayOptions = { radiusDeg: 5, label: '10×50 binos' }
597
+ * ```
598
+ */
599
+ export interface FOVOverlayOptions {
600
+ /** FOV radius in degrees. */
601
+ radiusDeg: number;
602
+ /** Centre of the FOV circle. Defaults to the current map centre. */
603
+ center?: EquatorialCoord;
604
+ /** CSS stroke colour. @defaultValue `'rgba(255,255,100,0.6)'` */
605
+ color?: string;
606
+ /** Stroke width in pixels. @defaultValue `1.5` */
607
+ lineWidth?: number;
608
+ /** Optional label text (e.g. `'Telescope'`). */
609
+ label?: string;
610
+ }
611
+ /**
612
+ * Heads-up display (HUD) overlay configuration.
613
+ *
614
+ * Requires {@link InteractiveSkyMapOptions.observer} for horizon and zenith
615
+ * features.
616
+ */
617
+ export interface HUDOptions {
618
+ /** Show N/S/E/W cardinal labels at the map edges. @defaultValue `false` */
619
+ cardinalDirections?: boolean;
620
+ /** Draw the observer's horizon line. @defaultValue `false` */
621
+ horizonLine?: boolean;
622
+ /** Mark the zenith point. @defaultValue `false` */
623
+ zenithMarker?: boolean;
624
+ /** Observer parameters for horizon / zenith calculations. */
625
+ observer?: ObserverParams;
626
+ /** CSS colour for HUD elements. @defaultValue `'rgba(255,255,255,0.5)'` */
627
+ color?: string;
628
+ }
629
+ /**
630
+ * Full configuration for {@link InteractiveSkyMap}.
631
+ *
632
+ * Extends {@link SkyMapRenderOptions} with interaction, overlay, and
633
+ * real-time tracking options.
634
+ *
635
+ * @example
636
+ * ```ts
637
+ * createInteractiveSkyMap(canvas, Data.all(), {
638
+ * projection: 'stereographic',
639
+ * center: { ra: 83.8, dec: -5.4 },
640
+ * scale: 400,
641
+ * panEnabled: true,
642
+ * zoomEnabled: true,
643
+ * hud: { cardinalDirections: true },
644
+ * fov: { radiusDeg: 5, label: 'Telescope' },
645
+ * })
646
+ * ```
647
+ */
648
+ export interface InteractiveSkyMapOptions extends SkyMapRenderOptions {
649
+ /** Enable pan by mouse drag / touch drag. @defaultValue `true` */
650
+ panEnabled?: boolean;
651
+ /** Enable zoom by scroll wheel / pinch. @defaultValue `true` */
652
+ zoomEnabled?: boolean;
653
+ /** Enable click-to-select. @defaultValue `true` */
654
+ selectEnabled?: boolean;
655
+ /** Enable hover detection. @defaultValue `true` */
656
+ hoverEnabled?: boolean;
657
+ /** Minimum scale (zoom-out limit). @defaultValue `50` */
658
+ minScale?: number;
659
+ /** Maximum scale (zoom-in limit). @defaultValue `5000` */
660
+ maxScale?: number;
661
+ /** Hit-test radius in pixels. @defaultValue `15` */
662
+ hitRadius?: number;
663
+ /** FOV indicator overlay(s). */
664
+ fov?: FOVOverlayOptions | FOVOverlayOptions[];
665
+ /** HUD configuration. */
666
+ hud?: HUDOptions;
667
+ /** Enable real-time sidereal tracking. @defaultValue `false` */
668
+ realTime?: boolean;
669
+ /** Real-time render interval in ms. @defaultValue `1000` */
670
+ realTimeInterval?: number;
671
+ /** Observer parameters (required for real-time mode and HUD horizon/zenith). */
672
+ observer?: ObserverParams;
673
+ /** Highlight style for hovered objects. */
674
+ hoverHighlight?: {
675
+ /** Highlight ring colour. @defaultValue `'rgba(255,255,255,0.6)'` */
676
+ color?: string;
677
+ /** Highlight ring radius in pixels. @defaultValue `20` */
678
+ radius?: number;
679
+ /** Show the object name on hover. @defaultValue `true` */
680
+ showLabel?: boolean;
681
+ };
682
+ /** Highlight style for the selected object. */
683
+ selectHighlight?: {
684
+ /** Highlight ring colour. @defaultValue `'rgba(100,200,255,0.8)'` */
685
+ color?: string;
686
+ /** Highlight ring radius in pixels. @defaultValue `24` */
687
+ radius?: number;
688
+ };
689
+ }
690
+ /**
691
+ * Options for {@link morph}, which wraps a DOM mutation in a View Transition.
692
+ */
693
+ export interface MorphOptions {
694
+ /** Animation duration in milliseconds. @defaultValue `300` */
695
+ duration?: number;
696
+ /** CSS easing function. @defaultValue `'ease'` */
697
+ easing?: string;
698
+ /** Abort signal to cancel the transition. */
699
+ signal?: AbortSignal;
700
+ }
701
+ /**
702
+ * Options for {@link staggerIn} and {@link staggerOut}.
703
+ */
704
+ export interface StaggerOptions {
705
+ /** Initial delay before the first child animates, in ms. @defaultValue `0` */
706
+ delay?: number;
707
+ /** Delay between successive children, in ms. @defaultValue `50` */
708
+ stagger?: number;
709
+ /** Animation duration per child, in ms. @defaultValue `400` */
710
+ duration?: number;
711
+ /** Direction children slide in from. @defaultValue `'bottom'` */
712
+ from?: 'top' | 'bottom' | 'left' | 'right';
713
+ /** CSS distance to slide (e.g. `'20px'`). @defaultValue `'20px'` */
714
+ distance?: string;
715
+ /** Abort signal to cancel the animation. */
716
+ signal?: AbortSignal;
717
+ }
718
+ /**
719
+ * Options for {@link heroExpand} and {@link heroCollapse}.
720
+ */
721
+ export interface HeroExpandOptions {
722
+ /** Animation duration in milliseconds. @defaultValue `500` */
723
+ duration?: number;
724
+ /** CSS easing function. @defaultValue `'ease'` */
725
+ easing?: string;
726
+ /** Callback invoked when the animation completes. */
727
+ onDone?: () => void;
728
+ /** Abort signal to cancel the animation. */
729
+ signal?: AbortSignal;
730
+ }