@roxyapi/ui 0.5.0 → 0.6.0

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 (153) hide show
  1. package/README.md +1 -1
  2. package/dist/cdn/components/ashtakavarga-grid.js +3 -362
  3. package/dist/cdn/components/ashtakavarga-grid.js.map +2 -2
  4. package/dist/cdn/components/biorhythm-chart.js +2 -225
  5. package/dist/cdn/components/biorhythm-chart.js.map +2 -2
  6. package/dist/cdn/components/choghadiya-grid.js +2 -231
  7. package/dist/cdn/components/choghadiya-grid.js.map +2 -2
  8. package/dist/cdn/components/compatibility-card.js +2 -230
  9. package/dist/cdn/components/compatibility-card.js.map +2 -2
  10. package/dist/cdn/components/dasha-timeline.js +3 -283
  11. package/dist/cdn/components/dasha-timeline.js.map +4 -4
  12. package/dist/cdn/components/data.js +3 -230
  13. package/dist/cdn/components/data.js.map +2 -2
  14. package/dist/cdn/components/divisional-chart.js +3 -356
  15. package/dist/cdn/components/divisional-chart.js.map +4 -4
  16. package/dist/cdn/components/dosha-card.js +2 -225
  17. package/dist/cdn/components/dosha-card.js.map +2 -2
  18. package/dist/cdn/components/endpoint-form.js +2 -243
  19. package/dist/cdn/components/endpoint-form.js.map +2 -2
  20. package/dist/cdn/components/guna-milan.js +2 -269
  21. package/dist/cdn/components/guna-milan.js.map +2 -2
  22. package/dist/cdn/components/hexagram.js +3 -247
  23. package/dist/cdn/components/hexagram.js.map +2 -2
  24. package/dist/cdn/components/horoscope-card.js +3 -281
  25. package/dist/cdn/components/horoscope-card.js.map +2 -2
  26. package/dist/cdn/components/kp-chart.js +2 -277
  27. package/dist/cdn/components/kp-chart.js.map +2 -2
  28. package/dist/cdn/components/kp-planets-table.js +2 -195
  29. package/dist/cdn/components/kp-planets-table.js.map +2 -2
  30. package/dist/cdn/components/kp-ruling-planets.js +2 -240
  31. package/dist/cdn/components/kp-ruling-planets.js.map +2 -2
  32. package/dist/cdn/components/location-search.js +2 -240
  33. package/dist/cdn/components/location-search.js.map +2 -2
  34. package/dist/cdn/components/moon-phase.js +3 -223
  35. package/dist/cdn/components/moon-phase.js.map +2 -2
  36. package/dist/cdn/components/nakshatra-card.js +2 -200
  37. package/dist/cdn/components/nakshatra-card.js.map +2 -2
  38. package/dist/cdn/components/natal-chart.js +3 -563
  39. package/dist/cdn/components/natal-chart.js.map +4 -4
  40. package/dist/cdn/components/numerology-card.js +2 -232
  41. package/dist/cdn/components/numerology-card.js.map +2 -2
  42. package/dist/cdn/components/panchang-table.js +3 -220
  43. package/dist/cdn/components/panchang-table.js.map +2 -2
  44. package/dist/cdn/components/shadbala-table.js +3 -284
  45. package/dist/cdn/components/shadbala-table.js.map +2 -2
  46. package/dist/cdn/components/synastry-chart.js +2 -398
  47. package/dist/cdn/components/synastry-chart.js.map +2 -2
  48. package/dist/cdn/components/tarot-card.js +3 -261
  49. package/dist/cdn/components/tarot-card.js.map +2 -2
  50. package/dist/cdn/components/tarot-spread.js +2 -248
  51. package/dist/cdn/components/tarot-spread.js.map +2 -2
  52. package/dist/cdn/components/transits-table.js +3 -382
  53. package/dist/cdn/components/transits-table.js.map +4 -4
  54. package/dist/cdn/components/vedic-kundli.js +3 -305
  55. package/dist/cdn/components/vedic-kundli.js.map +4 -4
  56. package/dist/cdn/components/vedic-planets-table.js +2 -202
  57. package/dist/cdn/components/vedic-planets-table.js.map +2 -2
  58. package/dist/cdn/components/western-planets-table.js +3 -192
  59. package/dist/cdn/components/western-planets-table.js.map +2 -2
  60. package/dist/cdn/components/yoga-list.js +2 -305
  61. package/dist/cdn/components/yoga-list.js.map +2 -2
  62. package/dist/cdn/roxy-ui.js +3 -5102
  63. package/dist/cdn/roxy-ui.js.map +4 -4
  64. package/dist/cdn/widgets.js +1 -114
  65. package/dist/components/ashtakavarga-grid.js +1 -577
  66. package/dist/components/ashtakavarga-grid.js.map +3 -3
  67. package/dist/components/biorhythm-chart.js +1 -378
  68. package/dist/components/biorhythm-chart.js.map +3 -3
  69. package/dist/components/choghadiya-grid.js +1 -397
  70. package/dist/components/choghadiya-grid.js.map +3 -3
  71. package/dist/components/compatibility-card.js +1 -359
  72. package/dist/components/compatibility-card.js.map +3 -3
  73. package/dist/components/dasha-timeline.d.ts.map +1 -1
  74. package/dist/components/dasha-timeline.js +1 -447
  75. package/dist/components/dasha-timeline.js.map +4 -4
  76. package/dist/components/data.js +1 -408
  77. package/dist/components/data.js.map +3 -3
  78. package/dist/components/divisional-chart.d.ts.map +1 -1
  79. package/dist/components/divisional-chart.js +1 -932
  80. package/dist/components/divisional-chart.js.map +4 -4
  81. package/dist/components/dosha-card.js +1 -339
  82. package/dist/components/dosha-card.js.map +3 -3
  83. package/dist/components/endpoint-form.js +1 -505
  84. package/dist/components/endpoint-form.js.map +3 -3
  85. package/dist/components/guna-milan.js +1 -420
  86. package/dist/components/guna-milan.js.map +3 -3
  87. package/dist/components/hexagram.js +1 -426
  88. package/dist/components/hexagram.js.map +3 -3
  89. package/dist/components/horoscope-card.js +1 -427
  90. package/dist/components/horoscope-card.js.map +3 -3
  91. package/dist/components/kp-chart.js +1 -441
  92. package/dist/components/kp-chart.js.map +3 -3
  93. package/dist/components/kp-planets-table.js +1 -292
  94. package/dist/components/kp-planets-table.js.map +3 -3
  95. package/dist/components/kp-ruling-planets.js +1 -334
  96. package/dist/components/kp-ruling-planets.js.map +3 -3
  97. package/dist/components/location-search.js +1 -461
  98. package/dist/components/location-search.js.map +3 -3
  99. package/dist/components/moon-phase.js +1 -373
  100. package/dist/components/moon-phase.js.map +3 -3
  101. package/dist/components/nakshatra-card.js +1 -290
  102. package/dist/components/nakshatra-card.js.map +3 -3
  103. package/dist/components/natal-chart.d.ts +0 -1
  104. package/dist/components/natal-chart.d.ts.map +1 -1
  105. package/dist/components/natal-chart.js +1 -1086
  106. package/dist/components/natal-chart.js.map +4 -4
  107. package/dist/components/numerology-card.js +1 -361
  108. package/dist/components/numerology-card.js.map +3 -3
  109. package/dist/components/panchang-table.js +1 -396
  110. package/dist/components/panchang-table.js.map +3 -3
  111. package/dist/components/shadbala-table.js +1 -459
  112. package/dist/components/shadbala-table.js.map +3 -3
  113. package/dist/components/synastry-chart.js +1 -704
  114. package/dist/components/synastry-chart.js.map +3 -3
  115. package/dist/components/tarot-card.js +1 -379
  116. package/dist/components/tarot-card.js.map +3 -3
  117. package/dist/components/tarot-spread.js +1 -356
  118. package/dist/components/tarot-spread.js.map +3 -3
  119. package/dist/components/transits-table.d.ts +2 -0
  120. package/dist/components/transits-table.d.ts.map +1 -1
  121. package/dist/components/transits-table.js +1 -594
  122. package/dist/components/transits-table.js.map +4 -4
  123. package/dist/components/vedic-kundli.d.ts.map +1 -1
  124. package/dist/components/vedic-kundli.js +1 -848
  125. package/dist/components/vedic-kundli.js.map +4 -4
  126. package/dist/components/vedic-planets-table.js +1 -414
  127. package/dist/components/vedic-planets-table.js.map +3 -3
  128. package/dist/components/western-planets-table.js +1 -409
  129. package/dist/components/western-planets-table.js.map +3 -3
  130. package/dist/components/yoga-list.js +1 -429
  131. package/dist/components/yoga-list.js.map +3 -3
  132. package/dist/index.cjs +1 -8726
  133. package/dist/index.cjs.map +4 -4
  134. package/dist/index.js +1 -8706
  135. package/dist/index.js.map +4 -4
  136. package/dist/utils/disclosure.d.ts +16 -0
  137. package/dist/utils/disclosure.d.ts.map +1 -0
  138. package/dist/utils/kundli-render.d.ts.map +1 -1
  139. package/dist/utils/kundli-styles.d.ts.map +1 -1
  140. package/dist/utils/tablist.d.ts +44 -0
  141. package/dist/utils/tablist.d.ts.map +1 -0
  142. package/dist/version.d.ts +1 -1
  143. package/package.json +3 -1
  144. package/src/components/dasha-timeline.ts +10 -1
  145. package/src/components/divisional-chart.ts +2 -0
  146. package/src/components/natal-chart.ts +37 -62
  147. package/src/components/transits-table.ts +45 -18
  148. package/src/components/vedic-kundli.ts +2 -1
  149. package/src/utils/disclosure.ts +62 -0
  150. package/src/utils/kundli-render.ts +21 -35
  151. package/src/utils/kundli-styles.ts +0 -31
  152. package/src/utils/tablist.ts +124 -0
  153. package/src/version.ts +1 -1
