swisseph-wasm 0.0.1
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/DOCUMENTATION.md +888 -0
- package/LICENSE +41 -0
- package/QUICK_REFERENCE.md +263 -0
- package/README.md +305 -0
- package/examples/README.md +239 -0
- package/examples/basic-usage.js +301 -0
- package/examples/birth-chart.js +386 -0
- package/examples/demo.html +543 -0
- package/package.json +75 -0
- package/src/swisseph.js +1092 -0
- package/types/index.d.ts +255 -0
- package/wsam/swisseph.data +0 -0
- package/wsam/swisseph.js +3412 -0
- package/wsam/swisseph.wasm +0 -0
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Swiss Ephemeris WebAssembly TypeScript Definitions
|
|
3
|
+
* High-precision astronomical calculations for JavaScript
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
declare module 'swisseph-wasm' {
|
|
7
|
+
/**
|
|
8
|
+
* Main Swiss Ephemeris class
|
|
9
|
+
*/
|
|
10
|
+
export default class SwissEph {
|
|
11
|
+
// Constants - Planets
|
|
12
|
+
readonly SE_SUN: 0;
|
|
13
|
+
readonly SE_MOON: 1;
|
|
14
|
+
readonly SE_MERCURY: 2;
|
|
15
|
+
readonly SE_VENUS: 3;
|
|
16
|
+
readonly SE_MARS: 4;
|
|
17
|
+
readonly SE_JUPITER: 5;
|
|
18
|
+
readonly SE_SATURN: 6;
|
|
19
|
+
readonly SE_URANUS: 7;
|
|
20
|
+
readonly SE_NEPTUNE: 8;
|
|
21
|
+
readonly SE_PLUTO: 9;
|
|
22
|
+
readonly SE_EARTH: 14;
|
|
23
|
+
|
|
24
|
+
// Constants - Lunar Nodes
|
|
25
|
+
readonly SE_MEAN_NODE: 10;
|
|
26
|
+
readonly SE_TRUE_NODE: 11;
|
|
27
|
+
readonly SE_MEAN_APOG: 12;
|
|
28
|
+
readonly SE_OSCU_APOG: 13;
|
|
29
|
+
|
|
30
|
+
// Constants - Asteroids
|
|
31
|
+
readonly SE_CHIRON: 15;
|
|
32
|
+
readonly SE_PHOLUS: 16;
|
|
33
|
+
readonly SE_CERES: 17;
|
|
34
|
+
readonly SE_PALLAS: 18;
|
|
35
|
+
readonly SE_JUNO: 19;
|
|
36
|
+
readonly SE_VESTA: 20;
|
|
37
|
+
|
|
38
|
+
// Constants - Calculation Flags
|
|
39
|
+
readonly SEFLG_JPLEPH: 1;
|
|
40
|
+
readonly SEFLG_SWIEPH: 2;
|
|
41
|
+
readonly SEFLG_MOSEPH: 4;
|
|
42
|
+
readonly SEFLG_HELCTR: 8;
|
|
43
|
+
readonly SEFLG_TRUEPOS: 16;
|
|
44
|
+
readonly SEFLG_J2000: 32;
|
|
45
|
+
readonly SEFLG_NONUT: 64;
|
|
46
|
+
readonly SEFLG_SPEED: 256;
|
|
47
|
+
readonly SEFLG_NOGDEFL: 512;
|
|
48
|
+
readonly SEFLG_NOABERR: 1024;
|
|
49
|
+
readonly SEFLG_EQUATORIAL: 2048;
|
|
50
|
+
readonly SEFLG_XYZ: 4096;
|
|
51
|
+
readonly SEFLG_RADIANS: 8192;
|
|
52
|
+
readonly SEFLG_BARYCTR: 16384;
|
|
53
|
+
readonly SEFLG_TOPOCTR: 32768;
|
|
54
|
+
readonly SEFLG_SIDEREAL: 65536;
|
|
55
|
+
|
|
56
|
+
// Constants - Sidereal Modes
|
|
57
|
+
readonly SE_SIDM_FAGAN_BRADLEY: 0;
|
|
58
|
+
readonly SE_SIDM_LAHIRI: 1;
|
|
59
|
+
readonly SE_SIDM_DELUCE: 2;
|
|
60
|
+
readonly SE_SIDM_RAMAN: 3;
|
|
61
|
+
readonly SE_SIDM_KRISHNAMURTI: 5;
|
|
62
|
+
|
|
63
|
+
// Constants - Calendar Types
|
|
64
|
+
readonly SE_JUL_CAL: 0;
|
|
65
|
+
readonly SE_GREG_CAL: 1;
|
|
66
|
+
|
|
67
|
+
// Constants - Degree Splitting
|
|
68
|
+
readonly SE_SPLIT_DEG_ROUND_SEC: 1;
|
|
69
|
+
readonly SE_SPLIT_DEG_ROUND_MIN: 2;
|
|
70
|
+
readonly SE_SPLIT_DEG_ROUND_DEG: 4;
|
|
71
|
+
readonly SE_SPLIT_DEG_ZODIACAL: 8;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Initialize the Swiss Ephemeris WebAssembly module
|
|
75
|
+
*/
|
|
76
|
+
initSwissEph(): Promise<void>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Calculate Julian Day Number
|
|
80
|
+
*/
|
|
81
|
+
julday(year: number, month: number, day: number, hour: number): number;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Calculate planetary positions (Universal Time)
|
|
85
|
+
*/
|
|
86
|
+
calc_ut(jd: number, planet: number, flags: number): Float64Array;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Calculate planetary positions with detailed output
|
|
90
|
+
*/
|
|
91
|
+
calc(jd: number, planet: number, flags: number): {
|
|
92
|
+
longitude: number;
|
|
93
|
+
latitude: number;
|
|
94
|
+
distance: number;
|
|
95
|
+
longitudeSpeed: number;
|
|
96
|
+
latitudeSpeed: number;
|
|
97
|
+
distanceSpeed: number;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Calculate Delta T (difference between Terrestrial Time and Universal Time)
|
|
102
|
+
*/
|
|
103
|
+
deltat(jd: number): number;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Calculate sidereal time
|
|
107
|
+
*/
|
|
108
|
+
sidtime(jd: number): number;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Convert UTC time to Julian Day
|
|
112
|
+
*/
|
|
113
|
+
utc_to_jd(year: number, month: number, day: number, hour: number, minute: number, second: number, gregflag: number): {
|
|
114
|
+
julianDayET: number;
|
|
115
|
+
julianDayUT: number;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Convert Julian Day back to calendar date
|
|
120
|
+
*/
|
|
121
|
+
revjul(jd: number, gregflag: number): {
|
|
122
|
+
year: number;
|
|
123
|
+
month: number;
|
|
124
|
+
day: number;
|
|
125
|
+
hour: number;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Convert calendar date to Julian Day
|
|
130
|
+
*/
|
|
131
|
+
date_conversion(year: number, month: number, day: number, hour: number, gregflag: number): number;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Normalize degrees to 0-360 range
|
|
135
|
+
*/
|
|
136
|
+
degnorm(degrees: number): number;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Split decimal degrees into components
|
|
140
|
+
*/
|
|
141
|
+
split_deg(degrees: number, roundflag: number): {
|
|
142
|
+
degree: number;
|
|
143
|
+
min: number;
|
|
144
|
+
second: number;
|
|
145
|
+
fraction: number;
|
|
146
|
+
sign: number;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Get day of week for Julian Day
|
|
151
|
+
*/
|
|
152
|
+
day_of_week(jd: number): number;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Set sidereal calculation mode
|
|
156
|
+
*/
|
|
157
|
+
set_sid_mode(sidmode: number, t0: number, ayan_t0: number): void;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Get ayanamsa value for sidereal calculations
|
|
161
|
+
*/
|
|
162
|
+
get_ayanamsa(jd: number): number;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Get Swiss Ephemeris version
|
|
166
|
+
*/
|
|
167
|
+
version(): string;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Get planet name
|
|
171
|
+
*/
|
|
172
|
+
get_planet_name(planet: number): string;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Set topocentric location
|
|
176
|
+
*/
|
|
177
|
+
set_topo(longitude: number, latitude: number, altitude: number): void;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Calculate fixed star positions
|
|
181
|
+
*/
|
|
182
|
+
fixstar(starname: string, jd: number, flags: number): Float64Array | null;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Get fixed star magnitude
|
|
186
|
+
*/
|
|
187
|
+
fixstar_mag(starname: string): number | null;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Calculate house positions
|
|
191
|
+
*/
|
|
192
|
+
houses(jd: number, latitude: number, longitude: number, hsys: string): number;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Calculate house position for a planet
|
|
196
|
+
*/
|
|
197
|
+
house_pos(armc: number, geolat: number, eps: number, hsys: string, lon: number, lat: number): number;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Close Swiss Ephemeris and free memory
|
|
201
|
+
*/
|
|
202
|
+
close(): void;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Planet position result from calc_ut
|
|
207
|
+
*/
|
|
208
|
+
export interface PlanetPosition {
|
|
209
|
+
longitude: number;
|
|
210
|
+
latitude: number;
|
|
211
|
+
distance: number;
|
|
212
|
+
speed: number;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Detailed planet position result from calc
|
|
217
|
+
*/
|
|
218
|
+
export interface DetailedPlanetPosition {
|
|
219
|
+
longitude: number;
|
|
220
|
+
latitude: number;
|
|
221
|
+
distance: number;
|
|
222
|
+
longitudeSpeed: number;
|
|
223
|
+
latitudeSpeed: number;
|
|
224
|
+
distanceSpeed: number;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Date components
|
|
229
|
+
*/
|
|
230
|
+
export interface DateComponents {
|
|
231
|
+
year: number;
|
|
232
|
+
month: number;
|
|
233
|
+
day: number;
|
|
234
|
+
hour: number;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Julian Day result from UTC conversion
|
|
239
|
+
*/
|
|
240
|
+
export interface JulianDayResult {
|
|
241
|
+
julianDayET: number;
|
|
242
|
+
julianDayUT: number;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Degree splitting result
|
|
247
|
+
*/
|
|
248
|
+
export interface DegreeSplit {
|
|
249
|
+
degree: number;
|
|
250
|
+
min: number;
|
|
251
|
+
second: number;
|
|
252
|
+
fraction: number;
|
|
253
|
+
sign: number;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
Binary file
|