panchang-ts 0.4.1 → 0.4.2

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 CHANGED
@@ -22,7 +22,7 @@ Works offline in React Native (Hermes), Node.js, and browsers.
22
22
  - **Instant mode:** Elements active at an exact moment (birth charts, muhurta selection)
23
23
  - **3 ayanamsa systems:** Lahiri (default), B.V. Raman, KP (Krishnamurti)
24
24
  - **3 languages:** English, Sanskrit (Devanagari), Hindi
25
- - **Jyotish (Vedic astrology):** Janam Kundli with Lagna, 12 houses (whole-sign), all 9 graha positions, Navamsa (D-9) chart, Vimshottari Dasha with Antardasha breakdown
25
+ - **Jyotish (Vedic astrology):** All 9 graha positions (geocentric, sidereal), Vimshottari Dasha with Antardasha breakdown
26
26
  - **React Native compatible:** Pure JS math, no native modules, tested on Hermes
27
27
  - **Fast:** ~0.1 ms names-only on Node.js; <100 ms on budget Android (Hermes)
28
28
  - **Typed:** Full TypeScript types for every result and option
@@ -186,77 +186,6 @@ const result = getDailyPanchang(
186
186
 
187
187
  ---
188
188
 
189
- ### `computeKundli(birthDateUtc, location, options?)`
190
-
191
- Compute a complete Janam Kundli (Vedic birth chart).
192
-
193
- ```typescript
194
- import { computeKundli } from 'panchang-ts';
195
-
196
- const kundli = computeKundli(
197
- new Date('1990-06-15T08:30:00Z'), // UTC birth moment
198
- { latitude: 18.5204, longitude: 73.8567 }, // birth location
199
- { ayanamsa: 'lahiri', language: 'en' },
200
- );
201
-
202
- // Ascendant
203
- console.log(kundli.lagna.name); // "Karka" (Cancer)
204
- console.log(kundli.lagnaLongitude); // 95.4 (sidereal degrees)
205
-
206
- // Planetary positions
207
- const sun = kundli.grahas.sun;
208
- console.log(sun.rashi.name); // "Mithuna"
209
- console.log(sun.nakshatra.name); // "Ardra"
210
- console.log(sun.degreeInRashi); // 24.3
211
- console.log(sun.isRetrograde); // false
212
-
213
- // Houses (whole-sign)
214
- kundli.houses.forEach(h => {
215
- console.log(`House ${h.number}: ${h.rashi.name} — ${h.planets.join(', ')}`);
216
- });
217
-
218
- // Navamsa (D-9) chart
219
- console.log(kundli.navamsa.lagna.name); // Navamsa lagna sign
220
- kundli.navamsa.positions.forEach(p => {
221
- console.log(p.planet, '→', p.rashi.name);
222
- });
223
-
224
- // Vimshottari Dasha
225
- const dasha = kundli.dasha;
226
- console.log(dasha.currentMahaDashaLord); // e.g. "Jupiter"
227
- dasha.mahaDashas.forEach(md => {
228
- console.log(md.lord, md.startDate, '→', md.endDate, `(${md.years}y)`);
229
- md.antarDashas.forEach(ad => {
230
- console.log(' ', ad.lord, ad.startDate, '→', ad.endDate);
231
- });
232
- });
233
-
234
- // Full birth Panchang is also included
235
- console.log(kundli.birthPanchang.tithi.name); // Tithi at birth
236
- ```
237
-
238
- **Returns: `KundliResult`**
239
-
240
- | Field | Type | Description |
241
- |-------|------|-------------|
242
- | `lagnaLongitude` | `number` | Sidereal longitude of the Ascendant in degrees [0, 360) |
243
- | `lagna` | `RashiInfo` | Ascendant zodiac sign |
244
- | `houses` | `KundliHouse[]` | 12 houses; House 1 = Lagna sign (whole-sign system) |
245
- | `grahas` | `PlanetaryPositions` | All 9 graha positions with rashi, nakshatra, house, retrograde flag |
246
- | `navamsa` | `NavamsaChart` | D-9 divisional chart with Lagna and all planet positions |
247
- | `dasha` | `VimshottariDashaResult` | Full Vimshottari Dasha sequence from birth with Antardasha breakdown |
248
- | `birthPanchang` | `InstantPanchangResult` | Complete Panchang at the birth moment |
249
-
250
- **`KundliOptions`** (optional):
251
-
252
- | Option | Type | Default | Description |
253
- |--------|------|---------|-------------|
254
- | `ayanamsa` | `'lahiri' \| 'raman' \| 'krishnamurti'` | `'lahiri'` | Ayanamsa system |
255
- | `language` | `'en' \| 'sa' \| 'hi'` | `'en'` | Language for names |
256
- | `computeDasha` | `boolean` | `true` | Set `false` to skip Vimshottari Dasha computation |
257
-
258
- ---
259
-
260
189
  ### `getInstantPanchang(date, location, options?)`
261
190
 
262
191
  Returns the single Panchang element active at an exact UTC moment.
@@ -332,7 +261,7 @@ import {
332
261
  computeAbhijitMuhurta, computeBrahmaMuhurta,
333
262
  computeGowriPanchangam,
334
263
  // Jyotish
335
- computePlanetaryPositions, computeVimshottariDasha, computeLagnaLongitude,
264
+ computePlanetaryPositions, computeVimshottariDasha,
336
265
  GRAHA_ABBR,
337
266
  } from 'panchang-ts';
338
267
 
@@ -374,9 +303,6 @@ console.log(grahas.jupiter.rashi.name); // e.g. "Dhanu"
374
303
  console.log(grahas.saturn.isRetrograde); // true/false
375
304
  console.log(GRAHA_ABBR['Jupiter']); // "Ju"
376
305
 
377
- // Lagna (Ascendant) longitude — useful when building a custom chart renderer
378
- const lagnaLon = computeLagnaLongitude(birthDate, latitude, longitude, 'lahiri');
379
-
380
306
  // Vimshottari Dasha — pass birth date and Moon's sidereal longitude
381
307
  const moonLon = getSiderealMoonLongitude(birthDate, 'lahiri');
382
308
  const dasha = computeVimshottariDasha(birthDate, moonLon);
@@ -546,7 +472,6 @@ interface GrahaPosition {
546
472
  degreeInRashi: number; // degrees within sign [0, 30)
547
473
  nakshatra: NakshatraInfo; // nakshatra + pada + completion %
548
474
  isRetrograde: boolean; // always false for Sun/Moon; always true for Rahu/Ketu
549
- house: number; // 1–12 (whole-sign system, relative to Lagna)
550
475
  }
551
476
 
552
477
  interface PlanetaryPositions {
@@ -555,22 +480,6 @@ interface PlanetaryPositions {
555
480
  saturn: GrahaPosition; rahu: GrahaPosition; ketu: GrahaPosition;
556
481
  }
557
482
 
558
- interface KundliHouse {
559
- number: number; // 1–12
560
- rashi: RashiInfo; // sign on this house cusp
561
- planets: string[]; // short abbreviations: "Su", "Mo", "Ma", "Me", "Ju", "Ve", "Sa", "Ra", "Ke"
562
- }
563
-
564
- interface NavamsaPosition {
565
- planet: GrahaName;
566
- rashi: RashiInfo; // D-9 (Navamsa) sign for this planet
567
- }
568
-
569
- interface NavamsaChart {
570
- positions: NavamsaPosition[];
571
- lagna: RashiInfo; // Navamsa Lagna sign
572
- }
573
-
574
483
  type DashaLord = 'Ketu' | 'Venus' | 'Sun' | 'Moon' | 'Mars' | 'Rahu' | 'Jupiter' | 'Saturn' | 'Mercury';
575
484
 
576
485
  interface AntarDasha {
@@ -593,15 +502,6 @@ interface VimshottariDashaResult {
593
502
  mahaDashas: MahaDasha[]; // 9-entry sequence starting from birth
594
503
  }
595
504
 
596
- interface KundliResult {
597
- lagnaLongitude: number; // sidereal ascendant in degrees [0, 360)
598
- lagna: RashiInfo; // ascendant sign
599
- houses: KundliHouse[]; // 12 houses (whole-sign)
600
- grahas: PlanetaryPositions; // all 9 graha positions
601
- navamsa: NavamsaChart; // D-9 chart
602
- birthPanchang: InstantPanchangResult;
603
- dasha: VimshottariDashaResult;
604
- }
605
505
  ```
606
506
 
607
507
  ---
package/dist/index.cjs CHANGED
@@ -1379,10 +1379,6 @@ function sidereal_time(time) {
1379
1379
  }
1380
1380
  return sidereal_time_cache.st;
1381
1381
  }
1382
- function SiderealTime(date) {
1383
- const time = MakeTime(date);
1384
- return sidereal_time(time);
1385
- }
1386
1382
  function terra(observer, st) {
1387
1383
  const phi = observer.latitude * DEG2RAD;
1388
1384
  const sinphi = Math.sin(phi);
@@ -2549,12 +2545,6 @@ function normalize360(degrees) {
2549
2545
  if (r === 0) return 0;
2550
2546
  return r < 0 ? r + 360 : r;
2551
2547
  }
2552
- function degToRad(degrees) {
2553
- return degrees * (Math.PI / 180);
2554
- }
2555
- function radToDeg(radians) {
2556
- return radians * (180 / Math.PI);
2557
- }
2558
2548
 
2559
2549
  // src/astronomy/moon.ts
2560
2550
  function getSiderealMoonLongitude(date, ayanamsaType) {
@@ -4032,9 +4022,6 @@ var GRAHA_ABBR = {
4032
4022
  Rahu: "Ra",
4033
4023
  Ketu: "Ke"
4034
4024
  };
4035
- function meanObliquity(T) {
4036
- return 23.439291111 - 0.013004167 * T - 164e-9 * T * T + 504e-9 * T * T * T;
4037
- }
4038
4025
  function getTropicalPlanetLongitude(body, date) {
4039
4026
  const vec = GeoVector(body, MakeTime(date), true);
4040
4027
  return Ecliptic(vec).elon;
@@ -4068,9 +4055,7 @@ function buildGrahaPosition(planet, siderealLon, isRetro, nakshatraNameFn, rashi
4068
4055
  rashi: { index: rashiIndex, name: rashiNameFn(rashiIndex) },
4069
4056
  degreeInRashi,
4070
4057
  nakshatra: computeNakshatraFromLongitude(siderealLon, nakshatraNameFn(nakIdx)),
4071
- isRetrograde: isRetro,
4072
- house: 0
4073
- // assigned later in computeKundli
4058
+ isRetrograde: isRetro
4074
4059
  };
4075
4060
  }
4076
4061
  var identity = (idx) => String(idx);
@@ -4106,41 +4091,6 @@ function computePlanetaryPositions(date, ayanamsaType, nakshatraName = identity,
4106
4091
  };
4107
4092
  }
4108
4093
 
4109
- // src/jyotish/lagna.ts
4110
- function computeLagnaLongitude(date, latitude, longitude, ayanamsaType) {
4111
- const gastHours = SiderealTime(MakeTime(date));
4112
- const last_deg = normalize360(gastHours * 15 + longitude);
4113
- const T = (dateToJulianDay(date) - 2451545) / 36525;
4114
- const eps_deg = meanObliquity(T);
4115
- const ramc = degToRad(last_deg);
4116
- const eps = degToRad(eps_deg);
4117
- const phi = degToRad(latitude);
4118
- const y = -Math.cos(ramc);
4119
- const x = Math.sin(ramc) * Math.cos(eps) + Math.tan(phi) * Math.sin(eps);
4120
- let tropicalAsc = normalize360(radToDeg(Math.atan2(y, x)));
4121
- const mcRaw = radToDeg(Math.atan2(Math.tan(ramc), Math.cos(eps)));
4122
- const mc = normalize360(
4123
- last_deg < 180 ? normalize360(mcRaw) : normalize360(mcRaw + 180)
4124
- );
4125
- const diff = normalize360(tropicalAsc - mc);
4126
- if (diff < 90 || diff > 270) {
4127
- tropicalAsc = normalize360(tropicalAsc + 180);
4128
- }
4129
- const ayanamsa = computeAyanamsa(date, ayanamsaType);
4130
- return normalize360(tropicalAsc - ayanamsa);
4131
- }
4132
- function navamsaRashi(siderealLongitude) {
4133
- const rashiIdx = Math.floor(siderealLongitude / 30);
4134
- const degInRashi = siderealLongitude - rashiIdx * 30;
4135
- const navamsaIndex = Math.floor(degInRashi / (30 / 9));
4136
- const NAVAMSA_STARTS = [0, 9, 6, 3, 0, 9, 6, 3, 0, 9, 6, 3];
4137
- return (NAVAMSA_STARTS[rashiIdx] + navamsaIndex) % 12;
4138
- }
4139
- function rashiFromLongitude(lon, nameFn) {
4140
- const index = Math.floor(lon / 30);
4141
- return { index, name: nameFn(index) };
4142
- }
4143
-
4144
4094
  // src/jyotish/dasha.ts
4145
4095
  var DASHA_YEARS = {
4146
4096
  Ketu: 7,
@@ -4241,74 +4191,6 @@ function buildAntarDashas(mahaLord, mahaStart, mahaDurationMs) {
4241
4191
  }
4242
4192
  return antarDashas;
4243
4193
  }
4244
-
4245
- // src/jyotish/kundli.ts
4246
- function computeKundli(birthDateUtc, location, options) {
4247
- validateDate(birthDateUtc);
4248
- validateLocation(location);
4249
- const ayanamsa = options?.ayanamsa ?? "lahiri";
4250
- const lang = options?.language ?? "en";
4251
- const doDasha = options?.computeDasha !== false;
4252
- const rashiName = (idx) => resolveMasaName(idx, lang);
4253
- const nakshatraName = (idx) => resolveNakshatraName(idx, lang);
4254
- const birthPanchang = getInstantPanchang(birthDateUtc, location, {
4255
- ayanamsa,
4256
- language: lang,
4257
- computeEndTimes: options?.computeEndTimes ?? false,
4258
- precision: options?.precision
4259
- });
4260
- const grahas = computePlanetaryPositions(birthDateUtc, ayanamsa, nakshatraName, rashiName);
4261
- const lagnaLon = computeLagnaLongitude(
4262
- birthDateUtc,
4263
- location.latitude,
4264
- location.longitude,
4265
- ayanamsa
4266
- );
4267
- const lagna = rashiFromLongitude(lagnaLon, rashiName);
4268
- const lagnaRashiIdx = lagna.index;
4269
- const houses = Array.from({ length: 12 }, (_, i) => {
4270
- const houseRashiIdx = (lagnaRashiIdx + i) % 12;
4271
- return {
4272
- number: i + 1,
4273
- rashi: { index: houseRashiIdx, name: rashiName(houseRashiIdx) },
4274
- planets: []
4275
- };
4276
- });
4277
- const grahaList = Object.values(grahas);
4278
- for (const graha of grahaList) {
4279
- const houseNumber = (graha.rashi.index - lagnaRashiIdx + 12) % 12 + 1;
4280
- graha.house = houseNumber;
4281
- houses[houseNumber - 1].planets.push(GRAHA_ABBR[graha.planet]);
4282
- }
4283
- const navamsa = buildNavamsaChart(grahas, lagnaLon, rashiName);
4284
- const dasha = doDasha ? computeVimshottariDasha(birthDateUtc, birthPanchang.siderealMoon) : { currentMahaDashaLord: "Sun", currentIndex: 0, mahaDashas: [] };
4285
- return {
4286
- lagnaLongitude: lagnaLon,
4287
- lagna,
4288
- houses,
4289
- grahas,
4290
- navamsa,
4291
- birthPanchang,
4292
- dasha
4293
- };
4294
- }
4295
- function buildNavamsaChart(grahas, lagnaLon, rashiName) {
4296
- const grahaList = Object.values(grahas);
4297
- const positions = grahaList.map((g) => ({
4298
- planet: g.planet,
4299
- rashi: {
4300
- index: navamsaRashi(g.siderealLongitude),
4301
- name: rashiName(navamsaRashi(g.siderealLongitude))
4302
- }
4303
- }));
4304
- return {
4305
- positions,
4306
- lagna: {
4307
- index: navamsaRashi(lagnaLon),
4308
- name: rashiName(navamsaRashi(lagnaLon))
4309
- }
4310
- };
4311
- }
4312
4194
  /*! Bundled license information:
4313
4195
 
4314
4196
  astronomy-engine/esm/astronomy.js:
@@ -4353,8 +4235,6 @@ exports.computeAbhijitMuhurta = computeAbhijitMuhurta;
4353
4235
  exports.computeBrahmaMuhurta = computeBrahmaMuhurta;
4354
4236
  exports.computeGowriPanchangam = computeGowriPanchangam;
4355
4237
  exports.computeGulikaKalam = computeGulikaKalam;
4356
- exports.computeKundli = computeKundli;
4357
- exports.computeLagnaLongitude = computeLagnaLongitude;
4358
4238
  exports.computePlanetaryPositions = computePlanetaryPositions;
4359
4239
  exports.computeRahuKalam = computeRahuKalam;
4360
4240
  exports.computeVimshottariDasha = computeVimshottariDasha;
package/dist/index.d.cts CHANGED
@@ -295,8 +295,6 @@ interface GrahaPosition {
295
295
  * Rahu/Ketu are always retrograde by definition.
296
296
  */
297
297
  isRetrograde: boolean;
298
- /** 1-based house number where this planet sits (set after house assignment) */
299
- house: number;
300
298
  }
301
299
  interface PlanetaryPositions {
302
300
  sun: GrahaPosition;
@@ -309,40 +307,6 @@ interface PlanetaryPositions {
309
307
  rahu: GrahaPosition;
310
308
  ketu: GrahaPosition;
311
309
  }
312
- interface KundliHouse {
313
- /** 1–12 */
314
- number: number;
315
- /** Zodiac sign on the cusp of this house */
316
- rashi: RashiInfo;
317
- /** Short planet abbreviations occupying this house (e.g. "Su", "Mo") */
318
- planets: string[];
319
- }
320
- interface NavamsaPosition {
321
- planet: GrahaName;
322
- /** Navamsa rashi (D-9 sign) */
323
- rashi: RashiInfo;
324
- }
325
- interface NavamsaChart {
326
- positions: NavamsaPosition[];
327
- /** Navamsa Lagna rashi */
328
- lagna: RashiInfo;
329
- }
330
- interface KundliResult {
331
- /** Sidereal longitude of the Ascendant in degrees [0, 360) */
332
- lagnaLongitude: number;
333
- /** Ascendant sign */
334
- lagna: RashiInfo;
335
- /** 12 houses, 1st house = lagna sign */
336
- houses: KundliHouse[];
337
- /** All 9 graha positions with house assignments */
338
- grahas: PlanetaryPositions;
339
- /** Navamsa (D-9) divisional chart */
340
- navamsa: NavamsaChart;
341
- /** Full Panchang at the birth moment */
342
- birthPanchang: InstantPanchangResult;
343
- /** Vimshottari Dasha from birth */
344
- dasha: VimshottariDashaResult;
345
- }
346
310
  type DashaLord = 'Ketu' | 'Venus' | 'Sun' | 'Moon' | 'Mars' | 'Rahu' | 'Jupiter' | 'Saturn' | 'Mercury';
347
311
  interface AntarDasha {
348
312
  lord: DashaLord;
@@ -369,26 +333,6 @@ interface VimshottariDashaResult {
369
333
  mahaDashas: MahaDasha[];
370
334
  }
371
335
 
372
- interface KundliOptions extends InstantPanchangOptions {
373
- /**
374
- * When true, compute Vimshottari Dasha periods.
375
- * Slightly more expensive. Default: true.
376
- */
377
- computeDasha?: boolean;
378
- }
379
- /**
380
- * Compute a complete Janam Kundli (birth chart).
381
- *
382
- * Returns planetary positions, Lagna, 12 houses, Navamsa (D-9) chart,
383
- * Vimshottari Dasha periods, and the full birth Panchang.
384
- *
385
- * @param birthDateUtc UTC birth moment. For times stored as "local time in UTC"
386
- * (the panchang-ts convention), pass the Date as-is.
387
- * @param location Birth location coordinates.
388
- * @param options Optional ayanamsa, language, computeDasha flag.
389
- */
390
- declare function computeKundli(birthDateUtc: Date, location: GeoLocation, options?: KundliOptions): KundliResult;
391
-
392
336
  declare const GRAHA_ABBR: Record<GrahaName, string>;
393
337
  /**
394
338
  * Compute geocentric sidereal positions for all 9 grahas.
@@ -408,26 +352,6 @@ declare function computePlanetaryPositions(date: Date, ayanamsaType: AyanamsaTyp
408
352
  */
409
353
  declare function computeVimshottariDasha(birthDate: Date, moonSiderealLon: number): VimshottariDashaResult;
410
354
 
411
- /**
412
- * Compute the sidereal longitude of the Lagna (Ascendant) for a given
413
- * UTC birth time and observer location.
414
- *
415
- * Algorithm (Meeus, Astronomical Algorithms, Ch. 14):
416
- * 1. GAST = SiderealTime(date) in hours → degrees
417
- * 2. LAST = GAST + observerLongitude (in degrees)
418
- * 3. RAMC = LAST (Right Ascension of the Midheaven Culminating)
419
- * 4. tan(λ_asc) = -cos(RAMC) / (sin(RAMC)·cos(ε) + tan(φ)·sin(ε))
420
- * where ε = mean obliquity, φ = geographic latitude
421
- * 5. Sidereal Lagna = normalize(λ_asc − ayanamsa)
422
- *
423
- * @param date UTC birth moment.
424
- * @param latitude Observer geographic latitude in degrees (−90 to +90).
425
- * @param longitude Observer geographic longitude in degrees (−180 to +180).
426
- * @param ayanamsaType Ayanamsa correction system.
427
- * @returns Sidereal ascendant longitude [0, 360).
428
- */
429
- declare function computeLagnaLongitude(date: Date, latitude: number, longitude: number, ayanamsaType: AyanamsaType): number;
430
-
431
355
  /**
432
356
  * Compute sunrise nearest to (and after) the given UTC search start.
433
357
  *
@@ -587,4 +511,4 @@ declare class PanchangError extends Error {
587
511
  constructor(message: string, code: PanchangErrorCode);
588
512
  }
589
513
 
590
- export { type AntarDasha, type AyanamsaType, type ChandraMasaInfo, type ChoghadiyaInfo, type ChoghadiyaQuality, type ChoghadiyaSlot, type DailyKaranaInfo, type DailyNakshatraInfo, type DailyPanchangResult, type DailyTithiInfo, type DailyYogaInfo, type DashaLord, type FestivalInfo, GRAHA_ABBR, type GeoLocation, type GowriInfo, type GowriSlot, type GrahaName, type GrahaPosition, type HoraInfo, type HoraSlot, type InstantPanchangOptions, type InstantPanchangResult, type KaranaInfo, type KundliHouse, type KundliOptions, type KundliResult, type Language, type MahaDasha, type MasaInfo, type NakshatraInfo, type NavamsaChart, type NavamsaPosition, PanchangError, type PanchangErrorCode, type PanchangOptions, type PlanetaryPositions, type Precision, type RashiInfo, type SamvatInfo, type SpecialYogaInfo, type TimePeriod, type TithiInfo, type VaraInfo, type VimshottariDashaResult, type YogaInfo, computeAbhijitMuhurta, computeBrahmaMuhurta, computeGowriPanchangam, computeGulikaKalam, computeKundli, computeLagnaLongitude, computePlanetaryPositions, computeRahuKalam, computeVimshottariDasha, computeYamaganda, computeAyanamsa as getAyanamsa, getDailyPanchang, getInstantPanchang, getMoonrise, getMoonset, getSiderealMoonLongitude, getSiderealSunLongitude, computeSunrise as getSunrise, computeSunset as getSunset };
514
+ export { type AntarDasha, type AyanamsaType, type ChandraMasaInfo, type ChoghadiyaInfo, type ChoghadiyaQuality, type ChoghadiyaSlot, type DailyKaranaInfo, type DailyNakshatraInfo, type DailyPanchangResult, type DailyTithiInfo, type DailyYogaInfo, type DashaLord, type FestivalInfo, GRAHA_ABBR, type GeoLocation, type GowriInfo, type GowriSlot, type GrahaName, type GrahaPosition, type HoraInfo, type HoraSlot, type InstantPanchangOptions, type InstantPanchangResult, type KaranaInfo, type Language, type MahaDasha, type MasaInfo, type NakshatraInfo, PanchangError, type PanchangErrorCode, type PanchangOptions, type PlanetaryPositions, type Precision, type RashiInfo, type SamvatInfo, type SpecialYogaInfo, type TimePeriod, type TithiInfo, type VaraInfo, type VimshottariDashaResult, type YogaInfo, computeAbhijitMuhurta, computeBrahmaMuhurta, computeGowriPanchangam, computeGulikaKalam, computePlanetaryPositions, computeRahuKalam, computeVimshottariDasha, computeYamaganda, computeAyanamsa as getAyanamsa, getDailyPanchang, getInstantPanchang, getMoonrise, getMoonset, getSiderealMoonLongitude, getSiderealSunLongitude, computeSunrise as getSunrise, computeSunset as getSunset };
package/dist/index.d.ts CHANGED
@@ -295,8 +295,6 @@ interface GrahaPosition {
295
295
  * Rahu/Ketu are always retrograde by definition.
296
296
  */
297
297
  isRetrograde: boolean;
298
- /** 1-based house number where this planet sits (set after house assignment) */
299
- house: number;
300
298
  }
301
299
  interface PlanetaryPositions {
302
300
  sun: GrahaPosition;
@@ -309,40 +307,6 @@ interface PlanetaryPositions {
309
307
  rahu: GrahaPosition;
310
308
  ketu: GrahaPosition;
311
309
  }
312
- interface KundliHouse {
313
- /** 1–12 */
314
- number: number;
315
- /** Zodiac sign on the cusp of this house */
316
- rashi: RashiInfo;
317
- /** Short planet abbreviations occupying this house (e.g. "Su", "Mo") */
318
- planets: string[];
319
- }
320
- interface NavamsaPosition {
321
- planet: GrahaName;
322
- /** Navamsa rashi (D-9 sign) */
323
- rashi: RashiInfo;
324
- }
325
- interface NavamsaChart {
326
- positions: NavamsaPosition[];
327
- /** Navamsa Lagna rashi */
328
- lagna: RashiInfo;
329
- }
330
- interface KundliResult {
331
- /** Sidereal longitude of the Ascendant in degrees [0, 360) */
332
- lagnaLongitude: number;
333
- /** Ascendant sign */
334
- lagna: RashiInfo;
335
- /** 12 houses, 1st house = lagna sign */
336
- houses: KundliHouse[];
337
- /** All 9 graha positions with house assignments */
338
- grahas: PlanetaryPositions;
339
- /** Navamsa (D-9) divisional chart */
340
- navamsa: NavamsaChart;
341
- /** Full Panchang at the birth moment */
342
- birthPanchang: InstantPanchangResult;
343
- /** Vimshottari Dasha from birth */
344
- dasha: VimshottariDashaResult;
345
- }
346
310
  type DashaLord = 'Ketu' | 'Venus' | 'Sun' | 'Moon' | 'Mars' | 'Rahu' | 'Jupiter' | 'Saturn' | 'Mercury';
347
311
  interface AntarDasha {
348
312
  lord: DashaLord;
@@ -369,26 +333,6 @@ interface VimshottariDashaResult {
369
333
  mahaDashas: MahaDasha[];
370
334
  }
371
335
 
372
- interface KundliOptions extends InstantPanchangOptions {
373
- /**
374
- * When true, compute Vimshottari Dasha periods.
375
- * Slightly more expensive. Default: true.
376
- */
377
- computeDasha?: boolean;
378
- }
379
- /**
380
- * Compute a complete Janam Kundli (birth chart).
381
- *
382
- * Returns planetary positions, Lagna, 12 houses, Navamsa (D-9) chart,
383
- * Vimshottari Dasha periods, and the full birth Panchang.
384
- *
385
- * @param birthDateUtc UTC birth moment. For times stored as "local time in UTC"
386
- * (the panchang-ts convention), pass the Date as-is.
387
- * @param location Birth location coordinates.
388
- * @param options Optional ayanamsa, language, computeDasha flag.
389
- */
390
- declare function computeKundli(birthDateUtc: Date, location: GeoLocation, options?: KundliOptions): KundliResult;
391
-
392
336
  declare const GRAHA_ABBR: Record<GrahaName, string>;
393
337
  /**
394
338
  * Compute geocentric sidereal positions for all 9 grahas.
@@ -408,26 +352,6 @@ declare function computePlanetaryPositions(date: Date, ayanamsaType: AyanamsaTyp
408
352
  */
409
353
  declare function computeVimshottariDasha(birthDate: Date, moonSiderealLon: number): VimshottariDashaResult;
410
354
 
411
- /**
412
- * Compute the sidereal longitude of the Lagna (Ascendant) for a given
413
- * UTC birth time and observer location.
414
- *
415
- * Algorithm (Meeus, Astronomical Algorithms, Ch. 14):
416
- * 1. GAST = SiderealTime(date) in hours → degrees
417
- * 2. LAST = GAST + observerLongitude (in degrees)
418
- * 3. RAMC = LAST (Right Ascension of the Midheaven Culminating)
419
- * 4. tan(λ_asc) = -cos(RAMC) / (sin(RAMC)·cos(ε) + tan(φ)·sin(ε))
420
- * where ε = mean obliquity, φ = geographic latitude
421
- * 5. Sidereal Lagna = normalize(λ_asc − ayanamsa)
422
- *
423
- * @param date UTC birth moment.
424
- * @param latitude Observer geographic latitude in degrees (−90 to +90).
425
- * @param longitude Observer geographic longitude in degrees (−180 to +180).
426
- * @param ayanamsaType Ayanamsa correction system.
427
- * @returns Sidereal ascendant longitude [0, 360).
428
- */
429
- declare function computeLagnaLongitude(date: Date, latitude: number, longitude: number, ayanamsaType: AyanamsaType): number;
430
-
431
355
  /**
432
356
  * Compute sunrise nearest to (and after) the given UTC search start.
433
357
  *
@@ -587,4 +511,4 @@ declare class PanchangError extends Error {
587
511
  constructor(message: string, code: PanchangErrorCode);
588
512
  }
589
513
 
590
- export { type AntarDasha, type AyanamsaType, type ChandraMasaInfo, type ChoghadiyaInfo, type ChoghadiyaQuality, type ChoghadiyaSlot, type DailyKaranaInfo, type DailyNakshatraInfo, type DailyPanchangResult, type DailyTithiInfo, type DailyYogaInfo, type DashaLord, type FestivalInfo, GRAHA_ABBR, type GeoLocation, type GowriInfo, type GowriSlot, type GrahaName, type GrahaPosition, type HoraInfo, type HoraSlot, type InstantPanchangOptions, type InstantPanchangResult, type KaranaInfo, type KundliHouse, type KundliOptions, type KundliResult, type Language, type MahaDasha, type MasaInfo, type NakshatraInfo, type NavamsaChart, type NavamsaPosition, PanchangError, type PanchangErrorCode, type PanchangOptions, type PlanetaryPositions, type Precision, type RashiInfo, type SamvatInfo, type SpecialYogaInfo, type TimePeriod, type TithiInfo, type VaraInfo, type VimshottariDashaResult, type YogaInfo, computeAbhijitMuhurta, computeBrahmaMuhurta, computeGowriPanchangam, computeGulikaKalam, computeKundli, computeLagnaLongitude, computePlanetaryPositions, computeRahuKalam, computeVimshottariDasha, computeYamaganda, computeAyanamsa as getAyanamsa, getDailyPanchang, getInstantPanchang, getMoonrise, getMoonset, getSiderealMoonLongitude, getSiderealSunLongitude, computeSunrise as getSunrise, computeSunset as getSunset };
514
+ export { type AntarDasha, type AyanamsaType, type ChandraMasaInfo, type ChoghadiyaInfo, type ChoghadiyaQuality, type ChoghadiyaSlot, type DailyKaranaInfo, type DailyNakshatraInfo, type DailyPanchangResult, type DailyTithiInfo, type DailyYogaInfo, type DashaLord, type FestivalInfo, GRAHA_ABBR, type GeoLocation, type GowriInfo, type GowriSlot, type GrahaName, type GrahaPosition, type HoraInfo, type HoraSlot, type InstantPanchangOptions, type InstantPanchangResult, type KaranaInfo, type Language, type MahaDasha, type MasaInfo, type NakshatraInfo, PanchangError, type PanchangErrorCode, type PanchangOptions, type PlanetaryPositions, type Precision, type RashiInfo, type SamvatInfo, type SpecialYogaInfo, type TimePeriod, type TithiInfo, type VaraInfo, type VimshottariDashaResult, type YogaInfo, computeAbhijitMuhurta, computeBrahmaMuhurta, computeGowriPanchangam, computeGulikaKalam, computePlanetaryPositions, computeRahuKalam, computeVimshottariDasha, computeYamaganda, computeAyanamsa as getAyanamsa, getDailyPanchang, getInstantPanchang, getMoonrise, getMoonset, getSiderealMoonLongitude, getSiderealSunLongitude, computeSunrise as getSunrise, computeSunset as getSunset };
package/dist/index.js CHANGED
@@ -1377,10 +1377,6 @@ function sidereal_time(time) {
1377
1377
  }
1378
1378
  return sidereal_time_cache.st;
1379
1379
  }
1380
- function SiderealTime(date) {
1381
- const time = MakeTime(date);
1382
- return sidereal_time(time);
1383
- }
1384
1380
  function terra(observer, st) {
1385
1381
  const phi = observer.latitude * DEG2RAD;
1386
1382
  const sinphi = Math.sin(phi);
@@ -2547,12 +2543,6 @@ function normalize360(degrees) {
2547
2543
  if (r === 0) return 0;
2548
2544
  return r < 0 ? r + 360 : r;
2549
2545
  }
2550
- function degToRad(degrees) {
2551
- return degrees * (Math.PI / 180);
2552
- }
2553
- function radToDeg(radians) {
2554
- return radians * (180 / Math.PI);
2555
- }
2556
2546
 
2557
2547
  // src/astronomy/moon.ts
2558
2548
  function getSiderealMoonLongitude(date, ayanamsaType) {
@@ -4030,9 +4020,6 @@ var GRAHA_ABBR = {
4030
4020
  Rahu: "Ra",
4031
4021
  Ketu: "Ke"
4032
4022
  };
4033
- function meanObliquity(T) {
4034
- return 23.439291111 - 0.013004167 * T - 164e-9 * T * T + 504e-9 * T * T * T;
4035
- }
4036
4023
  function getTropicalPlanetLongitude(body, date) {
4037
4024
  const vec = GeoVector(body, MakeTime(date), true);
4038
4025
  return Ecliptic(vec).elon;
@@ -4066,9 +4053,7 @@ function buildGrahaPosition(planet, siderealLon, isRetro, nakshatraNameFn, rashi
4066
4053
  rashi: { index: rashiIndex, name: rashiNameFn(rashiIndex) },
4067
4054
  degreeInRashi,
4068
4055
  nakshatra: computeNakshatraFromLongitude(siderealLon, nakshatraNameFn(nakIdx)),
4069
- isRetrograde: isRetro,
4070
- house: 0
4071
- // assigned later in computeKundli
4056
+ isRetrograde: isRetro
4072
4057
  };
4073
4058
  }
4074
4059
  var identity = (idx) => String(idx);
@@ -4104,41 +4089,6 @@ function computePlanetaryPositions(date, ayanamsaType, nakshatraName = identity,
4104
4089
  };
4105
4090
  }
4106
4091
 
4107
- // src/jyotish/lagna.ts
4108
- function computeLagnaLongitude(date, latitude, longitude, ayanamsaType) {
4109
- const gastHours = SiderealTime(MakeTime(date));
4110
- const last_deg = normalize360(gastHours * 15 + longitude);
4111
- const T = (dateToJulianDay(date) - 2451545) / 36525;
4112
- const eps_deg = meanObliquity(T);
4113
- const ramc = degToRad(last_deg);
4114
- const eps = degToRad(eps_deg);
4115
- const phi = degToRad(latitude);
4116
- const y = -Math.cos(ramc);
4117
- const x = Math.sin(ramc) * Math.cos(eps) + Math.tan(phi) * Math.sin(eps);
4118
- let tropicalAsc = normalize360(radToDeg(Math.atan2(y, x)));
4119
- const mcRaw = radToDeg(Math.atan2(Math.tan(ramc), Math.cos(eps)));
4120
- const mc = normalize360(
4121
- last_deg < 180 ? normalize360(mcRaw) : normalize360(mcRaw + 180)
4122
- );
4123
- const diff = normalize360(tropicalAsc - mc);
4124
- if (diff < 90 || diff > 270) {
4125
- tropicalAsc = normalize360(tropicalAsc + 180);
4126
- }
4127
- const ayanamsa = computeAyanamsa(date, ayanamsaType);
4128
- return normalize360(tropicalAsc - ayanamsa);
4129
- }
4130
- function navamsaRashi(siderealLongitude) {
4131
- const rashiIdx = Math.floor(siderealLongitude / 30);
4132
- const degInRashi = siderealLongitude - rashiIdx * 30;
4133
- const navamsaIndex = Math.floor(degInRashi / (30 / 9));
4134
- const NAVAMSA_STARTS = [0, 9, 6, 3, 0, 9, 6, 3, 0, 9, 6, 3];
4135
- return (NAVAMSA_STARTS[rashiIdx] + navamsaIndex) % 12;
4136
- }
4137
- function rashiFromLongitude(lon, nameFn) {
4138
- const index = Math.floor(lon / 30);
4139
- return { index, name: nameFn(index) };
4140
- }
4141
-
4142
4092
  // src/jyotish/dasha.ts
4143
4093
  var DASHA_YEARS = {
4144
4094
  Ketu: 7,
@@ -4239,74 +4189,6 @@ function buildAntarDashas(mahaLord, mahaStart, mahaDurationMs) {
4239
4189
  }
4240
4190
  return antarDashas;
4241
4191
  }
4242
-
4243
- // src/jyotish/kundli.ts
4244
- function computeKundli(birthDateUtc, location, options) {
4245
- validateDate(birthDateUtc);
4246
- validateLocation(location);
4247
- const ayanamsa = options?.ayanamsa ?? "lahiri";
4248
- const lang = options?.language ?? "en";
4249
- const doDasha = options?.computeDasha !== false;
4250
- const rashiName = (idx) => resolveMasaName(idx, lang);
4251
- const nakshatraName = (idx) => resolveNakshatraName(idx, lang);
4252
- const birthPanchang = getInstantPanchang(birthDateUtc, location, {
4253
- ayanamsa,
4254
- language: lang,
4255
- computeEndTimes: options?.computeEndTimes ?? false,
4256
- precision: options?.precision
4257
- });
4258
- const grahas = computePlanetaryPositions(birthDateUtc, ayanamsa, nakshatraName, rashiName);
4259
- const lagnaLon = computeLagnaLongitude(
4260
- birthDateUtc,
4261
- location.latitude,
4262
- location.longitude,
4263
- ayanamsa
4264
- );
4265
- const lagna = rashiFromLongitude(lagnaLon, rashiName);
4266
- const lagnaRashiIdx = lagna.index;
4267
- const houses = Array.from({ length: 12 }, (_, i) => {
4268
- const houseRashiIdx = (lagnaRashiIdx + i) % 12;
4269
- return {
4270
- number: i + 1,
4271
- rashi: { index: houseRashiIdx, name: rashiName(houseRashiIdx) },
4272
- planets: []
4273
- };
4274
- });
4275
- const grahaList = Object.values(grahas);
4276
- for (const graha of grahaList) {
4277
- const houseNumber = (graha.rashi.index - lagnaRashiIdx + 12) % 12 + 1;
4278
- graha.house = houseNumber;
4279
- houses[houseNumber - 1].planets.push(GRAHA_ABBR[graha.planet]);
4280
- }
4281
- const navamsa = buildNavamsaChart(grahas, lagnaLon, rashiName);
4282
- const dasha = doDasha ? computeVimshottariDasha(birthDateUtc, birthPanchang.siderealMoon) : { currentMahaDashaLord: "Sun", currentIndex: 0, mahaDashas: [] };
4283
- return {
4284
- lagnaLongitude: lagnaLon,
4285
- lagna,
4286
- houses,
4287
- grahas,
4288
- navamsa,
4289
- birthPanchang,
4290
- dasha
4291
- };
4292
- }
4293
- function buildNavamsaChart(grahas, lagnaLon, rashiName) {
4294
- const grahaList = Object.values(grahas);
4295
- const positions = grahaList.map((g) => ({
4296
- planet: g.planet,
4297
- rashi: {
4298
- index: navamsaRashi(g.siderealLongitude),
4299
- name: rashiName(navamsaRashi(g.siderealLongitude))
4300
- }
4301
- }));
4302
- return {
4303
- positions,
4304
- lagna: {
4305
- index: navamsaRashi(lagnaLon),
4306
- name: rashiName(navamsaRashi(lagnaLon))
4307
- }
4308
- };
4309
- }
4310
4192
  /*! Bundled license information:
4311
4193
 
4312
4194
  astronomy-engine/esm/astronomy.js:
@@ -4345,4 +4227,4 @@ astronomy-engine/esm/astronomy.js:
4345
4227
  *)
4346
4228
  */
4347
4229
 
4348
- export { GRAHA_ABBR, PanchangError, computeAbhijitMuhurta, computeBrahmaMuhurta, computeGowriPanchangam, computeGulikaKalam, computeKundli, computeLagnaLongitude, computePlanetaryPositions, computeRahuKalam, computeVimshottariDasha, computeYamaganda, computeAyanamsa as getAyanamsa, getDailyPanchang, getInstantPanchang, getMoonrise, getMoonset, getSiderealMoonLongitude, getSiderealSunLongitude, computeSunrise as getSunrise, computeSunset as getSunset };
4230
+ export { GRAHA_ABBR, PanchangError, computeAbhijitMuhurta, computeBrahmaMuhurta, computeGowriPanchangam, computeGulikaKalam, computePlanetaryPositions, computeRahuKalam, computeVimshottariDasha, computeYamaganda, computeAyanamsa as getAyanamsa, getDailyPanchang, getInstantPanchang, getMoonrise, getMoonset, getSiderealMoonLongitude, getSiderealSunLongitude, computeSunrise as getSunrise, computeSunset as getSunset };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "panchang-ts",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Pure TypeScript Hindu Panchang calculations. Tithi, Nakshatra, Yoga, Karana, Vara, and more. Offline-first, React Native compatible.",
5
5
  "author": "Ishank",
6
6
  "license": "MIT",