@roxyapi/ui 0.17.1 → 0.18.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.
Files changed (86) hide show
  1. package/AGENTS.md +3 -2
  2. package/README.md +3 -3
  3. package/components-catalog.json +126 -110
  4. package/dist/cdn/components/ashtakavarga-grid.js +1 -1
  5. package/dist/cdn/components/ashtakavarga-grid.js.map +2 -2
  6. package/dist/cdn/components/bodygraph.js +1 -1
  7. package/dist/cdn/components/bodygraph.js.map +2 -2
  8. package/dist/cdn/components/dasha-timeline.js +4 -4
  9. package/dist/cdn/components/dasha-timeline.js.map +4 -4
  10. package/dist/cdn/components/divisional-chart.js +2 -2
  11. package/dist/cdn/components/divisional-chart.js.map +2 -2
  12. package/dist/cdn/components/endpoint-form.js +1 -1
  13. package/dist/cdn/components/endpoint-form.js.map +1 -1
  14. package/dist/cdn/components/kp-chart.js +1 -1
  15. package/dist/cdn/components/kp-chart.js.map +2 -2
  16. package/dist/cdn/components/natal-chart.js +1 -1
  17. package/dist/cdn/components/natal-chart.js.map +2 -2
  18. package/dist/cdn/components/relocation-wheel.js +1 -1
  19. package/dist/cdn/components/relocation-wheel.js.map +2 -2
  20. package/dist/cdn/components/tarot-card.js +1 -1
  21. package/dist/cdn/components/tarot-card.js.map +2 -2
  22. package/dist/cdn/components/transits-table.js +1 -1
  23. package/dist/cdn/components/transits-table.js.map +2 -2
  24. package/dist/cdn/components/vedic-kundli.js +2 -2
  25. package/dist/cdn/components/vedic-kundli.js.map +2 -2
  26. package/dist/cdn/roxy-ui.js +74 -74
  27. package/dist/cdn/roxy-ui.js.map +3 -3
  28. package/dist/cdn/widgets.js +1 -1
  29. package/dist/components/ashtakavarga-grid.js +1 -1
  30. package/dist/components/ashtakavarga-grid.js.map +2 -2
  31. package/dist/components/bodygraph.js +1 -1
  32. package/dist/components/bodygraph.js.map +2 -2
  33. package/dist/components/dasha-timeline.d.ts +43 -8
  34. package/dist/components/dasha-timeline.d.ts.map +1 -1
  35. package/dist/components/dasha-timeline.js +1 -1
  36. package/dist/components/dasha-timeline.js.map +4 -4
  37. package/dist/components/divisional-chart.d.ts.map +1 -1
  38. package/dist/components/divisional-chart.js +2 -2
  39. package/dist/components/divisional-chart.js.map +2 -2
  40. package/dist/components/endpoint-form.js +1 -1
  41. package/dist/components/endpoint-form.js.map +1 -1
  42. package/dist/components/kp-chart.js +1 -1
  43. package/dist/components/kp-chart.js.map +2 -2
  44. package/dist/components/natal-chart.js +1 -1
  45. package/dist/components/natal-chart.js.map +2 -2
  46. package/dist/components/relocation-wheel.js +1 -1
  47. package/dist/components/relocation-wheel.js.map +2 -2
  48. package/dist/components/tarot-card.d.ts.map +1 -1
  49. package/dist/components/tarot-card.js +1 -1
  50. package/dist/components/tarot-card.js.map +2 -2
  51. package/dist/components/transits-table.js +1 -1
  52. package/dist/components/transits-table.js.map +2 -2
  53. package/dist/components/vedic-kundli.d.ts.map +1 -1
  54. package/dist/components/vedic-kundli.js +2 -2
  55. package/dist/components/vedic-kundli.js.map +2 -2
  56. package/dist/generated/endpoint-bindings.d.ts.map +1 -1
  57. package/dist/index.cjs +42 -42
  58. package/dist/index.cjs.map +3 -3
  59. package/dist/index.js +50 -50
  60. package/dist/index.js.map +3 -3
  61. package/dist/manifest.d.ts.map +1 -1
  62. package/dist/manifest.json +45 -45
  63. package/dist/schemas/post--vedic-astrology-dasha-current.json +1 -1
  64. package/dist/schemas/post--vedic-astrology-dasha-major.json +1 -1
  65. package/dist/schemas/post--vedic-astrology-dasha-sub-mahadasha-antardasha-pratyantardasha.json +1 -0
  66. package/dist/schemas/post--vedic-astrology-dasha-sub-mahadasha-antardasha.json +1 -0
  67. package/dist/schemas/post--vedic-astrology-dasha-sub-mahadasha.json +1 -1
  68. package/dist/types/index.d.ts +1 -1
  69. package/dist/types/index.d.ts.map +1 -1
  70. package/dist/types/types.gen.d.ts +642 -2
  71. package/dist/types/types.gen.d.ts.map +1 -1
  72. package/dist/utils/kundli-render.d.ts.map +1 -1
  73. package/dist/utils/tablist.d.ts.map +1 -1
  74. package/dist/version.d.ts +1 -1
  75. package/package.json +1 -1
  76. package/src/components/dasha-timeline.ts +250 -50
  77. package/src/components/divisional-chart.ts +15 -8
  78. package/src/components/tarot-card.ts +17 -9
  79. package/src/components/vedic-kundli.ts +15 -8
  80. package/src/generated/endpoint-bindings.ts +16 -0
  81. package/src/manifest.ts +4 -2
  82. package/src/types/index.ts +1 -1
  83. package/src/types/types.gen.ts +652 -2
  84. package/src/utils/kundli-render.ts +5 -0
  85. package/src/utils/tablist.ts +7 -1
  86. package/src/version.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"kundli-render.d.ts","sourceRoot":"","sources":["../../src/utils/kundli-render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAgC1C;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5D,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAsGpD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAChC,IAAI,EAAE,MAAM,CACX,MAAM,EACN;IACC,KAAK,CAAC,EAAE,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;;GAsBG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE;IACrD,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,MAAM,EAAE,CAAC,CAAC;IACV,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,cAAc,CA6CjB"}
