@roxyapi/ui 0.0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +169 -0
- package/THEMING.md +129 -0
- package/dist/cdn/components/biorhythm-chart.js +261 -0
- package/dist/cdn/components/biorhythm-chart.js.map +7 -0
- package/dist/cdn/components/compatibility-card.js +257 -0
- package/dist/cdn/components/compatibility-card.js.map +7 -0
- package/dist/cdn/components/dasha-timeline.js +244 -0
- package/dist/cdn/components/dasha-timeline.js.map +7 -0
- package/dist/cdn/components/data.js +258 -0
- package/dist/cdn/components/data.js.map +7 -0
- package/dist/cdn/components/dosha-card.js +254 -0
- package/dist/cdn/components/dosha-card.js.map +7 -0
- package/dist/cdn/components/endpoint-form.js +253 -0
- package/dist/cdn/components/endpoint-form.js.map +7 -0
- package/dist/cdn/components/guna-milan.js +256 -0
- package/dist/cdn/components/guna-milan.js.map +7 -0
- package/dist/cdn/components/hexagram.js +275 -0
- package/dist/cdn/components/hexagram.js.map +7 -0
- package/dist/cdn/components/horoscope-card.js +302 -0
- package/dist/cdn/components/horoscope-card.js.map +7 -0
- package/dist/cdn/components/kp-planets-table.js +224 -0
- package/dist/cdn/components/kp-planets-table.js.map +7 -0
- package/dist/cdn/components/location-search.js +267 -0
- package/dist/cdn/components/location-search.js.map +7 -0
- package/dist/cdn/components/moon-phase.js +251 -0
- package/dist/cdn/components/moon-phase.js.map +7 -0
- package/dist/cdn/components/natal-chart.js +237 -0
- package/dist/cdn/components/natal-chart.js.map +7 -0
- package/dist/cdn/components/numerology-card.js +252 -0
- package/dist/cdn/components/numerology-card.js.map +7 -0
- package/dist/cdn/components/panchang-table.js +234 -0
- package/dist/cdn/components/panchang-table.js.map +7 -0
- package/dist/cdn/components/synastry-chart.js +303 -0
- package/dist/cdn/components/synastry-chart.js.map +7 -0
- package/dist/cdn/components/tarot-card.js +260 -0
- package/dist/cdn/components/tarot-card.js.map +7 -0
- package/dist/cdn/components/tarot-spread.js +261 -0
- package/dist/cdn/components/tarot-spread.js.map +7 -0
- package/dist/cdn/components/vedic-kundli.js +189 -0
- package/dist/cdn/components/vedic-kundli.js.map +7 -0
- package/dist/cdn/roxy-ui.js +2552 -0
- package/dist/cdn/roxy-ui.js.map +7 -0
- package/dist/cdn/widgets.js +114 -0
- package/dist/components/biorhythm-chart.d.ts +66 -0
- package/dist/components/biorhythm-chart.d.ts.map +1 -0
- package/dist/components/biorhythm-chart.js +318 -0
- package/dist/components/biorhythm-chart.js.map +7 -0
- package/dist/components/compatibility-card.d.ts +46 -0
- package/dist/components/compatibility-card.d.ts.map +1 -0
- package/dist/components/compatibility-card.js +279 -0
- package/dist/components/compatibility-card.js.map +7 -0
- package/dist/components/dasha-timeline.d.ts +53 -0
- package/dist/components/dasha-timeline.d.ts.map +1 -0
- package/dist/components/dasha-timeline.js +269 -0
- package/dist/components/dasha-timeline.js.map +7 -0
- package/dist/components/data.d.ts +40 -0
- package/dist/components/data.d.ts.map +1 -0
- package/dist/components/data.js +339 -0
- package/dist/components/data.js.map +7 -0
- package/dist/components/dosha-card.d.ts +35 -0
- package/dist/components/dosha-card.d.ts.map +1 -0
- package/dist/components/dosha-card.js +278 -0
- package/dist/components/dosha-card.js.map +7 -0
- package/dist/components/endpoint-form.d.ts +39 -0
- package/dist/components/endpoint-form.d.ts.map +1 -0
- package/dist/components/endpoint-form.js +432 -0
- package/dist/components/endpoint-form.js.map +7 -0
- package/dist/components/guna-milan.d.ts +35 -0
- package/dist/components/guna-milan.d.ts.map +1 -0
- package/dist/components/guna-milan.js +302 -0
- package/dist/components/guna-milan.js.map +7 -0
- package/dist/components/hexagram.d.ts +47 -0
- package/dist/components/hexagram.d.ts.map +1 -0
- package/dist/components/hexagram.js +334 -0
- package/dist/components/hexagram.js.map +7 -0
- package/dist/components/horoscope-card.d.ts +38 -0
- package/dist/components/horoscope-card.d.ts.map +1 -0
- package/dist/components/horoscope-card.js +332 -0
- package/dist/components/horoscope-card.js.map +7 -0
- package/dist/components/kp-planets-table.d.ts +36 -0
- package/dist/components/kp-planets-table.d.ts.map +1 -0
- package/dist/components/kp-planets-table.js +227 -0
- package/dist/components/kp-planets-table.js.map +7 -0
- package/dist/components/location-search.d.ts +56 -0
- package/dist/components/location-search.d.ts.map +1 -0
- package/dist/components/location-search.js +401 -0
- package/dist/components/location-search.js.map +7 -0
- package/dist/components/moon-phase.d.ts +38 -0
- package/dist/components/moon-phase.d.ts.map +1 -0
- package/dist/components/moon-phase.js +284 -0
- package/dist/components/moon-phase.js.map +7 -0
- package/dist/components/natal-chart.d.ts +65 -0
- package/dist/components/natal-chart.d.ts.map +1 -0
- package/dist/components/natal-chart.js +407 -0
- package/dist/components/natal-chart.js.map +7 -0
- package/dist/components/numerology-card.d.ts +55 -0
- package/dist/components/numerology-card.d.ts.map +1 -0
- package/dist/components/numerology-card.js +274 -0
- package/dist/components/numerology-card.js.map +7 -0
- package/dist/components/panchang-table.d.ts +77 -0
- package/dist/components/panchang-table.d.ts.map +1 -0
- package/dist/components/panchang-table.js +285 -0
- package/dist/components/panchang-table.js.map +7 -0
- package/dist/components/synastry-chart.d.ts +52 -0
- package/dist/components/synastry-chart.d.ts.map +1 -0
- package/dist/components/synastry-chart.js +415 -0
- package/dist/components/synastry-chart.js.map +7 -0
- package/dist/components/tarot-card.d.ts +47 -0
- package/dist/components/tarot-card.d.ts.map +1 -0
- package/dist/components/tarot-card.js +281 -0
- package/dist/components/tarot-card.js.map +7 -0
- package/dist/components/tarot-spread.d.ts +42 -0
- package/dist/components/tarot-spread.d.ts.map +1 -0
- package/dist/components/tarot-spread.js +271 -0
- package/dist/components/tarot-spread.js.map +7 -0
- package/dist/components/vedic-kundli.d.ts +45 -0
- package/dist/components/vedic-kundli.d.ts.map +1 -0
- package/dist/components/vedic-kundli.js +325 -0
- package/dist/components/vedic-kundli.js.map +7 -0
- package/dist/index.cjs +4174 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4154 -0
- package/dist/index.js.map +7 -0
- package/dist/manifest.json +24 -0
- package/dist/styles/tokens.css +147 -0
- package/dist/tokens/index.d.ts +17 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/utils/base-styles.d.ts +6 -0
- package/dist/utils/base-styles.d.ts.map +1 -0
- package/dist/utils/debounce.d.ts +5 -0
- package/dist/utils/debounce.d.ts.map +1 -0
- package/dist/utils/degree.d.ts +29 -0
- package/dist/utils/degree.d.ts.map +1 -0
- package/dist/utils/motion.d.ts +13 -0
- package/dist/utils/motion.d.ts.map +1 -0
- package/package.json +69 -3
- package/src/components/biorhythm-chart.ts +290 -0
- package/src/components/compatibility-card.ts +231 -0
- package/src/components/dasha-timeline.ts +251 -0
- package/src/components/data.ts +287 -0
- package/src/components/dosha-card.ts +215 -0
- package/src/components/endpoint-form.ts +433 -0
- package/src/components/guna-milan.ts +245 -0
- package/src/components/hexagram.ts +279 -0
- package/src/components/horoscope-card.ts +291 -0
- package/src/components/kp-planets-table.ts +156 -0
- package/src/components/location-search.ts +335 -0
- package/src/components/moon-phase.ts +221 -0
- package/src/components/natal-chart.ts +298 -0
- package/src/components/numerology-card.ts +243 -0
- package/src/components/panchang-table.ts +265 -0
- package/src/components/synastry-chart.ts +341 -0
- package/src/components/tarot-card.ts +235 -0
- package/src/components/tarot-spread.ts +224 -0
- package/src/components/vedic-kundli.ts +257 -0
- package/src/index.ts +61 -0
- package/src/styles/tokens.css +147 -0
- package/src/tokens/index.ts +130 -0
- package/src/types/index.ts +3 -0
- package/src/types/types.gen.ts +28526 -0
- package/src/utils/base-styles.ts +89 -0
- package/src/utils/debounce.ts +13 -0
- package/src/utils/degree.ts +64 -0
- package/src/utils/motion.ts +18 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { baseStyles } from '../utils/base-styles.js';
|
|
4
|
+
|
|
5
|
+
interface PanchangTime {
|
|
6
|
+
start?: string;
|
|
7
|
+
end?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface PanchangData {
|
|
11
|
+
date?: string;
|
|
12
|
+
location?: { name?: string; latitude?: number; longitude?: number };
|
|
13
|
+
vara?: string;
|
|
14
|
+
sunrise?: string;
|
|
15
|
+
sunset?: string;
|
|
16
|
+
moonrise?: string;
|
|
17
|
+
moonset?: string;
|
|
18
|
+
sunSign?: string;
|
|
19
|
+
moonSign?: string;
|
|
20
|
+
sunNakshatra?: string;
|
|
21
|
+
tithi?: string | { name?: string; phase?: string; end?: string };
|
|
22
|
+
nakshatra?: string | { name?: string; lord?: string; end?: string };
|
|
23
|
+
yoga?: string | { name?: string; end?: string };
|
|
24
|
+
karana?: string | { name?: string; end?: string };
|
|
25
|
+
hora?: string;
|
|
26
|
+
rahuKaal?: PanchangTime;
|
|
27
|
+
yamaganda?: PanchangTime;
|
|
28
|
+
gulika?: PanchangTime;
|
|
29
|
+
abhijitMuhurta?: PanchangTime;
|
|
30
|
+
brahmaMuhurta?: PanchangTime;
|
|
31
|
+
vijayaMuhurta?: PanchangTime;
|
|
32
|
+
nishitaMuhurta?: PanchangTime;
|
|
33
|
+
godhuliMuhurta?: PanchangTime;
|
|
34
|
+
pratahSandhya?: PanchangTime;
|
|
35
|
+
sayahnaSandhya?: PanchangTime;
|
|
36
|
+
durMuhurta?: PanchangTime[];
|
|
37
|
+
varjyam?: PanchangTime[];
|
|
38
|
+
amritKalam?: PanchangTime[];
|
|
39
|
+
chandrabalam?: string | string[];
|
|
40
|
+
tarabalam?: string;
|
|
41
|
+
panchaka?: string;
|
|
42
|
+
bhadra?: string;
|
|
43
|
+
sunLongitude?: number;
|
|
44
|
+
moonLongitude?: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Panchang table for /vedic-astrology/panchang/{basic,detailed}. Detailed mode
|
|
49
|
+
* renders 15+ muhurtas. Basic mode renders the five elements only.
|
|
50
|
+
*/
|
|
51
|
+
@customElement('roxy-panchang-table')
|
|
52
|
+
export class RoxyPanchangTable extends LitElement {
|
|
53
|
+
static styles = [
|
|
54
|
+
baseStyles,
|
|
55
|
+
css`
|
|
56
|
+
.wrap {
|
|
57
|
+
border: 1px solid var(--roxy-border, #e4e4e7);
|
|
58
|
+
border-radius: var(--roxy-radius-md, 8px);
|
|
59
|
+
background: var(--roxy-bg, #fff);
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
box-shadow: var(--roxy-shadow-sm);
|
|
62
|
+
}
|
|
63
|
+
.head {
|
|
64
|
+
padding: var(--roxy-space-md, 1rem);
|
|
65
|
+
border-bottom: 1px solid var(--roxy-border, #e4e4e7);
|
|
66
|
+
display: flex;
|
|
67
|
+
justify-content: space-between;
|
|
68
|
+
flex-wrap: wrap;
|
|
69
|
+
gap: var(--roxy-space-sm, 0.5rem);
|
|
70
|
+
}
|
|
71
|
+
.title {
|
|
72
|
+
margin: 0;
|
|
73
|
+
font-size: var(--roxy-text-lg, 1.125rem);
|
|
74
|
+
font-weight: var(--roxy-weight-bold, 600);
|
|
75
|
+
}
|
|
76
|
+
.date {
|
|
77
|
+
color: var(--roxy-muted, #71717a);
|
|
78
|
+
font-size: var(--roxy-text-sm, 0.875rem);
|
|
79
|
+
}
|
|
80
|
+
table {
|
|
81
|
+
width: 100%;
|
|
82
|
+
border-collapse: collapse;
|
|
83
|
+
font-size: var(--roxy-text-sm, 0.875rem);
|
|
84
|
+
}
|
|
85
|
+
tbody tr:nth-child(odd) {
|
|
86
|
+
background: color-mix(in srgb, var(--roxy-border, #e4e4e7) 24%, transparent);
|
|
87
|
+
}
|
|
88
|
+
th,
|
|
89
|
+
td {
|
|
90
|
+
padding: var(--roxy-space-sm, 0.5rem) var(--roxy-space-md, 1rem);
|
|
91
|
+
text-align: left;
|
|
92
|
+
vertical-align: top;
|
|
93
|
+
}
|
|
94
|
+
th {
|
|
95
|
+
color: var(--roxy-muted, #71717a);
|
|
96
|
+
font-weight: var(--roxy-weight-bold, 600);
|
|
97
|
+
width: 38%;
|
|
98
|
+
text-transform: capitalize;
|
|
99
|
+
}
|
|
100
|
+
td {
|
|
101
|
+
color: var(--roxy-fg, #0a0a0a);
|
|
102
|
+
font-variant-numeric: tabular-nums;
|
|
103
|
+
}
|
|
104
|
+
.section {
|
|
105
|
+
border-top: 1px solid var(--roxy-border, #e4e4e7);
|
|
106
|
+
padding: var(--roxy-space-sm, 0.5rem) var(--roxy-space-md, 1rem);
|
|
107
|
+
font-size: var(--roxy-text-xs, 0.75rem);
|
|
108
|
+
color: var(--roxy-muted, #71717a);
|
|
109
|
+
font-weight: var(--roxy-weight-bold, 600);
|
|
110
|
+
text-transform: uppercase;
|
|
111
|
+
letter-spacing: 0.06em;
|
|
112
|
+
}
|
|
113
|
+
`,
|
|
114
|
+
];
|
|
115
|
+
|
|
116
|
+
@property({ attribute: false })
|
|
117
|
+
data: PanchangData | null = null;
|
|
118
|
+
|
|
119
|
+
@property({ type: String, reflect: true })
|
|
120
|
+
detail: 'basic' | 'detailed' = 'detailed';
|
|
121
|
+
|
|
122
|
+
render() {
|
|
123
|
+
const d = this.data;
|
|
124
|
+
if (!d)
|
|
125
|
+
return html`<div class="roxy-empty" role="status">No panchang data</div>`;
|
|
126
|
+
|
|
127
|
+
const fivefold = [
|
|
128
|
+
['Tithi', this.formatPart(d.tithi)],
|
|
129
|
+
['Nakshatra', this.formatPart(d.nakshatra)],
|
|
130
|
+
['Yoga', this.formatPart(d.yoga)],
|
|
131
|
+
['Karana', this.formatPart(d.karana)],
|
|
132
|
+
['Vara', d.vara ?? ''],
|
|
133
|
+
];
|
|
134
|
+
|
|
135
|
+
const muhurtas: Array<[string, PanchangTime | undefined]> = [
|
|
136
|
+
['Brahma Muhurta', d.brahmaMuhurta],
|
|
137
|
+
['Abhijit Muhurta', d.abhijitMuhurta],
|
|
138
|
+
['Vijaya Muhurta', d.vijayaMuhurta],
|
|
139
|
+
['Godhuli Muhurta', d.godhuliMuhurta],
|
|
140
|
+
['Nishita Muhurta', d.nishitaMuhurta],
|
|
141
|
+
['Pratah Sandhya', d.pratahSandhya],
|
|
142
|
+
['Sayahna Sandhya', d.sayahnaSandhya],
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
const inauspicious: Array<[string, PanchangTime | undefined]> = [
|
|
146
|
+
['Rahu Kaal', d.rahuKaal],
|
|
147
|
+
['Yamaganda', d.yamaganda],
|
|
148
|
+
['Gulika', d.gulika],
|
|
149
|
+
];
|
|
150
|
+
|
|
151
|
+
return html`<div class="wrap" aria-label="Panchang">
|
|
152
|
+
<header class="head">
|
|
153
|
+
<h2 class="title">Panchang</h2>
|
|
154
|
+
<span class="date">${d.date ?? ''}</span>
|
|
155
|
+
</header>
|
|
156
|
+
<table>
|
|
157
|
+
<tbody>
|
|
158
|
+
${fivefold.map(
|
|
159
|
+
([k, v]) => html`<tr>
|
|
160
|
+
<th>${k}</th>
|
|
161
|
+
<td>${v}</td>
|
|
162
|
+
</tr>`,
|
|
163
|
+
)}
|
|
164
|
+
${
|
|
165
|
+
d.sunrise
|
|
166
|
+
? html`<tr>
|
|
167
|
+
<th>Sunrise</th>
|
|
168
|
+
<td>${d.sunrise}</td>
|
|
169
|
+
</tr>`
|
|
170
|
+
: nothing
|
|
171
|
+
}
|
|
172
|
+
${
|
|
173
|
+
d.sunset
|
|
174
|
+
? html`<tr>
|
|
175
|
+
<th>Sunset</th>
|
|
176
|
+
<td>${d.sunset}</td>
|
|
177
|
+
</tr>`
|
|
178
|
+
: nothing
|
|
179
|
+
}
|
|
180
|
+
${
|
|
181
|
+
d.moonrise
|
|
182
|
+
? html`<tr>
|
|
183
|
+
<th>Moonrise</th>
|
|
184
|
+
<td>${d.moonrise}</td>
|
|
185
|
+
</tr>`
|
|
186
|
+
: nothing
|
|
187
|
+
}
|
|
188
|
+
${
|
|
189
|
+
d.moonset
|
|
190
|
+
? html`<tr>
|
|
191
|
+
<th>Moonset</th>
|
|
192
|
+
<td>${d.moonset}</td>
|
|
193
|
+
</tr>`
|
|
194
|
+
: nothing
|
|
195
|
+
}
|
|
196
|
+
</tbody>
|
|
197
|
+
</table>
|
|
198
|
+
${
|
|
199
|
+
this.detail === 'detailed' &&
|
|
200
|
+
(muhurtas.some((m) => !!m[1]) || inauspicious.some((m) => !!m[1]))
|
|
201
|
+
? html`
|
|
202
|
+
<div class="section">Auspicious muhurtas</div>
|
|
203
|
+
<table>
|
|
204
|
+
<tbody>
|
|
205
|
+
${muhurtas
|
|
206
|
+
.filter(([, v]) => !!v)
|
|
207
|
+
.map(
|
|
208
|
+
([k, v]) => html`<tr>
|
|
209
|
+
<th>${k}</th>
|
|
210
|
+
<td>${formatRange(v)}</td>
|
|
211
|
+
</tr>`,
|
|
212
|
+
)}
|
|
213
|
+
</tbody>
|
|
214
|
+
</table>
|
|
215
|
+
<div class="section">Inauspicious periods</div>
|
|
216
|
+
<table>
|
|
217
|
+
<tbody>
|
|
218
|
+
${inauspicious
|
|
219
|
+
.filter(([, v]) => !!v)
|
|
220
|
+
.map(
|
|
221
|
+
([k, v]) => html`<tr>
|
|
222
|
+
<th>${k}</th>
|
|
223
|
+
<td>${formatRange(v)}</td>
|
|
224
|
+
</tr>`,
|
|
225
|
+
)}
|
|
226
|
+
</tbody>
|
|
227
|
+
</table>
|
|
228
|
+
`
|
|
229
|
+
: nothing
|
|
230
|
+
}
|
|
231
|
+
</div>`;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
private formatPart(v: unknown): string {
|
|
235
|
+
if (!v) return '';
|
|
236
|
+
if (typeof v === 'string') return v;
|
|
237
|
+
if (typeof v === 'object') {
|
|
238
|
+
const obj = v as {
|
|
239
|
+
name?: string;
|
|
240
|
+
lord?: string;
|
|
241
|
+
phase?: string;
|
|
242
|
+
end?: string;
|
|
243
|
+
};
|
|
244
|
+
const parts = [
|
|
245
|
+
obj.name,
|
|
246
|
+
obj.lord ? `(${obj.lord})` : '',
|
|
247
|
+
obj.phase,
|
|
248
|
+
].filter(Boolean);
|
|
249
|
+
return parts.join(' ');
|
|
250
|
+
}
|
|
251
|
+
return String(v);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function formatRange(t: PanchangTime | undefined): string {
|
|
256
|
+
if (!t) return '';
|
|
257
|
+
if (t.start && t.end) return `${t.start} - ${t.end}`;
|
|
258
|
+
return t.start ?? t.end ?? '';
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
declare global {
|
|
262
|
+
interface HTMLElementTagNameMap {
|
|
263
|
+
'roxy-panchang-table': RoxyPanchangTable;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { css, html, LitElement, nothing, svg } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { PLANET_GLYPH, SIGN_GLYPH } from '../tokens/index.js';
|
|
4
|
+
import { baseStyles } from '../utils/base-styles.js';
|
|
5
|
+
import { polarToCartesian } from '../utils/degree.js';
|
|
6
|
+
|
|
7
|
+
interface PlanetEntry {
|
|
8
|
+
name?: string;
|
|
9
|
+
planet?: string;
|
|
10
|
+
longitude?: number;
|
|
11
|
+
degree?: number;
|
|
12
|
+
sign?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface InterAspect {
|
|
16
|
+
planet1?: string;
|
|
17
|
+
planet2?: string;
|
|
18
|
+
aspect?: string;
|
|
19
|
+
orb?: number;
|
|
20
|
+
strength?: string;
|
|
21
|
+
interpretation?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface SynastryData {
|
|
25
|
+
person1?: {
|
|
26
|
+
planets?: PlanetEntry[] | Record<string, PlanetEntry>;
|
|
27
|
+
name?: string;
|
|
28
|
+
};
|
|
29
|
+
person2?: {
|
|
30
|
+
planets?: PlanetEntry[] | Record<string, PlanetEntry>;
|
|
31
|
+
name?: string;
|
|
32
|
+
};
|
|
33
|
+
compatibilityScore?: number;
|
|
34
|
+
summary?: string;
|
|
35
|
+
interAspects?: InterAspect[];
|
|
36
|
+
strengths?: string[];
|
|
37
|
+
challenges?: string[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const SIZE = 360;
|
|
41
|
+
const CENTER = SIZE / 2;
|
|
42
|
+
const OUTER_R = 170;
|
|
43
|
+
const SIGN_R = 154;
|
|
44
|
+
const P1_R = 124;
|
|
45
|
+
const P2_R = 96;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Dual-wheel synastry chart with inter-aspects table. Pass `data` from
|
|
49
|
+
* /astrology/synastry.
|
|
50
|
+
*/
|
|
51
|
+
@customElement('roxy-synastry-chart')
|
|
52
|
+
export class RoxySynastryChart extends LitElement {
|
|
53
|
+
static styles = [
|
|
54
|
+
baseStyles,
|
|
55
|
+
css`
|
|
56
|
+
.wrap {
|
|
57
|
+
display: grid;
|
|
58
|
+
gap: var(--roxy-space-md, 1rem);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.head {
|
|
62
|
+
display: flex;
|
|
63
|
+
justify-content: space-between;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: var(--roxy-space-md, 1rem);
|
|
66
|
+
flex-wrap: wrap;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.title {
|
|
70
|
+
font-size: var(--roxy-text-lg, 1.125rem);
|
|
71
|
+
font-weight: var(--roxy-weight-bold, 600);
|
|
72
|
+
margin: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.score {
|
|
76
|
+
font-variant-numeric: tabular-nums;
|
|
77
|
+
font-weight: var(--roxy-weight-bold, 600);
|
|
78
|
+
color: var(--roxy-accent-fg, #b45309);
|
|
79
|
+
font-size: var(--roxy-text-xl, 1.5rem);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
svg {
|
|
83
|
+
display: block;
|
|
84
|
+
width: 100%;
|
|
85
|
+
max-width: 400px;
|
|
86
|
+
margin: 0 auto;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.wheel-line {
|
|
90
|
+
fill: none;
|
|
91
|
+
stroke: var(--roxy-border, #e4e4e7);
|
|
92
|
+
}
|
|
93
|
+
.sign {
|
|
94
|
+
fill: var(--roxy-secondary, #475569);
|
|
95
|
+
font-size: 14px;
|
|
96
|
+
}
|
|
97
|
+
.p1 {
|
|
98
|
+
fill: var(--roxy-accent, #f59e0b);
|
|
99
|
+
font-weight: 600;
|
|
100
|
+
font-size: 13px;
|
|
101
|
+
}
|
|
102
|
+
.p2 {
|
|
103
|
+
fill: var(--roxy-info, #0284c7);
|
|
104
|
+
font-weight: 600;
|
|
105
|
+
font-size: 13px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.summary {
|
|
109
|
+
margin: 0;
|
|
110
|
+
color: var(--roxy-fg, #0a0a0a);
|
|
111
|
+
font-size: var(--roxy-text-base, 1rem);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
table {
|
|
115
|
+
width: 100%;
|
|
116
|
+
border-collapse: collapse;
|
|
117
|
+
font-size: var(--roxy-text-sm, 0.875rem);
|
|
118
|
+
}
|
|
119
|
+
th,
|
|
120
|
+
td {
|
|
121
|
+
padding: var(--roxy-space-sm, 0.5rem);
|
|
122
|
+
border-bottom: 1px solid var(--roxy-border, #e4e4e7);
|
|
123
|
+
text-align: left;
|
|
124
|
+
}
|
|
125
|
+
th {
|
|
126
|
+
color: var(--roxy-muted, #71717a);
|
|
127
|
+
font-weight: var(--roxy-weight-bold, 600);
|
|
128
|
+
text-transform: uppercase;
|
|
129
|
+
font-size: var(--roxy-text-xs, 0.75rem);
|
|
130
|
+
letter-spacing: 0.06em;
|
|
131
|
+
}
|
|
132
|
+
td.orb {
|
|
133
|
+
font-variant-numeric: tabular-nums;
|
|
134
|
+
color: var(--roxy-muted, #71717a);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.lists {
|
|
138
|
+
display: grid;
|
|
139
|
+
grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
|
|
140
|
+
gap: var(--roxy-space-md, 1rem);
|
|
141
|
+
}
|
|
142
|
+
.lists h3 {
|
|
143
|
+
margin: 0 0 var(--roxy-space-xs, 0.25rem) 0;
|
|
144
|
+
font-size: var(--roxy-text-xs, 0.75rem);
|
|
145
|
+
color: var(--roxy-muted, #71717a);
|
|
146
|
+
text-transform: uppercase;
|
|
147
|
+
letter-spacing: 0.06em;
|
|
148
|
+
}
|
|
149
|
+
.lists ul {
|
|
150
|
+
margin: 0;
|
|
151
|
+
padding-left: var(--roxy-space-md, 1rem);
|
|
152
|
+
font-size: var(--roxy-text-sm, 0.875rem);
|
|
153
|
+
}
|
|
154
|
+
`,
|
|
155
|
+
];
|
|
156
|
+
|
|
157
|
+
@property({ attribute: false })
|
|
158
|
+
data: SynastryData | null = null;
|
|
159
|
+
|
|
160
|
+
render() {
|
|
161
|
+
if (!this.data)
|
|
162
|
+
return html`<div class="roxy-empty" role="status">No synastry data</div>`;
|
|
163
|
+
const {
|
|
164
|
+
person1,
|
|
165
|
+
person2,
|
|
166
|
+
compatibilityScore,
|
|
167
|
+
summary,
|
|
168
|
+
interAspects = [],
|
|
169
|
+
} = this.data;
|
|
170
|
+
const p1Planets = this.normalizePlanets(person1?.planets);
|
|
171
|
+
const p2Planets = this.normalizePlanets(person2?.planets);
|
|
172
|
+
|
|
173
|
+
return html`<div
|
|
174
|
+
class="wrap"
|
|
175
|
+
aria-label="Synastry compatibility chart"
|
|
176
|
+
>
|
|
177
|
+
<div class="head">
|
|
178
|
+
<h2 class="title">Synastry</h2>
|
|
179
|
+
${
|
|
180
|
+
typeof compatibilityScore === 'number'
|
|
181
|
+
? html`<span class="score" aria-label=${`Score ${compatibilityScore} of 100`}
|
|
182
|
+
>${compatibilityScore} / 100</span
|
|
183
|
+
>`
|
|
184
|
+
: nothing
|
|
185
|
+
}
|
|
186
|
+
</div>
|
|
187
|
+
<svg
|
|
188
|
+
viewBox="0 0 ${SIZE} ${SIZE}"
|
|
189
|
+
role="img"
|
|
190
|
+
aria-label="Dual chart wheel comparing two natal charts"
|
|
191
|
+
>
|
|
192
|
+
<title>Synastry dual wheel</title>
|
|
193
|
+
<circle
|
|
194
|
+
class="wheel-line"
|
|
195
|
+
cx=${CENTER}
|
|
196
|
+
cy=${CENTER}
|
|
197
|
+
r=${OUTER_R}
|
|
198
|
+
stroke-width="1.5"
|
|
199
|
+
/>
|
|
200
|
+
<circle
|
|
201
|
+
class="wheel-line"
|
|
202
|
+
cx=${CENTER}
|
|
203
|
+
cy=${CENTER}
|
|
204
|
+
r=${P2_R + 14}
|
|
205
|
+
stroke-width="0.8"
|
|
206
|
+
/>
|
|
207
|
+
<circle
|
|
208
|
+
class="wheel-line"
|
|
209
|
+
cx=${CENTER}
|
|
210
|
+
cy=${CENTER}
|
|
211
|
+
r=${P2_R - 14}
|
|
212
|
+
stroke-width="0.6"
|
|
213
|
+
/>
|
|
214
|
+
${this.renderSpokes()} ${this.renderSigns()}
|
|
215
|
+
${this.renderRing(p1Planets, P1_R, 'p1')} ${this.renderRing(p2Planets, P2_R, 'p2')}
|
|
216
|
+
</svg>
|
|
217
|
+
${summary ? html`<p class="summary">${summary}</p>` : nothing}
|
|
218
|
+
${interAspects.length > 0 ? this.renderAspects(interAspects) : nothing}
|
|
219
|
+
${
|
|
220
|
+
(this.data.strengths?.length ?? 0) > 0 ||
|
|
221
|
+
(this.data.challenges?.length ?? 0) > 0
|
|
222
|
+
? html`<div class="lists">
|
|
223
|
+
${
|
|
224
|
+
this.data.strengths?.length
|
|
225
|
+
? html`<div>
|
|
226
|
+
<h3>Strengths</h3>
|
|
227
|
+
<ul>
|
|
228
|
+
${this.data.strengths.map((s) => html`<li>${s}</li>`)}
|
|
229
|
+
</ul>
|
|
230
|
+
</div>`
|
|
231
|
+
: nothing
|
|
232
|
+
}
|
|
233
|
+
${
|
|
234
|
+
this.data.challenges?.length
|
|
235
|
+
? html`<div>
|
|
236
|
+
<h3>Challenges</h3>
|
|
237
|
+
<ul>
|
|
238
|
+
${this.data.challenges.map((s) => html`<li>${s}</li>`)}
|
|
239
|
+
</ul>
|
|
240
|
+
</div>`
|
|
241
|
+
: nothing
|
|
242
|
+
}
|
|
243
|
+
</div>`
|
|
244
|
+
: nothing
|
|
245
|
+
}
|
|
246
|
+
</div>`;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
private normalizePlanets(
|
|
250
|
+
p: PlanetEntry[] | Record<string, PlanetEntry> | undefined,
|
|
251
|
+
) {
|
|
252
|
+
if (!p) return [];
|
|
253
|
+
if (Array.isArray(p)) return p;
|
|
254
|
+
return Object.entries(p).map(([name, e]) => ({ ...e, name }));
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
private renderSpokes() {
|
|
258
|
+
return Array.from({ length: 12 }, (_, i) => {
|
|
259
|
+
const angle = i * 30 - 90;
|
|
260
|
+
const start = polarToCartesian(CENTER, CENTER, P2_R - 14, angle);
|
|
261
|
+
const end = polarToCartesian(CENTER, CENTER, OUTER_R, angle);
|
|
262
|
+
return svg`<line class="wheel-line" x1=${start.x} y1=${start.y} x2=${end.x} y2=${end.y} stroke-width="0.6" />`;
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
private renderSigns() {
|
|
267
|
+
const order = [
|
|
268
|
+
'Aries',
|
|
269
|
+
'Taurus',
|
|
270
|
+
'Gemini',
|
|
271
|
+
'Cancer',
|
|
272
|
+
'Leo',
|
|
273
|
+
'Virgo',
|
|
274
|
+
'Libra',
|
|
275
|
+
'Scorpio',
|
|
276
|
+
'Sagittarius',
|
|
277
|
+
'Capricorn',
|
|
278
|
+
'Aquarius',
|
|
279
|
+
'Pisces',
|
|
280
|
+
];
|
|
281
|
+
return order.map((s, i) => {
|
|
282
|
+
const angle = i * 30 + 15 - 90;
|
|
283
|
+
const pos = polarToCartesian(CENTER, CENTER, SIGN_R, angle);
|
|
284
|
+
return svg`<text class="sign" x=${pos.x} y=${pos.y} text-anchor="middle" dominant-baseline="central">${SIGN_GLYPH[s]}</text>`;
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
private renderRing(planets: PlanetEntry[], radius: number, cls: string) {
|
|
289
|
+
return planets.map((p) => {
|
|
290
|
+
const lon =
|
|
291
|
+
typeof p.longitude === 'number'
|
|
292
|
+
? p.longitude
|
|
293
|
+
: typeof p.degree === 'number'
|
|
294
|
+
? p.degree
|
|
295
|
+
: NaN;
|
|
296
|
+
if (!Number.isFinite(lon)) return nothing;
|
|
297
|
+
const pos = polarToCartesian(CENTER, CENTER, radius, lon - 90);
|
|
298
|
+
const name = p.name ?? p.planet ?? '';
|
|
299
|
+
const glyph = PLANET_GLYPH[capitalize(name)] ?? name.slice(0, 2);
|
|
300
|
+
return svg`<text class=${cls} x=${pos.x} y=${pos.y} text-anchor="middle" dominant-baseline="central"><title>${name}</title>${glyph}</text>`;
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
private renderAspects(aspects: InterAspect[]) {
|
|
305
|
+
return html`<table>
|
|
306
|
+
<thead>
|
|
307
|
+
<tr>
|
|
308
|
+
<th>Planet 1</th>
|
|
309
|
+
<th>Planet 2</th>
|
|
310
|
+
<th>Aspect</th>
|
|
311
|
+
<th>Orb</th>
|
|
312
|
+
<th>Strength</th>
|
|
313
|
+
</tr>
|
|
314
|
+
</thead>
|
|
315
|
+
<tbody>
|
|
316
|
+
${aspects.slice(0, 16).map(
|
|
317
|
+
(a) => html`<tr>
|
|
318
|
+
<td>${a.planet1 ?? ''}</td>
|
|
319
|
+
<td>${a.planet2 ?? ''}</td>
|
|
320
|
+
<td>${a.aspect ?? ''}</td>
|
|
321
|
+
<td class="orb">
|
|
322
|
+
${typeof a.orb === 'number' ? a.orb.toFixed(1) : ''}
|
|
323
|
+
</td>
|
|
324
|
+
<td>${a.strength ?? ''}</td>
|
|
325
|
+
</tr>`,
|
|
326
|
+
)}
|
|
327
|
+
</tbody>
|
|
328
|
+
</table>`;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function capitalize(s: string): string {
|
|
333
|
+
if (!s) return '';
|
|
334
|
+
return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
declare global {
|
|
338
|
+
interface HTMLElementTagNameMap {
|
|
339
|
+
'roxy-synastry-chart': RoxySynastryChart;
|
|
340
|
+
}
|
|
341
|
+
}
|