@roxyapi/ui 0.19.4 → 0.20.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.
- package/AGENTS.md +10 -7
- package/README.md +9 -6
- package/components-catalog.json +166 -114
- package/dist/cdn/components/arudha-padas.js +313 -0
- package/dist/cdn/components/arudha-padas.js.map +7 -0
- package/dist/cdn/components/chara-karakas.js +313 -0
- package/dist/cdn/components/chara-karakas.js.map +7 -0
- package/dist/cdn/components/dasha-timeline.js +4 -4
- package/dist/cdn/components/dasha-timeline.js.map +4 -4
- package/dist/cdn/components/endpoint-form.js +1 -1
- package/dist/cdn/components/endpoint-form.js.map +1 -1
- package/dist/cdn/components/kp-chart.js +4 -4
- package/dist/cdn/components/kp-chart.js.map +4 -4
- package/dist/cdn/components/kp-ruling-planets.js +3 -3
- package/dist/cdn/components/kp-ruling-planets.js.map +4 -4
- package/dist/cdn/components/reference-card.js +3 -3
- package/dist/cdn/components/reference-card.js.map +2 -2
- package/dist/cdn/components/upagraha-table.js +313 -0
- package/dist/cdn/components/upagraha-table.js.map +7 -0
- package/dist/cdn/components/vedic-planets-table.js +2 -2
- package/dist/cdn/components/vedic-planets-table.js.map +2 -2
- package/dist/cdn/components/yoga-list.js +4 -4
- package/dist/cdn/components/yoga-list.js.map +3 -3
- package/dist/cdn/roxy-ui.js +78 -78
- package/dist/cdn/roxy-ui.js.map +4 -4
- package/dist/cdn/widgets.js +1 -1
- package/dist/components/arudha-padas.d.ts +22 -0
- package/dist/components/arudha-padas.d.ts.map +1 -0
- package/dist/components/arudha-padas.js +2 -0
- package/dist/components/arudha-padas.js.map +7 -0
- package/dist/components/chara-karakas.d.ts +22 -0
- package/dist/components/chara-karakas.d.ts.map +1 -0
- package/dist/components/chara-karakas.js +2 -0
- package/dist/components/chara-karakas.js.map +7 -0
- package/dist/components/dasha-timeline.d.ts +18 -13
- package/dist/components/dasha-timeline.d.ts.map +1 -1
- package/dist/components/dasha-timeline.js +1 -1
- package/dist/components/dasha-timeline.js.map +4 -4
- package/dist/components/endpoint-form.js +1 -1
- package/dist/components/endpoint-form.js.map +1 -1
- package/dist/components/kp-chart.d.ts +7 -0
- package/dist/components/kp-chart.d.ts.map +1 -1
- package/dist/components/kp-chart.js +1 -1
- package/dist/components/kp-chart.js.map +4 -4
- package/dist/components/kp-ruling-planets.d.ts +6 -0
- package/dist/components/kp-ruling-planets.d.ts.map +1 -1
- package/dist/components/kp-ruling-planets.js +1 -1
- package/dist/components/kp-ruling-planets.js.map +4 -4
- package/dist/components/reference-card.d.ts +2 -2
- package/dist/components/reference-card.d.ts.map +1 -1
- package/dist/components/reference-card.js +1 -1
- package/dist/components/reference-card.js.map +2 -2
- package/dist/components/upagraha-table.d.ts +22 -0
- package/dist/components/upagraha-table.d.ts.map +1 -0
- package/dist/components/upagraha-table.js +2 -0
- package/dist/components/upagraha-table.js.map +7 -0
- package/dist/components/vedic-planets-table.d.ts +10 -1
- package/dist/components/vedic-planets-table.d.ts.map +1 -1
- package/dist/components/vedic-planets-table.js +1 -1
- package/dist/components/vedic-planets-table.js.map +2 -2
- package/dist/components/yoga-list.d.ts +13 -2
- package/dist/components/yoga-list.d.ts.map +1 -1
- package/dist/components/yoga-list.js +1 -1
- package/dist/components/yoga-list.js.map +3 -3
- package/dist/generated/endpoint-bindings.d.ts.map +1 -1
- package/dist/index.cjs +46 -46
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -51
- package/dist/index.js.map +4 -4
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.json +3 -0
- package/dist/schemas/get--astrology-horoscope-sign-daily.json +1 -1
- package/dist/schemas/get--astrology-horoscope-sign-monthly.json +1 -1
- package/dist/schemas/get--astrology-horoscope-sign-weekly.json +1 -1
- package/dist/schemas/get--astrology-moon-phase-current.json +1 -1
- package/dist/schemas/get--vedic-astrology-avasthas-id.json +1 -0
- package/dist/schemas/get--vedic-astrology-avasthas.json +1 -0
- package/dist/schemas/get--vedic-astrology-kp-ayanamsa.json +1 -1
- package/dist/schemas/get--vedic-astrology-yoga-id.json +1 -1
- package/dist/schemas/post--vedic-astrology-arudha.json +1 -0
- package/dist/schemas/post--vedic-astrology-birth-chart.json +1 -1
- package/dist/schemas/post--vedic-astrology-chara-karakas.json +1 -0
- package/dist/schemas/post--vedic-astrology-dasha-current.json +1 -1
- package/dist/schemas/post--vedic-astrology-dasha-major.json +1 -1
- package/dist/schemas/post--vedic-astrology-dasha-sub-mahadasha-antardasha-pratyantardasha-sookshma.json +1 -0
- package/dist/schemas/post--vedic-astrology-dasha-sub-mahadasha-antardasha-pratyantardasha.json +1 -1
- package/dist/schemas/post--vedic-astrology-dasha-sub-mahadasha-antardasha.json +1 -1
- package/dist/schemas/post--vedic-astrology-dasha-sub-mahadasha.json +1 -1
- package/dist/schemas/post--vedic-astrology-kp-chart.json +1 -1
- package/dist/schemas/post--vedic-astrology-kp-cusps.json +1 -1
- package/dist/schemas/post--vedic-astrology-kp-ruling-planets-interval.json +1 -1
- package/dist/schemas/post--vedic-astrology-kp-ruling-planets.json +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.gen.d.ts +3228 -934
- package/dist/types/types.gen.d.ts.map +1 -1
- package/dist/utils/house-themes.d.ts +19 -0
- package/dist/utils/house-themes.d.ts.map +1 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/arudha-padas.ts +230 -0
- package/src/components/chara-karakas.ts +241 -0
- package/src/components/dasha-timeline.ts +129 -28
- package/src/components/kp-chart.ts +40 -5
- package/src/components/kp-ruling-planets.ts +29 -6
- package/src/components/reference-card.ts +3 -1
- package/src/components/upagraha-table.ts +182 -0
- package/src/components/vedic-planets-table.ts +34 -4
- package/src/components/yoga-list.ts +144 -20
- package/src/generated/endpoint-bindings.ts +13 -0
- package/src/index.ts +3 -0
- package/src/manifest.ts +48 -7
- package/src/types/index.ts +1 -1
- package/src/types/types.gen.ts +3133 -809
- package/src/utils/house-themes.ts +36 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { GetCurrentDashaResponse } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The `houseThemes` map every themed Vedic response carries: house number as a string key, significations ordered primary first. Present on the six Vimshottari dasha routes, `kp/chart`, `kp/cusps`, `kp/ruling-planets` (only when birth data was sent, hence the `undefined` arm) and `kp/ruling-planets-interval` (once at the response root, never per interval).
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* The `focus` query parameter chooses which vocabulary the API fills this map with (`general` significations, or the `finance` reading of the same twelve bhavas) and `lang` translates it, so the caller has already chosen both by the time a component sees the response. A component therefore reads this map and holds no table of house meanings of its own.
|
|
7
|
+
*/
|
|
8
|
+
export type HouseThemes = GetCurrentDashaResponse['houseThemes'] | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* One primary keyword per house, "gains, enemies" for houses 11 and 6. Turns a bare house list (a dasha period's significators, a KP planet's `signifies`) into a phrase that fits on one line beside it.
|
|
11
|
+
*
|
|
12
|
+
* The words come from the response map and nowhere else, so a Hindi response renders Hindi houses and a `focus=finance` request renders the money reading. Only the FIRST theme per house is used: these call sites carry up to eight houses, and a full list per house would wrap past its row.
|
|
13
|
+
*
|
|
14
|
+
* Returns an empty string when the map is absent (the request did not ask for it) or no house is signified, so a caller can render nothing without a second guard.
|
|
15
|
+
*/
|
|
16
|
+
export declare function houseWords(houses: readonly number[] | undefined, themes: HouseThemes): string;
|
|
17
|
+
/** Every keyword for ONE house, "self, body, vitality". For a per-house row (a KP cusp, a house-wise significator) where the row IS the house and there is room for the whole set. */
|
|
18
|
+
export declare function houseThemeLine(house: number | undefined, themes: HouseThemes): string;
|
|
19
|
+
//# sourceMappingURL=house-themes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"house-themes.d.ts","sourceRoot":"","sources":["../../src/utils/house-themes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,uBAAuB,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC;AAE7E;;;;;;GAMG;AACH,wBAAgB,UAAU,CACzB,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EACrC,MAAM,EAAE,WAAW,GACjB,MAAM,CAMR;AAED,sLAAsL;AACtL,wBAAgB,cAAc,CAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,MAAM,EAAE,WAAW,GACjB,MAAM,CAGR"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const ROXY_UI_VERSION = "0.
|
|
1
|
+
export declare const ROXY_UI_VERSION = "0.20.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roxyapi/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Web components for the RoxyAPI catalog. Drop-in charts, tables, cards, forms for astrology, tarot, numerology, biorhythm, I Ching, crystals, dreams, angel numbers, and more. One key, beautiful in 30 minutes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { css, html, nothing } from 'lit';
|
|
2
|
+
import { customElement } from 'lit/decorators.js';
|
|
3
|
+
import { SIGN_GLYPH } from '../tokens/index.js';
|
|
4
|
+
import type { ArudhaResponse } from '../types/index.js';
|
|
5
|
+
import { RoxyDataElement } from '../utils/base-element.js';
|
|
6
|
+
import { baseStyles } from '../utils/base-styles.js';
|
|
7
|
+
import { capitalize } from '../utils/string.js';
|
|
8
|
+
|
|
9
|
+
type Pada = ArudhaResponse['padas'][number];
|
|
10
|
+
|
|
11
|
+
/** The two padas lifted to the top of the response, and what each is read for. Both are marked in the table too, so the summary and the rows agree. */
|
|
12
|
+
const LEAD_IDS = new Set(['a1', 'a12']);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Arudha padas. Renders /vedic-astrology/arudha: the twelve Jaimini padas, each with the bhava it belongs to, the lord and the count that produced it, the sign it lands in, and what it is read for.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* All twelve render, and two are marked. The Arudha Lagna (AL, the pada of the first house) is the one most readings start from, and the Upapada (UL, the pada of the twelfth) is the one a marriage reading turns on, so a table that shows only the AL is missing the second question it will be asked.
|
|
19
|
+
*
|
|
20
|
+
* The derivation is shown, not just the answer. Each row carries the bhava sign, its lord and the lord's sign, which is the count a reader checks by hand, plus a mark where the classical exception fired: a pada that fell in its own bhava or the seventh from it is moved to the tenth from there, and that step is the one implementations most often skip.
|
|
21
|
+
*/
|
|
22
|
+
@customElement('roxy-arudha-padas')
|
|
23
|
+
export class RoxyArudhaPadas extends RoxyDataElement<ArudhaResponse> {
|
|
24
|
+
static styles = [
|
|
25
|
+
baseStyles,
|
|
26
|
+
css`
|
|
27
|
+
.wrap {
|
|
28
|
+
border: 1px solid var(--roxy-border, #e4e4e7);
|
|
29
|
+
border-radius: var(--roxy-radius-md, 8px);
|
|
30
|
+
background: var(--roxy-surface, #fff);
|
|
31
|
+
box-shadow: var(--roxy-shadow-sm);
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
}
|
|
34
|
+
.head {
|
|
35
|
+
padding: var(--roxy-space-md, 1rem);
|
|
36
|
+
border-bottom: 1px solid var(--roxy-border, #e4e4e7);
|
|
37
|
+
}
|
|
38
|
+
.title {
|
|
39
|
+
margin: 0;
|
|
40
|
+
font-size: var(--roxy-text-lg, 1.125rem);
|
|
41
|
+
font-weight: var(--roxy-weight-bold, 600);
|
|
42
|
+
}
|
|
43
|
+
.leads {
|
|
44
|
+
display: grid;
|
|
45
|
+
grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
|
|
46
|
+
gap: var(--roxy-space-md, 1rem);
|
|
47
|
+
padding: var(--roxy-space-md, 1rem);
|
|
48
|
+
border-bottom: 1px solid var(--roxy-border, #e4e4e7);
|
|
49
|
+
}
|
|
50
|
+
.lead span {
|
|
51
|
+
display: block;
|
|
52
|
+
color: var(--roxy-muted, #71717a);
|
|
53
|
+
font-size: var(--roxy-text-xs, 0.75rem);
|
|
54
|
+
text-transform: uppercase;
|
|
55
|
+
letter-spacing: 0.06em;
|
|
56
|
+
}
|
|
57
|
+
.lead strong {
|
|
58
|
+
font-size: var(--roxy-text-base, 1rem);
|
|
59
|
+
color: var(--roxy-fg, #0a0a0a);
|
|
60
|
+
}
|
|
61
|
+
.scroll {
|
|
62
|
+
overflow-x: auto;
|
|
63
|
+
min-width: 0;
|
|
64
|
+
}
|
|
65
|
+
table {
|
|
66
|
+
width: 100%;
|
|
67
|
+
border-collapse: collapse;
|
|
68
|
+
font-size: var(--roxy-text-sm, 0.875rem);
|
|
69
|
+
min-width: 700px;
|
|
70
|
+
}
|
|
71
|
+
thead {
|
|
72
|
+
background: color-mix(in srgb, var(--roxy-border, #e4e4e7) 20%, transparent);
|
|
73
|
+
}
|
|
74
|
+
th,
|
|
75
|
+
td {
|
|
76
|
+
padding: var(--roxy-space-sm, 0.5rem) var(--roxy-space-md, 1rem);
|
|
77
|
+
text-align: left;
|
|
78
|
+
white-space: nowrap;
|
|
79
|
+
}
|
|
80
|
+
th {
|
|
81
|
+
color: var(--roxy-muted, #71717a);
|
|
82
|
+
font-weight: var(--roxy-weight-bold, 600);
|
|
83
|
+
text-transform: uppercase;
|
|
84
|
+
font-size: var(--roxy-text-xs, 0.75rem);
|
|
85
|
+
letter-spacing: 0.04em;
|
|
86
|
+
}
|
|
87
|
+
tbody tr {
|
|
88
|
+
border-top: 1px solid var(--roxy-border, #e4e4e7);
|
|
89
|
+
}
|
|
90
|
+
tbody tr.lead-row {
|
|
91
|
+
background: color-mix(in srgb, var(--roxy-accent, #f59e0b) 10%, transparent);
|
|
92
|
+
}
|
|
93
|
+
td.pada {
|
|
94
|
+
font-weight: var(--roxy-weight-bold, 600);
|
|
95
|
+
color: var(--roxy-fg, #0a0a0a);
|
|
96
|
+
}
|
|
97
|
+
.abbr {
|
|
98
|
+
color: var(--roxy-muted, #71717a);
|
|
99
|
+
font-weight: var(--roxy-weight-normal, 400);
|
|
100
|
+
margin-left: 0.4em;
|
|
101
|
+
}
|
|
102
|
+
tbody tr.lead-row .abbr,
|
|
103
|
+
tbody tr.lead-row .glyph {
|
|
104
|
+
color: var(--roxy-accent-ink, #b45309);
|
|
105
|
+
}
|
|
106
|
+
.glyph {
|
|
107
|
+
margin-right: 0.4em;
|
|
108
|
+
color: var(--roxy-muted, #71717a);
|
|
109
|
+
}
|
|
110
|
+
.num {
|
|
111
|
+
font-variant-numeric: tabular-nums;
|
|
112
|
+
}
|
|
113
|
+
.exception {
|
|
114
|
+
font-size: var(--roxy-text-xs, 0.75rem);
|
|
115
|
+
font-weight: var(--roxy-weight-bold, 600);
|
|
116
|
+
color: var(--roxy-warning-fg, #b45309);
|
|
117
|
+
}
|
|
118
|
+
.meaning {
|
|
119
|
+
white-space: normal;
|
|
120
|
+
min-width: 12rem;
|
|
121
|
+
}
|
|
122
|
+
.meaning strong {
|
|
123
|
+
display: block;
|
|
124
|
+
font-weight: var(--roxy-weight-bold, 600);
|
|
125
|
+
}
|
|
126
|
+
.meaning p {
|
|
127
|
+
margin: 0;
|
|
128
|
+
color: var(--roxy-muted, #71717a);
|
|
129
|
+
font-size: var(--roxy-text-xs, 0.75rem);
|
|
130
|
+
line-height: var(--roxy-leading-normal, 1.5);
|
|
131
|
+
}
|
|
132
|
+
.note {
|
|
133
|
+
margin: 0;
|
|
134
|
+
padding: 0 var(--roxy-space-md, 1rem) var(--roxy-space-md, 1rem);
|
|
135
|
+
color: var(--roxy-muted, #71717a);
|
|
136
|
+
font-size: var(--roxy-text-xs, 0.75rem);
|
|
137
|
+
line-height: var(--roxy-leading-normal, 1.5);
|
|
138
|
+
}
|
|
139
|
+
`,
|
|
140
|
+
];
|
|
141
|
+
|
|
142
|
+
protected renderEmpty() {
|
|
143
|
+
return html`<div class="roxy-empty" role="status">No arudha pada data</div>`;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
protected renderData(d: ArudhaResponse) {
|
|
147
|
+
const padas = d.padas ?? [];
|
|
148
|
+
if (!padas.length) return this.renderEmpty();
|
|
149
|
+
const exceptions = padas.filter((p) => p.exceptionApplied).length;
|
|
150
|
+
|
|
151
|
+
return html`<div class="wrap" aria-label="Arudha padas">
|
|
152
|
+
<header class="head">
|
|
153
|
+
<h2 class="title">Arudha padas</h2>
|
|
154
|
+
</header>
|
|
155
|
+
<div class="leads">
|
|
156
|
+
<div class="lead"><span>Lagna</span><strong>${d.lagnaRashi ?? ''}</strong></div>
|
|
157
|
+
<div class="lead">
|
|
158
|
+
<span>Arudha Lagna</span><strong>${d.arudhaLagna ?? ''}</strong>
|
|
159
|
+
</div>
|
|
160
|
+
<div class="lead"><span>Upapada</span><strong>${d.upapada ?? ''}</strong></div>
|
|
161
|
+
</div>
|
|
162
|
+
<div class="scroll" tabindex="0">
|
|
163
|
+
<table role="table">
|
|
164
|
+
<caption class="roxy-sr-only">
|
|
165
|
+
The twelve Arudha padas: each pada with its bhava, the bhava sign and its lord,
|
|
166
|
+
the sign the lord occupies, the sign the pada falls in, which house from the
|
|
167
|
+
Lagna that is, whether the classical exception was applied, and what the pada is
|
|
168
|
+
read for.
|
|
169
|
+
</caption>
|
|
170
|
+
<thead>
|
|
171
|
+
<tr>
|
|
172
|
+
<th scope="col">Pada</th>
|
|
173
|
+
<th scope="col">Bhava</th>
|
|
174
|
+
<th scope="col">Bhava rashi</th>
|
|
175
|
+
<th scope="col">Lord</th>
|
|
176
|
+
<th scope="col">Lord rashi</th>
|
|
177
|
+
<th scope="col">Pada rashi</th>
|
|
178
|
+
<th scope="col">From Lagna</th>
|
|
179
|
+
<th scope="col">Read for</th>
|
|
180
|
+
</tr>
|
|
181
|
+
</thead>
|
|
182
|
+
<tbody>
|
|
183
|
+
${padas.map((p) => this.renderRow(p))}
|
|
184
|
+
</tbody>
|
|
185
|
+
</table>
|
|
186
|
+
</div>
|
|
187
|
+
${
|
|
188
|
+
exceptions > 0
|
|
189
|
+
? html`<p class="note">
|
|
190
|
+
<span class="exception">Moved</span> marks a pada that fell in its own bhava or
|
|
191
|
+
the seventh from it and was moved to the tenth from there, as the classical rule
|
|
192
|
+
requires. ${exceptions} of ${padas.length} padas here.
|
|
193
|
+
</p>`
|
|
194
|
+
: nothing
|
|
195
|
+
}
|
|
196
|
+
</div>`;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
private renderRow(p: Pada) {
|
|
200
|
+
const glyph = (sign?: string) => SIGN_GLYPH[capitalize(sign ?? '')] ?? '';
|
|
201
|
+
const cell = (sign?: string) => {
|
|
202
|
+
const g = glyph(sign);
|
|
203
|
+
return html`${g ? html`<span class="glyph">${g}</span>` : nothing}${sign ?? ''}`;
|
|
204
|
+
};
|
|
205
|
+
return html`<tr class=${LEAD_IDS.has(p.id) ? 'lead-row' : ''}>
|
|
206
|
+
<td class="pada">
|
|
207
|
+
${p.name ?? ''}${p.abbreviation ? html`<span class="abbr">${p.abbreviation}</span>` : nothing}
|
|
208
|
+
</td>
|
|
209
|
+
<td class="num">${p.house ?? ''}</td>
|
|
210
|
+
<td>${cell(p.bhavaRashi)}</td>
|
|
211
|
+
<td>${p.lord ?? ''}</td>
|
|
212
|
+
<td>${cell(p.lordRashi)}</td>
|
|
213
|
+
<td>
|
|
214
|
+
${cell(p.rashi)}
|
|
215
|
+
${p.exceptionApplied ? html`<span class="exception">Moved</span>` : nothing}
|
|
216
|
+
</td>
|
|
217
|
+
<td class="num">${p.houseFromLagna ?? ''}</td>
|
|
218
|
+
<td class="meaning">
|
|
219
|
+
<strong>${p.meaning ?? ''}</strong>
|
|
220
|
+
${p.significations ? html`<p>${p.significations}</p>` : nothing}
|
|
221
|
+
</td>
|
|
222
|
+
</tr>`;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
declare global {
|
|
227
|
+
interface HTMLElementTagNameMap {
|
|
228
|
+
'roxy-arudha-padas': RoxyArudhaPadas;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { css, html, nothing } from 'lit';
|
|
2
|
+
import { customElement } from 'lit/decorators.js';
|
|
3
|
+
import { PLANET_GLYPH, SIGN_GLYPH } from '../tokens/index.js';
|
|
4
|
+
import type { CharaKarakaResponse } from '../types/index.js';
|
|
5
|
+
import { RoxyDataElement } from '../utils/base-element.js';
|
|
6
|
+
import { baseStyles } from '../utils/base-styles.js';
|
|
7
|
+
import { formatNumber } from '../utils/format.js';
|
|
8
|
+
import { capitalize } from '../utils/string.js';
|
|
9
|
+
|
|
10
|
+
type Karaka = CharaKarakaResponse['karakas'][number];
|
|
11
|
+
|
|
12
|
+
/** What each scheme is, stated on the card rather than left implicit. Read from the response `scheme`, which the API echoes for exactly this reason. */
|
|
13
|
+
const SCHEMES: Record<string, string> = {
|
|
14
|
+
eight:
|
|
15
|
+
'Eight karaka scheme, Rahu included and ranked from the end of its sign.',
|
|
16
|
+
seven:
|
|
17
|
+
'Seven karaka scheme, Rahu excluded and the Pitrikaraka office not assigned.',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Chara Karakas. Renders /vedic-astrology/chara-karakas: the movable significators of Jaimini astrology, the offices ranked by how far each graha has advanced into its sign, Atmakaraka first.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* The scheme is shown, never hidden. The seven and eight karaka schemes name a DIFFERENT Atmakaraka on the same chart, so a reader who follows one school has to be able to see at a glance which one produced the ranking in front of them. The value is the one the response echoes, so the label can never disagree with the ranking beside it.
|
|
25
|
+
*
|
|
26
|
+
* Rahu is flagged where it appears. It advances backward through a sign, so it is ranked on thirty degrees minus its position, and the response carries both figures: the degree a chart displays and the degree that earned the office. Showing only one of them makes the order look wrong.
|
|
27
|
+
*/
|
|
28
|
+
@customElement('roxy-chara-karakas')
|
|
29
|
+
export class RoxyCharaKarakas extends RoxyDataElement<CharaKarakaResponse> {
|
|
30
|
+
static styles = [
|
|
31
|
+
baseStyles,
|
|
32
|
+
css`
|
|
33
|
+
.wrap {
|
|
34
|
+
border: 1px solid var(--roxy-border, #e4e4e7);
|
|
35
|
+
border-radius: var(--roxy-radius-md, 8px);
|
|
36
|
+
background: var(--roxy-surface, #fff);
|
|
37
|
+
box-shadow: var(--roxy-shadow-sm);
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
}
|
|
40
|
+
.head {
|
|
41
|
+
padding: var(--roxy-space-md, 1rem);
|
|
42
|
+
border-bottom: 1px solid var(--roxy-border, #e4e4e7);
|
|
43
|
+
display: grid;
|
|
44
|
+
gap: var(--roxy-space-xs, 0.25rem);
|
|
45
|
+
}
|
|
46
|
+
.title {
|
|
47
|
+
margin: 0;
|
|
48
|
+
font-size: var(--roxy-text-lg, 1.125rem);
|
|
49
|
+
font-weight: var(--roxy-weight-bold, 600);
|
|
50
|
+
}
|
|
51
|
+
.scheme {
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-wrap: wrap;
|
|
54
|
+
align-items: baseline;
|
|
55
|
+
gap: var(--roxy-space-sm, 0.5rem);
|
|
56
|
+
font-size: var(--roxy-text-xs, 0.75rem);
|
|
57
|
+
color: var(--roxy-muted, #71717a);
|
|
58
|
+
line-height: var(--roxy-leading-normal, 1.5);
|
|
59
|
+
}
|
|
60
|
+
.scheme-chip {
|
|
61
|
+
font-size: var(--roxy-text-xs, 0.75rem);
|
|
62
|
+
font-weight: var(--roxy-weight-bold, 600);
|
|
63
|
+
text-transform: uppercase;
|
|
64
|
+
letter-spacing: 0.05em;
|
|
65
|
+
padding: 0.15em 0.6em;
|
|
66
|
+
border-radius: 999px;
|
|
67
|
+
background: color-mix(in srgb, var(--roxy-accent, #f59e0b) 16%, transparent);
|
|
68
|
+
color: var(--roxy-accent-ink, #b45309);
|
|
69
|
+
}
|
|
70
|
+
.leads {
|
|
71
|
+
display: grid;
|
|
72
|
+
grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
|
|
73
|
+
gap: var(--roxy-space-md, 1rem);
|
|
74
|
+
padding: var(--roxy-space-md, 1rem);
|
|
75
|
+
border-bottom: 1px solid var(--roxy-border, #e4e4e7);
|
|
76
|
+
}
|
|
77
|
+
.lead span {
|
|
78
|
+
display: block;
|
|
79
|
+
color: var(--roxy-muted, #71717a);
|
|
80
|
+
font-size: var(--roxy-text-xs, 0.75rem);
|
|
81
|
+
text-transform: uppercase;
|
|
82
|
+
letter-spacing: 0.06em;
|
|
83
|
+
}
|
|
84
|
+
.lead strong {
|
|
85
|
+
font-size: var(--roxy-text-base, 1rem);
|
|
86
|
+
color: var(--roxy-fg, #0a0a0a);
|
|
87
|
+
}
|
|
88
|
+
.scroll {
|
|
89
|
+
overflow-x: auto;
|
|
90
|
+
min-width: 0;
|
|
91
|
+
}
|
|
92
|
+
table {
|
|
93
|
+
width: 100%;
|
|
94
|
+
border-collapse: collapse;
|
|
95
|
+
font-size: var(--roxy-text-sm, 0.875rem);
|
|
96
|
+
min-width: 640px;
|
|
97
|
+
}
|
|
98
|
+
thead {
|
|
99
|
+
background: color-mix(in srgb, var(--roxy-border, #e4e4e7) 20%, transparent);
|
|
100
|
+
}
|
|
101
|
+
th,
|
|
102
|
+
td {
|
|
103
|
+
padding: var(--roxy-space-sm, 0.5rem) var(--roxy-space-md, 1rem);
|
|
104
|
+
text-align: left;
|
|
105
|
+
white-space: nowrap;
|
|
106
|
+
}
|
|
107
|
+
th {
|
|
108
|
+
color: var(--roxy-muted, #71717a);
|
|
109
|
+
font-weight: var(--roxy-weight-bold, 600);
|
|
110
|
+
text-transform: uppercase;
|
|
111
|
+
font-size: var(--roxy-text-xs, 0.75rem);
|
|
112
|
+
letter-spacing: 0.04em;
|
|
113
|
+
}
|
|
114
|
+
tbody tr {
|
|
115
|
+
border-top: 1px solid var(--roxy-border, #e4e4e7);
|
|
116
|
+
}
|
|
117
|
+
/* The Atmakaraka outranks every graha in the chart, so the first row is
|
|
118
|
+
* marked rather than left to be counted. */
|
|
119
|
+
tbody tr.ak {
|
|
120
|
+
background: color-mix(in srgb, var(--roxy-accent, #f59e0b) 10%, transparent);
|
|
121
|
+
}
|
|
122
|
+
td.office {
|
|
123
|
+
font-weight: var(--roxy-weight-bold, 600);
|
|
124
|
+
color: var(--roxy-fg, #0a0a0a);
|
|
125
|
+
}
|
|
126
|
+
.abbr {
|
|
127
|
+
color: var(--roxy-muted, #71717a);
|
|
128
|
+
font-weight: var(--roxy-weight-normal, 400);
|
|
129
|
+
margin-left: 0.4em;
|
|
130
|
+
}
|
|
131
|
+
tbody tr.ak .abbr {
|
|
132
|
+
color: var(--roxy-accent-ink, #b45309);
|
|
133
|
+
}
|
|
134
|
+
.glyph {
|
|
135
|
+
margin-right: 0.4em;
|
|
136
|
+
color: var(--roxy-muted, #71717a);
|
|
137
|
+
}
|
|
138
|
+
tbody tr.ak .glyph {
|
|
139
|
+
color: var(--roxy-accent-ink, #b45309);
|
|
140
|
+
}
|
|
141
|
+
.num {
|
|
142
|
+
font-variant-numeric: tabular-nums;
|
|
143
|
+
}
|
|
144
|
+
.reversed {
|
|
145
|
+
display: block;
|
|
146
|
+
color: var(--roxy-muted, #71717a);
|
|
147
|
+
font-size: var(--roxy-text-xs, 0.75rem);
|
|
148
|
+
}
|
|
149
|
+
.meaning {
|
|
150
|
+
white-space: normal;
|
|
151
|
+
min-width: 12rem;
|
|
152
|
+
}
|
|
153
|
+
.meaning strong {
|
|
154
|
+
display: block;
|
|
155
|
+
font-weight: var(--roxy-weight-bold, 600);
|
|
156
|
+
}
|
|
157
|
+
.meaning p {
|
|
158
|
+
margin: 0;
|
|
159
|
+
color: var(--roxy-muted, #71717a);
|
|
160
|
+
font-size: var(--roxy-text-xs, 0.75rem);
|
|
161
|
+
line-height: var(--roxy-leading-normal, 1.5);
|
|
162
|
+
}
|
|
163
|
+
`,
|
|
164
|
+
];
|
|
165
|
+
|
|
166
|
+
protected renderEmpty() {
|
|
167
|
+
return html`<div class="roxy-empty" role="status">No chara karaka data</div>`;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
protected renderData(d: CharaKarakaResponse) {
|
|
171
|
+
const karakas = d.karakas ?? [];
|
|
172
|
+
if (!karakas.length) return this.renderEmpty();
|
|
173
|
+
|
|
174
|
+
return html`<div class="wrap" aria-label="Chara karakas">
|
|
175
|
+
<header class="head">
|
|
176
|
+
<h2 class="title">Chara karakas</h2>
|
|
177
|
+
<p class="scheme">
|
|
178
|
+
<span class="scheme-chip">${d.scheme ?? ''}</span>
|
|
179
|
+
${d.scheme ? (SCHEMES[d.scheme] ?? '') : ''}
|
|
180
|
+
</p>
|
|
181
|
+
</header>
|
|
182
|
+
<div class="leads">
|
|
183
|
+
<div class="lead"><span>Atmakaraka</span><strong>${d.atmakaraka ?? ''}</strong></div>
|
|
184
|
+
<div class="lead"><span>Darakaraka</span><strong>${d.darakaraka ?? ''}</strong></div>
|
|
185
|
+
</div>
|
|
186
|
+
<div class="scroll" tabindex="0">
|
|
187
|
+
<table role="table">
|
|
188
|
+
<caption class="roxy-sr-only">
|
|
189
|
+
Chara karakas in descending rank: each office, the graha holding it, its rashi,
|
|
190
|
+
the degree it holds, the degree that earned the office, and what the office is
|
|
191
|
+
read for.
|
|
192
|
+
</caption>
|
|
193
|
+
<thead>
|
|
194
|
+
<tr>
|
|
195
|
+
<th scope="col">Office</th>
|
|
196
|
+
<th scope="col">Graha</th>
|
|
197
|
+
<th scope="col">Rashi</th>
|
|
198
|
+
<th scope="col">Degree</th>
|
|
199
|
+
<th scope="col">Ranked on</th>
|
|
200
|
+
<th scope="col">Read for</th>
|
|
201
|
+
</tr>
|
|
202
|
+
</thead>
|
|
203
|
+
<tbody>
|
|
204
|
+
${karakas.map((k, i) => this.renderRow(k, i === 0))}
|
|
205
|
+
</tbody>
|
|
206
|
+
</table>
|
|
207
|
+
</div>
|
|
208
|
+
</div>`;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
private renderRow(k: Karaka, isFirst: boolean) {
|
|
212
|
+
const glyph = PLANET_GLYPH[capitalize(k.graha ?? '')] ?? '';
|
|
213
|
+
const signGlyph = SIGN_GLYPH[capitalize(k.rashi ?? '')] ?? '';
|
|
214
|
+
return html`<tr class=${isFirst ? 'ak' : ''}>
|
|
215
|
+
<td class="office">
|
|
216
|
+
${k.name ?? ''}${k.abbreviation ? html`<span class="abbr">${k.abbreviation}</span>` : nothing}
|
|
217
|
+
</td>
|
|
218
|
+
<td>
|
|
219
|
+
${glyph ? html`<span class="glyph">${glyph}</span>` : nothing}${k.graha ?? ''}
|
|
220
|
+
</td>
|
|
221
|
+
<td>
|
|
222
|
+
${signGlyph ? html`<span class="glyph">${signGlyph}</span>` : nothing}${k.rashi ?? ''}
|
|
223
|
+
</td>
|
|
224
|
+
<td class="num">${formatNumber(k.degreeInRashi, 2)}</td>
|
|
225
|
+
<td class="num">
|
|
226
|
+
${formatNumber(k.rankingDegree, 2)}
|
|
227
|
+
${k.isReversed ? html`<span class="reversed">measured from the end of the sign</span>` : nothing}
|
|
228
|
+
</td>
|
|
229
|
+
<td class="meaning">
|
|
230
|
+
<strong>${k.meaning ?? ''}</strong>
|
|
231
|
+
${k.significations ? html`<p>${k.significations}</p>` : nothing}
|
|
232
|
+
</td>
|
|
233
|
+
</tr>`;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
declare global {
|
|
238
|
+
interface HTMLElementTagNameMap {
|
|
239
|
+
'roxy-chara-karakas': RoxyCharaKarakas;
|
|
240
|
+
}
|
|
241
|
+
}
|