@roxyapi/ui 0.4.1 → 0.5.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 (216) hide show
  1. package/AGENTS.md +21 -0
  2. package/README.md +16 -0
  3. package/dist/cdn/components/ashtakavarga-grid.js +12 -12
  4. package/dist/cdn/components/ashtakavarga-grid.js.map +4 -4
  5. package/dist/cdn/components/biorhythm-chart.js +8 -8
  6. package/dist/cdn/components/biorhythm-chart.js.map +4 -4
  7. package/dist/cdn/components/choghadiya-grid.js +12 -12
  8. package/dist/cdn/components/choghadiya-grid.js.map +4 -4
  9. package/dist/cdn/components/compatibility-card.js +7 -7
  10. package/dist/cdn/components/compatibility-card.js.map +4 -4
  11. package/dist/cdn/components/dasha-timeline.js +8 -8
  12. package/dist/cdn/components/dasha-timeline.js.map +4 -4
  13. package/dist/cdn/components/data.js +14 -14
  14. package/dist/cdn/components/data.js.map +4 -4
  15. package/dist/cdn/components/divisional-chart.js +29 -29
  16. package/dist/cdn/components/divisional-chart.js.map +4 -4
  17. package/dist/cdn/components/dosha-card.js +6 -6
  18. package/dist/cdn/components/dosha-card.js.map +4 -4
  19. package/dist/cdn/components/guna-milan.js +11 -11
  20. package/dist/cdn/components/guna-milan.js.map +4 -4
  21. package/dist/cdn/components/hexagram.js +9 -9
  22. package/dist/cdn/components/hexagram.js.map +4 -4
  23. package/dist/cdn/components/horoscope-card.js +18 -18
  24. package/dist/cdn/components/horoscope-card.js.map +4 -4
  25. package/dist/cdn/components/kp-chart.js +40 -40
  26. package/dist/cdn/components/kp-chart.js.map +4 -4
  27. package/dist/cdn/components/kp-planets-table.js +7 -7
  28. package/dist/cdn/components/kp-planets-table.js.map +4 -4
  29. package/dist/cdn/components/kp-ruling-planets.js +13 -13
  30. package/dist/cdn/components/kp-ruling-planets.js.map +4 -4
  31. package/dist/cdn/components/moon-phase.js +11 -11
  32. package/dist/cdn/components/moon-phase.js.map +4 -4
  33. package/dist/cdn/components/nakshatra-card.js +16 -16
  34. package/dist/cdn/components/nakshatra-card.js.map +4 -4
  35. package/dist/cdn/components/natal-chart.js +14 -14
  36. package/dist/cdn/components/natal-chart.js.map +4 -4
  37. package/dist/cdn/components/numerology-card.js +8 -8
  38. package/dist/cdn/components/numerology-card.js.map +4 -4
  39. package/dist/cdn/components/panchang-table.js +9 -9
  40. package/dist/cdn/components/panchang-table.js.map +4 -4
  41. package/dist/cdn/components/shadbala-table.js +13 -13
  42. package/dist/cdn/components/shadbala-table.js.map +4 -4
  43. package/dist/cdn/components/synastry-chart.js +18 -18
  44. package/dist/cdn/components/synastry-chart.js.map +4 -4
  45. package/dist/cdn/components/tarot-card.js +21 -21
  46. package/dist/cdn/components/tarot-card.js.map +4 -4
  47. package/dist/cdn/components/tarot-spread.js +27 -27
  48. package/dist/cdn/components/tarot-spread.js.map +4 -4
  49. package/dist/cdn/components/transits-table.js +15 -15
  50. package/dist/cdn/components/transits-table.js.map +4 -4
  51. package/dist/cdn/components/vedic-kundli.js +36 -36
  52. package/dist/cdn/components/vedic-kundli.js.map +4 -4
  53. package/dist/cdn/components/vedic-planets-table.js +11 -11
  54. package/dist/cdn/components/vedic-planets-table.js.map +4 -4
  55. package/dist/cdn/components/western-planets-table.js +8 -8
  56. package/dist/cdn/components/western-planets-table.js.map +4 -4
  57. package/dist/cdn/components/yoga-list.js +6 -6
  58. package/dist/cdn/components/yoga-list.js.map +4 -4
  59. package/dist/cdn/roxy-ui.js +231 -231
  60. package/dist/cdn/roxy-ui.js.map +4 -4
  61. package/dist/components/ashtakavarga-grid.d.ts +1 -0
  62. package/dist/components/ashtakavarga-grid.d.ts.map +1 -1
  63. package/dist/components/ashtakavarga-grid.js +47 -1
  64. package/dist/components/ashtakavarga-grid.js.map +3 -3
  65. package/dist/components/biorhythm-chart.d.ts +1 -0
  66. package/dist/components/biorhythm-chart.d.ts.map +1 -1
  67. package/dist/components/biorhythm-chart.js +47 -1
  68. package/dist/components/biorhythm-chart.js.map +3 -3
  69. package/dist/components/choghadiya-grid.d.ts +1 -0
  70. package/dist/components/choghadiya-grid.d.ts.map +1 -1
  71. package/dist/components/choghadiya-grid.js +47 -1
  72. package/dist/components/choghadiya-grid.js.map +3 -3
  73. package/dist/components/compatibility-card.d.ts +1 -0
  74. package/dist/components/compatibility-card.d.ts.map +1 -1
  75. package/dist/components/compatibility-card.js +47 -1
  76. package/dist/components/compatibility-card.js.map +3 -3
  77. package/dist/components/dasha-timeline.d.ts +1 -0
  78. package/dist/components/dasha-timeline.d.ts.map +1 -1
  79. package/dist/components/dasha-timeline.js +47 -1
  80. package/dist/components/dasha-timeline.js.map +3 -3
  81. package/dist/components/data.d.ts +1 -0
  82. package/dist/components/data.d.ts.map +1 -1
  83. package/dist/components/data.js +47 -1
  84. package/dist/components/data.js.map +3 -3
  85. package/dist/components/divisional-chart.d.ts +1 -0
  86. package/dist/components/divisional-chart.d.ts.map +1 -1
  87. package/dist/components/divisional-chart.js +47 -1
  88. package/dist/components/divisional-chart.js.map +3 -3
  89. package/dist/components/dosha-card.d.ts +1 -0
  90. package/dist/components/dosha-card.d.ts.map +1 -1
  91. package/dist/components/dosha-card.js +47 -1
  92. package/dist/components/dosha-card.js.map +3 -3
  93. package/dist/components/guna-milan.d.ts +1 -0
  94. package/dist/components/guna-milan.d.ts.map +1 -1
  95. package/dist/components/guna-milan.js +47 -1
  96. package/dist/components/guna-milan.js.map +3 -3
  97. package/dist/components/hexagram.d.ts +1 -0
  98. package/dist/components/hexagram.d.ts.map +1 -1
  99. package/dist/components/hexagram.js +47 -1
  100. package/dist/components/hexagram.js.map +3 -3
  101. package/dist/components/horoscope-card.d.ts +1 -0
  102. package/dist/components/horoscope-card.d.ts.map +1 -1
  103. package/dist/components/horoscope-card.js +47 -1
  104. package/dist/components/horoscope-card.js.map +3 -3
  105. package/dist/components/kp-chart.d.ts +1 -0
  106. package/dist/components/kp-chart.d.ts.map +1 -1
  107. package/dist/components/kp-chart.js +47 -1
  108. package/dist/components/kp-chart.js.map +3 -3
  109. package/dist/components/kp-planets-table.d.ts +1 -0
  110. package/dist/components/kp-planets-table.d.ts.map +1 -1
  111. package/dist/components/kp-planets-table.js +47 -1
  112. package/dist/components/kp-planets-table.js.map +3 -3
  113. package/dist/components/kp-ruling-planets.d.ts +1 -0
  114. package/dist/components/kp-ruling-planets.d.ts.map +1 -1
  115. package/dist/components/kp-ruling-planets.js +47 -1
  116. package/dist/components/kp-ruling-planets.js.map +3 -3
  117. package/dist/components/moon-phase.d.ts +1 -0
  118. package/dist/components/moon-phase.d.ts.map +1 -1
  119. package/dist/components/moon-phase.js +47 -1
  120. package/dist/components/moon-phase.js.map +3 -3
  121. package/dist/components/nakshatra-card.d.ts +1 -0
  122. package/dist/components/nakshatra-card.d.ts.map +1 -1
  123. package/dist/components/nakshatra-card.js +47 -1
  124. package/dist/components/nakshatra-card.js.map +3 -3
  125. package/dist/components/natal-chart.d.ts +1 -0
  126. package/dist/components/natal-chart.d.ts.map +1 -1
  127. package/dist/components/natal-chart.js +47 -1
  128. package/dist/components/natal-chart.js.map +3 -3
  129. package/dist/components/numerology-card.d.ts +1 -0
  130. package/dist/components/numerology-card.d.ts.map +1 -1
  131. package/dist/components/numerology-card.js +47 -1
  132. package/dist/components/numerology-card.js.map +3 -3
  133. package/dist/components/panchang-table.d.ts +1 -0
  134. package/dist/components/panchang-table.d.ts.map +1 -1
  135. package/dist/components/panchang-table.js +47 -1
  136. package/dist/components/panchang-table.js.map +3 -3
  137. package/dist/components/shadbala-table.d.ts +1 -0
  138. package/dist/components/shadbala-table.d.ts.map +1 -1
  139. package/dist/components/shadbala-table.js +47 -1
  140. package/dist/components/shadbala-table.js.map +3 -3
  141. package/dist/components/synastry-chart.d.ts +1 -0
  142. package/dist/components/synastry-chart.d.ts.map +1 -1
  143. package/dist/components/synastry-chart.js +47 -1
  144. package/dist/components/synastry-chart.js.map +3 -3
  145. package/dist/components/tarot-card.d.ts +1 -0
  146. package/dist/components/tarot-card.d.ts.map +1 -1
  147. package/dist/components/tarot-card.js +47 -1
  148. package/dist/components/tarot-card.js.map +3 -3
  149. package/dist/components/tarot-spread.d.ts +1 -0
  150. package/dist/components/tarot-spread.d.ts.map +1 -1
  151. package/dist/components/tarot-spread.js +47 -1
  152. package/dist/components/tarot-spread.js.map +3 -3
  153. package/dist/components/transits-table.d.ts +1 -0
  154. package/dist/components/transits-table.d.ts.map +1 -1
  155. package/dist/components/transits-table.js +47 -1
  156. package/dist/components/transits-table.js.map +3 -3
  157. package/dist/components/vedic-kundli.d.ts +1 -0
  158. package/dist/components/vedic-kundli.d.ts.map +1 -1
  159. package/dist/components/vedic-kundli.js +47 -1
  160. package/dist/components/vedic-kundli.js.map +3 -3
  161. package/dist/components/vedic-planets-table.d.ts +1 -0
  162. package/dist/components/vedic-planets-table.d.ts.map +1 -1
  163. package/dist/components/vedic-planets-table.js +47 -1
  164. package/dist/components/vedic-planets-table.js.map +3 -3
  165. package/dist/components/western-planets-table.d.ts +1 -0
  166. package/dist/components/western-planets-table.d.ts.map +1 -1
  167. package/dist/components/western-planets-table.js +47 -1
  168. package/dist/components/western-planets-table.js.map +3 -3
  169. package/dist/components/yoga-list.d.ts +1 -0
  170. package/dist/components/yoga-list.d.ts.map +1 -1
  171. package/dist/components/yoga-list.js +47 -1
  172. package/dist/components/yoga-list.js.map +3 -3
  173. package/dist/index.cjs +102 -29
  174. package/dist/index.cjs.map +3 -3
  175. package/dist/index.js +102 -29
  176. package/dist/index.js.map +3 -3
  177. package/dist/types/index.d.ts +1 -1
  178. package/dist/types/index.d.ts.map +1 -1
  179. package/dist/types/types.gen.d.ts +590 -202
  180. package/dist/types/types.gen.d.ts.map +1 -1
  181. package/dist/utils/markup-data.d.ts +57 -0
  182. package/dist/utils/markup-data.d.ts.map +1 -0
  183. package/dist/version.d.ts +1 -1
  184. package/package.json +1 -1
  185. package/src/components/ashtakavarga-grid.ts +9 -0
  186. package/src/components/biorhythm-chart.ts +9 -0
  187. package/src/components/choghadiya-grid.ts +9 -0
  188. package/src/components/compatibility-card.ts +9 -0
  189. package/src/components/dasha-timeline.ts +9 -0
  190. package/src/components/data.ts +9 -0
  191. package/src/components/divisional-chart.ts +9 -0
  192. package/src/components/dosha-card.ts +9 -0
  193. package/src/components/guna-milan.ts +9 -0
  194. package/src/components/hexagram.ts +9 -0
  195. package/src/components/horoscope-card.ts +9 -0
  196. package/src/components/kp-chart.ts +9 -0
  197. package/src/components/kp-planets-table.ts +9 -0
  198. package/src/components/kp-ruling-planets.ts +9 -0
  199. package/src/components/moon-phase.ts +9 -0
  200. package/src/components/nakshatra-card.ts +9 -0
  201. package/src/components/natal-chart.ts +9 -0
  202. package/src/components/numerology-card.ts +9 -0
  203. package/src/components/panchang-table.ts +9 -0
  204. package/src/components/shadbala-table.ts +9 -0
  205. package/src/components/synastry-chart.ts +9 -0
  206. package/src/components/tarot-card.ts +9 -0
  207. package/src/components/tarot-spread.ts +9 -0
  208. package/src/components/transits-table.ts +9 -0
  209. package/src/components/vedic-kundli.ts +9 -0
  210. package/src/components/vedic-planets-table.ts +9 -0
  211. package/src/components/western-planets-table.ts +9 -0
  212. package/src/components/yoga-list.ts +9 -0
  213. package/src/types/index.ts +1 -1
  214. package/src/types/types.gen.ts +602 -200
  215. package/src/utils/markup-data.ts +115 -0
  216. package/src/version.ts +1 -1