1
+ {"version":3,"file":"tablist.d.ts","sourceRoot":"","sources":["../../src/utils/tablist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAG1C,qDAAqD;AACrD,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACrD,EAAE,EAAE,CAAC,CAAC;IACN,KAAK,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,yBAiDzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE;IACrD,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,MAAM,EAAE,CAAC,CAAC;IACV,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,cAAc,CA6CjB"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const ROXY_UI_VERSION = "0.17.1";
1
+ export declare const ROXY_UI_VERSION = "0.18.1";
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.17.1",
3
+ "version": "0.18.1",
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",
@@ -1,8 +1,10 @@
1
1
  import { css, html, nothing } from 'lit';
2
- import { customElement, property } from 'lit/decorators.js';
2
+ import { customElement, property, state } from 'lit/decorators.js';
3
3
  import type {
4
4
  GetCurrentDashaResponse,
5
5
  GetMajorDashasResponse,
6
+ GetPratyantardashasResponse,
7
+ GetSookshmaDashasResponse,
6
8
  GetSubDashasResponse,
7
9
  } from '../types/index.js';
8
10
  import { RoxyDataElement } from '../utils/base-element.js';
@@ -14,21 +16,45 @@ import {
14
16
  interpAccordionStyles,
15
17
  renderInterpAccordion,
16
18
  } from '../utils/interp-accordion.js';
19
+ import { renderTablist, tablistStyles } from '../utils/tablist.js';
17
20
 
18
21
  type DashaData =
19
22
  | GetCurrentDashaResponse
20
23
  | GetMajorDashasResponse
21
- | GetSubDashasResponse;
24
+ | GetSubDashasResponse
25
+ | GetPratyantardashasResponse
26
+ | GetSookshmaDashasResponse;
22
27
 
23
28
  type DashaPeriod = GetMajorDashasResponse['mahadashas'][number];
24
29
  type Remaining = GetCurrentDashaResponse['remainingInMahadasha'];
25
30
 
26
- /** The level a period sits at, so no view ever labels an antardasha a mahadasha. */
27
- const LEVEL_LABEL = {
28
- current: 'Mahadasha',
29
- major: 'Mahadasha',
30
- sub: 'Antardasha',
31
- } as const;
31
+ /**
32
+ * The Vimshottari level a listed period sits at, so no view ever labels an
33
+ * antardasha a mahadasha.
34
+ *
35
+ * Read from the RESPONSE, not from the `period` attribute: all three drill-down
36
+ * routes are `period="sub"`, and only the payload says whether the list is
37
+ * antardashas, pratyantardashas or sookshma dashas.
38
+ */
39
+ function levelOf(d: DashaData): string {
40
+ if ('sookshmaDashas' in d) return 'Sookshma';
41
+ if ('pratyantardashas' in d) return 'Pratyantardasha';
42
+ if ('antardashas' in d) return 'Antardasha';
43
+ return 'Mahadasha';
44
+ }
45
+
46
+ /** The parent period a drill-down response hangs off, with the level it sits at. */
47
+ function parentOf(
48
+ d: DashaData,
49
+ ): { label: string; period: DashaPeriod } | undefined {
50
+ if ('pratyantardashaPeriod' in d && d.pratyantardashaPeriod)
51
+ return { label: 'Pratyantardasha', period: d.pratyantardashaPeriod };
52
+ if ('antardashaPeriod' in d && d.antardashaPeriod)
53
+ return { label: 'Antardasha', period: d.antardashaPeriod };
54
+ if ('mahadashaPeriod' in d && d.mahadashaPeriod)
55
+ return { label: 'Mahadasha', period: d.mahadashaPeriod };
56
+ return undefined;
57
+ }
32
58
 
33
59
  /** "8y 11m 5d", the form a dasha reader expects for a remaining balance. */
34
60
  function formatBalance(b: Remaining | undefined): string {
@@ -64,6 +90,7 @@ export class RoxyDashaTimeline extends RoxyDataElement<DashaData> {
64
90
  baseStyles,
65
91
  disclosureStyles,
66
92
  interpAccordionStyles,
93
+ tablistStyles,
67
94
  css`
68
95
  .wrap {
69
96
  display: grid;
@@ -113,7 +140,6 @@ export class RoxyDashaTimeline extends RoxyDataElement<DashaData> {
113
140
  font-size: var(--roxy-text-xs, 0.75rem);
114
141
  }
115
142
 
116
- .balance,
117
143
  .parent {
118
144
  font-size: var(--roxy-text-sm, 0.875rem);
119
145
  color: var(--roxy-muted, #71717a);
@@ -179,6 +205,27 @@ export class RoxyDashaTimeline extends RoxyDataElement<DashaData> {
179
205
  font-variant-numeric: tabular-nums;
180
206
  text-align: right;
181
207
  }
208
+ [role='tabpanel'] {
209
+ padding-top: var(--roxy-space-md, 1rem);
210
+ }
211
+ .frame {
212
+ display: grid;
213
+ grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
214
+ gap: var(--roxy-space-sm, 0.5rem);
215
+ margin: 0;
216
+ }
217
+ .frame dt {
218
+ color: var(--roxy-muted, #71717a);
219
+ font-size: var(--roxy-text-xs, 0.75rem);
220
+ text-transform: uppercase;
221
+ letter-spacing: 0.06em;
222
+ }
223
+ .frame dd {
224
+ margin: 0;
225
+ font-size: var(--roxy-text-sm, 0.875rem);
226
+ color: var(--roxy-fg, #0a0a0a);
227
+ font-variant-numeric: tabular-nums;
228
+ }
182
229
  .block {
183
230
  border: 1px solid var(--roxy-border, #e4e4e7);
184
231
  border-radius: var(--roxy-radius-md, 8px);
@@ -188,8 +235,23 @@ export class RoxyDashaTimeline extends RoxyDataElement<DashaData> {
188
235
  `,
189
236
  ];
190
237
 
238
+ /**
239
+ * Which dasha endpoint fed this element. `sub`, `antara` and `sookshma` are the
240
+ * three drill-down levels and render identically; they stay distinct because
241
+ * each maps one-to-one onto its endpoint binding, which is what lets a widget
242
+ * pick a level. The LABELS come from the payload, not from here.
243
+ */
191
244
  @property({ type: String, reflect: true })
192
- period: 'current' | 'major' | 'sub' = 'current';
245
+ period: 'current' | 'major' | 'sub' | 'antara' | 'sookshma' = 'current';
246
+
247
+ /** Which panel is showing. Reset guarded in renderData when the data changes shape. */
248
+ @state()
249
+ private view: 'timeline' | 'readings' | 'frame' = 'timeline';
250
+
251
+ /** True for any of the drill-down levels, which share one layout. */
252
+ private get isDrillDown(): boolean {
253
+ return this.period !== 'current' && this.period !== 'major';
254
+ }
193
255
 
194
256
  protected renderEmpty() {
195
257
  return html`<div class="roxy-empty" role="status">No dasha data</div>`;
@@ -200,78 +262,210 @@ export class RoxyDashaTimeline extends RoxyDataElement<DashaData> {
200
262
  const maxYears = periods.length
201
263
  ? Math.max(...periods.map((p) => p.durationYears))
202
264
  : 0;
265
+ const readings = this.readings(d, periods);
266
+ const frame = this.frameRows(d);
267
+
268
+ // One panel per kind of question a reader asks: when do the periods run,
269
+ // what do they mean, and what chart produced them. Without the split the
270
+ // card became a single column of periods, prose and provenance, and the
271
+ // dates (the reason anyone opens it) were pushed below the fold.
272
+ const tabs = [
273
+ { id: 'timeline' as const, label: 'Timeline' },
274
+ ...(readings.length
275
+ ? [{ id: 'readings' as const, label: `Readings (${readings.length})` }]
276
+ : []),
277
+ ...(frame.length ? [{ id: 'frame' as const, label: 'Chart' }] : []),
278
+ ];
279
+ // A tab that no longer exists (data changed under a selection) must not
280
+ // blank the card, so fall back to the first.
281
+ const view = tabs.some((t) => t.id === this.view) ? this.view : 'timeline';
203
282
 
204
283
  return html`<div class="wrap" aria-label="Dasha timeline">
205
284
  <header class="head">
206
285
  <h2 class="title">${this.heading(d)}</h2>
207
- ${
208
- 'nakshatraName' in d && d.nakshatraName
209
- ? html`<div class="nakshatra">
210
- Moon nakshatra: ${d.nakshatraName}
211
- ${'nakshatraLord' in d && d.nakshatraLord ? html`(lord ${d.nakshatraLord})` : nothing}
212
- </div>`
213
- : nothing
214
- }
286
+ ${this.renderLordChain(d)}
215
287
  </header>
216
288
 
217
- ${this.renderBirthBalance(d)}
218
289
  ${this.renderParentMahadasha(d)}
219
- ${this.period === 'current' ? this.renderCurrent(d) : nothing}
220
290
  ${
221
- periods.length > 0
222
- ? html`<div class="timeline" role="list">
223
- ${periods.map((p) => this.renderBar(p, maxYears))}
224
- </div>`
291
+ tabs.length > 1
292
+ ? renderTablist({
293
+ items: tabs,
294
+ active: view,
295
+ onSelect: (v) => {
296
+ this.view = v;
297
+ },
298
+ label: 'Dasha views',
299
+ idPrefix: 'roxy-dasha',
300
+ controls: true,
301
+ })
225
302
  : nothing
226
303
  }
227
- ${renderInterpAccordion(this.readings(d, periods), 'roxy-dasha', 'Reading')}
304
+ <div
305
+ id="roxy-dasha-panel-${view}"
306
+ role="tabpanel"
307
+ tabindex="0"
308
+ aria-labelledby=${tabs.length > 1 ? `roxy-dasha-tab-${view}` : nothing}
309
+ >
310
+ ${
311
+ view === 'timeline'
312
+ ? html`
313
+ ${this.period === 'current' ? this.renderCurrent(d) : nothing}
314
+ ${
315
+ periods.length > 0
316
+ ? html`<div class="timeline" role="list">
317
+ ${periods.map((p) => this.renderBar(p, maxYears))}
318
+ </div>`
319
+ : nothing
320
+ }`
321
+ : nothing
322
+ }
323
+ ${
324
+ view === 'readings'
325
+ ? renderInterpAccordion(
326
+ readings,
327
+ 'roxy-dasha',
328
+ readings.length === 1 ? 'Reading' : 'Readings',
329
+ )
330
+ : nothing
331
+ }
332
+ ${view === 'frame' ? this.renderFrame(frame) : nothing}
333
+ </div>
228
334
  </div>`;
229
335
  }
230
336
 
337
+ /**
338
+ * The full lord chain a drill-down sits under, e.g. Saturn > Venus > Rahu.
339
+ *
340
+ * The response carries every ancestor lord on each period, and naming only the
341
+ * immediate parent leaves a reader at the sookshma level unable to tell which
342
+ * branch of the chart they are looking at.
343
+ */
344
+ private renderLordChain(d: DashaData) {
345
+ const chain = [
346
+ 'mahadashaLord' in d ? d.mahadashaLord : undefined,
347
+ 'antardashaLord' in d ? d.antardashaLord : undefined,
348
+ 'pratyantardashaLord' in d ? d.pratyantardashaLord : undefined,
349
+ ].filter(Boolean);
350
+ if (chain.length > 1) {
351
+ return html`<div class="nakshatra">${chain.join(' \u203a ')}</div>`;
352
+ }
353
+ if ('nakshatraName' in d && d.nakshatraName) {
354
+ return html`<div class="nakshatra">
355
+ Moon nakshatra: ${d.nakshatraName}
356
+ ${'nakshatraLord' in d && d.nakshatraLord ? html`(lord ${d.nakshatraLord})` : nothing}
357
+ </div>`;
358
+ }
359
+ return nothing;
360
+ }
361
+
362
+ /**
363
+ * Provenance rows: the chart every date in this response was derived from.
364
+ *
365
+ * These are the fields that let a reader reconcile our dates against another
366
+ * calculator. The sidereal frame is the one that actually explains a
367
+ * disagreement, since Lahiri and the KP variants move every boundary by weeks,
368
+ * so it is shown rather than left in the JSON.
369
+ */
370
+ private frameRows(d: DashaData): Array<[string, string]> {
371
+ const rows: Array<[string, string]> = [];
372
+ if ('nakshatraName' in d && d.nakshatraName) {
373
+ const n =
374
+ 'moonNakshatra' in d && d.moonNakshatra
375
+ ? ` (${d.moonNakshatra} of 27)`
376
+ : '';
377
+ rows.push(['Moon nakshatra', `${d.nakshatraName}${n}`]);
378
+ }
379
+ if ('nakshatraLord' in d && d.nakshatraLord) {
380
+ rows.push(['Nakshatra lord', d.nakshatraLord]);
381
+ }
382
+ if ('moonLongitude' in d && typeof d.moonLongitude === 'number') {
383
+ rows.push([
384
+ 'Moon longitude',
385
+ `${formatNumber(d.moonLongitude, 3)}\u00b0 sidereal`,
386
+ ]);
387
+ }
388
+ if ('ayanamsaType' in d && d.ayanamsaType) {
389
+ const deg =
390
+ 'ayanamsa' in d && typeof d.ayanamsa === 'number'
391
+ ? ` (${formatNumber(d.ayanamsa, 3)}\u00b0)`
392
+ : '';
393
+ rows.push(['Ayanamsa', `${d.ayanamsaType}${deg}`]);
394
+ }
395
+ if ('birthDashaBalance' in d && d.birthDashaBalance) {
396
+ const lord =
397
+ 'nakshatraLord' in d && d.nakshatraLord ? `${d.nakshatraLord} ` : '';
398
+ rows.push([
399
+ 'Balance at birth',
400
+ `${formatBalance(d.birthDashaBalance)} of the opening ${lord}mahadasha`,
401
+ ]);
402
+ }
403
+ if ('totalYears' in d && typeof d.totalYears === 'number') {
404
+ rows.push(['Cycle length', `${d.totalYears} years`]);
405
+ }
406
+ return rows;
407
+ }
408
+
409
+ private renderFrame(rows: Array<[string, string]>) {
410
+ return html`<dl class="frame">
411
+ ${rows.map(([label, value]) => html`<div><dt>${label}</dt><dd>${value}</dd></div>`)}
412
+ </dl>`;
413
+ }
414
+
231
415
  private heading(d: DashaData): string {
232
416
  if (this.period === 'major') return 'Vimshottari Mahadasha';
233
- if (this.period === 'sub') {
234
- const lord = 'mahadashaLord' in d ? d.mahadashaLord : '';
235
- return lord ? `Antardashas in ${lord} Mahadasha` : 'Antardashas';
417
+ if (this.isDrillDown) {
418
+ const parent = parentOf(d);
419
+ const level = levelOf(d);
420
+ return parent
421
+ ? `${level}s in ${parent.period.planet} ${parent.label}`
422
+ : `${level}s`;
236
423
  }
237
424
  return 'Active dashas';
238
425
  }
239
426
 
240
- private renderBirthBalance(d: DashaData) {
241
- if (!('birthDashaBalance' in d) || !d.birthDashaBalance) return nothing;
242
- const lord = 'nakshatraLord' in d && d.nakshatraLord ? d.nakshatraLord : '';
243
- const remaining = formatBalance(d.birthDashaBalance);
244
- return html`<p class="balance">
245
- Birth dasha balance: ${remaining} of
246
- ${lord ? html`<strong>${lord}</strong>` : 'the opening mahadasha'} remained at birth.
247
- </p>`;
248
- }
249
-
250
- /** Sub mode lists antardashas inside one mahadasha, so name the parent and its span. */
427
+ /**
428
+ * Drill-down modes list sub-periods inside one parent, so name the parent and
429
+ * its span. A sub-period means nothing without its parent lord.
430
+ *
431
+ * `nominalStartDate` is present only when birth cut the parent short, which is
432
+ * also why such a list can hold fewer than nine rows: the sub-periods that
433
+ * finished before the native was born are not part of the chart. Saying so
434
+ * turns a surprising short list into an explained one.
435
+ */
251
436
  private renderParentMahadasha(d: DashaData) {
252
- if (!('mahadashaPeriod' in d) || !d.mahadashaPeriod) return nothing;
253
- const p = d.mahadashaPeriod;
437
+ const parent = parentOf(d);
438
+ if (!parent) return nothing;
439
+ const p = parent.period;
254
440
  const span = formatSpan(p);
441
+ const began = p.nominalStartDate ? formatDate(p.nominalStartDate) : '';
255
442
  return html`<p class="parent">
256
- Inside the <strong>${p.planet}</strong> Mahadasha${span ? `, ${span}` : ''}
443
+ Inside the <strong>${p.planet}</strong> ${parent.label}${span ? `, ${span}` : ''}
257
444
  ${typeof p.durationYears === 'number' ? `(${formatNumber(p.durationYears, 1)} years)` : ''}.
445
+ ${
446
+ began
447
+ ? html`<br />It began ${began}, before birth, so only the sub-periods running
448
+ after the birth date are listed.`
449
+ : nothing
450
+ }
258
451
  </p>`;
259
452
  }
260
453
 
261
454
  /**
262
455
  * Every reading the response carries, behind one exclusive accordion. Current
263
- * mode has three (mahadasha, antardasha, pratyantardasha); sub mode leads with
264
- * the parent mahadasha reading, then the antardasha running now; major mode
265
- * shows the mahadasha running now.
456
+ * mode has four (mahadasha, antardasha, pratyantardasha, sookshma); drill-down
457
+ * modes lead with the parent period reading, then the sub-period running now;
458
+ * major mode shows the mahadasha running now.
266
459
  */
267
460
  private readings(d: DashaData, periods: DashaPeriod[]): InterpSection[] {
268
461
  const sections: InterpSection[] = [];
269
462
 
270
- if ('mahadashaPeriod' in d && d.mahadashaPeriod?.interpretation) {
463
+ const parent = parentOf(d);
464
+ if (parent?.period.interpretation) {
271
465
  sections.push({
272
- label: `${d.mahadashaPeriod.planet} Mahadasha`,
273
- aside: formatSpan(d.mahadashaPeriod),
274
- body: d.mahadashaPeriod.interpretation,
466
+ label: `${parent.period.planet} ${parent.label}`,
467
+ aside: formatSpan(parent.period),
468
+ body: parent.period.interpretation,
275
469
  });
276
470
  }
277
471
 
@@ -280,6 +474,7 @@ export class RoxyDashaTimeline extends RoxyDataElement<DashaData> {
280
474
  ['Mahadasha', d.mahadasha, d.remainingInMahadasha],
281
475
  ['Antardasha', d.antardasha, d.remainingInAntardasha],
282
476
  ['Pratyantardasha', d.pratyantardasha, d.remainingInPratyantardasha],
477
+ ['Sookshma', d.sookshmaDasha, d.remainingInSookshma],
283
478
  ] as const;
284
479
  for (const [label, period, remaining] of levels) {
285
480
  if (!period?.interpretation) continue;
@@ -295,7 +490,7 @@ export class RoxyDashaTimeline extends RoxyDataElement<DashaData> {
295
490
  const active = periods.find((p) => this.isCurrent(p));
296
491
  if (active?.interpretation) {
297
492
  sections.push({
298
- label: `${active.planet} ${LEVEL_LABEL[this.period]}`,
493
+ label: `${active.planet} ${levelOf(d)}`,
299
494
  aside: formatSpan(active),
300
495
  body: active.interpretation,
301
496
  });
@@ -310,6 +505,7 @@ export class RoxyDashaTimeline extends RoxyDataElement<DashaData> {
310
505
  ['Mahadasha', d.mahadasha, d.remainingInMahadasha],
311
506
  ['Antardasha', d.antardasha, d.remainingInAntardasha],
312
507
  ['Pratyantardasha', d.pratyantardasha, d.remainingInPratyantardasha],
508
+ ['Sookshma', d.sookshmaDasha, d.remainingInSookshma],
313
509
  ] as const;
314
510
  return html`<div class="current">
315
511
  ${levels.map(([label, period, remaining]) => {
@@ -327,6 +523,10 @@ export class RoxyDashaTimeline extends RoxyDataElement<DashaData> {
327
523
  private collectPeriods(d: DashaData): DashaPeriod[] {
328
524
  if ('mahadashas' in d && d.mahadashas?.length) return d.mahadashas;
329
525
  if ('antardashas' in d && d.antardashas?.length) return d.antardashas;
526
+ if ('pratyantardashas' in d && d.pratyantardashas?.length)
527
+ return d.pratyantardashas;
528
+ if ('sookshmaDashas' in d && d.sookshmaDashas?.length)
529
+ return d.sookshmaDashas;
330
530
  return [];
331
531
  }
332
532
 
@@ -112,15 +112,22 @@ export class RoxyDivisionalChart extends RoxyDataElement<DivisionalChartResponse
112
112
  ${renderKundliStyleTablist(this.chartStyle, this.setStyle)}
113
113
  </div>
114
114
 
115
- <svg
116
- viewBox="0 0 400 400"
117
- preserveAspectRatio="xMidYMid meet"
118
- role="img"
119
- aria-label="D${division.number} ${division.name} divisional chart with twelve sign houses"
115
+ <div
116
+ id="kundli-panel-${this.chartStyle}"
117
+ role="tabpanel"
118
+ tabindex="0"
119
+ aria-labelledby="kundli-tab-${this.chartStyle}"
120
120
  >
121
- <title>D${division.number} ${division.name}</title>
122
- ${renderKundliSvg(vm, this.chartStyle)}
123
- </svg>
121
+ <svg
122
+ viewBox="0 0 400 400"
123
+ preserveAspectRatio="xMidYMid meet"
124
+ role="img"
125
+ aria-label="D${division.number} ${division.name} divisional chart with twelve sign houses"
126
+ >
127
+ <title>D${division.number} ${division.name}</title>
128
+ ${renderKundliSvg(vm, this.chartStyle)}
129
+ </svg>
130
+ </div>
124
131
 
125
132
  ${
126
133
  vargottama && vargottama.length > 0
@@ -200,16 +200,24 @@ export class RoxyTarotCard extends RoxyDataElement<TarotData> {
200
200
  },
201
201
  label: 'Card orientation',
202
202
  idPrefix: 'tarot',
203
+ controls: true,
203
204
  })}
204
- ${oriented?.description ? html`<p class="reading">${oriented.description}</p>` : nothing}
205
- ${
206
- keywords.length > 0
207
- ? html`<div class="chips">
208
- ${keywords.map((k) => html`<span>${k}</span>`)}
209
- </div>`
210
- : nothing
211
- }
212
- ${this.renderGuidance(oriented, `tarot-${this.orientation}-guidance`)}
205
+ <div
206
+ id="tarot-panel-${this.orientation}"
207
+ role="tabpanel"
208
+ tabindex="0"
209
+ aria-labelledby="tarot-tab-${this.orientation}"
210
+ >
211
+ ${oriented?.description ? html`<p class="reading">${oriented.description}</p>` : nothing}
212
+ ${
213
+ keywords.length > 0
214
+ ? html`<div class="chips">
215
+ ${keywords.map((k) => html`<span>${k}</span>`)}
216
+ </div>`
217
+ : nothing
218
+ }
219
+ ${this.renderGuidance(oriented, `tarot-${this.orientation}-guidance`)}
220
+ </div>
213
221
  </div>
214
222
  </article>`;
215
223
  }
@@ -90,15 +90,22 @@ export class RoxyVedicKundli extends RoxyDataElement<BirthChartResponse> {
90
90
  <h2 class="title">${title}</h2>
91
91
  ${renderKundliStyleTablist(this.chartStyle, this.setStyle)}
92
92
  </div>
93
- <svg
94
- viewBox="0 0 400 400"
95
- preserveAspectRatio="xMidYMid meet"
96
- role="img"
97
- aria-label="Vedic birth chart with twelve sign houses"
93
+ <div
94
+ id="kundli-panel-${this.chartStyle}"
95
+ role="tabpanel"
96
+ tabindex="0"
97
+ aria-labelledby="kundli-tab-${this.chartStyle}"
98
98
  >
99
- <title>Vedic kundli</title>
100
- ${renderKundliSvg(vm, this.chartStyle)}
101
- </svg>
99
+ <svg
100
+ viewBox="0 0 400 400"
101
+ preserveAspectRatio="xMidYMid meet"
102
+ role="img"
103
+ aria-label="Vedic birth chart with twelve sign houses"
104
+ >
105
+ <title>Vedic kundli</title>
106
+ ${renderKundliSvg(vm, this.chartStyle)}
107
+ </svg>
108
+ </div>
102
109
  </div>`;
103
110
  }
104
111
  }
@@ -175,6 +175,22 @@ export const ENDPOINT_BINDINGS: Record<string, EndpointBinding[]> = {
175
175
  period: 'sub',
176
176
  },
177
177
  },
178
+ {
179
+ operationId: 'getPratyantardashas',
180
+ method: 'POST',
181
+ path: '/vedic-astrology/dasha/sub/{mahadasha}/{antardasha}',
182
+ attrs: {
183
+ period: 'antara',
184
+ },
185
+ },
186
+ {
187
+ operationId: 'getSookshmaDashas',
188
+ method: 'POST',
189
+ path: '/vedic-astrology/dasha/sub/{mahadasha}/{antardasha}/{pratyantardasha}',
190
+ attrs: {
191
+ period: 'sookshma',
192
+ },
193
+ },
178
194
  ],
179
195
  'roxy-divisional-chart': [
180
196
  {
package/src/manifest.ts CHANGED
@@ -319,10 +319,12 @@ export const ROXY_COMPONENTS: readonly RoxyComponent[] = [
319
319
  tag: 'roxy-dasha-timeline',
320
320
  slug: 'dasha-timeline',
321
321
  heading: 'Vimshottari dasha',
322
- description: 'Vimshottari dasha timeline with active mahadasha highlighted',
322
+ description:
323
+ 'Vimshottari dasha timeline, mahadasha through sookshma, with the active period highlighted',
323
324
  docsLabel: 'Vedic',
324
325
  endpointLabel: 'POST /vedic-astrology/dasha/{current,major,sub/...}',
325
- docsSummary: 'Vimshottari mahadasha + antardasha + pratyantardasha',
326
+ docsSummary:
327
+ 'Vimshottari mahadasha, antardasha, pratyantardasha and sookshma, drill-down at every level',
326
328
  topic: 'Vedic',
327
329
  },
328
330
  {