@@ -1,849 +1,2 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __decorateClass = (decorators, target, key, kind) => {
4
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
- if (decorator = decorators[i])
7
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result) __defProp(target, key, result);
9
- return result;
10
- };
11
-
12
- // packages/ui/src/components/vedic-kundli.ts
13
- import { html as html2, LitElement } from "lit";
14
- import { customElement, property } from "lit/decorators.js";
15
-
16
- // packages/ui/src/utils/base-styles.ts
17
- import { css } from "lit";
18
- var baseStyles = css`
19
- :host {
20
- display: block;
21
- container-type: inline-size;
22
- font-family: var(
23
- --roxy-font-sans,
24
- system-ui,
25
- -apple-system,
26
- BlinkMacSystemFont,
27
- 'Segoe UI',
28
- Roboto,
29
- sans-serif
30
- );
31
- color: var(--roxy-fg, #0a0a0a);
32
- background: transparent;
33
- font-size: var(--roxy-text-base, 1rem);
34
- line-height: var(--roxy-leading-normal, 1.5);
35
- animation: roxy-fade-in var(--roxy-motion-duration, 200ms)
36
- var(--roxy-motion-easing, cubic-bezier(0.4, 0, 0.2, 1)) both;
37
- }
38
-
39
- *,
40
- *::before,
41
- *::after {
42
- box-sizing: border-box;
43
- }
44
-
45
- @keyframes roxy-fade-in {
46
- from {
47
- opacity: 0;
48
- transform: translateY(2px);
49
- }
50
- to {
51
- opacity: 1;
52
- transform: translateY(0);
53
- }
54
- }
55
-
56
- @media (prefers-reduced-motion: reduce) {
57
- :host {
58
- animation: none;
59
- }
60
- }
61
-
62
- .roxy-skeleton {
63
- background: linear-gradient(
64
- 90deg,
65
- var(--roxy-border, #e4e4e7) 0%,
66
- color-mix(in srgb, var(--roxy-border, #e4e4e7) 60%, transparent) 50%,
67
- var(--roxy-border, #e4e4e7) 100%
68
- );
69
- background-size: 200% 100%;
70
- animation: roxy-shimmer 1.4s ease-in-out infinite;
71
- border-radius: var(--roxy-radius-md, 8px);
72
- }
73
-
74
- @keyframes roxy-shimmer {
75
- 0% {
76
- background-position: 200% 0;
77
- }
78
- 100% {
79
- background-position: -200% 0;
80
- }
81
- }
82
-
83
- @media (prefers-reduced-motion: reduce) {
84
- .roxy-skeleton {
85
- animation: none;
86
- }
87
- }
88
-
89
- .roxy-empty {
90
- padding: var(--roxy-space-lg, 1.5rem);
91
- color: var(--roxy-muted, #71717a);
92
- text-align: center;
93
- font-size: var(--roxy-text-sm, 0.875rem);
94
- }
95
-
96
- :host(:focus-within) .roxy-card {
97
- outline: 2px solid var(--roxy-ring, rgba(245, 158, 11, 0.4));
98
- outline-offset: 2px;
99
- }
100
-
101
- /* Force the text-style variant on every Unicode glyph in the component.
102
- * macOS and iOS substitute coloured emoji glyphs for the planetary and
103
- * gender Unicode code points (Mars, Venus, Mercury, etc.) when the
104
- * system colour-emoji font wins font selection. The text-style variant
105
- * keeps glyphs monochrome so they inherit the surrounding fill colour
106
- * and match the brand palette consistently across platforms.
107
- *
108
- * font-variant-emoji is part of CSS Fonts 4 (Safari 17+, Chrome 134+,
109
- * Firefox 139+). On older browsers the rule is silently ignored.
110
- */
111
- :host {
112
- font-variant-emoji: text;
113
- }
114
- `;
115
-
116
- // packages/ui/src/utils/kundli-render.ts
117
- import { html, nothing, svg } from "lit";
118
-
119
- // packages/ui/src/tokens/index.ts
120
- var PLANET_ABBR = {
121
- Sun: "Su",
122
- Moon: "Mo",
123
- Mercury: "Me",
124
- Venus: "Ve",
125
- Mars: "Ma",
126
- Jupiter: "Ju",
127
- Saturn: "Sa",
128
- Uranus: "Ur",
129
- Neptune: "Ne",
130
- Pluto: "Pl",
131
- Rahu: "Ra",
132
- Ketu: "Ke",
133
- Ascendant: "Asc",
134
- Lagna: "La"
135
- };
136
- var SIGN_ABBR = {
137
- Aries: "Ar",
138
- Taurus: "Ta",
139
- Gemini: "Ge",
140
- Cancer: "Cn",
141
- Leo: "Le",
142
- Virgo: "Vi",
143
- Libra: "Li",
144
- Scorpio: "Sc",
145
- Sagittarius: "Sg",
146
- Capricorn: "Cp",
147
- Aquarius: "Aq",
148
- Pisces: "Pi"
149
- };
150
- var SIGNS_ORDER = [
151
- "Aries",
152
- "Taurus",
153
- "Gemini",
154
- "Cancer",
155
- "Leo",
156
- "Virgo",
157
- "Libra",
158
- "Scorpio",
159
- "Sagittarius",
160
- "Capricorn",
161
- "Aquarius",
162
- "Pisces"
163
- ];
164
- var RASHI_KEYS = SIGNS_ORDER.map(
165
- (s) => s.toLowerCase()
166
- );
167
-
168
- // packages/ui/src/utils/degree.ts
169
- function normalizeLongitude(lon) {
170
- const wrapped = lon % 360;
171
- return wrapped < 0 ? wrapped + 360 : wrapped;
172
- }
173
- function longitudeToSignPosition(longitude) {
174
- const lon = normalizeLongitude(longitude);
175
- const signIndex = Math.floor(lon / 30) % 12;
176
- const within = lon % 30;
177
- const degree = Math.floor(within);
178
- const minuteFloat = (within - degree) * 60;
179
- const minute = Math.floor(minuteFloat);
180
- const second = Math.round((minuteFloat - minute) * 60);
181
- return {
182
- sign: SIGNS_ORDER[signIndex] ?? "Aries",
183
- signIndex,
184
- degree,
185
- minute,
186
- second
187
- };
188
- }
189
-
190
- // packages/ui/src/utils/string.ts
191
- function capitalize(s) {
192
- if (!s) return "";
193
- return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();
194
- }
195
-
196
- // packages/ui/src/utils/kundli-render.ts
197
- var VIEW_BOX = 400;
198
- var MARGIN = 20;
199
- var INNER = VIEW_BOX - 2 * MARGIN;
200
- var CENTRE = VIEW_BOX / 2;
201
- var RASHI_TO_SIGN = Object.fromEntries(
202
- SIGNS_ORDER.map((s) => [s.toLowerCase(), s])
203
- );
204
- var CHART_STYLES = [
205
- { id: "north", label: "North" },
206
- { id: "south", label: "South" },
207
- { id: "east", label: "East" }
208
- ];
209
- var RETRO_MARK = "\u02B3";
210
- function isDivisionalPlacement(p, cellSign) {
211
- if (typeof p.longitude !== "number" || !Number.isFinite(p.longitude)) {
212
- return false;
213
- }
214
- return longitudeToSignPosition(p.longitude).sign.toLowerCase() !== cellSign.toLowerCase();
215
- }
216
- function grahaLabel(p, cellSign) {
217
- const abbr = PLANET_ABBR[capitalize(p.graha)] ?? p.graha.slice(0, 2);
218
- const retro = p.isRetrograde ? RETRO_MARK : "";
219
- if (typeof p.longitude !== "number" || !Number.isFinite(p.longitude) || isDivisionalPlacement(p, cellSign)) {
220
- return `${abbr}${retro}`;
221
- }
222
- const { degree } = longitudeToSignPosition(p.longitude);
223
- return `${abbr} ${degree}\xB0${retro}`;
224
- }
225
- function grahaTitle(p, cellSign) {
226
- const parts = [capitalize(p.graha)];
227
- const divisional = isDivisionalPlacement(p, cellSign);
228
- if (divisional) {
229
- parts.push(`in ${cellSign}`);
230
- }
231
- if (typeof p.longitude === "number" && Number.isFinite(p.longitude)) {
232
- const sp = longitudeToSignPosition(p.longitude);
233
- const minute = String(sp.minute).padStart(2, "0");
234
- parts.push(
235
- divisional ? `D1: ${sp.degree}\xB0${minute}' ${sp.sign}` : `${sp.degree}\xB0${minute}' ${sp.sign}`
236
- );
237
- }
238
- if (p.nakshatra?.name) {
239
- const pada = p.nakshatra.pada ? ` pada ${p.nakshatra.pada}` : "";
240
- parts.push(`${p.nakshatra.name}${pada}`);
241
- }
242
- if (p.awastha) parts.push(p.awastha);
243
- if (p.isRetrograde) parts.push("retrograde");
244
- return parts.join(" \xB7 ");
245
- }
246
- function renderPlanetStack(planets, cellSign, cx, baseY, lineHeight) {
247
- const startY = baseY - (planets.length - 1) * lineHeight / 2;
248
- return planets.map((p, j) => {
249
- const yPos = startY + j * lineHeight;
250
- return svg`<text class="planet-text" x=${cx} y=${yPos} text-anchor="middle" dominant-baseline="central">${grahaLabel(
251
- p,
252
- cellSign
253
- )}<title>${grahaTitle(p, cellSign)}</title></text>`;
254
- });
255
- }
256
- function toKundliViewModel(meta, divisionLabel) {
257
- const placements = {};
258
- for (const sign of SIGNS_ORDER) placements[sign.toLowerCase()] = [];
259
- let lagnaSign = "";
260
- for (const [name, pos] of Object.entries(meta ?? {})) {
261
- const rashiKey = (pos?.rashi ?? "").toLowerCase();
262
- if (name === "Lagna" || pos?.graha === "Lagna") {
263
- lagnaSign = RASHI_TO_SIGN[rashiKey] ?? "";
264
- continue;
265
- }
266
- if (!rashiKey || !(rashiKey in placements)) continue;
267
- placements[rashiKey]?.push({
268
- graha: pos.graha ?? name,
269
- longitude: pos.longitude,
270
- nakshatra: pos.nakshatra,
271
- isRetrograde: pos.isRetrograde,
272
- awastha: pos.awastha
273
- });
274
- }
275
- return { lagnaSign, placements, divisionLabel };
276
- }
277
- var SOUTH_CELL = INNER / 4;
278
- var SOUTH_CELL_GRID = {
279
- Pisces: { col: 0, row: 0 },
280
- Aries: { col: 1, row: 0 },
281
- Taurus: { col: 2, row: 0 },
282
- Gemini: { col: 3, row: 0 },
283
- Cancer: { col: 3, row: 1 },
284
- Leo: { col: 3, row: 2 },
285
- Virgo: { col: 3, row: 3 },
286
- Libra: { col: 2, row: 3 },
287
- Scorpio: { col: 1, row: 3 },
288
- Sagittarius: { col: 0, row: 3 },
289
- Capricorn: { col: 0, row: 2 },
290
- Aquarius: { col: 0, row: 1 }
291
- };
292
- function southCellRect(sign) {
293
- const g = SOUTH_CELL_GRID[sign] ?? { col: 0, row: 0 };
294
- return {
295
- x: MARGIN + g.col * SOUTH_CELL,
296
- y: MARGIN + g.row * SOUTH_CELL,
297
- w: SOUTH_CELL,
298
- h: SOUTH_CELL
299
- };
300
- }
301
- function renderSouthFrame(divisionLabel) {
302
- const a = MARGIN;
303
- const b = MARGIN + SOUTH_CELL;
304
- const c = MARGIN + 2 * SOUTH_CELL;
305
- const d = MARGIN + 3 * SOUTH_CELL;
306
- const e = VIEW_BOX - MARGIN;
307
- return svg`
308
- <rect class="line" x=${a} y=${a} width=${INNER} height=${INNER} stroke-width="1.5" fill="none" />
309
- <line class="line" x1=${a} y1=${b} x2=${e} y2=${b} stroke-width="1" />
310
- <line class="line" x1=${a} y1=${d} x2=${e} y2=${d} stroke-width="1" />
311
- <line class="line" x1=${b} y1=${a} x2=${b} y2=${e} stroke-width="1" />
312
- <line class="line" x1=${d} y1=${a} x2=${d} y2=${e} stroke-width="1" />
313
- <line class="line" x1=${a} y1=${c} x2=${b} y2=${c} stroke-width="1" />
314
- <line class="line" x1=${d} y1=${c} x2=${e} y2=${c} stroke-width="1" />
315
- <line class="line" x1=${c} y1=${a} x2=${c} y2=${b} stroke-width="1" />
316
- <line class="line" x1=${c} y1=${d} x2=${c} y2=${e} stroke-width="1" />
317
- ${divisionLabel ? svg`<text class="centre-label" x=${CENTRE} y=${CENTRE} text-anchor="middle" dominant-baseline="central">${divisionLabel}</text>` : nothing}
318
- `;
319
- }
320
- function houseNumberInSign(sign, lagnaSign) {
321
- const lagnaIdx = SIGNS_ORDER.findIndex((s) => s === lagnaSign);
322
- const signIdx = SIGNS_ORDER.findIndex((s) => s === sign);
323
- if (lagnaIdx === -1 || signIdx === -1) return 0;
324
- return (signIdx - lagnaIdx + 12) % 12 + 1;
325
- }
326
- function renderSouthCell(sign, planets, isLagna, houseNum) {
327
- const r = southCellRect(sign);
328
- const cx = r.x + r.w / 2;
329
- const cy = r.y + r.h / 2;
330
- const signAbbr = SIGN_ABBR[sign] ?? sign.slice(0, 2);
331
- const slashInset = 14;
332
- return svg`
333
- <g class=${isLagna ? "cell lagna" : "cell"}>
334
- ${isLagna ? svg`
335
- <rect class="lagna-bg" x=${r.x} y=${r.y} width=${r.w} height=${r.h} />
336
- <line class="lagna-slash" x1=${r.x + r.w - slashInset} y1=${r.y + slashInset} x2=${r.x + slashInset} y2=${r.y + r.h - slashInset} stroke-width="1.2" />
337
- ` : nothing}
338
- <text class="sign-text" x=${r.x + 6} y=${r.y + 12} text-anchor="start" dominant-baseline="central">${signAbbr}</text>
339
- ${houseNum > 0 ? svg`<text class="house-num" x=${r.x + r.w - 6} y=${r.y + 12} text-anchor="end" dominant-baseline="central">${houseNum}</text>` : nothing}
340
- ${planets.length ? renderPlanetStack(planets, sign, cx, cy + 4, 14) : nothing}
341
- </g>
342
- `;
343
- }
344
- function renderSouthSvg(vm) {
345
- const lagnaKey = vm.lagnaSign.toLowerCase();
346
- return svg`
347
- ${renderSouthFrame(vm.divisionLabel)}
348
- ${SIGNS_ORDER.map(
349
- (sign) => renderSouthCell(
350
- sign,
351
- vm.placements[sign.toLowerCase()] ?? [],
352
- sign.toLowerCase() === lagnaKey,
353
- houseNumberInSign(sign, vm.lagnaSign)
354
- )
355
- )}
356
- `;
357
- }
358
- var NORTH_VERTICES = {
359
- tl: { x: MARGIN, y: MARGIN },
360
- tr: { x: VIEW_BOX - MARGIN, y: MARGIN },
361
- br: { x: VIEW_BOX - MARGIN, y: VIEW_BOX - MARGIN },
362
- bl: { x: MARGIN, y: VIEW_BOX - MARGIN },
363
- top: { x: CENTRE, y: MARGIN },
364
- right: { x: VIEW_BOX - MARGIN, y: CENTRE },
365
- bottom: { x: CENTRE, y: VIEW_BOX - MARGIN },
366
- left: { x: MARGIN, y: CENTRE },
367
- tlMid: { x: CENTRE - INNER / 4, y: CENTRE - INNER / 4 },
368
- trMid: { x: CENTRE + INNER / 4, y: CENTRE - INNER / 4 },
369
- brMid: { x: CENTRE + INNER / 4, y: CENTRE + INNER / 4 },
370
- blMid: { x: CENTRE - INNER / 4, y: CENTRE + INNER / 4 }
371
- };
372
- function centroidOf(pts) {
373
- const x = pts.reduce((s, p) => s + p.x, 0) / pts.length;
374
- const y = pts.reduce((s, p) => s + p.y, 0) / pts.length;
375
- return { x, y };
376
- }
377
- var NORTH_HOUSE_CENTERS = {
378
- 1: { x: CENTRE, y: NORTH_VERTICES.tlMid.y },
379
- 2: centroidOf([NORTH_VERTICES.tl, NORTH_VERTICES.top, NORTH_VERTICES.tlMid]),
380
- 3: centroidOf([NORTH_VERTICES.tl, NORTH_VERTICES.left, NORTH_VERTICES.tlMid]),
381
- 4: { x: NORTH_VERTICES.tlMid.x, y: CENTRE },
382
- 5: centroidOf([NORTH_VERTICES.bl, NORTH_VERTICES.left, NORTH_VERTICES.blMid]),
383
- 6: centroidOf([
384
- NORTH_VERTICES.bl,
385
- NORTH_VERTICES.bottom,
386
- NORTH_VERTICES.blMid
387
- ]),
388
- 7: { x: CENTRE, y: NORTH_VERTICES.blMid.y },
389
- 8: centroidOf([
390
- NORTH_VERTICES.br,
391
- NORTH_VERTICES.bottom,
392
- NORTH_VERTICES.brMid
393
- ]),
394
- 9: centroidOf([
395
- NORTH_VERTICES.br,
396
- NORTH_VERTICES.right,
397
- NORTH_VERTICES.brMid
398
- ]),
399
- 10: { x: NORTH_VERTICES.brMid.x, y: CENTRE },
400
- 11: centroidOf([
401
- NORTH_VERTICES.tr,
402
- NORTH_VERTICES.right,
403
- NORTH_VERTICES.trMid
404
- ]),
405
- 12: centroidOf([NORTH_VERTICES.tr, NORTH_VERTICES.top, NORTH_VERTICES.trMid])
406
- };
407
- function rashiInHouse(houseNum, lagnaSign) {
408
- const lagnaIdx = SIGNS_ORDER.findIndex((s) => s === lagnaSign);
409
- if (lagnaIdx === -1) return houseNum;
410
- return (lagnaIdx + houseNum - 1) % 12 + 1;
411
- }
412
- function renderNorthFrame(divisionLabel) {
413
- const { tl, tr, br, bl, top, right, bottom, left } = NORTH_VERTICES;
414
- return svg`
415
- <rect class="line" x=${tl.x} y=${tl.y} width=${INNER} height=${INNER} stroke-width="1.5" fill="none" />
416
- <polygon class="line" points="${top.x},${top.y} ${right.x},${right.y} ${bottom.x},${bottom.y} ${left.x},${left.y}" stroke-width="1" fill="none" />
417
- <line class="line" x1=${tl.x} y1=${tl.y} x2=${br.x} y2=${br.y} stroke-width="1" />
418
- <line class="line" x1=${tr.x} y1=${tr.y} x2=${bl.x} y2=${bl.y} stroke-width="1" />
419
- ${divisionLabel ? svg`<text class="centre-label" x=${CENTRE} y=${CENTRE} text-anchor="middle" dominant-baseline="central">${divisionLabel}</text>` : nothing}
420
- `;
421
- }
422
- function renderNorthCell(houseNum, rashiNum, sign, planets, isLagna) {
423
- const c = NORTH_HOUSE_CENTERS[houseNum];
424
- if (!c) return svg``;
425
- const rashiOffsetY = Math.min(14, Math.abs(c.y - CENTRE) * 0.45 + 6);
426
- const ascOffsetY = rashiOffsetY + 12;
427
- return svg`
428
- <g class=${isLagna ? "cell lagna" : "cell"}>
429
- <text class="rashi-num" x=${c.x} y=${c.y - rashiOffsetY} text-anchor="middle" dominant-baseline="central">${rashiNum}</text>
430
- ${isLagna ? svg`<text class="lagna-marker" x=${c.x} y=${c.y - ascOffsetY} text-anchor="middle" dominant-baseline="central">Asc</text>` : nothing}
431
- ${planets.length ? renderPlanetStack(planets, sign, c.x, c.y + 8, 12) : nothing}
432
- </g>
433
- `;
434
- }
435
- function renderNorthSvg(vm) {
436
- const lagnaSign = vm.lagnaSign || "Aries";
437
- return svg`
438
- ${renderNorthFrame(vm.divisionLabel)}
439
- ${Array.from({ length: 12 }, (_, i) => {
440
- const houseNum = i + 1;
441
- const rashiNum = rashiInHouse(houseNum, lagnaSign);
442
- const sign = SIGNS_ORDER[rashiNum - 1] ?? "Aries";
443
- return renderNorthCell(
444
- houseNum,
445
- rashiNum,
446
- sign,
447
- vm.placements[sign.toLowerCase()] ?? [],
448
- houseNum === 1
449
- );
450
- })}
451
- `;
452
- }
453
- var EAST_CELL = INNER / 3;
454
- function eastCells() {
455
- const a = MARGIN;
456
- const b = MARGIN + EAST_CELL;
457
- const c = MARGIN + 2 * EAST_CELL;
458
- const d = VIEW_BOX - MARGIN;
459
- const aries = [
460
- { x: b, y: a },
461
- { x: c, y: a },
462
- { x: c, y: b },
463
- { x: b, y: b }
464
- ];
465
- const cancer = [
466
- { x: a, y: b },
467
- { x: b, y: b },
468
- { x: b, y: c },
469
- { x: a, y: c }
470
- ];
471
- const libra = [
472
- { x: b, y: c },
473
- { x: c, y: c },
474
- { x: c, y: d },
475
- { x: b, y: d }
476
- ];
477
- const capricorn = [
478
- { x: c, y: b },
479
- { x: d, y: b },
480
- { x: d, y: c },
481
- { x: c, y: c }
482
- ];
483
- const taurus = [
484
- { x: a, y: a },
485
- { x: b, y: a },
486
- { x: b, y: b }
487
- ];
488
- const gemini = [
489
- { x: a, y: a },
490
- { x: b, y: b },
491
- { x: a, y: b }
492
- ];
493
- const leo = [
494
- { x: a, y: c },
495
- { x: b, y: c },
496
- { x: a, y: d }
497
- ];
498
- const virgo = [
499
- { x: b, y: c },
500
- { x: b, y: d },
501
- { x: a, y: d }
502
- ];
503
- const scorpio = [
504
- { x: c, y: c },
505
- { x: c, y: d },
506
- { x: d, y: d }
507
- ];
508
- const sagittarius = [
509
- { x: c, y: c },
510
- { x: d, y: d },
511
- { x: d, y: c }
512
- ];
513
- const aquarius = [
514
- { x: d, y: a },
515
- { x: d, y: b },
516
- { x: c, y: b }
517
- ];
518
- const pisces = [
519
- { x: c, y: a },
520
- { x: d, y: a },
521
- { x: c, y: b }
522
- ];
523
- const polys = {
524
- Aries: aries,
525
- Taurus: taurus,
526
- Gemini: gemini,
527
- Cancer: cancer,
528
- Leo: leo,
529
- Virgo: virgo,
530
- Libra: libra,
531
- Scorpio: scorpio,
532
- Sagittarius: sagittarius,
533
- Capricorn: capricorn,
534
- Aquarius: aquarius,
535
- Pisces: pisces
536
- };
537
- const out = {};
538
- for (const [sign, points] of Object.entries(polys)) {
539
- out[sign] = { points: [...points], centroid: centroidOf(points) };
540
- }
541
- return out;
542
- }
543
- var EAST_CELLS = eastCells();
544
- function renderEastFrame(divisionLabel) {
545
- const a = MARGIN;
546
- const b = MARGIN + EAST_CELL;
547
- const c = MARGIN + 2 * EAST_CELL;
548
- const d = VIEW_BOX - MARGIN;
549
- return svg`
550
- <rect class="line" x=${a} y=${a} width=${INNER} height=${INNER} stroke-width="1.5" fill="none" />
551
- <line class="line" x1=${a} y1=${b} x2=${b} y2=${b} stroke-width="1" />
552
- <line class="line" x1=${c} y1=${b} x2=${d} y2=${b} stroke-width="1" />
553
- <line class="line" x1=${a} y1=${c} x2=${b} y2=${c} stroke-width="1" />
554
- <line class="line" x1=${c} y1=${c} x2=${d} y2=${c} stroke-width="1" />
555
- <line class="line" x1=${b} y1=${a} x2=${b} y2=${b} stroke-width="1" />
556
- <line class="line" x1=${b} y1=${c} x2=${b} y2=${d} stroke-width="1" />
557
- <line class="line" x1=${c} y1=${a} x2=${c} y2=${b} stroke-width="1" />
558
- <line class="line" x1=${c} y1=${c} x2=${c} y2=${d} stroke-width="1" />
559
- <line class="line" x1=${a} y1=${a} x2=${b} y2=${b} stroke-width="1" />
560
- <line class="line" x1=${d} y1=${a} x2=${c} y2=${b} stroke-width="1" />
561
- <line class="line" x1=${d} y1=${d} x2=${c} y2=${c} stroke-width="1" />
562
- <line class="line" x1=${a} y1=${d} x2=${b} y2=${c} stroke-width="1" />
563
- ${divisionLabel ? svg`<text class="centre-label" x=${CENTRE} y=${CENTRE} text-anchor="middle" dominant-baseline="central">${divisionLabel}</text>` : nothing}
564
- `;
565
- }
566
- function renderEastCell(sign, planets, isLagna, houseNum) {
567
- const cell = EAST_CELLS[sign];
568
- if (!cell) return svg``;
569
- const { centroid: cen, points } = cell;
570
- const signAbbr = SIGN_ABBR[sign] ?? sign.slice(0, 2);
571
- const polyPoints = points.map((p) => `${p.x},${p.y}`).join(" ");
572
- return svg`
573
- <g class=${isLagna ? "cell lagna" : "cell"}>
574
- ${isLagna ? svg`<polygon class="lagna-bg" points=${polyPoints} />` : nothing}
575
- <text class="sign-text" x=${cen.x} y=${cen.y - 16} text-anchor="middle" dominant-baseline="central">${signAbbr}</text>
576
- ${houseNum > 0 ? svg`<text class="house-num" x=${cen.x + 18} y=${cen.y - 16} text-anchor="start" dominant-baseline="central">${houseNum}</text>` : nothing}
577
- ${isLagna ? svg`<text class="lagna-marker" x=${cen.x} y=${cen.y - 30} text-anchor="middle" dominant-baseline="central">Asc</text>` : nothing}
578
- ${planets.length ? renderPlanetStack(planets, sign, cen.x, cen.y + 4, 12) : nothing}
579
- </g>
580
- `;
581
- }
582
- function renderEastSvg(vm) {
583
- const lagnaKey = vm.lagnaSign.toLowerCase();
584
- return svg`
585
- ${renderEastFrame(vm.divisionLabel)}
586
- ${SIGNS_ORDER.map(
587
- (sign) => renderEastCell(
588
- sign,
589
- vm.placements[sign.toLowerCase()] ?? [],
590
- sign.toLowerCase() === lagnaKey,
591
- houseNumberInSign(sign, vm.lagnaSign)
592
- )
593
- )}
594
- `;
595
- }
596
- function renderKundliSvg(vm, style) {
597
- switch (style) {
598
- case "north":
599
- return renderNorthSvg(vm);
600
- case "east":
601
- return renderEastSvg(vm);
602
- default:
603
- return renderSouthSvg(vm);
604
- }
605
- }
606
- function renderKundliStyleTablist(active, setStyle) {
607
- const onKeyDown = (e) => {
608
- const idx = CHART_STYLES.findIndex((s) => s.id === active);
609
- if (e.key === "ArrowRight") {
610
- e.preventDefault();
611
- const next = CHART_STYLES[(idx + 1) % CHART_STYLES.length];
612
- if (next) setStyle(next.id);
613
- } else if (e.key === "ArrowLeft") {
614
- e.preventDefault();
615
- const next = CHART_STYLES[(idx - 1 + CHART_STYLES.length) % CHART_STYLES.length];
616
- if (next) setStyle(next.id);
617
- }
618
- };
619
- return html`<div
620
- class="kundli-tablist"
621
- role="tablist"
622
- aria-label="Kundli style"
623
- @keydown=${onKeyDown}
624
- >
625
- ${CHART_STYLES.map(
626
- (s) => html`<button
627
- type="button"
628
- class="kundli-tab"
629
- role="tab"
630
- id="kundli-tab-${s.id}"
631
- aria-selected=${active === s.id ? "true" : "false"}
632
- tabindex=${active === s.id ? "0" : "-1"}
633
- @click=${() => setStyle(s.id)}
634
- >
635
- ${s.label}
636
- </button>`
637
- )}
638
- </div>`;
639
- }
640
-
641
- // packages/ui/src/utils/kundli-styles.ts
642
- import { css as css2 } from "lit";
643
- var kundliStyles = css2`
644
- .wrap {
645
- display: grid;
646
- gap: var(--roxy-space-md, 1rem);
647
- }
648
- .header {
649
- display: flex;
650
- flex-wrap: wrap;
651
- align-items: center;
652
- justify-content: space-between;
653
- gap: var(--roxy-space-sm, 0.5rem);
654
- }
655
- .title {
656
- font-size: var(--roxy-text-lg, 1.125rem);
657
- font-weight: var(--roxy-weight-bold, 600);
658
- margin: 0;
659
- }
660
- .kundli-tablist {
661
- display: inline-flex;
662
- gap: 2px;
663
- border-bottom: 2px solid var(--roxy-border, #e4e4e7);
664
- }
665
- .kundli-tab {
666
- padding: var(--roxy-space-xs, 0.25rem) var(--roxy-space-md, 1rem);
667
- font-size: var(--roxy-text-sm, 0.875rem);
668
- background: none;
669
- border: none;
670
- border-bottom: 2px solid transparent;
671
- margin-bottom: -2px;
672
- cursor: pointer;
673
- color: var(--roxy-muted, #71717a);
674
- font-family: inherit;
675
- transition: color var(--roxy-motion-duration, 200ms)
676
- var(--roxy-motion-easing, ease);
677
- }
678
- .kundli-tab[aria-selected='true'] {
679
- color: var(--roxy-accent-fg, #b45309);
680
- border-bottom-color: var(--roxy-accent, #f59e0b);
681
- font-weight: var(--roxy-weight-bold, 600);
682
- }
683
- .kundli-tab:hover:not([aria-selected='true']) {
684
- color: var(--roxy-fg, #0a0a0a);
685
- }
686
- .kundli-tab:focus-visible {
687
- outline: 2px solid var(--roxy-ring, rgba(245, 158, 11, 0.4));
688
- outline-offset: 2px;
689
- border-radius: 4px;
690
- }
691
- svg {
692
- display: block;
693
- width: 100%;
694
- max-width: 560px;
695
- aspect-ratio: 1 / 1;
696
- height: auto;
697
- margin: 0 auto;
698
- }
699
- .line {
700
- fill: transparent;
701
- stroke: var(--roxy-border, #d4d4d8);
702
- }
703
- .sign-text {
704
- fill: var(--roxy-muted, #71717a);
705
- font-size: 11px;
706
- font-weight: 500;
707
- font-family: var(--roxy-font-sans);
708
- text-transform: uppercase;
709
- letter-spacing: 0.04em;
710
- }
711
- .rashi-num {
712
- fill: var(--roxy-muted, #71717a);
713
- font-size: 12px;
714
- font-weight: 500;
715
- font-family: var(--roxy-font-sans);
716
- }
717
- .house-num {
718
- fill: var(--roxy-accent-fg, #b45309);
719
- font-size: 11px;
720
- font-weight: 600;
721
- font-family: var(--roxy-font-sans);
722
- opacity: 0.85;
723
- }
724
- .planet-text {
725
- fill: var(--roxy-fg, #0a0a0a);
726
- font-size: 13px;
727
- font-weight: 600;
728
- font-family: var(--roxy-font-sans);
729
- }
730
- .centre-label {
731
- fill: var(--roxy-muted, #71717a);
732
- font-size: 14px;
733
- font-weight: 600;
734
- font-family: var(--roxy-font-sans);
735
- letter-spacing: 0.02em;
736
- }
737
- .lagna-marker {
738
- fill: var(--roxy-accent-fg, #b45309);
739
- font-size: 10px;
740
- font-weight: 700;
741
- font-family: var(--roxy-font-sans);
742
- letter-spacing: 0.08em;
743
- text-transform: uppercase;
744
- }
745
- .lagna-bg {
746
- fill: color-mix(in srgb, var(--roxy-accent, #f59e0b) 14%, transparent);
747
- }
748
- .lagna-slash {
749
- stroke: var(--roxy-accent, #f59e0b);
750
- stroke-linecap: round;
751
- opacity: 0.7;
752
- }
753
- `;
754
-
755
- // packages/ui/src/utils/markup-data.ts
756
- var ROXY_DATA_CLASS = "roxy-data";
757
- function isJsonScript(el) {
758
- return el.nodeName === "SCRIPT" && el.getAttribute("type") === "application/json";
759
- }
760
- var MarkupDataController = class {
761
- constructor(host) {
762
- this.host = host;
763
- host.addController(this);
764
- }
765
- hostConnected() {
766
- if (this.host.data != null) return;
767
- const parsed = this.read();
768
- if (parsed === void 0) return;
769
- this.host.data = parsed;
770
- this.host.requestUpdate();
771
- }
772
- /**
773
- * Resolve the embedded payload. Returns `undefined` when there is nothing valid to read so the caller can leave `host.data` untouched.
774
- */
775
- read() {
776
- const inline = this.findInlineScript();
777
- return inline ? this.parse(inline.textContent) : void 0;
778
- }
779
- /**
780
- * Direct-child `<script type="application/json" class="roxy-data">`. Scoped to immediate children so a nested data-driven component never has its script read by an ancestor, and so sibling fallback markup is ignored.
781
- */
782
- findInlineScript() {
783
- for (const child of Array.from(this.host.children)) {
784
- if (isJsonScript(child) && child.classList.contains(ROXY_DATA_CLASS)) {
785
- return child;
786
- }
787
- }
788
- return null;
789
- }
790
- parse(text) {
791
- if (!text?.trim()) return void 0;
792
- try {
793
- return JSON.parse(text);
794
- } catch {
795
- return void 0;
796
- }
797
- }
798
- };
799
-
800
- // packages/ui/src/components/vedic-kundli.ts
801
- var RoxyVedicKundli = class extends LitElement {
802
- constructor() {
803
- super();
804
- this.data = null;
805
- this.chartStyle = "north";
806
- this.setStyle = (next) => {
807
- this.chartStyle = next;
808
- };
809
- new MarkupDataController(this);
810
- }
811
- viewModel() {
812
- if (!this.data?.meta) return null;
813
- return toKundliViewModel(this.data.meta, "D1 Rashi");
814
- }
815
- render() {
816
- const vm = this.viewModel();
817
- if (!vm)
818
- return html2`<div class="roxy-empty" role="status">No kundli data</div>`;
819
- return html2`<div class="wrap">
820
- <div class="header">
821
- <h2 class="title">Vedic kundli</h2>
822
- ${renderKundliStyleTablist(this.chartStyle, this.setStyle)}
823
- </div>
824
- <svg
825
- viewBox="0 0 400 400"
826
- preserveAspectRatio="xMidYMid meet"
827
- role="img"
828
- aria-label="Vedic birth chart with twelve sign houses"
829
- >
830
- <title>Vedic kundli</title>
831
- ${renderKundliSvg(vm, this.chartStyle)}
832
- </svg>
833
- </div>`;
834
- }
835
- };
836
- RoxyVedicKundli.styles = [baseStyles, kundliStyles];
837
- __decorateClass([
838
- property({ attribute: false })
839
- ], RoxyVedicKundli.prototype, "data", 2);
840
- __decorateClass([
841
- property({ type: String, reflect: true, attribute: "chart-style" })
842
- ], RoxyVedicKundli.prototype, "chartStyle", 2);
843
- RoxyVedicKundli = __decorateClass([
844
- customElement("roxy-vedic-kundli")
845
- ], RoxyVedicKundli);
846
- export {
847
- RoxyVedicKundli
848
- };
1
+ var J=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var S=(e,t,r,o)=>{for(var n=o>1?void 0:o?W(t,r):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(n=(o?a(t,r,n):a(n))||n);return o&&n&&J(t,r,n),n};import{html as Y,LitElement as Rt}from"lit";import{customElement as kt,property as j}from"lit/decorators.js";import{css as X}from"lit";var I=X`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;import{nothing as m,svg as u}from"lit";var _={Sun:"Su",Moon:"Mo",Mercury:"Me",Venus:"Ve",Mars:"Ma",Jupiter:"Ju",Saturn:"Sa",Uranus:"Ur",Neptune:"Ne",Pluto:"Pl",Rahu:"Ra",Ketu:"Ke",Ascendant:"Asc",Lagna:"La"};var v={Aries:"Ar",Taurus:"Ta",Gemini:"Ge",Cancer:"Cn",Leo:"Le",Virgo:"Vi",Libra:"Li",Scorpio:"Sc",Sagittarius:"Sg",Capricorn:"Cp",Aquarius:"Aq",Pisces:"Pi"},g=["Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn","Aquarius","Pisces"],Et=g.map(e=>e.toLowerCase());function Z(e){let t=e%360;return t<0?t+360:t}function R(e){let t=Z(e),r=Math.floor(t/30)%12,o=t%30,n=Math.floor(o),i=(o-n)*60,a=Math.floor(i),y=Math.round((i-a)*60);return{sign:g[r]??"Aries",signIndex:r,degree:n,minute:a,second:y}}function C(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():""}import{css as Q,html as G,nothing as tt}from"lit";var O=Q`.roxy-tablist{border-bottom:2px solid var(--roxy-border,#e4e4e7);gap:2px;display:flex}.roxy-tab{padding:var(--roxy-space-xs,.25rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-sm,.875rem);cursor:pointer;color:var(--roxy-muted,#71717a);transition:color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);background:0 0;border:none;border-bottom:2px solid #0000;margin-bottom:-2px;font-family:inherit}.roxy-tab[aria-selected=true]{color:var(--roxy-accent-fg,#b45309);border-bottom-color:var(--roxy-accent,#f59e0b);font-weight:var(--roxy-weight-bold,600)}.roxy-tab:hover:not([aria-selected=true]){color:var(--roxy-fg,#0a0a0a)}.roxy-tab:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px;border-radius:4px}`;function H(e){let{items:t,active:r,onSelect:o,label:n,idPrefix:i,controls:a=!1}=e;return G`<div class="roxy-tablist" role="tablist" aria-label="${n}" @keydown="${l=>{if(l.key!=="ArrowRight"&&l.key!=="ArrowLeft")return;l.preventDefault();let $=t.findIndex(E=>E.id===r);if($===-1)return;let A=l.key==="ArrowRight"?1:-1,w=t[($+A+t.length)%t.length];if(!w)return;o(w.id);let L=l.currentTarget.getRootNode();requestAnimationFrame(()=>{L.querySelector(`#${i}-tab-${w.id}`)?.focus()})}}">${t.map(l=>G`<button type="button" class="roxy-tab" role="tab" id="${i}-tab-${l.id}" aria-selected="${r===l.id?"true":"false"}" aria-controls="${a&&r===l.id?`${i}-panel-${l.id}`:tt}" tabindex="${r===l.id?"0":"-1"}" @click="${()=>o(l.id)}">${l.label}</button>`)}</div>`}var h=400,c=20,x=h-2*c,d=h/2,et=Object.fromEntries(g.map(e=>[e.toLowerCase(),e])),rt=[{id:"north",label:"North"},{id:"south",label:"South"},{id:"east",label:"East"}],nt="\u02B3";function K(e,t){return typeof e.longitude!="number"||!Number.isFinite(e.longitude)?!1:R(e.longitude).sign.toLowerCase()!==t.toLowerCase()}function ot(e,t){let r=_[C(e.graha)]??e.graha.slice(0,2),o=e.isRetrograde?nt:"";if(typeof e.longitude!="number"||!Number.isFinite(e.longitude)||K(e,t))return`${r}${o}`;let{degree:n}=R(e.longitude);return`${r} ${n}\xB0${o}`}function it(e,t){let r=[C(e.graha)],o=K(e,t);if(o&&r.push(`in ${t}`),typeof e.longitude=="number"&&Number.isFinite(e.longitude)){let n=R(e.longitude),i=String(n.minute).padStart(2,"0");r.push(o?`D1: ${n.degree}\xB0${i}' ${n.sign}`:`${n.degree}\xB0${i}' ${n.sign}`)}if(e.nakshatra?.name){let n=e.nakshatra.pada?` pada ${e.nakshatra.pada}`:"";r.push(`${e.nakshatra.name}${n}`)}return e.awastha&&r.push(e.awastha),e.isRetrograde&&r.push("retrograde"),r.join(" \xB7 ")}function M(e,t,r,o,n){let i=o-(e.length-1)*n/2;return e.map((a,y)=>{let l=i+y*n;return u`<text class="planet-text" x="${r}" y="${l}" text-anchor="middle" dominant-baseline="central">${ot(a,t)}<title>${it(a,t)}</title></text>`})}function z(e,t){let r={};for(let n of g)r[n.toLowerCase()]=[];let o="";for(let[n,i]of Object.entries(e??{})){let a=(i?.rashi??"").toLowerCase();if(n==="Lagna"||i?.graha==="Lagna"){o=et[a]??"";continue}!a||!(a in r)||r[a]?.push({graha:i.graha??n,longitude:i.longitude,nakshatra:i.nakshatra,isRetrograde:i.isRetrograde,awastha:i.awastha})}return{lagnaSign:o,placements:r,divisionLabel:t}}var f=x/4,at={Pisces:{col:0,row:0},Aries:{col:1,row:0},Taurus:{col:2,row:0},Gemini:{col:3,row:0},Cancer:{col:3,row:1},Leo:{col:3,row:2},Virgo:{col:3,row:3},Libra:{col:2,row:3},Scorpio:{col:1,row:3},Sagittarius:{col:0,row:3},Capricorn:{col:0,row:2},Aquarius:{col:0,row:1}};function st(e){let t=at[e]??{col:0,row:0};return{x:c+t.col*f,y:c+t.row*f,w:f,h:f}}function lt(e){let t=c,r=c+f,o=c+2*f,n=c+3*f,i=h-c;return u`<rect class="line" x="${t}" y="${t}" width="${x}" height="${x}" stroke-width="1.5" fill="none"><line class="line" x1="${t}" y1="${r}" x2="${i}" y2="${r}" stroke-width="1"><line class="line" x1="${t}" y1="${n}" x2="${i}" y2="${n}" stroke-width="1"><line class="line" x1="${r}" y1="${t}" x2="${r}" y2="${i}" stroke-width="1"><line class="line" x1="${n}" y1="${t}" x2="${n}" y2="${i}" stroke-width="1"><line class="line" x1="${t}" y1="${o}" x2="${r}" y2="${o}" stroke-width="1"><line class="line" x1="${n}" y1="${o}" x2="${i}" y2="${o}" stroke-width="1"><line class="line" x1="${o}" y1="${t}" x2="${o}" y2="${r}" stroke-width="1"><line class="line" x1="${o}" y1="${n}" x2="${o}" y2="${i}" stroke-width="1">${e?u`<text class="centre-label" x="${d}" y="${d}" text-anchor="middle" dominant-baseline="central">${e}</text>`:m}`}function V(e,t){let r=g.findIndex(n=>n===t),o=g.findIndex(n=>n===e);return r===-1||o===-1?0:(o-r+12)%12+1}function ct(e,t,r,o){let n=st(e),i=n.x+n.w/2,a=n.y+n.h/2,y=v[e]??e.slice(0,2),l=14;return u`<g class="${r?"cell lagna":"cell"}">${r?u`<rect class="lagna-bg" x="${n.x}" y="${n.y}" width="${n.w}" height="${n.h}"><line class="lagna-slash" x1="${n.x+n.w-l}" y1="${n.y+l}" x2="${n.x+l}" y2="${n.y+n.h-l}" stroke-width="1.2">`:m}<text class="sign-text" x="${n.x+6}" y="${n.y+12}" text-anchor="start" dominant-baseline="central">${y}</text>${o>0?u`<text class="house-num" x="${n.x+n.w-6}" y="${n.y+12}" text-anchor="end" dominant-baseline="central">${o}</text>`:m} ${r?u`<text class="lagna-marker" x="${i}" y="${n.y+26}" text-anchor="middle" dominant-baseline="central">Asc</text>`:m} ${t.length?M(t,e,i,a+4,14):m}</g>`}function dt(e){let t=e.lagnaSign.toLowerCase();return u`${lt(e.divisionLabel)} ${g.map(r=>ct(r,e.placements[r.toLowerCase()]??[],r.toLowerCase()===t,V(r,e.lagnaSign)))}`}var s={tl:{x:c,y:c},tr:{x:h-c,y:c},br:{x:h-c,y:h-c},bl:{x:c,y:h-c},top:{x:d,y:c},right:{x:h-c,y:d},bottom:{x:d,y:h-c},left:{x:c,y:d},tlMid:{x:d-x/4,y:d-x/4},trMid:{x:d+x/4,y:d-x/4},brMid:{x:d+x/4,y:d+x/4},blMid:{x:d-x/4,y:d+x/4}};function p(e){let t=e.reduce((o,n)=>o+n.x,0)/e.length,r=e.reduce((o,n)=>o+n.y,0)/e.length;return{x:t,y:r}}var ut={1:{x:d,y:s.tlMid.y},2:p([s.tl,s.top,s.tlMid]),3:p([s.tl,s.left,s.tlMid]),4:{x:s.tlMid.x,y:d},5:p([s.bl,s.left,s.blMid]),6:p([s.bl,s.bottom,s.blMid]),7:{x:d,y:s.blMid.y},8:p([s.br,s.bottom,s.brMid]),9:p([s.br,s.right,s.brMid]),10:{x:s.brMid.x,y:d},11:p([s.tr,s.right,s.trMid]),12:p([s.tr,s.top,s.trMid])};function xt(e,t){let r=g.findIndex(o=>o===t);return r===-1?e:(r+e-1)%12+1}function yt(e){let{tl:t,tr:r,br:o,bl:n,top:i,right:a,bottom:y,left:l}=s;return u`<rect class="line" x="${t.x}" y="${t.y}" width="${x}" height="${x}" stroke-width="1.5" fill="none"><polygon class="line" points="${i.x},${i.y} ${a.x},${a.y} ${y.x},${y.y} ${l.x},${l.y}" stroke-width="1" fill="none"><line class="line" x1="${t.x}" y1="${t.y}" x2="${o.x}" y2="${o.y}" stroke-width="1"><line class="line" x1="${r.x}" y1="${r.y}" x2="${n.x}" y2="${n.y}" stroke-width="1">${e?u`<text class="centre-label" x="${d}" y="${d}" text-anchor="middle" dominant-baseline="central">${e}</text>`:m}`}function mt(e,t,r,o,n){let i=ut[e];if(!i)return u``;let a=Math.min(14,Math.abs(i.y-d)*.45+6),y=a+12,l=n?`${t} \xB7 ${v[r]??r.slice(0,2)}`:`${t}`;return u`<g class="${n?"cell lagna":"cell"}"><text class="rashi-num" x="${i.x}" y="${i.y-a}" text-anchor="middle" dominant-baseline="central">${l}</text>${n?u`<text class="lagna-marker" x="${i.x}" y="${i.y-y}" text-anchor="middle" dominant-baseline="central">Asc</text>`:m} ${o.length?M(o,r,i.x,i.y+8,12):m}</g>`}function gt(e){let t=e.lagnaSign||"Aries";return u`${yt(e.divisionLabel)} ${Array.from({length:12},(r,o)=>{let n=o+1,i=xt(n,t),a=g[i-1]??"Aries";return mt(n,i,a,e.placements[a.toLowerCase()]??[],n===1)})}`}var k=x/3;function ht(){let e=c,t=c+k,r=c+2*k,o=h-c,F={Aries:[{x:t,y:e},{x:r,y:e},{x:r,y:t},{x:t,y:t}],Taurus:[{x:e,y:e},{x:t,y:e},{x:t,y:t}],Gemini:[{x:e,y:e},{x:t,y:t},{x:e,y:t}],Cancer:[{x:e,y:t},{x:t,y:t},{x:t,y:r},{x:e,y:r}],Leo:[{x:e,y:r},{x:t,y:r},{x:e,y:o}],Virgo:[{x:t,y:r},{x:t,y:o},{x:e,y:o}],Libra:[{x:t,y:r},{x:r,y:r},{x:r,y:o},{x:t,y:o}],Scorpio:[{x:r,y:r},{x:r,y:o},{x:o,y:o}],Sagittarius:[{x:r,y:r},{x:o,y:o},{x:o,y:r}],Capricorn:[{x:r,y:t},{x:o,y:t},{x:o,y:r},{x:r,y:r}],Aquarius:[{x:o,y:e},{x:o,y:t},{x:r,y:t}],Pisces:[{x:r,y:e},{x:o,y:e},{x:r,y:t}]},P={};for(let[U,N]of Object.entries(F))P[U]={points:[...N],centroid:p(N)};return P}var pt=ht();function ft(e){let t=c,r=c+k,o=c+2*k,n=h-c;return u`<rect class="line" x="${t}" y="${t}" width="${x}" height="${x}" stroke-width="1.5" fill="none"><line class="line" x1="${t}" y1="${r}" x2="${r}" y2="${r}" stroke-width="1"><line class="line" x1="${o}" y1="${r}" x2="${n}" y2="${r}" stroke-width="1"><line class="line" x1="${t}" y1="${o}" x2="${r}" y2="${o}" stroke-width="1"><line class="line" x1="${o}" y1="${o}" x2="${n}" y2="${o}" stroke-width="1"><line class="line" x1="${r}" y1="${t}" x2="${r}" y2="${r}" stroke-width="1"><line class="line" x1="${r}" y1="${o}" x2="${r}" y2="${n}" stroke-width="1"><line class="line" x1="${o}" y1="${t}" x2="${o}" y2="${r}" stroke-width="1"><line class="line" x1="${o}" y1="${o}" x2="${o}" y2="${n}" stroke-width="1"><line class="line" x1="${t}" y1="${t}" x2="${r}" y2="${r}" stroke-width="1"><line class="line" x1="${n}" y1="${t}" x2="${o}" y2="${r}" stroke-width="1"><line class="line" x1="${n}" y1="${n}" x2="${o}" y2="${o}" stroke-width="1"><line class="line" x1="${t}" y1="${n}" x2="${r}" y2="${o}" stroke-width="1">${e?u`<text class="centre-label" x="${d}" y="${d}" text-anchor="middle" dominant-baseline="central">${e}</text>`:m}`}function bt(e,t,r,o){let n=pt[e];if(!n)return u``;let{centroid:i,points:a}=n,y=v[e]??e.slice(0,2),l=a.map($=>`${$.x},${$.y}`).join(" ");return u`<g class="${r?"cell lagna":"cell"}">${r?u`<polygon class="lagna-bg" points="${l}">`:m}<text class="sign-text" x="${i.x}" y="${i.y-16}" text-anchor="middle" dominant-baseline="central">${y}</text>${o>0?u`<text class="house-num" x="${i.x+18}" y="${i.y-16}" text-anchor="start" dominant-baseline="central">${o}</text>`:m} ${r?u`<text class="lagna-marker" x="${i.x}" y="${i.y-30}" text-anchor="middle" dominant-baseline="central">Asc</text>`:m} ${t.length?M(t,e,i.x,i.y+4,12):m}</g>`}function $t(e){let t=e.lagnaSign.toLowerCase();return u`${ft(e.divisionLabel)} ${g.map(r=>bt(r,e.placements[r.toLowerCase()]??[],r.toLowerCase()===t,V(r,e.lagnaSign)))}`}function B(e,t){switch(t){case"north":return gt(e);case"east":return $t(e);default:return dt(e)}}function D(e,t){return H({items:rt,active:e,onSelect:t,label:"Kundli style",idPrefix:"kundli"})}import{css as wt}from"lit";var q=wt`.wrap{gap:var(--roxy-space-md,1rem);display:grid}.header{justify-content:space-between;align-items:center;gap:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}svg{aspect-ratio:1;width:100%;max-width:560px;height:auto;margin:0 auto;display:block}.line{fill:#0000;stroke:var(--roxy-border,#d4d4d8)}.sign-text{fill:var(--roxy-muted,#71717a);font-size:11px;font-weight:500;font-family:var(--roxy-font-sans);text-transform:uppercase;letter-spacing:.04em}.rashi-num{fill:var(--roxy-muted,#71717a);font-size:12px;font-weight:500;font-family:var(--roxy-font-sans)}.house-num{fill:var(--roxy-accent-fg,#b45309);font-size:11px;font-weight:600;font-family:var(--roxy-font-sans);opacity:.85}.planet-text{fill:var(--roxy-fg,#0a0a0a);font-size:13px;font-weight:600;font-family:var(--roxy-font-sans)}.centre-label{fill:var(--roxy-muted,#71717a);font-size:14px;font-weight:600;font-family:var(--roxy-font-sans);letter-spacing:.02em}.lagna-marker{fill:var(--roxy-accent-fg,#b45309);font-size:10px;font-weight:700;font-family:var(--roxy-font-sans);letter-spacing:.08em;text-transform:uppercase}.lagna-bg{fill:color-mix(in srgb, var(--roxy-accent,#f59e0b) 14%, transparent)}.lagna-slash{stroke:var(--roxy-accent,#f59e0b);stroke-linecap:round;opacity:.7}`;var St="roxy-data";function vt(e){return e.nodeName==="SCRIPT"&&e.getAttribute("type")==="application/json"}var T=class{constructor(t){this.host=t,t.addController(this)}hostConnected(){if(this.host.data!=null)return;let t=this.read();t!==void 0&&(this.host.data=t,this.host.requestUpdate())}read(){let t=this.findInlineScript();return t?this.parse(t.textContent):void 0}findInlineScript(){for(let t of Array.from(this.host.children))if(vt(t)&&t.classList.contains(St))return t;return null}parse(t){if(t?.trim())try{return JSON.parse(t)}catch{return}}};var b=class extends Rt{constructor(){super();this.data=null;this.chartStyle="north";this.setStyle=r=>{this.chartStyle=r};new T(this)}viewModel(){return this.data?.meta?z(this.data.meta,"D1 Rashi"):null}render(){let r=this.viewModel();return r?Y`<div class="wrap"><div class="header"><h2 class="title">Vedic kundli</h2>${D(this.chartStyle,this.setStyle)}</div><svg viewBox="0 0 400 400" preserveAspectRatio="xMidYMid meet" role="img" aria-label="Vedic birth chart with twelve sign houses"><title>Vedic kundli</title>${B(r,this.chartStyle)}</svg></div>`:Y`<div class="roxy-empty" role="status">No kundli data</div>`}};b.styles=[I,q,O],S([j({attribute:!1})],b.prototype,"data",2),S([j({type:String,reflect:!0,attribute:"chart-style"})],b.prototype,"chartStyle",2),b=S([kt("roxy-vedic-kundli")],b);export{b as RoxyVedicKundli};
849
2
  //# sourceMappingURL=vedic-kundli.js.map