@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,132 @@
1
+ /**
2
+ * Unit conversion and formatting utilities for astronomical distances,
3
+ * angles, and Right Ascension values.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * import { Units } from '@motioncomplex/cosmos-lib'
8
+ * Units.auToKm(1) // 149597870.7
9
+ * Units.formatRA(83.822) // '5h 35m 17.3s'
10
+ * Units.formatDistance(4.07e13) // '4.307 ly'
11
+ * ```
12
+ */
13
+ export declare const Units: {
14
+ /**
15
+ * Convert Astronomical Units to kilometres.
16
+ * @param au - Distance in AU.
17
+ * @returns Distance in kilometres.
18
+ */
19
+ readonly auToKm: (au: number) => number;
20
+ /**
21
+ * Convert kilometres to Astronomical Units.
22
+ * @param km - Distance in kilometres.
23
+ * @returns Distance in AU.
24
+ */
25
+ readonly kmToAu: (km: number) => number;
26
+ /**
27
+ * Convert light-years to parsecs.
28
+ * @param ly - Distance in light-years.
29
+ * @returns Distance in parsecs.
30
+ */
31
+ readonly lyToPc: (ly: number) => number;
32
+ /**
33
+ * Convert parsecs to light-years.
34
+ * @param pc - Distance in parsecs.
35
+ * @returns Distance in light-years.
36
+ */
37
+ readonly pcToLy: (pc: number) => number;
38
+ /**
39
+ * Convert parsecs to kilometres.
40
+ * @param pc - Distance in parsecs.
41
+ * @returns Distance in kilometres.
42
+ */
43
+ readonly pcToKm: (pc: number) => number;
44
+ /**
45
+ * Convert light-years to kilometres.
46
+ * @param ly - Distance in light-years.
47
+ * @returns Distance in kilometres.
48
+ */
49
+ readonly lyToKm: (ly: number) => number;
50
+ /**
51
+ * Convert kilometres to light-years.
52
+ * @param km - Distance in kilometres.
53
+ * @returns Distance in light-years.
54
+ */
55
+ readonly kmToLy: (km: number) => number;
56
+ /**
57
+ * Convert degrees to radians.
58
+ * @param d - Angle in degrees.
59
+ * @returns Angle in radians.
60
+ */
61
+ readonly degToRad: (d: number) => number;
62
+ /**
63
+ * Convert radians to degrees.
64
+ * @param r - Angle in radians.
65
+ * @returns Angle in degrees.
66
+ */
67
+ readonly radToDeg: (r: number) => number;
68
+ /**
69
+ * Convert arcseconds to degrees.
70
+ * @param a - Angle in arcseconds.
71
+ * @returns Angle in degrees.
72
+ */
73
+ readonly arcsecToDeg: (a: number) => number;
74
+ /**
75
+ * Convert degrees to arcseconds.
76
+ * @param d - Angle in degrees.
77
+ * @returns Angle in arcseconds.
78
+ */
79
+ readonly degToArcsec: (d: number) => number;
80
+ /**
81
+ * Convert Right Ascension from hours to degrees.
82
+ * @param h - RA in hours (0–24).
83
+ * @returns RA in degrees (0–360).
84
+ */
85
+ readonly hrsToDeg: (h: number) => number;
86
+ /**
87
+ * Convert Right Ascension from degrees to hours.
88
+ * @param d - RA in degrees (0–360).
89
+ * @returns RA in hours (0–24).
90
+ */
91
+ readonly degToHrs: (d: number) => number;
92
+ /**
93
+ * Format a distance in kilometres into a human-readable string,
94
+ * automatically choosing the most appropriate unit (km, AU, ly, or Mly).
95
+ *
96
+ * @param km - Distance in kilometres.
97
+ * @returns Formatted string with unit suffix.
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * Units.formatDistance(384_400) // '0.002570 AU'
102
+ * Units.formatDistance(9_460_730_472_580 * 8.6) // '8.600 ly'
103
+ * ```
104
+ */
105
+ readonly formatDistance: (km: number) => string;
106
+ /**
107
+ * Format decimal degrees as d°m′s″ (signed).
108
+ *
109
+ * @param deg - Angle in decimal degrees.
110
+ * @returns Formatted DMS string.
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * Units.formatAngle(-16.716) // '-16°42′57.6″'
115
+ * Units.formatAngle(83.822) // '83°49′19.2″'
116
+ * ```
117
+ */
118
+ readonly formatAngle: (deg: number) => string;
119
+ /**
120
+ * Format Right Ascension from decimal degrees into hours/minutes/seconds.
121
+ *
122
+ * @param deg - RA in decimal degrees (0–360).
123
+ * @returns Formatted string like `'5h 35m 17.3s'`.
124
+ *
125
+ * @example
126
+ * ```ts
127
+ * Units.formatRA(83.822) // '5h 35m 17.3s'
128
+ * Units.formatRA(0) // '0h 0m 0.0s'
129
+ * ```
130
+ */
131
+ readonly formatRA: (deg: number) => string;
132
+ };
package/package.json ADDED
@@ -0,0 +1,93 @@
1
+ {
2
+ "name": "@motioncomplex/cosmos-lib",
3
+ "publishConfig": {
4
+ "registry": "https://registry.npmjs.org",
5
+ "access": "public"
6
+ },
7
+ "version": "1.0.9",
8
+ "description": "Reusable astronomical utilities: data, math, media, sky maps, NASA APIs, and UI transitions.",
9
+ "author": "",
10
+ "license": "MIT",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/MotionComplex/cosmos-lib.git"
14
+ },
15
+ "type": "module",
16
+ "files": [
17
+ "dist",
18
+ "!dist/**/*.map",
19
+ "!dist/bundle-analysis.html",
20
+ "README.md"
21
+ ],
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "import": "./dist/index.js",
26
+ "require": "./dist/index.cjs"
27
+ },
28
+ "./three": {
29
+ "types": "./dist/three/index.d.ts",
30
+ "import": "./dist/three/index.js",
31
+ "require": "./dist/three/index.cjs"
32
+ },
33
+ "./react": {
34
+ "types": "./dist/react/index.d.ts",
35
+ "import": "./dist/react/index.js",
36
+ "require": "./dist/react/index.cjs"
37
+ }
38
+ },
39
+ "main": "./dist/index.cjs",
40
+ "module": "./dist/index.js",
41
+ "types": "./dist/index.d.ts",
42
+ "scripts": {
43
+ "build": "vite build && tsc --emitDeclarationOnly --declaration --declarationDir dist",
44
+ "test": "vitest run",
45
+ "test:watch": "vitest",
46
+ "test:coverage": "vitest run --coverage",
47
+ "typecheck": "tsc --noEmit",
48
+ "lint": "eslint src tests --ext .ts",
49
+ "docs": "typedoc",
50
+ "size": "npm run build && node -e \"const s=require('fs').statSync('dist/index.cjs').size;console.log('CJS:',Math.round(s/1024)+'KB');if(s>200000){console.error('Bundle exceeds 200KB!');process.exit(1)}\"",
51
+ "prepublishOnly": "npm run typecheck && npm test && npm run build"
52
+ },
53
+ "devDependencies": {
54
+ "@testing-library/react": "^16.3.2",
55
+ "@types/node": "^22.19.15",
56
+ "@types/react": "^19.2.14",
57
+ "@types/three": "^0.183.1",
58
+ "@vitest/coverage-v8": "^4.1.0",
59
+ "happy-dom": "^20.8.4",
60
+ "react": "^19.2.4",
61
+ "react-dom": "^19.2.4",
62
+ "rollup-plugin-visualizer": "^6.0.11",
63
+ "three": "^0.160.0",
64
+ "typedoc": "^0.28.17",
65
+ "typedoc-plugin-markdown": "^4.11.0",
66
+ "typescript": "^5.3.3",
67
+ "vite": "^6.4.1",
68
+ "vite-plugin-dts": "^4.5.4",
69
+ "vitest": "^4.1.0"
70
+ },
71
+ "peerDependencies": {
72
+ "react": ">=18.0.0",
73
+ "three": ">=0.150.0"
74
+ },
75
+ "peerDependenciesMeta": {
76
+ "three": {
77
+ "optional": true
78
+ },
79
+ "react": {
80
+ "optional": true
81
+ }
82
+ },
83
+ "keywords": [
84
+ "astronomy",
85
+ "celestial",
86
+ "nasa",
87
+ "skymap",
88
+ "coordinates",
89
+ "three.js",
90
+ "space"
91
+ ],
92
+ "sideEffects": false
93
+ }