@@ -0,0 +1,57 @@
1
+ import type { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ /**
3
+ * Host shape the controller drives: any reactive element that exposes a public `data` slot. The controller only writes `data` when the host left it unset, so the JavaScript property path always wins.
4
+ */
5
+ interface DataHost extends ReactiveControllerHost, HTMLElement {
6
+ data?: unknown;
7
+ }
8
+ /**
9
+ * Reactive controller that lets a component hydrate its `data` from embedded markup when no `data` property was assigned in JavaScript.
10
+ *
11
+ * @remarks
12
+ * The server-side and cached-render model: a backend renders the RoxyAPI response into a direct-child `<script type="application/json" class="roxy-data">` element, ships static HTML, and never runs per-element JavaScript to assign a property. On connect this controller reads that script, parses it, and feeds the result to the host. The JavaScript property path is untouched and authoritative: if `host.data` already holds a value when the host connects, the controller does nothing and the markup is ignored.
13
+ *
14
+ * Source resolution order on connect, first hit wins:
15
+ *
16
+ * 1. `host.data` already set in JavaScript -> leave it, read nothing.
17
+ * 2. A direct-child `<script type="application/json" class="roxy-data">` -> parse and use. Direct-child only, so a nested component's own script is never read by an ancestor.
18
+ *
19
+ * Fetching from a URL is intentionally unsupported: that would require a browser-visible key and breaks the server-rendered, cached model these consumers rely on.
20
+ *
21
+ * Timing: {@link hostConnected} runs inside the host `connectedCallback`. For an element parsed from server HTML, its direct children are present by the time the custom element upgrades and connects, so the script is readable here. For an element created with `document.createElement` and connected before any child is appended, there is nothing to read and the property path is the only source, which is exactly the existing behavior.
22
+ *
23
+ * Failure is safe: malformed JSON or a missing script leaves `host.data` untouched, so the host renders its normal empty state.
24
+ *
25
+ * Reading the script never mutates it, and only the marked script is touched, so any sibling fallback markup a server nested inside the element (for no-JavaScript, AMP, or crawler rendering) is left in place.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * import { MarkupDataController } from '../utils/markup-data.js';
30
+ *
31
+ * export class RoxyExample extends LitElement {
32
+ * constructor() {
33
+ * super();
34
+ * new MarkupDataController(this);
35
+ * }
36
+ *
37
+ * @property({ attribute: false })
38
+ * data: ExampleResponse | null = null;
39
+ * }
40
+ * ```
41
+ */
42
+ export declare class MarkupDataController<T = unknown> implements ReactiveController {
43
+ private readonly host;
44
+ constructor(host: DataHost);
45
+ hostConnected(): void;
46
+ /**
47
+ * Resolve the embedded payload. Returns `undefined` when there is nothing valid to read so the caller can leave `host.data` untouched.
48
+ */
49
+ private read;
50
+ /**
51
+ * 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.
52
+ */
53
+ private findInlineScript;
54
+ private parse;
55
+ }
56
+ export {};
57
+ //# sourceMappingURL=markup-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markup-data.d.ts","sourceRoot":"","sources":["../../src/utils/markup-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AAuBtE;;GAEG;AACH,UAAU,QAAS,SAAQ,sBAAsB,EAAE,WAAW;IAC7D,IAAI,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,oBAAoB,CAAC,CAAC,GAAG,OAAO,CAAE,YAAW,kBAAkB;IAC3E,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAW;gBAEpB,IAAI,EAAE,QAAQ;IAK1B,aAAa;IAYb;;OAEG;IACH,OAAO,CAAC,IAAI;IAKZ;;OAEG;IACH,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,KAAK;CAUb"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const ROXY_UI_VERSION = "0.4.1";
1
+ export declare const ROXY_UI_VERSION = "0.5.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.4.1",
3
+ "version": "0.5.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",
@@ -3,6 +3,7 @@ import { customElement, property, state } from 'lit/decorators.js';
3
3
  import { SIGN_GLYPH } from '../tokens/index.js';
4
4
  import type { AshtakavargaResponse } from '../types/index.js';
5
5
  import { baseStyles } from '../utils/base-styles.js';
6
+ import { MarkupDataController } from '../utils/markup-data.js';
6
7
 
7
8
  type Tab = 'sarva' | 'bhinna' | 'pinda';
8
9
 
@@ -194,6 +195,14 @@ export class RoxyAshtakavargaGrid extends LitElement {
194
195
  `,
195
196
  ];
196
197
 
198
+ constructor() {
199
+ super();
200
+ // Enables hydrating `data` from a direct-child
201
+ // <script type="application/json" class="roxy-data"> for server-rendered
202
+ // and cached consumers. The JavaScript `data` property still wins.
203
+ new MarkupDataController(this);
204
+ }
205
+
197
206
  @property({ attribute: false })
198
207
  data: AshtakavargaResponse | null = null;
199
208
 
@@ -6,6 +6,7 @@ import type {
6
6
  GetForecastResponse,
7
7
  } from '../types/index.js';
8
8
  import { baseStyles } from '../utils/base-styles.js';
9
+ import { MarkupDataController } from '../utils/markup-data.js';
9
10
 
10
11
  type BiorhythmData =
11
12
  | GetDailyBiorhythmResponse
@@ -111,6 +112,14 @@ export class RoxyBiorhythmChart extends LitElement {
111
112
  `,
112
113
  ];
113
114
 
115
+ constructor() {
116
+ super();
117
+ // Enables hydrating `data` from a direct-child
118
+ // <script type="application/json" class="roxy-data"> for server-rendered
119
+ // and cached consumers. The JavaScript `data` property still wins.
120
+ new MarkupDataController(this);
121
+ }
122
+
114
123
  @property({ attribute: false })
115
124
  data: BiorhythmData | null = null;
116
125
 
@@ -3,6 +3,7 @@ import { customElement, property } from 'lit/decorators.js';
3
3
  import { PLANET_GLYPH } from '../tokens/index.js';
4
4
  import type { GetChoghadiyaResponse } from '../types/index.js';
5
5
  import { baseStyles } from '../utils/base-styles.js';
6
+ import { MarkupDataController } from '../utils/markup-data.js';
6
7
  import { capitalize } from '../utils/string.js';
7
8
 
8
9
  type ChoghadiyaPeriod = GetChoghadiyaResponse['dayChoghadiya'][number];
@@ -132,6 +133,14 @@ export class RoxyChoghadiyaGrid extends LitElement {
132
133
  `,
133
134
  ];
134
135
 
136
+ constructor() {
137
+ super();
138
+ // Enables hydrating `data` from a direct-child
139
+ // <script type="application/json" class="roxy-data"> for server-rendered
140
+ // and cached consumers. The JavaScript `data` property still wins.
141
+ new MarkupDataController(this);
142
+ }
143
+
135
144
  @property({ attribute: false })
136
145
  data: GetChoghadiyaResponse | null = null;
137
146
 
@@ -7,6 +7,7 @@ import type {
7
7
  } from '../types/index.js';
8
8
  import { baseStyles } from '../utils/base-styles.js';
9
9
  import { formatNumber } from '../utils/format.js';
10
+ import { MarkupDataController } from '../utils/markup-data.js';
10
11
 
11
12
  type CompatibilityData =
12
13
  | CalculateCompatibilityResponse
@@ -108,6 +109,14 @@ export class RoxyCompatibilityCard extends LitElement {
108
109
  `,
109
110
  ];
110
111
 
112
+ constructor() {
113
+ super();
114
+ // Enables hydrating `data` from a direct-child
115
+ // <script type="application/json" class="roxy-data"> for server-rendered
116
+ // and cached consumers. The JavaScript `data` property still wins.
117
+ new MarkupDataController(this);
118
+ }
119
+
111
120
  @property({ attribute: false })
112
121
  data: CompatibilityData | null = null;
113
122
 
@@ -7,6 +7,7 @@ import type {
7
7
  } from '../types/index.js';
8
8
  import { baseStyles } from '../utils/base-styles.js';
9
9
  import { formatNumber } from '../utils/format.js';
10
+ import { MarkupDataController } from '../utils/markup-data.js';
10
11
 
11
12
  type DashaData =
12
13
  | GetCurrentDashaResponse
@@ -152,6 +153,14 @@ export class RoxyDashaTimeline extends LitElement {
152
153
  `,
153
154
  ];
154
155
 
156
+ constructor() {
157
+ super();
158
+ // Enables hydrating `data` from a direct-child
159
+ // <script type="application/json" class="roxy-data"> for server-rendered
160
+ // and cached consumers. The JavaScript `data` property still wins.
161
+ new MarkupDataController(this);
162
+ }
163
+
155
164
  @property({ attribute: false })
156
165
  data: DashaData | null = null;
157
166
 
@@ -1,6 +1,7 @@
1
1
  import { css, html, LitElement, nothing, type TemplateResult } from 'lit';
2
2
  import { customElement, property } from 'lit/decorators.js';
3
3
  import { baseStyles } from '../utils/base-styles.js';
4
+ import { MarkupDataController } from '../utils/markup-data.js';
4
5
  import { humanize } from '../utils/string.js';
5
6
 
6
7
  /**
@@ -134,6 +135,14 @@ export class RoxyData extends LitElement {
134
135
  `,
135
136
  ];
136
137
 
138
+ constructor() {
139
+ super();
140
+ // Enables hydrating `data` from a direct-child
141
+ // <script type="application/json" class="roxy-data"> for server-rendered
142
+ // and cached consumers. The JavaScript `data` property still wins.
143
+ new MarkupDataController(this);
144
+ }
145
+
137
146
  @property({ attribute: false })
138
147
  data: Json = null;
139
148
 
@@ -11,6 +11,7 @@ import {
11
11
  toKundliViewModel,
12
12
  } from '../utils/kundli-render.js';
13
13
  import { kundliStyles } from '../utils/kundli-styles.js';
14
+ import { MarkupDataController } from '../utils/markup-data.js';
14
15
 
15
16
  /**
16
17
  * Divisional chart renderer (D2-D60). Accepts a DivisionalChartResponse and
@@ -65,6 +66,14 @@ export class RoxyDivisionalChart extends LitElement {
65
66
  `,
66
67
  ];
67
68
 
69
+ constructor() {
70
+ super();
71
+ // Enables hydrating `data` from a direct-child
72
+ // <script type="application/json" class="roxy-data"> for server-rendered
73
+ // and cached consumers. The JavaScript `data` property still wins.
74
+ new MarkupDataController(this);
75
+ }
76
+
68
77
  @property({ attribute: false })
69
78
  data: DivisionalChartResponse | null = null;
70
79
 
@@ -6,6 +6,7 @@ import type {
6
6
  SadhesatiResponse,
7
7
  } from '../types/index.js';
8
8
  import { baseStyles } from '../utils/base-styles.js';
9
+ import { MarkupDataController } from '../utils/markup-data.js';
9
10
 
10
11
  type DoshaData = ManglikResponse | KalsarpaResponse | SadhesatiResponse;
11
12
 
@@ -114,6 +115,14 @@ export class RoxyDoshaCard extends LitElement {
114
115
  `,
115
116
  ];
116
117
 
118
+ constructor() {
119
+ super();
120
+ // Enables hydrating `data` from a direct-child
121
+ // <script type="application/json" class="roxy-data"> for server-rendered
122
+ // and cached consumers. The JavaScript `data` property still wins.
123
+ new MarkupDataController(this);
124
+ }
125
+
117
126
  @property({ attribute: false })
118
127
  data: DoshaData | null = null;
119
128
 
@@ -3,6 +3,7 @@ import { customElement, property } from 'lit/decorators.js';
3
3
  import type { CompatibilityResponse } from '../types/index.js';
4
4
  import { baseStyles } from '../utils/base-styles.js';
5
5
  import { formatNumber, formatPercent } from '../utils/format.js';
6
+ import { MarkupDataController } from '../utils/markup-data.js';
6
7
 
7
8
  const STANDARD_CATEGORIES = [
8
9
  'Varna',
@@ -146,6 +147,14 @@ export class RoxyGunaMilan extends LitElement {
146
147
  `,
147
148
  ];
148
149
 
150
+ constructor() {
151
+ super();
152
+ // Enables hydrating `data` from a direct-child
153
+ // <script type="application/json" class="roxy-data"> for server-rendered
154
+ // and cached consumers. The JavaScript `data` property still wins.
155
+ new MarkupDataController(this);
156
+ }
157
+
149
158
  @property({ attribute: false })
150
159
  data: CompatibilityResponse | null = null;
151
160
 
@@ -10,6 +10,7 @@ import type {
10
10
  LookupHexagramResponse,
11
11
  } from '../types/index.js';
12
12
  import { baseStyles } from '../utils/base-styles.js';
13
+ import { MarkupDataController } from '../utils/markup-data.js';
13
14
 
14
15
  type HexagramData =
15
16
  | GetHexagramResponse
@@ -136,6 +137,14 @@ export class RoxyHexagram extends LitElement {
136
137
  `,
137
138
  ];
138
139
 
140
+ constructor() {
141
+ super();
142
+ // Enables hydrating `data` from a direct-child
143
+ // <script type="application/json" class="roxy-data"> for server-rendered
144
+ // and cached consumers. The JavaScript `data` property still wins.
145
+ new MarkupDataController(this);
146
+ }
147
+
139
148
  @property({ attribute: false })
140
149
  data: HexagramData | null = null;
141
150
 
@@ -7,6 +7,7 @@ import type {
7
7
  GetWeeklyHoroscopeResponse,
8
8
  } from '../types/index.js';
9
9
  import { baseStyles } from '../utils/base-styles.js';
10
+ import { MarkupDataController } from '../utils/markup-data.js';
10
11
  import { capitalize } from '../utils/string.js';
11
12
 
12
13
  type HoroscopeData =
@@ -147,6 +148,14 @@ export class RoxyHoroscopeCard extends LitElement {
147
148
  `,
148
149
  ];
149
150
 
151
+ constructor() {
152
+ super();
153
+ // Enables hydrating `data` from a direct-child
154
+ // <script type="application/json" class="roxy-data"> for server-rendered
155
+ // and cached consumers. The JavaScript `data` property still wins.
156
+ new MarkupDataController(this);
157
+ }
158
+
150
159
  @property({ attribute: false })
151
160
  data: HoroscopeData | null = null;
152
161
 
@@ -3,6 +3,7 @@ import { customElement, property, state } from 'lit/decorators.js';
3
3
  import type { KpChartResponse } from '../types/index.js';
4
4
  import { baseStyles } from '../utils/base-styles.js';
5
5
  import { formatNumber } from '../utils/format.js';
6
+ import { MarkupDataController } from '../utils/markup-data.js';
6
7
 
7
8
  type Tab = 'planets' | 'cusps';
8
9
 
@@ -123,6 +124,14 @@ export class RoxyKpChart extends LitElement {
123
124
  `,
124
125
  ];
125
126
 
127
+ constructor() {
128
+ super();
129
+ // Enables hydrating `data` from a direct-child
130
+ // <script type="application/json" class="roxy-data"> for server-rendered
131
+ // and cached consumers. The JavaScript `data` property still wins.
132
+ new MarkupDataController(this);
133
+ }
134
+
126
135
  @property({ attribute: false })
127
136
  data: KpChartResponse | null = null;
128
137
 
@@ -3,6 +3,7 @@ import { customElement, property } from 'lit/decorators.js';
3
3
  import type { KpPlanetsResponse } from '../types/index.js';
4
4
  import { baseStyles } from '../utils/base-styles.js';
5
5
  import { formatNumber } from '../utils/format.js';
6
+ import { MarkupDataController } from '../utils/markup-data.js';
6
7
 
7
8
  /**
8
9
  * KP planets table with sub-lord and sub-sub-lord columns. Renders
@@ -74,6 +75,14 @@ export class RoxyKpPlanetsTable extends LitElement {
74
75
  `,
75
76
  ];
76
77
 
78
+ constructor() {
79
+ super();
80
+ // Enables hydrating `data` from a direct-child
81
+ // <script type="application/json" class="roxy-data"> for server-rendered
82
+ // and cached consumers. The JavaScript `data` property still wins.
83
+ new MarkupDataController(this);
84
+ }
85
+
77
86
  @property({ attribute: false })
78
87
  data: KpPlanetsResponse | null = null;
79
88
 
@@ -2,6 +2,7 @@ import { css, html, LitElement, nothing } from 'lit';
2
2
  import { customElement, property } from 'lit/decorators.js';
3
3
  import type { KpRulingPlanetsResponse } from '../types/index.js';
4
4
  import { baseStyles } from '../utils/base-styles.js';
5
+ import { MarkupDataController } from '../utils/markup-data.js';
5
6
 
6
7
  /**
7
8
  * KP ruling planets card. Renders /vedic-astrology/kp/ruling-planets: the day
@@ -113,6 +114,14 @@ export class RoxyKpRulingPlanets extends LitElement {
113
114
  `,
114
115
  ];
115
116
 
117
+ constructor() {
118
+ super();
119
+ // Enables hydrating `data` from a direct-child
120
+ // <script type="application/json" class="roxy-data"> for server-rendered
121
+ // and cached consumers. The JavaScript `data` property still wins.
122
+ new MarkupDataController(this);
123
+ }
124
+
116
125
  @property({ attribute: false })
117
126
  data: KpRulingPlanetsResponse | null = null;
118
127
 
@@ -8,6 +8,7 @@ import type {
8
8
  } from '../types/index.js';
9
9
  import { baseStyles } from '../utils/base-styles.js';
10
10
  import { formatNumber } from '../utils/format.js';
11
+ import { MarkupDataController } from '../utils/markup-data.js';
11
12
 
12
13
  type MoonPhaseData =
13
14
  | GetCurrentMoonPhaseResponse
@@ -109,6 +110,14 @@ export class RoxyMoonPhase extends LitElement {
109
110
  `,
110
111
  ];
111
112
 
113
+ constructor() {
114
+ super();
115
+ // Enables hydrating `data` from a direct-child
116
+ // <script type="application/json" class="roxy-data"> for server-rendered
117
+ // and cached consumers. The JavaScript `data` property still wins.
118
+ new MarkupDataController(this);
119
+ }
120
+
112
121
  @property({ attribute: false })
113
122
  data: MoonPhaseData | null = null;
114
123
 
@@ -2,6 +2,7 @@ import { css, html, LitElement, nothing } from 'lit';
2
2
  import { customElement, property } from 'lit/decorators.js';
3
3
  import type { NakshatraResponse } from '../types/index.js';
4
4
  import { baseStyles } from '../utils/base-styles.js';
5
+ import { MarkupDataController } from '../utils/markup-data.js';
5
6
 
6
7
  /**
7
8
  * Nakshatra reference card. Renders /vedic-astrology/nakshatras/{id}: the
@@ -91,6 +92,14 @@ export class RoxyNakshatraCard extends LitElement {
91
92
  `,
92
93
  ];
93
94
 
95
+ constructor() {
96
+ super();
97
+ // Enables hydrating `data` from a direct-child
98
+ // <script type="application/json" class="roxy-data"> for server-rendered
99
+ // and cached consumers. The JavaScript `data` property still wins.
100
+ new MarkupDataController(this);
101
+ }
102
+
94
103
  @property({ attribute: false })
95
104
  data: NakshatraResponse | null = null;
96
105
 
@@ -20,6 +20,7 @@ import {
20
20
  formatNumber,
21
21
  normalizeAspect,
22
22
  } from '../utils/format.js';
23
+ import { MarkupDataController } from '../utils/markup-data.js';
23
24
  import { capitalize } from '../utils/string.js';
24
25
 
25
26
  type PlanetEntry = NatalChartResponse['planets'][number];
@@ -382,6 +383,14 @@ export class RoxyNatalChart extends LitElement {
382
383
  `,
383
384
  ];
384
385
 
386
+ constructor() {
387
+ super();
388
+ // Enables hydrating `data` from a direct-child
389
+ // <script type="application/json" class="roxy-data"> for server-rendered
390
+ // and cached consumers. The JavaScript `data` property still wins.
391
+ new MarkupDataController(this);
392
+ }
393
+
385
394
  @property({ attribute: false })
386
395
  data: NatalChartResponse | null = null;
387
396
 
@@ -7,6 +7,7 @@ import type {
7
7
  GenerateNumerologyChartResponse,
8
8
  } from '../types/index.js';
9
9
  import { baseStyles } from '../utils/base-styles.js';
10
+ import { MarkupDataController } from '../utils/markup-data.js';
10
11
  import { humanize } from '../utils/string.js';
11
12
 
12
13
  type NumerologyData =
@@ -122,6 +123,14 @@ export class RoxyNumerologyCard extends LitElement {
122
123
  `,
123
124
  ];
124
125
 
126
+ constructor() {
127
+ super();
128
+ // Enables hydrating `data` from a direct-child
129
+ // <script type="application/json" class="roxy-data"> for server-rendered
130
+ // and cached consumers. The JavaScript `data` property still wins.
131
+ new MarkupDataController(this);
132
+ }
133
+
125
134
  @property({ attribute: false })
126
135
  data: NumerologyData | null = null;
127
136
 
@@ -6,6 +6,7 @@ import type {
6
6
  } from '../types/index.js';
7
7
  import { baseStyles } from '../utils/base-styles.js';
8
8
  import { formatDate, formatTime, formatTimeRange } from '../utils/format.js';
9
+ import { MarkupDataController } from '../utils/markup-data.js';
9
10
 
10
11
  type PanchangData = GetBasicPanchangResponse | GetDetailedPanchangResponse;
11
12
  type PanchangTime = GetDetailedPanchangResponse['rahuKaal'];
@@ -76,6 +77,14 @@ export class RoxyPanchangTable extends LitElement {
76
77
  `,
77
78
  ];
78
79
 
80
+ constructor() {
81
+ super();
82
+ // Enables hydrating `data` from a direct-child
83
+ // <script type="application/json" class="roxy-data"> for server-rendered
84
+ // and cached consumers. The JavaScript `data` property still wins.
85
+ new MarkupDataController(this);
86
+ }
87
+
79
88
  @property({ attribute: false })
80
89
  data: PanchangData | null = null;
81
90
 
@@ -4,6 +4,7 @@ import { PLANET_GLYPH } from '../tokens/index.js';
4
4
  import type { ShadbalaResponse } from '../types/index.js';
5
5
  import { baseStyles } from '../utils/base-styles.js';
6
6
  import { formatNumber } from '../utils/format.js';
7
+ import { MarkupDataController } from '../utils/markup-data.js';
7
8
  import { capitalize } from '../utils/string.js';
8
9
 
9
10
  type Planet = ShadbalaResponse['planets'][number];
@@ -191,6 +192,14 @@ export class RoxyShadbalaTable extends LitElement {
191
192
  `,
192
193
  ];
193
194
 
195
+ constructor() {
196
+ super();
197
+ // Enables hydrating `data` from a direct-child
198
+ // <script type="application/json" class="roxy-data"> for server-rendered
199
+ // and cached consumers. The JavaScript `data` property still wins.
200
+ new MarkupDataController(this);
201
+ }
202
+
194
203
  @property({ attribute: false })
195
204
  data: ShadbalaResponse | null = null;
196
205
 
@@ -12,6 +12,7 @@ import {
12
12
  formatNumber,
13
13
  normalizeAspect,
14
14
  } from '../utils/format.js';
15
+ import { MarkupDataController } from '../utils/markup-data.js';
15
16
  import { capitalize } from '../utils/string.js';
16
17
 
17
18
  type PlanetEntry = NatalChartResponse['planets'][number];
@@ -224,6 +225,14 @@ export class RoxySynastryChart extends LitElement {
224
225
  `,
225
226
  ];
226
227
 
228
+ constructor() {
229
+ super();
230
+ // Enables hydrating `data` from a direct-child
231
+ // <script type="application/json" class="roxy-data"> for server-rendered
232
+ // and cached consumers. The JavaScript `data` property still wins.
233
+ new MarkupDataController(this);
234
+ }
235
+
227
236
  @property({ attribute: false })
228
237
  data: SynastryWithPlanets | null = null;
229
238
 
@@ -2,6 +2,7 @@ import { css, html, LitElement, nothing } from 'lit';
2
2
  import { customElement, property, state } from 'lit/decorators.js';
3
3
  import type { GetCardResponse, GetDailyCardResponse } from '../types/index.js';
4
4
  import { baseStyles } from '../utils/base-styles.js';
5
+ import { MarkupDataController } from '../utils/markup-data.js';
5
6
 
6
7
  type TarotData = GetCardResponse | GetDailyCardResponse;
7
8
 
@@ -106,6 +107,14 @@ export class RoxyTarotCard extends LitElement {
106
107
  `,
107
108
  ];
108
109
 
110
+ constructor() {
111
+ super();
112
+ // Enables hydrating `data` from a direct-child
113
+ // <script type="application/json" class="roxy-data"> for server-rendered
114
+ // and cached consumers. The JavaScript `data` property still wins.
115
+ new MarkupDataController(this);
116
+ }
117
+
109
118
  @property({ attribute: false })
110
119
  data: TarotData | null = null;
111
120
 
@@ -9,6 +9,7 @@ import type {
9
9
  DrawCardsResponse,
10
10
  } from '../types/index.js';
11
11
  import { baseStyles } from '../utils/base-styles.js';
12
+ import { MarkupDataController } from '../utils/markup-data.js';
12
13
 
13
14
  type TarotSpreadData =
14
15
  | CastThreeCardResponse
@@ -135,6 +136,14 @@ export class RoxyTarotSpread extends LitElement {
135
136
  `,
136
137
  ];
137
138
 
139
+ constructor() {
140
+ super();
141
+ // Enables hydrating `data` from a direct-child
142
+ // <script type="application/json" class="roxy-data"> for server-rendered
143
+ // and cached consumers. The JavaScript `data` property still wins.
144
+ new MarkupDataController(this);
145
+ }
146
+
138
147
  @property({ attribute: false })
139
148
  data: TarotSpreadData | null = null;
140
149
 
@@ -4,6 +4,7 @@ import { PLANET_GLYPH, SIGN_GLYPH } from '../tokens/index.js';
4
4
  import type { TransitsResponse } from '../types/index.js';
5
5
  import { baseStyles } from '../utils/base-styles.js';
6
6
  import { formatDate, formatNumber, formatTime } from '../utils/format.js';
7
+ import { MarkupDataController } from '../utils/markup-data.js';
7
8
  import { capitalize } from '../utils/string.js';
8
9
 
9
10
  /**
@@ -214,6 +215,14 @@ export class RoxyTransitsTable extends LitElement {
214
215
  `,
215
216
  ];
216
217
 
218
+ constructor() {
219
+ super();
220
+ // Enables hydrating `data` from a direct-child
221
+ // <script type="application/json" class="roxy-data"> for server-rendered
222
+ // and cached consumers. The JavaScript `data` property still wins.
223
+ new MarkupDataController(this);
224
+ }
225
+
217
226
  @property({ attribute: false })
218
227
  data: TransitsResponse | null = null;
219
228
 
@@ -10,6 +10,7 @@ import {
10
10
  toKundliViewModel,
11
11
  } from '../utils/kundli-render.js';
12
12
  import { kundliStyles } from '../utils/kundli-styles.js';
13
+ import { MarkupDataController } from '../utils/markup-data.js';
13
14
 
14
15
  /**
15
16
  * Vedic kundli (D1 Rashi chart). Pass `data` from /vedic-astrology/birth-chart.
@@ -29,6 +30,14 @@ import { kundliStyles } from '../utils/kundli-styles.js';
29
30
  export class RoxyVedicKundli extends LitElement {
30
31
  static styles = [baseStyles, kundliStyles];
31
32
 
33
+ constructor() {
34
+ super();
35
+ // Enables hydrating `data` from a direct-child
36
+ // <script type="application/json" class="roxy-data"> for server-rendered
37
+ // and cached consumers. The JavaScript `data` property still wins.
38
+ new MarkupDataController(this);
39
+ }
40
+
32
41
  @property({ attribute: false })
33
42
  data: BirthChartResponse | null = null;
34
43