@motioncomplex/cosmos-lib 1.0.9 → 1.0.15
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/dist/data/index.d.ts +53 -0
- package/dist/data/stars-tier1.d.ts +18 -0
- package/dist/data/stars-tier2.d.ts +19 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -2
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +1 -1
- package/dist/{skymap-interactive-CLg6FA0X.js → skymap-interactive-BBwTtzAL.js} +266 -182
- package/dist/{skymap-interactive-D2OZFwJ7.cjs → skymap-interactive-BPQAzeo8.cjs} +1 -1
- package/dist/stars-tier1-BjFG5KSI.cjs +1 -0
- package/dist/stars-tier1-C56Nvm8y.js +20 -0
- package/dist/stars-tier2-BsR2zl0r.cjs +1 -0
- package/dist/stars-tier2-Ci6zwt3G.js +20 -0
- package/package.json +3 -2
package/dist/data/index.d.ts
CHANGED
|
@@ -19,6 +19,13 @@ export { METEOR_SHOWERS } from './showers.js';
|
|
|
19
19
|
export { IMAGE_FALLBACKS, resolveImages, getObjectImage, prefetchImages } from './images.js';
|
|
20
20
|
export { computeFov, tryPanSTARRS, tryDSS } from './cutouts.js';
|
|
21
21
|
export type { CutoutResult, CutoutOptions } from './cutouts.js';
|
|
22
|
+
/** Compact star record used by tier data files. */
|
|
23
|
+
export interface TierStar {
|
|
24
|
+
ra: number;
|
|
25
|
+
dec: number;
|
|
26
|
+
mag: number;
|
|
27
|
+
bv: number;
|
|
28
|
+
}
|
|
22
29
|
/**
|
|
23
30
|
* Unified data-access facade for all built-in astronomical catalogs.
|
|
24
31
|
*
|
|
@@ -419,4 +426,50 @@ export declare const Data: {
|
|
|
419
426
|
* ```
|
|
420
427
|
*/
|
|
421
428
|
getActiveShowers(date: Date): MeteorShower[];
|
|
429
|
+
/**
|
|
430
|
+
* Load an expanded star tier into the catalog.
|
|
431
|
+
*
|
|
432
|
+
* - **Tier 0** (default): ~200 IAU named bright stars — always bundled
|
|
433
|
+
* - **Tier 1**: ~9,100 stars to magnitude 6.5 (naked-eye limit) — ~145 KB
|
|
434
|
+
* - **Tier 2**: ~120,000 stars to magnitude 9+ — ~1.9 MB (compact binary)
|
|
435
|
+
*
|
|
436
|
+
* Loaded stars are merged into the unified catalog and become available
|
|
437
|
+
* to `search()`, `nearby()`, `all()`, `getByType('star')`, and sky map
|
|
438
|
+
* rendering. Loading is idempotent — calling again for an already-loaded
|
|
439
|
+
* tier is a no-op.
|
|
440
|
+
*
|
|
441
|
+
* @param tier - The tier to load (1 or 2).
|
|
442
|
+
* @returns A promise that resolves with the number of stars added.
|
|
443
|
+
*
|
|
444
|
+
* @remarks
|
|
445
|
+
* Star data is sourced from the HYG Database v3.8 (public domain).
|
|
446
|
+
* Attribution: David Nash, "HYG Stellar Database", https://github.com/astronexus/HYG-Database
|
|
447
|
+
*
|
|
448
|
+
* @example
|
|
449
|
+
* ```ts
|
|
450
|
+
* // Load naked-eye stars
|
|
451
|
+
* const added = await Data.loadStarTier(1)
|
|
452
|
+
* console.log(`Added ${added} stars`)
|
|
453
|
+
*
|
|
454
|
+
* // Now search finds fainter stars
|
|
455
|
+
* const faint = Data.search('hip 12345')
|
|
456
|
+
*
|
|
457
|
+
* // Sky map renders more stars
|
|
458
|
+
* renderSkyMap(canvas, Data.all(), { showMagnitudeLimit: 6.5 })
|
|
459
|
+
* ```
|
|
460
|
+
*/
|
|
461
|
+
loadStarTier(tier: 1 | 2): Promise<number>;
|
|
462
|
+
/**
|
|
463
|
+
* Check which star tiers are currently loaded.
|
|
464
|
+
*
|
|
465
|
+
* @returns A set of loaded tier numbers (always includes 0).
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* ```ts
|
|
469
|
+
* Data.loadedStarTiers() // Set { 0 }
|
|
470
|
+
* await Data.loadStarTier(1)
|
|
471
|
+
* Data.loadedStarTiers() // Set { 0, 1 }
|
|
472
|
+
* ```
|
|
473
|
+
*/
|
|
474
|
+
loadedStarTiers(): ReadonlySet<number>;
|
|
422
475
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier 1 Star Catalog — ~9,110 stars to magnitude 6.5 (naked-eye limit).
|
|
3
|
+
*
|
|
4
|
+
* Source: Based on the HYG Database v3.8 (public domain).
|
|
5
|
+
* Attribution: David Nash, "HYG Stellar Database",
|
|
6
|
+
* https://github.com/astronexus/HYG-Database
|
|
7
|
+
*
|
|
8
|
+
* Data is stored as a compact base64-encoded Float32Array (4 floats per star:
|
|
9
|
+
* ra, dec, mag, bv). Decoded on first call to loadTier1Stars().
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import type { TierStar } from './index.js';
|
|
14
|
+
/**
|
|
15
|
+
* Decode and return the Tier 1 star catalog.
|
|
16
|
+
* Results are cached after first call.
|
|
17
|
+
*/
|
|
18
|
+
export declare function loadTier1Stars(): TierStar[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier 2 Star Catalog — ~120,000 stars to magnitude 9+ (binocular/telescope limit).
|
|
3
|
+
*
|
|
4
|
+
* Source: Based on the HYG Database v3.8 (public domain).
|
|
5
|
+
* Attribution: David Nash, "HYG Stellar Database",
|
|
6
|
+
* https://github.com/astronexus/HYG-Database
|
|
7
|
+
*
|
|
8
|
+
* Data is stored as a compact base64-encoded Float32Array (4 floats per star:
|
|
9
|
+
* ra, dec, mag, bv). This is the binary format option — ~1.9 MB base64,
|
|
10
|
+
* decodes to ~1.9 MB Float32Array.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
import type { TierStar } from './index.js';
|
|
15
|
+
/**
|
|
16
|
+
* Decode and return the Tier 2 star catalog.
|
|
17
|
+
* Results are cached after first call.
|
|
18
|
+
*/
|
|
19
|
+
export declare function loadTier2Stars(): TierStar[];
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./skymap-interactive-D2OZFwJ7.cjs"),O=require("./media-DlE7RKBL.cjs"),N={auToKm:e=>e*t.CONSTANTS.AU_TO_KM,kmToAu:e=>e/t.CONSTANTS.AU_TO_KM,lyToPc:e=>e/t.CONSTANTS.PC_TO_LY,pcToLy:e=>e*t.CONSTANTS.PC_TO_LY,pcToKm:e=>e*t.CONSTANTS.PC_TO_KM,lyToKm:e=>e*t.CONSTANTS.LY_TO_KM,kmToLy:e=>e/t.CONSTANTS.LY_TO_KM,degToRad:e=>e*t.CONSTANTS.DEG_TO_RAD,radToDeg:e=>e*t.CONSTANTS.RAD_TO_DEG,arcsecToDeg:e=>e/3600,degToArcsec:e=>e*3600,hrsToDeg:e=>e*15,degToHrs:e=>e/15,formatDistance(e){const o=e/t.CONSTANTS.AU_TO_KM;if(o<.01)return`${e.toFixed(0)} km`;if(o<1e3)return`${o.toPrecision(4)} AU`;const i=e/t.CONSTANTS.LY_TO_KM;return i<1e6?`${i.toPrecision(4)} ly`:`${(i/1e6).toPrecision(4)} Mly`},formatAngle(e){const o=e<0?"-":"",i=Math.abs(e),r=Math.floor(i),s=Math.floor((i-r)*60),c=((i-r)*60-s)*60;return`${o}${r}°${s}′${c.toFixed(1)}″`},formatRA(e){const o=(e%360+360)%360,i=Math.floor(o/15),r=Math.floor((o/15-i)*60),s=((o/15-i)*60-r)*60;return`${i}h ${r}m ${s.toFixed(1)}s`}},C={nextSolar(e=new Date){let o=new Date(e);for(let i=0;i<26;i++){const r=t.Moon.nextPhase(o,"new"),s=this._checkSolarEclipse(r);if(s)return s;o=new Date(r.valueOf()+864e5)}return null},nextLunar(e=new Date){let o=new Date(e);for(let i=0;i<26;i++){const r=t.Moon.nextPhase(o,"full"),s=this._checkLunarEclipse(r);if(s)return s;o=new Date(r.valueOf()+864e5)}return null},search(e,o,i){const r=[];let s=new Date(e);const c=o.valueOf();for(;s.valueOf()<c;){if(i!=="lunar"){const n=t.Moon.nextPhase(s,"new");if(n.valueOf()>c)break;const a=this._checkSolarEclipse(n);a&&r.push(a)}if(i!=="solar"){const n=t.Moon.nextPhase(s,"full");if(n.valueOf()<=c){const a=this._checkLunarEclipse(n);a&&r.push(a)}}s=new Date(s.valueOf()+15*864e5)}return r.sort((n,a)=>n.date.valueOf()-a.date.valueOf()),r.filter((n,a)=>a===0||Math.abs(n.date.valueOf()-r[a-1].date.valueOf())>864e5)},_checkSolarEclipse(e){const o=t.Moon.position(e),i=t.AstroMath.planetEcliptic("earth",e),r=((i.lon+180)%360+360)%360;if(Math.abs(o.eclipticLat)>1.5)return null;const c=i.r*1495978707e-1,n=Math.atan2(696e3,c)*(180/Math.PI),a=Math.atan2(1737.4,o.distance_km)*(180/Math.PI),u=t.AstroMath.angularSeparation(o,t.AstroMath.eclipticToEquatorial({lon:r,lat:0})),m=n+a;if(u>m*1.5)return null;let d,l;if(a>=n&&u<a-n)d="total",l=1;else if(a<n&&u<n-a)d="annular",l=a/n;else if(u<m)d="partial",l=(m-u)/(2*n);else return null;return{type:"solar",subtype:d,date:e,magnitude:l}},_checkLunarEclipse(e){const o=t.Moon.position(e),i=Math.abs(o.eclipticLat),r=Math.atan2(6371,o.distance_km)*(180/Math.PI),s=r*2.6,c=r*4.3,n=Math.atan2(1737.4,o.distance_km)*(180/Math.PI);if(i>c+n)return null;let a,u;if(i<s-n)a="total",u=(s-i)/(2*n);else if(i<s+n)a="partial",u=(s+n-i)/(2*n);else if(i<c+n)a="penumbral",u=(c+n-i)/(2*n);else return null;return{type:"lunar",subtype:a,date:e,magnitude:Math.min(u,1)}}},L={sun:{id:"sun",name:"Sun Surface",urls:["https://upload.wikimedia.org/wikipedia/commons/b/b4/The_Sun_by_the_Atmospheric_Imaging_Assembly_of_NASA%27s_Solar_Dynamics_Observatory_-_20100819.jpg"],credit:"NASA/SDO (AIA)",license:"public-domain",width:4096,height:4096},mercury:{id:"mercury",name:"Mercury Surface",urls:["https://upload.wikimedia.org/wikipedia/commons/9/92/Solarsystemscope_texture_2k_mercury.jpg"],credit:"NASA/Johns Hopkins APL/Carnegie Institution",license:"public-domain",width:2048,height:1024},venus:{id:"venus",name:"Venus Surface (Radar)",urls:["https://upload.wikimedia.org/wikipedia/commons/1/16/Solarsystemscope_texture_2k_venus_surface.jpg"],credit:"NASA/JPL-Caltech",license:"public-domain",width:2048,height:1024},venus_atmosphere:{id:"venus_atmosphere",name:"Venus Atmosphere",urls:["https://upload.wikimedia.org/wikipedia/commons/7/72/Solarsystemscope_texture_2k_venus_atmosphere.jpg"],credit:"NASA/JPL-Caltech",license:"public-domain",width:2048,height:1024},earth:{id:"earth",name:"Earth Blue Marble",urls:["https://upload.wikimedia.org/wikipedia/commons/0/04/Solarsystemscope_texture_8k_earth_daymap.jpg","https://upload.wikimedia.org/wikipedia/commons/2/23/Blue_Marble_2002.png"],credit:"NASA Visible Earth",license:"public-domain",width:8192,height:4096},earth_night:{id:"earth_night",name:"Earth Night Lights",urls:["https://upload.wikimedia.org/wikipedia/commons/b/ba/Solarsystemscope_texture_8k_earth_nightmap.jpg"],credit:"NASA Earth Observatory",license:"public-domain",width:8192,height:4096},earth_clouds:{id:"earth_clouds",name:"Earth Clouds",urls:["https://upload.wikimedia.org/wikipedia/commons/9/9d/Solarsystemscope_texture_8k_earth_clouds.jpg"],credit:"NASA Visible Earth",license:"public-domain",width:8192,height:4096},moon:{id:"moon",name:"Moon Surface",urls:["https://upload.wikimedia.org/wikipedia/commons/a/a8/Solarsystemscope_texture_8k_moon.jpg"],credit:"NASA/GSFC/Arizona State University (LROC)",license:"public-domain",width:8192,height:4096},mars:{id:"mars",name:"Mars Surface",urls:["https://upload.wikimedia.org/wikipedia/commons/f/fe/Solarsystemscope_texture_8k_mars.jpg"],credit:"NASA/JPL-Caltech (MOLA)",license:"public-domain",width:8192,height:4096},jupiter:{id:"jupiter",name:"Jupiter Surface",urls:["https://upload.wikimedia.org/wikipedia/commons/4/48/Solarsystemscope_texture_8k_jupiter.jpg"],credit:"NASA/JPL-Caltech (Cassini/Juno)",license:"public-domain",width:8192,height:4096},saturn:{id:"saturn",name:"Saturn Surface",urls:["https://upload.wikimedia.org/wikipedia/commons/e/ea/Solarsystemscope_texture_8k_saturn.jpg"],credit:"NASA/JPL-Caltech (Cassini)",license:"public-domain",width:8192,height:4096},saturn_ring:{id:"saturn_ring",name:"Saturn Ring",urls:["https://upload.wikimedia.org/wikipedia/commons/1/1e/Solarsystemscope_texture_2k_saturn_ring_alpha.png"],credit:"NASA/JPL-Caltech (Cassini)",license:"public-domain",width:2048,height:64},uranus:{id:"uranus",name:"Uranus Surface",urls:["https://upload.wikimedia.org/wikipedia/commons/9/95/Solarsystemscope_texture_2k_uranus.jpg"],credit:"NASA/JPL-Caltech (Voyager)",license:"public-domain",width:2048,height:1024},neptune:{id:"neptune",name:"Neptune Surface",urls:["https://upload.wikimedia.org/wikipedia/commons/1/1e/Solarsystemscope_texture_2k_neptune.jpg"],credit:"NASA/JPL-Caltech (Voyager)",license:"public-domain",width:2048,height:1024}},P={milky_way:{id:"milky_way",name:"Milky Way Panorama",urls:["https://upload.wikimedia.org/wikipedia/commons/4/43/ESO_-_Milky_Way.jpg"],credit:"ESO/S. Brunier",license:"CC-BY",width:9e3,height:3600},star_field:{id:"star_field",name:"Star Field Background",urls:["https://upload.wikimedia.org/wikipedia/commons/8/80/Solarsystemscope_texture_8k_stars.jpg"],credit:"NASA/Goddard Space Flight Center",license:"public-domain",width:8192,height:4096}};async function T(e,o={}){const{duration:i=400,easing:r="ease-in-out",signal:s}=o;if(s!=null&&s.aborted)return;if(!("startViewTransition"in document)){await e();return}document.documentElement.style.setProperty("--cosmos-vt-duration",`${i}ms`),document.documentElement.style.setProperty("--cosmos-vt-easing",r),await document.startViewTransition(e).finished}function k(e,o={}){const{delay:i=0,stagger:r=60,duration:s=500,from:c="bottom",distance:n="20px",signal:a}=o;if(a!=null&&a.aborted)return Promise.resolve();const m={top:`translateY(-${n})`,bottom:`translateY(${n})`,left:`translateX(-${n})`,right:`translateX(${n})`}[c],d=[...e.children];return d.forEach(l=>{l.style.opacity="0",l.style.transform=m,l.style.transition="none"}),d.length===0?Promise.resolve():new Promise(l=>{const f=performance.now()+i,p=()=>{d.forEach(S=>{S.style.opacity="1",S.style.transform="none",S.style.transition=""}),l()};a==null||a.addEventListener("abort",p,{once:!0});const h=S=>{if(a!=null&&a.aborted)return;let _=!0;for(let A=0;A<d.length;A++){const y=f+A*r;if(S>=y){const w=d[A];w.style.opacity==="0"&&(w.style.transition=`opacity ${s}ms ease, transform ${s}ms cubic-bezier(0.2,0,0,1)`,w.style.opacity="1",w.style.transform="none"),S<y+s&&(_=!1)}else _=!1}_?(a==null||a.removeEventListener("abort",p),l()):requestAnimationFrame(h)};requestAnimationFrame(()=>requestAnimationFrame(h))})}function E(e,o={}){const{stagger:i=40,duration:r=300,from:s="bottom",distance:c="12px",signal:n}=o;if(n!=null&&n.aborted)return Promise.resolve();const u={top:`translateY(-${c})`,bottom:`translateY(${c})`,left:`translateX(-${c})`,right:`translateX(${c})`}[s],m=[...e.children].reverse();return m.length===0?Promise.resolve():new Promise(d=>{const l=performance.now(),f=()=>{m.forEach(h=>{h.style.opacity="0",h.style.transform=u,h.style.transition=""}),d()};n==null||n.addEventListener("abort",f,{once:!0});const p=h=>{if(n!=null&&n.aborted)return;let S=!0;for(let _=0;_<m.length;_++){const A=l+_*i;if(h>=A){const y=m[_];y.style.opacity!=="0"&&(y.style.transition=`opacity ${r}ms ease, transform ${r}ms ease`,y.style.opacity="0",y.style.transform=u),h<A+r&&(S=!1)}else S=!1}S?(n==null||n.removeEventListener("abort",f),d()):requestAnimationFrame(p)};requestAnimationFrame(p)})}function g(e,o,i=300){return new Promise(r=>{e.style.transition=`opacity ${i}ms ease`,e.style.opacity=o==="in"?"1":"0",e.style.pointerEvents=o==="in"?"auto":"none";const s=()=>{e.removeEventListener("transitionend",s),r()};e.addEventListener("transitionend",s,{once:!0}),setTimeout(r,i+50)})}async function M(e,o,i=400){o.style.opacity="0",o.style.pointerEvents="none",o.style.display="",await Promise.all([g(e,"out",i),g(o,"in",i)]),e.style.display="none"}function b(e,o={}){const{duration:i=500,easing:r="cubic-bezier(0.4,0,0.2,1)",onDone:s,signal:c}=o;if(c!=null&&c.aborted)return;const n=e.getBoundingClientRect(),a=window.innerWidth/n.width,u=window.innerHeight/n.height,m=window.innerWidth/2-(n.left+n.width/2),d=window.innerHeight/2-(n.top+n.height/2);e.style.transformOrigin="center center",e.style.transition="none",e.style.transform="translate(0,0) scale(1,1)",requestAnimationFrame(()=>{c!=null&&c.aborted||requestAnimationFrame(()=>{if(c!=null&&c.aborted)return;e.style.transition=`transform ${i}ms ${r}`,e.style.transform=`translate(${m}px, ${d}px) scale(${a}, ${u})`;const l=()=>{e.removeEventListener("transitionend",l),e.style.transform="",e.style.transition="",s==null||s()};e.addEventListener("transitionend",l,{once:!0}),setTimeout(l,i+100)})})}function v(e,o={},i){const{duration:r=400,easing:s="cubic-bezier(0.4,0,0.2,1)",onDone:c,signal:n}=o;if(n!=null&&n.aborted)return;const a=e.getBoundingClientRect(),u=a.width/window.innerWidth,m=a.height/window.innerHeight,d=a.left+a.width/2-window.innerWidth/2,l=a.top+a.height/2-window.innerHeight/2,f=!i,p=i??document.createElement("div");f&&(Object.assign(p.style,{position:"fixed",inset:"0",pointerEvents:"none",zIndex:"9999",transformOrigin:"center center"}),document.body.appendChild(p)),p.style.transition=`transform ${r}ms ${s}, opacity ${r*.6}ms ease ${r*.4}ms`;const h=()=>{p.removeEventListener("transitionend",h),f&&p.remove(),c==null||c()};requestAnimationFrame(()=>{if(n!=null&&n.aborted){h();return}p.style.transform=`translate(${d}px, ${l}px) scale(${u}, ${m})`,p.style.opacity="0",p.addEventListener("transitionend",h,{once:!0}),setTimeout(h,r+100)})}const $={morph:T,staggerIn:k,staggerOut:E,fade:g,crossfade:M,heroExpand:b,heroCollapse:v},I={CONSTANTS:t.CONSTANTS,Units:N,Math:t.AstroMath,Sun:t.Sun,Moon:t.Moon,Eclipse:C,Planner:t.Planner,AstroClock:t.AstroClock,Data:t.Data,Media:O.Media,API:{NASA:t.NASA,ESA:t.ESA,resolveSimbad:t.resolveSimbad},SkyMap:{render:t.renderSkyMap,stereographic:t.stereographic,mollweide:t.mollweide,gnomonic:t.gnomonic,Interactive:t.InteractiveSkyMap,create:t.createInteractiveSkyMap},Transitions:{morph:T,staggerIn:k,staggerOut:E,fade:g,crossfade:M,heroExpand:b,heroCollapse:v}};exports.AstroClock=t.AstroClock;exports.AstroMath=t.AstroMath;exports.BRIGHT_STARS=t.BRIGHT_STARS;exports.CONSTANTS=t.CONSTANTS;exports.CONSTELLATIONS=t.CONSTELLATIONS;exports.DEEP_SKY_EXTRAS=t.DEEP_SKY_EXTRAS;exports.Data=t.Data;exports.ESA=t.ESA;exports.IMAGE_FALLBACKS=t.IMAGE_FALLBACKS;exports.InteractiveSkyMap=t.InteractiveSkyMap;exports.MESSIER_CATALOG=t.MESSIER_CATALOG;exports.METEOR_SHOWERS=t.METEOR_SHOWERS;exports.Moon=t.Moon;exports.NASA=t.NASA;exports.Planner=t.Planner;exports.SOLAR_SYSTEM=t.SOLAR_SYSTEM;exports.SkyMap=t.SkyMap;exports.Sun=t.Sun;exports.canvasToEquatorial=t.canvasToEquatorial;exports.computeFov=t.computeFov;exports.createInteractiveSkyMap=t.createInteractiveSkyMap;exports.getObjectImage=t.getObjectImage;exports.gnomonic=t.gnomonic;exports.mollweide=t.mollweide;exports.prefetchImages=t.prefetchImages;exports.renderSkyMap=t.renderSkyMap;exports.resolveImages=t.resolveImages;exports.resolveSimbad=t.resolveSimbad;exports.spectralColor=t.spectralColor;exports.stereographic=t.stereographic;exports.tryDSS=t.tryDSS;exports.tryPanSTARRS=t.tryPanSTARRS;exports.Media=O.Media;exports.Eclipse=C;exports.PLANET_TEXTURES=L;exports.STAR_TEXTURES=P;exports.Transitions=$;exports.Units=N;exports.crossfade=M;exports.default=I;exports.fade=g;exports.heroCollapse=v;exports.heroExpand=b;exports.morph=T;exports.staggerIn=k;exports.staggerOut=E;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./skymap-interactive-BPQAzeo8.cjs"),O=require("./media-DlE7RKBL.cjs"),N={auToKm:e=>e*t.CONSTANTS.AU_TO_KM,kmToAu:e=>e/t.CONSTANTS.AU_TO_KM,lyToPc:e=>e/t.CONSTANTS.PC_TO_LY,pcToLy:e=>e*t.CONSTANTS.PC_TO_LY,pcToKm:e=>e*t.CONSTANTS.PC_TO_KM,lyToKm:e=>e*t.CONSTANTS.LY_TO_KM,kmToLy:e=>e/t.CONSTANTS.LY_TO_KM,degToRad:e=>e*t.CONSTANTS.DEG_TO_RAD,radToDeg:e=>e*t.CONSTANTS.RAD_TO_DEG,arcsecToDeg:e=>e/3600,degToArcsec:e=>e*3600,hrsToDeg:e=>e*15,degToHrs:e=>e/15,formatDistance(e){const o=e/t.CONSTANTS.AU_TO_KM;if(o<.01)return`${e.toFixed(0)} km`;if(o<1e3)return`${o.toPrecision(4)} AU`;const i=e/t.CONSTANTS.LY_TO_KM;return i<1e6?`${i.toPrecision(4)} ly`:`${(i/1e6).toPrecision(4)} Mly`},formatAngle(e){const o=e<0?"-":"",i=Math.abs(e),r=Math.floor(i),s=Math.floor((i-r)*60),c=((i-r)*60-s)*60;return`${o}${r}°${s}′${c.toFixed(1)}″`},formatRA(e){const o=(e%360+360)%360,i=Math.floor(o/15),r=Math.floor((o/15-i)*60),s=((o/15-i)*60-r)*60;return`${i}h ${r}m ${s.toFixed(1)}s`}},C={nextSolar(e=new Date){let o=new Date(e);for(let i=0;i<26;i++){const r=t.Moon.nextPhase(o,"new"),s=this._checkSolarEclipse(r);if(s)return s;o=new Date(r.valueOf()+864e5)}return null},nextLunar(e=new Date){let o=new Date(e);for(let i=0;i<26;i++){const r=t.Moon.nextPhase(o,"full"),s=this._checkLunarEclipse(r);if(s)return s;o=new Date(r.valueOf()+864e5)}return null},search(e,o,i){const r=[];let s=new Date(e);const c=o.valueOf();for(;s.valueOf()<c;){if(i!=="lunar"){const n=t.Moon.nextPhase(s,"new");if(n.valueOf()>c)break;const a=this._checkSolarEclipse(n);a&&r.push(a)}if(i!=="solar"){const n=t.Moon.nextPhase(s,"full");if(n.valueOf()<=c){const a=this._checkLunarEclipse(n);a&&r.push(a)}}s=new Date(s.valueOf()+15*864e5)}return r.sort((n,a)=>n.date.valueOf()-a.date.valueOf()),r.filter((n,a)=>a===0||Math.abs(n.date.valueOf()-r[a-1].date.valueOf())>864e5)},_checkSolarEclipse(e){const o=t.Moon.position(e),i=t.AstroMath.planetEcliptic("earth",e),r=((i.lon+180)%360+360)%360;if(Math.abs(o.eclipticLat)>1.5)return null;const c=i.r*1495978707e-1,n=Math.atan2(696e3,c)*(180/Math.PI),a=Math.atan2(1737.4,o.distance_km)*(180/Math.PI),u=t.AstroMath.angularSeparation(o,t.AstroMath.eclipticToEquatorial({lon:r,lat:0})),m=n+a;if(u>m*1.5)return null;let d,l;if(a>=n&&u<a-n)d="total",l=1;else if(a<n&&u<n-a)d="annular",l=a/n;else if(u<m)d="partial",l=(m-u)/(2*n);else return null;return{type:"solar",subtype:d,date:e,magnitude:l}},_checkLunarEclipse(e){const o=t.Moon.position(e),i=Math.abs(o.eclipticLat),r=Math.atan2(6371,o.distance_km)*(180/Math.PI),s=r*2.6,c=r*4.3,n=Math.atan2(1737.4,o.distance_km)*(180/Math.PI);if(i>c+n)return null;let a,u;if(i<s-n)a="total",u=(s-i)/(2*n);else if(i<s+n)a="partial",u=(s+n-i)/(2*n);else if(i<c+n)a="penumbral",u=(c+n-i)/(2*n);else return null;return{type:"lunar",subtype:a,date:e,magnitude:Math.min(u,1)}}},L={sun:{id:"sun",name:"Sun Surface",urls:["https://upload.wikimedia.org/wikipedia/commons/b/b4/The_Sun_by_the_Atmospheric_Imaging_Assembly_of_NASA%27s_Solar_Dynamics_Observatory_-_20100819.jpg"],credit:"NASA/SDO (AIA)",license:"public-domain",width:4096,height:4096},mercury:{id:"mercury",name:"Mercury Surface",urls:["https://upload.wikimedia.org/wikipedia/commons/9/92/Solarsystemscope_texture_2k_mercury.jpg"],credit:"NASA/Johns Hopkins APL/Carnegie Institution",license:"public-domain",width:2048,height:1024},venus:{id:"venus",name:"Venus Surface (Radar)",urls:["https://upload.wikimedia.org/wikipedia/commons/1/16/Solarsystemscope_texture_2k_venus_surface.jpg"],credit:"NASA/JPL-Caltech",license:"public-domain",width:2048,height:1024},venus_atmosphere:{id:"venus_atmosphere",name:"Venus Atmosphere",urls:["https://upload.wikimedia.org/wikipedia/commons/7/72/Solarsystemscope_texture_2k_venus_atmosphere.jpg"],credit:"NASA/JPL-Caltech",license:"public-domain",width:2048,height:1024},earth:{id:"earth",name:"Earth Blue Marble",urls:["https://upload.wikimedia.org/wikipedia/commons/0/04/Solarsystemscope_texture_8k_earth_daymap.jpg","https://upload.wikimedia.org/wikipedia/commons/2/23/Blue_Marble_2002.png"],credit:"NASA Visible Earth",license:"public-domain",width:8192,height:4096},earth_night:{id:"earth_night",name:"Earth Night Lights",urls:["https://upload.wikimedia.org/wikipedia/commons/b/ba/Solarsystemscope_texture_8k_earth_nightmap.jpg"],credit:"NASA Earth Observatory",license:"public-domain",width:8192,height:4096},earth_clouds:{id:"earth_clouds",name:"Earth Clouds",urls:["https://upload.wikimedia.org/wikipedia/commons/9/9d/Solarsystemscope_texture_8k_earth_clouds.jpg"],credit:"NASA Visible Earth",license:"public-domain",width:8192,height:4096},moon:{id:"moon",name:"Moon Surface",urls:["https://upload.wikimedia.org/wikipedia/commons/a/a8/Solarsystemscope_texture_8k_moon.jpg"],credit:"NASA/GSFC/Arizona State University (LROC)",license:"public-domain",width:8192,height:4096},mars:{id:"mars",name:"Mars Surface",urls:["https://upload.wikimedia.org/wikipedia/commons/f/fe/Solarsystemscope_texture_8k_mars.jpg"],credit:"NASA/JPL-Caltech (MOLA)",license:"public-domain",width:8192,height:4096},jupiter:{id:"jupiter",name:"Jupiter Surface",urls:["https://upload.wikimedia.org/wikipedia/commons/4/48/Solarsystemscope_texture_8k_jupiter.jpg"],credit:"NASA/JPL-Caltech (Cassini/Juno)",license:"public-domain",width:8192,height:4096},saturn:{id:"saturn",name:"Saturn Surface",urls:["https://upload.wikimedia.org/wikipedia/commons/e/ea/Solarsystemscope_texture_8k_saturn.jpg"],credit:"NASA/JPL-Caltech (Cassini)",license:"public-domain",width:8192,height:4096},saturn_ring:{id:"saturn_ring",name:"Saturn Ring",urls:["https://upload.wikimedia.org/wikipedia/commons/1/1e/Solarsystemscope_texture_2k_saturn_ring_alpha.png"],credit:"NASA/JPL-Caltech (Cassini)",license:"public-domain",width:2048,height:64},uranus:{id:"uranus",name:"Uranus Surface",urls:["https://upload.wikimedia.org/wikipedia/commons/9/95/Solarsystemscope_texture_2k_uranus.jpg"],credit:"NASA/JPL-Caltech (Voyager)",license:"public-domain",width:2048,height:1024},neptune:{id:"neptune",name:"Neptune Surface",urls:["https://upload.wikimedia.org/wikipedia/commons/1/1e/Solarsystemscope_texture_2k_neptune.jpg"],credit:"NASA/JPL-Caltech (Voyager)",license:"public-domain",width:2048,height:1024}},P={milky_way:{id:"milky_way",name:"Milky Way Panorama",urls:["https://upload.wikimedia.org/wikipedia/commons/4/43/ESO_-_Milky_Way.jpg"],credit:"ESO/S. Brunier",license:"CC-BY",width:9e3,height:3600},star_field:{id:"star_field",name:"Star Field Background",urls:["https://upload.wikimedia.org/wikipedia/commons/8/80/Solarsystemscope_texture_8k_stars.jpg"],credit:"NASA/Goddard Space Flight Center",license:"public-domain",width:8192,height:4096}};async function T(e,o={}){const{duration:i=400,easing:r="ease-in-out",signal:s}=o;if(s!=null&&s.aborted)return;if(!("startViewTransition"in document)){await e();return}document.documentElement.style.setProperty("--cosmos-vt-duration",`${i}ms`),document.documentElement.style.setProperty("--cosmos-vt-easing",r),await document.startViewTransition(e).finished}function k(e,o={}){const{delay:i=0,stagger:r=60,duration:s=500,from:c="bottom",distance:n="20px",signal:a}=o;if(a!=null&&a.aborted)return Promise.resolve();const m={top:`translateY(-${n})`,bottom:`translateY(${n})`,left:`translateX(-${n})`,right:`translateX(${n})`}[c],d=[...e.children];return d.forEach(l=>{l.style.opacity="0",l.style.transform=m,l.style.transition="none"}),d.length===0?Promise.resolve():new Promise(l=>{const f=performance.now()+i,p=()=>{d.forEach(S=>{S.style.opacity="1",S.style.transform="none",S.style.transition=""}),l()};a==null||a.addEventListener("abort",p,{once:!0});const h=S=>{if(a!=null&&a.aborted)return;let _=!0;for(let A=0;A<d.length;A++){const y=f+A*r;if(S>=y){const w=d[A];w.style.opacity==="0"&&(w.style.transition=`opacity ${s}ms ease, transform ${s}ms cubic-bezier(0.2,0,0,1)`,w.style.opacity="1",w.style.transform="none"),S<y+s&&(_=!1)}else _=!1}_?(a==null||a.removeEventListener("abort",p),l()):requestAnimationFrame(h)};requestAnimationFrame(()=>requestAnimationFrame(h))})}function E(e,o={}){const{stagger:i=40,duration:r=300,from:s="bottom",distance:c="12px",signal:n}=o;if(n!=null&&n.aborted)return Promise.resolve();const u={top:`translateY(-${c})`,bottom:`translateY(${c})`,left:`translateX(-${c})`,right:`translateX(${c})`}[s],m=[...e.children].reverse();return m.length===0?Promise.resolve():new Promise(d=>{const l=performance.now(),f=()=>{m.forEach(h=>{h.style.opacity="0",h.style.transform=u,h.style.transition=""}),d()};n==null||n.addEventListener("abort",f,{once:!0});const p=h=>{if(n!=null&&n.aborted)return;let S=!0;for(let _=0;_<m.length;_++){const A=l+_*i;if(h>=A){const y=m[_];y.style.opacity!=="0"&&(y.style.transition=`opacity ${r}ms ease, transform ${r}ms ease`,y.style.opacity="0",y.style.transform=u),h<A+r&&(S=!1)}else S=!1}S?(n==null||n.removeEventListener("abort",f),d()):requestAnimationFrame(p)};requestAnimationFrame(p)})}function g(e,o,i=300){return new Promise(r=>{e.style.transition=`opacity ${i}ms ease`,e.style.opacity=o==="in"?"1":"0",e.style.pointerEvents=o==="in"?"auto":"none";const s=()=>{e.removeEventListener("transitionend",s),r()};e.addEventListener("transitionend",s,{once:!0}),setTimeout(r,i+50)})}async function M(e,o,i=400){o.style.opacity="0",o.style.pointerEvents="none",o.style.display="",await Promise.all([g(e,"out",i),g(o,"in",i)]),e.style.display="none"}function b(e,o={}){const{duration:i=500,easing:r="cubic-bezier(0.4,0,0.2,1)",onDone:s,signal:c}=o;if(c!=null&&c.aborted)return;const n=e.getBoundingClientRect(),a=window.innerWidth/n.width,u=window.innerHeight/n.height,m=window.innerWidth/2-(n.left+n.width/2),d=window.innerHeight/2-(n.top+n.height/2);e.style.transformOrigin="center center",e.style.transition="none",e.style.transform="translate(0,0) scale(1,1)",requestAnimationFrame(()=>{c!=null&&c.aborted||requestAnimationFrame(()=>{if(c!=null&&c.aborted)return;e.style.transition=`transform ${i}ms ${r}`,e.style.transform=`translate(${m}px, ${d}px) scale(${a}, ${u})`;const l=()=>{e.removeEventListener("transitionend",l),e.style.transform="",e.style.transition="",s==null||s()};e.addEventListener("transitionend",l,{once:!0}),setTimeout(l,i+100)})})}function v(e,o={},i){const{duration:r=400,easing:s="cubic-bezier(0.4,0,0.2,1)",onDone:c,signal:n}=o;if(n!=null&&n.aborted)return;const a=e.getBoundingClientRect(),u=a.width/window.innerWidth,m=a.height/window.innerHeight,d=a.left+a.width/2-window.innerWidth/2,l=a.top+a.height/2-window.innerHeight/2,f=!i,p=i??document.createElement("div");f&&(Object.assign(p.style,{position:"fixed",inset:"0",pointerEvents:"none",zIndex:"9999",transformOrigin:"center center"}),document.body.appendChild(p)),p.style.transition=`transform ${r}ms ${s}, opacity ${r*.6}ms ease ${r*.4}ms`;const h=()=>{p.removeEventListener("transitionend",h),f&&p.remove(),c==null||c()};requestAnimationFrame(()=>{if(n!=null&&n.aborted){h();return}p.style.transform=`translate(${d}px, ${l}px) scale(${u}, ${m})`,p.style.opacity="0",p.addEventListener("transitionend",h,{once:!0}),setTimeout(h,r+100)})}const $={morph:T,staggerIn:k,staggerOut:E,fade:g,crossfade:M,heroExpand:b,heroCollapse:v},I={CONSTANTS:t.CONSTANTS,Units:N,Math:t.AstroMath,Sun:t.Sun,Moon:t.Moon,Eclipse:C,Planner:t.Planner,AstroClock:t.AstroClock,Data:t.Data,Media:O.Media,API:{NASA:t.NASA,ESA:t.ESA,resolveSimbad:t.resolveSimbad},SkyMap:{render:t.renderSkyMap,stereographic:t.stereographic,mollweide:t.mollweide,gnomonic:t.gnomonic,Interactive:t.InteractiveSkyMap,create:t.createInteractiveSkyMap},Transitions:{morph:T,staggerIn:k,staggerOut:E,fade:g,crossfade:M,heroExpand:b,heroCollapse:v}};exports.AstroClock=t.AstroClock;exports.AstroMath=t.AstroMath;exports.BRIGHT_STARS=t.BRIGHT_STARS;exports.CONSTANTS=t.CONSTANTS;exports.CONSTELLATIONS=t.CONSTELLATIONS;exports.DEEP_SKY_EXTRAS=t.DEEP_SKY_EXTRAS;exports.Data=t.Data;exports.ESA=t.ESA;exports.IMAGE_FALLBACKS=t.IMAGE_FALLBACKS;exports.InteractiveSkyMap=t.InteractiveSkyMap;exports.MESSIER_CATALOG=t.MESSIER_CATALOG;exports.METEOR_SHOWERS=t.METEOR_SHOWERS;exports.Moon=t.Moon;exports.NASA=t.NASA;exports.Planner=t.Planner;exports.SOLAR_SYSTEM=t.SOLAR_SYSTEM;exports.SkyMap=t.SkyMap;exports.Sun=t.Sun;exports.canvasToEquatorial=t.canvasToEquatorial;exports.computeFov=t.computeFov;exports.createInteractiveSkyMap=t.createInteractiveSkyMap;exports.getObjectImage=t.getObjectImage;exports.gnomonic=t.gnomonic;exports.mollweide=t.mollweide;exports.prefetchImages=t.prefetchImages;exports.renderSkyMap=t.renderSkyMap;exports.resolveImages=t.resolveImages;exports.resolveSimbad=t.resolveSimbad;exports.spectralColor=t.spectralColor;exports.stereographic=t.stereographic;exports.tryDSS=t.tryDSS;exports.tryPanSTARRS=t.tryPanSTARRS;exports.Media=O.Media;exports.Eclipse=C;exports.PLANET_TEXTURES=L;exports.STAR_TEXTURES=P;exports.Transitions=$;exports.Units=N;exports.crossfade=M;exports.default=I;exports.fade=g;exports.heroCollapse=v;exports.heroExpand=b;exports.morph=T;exports.staggerIn=k;exports.staggerOut=E;
|
package/dist/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export { AstroClock } from './clock.js';
|
|
|
33
33
|
export type { AstroClockOptions, AstroClockEventMap, AstroEventType } from './clock.js';
|
|
34
34
|
export type { EclipseEvent } from './eclipse.js';
|
|
35
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';
|
|
36
|
+
export type { SolarSystemBody, BrightStar, Constellation, MessierObject, MeteorShower, ResolvedImage, ResolveImageOptions, CutoutResult, CutoutOptions, TierStar } from './data/index.js';
|
|
37
37
|
export { PLANET_TEXTURES, STAR_TEXTURES } from './data/textures.js';
|
|
38
38
|
export type { TextureInfo } from './data/textures.js';
|
|
39
39
|
export { Media } from './media.js';
|
|
@@ -188,6 +188,8 @@ declare const Cosmos: {
|
|
|
188
188
|
getMessier(number: number): import("./index.js").MessierObject | null;
|
|
189
189
|
showers(): readonly import("./index.js").MeteorShower[];
|
|
190
190
|
getActiveShowers(date: Date): import("./index.js").MeteorShower[];
|
|
191
|
+
loadStarTier(tier: 1 | 2): Promise<number>;
|
|
192
|
+
loadedStarTiers(): ReadonlySet<number>;
|
|
191
193
|
};
|
|
192
194
|
readonly Media: {
|
|
193
195
|
readonly chainLoad: (urls: string[]) => Promise<string>;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as h, M as w, A as k, c as P, I as $, g as x, m as C, s as N, r as I, a as R, E as D, N as j, D as F, b as Y, P as X, S as K } from "./skymap-interactive-
|
|
2
|
-
import { B as ee, d as te, e as ie, f as ne, h as ae, i as se, j as re, k as oe, l as ce, n as le, o as ue, p as de, q as me, t as pe, u as he, v as fe } from "./skymap-interactive-
|
|
1
|
+
import { C as h, M as w, A as k, c as P, I as $, g as x, m as C, s as N, r as I, a as R, E as D, N as j, D as F, b as Y, P as X, S as K } from "./skymap-interactive-BBwTtzAL.js";
|
|
2
|
+
import { B as ee, d as te, e as ie, f as ne, h as ae, i as se, j as re, k as oe, l as ce, n as le, o as ue, p as de, q as me, t as pe, u as he, v as fe } from "./skymap-interactive-BBwTtzAL.js";
|
|
3
3
|
import { M as q } from "./media-DVOcIMa1.js";
|
|
4
4
|
const J = {
|
|
5
5
|
// ── Distance ───────────────────────────────────────────────────────────────
|
package/dist/react/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),c=require("react"),i=require("../skymap-interactive-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),c=require("react"),i=require("../skymap-interactive-BPQAzeo8.cjs"),D=typeof window<"u";function C(e,t,s=1e4){const[o,f]=c.useState(null);return c.useEffect(()=>{const a=()=>{const u=i.Data.get(e);if(!u){f(null);return}const p=new Date,r=q(u,p);if(!r){f(null);return}f(i.AstroMath.equatorialToHorizontal(r,{...t,date:p}))};if(a(),!D)return;const h=setInterval(a,s);return()=>clearInterval(h)},[e,t.lat,t.lng,s]),o}function E(e,t=6e4){const[s,o]=c.useState(()=>i.Moon.phase(e??new Date));return c.useEffect(()=>{if(e){o(i.Moon.phase(e));return}const f=()=>o(i.Moon.phase(new Date));if(f(),!D)return;const a=setInterval(f,t);return()=>clearInterval(a)},[e==null?void 0:e.valueOf(),t]),s}function M(e={}){const[t,s]=c.useState(()=>e.startDate??new Date),[o,f]=c.useState(e.speed??1),[a,h]=c.useState(e.autoPlay??!1),u=c.useRef(null);u.current===null&&(u.current=new i.AstroClock(e)),c.useEffect(()=>{const n=u.current,d=k=>s(k.date),g=()=>h(!0),S=()=>h(!1),l=k=>s(k.date),P=k=>f(k.speed);return n.on("tick",d),n.on("play",g),n.on("pause",S),n.on("datechange",l),n.on("speedchange",P),()=>{n.off("tick",d),n.off("play",g),n.off("pause",S),n.off("datechange",l),n.off("speedchange",P),n.dispose(),u.current=null}},[]);const p=c.useCallback(()=>{var n;return(n=u.current)==null?void 0:n.play()},[]),r=c.useCallback(()=>{var n;return(n=u.current)==null?void 0:n.pause()},[]),y=c.useCallback(n=>{var d;return(d=u.current)==null?void 0:d.setDate(n)},[]),w=c.useCallback(n=>{var d;return(d=u.current)==null?void 0:d.setSpeed(n)},[]);return{date:t,speed:o,playing:a,play:p,pause:r,setDate:y,setSpeed:w,clock:u.current}}function v(e,t={},s=3e4){var a,h;const[o,f]=c.useState([]);return c.useEffect(()=>{const u=()=>{const r={...e,date:e.date??new Date};f(i.Planner.whatsUp(r,t))};if(u(),!D)return;const p=setInterval(u,s);return()=>clearInterval(p)},[e.lat,e.lng,(a=e.date)==null?void 0:a.valueOf(),s,t.minAltitude,t.magnitudeLimit,t.limit,t.tag,t.constellation,(h=t.types)==null?void 0:h.join(",")]),o}function x(e,t){var s;return c.useMemo(()=>{const o={...e,date:t??e.date??new Date};return i.Sun.twilight(o)},[e.lat,e.lng,t==null?void 0:t.valueOf(),(s=e.date)==null?void 0:s.valueOf()])}function I({objects:e,width:t="100%",height:s="400px",onSelect:o,onHover:f,skymapRef:a,...h}){const u=c.useRef(null),p=c.useRef(null);return c.useEffect(()=>{const r=u.current;if(!r||!D)return;const y=r.parentElement;if(!y)return;const w=window.devicePixelRatio||1,n=y.getBoundingClientRect();r.width=n.width*w,r.height=n.height*w,r.style.width=`${n.width}px`,r.style.height=`${n.height}px`;const d=e??i.Data.all().filter(l=>l.ra!=null&&l.dec!=null),g=new i.InteractiveSkyMap(r,d,h);p.current=g,a&&"current"in a&&(a.current=g),o&&g.on("select",({object:l})=>o(l)),f&&g.on("hover",({object:l})=>f(l));const S=()=>{const l=y.getBoundingClientRect();r.width=l.width*w,r.height=l.height*w,r.style.width=`${l.width}px`,r.style.height=`${l.height}px`,g.render()};return window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S),g.dispose(),p.current=null,a&&"current"in a&&(a.current=null)}},[]),m.jsx("div",{style:{width:t,height:s,position:"relative"},children:m.jsx("canvas",{ref:u,style:{width:"100%",height:"100%",display:"block"},"aria-label":"Interactive sky map"})})}function q(e,t){if(e.ra!==null&&e.dec!==null)return{ra:e.ra,dec:e.dec};if(e.type==="planet")try{const s=i.AstroMath.planetEcliptic(e.id,t);return i.AstroMath.eclipticToEquatorial(s)}catch{return null}if(e.id==="sun"){const s=i.Sun.position(t);return{ra:s.ra,dec:s.dec}}if(e.id==="moon"){const s=i.Moon.position(t);return{ra:s.ra,dec:s.dec}}return null}exports.SkyMap=I;exports.useAstroClock=M;exports.useMoonPhase=E;exports.useSkyPosition=C;exports.useTwilight=x;exports.useWhatsUp=v;
|
package/dist/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as C } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as v, useEffect as D, useState as g, useCallback as P, useMemo as q } from "react";
|
|
3
|
-
import { D as E, I as z, b as F, M as k, S as A, A as x, P as M } from "../skymap-interactive-
|
|
3
|
+
import { D as E, I as z, b as F, M as k, S as A, A as x, P as M } from "../skymap-interactive-BBwTtzAL.js";
|
|
4
4
|
const S = typeof window < "u";
|
|
5
5
|
function B(t, e, r = 1e4) {
|
|
6
6
|
const [l, u] = g(null);
|