vedic-calc 1.0.3

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/astrology/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,IAAI;IACZ,KAAK,IAAI,CAAO,QAAQ;IACxB,MAAM,IAAI,CAAM,YAAY;IAC5B,MAAM,IAAI,CAAM,UAAU;IAC1B,MAAM,IAAI,CAAM,QAAQ;IACxB,GAAG,IAAI,CAAS,QAAQ;IACxB,KAAK,IAAI,CAAO,QAAQ;IACxB,KAAK,IAAI,CAAO,OAAO;IACvB,OAAO,IAAI,CAAK,aAAa;IAC7B,WAAW,IAAI,CAAC,QAAQ;IACxB,SAAS,IAAI,CAAG,SAAS;IACzB,QAAQ,KAAK,CAAG,SAAS;IACzB,MAAM,KAAK;CACd;AAED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAarB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,qWAMb,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;AAEtD;;;GAGG;AACH,oBAAY,MAAM;IACd,GAAG,IAAI,CAAS,QAAQ;IACxB,IAAI,IAAI,CAAQ,UAAU;IAC1B,IAAI,IAAI,CAAQ,SAAS;IACzB,OAAO,IAAI,CAAK,OAAO;IACvB,OAAO,IAAI,CAAK,OAAO;IACvB,KAAK,IAAI,CAAO,SAAS;IACzB,MAAM,IAAI,CAAM,QAAQ;IACxB,IAAI,IAAI,CAAQ,aAAa;IAC7B,IAAI,IAAI;CACX;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;CAU7B,CAAC"}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SwissEphPlanetIds = exports.PlanetNames = exports.Planet = exports.Nakshatras = exports.SignNames = exports.Sign = void 0;
4
+ /**
5
+ * Zodiac Signs (Rashis) in Vedic Astrology
6
+ * Each sign occupies 30 degrees of the 360-degree zodiac
7
+ */
8
+ var Sign;
9
+ (function (Sign) {
10
+ Sign[Sign["ARIES"] = 0] = "ARIES";
11
+ Sign[Sign["TAURUS"] = 1] = "TAURUS";
12
+ Sign[Sign["GEMINI"] = 2] = "GEMINI";
13
+ Sign[Sign["CANCER"] = 3] = "CANCER";
14
+ Sign[Sign["LEO"] = 4] = "LEO";
15
+ Sign[Sign["VIRGO"] = 5] = "VIRGO";
16
+ Sign[Sign["LIBRA"] = 6] = "LIBRA";
17
+ Sign[Sign["SCORPIO"] = 7] = "SCORPIO";
18
+ Sign[Sign["SAGITTARIUS"] = 8] = "SAGITTARIUS";
19
+ Sign[Sign["CAPRICORN"] = 9] = "CAPRICORN";
20
+ Sign[Sign["AQUARIUS"] = 10] = "AQUARIUS";
21
+ Sign[Sign["PISCES"] = 11] = "PISCES";
22
+ })(Sign || (exports.Sign = Sign = {}));
23
+ exports.SignNames = {
24
+ [Sign.ARIES]: { en: 'Aries', sa: 'Mesha' },
25
+ [Sign.TAURUS]: { en: 'Taurus', sa: 'Vrishabha' },
26
+ [Sign.GEMINI]: { en: 'Gemini', sa: 'Mithuna' },
27
+ [Sign.CANCER]: { en: 'Cancer', sa: 'Karka' },
28
+ [Sign.LEO]: { en: 'Leo', sa: 'Simha' },
29
+ [Sign.VIRGO]: { en: 'Virgo', sa: 'Kanya' },
30
+ [Sign.LIBRA]: { en: 'Libra', sa: 'Tula' },
31
+ [Sign.SCORPIO]: { en: 'Scorpio', sa: 'Vrishchika' },
32
+ [Sign.SAGITTARIUS]: { en: 'Sagittarius', sa: 'Dhanu' },
33
+ [Sign.CAPRICORN]: { en: 'Capricorn', sa: 'Makara' },
34
+ [Sign.AQUARIUS]: { en: 'Aquarius', sa: 'Kumbha' },
35
+ [Sign.PISCES]: { en: 'Pisces', sa: 'Meena' },
36
+ };
37
+ /**
38
+ * Nakshatras (Lunar Mansions)
39
+ * 27 divisions of the zodiac, each 13°20' (13.333...)
40
+ */
41
+ exports.Nakshatras = [
42
+ 'Ashwini', 'Bharani', 'Krittika', 'Rohini', 'Mrigashira', 'Ardra',
43
+ 'Punarvasu', 'Pushya', 'Ashlesha', 'Magha', 'Purva Phalguni', 'Uttara Phalguni',
44
+ 'Hasta', 'Chitra', 'Swati', 'Vishakha', 'Anuradha', 'Jyeshtha',
45
+ 'Mula', 'Purva Ashadha', 'Uttara Ashadha', 'Shravana', 'Dhanishta', 'Shatabhisha',
46
+ 'Purva Bhadrapada', 'Uttara Bhadrapada', 'Revati',
47
+ ];
48
+ /**
49
+ * Planets in Vedic Astrology
50
+ * Sun to Ketu (9 grahas)
51
+ */
52
+ var Planet;
53
+ (function (Planet) {
54
+ Planet[Planet["SUN"] = 0] = "SUN";
55
+ Planet[Planet["MOON"] = 1] = "MOON";
56
+ Planet[Planet["MARS"] = 2] = "MARS";
57
+ Planet[Planet["MERCURY"] = 3] = "MERCURY";
58
+ Planet[Planet["JUPITER"] = 4] = "JUPITER";
59
+ Planet[Planet["VENUS"] = 5] = "VENUS";
60
+ Planet[Planet["SATURN"] = 6] = "SATURN";
61
+ Planet[Planet["RAHU"] = 7] = "RAHU";
62
+ Planet[Planet["KETU"] = 8] = "KETU";
63
+ })(Planet || (exports.Planet = Planet = {}));
64
+ exports.PlanetNames = {
65
+ [Planet.SUN]: { en: 'Sun', sa: 'Surya' },
66
+ [Planet.MOON]: { en: 'Moon', sa: 'Chandra' },
67
+ [Planet.MARS]: { en: 'Mars', sa: 'Mangal' },
68
+ [Planet.MERCURY]: { en: 'Mercury', sa: 'Budh' },
69
+ [Planet.JUPITER]: { en: 'Jupiter', sa: 'Guru' },
70
+ [Planet.VENUS]: { en: 'Venus', sa: 'Shukra' },
71
+ [Planet.SATURN]: { en: 'Saturn', sa: 'Shani' },
72
+ [Planet.RAHU]: { en: 'Rahu', sa: 'Rahu' },
73
+ [Planet.KETU]: { en: 'Ketu', sa: 'Ketu' },
74
+ };
75
+ /**
76
+ * Swiss Ephemeris Planet IDs mapping to our Planet enum
77
+ */
78
+ exports.SwissEphPlanetIds = {
79
+ [Planet.SUN]: 0, // SE_SUN
80
+ [Planet.MOON]: 1, // SE_MOON
81
+ [Planet.MERCURY]: 2, // SE_MERCURY
82
+ [Planet.VENUS]: 3, // SE_VENUS
83
+ [Planet.MARS]: 4, // SE_MARS
84
+ [Planet.JUPITER]: 5, // SE_JUPITER
85
+ [Planet.SATURN]: 6, // SE_SATURN
86
+ [Planet.RAHU]: 11, // SE_TRUE_NODE (Mean Node)
87
+ [Planet.KETU]: 11, // Ketu is calculated as Rahu + 180°
88
+ };
@@ -0,0 +1,49 @@
1
+ import { Sign, NakshatraName } from './constants';
2
+ /**
3
+ * Complete planetary position data
4
+ */
5
+ export interface PlanetaryPosition {
6
+ longitude: number;
7
+ latitude: number;
8
+ speed: number;
9
+ sign: Sign;
10
+ signName: {
11
+ en: string;
12
+ sa: string;
13
+ };
14
+ degreeInSign: number;
15
+ nakshatra: NakshatraName;
16
+ nakshatraPada: number;
17
+ isRetrograde: boolean;
18
+ }
19
+ /**
20
+ * Calculates which Sign (Rashi) the longitude falls in
21
+ * @param longitude Sidereal longitude (0-360)
22
+ * @returns Sign enum value (0-11)
23
+ */
24
+ export declare function getSign(longitude: number): Sign;
25
+ /**
26
+ * Calculates degrees within the current sign
27
+ * @param longitude Sidereal longitude (0-360)
28
+ * @returns Degrees (0-30)
29
+ */
30
+ export declare function getDegreeInSign(longitude: number): number;
31
+ /**
32
+ * Calculates which Nakshatra the longitude falls in
33
+ * Each Nakshatra is 13°20' (13.333...)
34
+ * @param longitude Sidereal longitude (0-360)
35
+ * @returns Nakshatra name
36
+ */
37
+ export declare function getNakshatra(longitude: number): NakshatraName;
38
+ /**
39
+ * Calculates which Pada (quarter) within the Nakshatra
40
+ * Each Nakshatra has 4 padas of 3°20' each
41
+ * @param longitude Sidereal longitude (0-360)
42
+ * @returns Pada number (1-4)
43
+ */
44
+ export declare function getNakshatraPada(longitude: number): number;
45
+ /**
46
+ * Main calculator: Converts raw longitude to complete planetary position
47
+ */
48
+ export declare function calculatePlanetaryPosition(longitude: number, latitude: number, speed: number): PlanetaryPosition;
49
+ //# sourceMappingURL=planetaryPosition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planetaryPosition.d.ts","sourceRoot":"","sources":["../../src/astrology/planetaryPosition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAyB,aAAa,EAAE,MAAM,aAAa,CAAC;AAGzE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,aAAa,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAG/C;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,CAK7D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAM1D;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACtC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACd,iBAAiB,CAcnB"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSign = getSign;
4
+ exports.getDegreeInSign = getDegreeInSign;
5
+ exports.getNakshatra = getNakshatra;
6
+ exports.getNakshatraPada = getNakshatraPada;
7
+ exports.calculatePlanetaryPosition = calculatePlanetaryPosition;
8
+ const constants_1 = require("./constants");
9
+ const math_1 = require("../utils/math");
10
+ /**
11
+ * Calculates which Sign (Rashi) the longitude falls in
12
+ * @param longitude Sidereal longitude (0-360)
13
+ * @returns Sign enum value (0-11)
14
+ */
15
+ function getSign(longitude) {
16
+ const normalized = (0, math_1.normalizeAngle)(longitude);
17
+ return Math.floor(normalized / 30);
18
+ }
19
+ /**
20
+ * Calculates degrees within the current sign
21
+ * @param longitude Sidereal longitude (0-360)
22
+ * @returns Degrees (0-30)
23
+ */
24
+ function getDegreeInSign(longitude) {
25
+ const normalized = (0, math_1.normalizeAngle)(longitude);
26
+ return normalized % 30;
27
+ }
28
+ /**
29
+ * Calculates which Nakshatra the longitude falls in
30
+ * Each Nakshatra is 13°20' (13.333...)
31
+ * @param longitude Sidereal longitude (0-360)
32
+ * @returns Nakshatra name
33
+ */
34
+ function getNakshatra(longitude) {
35
+ const normalized = (0, math_1.normalizeAngle)(longitude);
36
+ const nakshatraSize = 360 / 27; // 13.333...
37
+ const index = Math.floor(normalized / nakshatraSize);
38
+ return constants_1.Nakshatras[index];
39
+ }
40
+ /**
41
+ * Calculates which Pada (quarter) within the Nakshatra
42
+ * Each Nakshatra has 4 padas of 3°20' each
43
+ * @param longitude Sidereal longitude (0-360)
44
+ * @returns Pada number (1-4)
45
+ */
46
+ function getNakshatraPada(longitude) {
47
+ const normalized = (0, math_1.normalizeAngle)(longitude);
48
+ const nakshatraSize = 360 / 27;
49
+ const padaSize = nakshatraSize / 4; // 3.333...
50
+ const positionInNakshatra = normalized % nakshatraSize;
51
+ return Math.floor(positionInNakshatra / padaSize) + 1; // 1-indexed
52
+ }
53
+ /**
54
+ * Main calculator: Converts raw longitude to complete planetary position
55
+ */
56
+ function calculatePlanetaryPosition(longitude, latitude, speed) {
57
+ const sign = getSign(longitude);
58
+ return {
59
+ longitude,
60
+ latitude,
61
+ speed,
62
+ sign,
63
+ signName: constants_1.SignNames[sign],
64
+ degreeInSign: getDegreeInSign(longitude),
65
+ nakshatra: getNakshatra(longitude),
66
+ nakshatraPada: getNakshatraPada(longitude),
67
+ isRetrograde: speed < 0,
68
+ };
69
+ }
@@ -0,0 +1,9 @@
1
+ import { RasiChart } from './charts';
2
+ export declare function generateNorthIndianChartSVG(chart: RasiChart, options?: {
3
+ showTable?: boolean;
4
+ width?: number;
5
+ height?: number;
6
+ layout?: 'row' | 'column';
7
+ tableWidth?: number;
8
+ }): string;
9
+ //# sourceMappingURL=svgRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgRenderer.d.ts","sourceRoot":"","sources":["../../src/astrology/svgRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAqLrC,wBAAgB,2BAA2B,CACvC,KAAK,EAAE,SAAS,EAChB,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GACnH,MAAM,CAiGR"}
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateNorthIndianChartSVG = generateNorthIndianChartSVG;
4
+ const constants_1 = require("./constants");
5
+ /**
6
+ * SVG Renderer for North Indian Chart (AstroSage-Inspired Clean Style)
7
+ *
8
+ * White background, deep purple (#422762) borders, clean professional look.
9
+ */
10
+ const CONFIG = {
11
+ WIDTH: 400,
12
+ HEIGHT: 300,
13
+ COLORS: {
14
+ background: '#FFFFFF',
15
+ border: '#422762',
16
+ innerLines: '#422762',
17
+ signNumber: '#422762',
18
+ text: '#1A1A2E',
19
+ retrograde: '#D63031',
20
+ tableHeaderBg: '#422762',
21
+ tableHeaderText: '#FFFFFF',
22
+ tableRowEven: '#F8F5FC',
23
+ tableRowOdd: '#FFFFFF',
24
+ tableBorder: '#422762',
25
+ tableText: '#2D2D3F',
26
+ tableTextSecondary: '#5A5A7A',
27
+ },
28
+ FONTS: {
29
+ family: "'Segoe UI', 'Arial', 'Helvetica', sans-serif",
30
+ planetSize: 12,
31
+ degreeSize: 8,
32
+ signSize: 11,
33
+ }
34
+ };
35
+ const PLANET_ABBR = {
36
+ [constants_1.Planet.SUN]: 'Su',
37
+ [constants_1.Planet.MOON]: 'Mo',
38
+ [constants_1.Planet.MARS]: 'Ma',
39
+ [constants_1.Planet.MERCURY]: 'Me',
40
+ [constants_1.Planet.JUPITER]: 'Ju',
41
+ [constants_1.Planet.VENUS]: 'Ve',
42
+ [constants_1.Planet.SATURN]: 'Sa',
43
+ [constants_1.Planet.RAHU]: 'Ra',
44
+ [constants_1.Planet.KETU]: 'Ke',
45
+ };
46
+ function getPlanetColor(planet, isRetrograde) {
47
+ if (isRetrograde)
48
+ return CONFIG.COLORS.retrograde;
49
+ // Return a standard dark text color for all planets
50
+ return '#333333';
51
+ }
52
+ function getSignNumberColor(_sign) {
53
+ return '#422762';
54
+ }
55
+ function getHouseCenters(w, h) {
56
+ const cx = w / 2;
57
+ const cy = h / 2;
58
+ const scaleX = w / 700;
59
+ const scaleY = h / 700;
60
+ const base = {
61
+ 1: { x: 0, y: -175, signPos: { x: 0, y: -235 } },
62
+ 2: { x: -175, y: -225, signPos: { x: -230, y: -260 } },
63
+ 3: { x: -225, y: -175, signPos: { x: -260, y: -230 } },
64
+ 4: { x: -175, y: 0, signPos: { x: -235, y: 0 } },
65
+ 5: { x: -225, y: 175, signPos: { x: -260, y: 230 } },
66
+ 6: { x: -175, y: 225, signPos: { x: -230, y: 260 } },
67
+ 7: { x: 0, y: 175, signPos: { x: 0, y: 235 } },
68
+ 8: { x: 175, y: 225, signPos: { x: 230, y: 260 } },
69
+ 9: { x: 225, y: 175, signPos: { x: 260, y: 230 } },
70
+ 10: { x: 175, y: 0, signPos: { x: 235, y: 0 } },
71
+ 11: { x: 225, y: -175, signPos: { x: 260, y: -230 } },
72
+ 12: { x: 175, y: -225, signPos: { x: 230, y: -260 } },
73
+ };
74
+ const centers = {};
75
+ Object.entries(base).forEach(([key, value]) => {
76
+ const num = Number(key);
77
+ centers[num] = {
78
+ x: cx + value.x * scaleX,
79
+ y: cy + value.y * scaleY,
80
+ signPos: {
81
+ x: cx + value.signPos.x * scaleX,
82
+ y: cy + value.signPos.y * scaleY,
83
+ },
84
+ };
85
+ });
86
+ return centers;
87
+ }
88
+ function generatePlanetTable(chart, startX, startY, width, tableHeight) {
89
+ const rowHeight = 24;
90
+ const headers = ['Planet', 'Sign No', 'Sign', 'Degree', 'Nakshatra', 'House'];
91
+ const colWidths = [80, 60, 110, 60, 140, 50];
92
+ const left = startX + 10;
93
+ const tableWidth = width - 20;
94
+ // Table container with rounded corners and purple border
95
+ let content = `
96
+ <rect x="${left}" y="${startY}" width="${tableWidth}" height="${tableHeight}"
97
+ fill="${CONFIG.COLORS.background}" stroke="${CONFIG.COLORS.tableBorder}" stroke-width="2" rx="6" />
98
+ <rect x="${left}" y="${startY}" width="${tableWidth}" height="${rowHeight}"
99
+ fill="${CONFIG.COLORS.tableHeaderBg}" rx="6" />
100
+ <rect x="${left}" y="${startY + 6}" width="${tableWidth}" height="${rowHeight - 6}"
101
+ fill="${CONFIG.COLORS.tableHeaderBg}" />
102
+ `;
103
+ // Header text
104
+ let currentX = left + 12;
105
+ headers.forEach((h, i) => {
106
+ content += `<text x="${currentX}" y="${startY + 17}"
107
+ font-family="${CONFIG.FONTS.family}" font-size="11" font-weight="700"
108
+ fill="${CONFIG.COLORS.tableHeaderText}">
109
+ ${h.toUpperCase()}
110
+ </text>`;
111
+ currentX += colWidths[i];
112
+ });
113
+ // Rows
114
+ chart.planets.forEach((p, idx) => {
115
+ const y = startY + rowHeight + (idx * rowHeight);
116
+ const bg = idx % 2 === 0 ? CONFIG.COLORS.tableRowOdd : CONFIG.COLORS.tableRowEven;
117
+ content += `<rect x="${left}" y="${y}" width="${tableWidth}" height="${rowHeight}" fill="${bg}" />`;
118
+ // Bottom border for each row (subtle separator)
119
+ content += `<line x1="${left}" y1="${y + rowHeight}" x2="${left + tableWidth}" y2="${y + rowHeight}"
120
+ stroke="#E8E0F0" stroke-width="0.5" />`;
121
+ const abbr = PLANET_ABBR[p.planet];
122
+ const planetName = p.isRetrograde ? `${abbr} ℞` : abbr;
123
+ const planetColor = getPlanetColor(p.planet, p.isRetrograde);
124
+ const degree = Math.round(p.degreeInSign) + '°';
125
+ const signNumber = p.sign + 1;
126
+ const signStr = p.signName;
127
+ let cx = left + 12;
128
+ content += `<text x="${cx}" y="${y + 16}" font-family="${CONFIG.FONTS.family}"
129
+ font-size="12" font-weight="700" fill="${planetColor}">${planetName}</text>`;
130
+ cx += colWidths[0];
131
+ content += `<text x="${cx}" y="${y + 16}" font-family="${CONFIG.FONTS.family}"
132
+ font-size="11" font-weight="700" fill="${CONFIG.COLORS.signNumber}">${signNumber}</text>`;
133
+ cx += colWidths[1];
134
+ content += `<text x="${cx}" y="${y + 16}" font-family="${CONFIG.FONTS.family}"
135
+ font-size="11" fill="${CONFIG.COLORS.tableText}">${signStr}</text>`;
136
+ cx += colWidths[2];
137
+ content += `<text x="${cx}" y="${y + 16}" font-family="${CONFIG.FONTS.family}"
138
+ font-size="11" fill="${CONFIG.COLORS.tableTextSecondary}">${degree}</text>`;
139
+ cx += colWidths[3];
140
+ content += `<text x="${cx}" y="${y + 16}" font-family="${CONFIG.FONTS.family}"
141
+ font-size="10" fill="${CONFIG.COLORS.tableTextSecondary}">${p.nakshatra} (${p.nakshatraPada})</text>`;
142
+ cx += colWidths[4];
143
+ content += `<text x="${cx}" y="${y + 16}" font-family="${CONFIG.FONTS.family}"
144
+ font-size="11" font-weight="700" fill="${CONFIG.COLORS.signNumber}">${p.house}</text>`;
145
+ });
146
+ return content;
147
+ }
148
+ function generateNorthIndianChartSVG(chart, options) {
149
+ const chartW = options?.width || CONFIG.WIDTH;
150
+ const chartH = options?.height || CONFIG.HEIGHT;
151
+ const showTable = options?.showTable ?? true;
152
+ const layout = options?.layout || 'row';
153
+ const rowHeight = 24;
154
+ const tableHeight = showTable ? (rowHeight * (chart.planets.length + 1) + 12) : 0;
155
+ const tableWidth = options?.tableWidth || 520;
156
+ const gap = 12;
157
+ let totalW = chartW;
158
+ let totalH = chartH;
159
+ let tableX = 0;
160
+ let tableY = 0;
161
+ if (showTable) {
162
+ if (layout === 'row') {
163
+ totalW = chartW + gap + tableWidth;
164
+ totalH = Math.max(chartH, tableHeight);
165
+ tableX = chartW + gap;
166
+ tableY = 0;
167
+ }
168
+ else {
169
+ totalW = Math.max(chartW, tableWidth);
170
+ totalH = chartH + gap + tableHeight;
171
+ tableX = 0;
172
+ tableY = chartH + gap;
173
+ }
174
+ }
175
+ const centers = getHouseCenters(chartW, chartH);
176
+ const ascendantSign = chart.ascendant.sign;
177
+ const margin = 6;
178
+ // White background with purple border — clean outer rect
179
+ const base = `
180
+ <rect x="0" y="0" width="${totalW}" height="${totalH}" fill="${CONFIG.COLORS.background}" />
181
+ <rect x="${margin}" y="${margin}" width="${chartW - margin * 2}" height="${chartH - margin * 2}"
182
+ fill="${CONFIG.COLORS.background}" stroke="${CONFIG.COLORS.border}" stroke-width="2.5" />
183
+ `;
184
+ // Solid lines for a clean, traditional look (no dashes)
185
+ const lines = `
186
+ <g stroke="${CONFIG.COLORS.innerLines}" stroke-width="1.5" opacity="1">
187
+ <line x1="${margin}" y1="${margin}" x2="${chartW - margin}" y2="${chartH - margin}" />
188
+ <line x1="${chartW - margin}" y1="${margin}" x2="${margin}" y2="${chartH - margin}" />
189
+ <line x1="${margin}" y1="${chartH / 2}" x2="${chartW / 2}" y2="${margin}" />
190
+ <line x1="${chartW / 2}" y1="${margin}" x2="${chartW - margin}" y2="${chartH / 2}" />
191
+ <line x1="${chartW - margin}" y1="${chartH / 2}" x2="${chartW / 2}" y2="${chartH - margin}" />
192
+ <line x1="${chartW / 2}" y1="${chartH - margin}" x2="${margin}" y2="${chartH / 2}" />
193
+ </g>
194
+ `;
195
+ let content = '';
196
+ for (let i = 1; i <= 12; i++) {
197
+ const center = centers[i];
198
+ const houseSignIndex = (ascendantSign + i - 1) % 12;
199
+ const signNumber = houseSignIndex + 1;
200
+ const signColor = getSignNumberColor(houseSignIndex);
201
+ content += `<text x="${center.signPos.x}" y="${center.signPos.y}"
202
+ font-family="${CONFIG.FONTS.family}"
203
+ font-size="${CONFIG.FONTS.signSize}"
204
+ fill="${signColor}"
205
+ font-weight="700"
206
+ text-anchor="middle" dominant-baseline="middle">${signNumber}</text>`;
207
+ const planets = chart.planets.filter(p => p.house === i);
208
+ if (planets.length > 0) {
209
+ const lineHeight = 14;
210
+ const startY = center.y - ((planets.length - 1) * lineHeight) / 2;
211
+ planets.forEach((p, idx) => {
212
+ const abbr = PLANET_ABBR[p.planet];
213
+ const text = p.isRetrograde ? `${abbr}℞` : abbr;
214
+ const color = getPlanetColor(p.planet, p.isRetrograde);
215
+ const deg = Math.round(p.degreeInSign);
216
+ content += `<text x="${center.x}" y="${startY + (idx * lineHeight)}"
217
+ font-family="${CONFIG.FONTS.family}"
218
+ font-size="${CONFIG.FONTS.planetSize}"
219
+ fill="${color}"
220
+ font-weight="700"
221
+ text-anchor="middle" dominant-baseline="middle">${text}<tspan dx="1" dy="-5" font-size="${CONFIG.FONTS.degreeSize}">${deg}</tspan></text>`;
222
+ });
223
+ }
224
+ }
225
+ const table = showTable ? generatePlanetTable(chart, tableX, tableY + 6, tableWidth, tableHeight) : '';
226
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${totalW} ${totalH}">
227
+ ${base}
228
+ ${lines}
229
+ ${content}
230
+ ${table}
231
+ </svg>`;
232
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Ayanamsa Systems
3
+ * Different schools use different reference points for the Sidereal zodiac
4
+ */
5
+ export declare enum AyanamsaSystem {
6
+ LAHIRI = 1,// Most popular in India (Chitrapaksha)
7
+ RAMAN = 3,// Used in South India
8
+ KRISHNAMURTI = 5
9
+ }
10
+ /**
11
+ * Calculates the Ayanamsa value for a given Julian Day
12
+ * Ayanamsa is the difference between Tropical and Sidereal zodiacs
13
+ *
14
+ * @param julianDay The Julian Day number
15
+ * @param system The Ayanamsa system to use (default: Lahiri)
16
+ * @returns Ayanamsa value in degrees
17
+ */
18
+ export declare function getAyanamsa(julianDay: number, system?: AyanamsaSystem): number;
19
+ /**
20
+ * Converts Tropical longitude to Sidereal longitude
21
+ *
22
+ * @param tropicalLongitude Tropical longitude (0-360)
23
+ * @param ayanamsa Ayanamsa value in degrees
24
+ * @returns Sidereal longitude (0-360)
25
+ */
26
+ export declare function tropicalToSidereal(tropicalLongitude: number, ayanamsa: number): number;
27
+ /**
28
+ * Converts Sidereal longitude to Tropical longitude
29
+ * (Rarely needed, but included for completeness)
30
+ *
31
+ * @param siderealLongitude Sidereal longitude (0-360)
32
+ * @param ayanamsa Ayanamsa value in degrees
33
+ * @returns Tropical longitude (0-360)
34
+ */
35
+ export declare function siderealToTropical(siderealLongitude: number, ayanamsa: number): number;
36
+ //# sourceMappingURL=ayanamsa.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ayanamsa.d.ts","sourceRoot":"","sources":["../../src/core/ayanamsa.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,oBAAY,cAAc;IACtB,MAAM,IAAI,CAAS,uCAAuC;IAC1D,KAAK,IAAI,CAAU,sBAAsB;IACzC,YAAY,IAAI;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,GAAE,cAAsC,GAAG,MAAM,CAQrG;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,iBAAiB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAStF;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,iBAAiB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAStF"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AyanamsaSystem = void 0;
7
+ exports.getAyanamsa = getAyanamsa;
8
+ exports.tropicalToSidereal = tropicalToSidereal;
9
+ exports.siderealToTropical = siderealToTropical;
10
+ const swisseph_1 = __importDefault(require("swisseph"));
11
+ /**
12
+ * Ayanamsa Systems
13
+ * Different schools use different reference points for the Sidereal zodiac
14
+ */
15
+ var AyanamsaSystem;
16
+ (function (AyanamsaSystem) {
17
+ AyanamsaSystem[AyanamsaSystem["LAHIRI"] = 1] = "LAHIRI";
18
+ AyanamsaSystem[AyanamsaSystem["RAMAN"] = 3] = "RAMAN";
19
+ AyanamsaSystem[AyanamsaSystem["KRISHNAMURTI"] = 5] = "KRISHNAMURTI";
20
+ })(AyanamsaSystem || (exports.AyanamsaSystem = AyanamsaSystem = {}));
21
+ /**
22
+ * Calculates the Ayanamsa value for a given Julian Day
23
+ * Ayanamsa is the difference between Tropical and Sidereal zodiacs
24
+ *
25
+ * @param julianDay The Julian Day number
26
+ * @param system The Ayanamsa system to use (default: Lahiri)
27
+ * @returns Ayanamsa value in degrees
28
+ */
29
+ function getAyanamsa(julianDay, system = AyanamsaSystem.LAHIRI) {
30
+ // Set the Ayanamsa system
31
+ swisseph_1.default.swe_set_sid_mode(system, 0, 0);
32
+ // Calculate Ayanamsa for the given Julian Day
33
+ const ayanamsa = swisseph_1.default.swe_get_ayanamsa_ut(julianDay);
34
+ return ayanamsa;
35
+ }
36
+ /**
37
+ * Converts Tropical longitude to Sidereal longitude
38
+ *
39
+ * @param tropicalLongitude Tropical longitude (0-360)
40
+ * @param ayanamsa Ayanamsa value in degrees
41
+ * @returns Sidereal longitude (0-360)
42
+ */
43
+ function tropicalToSidereal(tropicalLongitude, ayanamsa) {
44
+ let sidereal = tropicalLongitude - ayanamsa;
45
+ // Normalize to 0-360 range
46
+ if (sidereal < 0) {
47
+ sidereal += 360;
48
+ }
49
+ return sidereal;
50
+ }
51
+ /**
52
+ * Converts Sidereal longitude to Tropical longitude
53
+ * (Rarely needed, but included for completeness)
54
+ *
55
+ * @param siderealLongitude Sidereal longitude (0-360)
56
+ * @param ayanamsa Ayanamsa value in degrees
57
+ * @returns Tropical longitude (0-360)
58
+ */
59
+ function siderealToTropical(siderealLongitude, ayanamsa) {
60
+ let tropical = siderealLongitude + ayanamsa;
61
+ // Normalize to 0-360 range
62
+ if (tropical >= 360) {
63
+ tropical -= 360;
64
+ }
65
+ return tropical;
66
+ }
@@ -0,0 +1,72 @@
1
+ /**
2
+ * House System Types
3
+ */
4
+ export declare enum HouseSystem {
5
+ PLACIDUS = "P",// Most common in Western astrology
6
+ WHOLE_SIGN = "W",// Traditional Vedic system (each house = one sign)
7
+ EQUAL = "E",// Equal 30-degree houses from Ascendant
8
+ KOCH = "K"
9
+ }
10
+ /**
11
+ * House Cusps Data
12
+ */
13
+ export interface HouseCusps {
14
+ ascendant: number;
15
+ midheaven: number;
16
+ cusps: number[];
17
+ system: HouseSystem;
18
+ }
19
+ /**
20
+ * Calculates house cusps using Swiss Ephemeris
21
+ *
22
+ * @param julianDay Julian Day number
23
+ * @param latitude Geographic latitude
24
+ * @param longitude Geographic longitude
25
+ * @param system House system to use (default: Whole Sign for Vedic)
26
+ * @returns House cusps data
27
+ */
28
+ export declare function calculateHouseCusps(julianDay: number, latitude: number, longitude: number, system?: HouseSystem): HouseCusps;
29
+ /**
30
+ * Calculates Whole Sign houses (traditional Vedic method)
31
+ * Each house is exactly one sign (30 degrees)
32
+ *
33
+ * @param ascendantDegree The Ascendant degree (0-360)
34
+ * @returns Array of 12 house cusps
35
+ */
36
+ export declare function calculateWholeSignHouses(ascendantDegree: number): number[];
37
+ /**
38
+ * Calculates Bhava Chalit houses (Equal House from Ascendant degree)
39
+ * Used by modern software like Astrosage
40
+ * Each house is exactly 30 degrees, starting from the exact Ascendant degree
41
+ *
42
+ * @param ascendantDegree The exact Ascendant degree (0-360)
43
+ * @returns Array of 12 house cusps
44
+ */
45
+ export declare function calculateBhavaChalitHouses(ascendantDegree: number): number[];
46
+ /**
47
+ * Determines which house a planet is in
48
+ *
49
+ * @param planetLongitude Planet's longitude (0-360)
50
+ * @param houseCusps Array of house cusps
51
+ * @returns House number (1-12)
52
+ */
53
+ export declare function getPlanetHouse(planetLongitude: number, houseCusps: number[]): number;
54
+ /**
55
+ * Determines which house a planet is in using Whole Sign houses (Vedic method)
56
+ * In Whole Sign houses, the house is determined purely by which sign the planet is in
57
+ * relative to the ascendant sign
58
+ *
59
+ * @param planetLongitude Planet's longitude (0-360)
60
+ * @param ascendantLongitude Ascendant's longitude (0-360)
61
+ * @returns House number (1-12)
62
+ */
63
+ export declare function getPlanetHouseWholeSign(planetLongitude: number, ascendantLongitude: number): number;
64
+ /**
65
+ * Gets the house lord (ruling planet) for a given house
66
+ * Based on which sign the house cusp falls in
67
+ *
68
+ * @param houseCusp The house cusp degree
69
+ * @returns Ruling planet name
70
+ */
71
+ export declare function getHouseLord(houseCusp: number): string;
72
+ //# sourceMappingURL=houses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"houses.d.ts","sourceRoot":"","sources":["../../src/core/houses.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,oBAAY,WAAW;IACnB,QAAQ,MAAM,CAAO,mCAAmC;IACxD,UAAU,MAAM,CAAK,mDAAmD;IACxE,KAAK,MAAM,CAAU,wCAAwC;IAC7D,IAAI,MAAM;CACb;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAC/B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,WAAoC,GAC7C,UAAU,CAUZ;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,EAAE,CAc1E;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,EAAE,CAY5E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAuBpF;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,eAAe,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,MAAM,CAUnG;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAmBtD"}