@roxyapi/ui-react 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +35 -52
- package/README.md +99 -41
- package/dist/components/ashtakavarga-grid.js.map +1 -1
- package/dist/components/biorhythm-chart.js.map +1 -1
- package/dist/components/bodygraph.d.ts +9 -0
- package/dist/components/bodygraph.d.ts.map +1 -0
- package/dist/components/bodygraph.js +2 -0
- package/dist/components/bodygraph.js.map +7 -0
- package/dist/components/choghadiya-grid.js.map +1 -1
- package/dist/components/compatibility-card.js.map +1 -1
- package/dist/components/dasha-timeline.js.map +1 -1
- package/dist/components/data.js.map +1 -1
- package/dist/components/divisional-chart.js.map +1 -1
- package/dist/components/dosha-card.js.map +1 -1
- package/dist/components/endpoint-form.js.map +1 -1
- package/dist/components/forecast-timeline.d.ts +9 -0
- package/dist/components/forecast-timeline.d.ts.map +1 -0
- package/dist/components/forecast-timeline.js +2 -0
- package/dist/components/forecast-timeline.js.map +7 -0
- package/dist/components/guna-milan.js.map +1 -1
- package/dist/components/hexagram.js.map +1 -1
- package/dist/components/horoscope-card.js.map +1 -1
- package/dist/components/kp-chart.js.map +1 -1
- package/dist/components/kp-planets-table.js.map +1 -1
- package/dist/components/kp-ruling-planets.js.map +1 -1
- package/dist/components/location-search.js.map +1 -1
- package/dist/components/moon-phase.js.map +1 -1
- package/dist/components/nakshatra-card.js.map +1 -1
- package/dist/components/natal-chart.js.map +1 -1
- package/dist/components/numerology-card.js.map +1 -1
- package/dist/components/panchang-table.js.map +1 -1
- package/dist/components/shadbala-table.js.map +1 -1
- package/dist/components/synastry-chart.js.map +1 -1
- package/dist/components/tarot-card.js.map +1 -1
- package/dist/components/tarot-spread.js.map +1 -1
- package/dist/components/transits-table.js.map +1 -1
- package/dist/components/vedic-kundli.js.map +1 -1
- package/dist/components/vedic-planets-table.js.map +1 -1
- package/dist/components/western-planets-table.js.map +1 -1
- package/dist/components/yoga-list.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/load-ui.d.ts +1 -1
- package/dist/load-ui.js +1 -1
- package/dist/load-ui.js.map +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -8,7 +8,7 @@ Live preview: <https://roxyapi.github.io/ui/>. Source of truth for component typ
|
|
|
8
8
|
|
|
9
9
|
## Identity
|
|
10
10
|
|
|
11
|
-
Roxy UI is the official web component library for the RoxyAPI catalog. Components and helpers cover Western astrology, Vedic astrology, numerology, tarot, biorhythm, I Ching, crystals, dreams, angel numbers, with the location helper for geocoding. New endpoints regenerate component types automatically.
|
|
11
|
+
Roxy UI is the official web component library for the RoxyAPI catalog. Components and helpers cover Western astrology, Vedic astrology, numerology, tarot, Human Design, forecast, biorhythm, I Ching, crystals, dreams, angel numbers, with the location helper for geocoding. New endpoints regenerate component types automatically.
|
|
12
12
|
|
|
13
13
|
## Decision tree for picking a component
|
|
14
14
|
|
|
@@ -32,6 +32,8 @@ Map the natural-language request to a component first; fall back to the table be
|
|
|
32
32
|
| "life path number", "expression number", "personal year", "numerology chart" | `<roxy-numerology-card>` |
|
|
33
33
|
| "draw a tarot card", "card of the day", "card meaning" | `<roxy-tarot-card>` |
|
|
34
34
|
| "tarot reading", "three-card spread", "Celtic Cross", "yes or no tarot" | `<roxy-tarot-spread>` |
|
|
35
|
+
| "Human Design chart", "bodygraph", "my type and authority", "defined centers", "channels and gates" | `<roxy-bodygraph>` |
|
|
36
|
+
| "forecast", "what is coming up", "upcoming transits and events", "timeline of my year" | `<roxy-forecast-timeline>` |
|
|
35
37
|
| "biorhythm", "physical/emotional/intellectual cycle", "critical days" | `<roxy-biorhythm-chart>` |
|
|
36
38
|
| "I Ching", "hexagram", "cast the coins", "Book of Changes" | `<roxy-hexagram>` |
|
|
37
39
|
| "moon phase", "moon calendar", "next full moon", "current moon" | `<roxy-moon-phase>` |
|
|
@@ -72,6 +74,8 @@ Use the table below for the formal endpoint to component mapping.
|
|
|
72
74
|
| `<roxy-numerology-card>` | Numerology | POST /numerology/{life-path,expression,personal-year,chart} | Life path, expression, personal year, full chart |
|
|
73
75
|
| `<roxy-tarot-card>` | Tarot | GET /tarot/cards/{id}, POST /tarot/daily | Single card with upright and reversed flip |
|
|
74
76
|
| `<roxy-tarot-spread>` | Tarot | POST /tarot/spreads/{three-card,celtic-cross,love}, /tarot/yes-no, /tarot/draw | Spreads with positions and reading |
|
|
77
|
+
| `<roxy-bodygraph>` | Human Design | POST /human-design/bodygraph | Nine-center chart with defined and open centers, active channels, gates, and a type and authority summary |
|
|
78
|
+
| `<roxy-forecast-timeline>` | Forecast | POST /forecast/timeline | Date-grouped events across Western, Vedic, and biorhythm domains, weighted by significance |
|
|
75
79
|
| `<roxy-biorhythm-chart>` | Biorhythm | POST /biorhythm/{daily,forecast,critical-days} | Daily bars, forecast cycle lines, critical days |
|
|
76
80
|
| `<roxy-hexagram>` | I Ching | GET /iching/hexagrams/{number}, /iching/cast, POST /iching/daily, /iching/daily/cast | Hexagram with trigrams, judgment, image, changing lines |
|
|
77
81
|
| `<roxy-endpoint-form>` | Helper | Any endpoint via x-roxy-ui hints | Schema-driven form, emits roxy-submit |
|
|
@@ -116,16 +120,13 @@ const { data: chart } = await roxy.astrology.generateNatalChart({
|
|
|
116
120
|
|
|
117
121
|
Every chart endpoint accepts `timezone` as either a decimal-hour offset (`5.5` for IST, `-5` for EST) or an IANA name (`'Asia/Kolkata'`, `'America/New_York'`). The decimal form is what `/location/search` returns; the IANA form is correct over DST boundaries. Pick one and stay consistent in a single integration. Mixing them does not break the API but makes the bug surface area larger.
|
|
118
122
|
|
|
119
|
-
### 4.
|
|
123
|
+
### 4. API key in the browser
|
|
120
124
|
|
|
121
|
-
|
|
125
|
+
Keys are server side only. Call `createRoxy(process.env.ROXY_API_KEY!)` on your server (Node, Bun, Hono, Next.js route handlers, Workers, Edge functions), then send the response, not the key, to the component. Never ship the key in a client bundle. Browser-safe keys for direct client-side embedding are on the roadmap, not yet available.
|
|
122
126
|
|
|
123
127
|
```ts
|
|
124
|
-
// Server
|
|
128
|
+
// Server side only
|
|
125
129
|
const roxy = createRoxy(process.env.ROXY_API_KEY!);
|
|
126
|
-
|
|
127
|
-
// Browser (widgets auto-mount): publishable key
|
|
128
|
-
<div data-roxy-widget="natal-chart" data-publishable-key="pk_live_xxx" ...></div>
|
|
129
130
|
```
|
|
130
131
|
|
|
131
132
|
### 5. Missing `'use client'` in Next.js App Router
|
|
@@ -190,30 +191,30 @@ import type { NatalChartResponse } from '@roxyapi/sdk';
|
|
|
190
191
|
|
|
191
192
|
### Pattern 1: vanilla HTML, no build step
|
|
192
193
|
|
|
194
|
+
Fetch on your server with the secret key, then inline the response into the component as a child `<script type="application/json" class="roxy-data">`. The component reads it on load. No key in the browser.
|
|
195
|
+
|
|
193
196
|
```html
|
|
194
197
|
<script
|
|
195
198
|
src="https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn/roxy-ui.js"
|
|
196
199
|
crossorigin="anonymous"
|
|
197
200
|
></script>
|
|
198
201
|
|
|
199
|
-
<roxy-natal-chart
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const { data } = await roxy.astrology.generateNatalChart({
|
|
205
|
-
body: { date: '1990-01-15', time: '14:30:00', latitude: 19.07, longitude: 72.88, timezone: 5.5 },
|
|
206
|
-
});
|
|
207
|
-
document.getElementById('chart').data = data;
|
|
208
|
-
</script>
|
|
202
|
+
<roxy-natal-chart>
|
|
203
|
+
<script type="application/json" class="roxy-data">
|
|
204
|
+
{ "planets": [ ... ], "houses": [ ... ], "aspects": [ ... ] }
|
|
205
|
+
</script>
|
|
206
|
+
</roxy-natal-chart>
|
|
209
207
|
```
|
|
210
208
|
|
|
211
|
-
|
|
209
|
+
Setting the JavaScript `data` property always wins over the inlined JSON, so the same element also drives dynamic pages.
|
|
210
|
+
|
|
211
|
+
### Pattern 2: React, interactive
|
|
212
|
+
|
|
213
|
+
`<RoxyLocationSearch>` runs in the browser. On select, call your own route, which holds the secret key, and set the returned data on the chart. The key never reaches the client.
|
|
212
214
|
|
|
213
215
|
```tsx
|
|
214
216
|
'use client';
|
|
215
217
|
|
|
216
|
-
import { createRoxy } from '@roxyapi/sdk';
|
|
217
218
|
import {
|
|
218
219
|
RoxyNatalChart,
|
|
219
220
|
RoxyLocationSearch,
|
|
@@ -221,18 +222,18 @@ import {
|
|
|
221
222
|
} from '@roxyapi/ui-react';
|
|
222
223
|
import { useState } from 'react';
|
|
223
224
|
|
|
224
|
-
const roxy = createRoxy(process.env.NEXT_PUBLIC_ROXY_API_KEY!);
|
|
225
|
-
|
|
226
225
|
export function BirthChartView() {
|
|
227
226
|
const [chart, setChart] = useState<RoxyNatalChartProps['data']>(undefined);
|
|
228
227
|
|
|
229
228
|
const onLocationSelect = async (e: CustomEvent<{ latitude?: number; longitude?: number; timezone?: number | string }>) => {
|
|
230
229
|
const { latitude, longitude, timezone } = e.detail;
|
|
231
230
|
if (latitude == null || longitude == null) return;
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
// Your route calls roxy.astrology.generateNatalChart with the secret key.
|
|
232
|
+
const res = await fetch('/api/natal-chart', {
|
|
233
|
+
method: 'POST',
|
|
234
|
+
body: JSON.stringify({ date: '1990-01-15', time: '14:30:00', latitude, longitude, timezone }),
|
|
234
235
|
});
|
|
235
|
-
setChart(
|
|
236
|
+
setChart(await res.json());
|
|
236
237
|
};
|
|
237
238
|
|
|
238
239
|
return (
|
|
@@ -244,9 +245,11 @@ export function BirthChartView() {
|
|
|
244
245
|
}
|
|
245
246
|
```
|
|
246
247
|
|
|
248
|
+
For a static chart with no picker, fetch in a Server Component and pass `data` to a client component (Pattern 6).
|
|
249
|
+
|
|
247
250
|
### Pattern 3: schema-driven form
|
|
248
251
|
|
|
249
|
-
`<roxy-endpoint-form>` reads the OpenAPI spec and renders the inputs for any endpoint.
|
|
252
|
+
`<roxy-endpoint-form>` reads the OpenAPI spec and renders the inputs for any endpoint. On `roxy-submit`, POST the validated values to your own route, which calls the SDK with the secret key, then set the returned data on the target component.
|
|
250
253
|
|
|
251
254
|
```html
|
|
252
255
|
<roxy-endpoint-form
|
|
@@ -254,41 +257,21 @@ export function BirthChartView() {
|
|
|
254
257
|
method="POST"
|
|
255
258
|
submit-label="Generate kundli"
|
|
256
259
|
></roxy-endpoint-form>
|
|
260
|
+
<roxy-vedic-kundli chart-style="south"></roxy-vedic-kundli>
|
|
257
261
|
|
|
258
262
|
<script type="module">
|
|
259
|
-
import { createRoxy } from 'https://cdn.jsdelivr.net/npm/@roxyapi/sdk@latest/dist/factory.js';
|
|
260
|
-
const roxy = createRoxy('pk_live_xxx');
|
|
261
263
|
const form = document.querySelector('roxy-endpoint-form');
|
|
262
264
|
form.addEventListener('roxy-submit', async (e) => {
|
|
263
|
-
|
|
264
|
-
const
|
|
265
|
-
document.querySelector('roxy-vedic-kundli').data =
|
|
265
|
+
// Your route calls roxy.vedicAstrology.generateBirthChart with the secret key.
|
|
266
|
+
const res = await fetch('/api/kundli', { method: 'POST', body: JSON.stringify(e.detail.values) });
|
|
267
|
+
document.querySelector('roxy-vedic-kundli').data = await res.json();
|
|
266
268
|
});
|
|
267
269
|
</script>
|
|
268
270
|
```
|
|
269
271
|
|
|
270
|
-
### Pattern 4: widgets auto-mount (
|
|
271
|
-
|
|
272
|
-
Use a publishable key (`pk_live_*` or `pk_test_*`) for client-side embeds. Get one at <https://roxyapi.com/account>. Publishable keys are origin-restricted at the API gateway. Register the customer domain (e.g. `https://customer.com`) when creating the key, and the gateway will reject requests from any other origin. Never use a secret key in client-side code (secret keys are unprefixed and live server-side only).
|
|
273
|
-
|
|
274
|
-
```html
|
|
275
|
-
<script
|
|
276
|
-
src="https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn/widgets.js"
|
|
277
|
-
defer
|
|
278
|
-
></script>
|
|
279
|
-
|
|
280
|
-
<div
|
|
281
|
-
data-roxy-widget="natal-chart"
|
|
282
|
-
data-publishable-key="pk_live_xxx"
|
|
283
|
-
data-date="1990-01-15"
|
|
284
|
-
data-time="14:30:00"
|
|
285
|
-
data-latitude="19.07"
|
|
286
|
-
data-longitude="72.88"
|
|
287
|
-
data-timezone="5.5"
|
|
288
|
-
></div>
|
|
289
|
-
```
|
|
272
|
+
### Pattern 4: widgets auto-mount (coming soon)
|
|
290
273
|
|
|
291
|
-
|
|
274
|
+
A zero-wiring embed that reads `data-*` attributes and renders the matching component is on the roadmap. It needs browser-safe keys, which are not yet available. Until then, use Pattern 1 (inline JSON) for no-build pages.
|
|
292
275
|
|
|
293
276
|
### Pattern 5: MCP tool-call response
|
|
294
277
|
|
|
@@ -392,7 +375,7 @@ Every visible aspect of the chart is driven by `--roxy-*` CSS custom properties
|
|
|
392
375
|
|
|
393
376
|
## Domain ordering
|
|
394
377
|
|
|
395
|
-
When listing domains in user-visible copy, use the canonical order: Western astrology, Vedic astrology, numerology, tarot, biorhythm, I Ching, crystals, dreams, angel numbers. Location is utility, not a selling domain.
|
|
378
|
+
When listing domains in user-visible copy, use the canonical order: Western astrology, Vedic astrology, numerology, tarot, human design, forecast, biorhythm, I Ching, crystals, dreams, angel numbers. Location is utility, not a selling domain.
|
|
396
379
|
|
|
397
380
|
## What not to ship
|
|
398
381
|
|
package/README.md
CHANGED
|
@@ -42,6 +42,14 @@ Light, dark, your brand. Override one CSS variable and every component updates.
|
|
|
42
42
|
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/vedic-kundli-dark.png" alt="Vedic kundli, dark mode">
|
|
43
43
|
</td>
|
|
44
44
|
</tr>
|
|
45
|
+
<tr>
|
|
46
|
+
<td width="50%" align="center">
|
|
47
|
+
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/bodygraph-light.png" alt="Human Design bodygraph, light mode">
|
|
48
|
+
</td>
|
|
49
|
+
<td width="50%" align="center">
|
|
50
|
+
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/bodygraph-dark.png" alt="Human Design bodygraph, dark mode">
|
|
51
|
+
</td>
|
|
52
|
+
</tr>
|
|
45
53
|
</table>
|
|
46
54
|
|
|
47
55
|
```css
|
|
@@ -148,6 +156,25 @@ Every chart, table, and card adapts to light and dark automatically. Hover any i
|
|
|
148
156
|
</tr>
|
|
149
157
|
</table>
|
|
150
158
|
|
|
159
|
+
### Human Design and forecast
|
|
160
|
+
|
|
161
|
+
<table>
|
|
162
|
+
<tr>
|
|
163
|
+
<td width="50%"><strong>Bodygraph</strong> · <code><roxy-bodygraph></code><br><sub>POST /human-design/bodygraph</sub><br>
|
|
164
|
+
<picture>
|
|
165
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/bodygraph-dark.png">
|
|
166
|
+
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/bodygraph-light.png" alt="Human Design bodygraph with nine centers defined and open, channels between activated gates, plus type, authority, and profile summary">
|
|
167
|
+
</picture>
|
|
168
|
+
</td>
|
|
169
|
+
<td width="50%"><strong>Forecast timeline</strong> · <code><roxy-forecast-timeline></code><br><sub>POST /forecast/timeline</sub><br>
|
|
170
|
+
<picture>
|
|
171
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/forecast-timeline-dark.png">
|
|
172
|
+
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/forecast-timeline-light.png" alt="Cross-domain forecast timeline of transits, ingresses, retrograde stations, and biorhythm critical days grouped by date and weighted by significance">
|
|
173
|
+
</picture>
|
|
174
|
+
</td>
|
|
175
|
+
</tr>
|
|
176
|
+
</table>
|
|
177
|
+
|
|
151
178
|
### Other domains
|
|
152
179
|
|
|
153
180
|
<table>
|
|
@@ -194,42 +221,24 @@ Tables, cards, forms, and helper components in the [live demo](https://roxyapi.g
|
|
|
194
221
|
|
|
195
222
|
## Start with one component
|
|
196
223
|
|
|
197
|
-
|
|
224
|
+
Fetch with the typed SDK, pass `data` to the component. No glue code.
|
|
198
225
|
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
crossorigin="anonymous"
|
|
203
|
-
defer
|
|
204
|
-
></script>
|
|
205
|
-
<roxy-natal-chart id="chart"></roxy-natal-chart>
|
|
206
|
-
<script type="module">
|
|
207
|
-
import { createRoxy } from 'https://cdn.jsdelivr.net/npm/@roxyapi/sdk@latest/dist/factory.js';
|
|
208
|
-
const roxy = createRoxy('YOUR_API_KEY');
|
|
209
|
-
const { data } = await roxy.astrology.generateNatalChart({
|
|
210
|
-
body: { date: '1990-01-15', time: '14:30:00', latitude: 19.07, longitude: 72.88, timezone: 5.5 },
|
|
211
|
-
});
|
|
212
|
-
document.getElementById('chart').data = data;
|
|
213
|
-
</script>
|
|
214
|
-
```
|
|
226
|
+
```tsx
|
|
227
|
+
import { createRoxy } from '@roxyapi/sdk';
|
|
228
|
+
import { RoxyHoroscopeCard } from '@roxyapi/ui-react';
|
|
215
229
|
|
|
216
|
-
|
|
230
|
+
const roxy = createRoxy(process.env.ROXY_API_KEY!);
|
|
217
231
|
|
|
218
|
-
|
|
232
|
+
const { data } = await roxy.astrology.getDailyHoroscope({ path: { sign: 'aries' } });
|
|
219
233
|
|
|
220
|
-
|
|
221
|
-
<roxy-vedic-kundli id="kundli" chart-style="south"></roxy-vedic-kundli>
|
|
222
|
-
<script type="module">
|
|
223
|
-
import { createRoxy } from 'https://cdn.jsdelivr.net/npm/@roxyapi/sdk@latest/dist/factory.js';
|
|
224
|
-
const roxy = createRoxy('YOUR_API_KEY');
|
|
225
|
-
const { data } = await roxy.vedicAstrology.generateBirthChart({
|
|
226
|
-
body: { date: '1990-01-15', time: '14:30:00', latitude: 19.07, longitude: 72.88, timezone: 5.5 },
|
|
227
|
-
});
|
|
228
|
-
document.getElementById('kundli').data = data;
|
|
229
|
-
</script>
|
|
234
|
+
return <RoxyHoroscopeCard data={data} />;
|
|
230
235
|
```
|
|
231
236
|
|
|
232
|
-
|
|
237
|
+
Then expand into natal charts, kundli, dasha, tarot, and every other domain. The SDK returns `data`, the component renders it; the same pairing holds for all 32 components.
|
|
238
|
+
|
|
239
|
+
> **Pass `data`, not the envelope.** The SDK returns `{ data, error, request, response }`. Pass `data`, or the component renders `[object Object]`. This is the most common integration bug.
|
|
240
|
+
|
|
241
|
+
The key stays on your server. Vanilla HTML or a server-rendered page fetches the same way, then [inlines the JSON into the component](#server-rendered-no-javascript-wiring): no build step, no key in the browser. Try every component in the [live demo](https://roxyapi.github.io/ui/), each with Preview, Code, and shadcn tabs and a live color customizer.
|
|
233
242
|
|
|
234
243
|
## Install
|
|
235
244
|
|
|
@@ -279,7 +288,12 @@ Always call `/location/search` first. Every chart endpoint expects latitude, lon
|
|
|
279
288
|
|
|
280
289
|
Server-rendered and cached pages (WordPress, JSX SSR, static HTML) cannot always run JavaScript to set the `data` property per element. Render the response into a child `<script type="application/json" class="roxy-data">` on the server instead. The component reads it on load. No per-element script, no API key in the browser.
|
|
281
290
|
|
|
291
|
+
Load the bundle once anywhere on the page. It registers every `roxy-*` element, so every component on the page renders from that single tag.
|
|
292
|
+
|
|
282
293
|
```html
|
|
294
|
+
<!-- Once per page: defines every roxy-* element -->
|
|
295
|
+
<script src="https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn/roxy-ui.js" crossorigin="anonymous" defer></script>
|
|
296
|
+
|
|
283
297
|
<roxy-natal-chart>
|
|
284
298
|
<script type="application/json" class="roxy-data">
|
|
285
299
|
{ "planets": [ ... ], "houses": [ ... ], "aspects": [ ... ] }
|
|
@@ -431,7 +445,48 @@ const { data: cc } = await roxy.tarot.castCelticCross({
|
|
|
431
445
|
<RoxyTarotSpread data={cc} />
|
|
432
446
|
```
|
|
433
447
|
|
|
434
|
-
### 5.
|
|
448
|
+
### 5. Human Design (bodygraph)
|
|
449
|
+
|
|
450
|
+
The breakout 2026 self-knowledge category, computed from the same ephemeris as Western astrology plus the I Ching gate wheel and chakra-style centers. Self-discovery apps, dating and compatibility products, and AI coaching bots ship the full bodygraph first. No coordinates needed; Human Design uses the birth instant, not the observer location.
|
|
451
|
+
|
|
452
|
+
```tsx
|
|
453
|
+
import { RoxyBodygraph } from '@roxyapi/ui-react';
|
|
454
|
+
|
|
455
|
+
// Full bodygraph. The head term every Human Design app leads with ("human design chart").
|
|
456
|
+
// Type, strategy, authority, profile, the nine centers, channels, and every gate
|
|
457
|
+
// activation in one call. Pass the birth instant only, no latitude or longitude.
|
|
458
|
+
const { data: bodygraph } = await roxy.humanDesign.generateBodygraph({
|
|
459
|
+
body: { date: '1990-01-15', time: '14:30:00', timezone: 5.5 },
|
|
460
|
+
});
|
|
461
|
+
<RoxyBodygraph data={bodygraph} />
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
### 6. Forecast (transits, cross-domain timeline)
|
|
465
|
+
|
|
466
|
+
The first cross-domain, stateless forecast in the catalog: one call merges Western transits, Vedic Vimshottari dasha boundaries, and biorhythm critical days into a single significance-scored, time-ordered timeline. Forecast feeds, transit alerts, and timing tools are the buyers. Acquire on the high-volume `astrology transits` search, convert on the cross-domain timeline no competitor ships. No coordinates needed.
|
|
467
|
+
|
|
468
|
+
```tsx
|
|
469
|
+
import { RoxyForecastTimeline } from '@roxyapi/ui-react';
|
|
470
|
+
|
|
471
|
+
// Transit forecast. The demand leader. Western transit-to-natal aspects, sign
|
|
472
|
+
// ingresses, and retrograde stations over the window.
|
|
473
|
+
const { data: transits } = await roxy.forecast.forecastTransits({
|
|
474
|
+
body: { birthData: { date: '1990-01-15', time: '14:30:00', timezone: 5.5 } },
|
|
475
|
+
});
|
|
476
|
+
<RoxyForecastTimeline data={transits} />
|
|
477
|
+
|
|
478
|
+
// Cross-domain timeline. The same window merged with Vedic dasha boundaries and
|
|
479
|
+
// biorhythm critical days into one significance-scored timeline.
|
|
480
|
+
const { data: timeline } = await roxy.forecast.generateTimeline({
|
|
481
|
+
body: {
|
|
482
|
+
birthData: { date: '1990-01-15', time: '14:30:00', timezone: 5.5 },
|
|
483
|
+
domains: ['western', 'vedic', 'biorhythm'],
|
|
484
|
+
},
|
|
485
|
+
});
|
|
486
|
+
<RoxyForecastTimeline data={timeline} />
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
### 7. Biorhythm (daily, forecast)
|
|
435
490
|
|
|
436
491
|
Zero competition domain. Steady search volume with the top Google result being a static calculator page. Pure land-grab for wellness, productivity, sports, and couples apps.
|
|
437
492
|
|
|
@@ -452,7 +507,7 @@ const { data: forecast } = await roxy.biorhythm.getForecast({
|
|
|
452
507
|
<RoxyBiorhythmChart data={forecast} mode="forecast" />
|
|
453
508
|
```
|
|
454
509
|
|
|
455
|
-
###
|
|
510
|
+
### 8. I Ching (cast a reading, hexagram lookup)
|
|
456
511
|
|
|
457
512
|
Meditation apps, decision-making tools, and wisdom chatbots. `i ching API` and `hexagram API` are the keywords.
|
|
458
513
|
|
|
@@ -472,12 +527,13 @@ const { data: random } = await roxy.iching.getRandomHexagram();
|
|
|
472
527
|
|
|
473
528
|
## API keys
|
|
474
529
|
|
|
475
|
-
Get
|
|
530
|
+
Get a key at <https://roxyapi.com/account>.
|
|
531
|
+
|
|
532
|
+
Today every key is a **secret key**: use it server side only (Node, Bun, Hono, Next.js route handlers, Workers). Never commit it, never ship it in a client bundle. Fetch on your server and send the rendered response, not the key, to the browser. The [Start with one component](#start-with-one-component) section and the [framework recipes](#most-used-components-per-domain) show the pattern.
|
|
476
533
|
|
|
477
|
-
|
|
478
|
-
- **Publishable key** (`pk_live_*` / `pk_test_*`). Safe in browsers, locked to the origins you register on the key. Use with the widgets auto-mount script for WordPress, Shopify, static HTML, embed scenarios. The API gateway rejects requests from any origin not on the allowlist.
|
|
534
|
+
Set `ROXY_API_KEY` to your secret key in your server env for every SDK example on this page.
|
|
479
535
|
|
|
480
|
-
|
|
536
|
+
Browser-safe keys for direct client-side embedding are on the roadmap, not yet available. Until they ship, keep the fetch on your server.
|
|
481
537
|
|
|
482
538
|
## Distribution
|
|
483
539
|
|
|
@@ -487,7 +543,7 @@ For the SDK examples on this page, set `ROXY_API_KEY` to a secret key in your se
|
|
|
487
543
|
| npm `@roxyapi/ui-react` | `npmjs.com/package/@roxyapi/ui-react` |
|
|
488
544
|
| jsDelivr CDN (full bundle) | `cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn/roxy-ui.js` |
|
|
489
545
|
| jsDelivr CDN (per component) | `cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn/components/{name}.js` |
|
|
490
|
-
| Widgets auto-mount | `cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn/widgets.js` |
|
|
546
|
+
| Widgets auto-mount (with browser keys, coming soon) | `cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn/widgets.js` |
|
|
491
547
|
| shadcn registry | `npx shadcn@latest add https://cdn.jsdelivr.net/gh/RoxyAPI/ui@latest/registry/{name}.json` |
|
|
492
548
|
|
|
493
549
|
## Components
|
|
@@ -520,6 +576,8 @@ For the SDK examples on this page, set `ROXY_API_KEY` to a secret key in your se
|
|
|
520
576
|
| `<roxy-numerology-card>` | Numerology | POST /numerology/{life-path,expression,personal-year,chart} | Life path, expression, personal year, full chart |
|
|
521
577
|
| `<roxy-tarot-card>` | Tarot | GET /tarot/cards/{id}, POST /tarot/daily | Single card with upright and reversed flip |
|
|
522
578
|
| `<roxy-tarot-spread>` | Tarot | POST /tarot/spreads/{three-card,celtic-cross,love}, /tarot/yes-no, /tarot/draw | Spreads with positions and reading |
|
|
579
|
+
| `<roxy-bodygraph>` | Human Design | POST /human-design/bodygraph | Nine-center chart with defined and open centers, active channels, gates, and a type and authority summary |
|
|
580
|
+
| `<roxy-forecast-timeline>` | Forecast | POST /forecast/timeline | Date-grouped events across Western, Vedic, and biorhythm domains, weighted by significance |
|
|
523
581
|
| `<roxy-biorhythm-chart>` | Biorhythm | POST /biorhythm/{daily,forecast,critical-days} | Daily bars, forecast cycle lines, critical days |
|
|
524
582
|
| `<roxy-hexagram>` | I Ching | GET /iching/hexagrams/{number}, /iching/cast, POST /iching/daily, /iching/daily/cast | Hexagram with trigrams, judgment, image, changing lines |
|
|
525
583
|
| `<roxy-endpoint-form>` | Helper | Any endpoint via x-roxy-ui hints | Schema-driven form, emits roxy-submit |
|
|
@@ -559,7 +617,7 @@ roxy-natal-chart {
|
|
|
559
617
|
- Consistent response formats across every domain in the catalog.
|
|
560
618
|
- A11y zero violations enforced in CI.
|
|
561
619
|
- Tight per-component bundle budget enforced in CI.
|
|
562
|
-
- Coverage of the highest-demand endpoints across Western astrology, Vedic astrology, numerology, tarot, biorhythm, I Ching, plus helpers for location search and schema-driven forms.
|
|
620
|
+
- Coverage of the highest-demand endpoints across Western astrology, Vedic astrology, numerology, tarot, Human Design, forecast, biorhythm, I Ching, plus helpers for location search and schema-driven forms.
|
|
563
621
|
|
|
564
622
|
## Built for AI agents
|
|
565
623
|
|
|
@@ -735,7 +793,7 @@ Components ship in Shadow DOM for style isolation; Tailwind utilities are scoped
|
|
|
735
793
|
<details>
|
|
736
794
|
<summary><strong>What is the security model for API keys?</strong></summary>
|
|
737
795
|
|
|
738
|
-
|
|
796
|
+
Today keys are secret keys: they live server side only and grant full access, so never ship one in a client bundle. Fetch on your server and pass the rendered response, not the key, to the browser. Browser-safe keys with an origin allowlist for direct client-side embedding are on the roadmap and not yet available.
|
|
739
797
|
|
|
740
798
|
For CSP, allow `script-src https://cdn.jsdelivr.net` if loading the bundle from the CDN. Subresource Integrity hashes are available via the jsDelivr SRI API for any pinned version.
|
|
741
799
|
</details>
|
|
@@ -746,11 +804,11 @@ For CSP, allow `script-src https://cdn.jsdelivr.net` if loading the bundle from
|
|
|
746
804
|
Semver. Pre-1.0, minor bumps may include breaking changes (we will note them in the changelog). Patch bumps are always backwards-compatible. Pin a concrete version in production code:
|
|
747
805
|
|
|
748
806
|
```bash
|
|
749
|
-
npm install @roxyapi/ui@0.
|
|
807
|
+
npm install @roxyapi/ui@0.8.x
|
|
750
808
|
```
|
|
751
809
|
|
|
752
810
|
```html
|
|
753
|
-
<script src="https://cdn.jsdelivr.net/npm/@roxyapi/ui@0.
|
|
811
|
+
<script src="https://cdn.jsdelivr.net/npm/@roxyapi/ui@0.8.0/dist/cdn/roxy-ui.js"></script>
|
|
754
812
|
```
|
|
755
813
|
|
|
756
814
|
The `@latest` URL on this page is for paste-friendly marketing; production code should pin.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/ashtakavarga-grid.tsx", "../../src/load-ui.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\nimport type { AshtakavargaResponse } from '@roxyapi/ui/types';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children' | 'data'\n>;\n\nexport interface RoxyAshtakavargaGridProps extends ElementAttrs {\n\t/** Spec-derived response payload. Pass the raw RoxyAPI response. */\n\tdata?: AshtakavargaResponse;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\n}\n\nexport const RoxyAshtakavargaGrid = React.forwardRef<HTMLElement | null, RoxyAshtakavargaGridProps>(\n\tfunction RoxyAshtakavargaGrid({ data, className, style, ...rest }, ref) {\n\t\tconst internal = React.useRef<HTMLElement | null>(null);\n\t\tReact.useImperativeHandle<HTMLElement | null, HTMLElement | null>(\n\t\t\tref,\n\t\t\t() => internal.current,\n\t\t\t[],\n\t\t);\n\t\tconst [loaded, setLoaded] = React.useState(false);\n\t\tconst [error, setError] = React.useState<Error | null>(null);\n\n\t\tReact.useEffect(() => {\n\t\t\tlet active = true;\n\t\t\tensureScriptLoaded()\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (active) setLoaded(true);\n\t\t\t\t})\n\t\t\t\t.catch((err: unknown) => {\n\t\t\t\t\tif (!active) return;\n\t\t\t\t\tsetError(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\t});\n\t\t\treturn () => {\n\t\t\t\tactive = false;\n\t\t\t};\n\t\t}, []);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && data !== undefined) {\n\t\t\t\t(el as unknown as { data: unknown }).data = data;\n\t\t\t}\n\t\t}, [data, loaded]);\n\n\t\tif (error) {\n\t\t\treturn React.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ role: 'alert', className, style },\n\t\t\t\t`Roxy UI script load failed: ${error.message}`,\n\t\t\t);\n\t\t}\n\n\t\treturn React.createElement('roxy-ashtakavarga-grid', {\n\t\t\tref: internal,\n\t\t\tclassName,\n\t\t\tstyle,\n\t\t\t...rest,\n\t\t});\n\t},\n);\n", "/**\n * Loads the matching component bundle on first mount. Idempotent across\n * many components on the same page. Skips on the server (no document) so\n * React server components and Next.js SSR work without a flash.\n *\n * Pass an explicit `version` (e.g. `'0.1.5'`) to pin the loaded bundle to a\n * specific @roxyapi/ui release; the default ('latest') resolves to whatever\n * the CDN currently serves for @latest.\n */\nconst SCRIPT_ID = 'roxyapi-ui-loader';\nconst CDN_BASE_LATEST = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn\";\nconst CDN_BASE_PREFIX = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@\";\nconst CDN_BASE_SUFFIX = \"/dist/cdn\";\n\nlet loaded: Promise<void> | null = null;\n\nfunction buildBase(version: string): string {\n\tif (!version || version === 'latest') return CDN_BASE_LATEST;\n\treturn `${CDN_BASE_PREFIX}${version}${CDN_BASE_SUFFIX}`;\n}\n\nexport function ensureScriptLoaded(version: string = 'latest'): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tif (loaded) return loaded;\n\n\tloaded = new Promise<void>((resolve, reject) => {\n\t\tconst url = `${buildBase(version)}/roxy-ui.js`;\n\t\tlet existing = document.getElementById(SCRIPT_ID) as HTMLScriptElement | null;\n\t\tif (existing) {\n\t\t\tif (existing.dataset.loaded === 'true') {\n\t\t\t\tresolve();\n\t\t\t} else {\n\t\t\t\texisting.addEventListener('load', () => resolve());\n\t\t\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\texisting = document.createElement('script');\n\t\texisting.id = SCRIPT_ID;\n\t\texisting.src = url;\n\t\texisting.async = true;\n\t\texisting.crossOrigin = 'anonymous';\n\t\texisting.addEventListener('load', () => {\n\t\t\texisting!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\tdocument.head.appendChild(existing);\n\t});\n\treturn loaded;\n}\n\n// Default export retained for convenience; matches the named export.\nexport default ensureScriptLoaded;\n// Surfaces the embedded @roxyapi/ui version this build of @roxyapi/ui-react\n// was generated against. Useful for diagnostics; not load-bearing.\nexport const ROXY_UI_VERSION = \"0.
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\nimport type { AshtakavargaResponse } from '@roxyapi/ui/types';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children' | 'data'\n>;\n\nexport interface RoxyAshtakavargaGridProps extends ElementAttrs {\n\t/** Spec-derived response payload. Pass the raw RoxyAPI response. */\n\tdata?: AshtakavargaResponse;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\n}\n\nexport const RoxyAshtakavargaGrid = React.forwardRef<HTMLElement | null, RoxyAshtakavargaGridProps>(\n\tfunction RoxyAshtakavargaGrid({ data, className, style, ...rest }, ref) {\n\t\tconst internal = React.useRef<HTMLElement | null>(null);\n\t\tReact.useImperativeHandle<HTMLElement | null, HTMLElement | null>(\n\t\t\tref,\n\t\t\t() => internal.current,\n\t\t\t[],\n\t\t);\n\t\tconst [loaded, setLoaded] = React.useState(false);\n\t\tconst [error, setError] = React.useState<Error | null>(null);\n\n\t\tReact.useEffect(() => {\n\t\t\tlet active = true;\n\t\t\tensureScriptLoaded()\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (active) setLoaded(true);\n\t\t\t\t})\n\t\t\t\t.catch((err: unknown) => {\n\t\t\t\t\tif (!active) return;\n\t\t\t\t\tsetError(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\t});\n\t\t\treturn () => {\n\t\t\t\tactive = false;\n\t\t\t};\n\t\t}, []);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && data !== undefined) {\n\t\t\t\t(el as unknown as { data: unknown }).data = data;\n\t\t\t}\n\t\t}, [data, loaded]);\n\n\t\tif (error) {\n\t\t\treturn React.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ role: 'alert', className, style },\n\t\t\t\t`Roxy UI script load failed: ${error.message}`,\n\t\t\t);\n\t\t}\n\n\t\treturn React.createElement('roxy-ashtakavarga-grid', {\n\t\t\tref: internal,\n\t\t\tclassName,\n\t\t\tstyle,\n\t\t\t...rest,\n\t\t});\n\t},\n);\n", "/**\n * Loads the matching component bundle on first mount. Idempotent across\n * many components on the same page. Skips on the server (no document) so\n * React server components and Next.js SSR work without a flash.\n *\n * Pass an explicit `version` (e.g. `'0.1.5'`) to pin the loaded bundle to a\n * specific @roxyapi/ui release; the default ('latest') resolves to whatever\n * the CDN currently serves for @latest.\n */\nconst SCRIPT_ID = 'roxyapi-ui-loader';\nconst CDN_BASE_LATEST = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn\";\nconst CDN_BASE_PREFIX = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@\";\nconst CDN_BASE_SUFFIX = \"/dist/cdn\";\n\nlet loaded: Promise<void> | null = null;\n\nfunction buildBase(version: string): string {\n\tif (!version || version === 'latest') return CDN_BASE_LATEST;\n\treturn `${CDN_BASE_PREFIX}${version}${CDN_BASE_SUFFIX}`;\n}\n\nexport function ensureScriptLoaded(version: string = 'latest'): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tif (loaded) return loaded;\n\n\tloaded = new Promise<void>((resolve, reject) => {\n\t\tconst url = `${buildBase(version)}/roxy-ui.js`;\n\t\tlet existing = document.getElementById(SCRIPT_ID) as HTMLScriptElement | null;\n\t\tif (existing) {\n\t\t\tif (existing.dataset.loaded === 'true') {\n\t\t\t\tresolve();\n\t\t\t} else {\n\t\t\t\texisting.addEventListener('load', () => resolve());\n\t\t\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\texisting = document.createElement('script');\n\t\texisting.id = SCRIPT_ID;\n\t\texisting.src = url;\n\t\texisting.async = true;\n\t\texisting.crossOrigin = 'anonymous';\n\t\texisting.addEventListener('load', () => {\n\t\t\texisting!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\tdocument.head.appendChild(existing);\n\t});\n\treturn loaded;\n}\n\n// Default export retained for convenience; matches the named export.\nexport default ensureScriptLoaded;\n// Surfaces the embedded @roxyapi/ui version this build of @roxyapi/ui-react\n// was generated against. Useful for diagnostics; not load-bearing.\nexport const ROXY_UI_VERSION = \"0.8.1\";\n"],
|
|
5
5
|
"mappings": "AAAA,UAAYA,MAAW,QCSvB,IAAMC,EAAY,oBACZC,EAAkB,2DAClBC,EAAkB,4CAClBC,EAAkB,YAEpBC,EAA+B,KAEnC,SAASC,EAAUC,EAAyB,CAC3C,MAAI,CAACA,GAAWA,IAAY,SAAiBL,EACtC,GAAGC,CAAe,GAAGI,CAAO,GAAGH,CAAe,EACtD,CAEO,SAASI,EAAmBD,EAAkB,SAAyB,CAC7E,OAAI,OAAO,SAAa,IAAoB,QAAQ,QAAQ,EACxDF,IAEJA,EAAS,IAAI,QAAc,CAACI,EAASC,IAAW,CAC/C,IAAMC,EAAM,GAAGL,EAAUC,CAAO,CAAC,cAC7BK,EAAW,SAAS,eAAeX,CAAS,EAChD,GAAIW,EAAU,CACTA,EAAS,QAAQ,SAAW,OAC/BH,EAAQ,GAERG,EAAS,iBAAiB,OAAQ,IAAMH,EAAQ,CAAC,EACjDG,EAAS,iBAAiB,QAAS,IAAMF,EAAO,IAAI,MAAM,qBAAqB,CAAC,CAAC,GAElF,MACD,CACAE,EAAW,SAAS,cAAc,QAAQ,EAC1CA,EAAS,GAAKX,EACdW,EAAS,IAAMD,EACfC,EAAS,MAAQ,GACjBA,EAAS,YAAc,YACvBA,EAAS,iBAAiB,OAAQ,IAAM,CACvCA,EAAU,QAAQ,OAAS,OAC3BH,EAAQ,CACT,CAAC,EACDG,EAAS,iBAAiB,QAAS,IAAMF,EAAO,IAAI,MAAM,qBAAqB,CAAC,CAAC,EACjF,SAAS,KAAK,YAAYE,CAAQ,CACnC,CAAC,EACMP,EACR,CDjCO,IAAMQ,EAA6B,aACzC,SAA8B,CAAE,KAAAC,EAAM,UAAAC,EAAW,MAAAC,EAAO,GAAGC,CAAK,EAAGC,EAAK,CACvE,IAAMC,EAAiB,SAA2B,IAAI,EAChD,sBACLD,EACA,IAAMC,EAAS,QACf,CAAC,CACF,EACA,GAAM,CAACC,EAAQC,CAAS,EAAU,WAAS,EAAK,EAC1C,CAACC,EAAOC,CAAQ,EAAU,WAAuB,IAAI,EAwB3D,OAtBM,YAAU,IAAM,CACrB,IAAIC,EAAS,GACb,OAAAC,EAAmB,EACjB,KAAK,IAAM,CACPD,GAAQH,EAAU,EAAI,CAC3B,CAAC,EACA,MAAOK,GAAiB,CACnBF,GACLD,EAASG,aAAe,MAAQA,EAAM,IAAI,MAAM,OAAOA,CAAG,CAAC,CAAC,CAC7D,CAAC,EACK,IAAM,CACZF,EAAS,EACV,CACD,EAAG,CAAC,CAAC,EAEC,YAAU,IAAM,CACrB,IAAMG,EAAKR,EAAS,QAChBQ,GAAMb,IAAS,SACjBa,EAAoC,KAAOb,EAE9C,EAAG,CAACA,EAAMM,CAAM,CAAC,EAEbE,EACU,gBACZ,MACA,CAAE,KAAM,QAAS,UAAAP,EAAW,MAAAC,CAAM,EAClC,+BAA+BM,EAAM,OAAO,EAC7C,EAGY,gBAAc,yBAA0B,CACpD,IAAKH,EACL,UAAAJ,EACA,MAAAC,EACA,GAAGC,CACJ,CAAC,CACF,CACD",
|
|
6
6
|
"names": ["React", "SCRIPT_ID", "CDN_BASE_LATEST", "CDN_BASE_PREFIX", "CDN_BASE_SUFFIX", "loaded", "buildBase", "version", "ensureScriptLoaded", "resolve", "reject", "url", "existing", "RoxyAshtakavargaGrid", "data", "className", "style", "rest", "ref", "internal", "loaded", "setLoaded", "error", "setError", "active", "ensureScriptLoaded", "err", "el"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/biorhythm-chart.tsx", "../../src/load-ui.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\nimport type { GetCriticalDaysResponse, GetDailyBiorhythmResponse, GetForecastResponse } from '@roxyapi/ui/types';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children' | 'data'\n>;\n\nexport interface RoxyBiorhythmChartProps extends ElementAttrs {\n\t/** Spec-derived response payload. Pass the raw RoxyAPI response. */\n\tdata?: GetDailyBiorhythmResponse | GetForecastResponse | GetCriticalDaysResponse;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\t/** Which biorhythm response shape to render: a single day, a multi-day forecast, or the critical days list. */\n\tmode?: 'daily' | 'forecast' | 'critical-days';\n\n}\n\nexport const RoxyBiorhythmChart = React.forwardRef<HTMLElement | null, RoxyBiorhythmChartProps>(\n\tfunction RoxyBiorhythmChart({ data, className, style, mode, ...rest }, ref) {\n\t\tconst internal = React.useRef<HTMLElement | null>(null);\n\t\tReact.useImperativeHandle<HTMLElement | null, HTMLElement | null>(\n\t\t\tref,\n\t\t\t() => internal.current,\n\t\t\t[],\n\t\t);\n\t\tconst [loaded, setLoaded] = React.useState(false);\n\t\tconst [error, setError] = React.useState<Error | null>(null);\n\n\t\tReact.useEffect(() => {\n\t\t\tlet active = true;\n\t\t\tensureScriptLoaded()\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (active) setLoaded(true);\n\t\t\t\t})\n\t\t\t\t.catch((err: unknown) => {\n\t\t\t\t\tif (!active) return;\n\t\t\t\t\tsetError(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\t});\n\t\t\treturn () => {\n\t\t\t\tactive = false;\n\t\t\t};\n\t\t}, []);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && data !== undefined) {\n\t\t\t\t(el as unknown as { data: unknown }).data = data;\n\t\t\t}\n\t\t}, [data, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && mode !== undefined) {\n\t\t\t\t(el as unknown as { mode: 'daily' | 'forecast' | 'critical-days' }).mode = mode;\n\t\t\t}\n\t\t}, [mode, loaded]);\n\n\t\tif (error) {\n\t\t\treturn React.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ role: 'alert', className, style },\n\t\t\t\t`Roxy UI script load failed: ${error.message}`,\n\t\t\t);\n\t\t}\n\n\t\treturn React.createElement('roxy-biorhythm-chart', {\n\t\t\tref: internal,\n\t\t\tclassName,\n\t\t\tstyle,\n\t\t\t...rest,\n\t\t});\n\t},\n);\n", "/**\n * Loads the matching component bundle on first mount. Idempotent across\n * many components on the same page. Skips on the server (no document) so\n * React server components and Next.js SSR work without a flash.\n *\n * Pass an explicit `version` (e.g. `'0.1.5'`) to pin the loaded bundle to a\n * specific @roxyapi/ui release; the default ('latest') resolves to whatever\n * the CDN currently serves for @latest.\n */\nconst SCRIPT_ID = 'roxyapi-ui-loader';\nconst CDN_BASE_LATEST = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn\";\nconst CDN_BASE_PREFIX = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@\";\nconst CDN_BASE_SUFFIX = \"/dist/cdn\";\n\nlet loaded: Promise<void> | null = null;\n\nfunction buildBase(version: string): string {\n\tif (!version || version === 'latest') return CDN_BASE_LATEST;\n\treturn `${CDN_BASE_PREFIX}${version}${CDN_BASE_SUFFIX}`;\n}\n\nexport function ensureScriptLoaded(version: string = 'latest'): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tif (loaded) return loaded;\n\n\tloaded = new Promise<void>((resolve, reject) => {\n\t\tconst url = `${buildBase(version)}/roxy-ui.js`;\n\t\tlet existing = document.getElementById(SCRIPT_ID) as HTMLScriptElement | null;\n\t\tif (existing) {\n\t\t\tif (existing.dataset.loaded === 'true') {\n\t\t\t\tresolve();\n\t\t\t} else {\n\t\t\t\texisting.addEventListener('load', () => resolve());\n\t\t\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\texisting = document.createElement('script');\n\t\texisting.id = SCRIPT_ID;\n\t\texisting.src = url;\n\t\texisting.async = true;\n\t\texisting.crossOrigin = 'anonymous';\n\t\texisting.addEventListener('load', () => {\n\t\t\texisting!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\tdocument.head.appendChild(existing);\n\t});\n\treturn loaded;\n}\n\n// Default export retained for convenience; matches the named export.\nexport default ensureScriptLoaded;\n// Surfaces the embedded @roxyapi/ui version this build of @roxyapi/ui-react\n// was generated against. Useful for diagnostics; not load-bearing.\nexport const ROXY_UI_VERSION = \"0.
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\nimport type { GetCriticalDaysResponse, GetDailyBiorhythmResponse, GetForecastResponse } from '@roxyapi/ui/types';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children' | 'data'\n>;\n\nexport interface RoxyBiorhythmChartProps extends ElementAttrs {\n\t/** Spec-derived response payload. Pass the raw RoxyAPI response. */\n\tdata?: GetDailyBiorhythmResponse | GetForecastResponse | GetCriticalDaysResponse;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\t/** Which biorhythm response shape to render: a single day, a multi-day forecast, or the critical days list. */\n\tmode?: 'daily' | 'forecast' | 'critical-days';\n\n}\n\nexport const RoxyBiorhythmChart = React.forwardRef<HTMLElement | null, RoxyBiorhythmChartProps>(\n\tfunction RoxyBiorhythmChart({ data, className, style, mode, ...rest }, ref) {\n\t\tconst internal = React.useRef<HTMLElement | null>(null);\n\t\tReact.useImperativeHandle<HTMLElement | null, HTMLElement | null>(\n\t\t\tref,\n\t\t\t() => internal.current,\n\t\t\t[],\n\t\t);\n\t\tconst [loaded, setLoaded] = React.useState(false);\n\t\tconst [error, setError] = React.useState<Error | null>(null);\n\n\t\tReact.useEffect(() => {\n\t\t\tlet active = true;\n\t\t\tensureScriptLoaded()\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (active) setLoaded(true);\n\t\t\t\t})\n\t\t\t\t.catch((err: unknown) => {\n\t\t\t\t\tif (!active) return;\n\t\t\t\t\tsetError(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\t});\n\t\t\treturn () => {\n\t\t\t\tactive = false;\n\t\t\t};\n\t\t}, []);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && data !== undefined) {\n\t\t\t\t(el as unknown as { data: unknown }).data = data;\n\t\t\t}\n\t\t}, [data, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && mode !== undefined) {\n\t\t\t\t(el as unknown as { mode: 'daily' | 'forecast' | 'critical-days' }).mode = mode;\n\t\t\t}\n\t\t}, [mode, loaded]);\n\n\t\tif (error) {\n\t\t\treturn React.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ role: 'alert', className, style },\n\t\t\t\t`Roxy UI script load failed: ${error.message}`,\n\t\t\t);\n\t\t}\n\n\t\treturn React.createElement('roxy-biorhythm-chart', {\n\t\t\tref: internal,\n\t\t\tclassName,\n\t\t\tstyle,\n\t\t\t...rest,\n\t\t});\n\t},\n);\n", "/**\n * Loads the matching component bundle on first mount. Idempotent across\n * many components on the same page. Skips on the server (no document) so\n * React server components and Next.js SSR work without a flash.\n *\n * Pass an explicit `version` (e.g. `'0.1.5'`) to pin the loaded bundle to a\n * specific @roxyapi/ui release; the default ('latest') resolves to whatever\n * the CDN currently serves for @latest.\n */\nconst SCRIPT_ID = 'roxyapi-ui-loader';\nconst CDN_BASE_LATEST = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn\";\nconst CDN_BASE_PREFIX = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@\";\nconst CDN_BASE_SUFFIX = \"/dist/cdn\";\n\nlet loaded: Promise<void> | null = null;\n\nfunction buildBase(version: string): string {\n\tif (!version || version === 'latest') return CDN_BASE_LATEST;\n\treturn `${CDN_BASE_PREFIX}${version}${CDN_BASE_SUFFIX}`;\n}\n\nexport function ensureScriptLoaded(version: string = 'latest'): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tif (loaded) return loaded;\n\n\tloaded = new Promise<void>((resolve, reject) => {\n\t\tconst url = `${buildBase(version)}/roxy-ui.js`;\n\t\tlet existing = document.getElementById(SCRIPT_ID) as HTMLScriptElement | null;\n\t\tif (existing) {\n\t\t\tif (existing.dataset.loaded === 'true') {\n\t\t\t\tresolve();\n\t\t\t} else {\n\t\t\t\texisting.addEventListener('load', () => resolve());\n\t\t\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\texisting = document.createElement('script');\n\t\texisting.id = SCRIPT_ID;\n\t\texisting.src = url;\n\t\texisting.async = true;\n\t\texisting.crossOrigin = 'anonymous';\n\t\texisting.addEventListener('load', () => {\n\t\t\texisting!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\tdocument.head.appendChild(existing);\n\t});\n\treturn loaded;\n}\n\n// Default export retained for convenience; matches the named export.\nexport default ensureScriptLoaded;\n// Surfaces the embedded @roxyapi/ui version this build of @roxyapi/ui-react\n// was generated against. Useful for diagnostics; not load-bearing.\nexport const ROXY_UI_VERSION = \"0.8.1\";\n"],
|
|
5
5
|
"mappings": "AAAA,UAAYA,MAAW,QCSvB,IAAMC,EAAY,oBACZC,EAAkB,2DAClBC,EAAkB,4CAClBC,EAAkB,YAEpBC,EAA+B,KAEnC,SAASC,EAAUC,EAAyB,CAC3C,MAAI,CAACA,GAAWA,IAAY,SAAiBL,EACtC,GAAGC,CAAe,GAAGI,CAAO,GAAGH,CAAe,EACtD,CAEO,SAASI,EAAmBD,EAAkB,SAAyB,CAC7E,OAAI,OAAO,SAAa,IAAoB,QAAQ,QAAQ,EACxDF,IAEJA,EAAS,IAAI,QAAc,CAACI,EAASC,IAAW,CAC/C,IAAMC,EAAM,GAAGL,EAAUC,CAAO,CAAC,cAC7BK,EAAW,SAAS,eAAeX,CAAS,EAChD,GAAIW,EAAU,CACTA,EAAS,QAAQ,SAAW,OAC/BH,EAAQ,GAERG,EAAS,iBAAiB,OAAQ,IAAMH,EAAQ,CAAC,EACjDG,EAAS,iBAAiB,QAAS,IAAMF,EAAO,IAAI,MAAM,qBAAqB,CAAC,CAAC,GAElF,MACD,CACAE,EAAW,SAAS,cAAc,QAAQ,EAC1CA,EAAS,GAAKX,EACdW,EAAS,IAAMD,EACfC,EAAS,MAAQ,GACjBA,EAAS,YAAc,YACvBA,EAAS,iBAAiB,OAAQ,IAAM,CACvCA,EAAU,QAAQ,OAAS,OAC3BH,EAAQ,CACT,CAAC,EACDG,EAAS,iBAAiB,QAAS,IAAMF,EAAO,IAAI,MAAM,qBAAqB,CAAC,CAAC,EACjF,SAAS,KAAK,YAAYE,CAAQ,CACnC,CAAC,EACMP,EACR,CD/BO,IAAMQ,EAA2B,aACvC,SAA4B,CAAE,KAAAC,EAAM,UAAAC,EAAW,MAAAC,EAAO,KAAAC,EAAM,GAAGC,CAAK,EAAGC,EAAK,CAC3E,IAAMC,EAAiB,SAA2B,IAAI,EAChD,sBACLD,EACA,IAAMC,EAAS,QACf,CAAC,CACF,EACA,GAAM,CAACC,EAAQC,CAAS,EAAU,WAAS,EAAK,EAC1C,CAACC,EAAOC,CAAQ,EAAU,WAAuB,IAAI,EA+B3D,OA7BM,YAAU,IAAM,CACrB,IAAIC,EAAS,GACb,OAAAC,EAAmB,EACjB,KAAK,IAAM,CACPD,GAAQH,EAAU,EAAI,CAC3B,CAAC,EACA,MAAOK,GAAiB,CACnBF,GACLD,EAASG,aAAe,MAAQA,EAAM,IAAI,MAAM,OAAOA,CAAG,CAAC,CAAC,CAC7D,CAAC,EACK,IAAM,CACZF,EAAS,EACV,CACD,EAAG,CAAC,CAAC,EAEC,YAAU,IAAM,CACrB,IAAMG,EAAKR,EAAS,QAChBQ,GAAMd,IAAS,SACjBc,EAAoC,KAAOd,EAE9C,EAAG,CAACA,EAAMO,CAAM,CAAC,EAEX,YAAU,IAAM,CACrB,IAAMO,EAAKR,EAAS,QAChBQ,GAAMX,IAAS,SACjBW,EAAmE,KAAOX,EAE7E,EAAG,CAACA,EAAMI,CAAM,CAAC,EAEbE,EACU,gBACZ,MACA,CAAE,KAAM,QAAS,UAAAR,EAAW,MAAAC,CAAM,EAClC,+BAA+BO,EAAM,OAAO,EAC7C,EAGY,gBAAc,uBAAwB,CAClD,IAAKH,EACL,UAAAL,EACA,MAAAC,EACA,GAAGE,CACJ,CAAC,CACF,CACD",
|
|
6
6
|
"names": ["React", "SCRIPT_ID", "CDN_BASE_LATEST", "CDN_BASE_PREFIX", "CDN_BASE_SUFFIX", "loaded", "buildBase", "version", "ensureScriptLoaded", "resolve", "reject", "url", "existing", "RoxyBiorhythmChart", "data", "className", "style", "mode", "rest", "ref", "internal", "loaded", "setLoaded", "error", "setError", "active", "ensureScriptLoaded", "err", "el"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type ElementAttrs = Omit<React.HTMLAttributes<HTMLElement>, 'children'>;
|
|
3
|
+
export interface RoxyBodygraphProps extends ElementAttrs {
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
}
|
|
7
|
+
export declare const RoxyBodygraph: React.ForwardRefExoticComponent<RoxyBodygraphProps & React.RefAttributes<HTMLElement | null>>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=bodygraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bodygraph.d.ts","sourceRoot":"","sources":["../../src/components/bodygraph.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,KAAK,YAAY,GAAG,IAAI,CACvB,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EACjC,UAAU,CACV,CAAC;AAEF,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAE5B;AAED,eAAO,MAAM,aAAa,+FAyCzB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as t from"react";var c="roxyapi-ui-loader",E="https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn",y="https://cdn.jsdelivr.net/npm/@roxyapi/ui@",R="/dist/cdn",a=null;function x(r){return!r||r==="latest"?E:`${y}${r}${R}`}function p(r="latest"){return typeof document>"u"?Promise.resolve():a||(a=new Promise((n,o)=>{let d=`${x(r)}/roxy-ui.js`,e=document.getElementById(c);if(e){e.dataset.loaded==="true"?n():(e.addEventListener("load",()=>n()),e.addEventListener("error",()=>o(new Error("roxy-ui load failed"))));return}e=document.createElement("script"),e.id=c,e.src=d,e.async=!0,e.crossOrigin="anonymous",e.addEventListener("load",()=>{e.dataset.loaded="true",n()}),e.addEventListener("error",()=>o(new Error("roxy-ui load failed"))),document.head.appendChild(e)}),a)}var h=t.forwardRef(function({className:n,style:o,...d},e){let s=t.useRef(null);t.useImperativeHandle(e,()=>s.current,[]);let[L,m]=t.useState(!1),[u,f]=t.useState(null);return t.useEffect(()=>{let i=!0;return p().then(()=>{i&&m(!0)}).catch(l=>{i&&f(l instanceof Error?l:new Error(String(l)))}),()=>{i=!1}},[]),u?t.createElement("div",{role:"alert",className:n,style:o},`Roxy UI script load failed: ${u.message}`):t.createElement("roxy-bodygraph",{ref:s,className:n,style:o,...d})});export{h as RoxyBodygraph};
|
|
2
|
+
//# sourceMappingURL=bodygraph.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/bodygraph.tsx", "../../src/load-ui.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children'\n>;\n\nexport interface RoxyBodygraphProps extends ElementAttrs {\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\n}\n\nexport const RoxyBodygraph = React.forwardRef<HTMLElement | null, RoxyBodygraphProps>(\n\tfunction RoxyBodygraph({ className, style, ...rest }, ref) {\n\t\tconst internal = React.useRef<HTMLElement | null>(null);\n\t\tReact.useImperativeHandle<HTMLElement | null, HTMLElement | null>(\n\t\t\tref,\n\t\t\t() => internal.current,\n\t\t\t[],\n\t\t);\n\t\tconst [loaded, setLoaded] = React.useState(false);\n\t\tconst [error, setError] = React.useState<Error | null>(null);\n\n\t\tReact.useEffect(() => {\n\t\t\tlet active = true;\n\t\t\tensureScriptLoaded()\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (active) setLoaded(true);\n\t\t\t\t})\n\t\t\t\t.catch((err: unknown) => {\n\t\t\t\t\tif (!active) return;\n\t\t\t\t\tsetError(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\t});\n\t\t\treturn () => {\n\t\t\t\tactive = false;\n\t\t\t};\n\t\t}, []);\n\n\t\tif (error) {\n\t\t\treturn React.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ role: 'alert', className, style },\n\t\t\t\t`Roxy UI script load failed: ${error.message}`,\n\t\t\t);\n\t\t}\n\n\t\treturn React.createElement('roxy-bodygraph', {\n\t\t\tref: internal,\n\t\t\tclassName,\n\t\t\tstyle,\n\t\t\t...rest,\n\t\t});\n\t},\n);\n", "/**\n * Loads the matching component bundle on first mount. Idempotent across\n * many components on the same page. Skips on the server (no document) so\n * React server components and Next.js SSR work without a flash.\n *\n * Pass an explicit `version` (e.g. `'0.1.5'`) to pin the loaded bundle to a\n * specific @roxyapi/ui release; the default ('latest') resolves to whatever\n * the CDN currently serves for @latest.\n */\nconst SCRIPT_ID = 'roxyapi-ui-loader';\nconst CDN_BASE_LATEST = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn\";\nconst CDN_BASE_PREFIX = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@\";\nconst CDN_BASE_SUFFIX = \"/dist/cdn\";\n\nlet loaded: Promise<void> | null = null;\n\nfunction buildBase(version: string): string {\n\tif (!version || version === 'latest') return CDN_BASE_LATEST;\n\treturn `${CDN_BASE_PREFIX}${version}${CDN_BASE_SUFFIX}`;\n}\n\nexport function ensureScriptLoaded(version: string = 'latest'): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tif (loaded) return loaded;\n\n\tloaded = new Promise<void>((resolve, reject) => {\n\t\tconst url = `${buildBase(version)}/roxy-ui.js`;\n\t\tlet existing = document.getElementById(SCRIPT_ID) as HTMLScriptElement | null;\n\t\tif (existing) {\n\t\t\tif (existing.dataset.loaded === 'true') {\n\t\t\t\tresolve();\n\t\t\t} else {\n\t\t\t\texisting.addEventListener('load', () => resolve());\n\t\t\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\texisting = document.createElement('script');\n\t\texisting.id = SCRIPT_ID;\n\t\texisting.src = url;\n\t\texisting.async = true;\n\t\texisting.crossOrigin = 'anonymous';\n\t\texisting.addEventListener('load', () => {\n\t\t\texisting!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\tdocument.head.appendChild(existing);\n\t});\n\treturn loaded;\n}\n\n// Default export retained for convenience; matches the named export.\nexport default ensureScriptLoaded;\n// Surfaces the embedded @roxyapi/ui version this build of @roxyapi/ui-react\n// was generated against. Useful for diagnostics; not load-bearing.\nexport const ROXY_UI_VERSION = \"0.8.1\";\n"],
|
|
5
|
+
"mappings": "AAAA,UAAYA,MAAW,QCSvB,IAAMC,EAAY,oBACZC,EAAkB,2DAClBC,EAAkB,4CAClBC,EAAkB,YAEpBC,EAA+B,KAEnC,SAASC,EAAUC,EAAyB,CAC3C,MAAI,CAACA,GAAWA,IAAY,SAAiBL,EACtC,GAAGC,CAAe,GAAGI,CAAO,GAAGH,CAAe,EACtD,CAEO,SAASI,EAAmBD,EAAkB,SAAyB,CAC7E,OAAI,OAAO,SAAa,IAAoB,QAAQ,QAAQ,EACxDF,IAEJA,EAAS,IAAI,QAAc,CAACI,EAASC,IAAW,CAC/C,IAAMC,EAAM,GAAGL,EAAUC,CAAO,CAAC,cAC7BK,EAAW,SAAS,eAAeX,CAAS,EAChD,GAAIW,EAAU,CACTA,EAAS,QAAQ,SAAW,OAC/BH,EAAQ,GAERG,EAAS,iBAAiB,OAAQ,IAAMH,EAAQ,CAAC,EACjDG,EAAS,iBAAiB,QAAS,IAAMF,EAAO,IAAI,MAAM,qBAAqB,CAAC,CAAC,GAElF,MACD,CACAE,EAAW,SAAS,cAAc,QAAQ,EAC1CA,EAAS,GAAKX,EACdW,EAAS,IAAMD,EACfC,EAAS,MAAQ,GACjBA,EAAS,YAAc,YACvBA,EAAS,iBAAiB,OAAQ,IAAM,CACvCA,EAAU,QAAQ,OAAS,OAC3BH,EAAQ,CACT,CAAC,EACDG,EAAS,iBAAiB,QAAS,IAAMF,EAAO,IAAI,MAAM,qBAAqB,CAAC,CAAC,EACjF,SAAS,KAAK,YAAYE,CAAQ,CACnC,CAAC,EACMP,EACR,CDpCO,IAAMQ,EAAsB,aAClC,SAAuB,CAAE,UAAAC,EAAW,MAAAC,EAAO,GAAGC,CAAK,EAAGC,EAAK,CAC1D,IAAMC,EAAiB,SAA2B,IAAI,EAChD,sBACLD,EACA,IAAMC,EAAS,QACf,CAAC,CACF,EACA,GAAM,CAACC,EAAQC,CAAS,EAAU,WAAS,EAAK,EAC1C,CAACC,EAAOC,CAAQ,EAAU,WAAuB,IAAI,EAiB3D,OAfM,YAAU,IAAM,CACrB,IAAIC,EAAS,GACb,OAAAC,EAAmB,EACjB,KAAK,IAAM,CACPD,GAAQH,EAAU,EAAI,CAC3B,CAAC,EACA,MAAOK,GAAiB,CACnBF,GACLD,EAASG,aAAe,MAAQA,EAAM,IAAI,MAAM,OAAOA,CAAG,CAAC,CAAC,CAC7D,CAAC,EACK,IAAM,CACZF,EAAS,EACV,CACD,EAAG,CAAC,CAAC,EAEDF,EACU,gBACZ,MACA,CAAE,KAAM,QAAS,UAAAP,EAAW,MAAAC,CAAM,EAClC,+BAA+BM,EAAM,OAAO,EAC7C,EAGY,gBAAc,iBAAkB,CAC5C,IAAKH,EACL,UAAAJ,EACA,MAAAC,EACA,GAAGC,CACJ,CAAC,CACF,CACD",
|
|
6
|
+
"names": ["React", "SCRIPT_ID", "CDN_BASE_LATEST", "CDN_BASE_PREFIX", "CDN_BASE_SUFFIX", "loaded", "buildBase", "version", "ensureScriptLoaded", "resolve", "reject", "url", "existing", "RoxyBodygraph", "className", "style", "rest", "ref", "internal", "loaded", "setLoaded", "error", "setError", "active", "ensureScriptLoaded", "err"]
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/choghadiya-grid.tsx", "../../src/load-ui.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\nimport type { GetChoghadiyaResponse } from '@roxyapi/ui/types';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children' | 'data'\n>;\n\nexport interface RoxyChoghadiyaGridProps extends ElementAttrs {\n\t/** Spec-derived response payload. Pass the raw RoxyAPI response. */\n\tdata?: GetChoghadiyaResponse;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\n}\n\nexport const RoxyChoghadiyaGrid = React.forwardRef<HTMLElement | null, RoxyChoghadiyaGridProps>(\n\tfunction RoxyChoghadiyaGrid({ data, className, style, ...rest }, ref) {\n\t\tconst internal = React.useRef<HTMLElement | null>(null);\n\t\tReact.useImperativeHandle<HTMLElement | null, HTMLElement | null>(\n\t\t\tref,\n\t\t\t() => internal.current,\n\t\t\t[],\n\t\t);\n\t\tconst [loaded, setLoaded] = React.useState(false);\n\t\tconst [error, setError] = React.useState<Error | null>(null);\n\n\t\tReact.useEffect(() => {\n\t\t\tlet active = true;\n\t\t\tensureScriptLoaded()\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (active) setLoaded(true);\n\t\t\t\t})\n\t\t\t\t.catch((err: unknown) => {\n\t\t\t\t\tif (!active) return;\n\t\t\t\t\tsetError(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\t});\n\t\t\treturn () => {\n\t\t\t\tactive = false;\n\t\t\t};\n\t\t}, []);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && data !== undefined) {\n\t\t\t\t(el as unknown as { data: unknown }).data = data;\n\t\t\t}\n\t\t}, [data, loaded]);\n\n\t\tif (error) {\n\t\t\treturn React.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ role: 'alert', className, style },\n\t\t\t\t`Roxy UI script load failed: ${error.message}`,\n\t\t\t);\n\t\t}\n\n\t\treturn React.createElement('roxy-choghadiya-grid', {\n\t\t\tref: internal,\n\t\t\tclassName,\n\t\t\tstyle,\n\t\t\t...rest,\n\t\t});\n\t},\n);\n", "/**\n * Loads the matching component bundle on first mount. Idempotent across\n * many components on the same page. Skips on the server (no document) so\n * React server components and Next.js SSR work without a flash.\n *\n * Pass an explicit `version` (e.g. `'0.1.5'`) to pin the loaded bundle to a\n * specific @roxyapi/ui release; the default ('latest') resolves to whatever\n * the CDN currently serves for @latest.\n */\nconst SCRIPT_ID = 'roxyapi-ui-loader';\nconst CDN_BASE_LATEST = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn\";\nconst CDN_BASE_PREFIX = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@\";\nconst CDN_BASE_SUFFIX = \"/dist/cdn\";\n\nlet loaded: Promise<void> | null = null;\n\nfunction buildBase(version: string): string {\n\tif (!version || version === 'latest') return CDN_BASE_LATEST;\n\treturn `${CDN_BASE_PREFIX}${version}${CDN_BASE_SUFFIX}`;\n}\n\nexport function ensureScriptLoaded(version: string = 'latest'): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tif (loaded) return loaded;\n\n\tloaded = new Promise<void>((resolve, reject) => {\n\t\tconst url = `${buildBase(version)}/roxy-ui.js`;\n\t\tlet existing = document.getElementById(SCRIPT_ID) as HTMLScriptElement | null;\n\t\tif (existing) {\n\t\t\tif (existing.dataset.loaded === 'true') {\n\t\t\t\tresolve();\n\t\t\t} else {\n\t\t\t\texisting.addEventListener('load', () => resolve());\n\t\t\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\texisting = document.createElement('script');\n\t\texisting.id = SCRIPT_ID;\n\t\texisting.src = url;\n\t\texisting.async = true;\n\t\texisting.crossOrigin = 'anonymous';\n\t\texisting.addEventListener('load', () => {\n\t\t\texisting!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\tdocument.head.appendChild(existing);\n\t});\n\treturn loaded;\n}\n\n// Default export retained for convenience; matches the named export.\nexport default ensureScriptLoaded;\n// Surfaces the embedded @roxyapi/ui version this build of @roxyapi/ui-react\n// was generated against. Useful for diagnostics; not load-bearing.\nexport const ROXY_UI_VERSION = \"0.
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\nimport type { GetChoghadiyaResponse } from '@roxyapi/ui/types';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children' | 'data'\n>;\n\nexport interface RoxyChoghadiyaGridProps extends ElementAttrs {\n\t/** Spec-derived response payload. Pass the raw RoxyAPI response. */\n\tdata?: GetChoghadiyaResponse;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\n}\n\nexport const RoxyChoghadiyaGrid = React.forwardRef<HTMLElement | null, RoxyChoghadiyaGridProps>(\n\tfunction RoxyChoghadiyaGrid({ data, className, style, ...rest }, ref) {\n\t\tconst internal = React.useRef<HTMLElement | null>(null);\n\t\tReact.useImperativeHandle<HTMLElement | null, HTMLElement | null>(\n\t\t\tref,\n\t\t\t() => internal.current,\n\t\t\t[],\n\t\t);\n\t\tconst [loaded, setLoaded] = React.useState(false);\n\t\tconst [error, setError] = React.useState<Error | null>(null);\n\n\t\tReact.useEffect(() => {\n\t\t\tlet active = true;\n\t\t\tensureScriptLoaded()\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (active) setLoaded(true);\n\t\t\t\t})\n\t\t\t\t.catch((err: unknown) => {\n\t\t\t\t\tif (!active) return;\n\t\t\t\t\tsetError(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\t});\n\t\t\treturn () => {\n\t\t\t\tactive = false;\n\t\t\t};\n\t\t}, []);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && data !== undefined) {\n\t\t\t\t(el as unknown as { data: unknown }).data = data;\n\t\t\t}\n\t\t}, [data, loaded]);\n\n\t\tif (error) {\n\t\t\treturn React.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ role: 'alert', className, style },\n\t\t\t\t`Roxy UI script load failed: ${error.message}`,\n\t\t\t);\n\t\t}\n\n\t\treturn React.createElement('roxy-choghadiya-grid', {\n\t\t\tref: internal,\n\t\t\tclassName,\n\t\t\tstyle,\n\t\t\t...rest,\n\t\t});\n\t},\n);\n", "/**\n * Loads the matching component bundle on first mount. Idempotent across\n * many components on the same page. Skips on the server (no document) so\n * React server components and Next.js SSR work without a flash.\n *\n * Pass an explicit `version` (e.g. `'0.1.5'`) to pin the loaded bundle to a\n * specific @roxyapi/ui release; the default ('latest') resolves to whatever\n * the CDN currently serves for @latest.\n */\nconst SCRIPT_ID = 'roxyapi-ui-loader';\nconst CDN_BASE_LATEST = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn\";\nconst CDN_BASE_PREFIX = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@\";\nconst CDN_BASE_SUFFIX = \"/dist/cdn\";\n\nlet loaded: Promise<void> | null = null;\n\nfunction buildBase(version: string): string {\n\tif (!version || version === 'latest') return CDN_BASE_LATEST;\n\treturn `${CDN_BASE_PREFIX}${version}${CDN_BASE_SUFFIX}`;\n}\n\nexport function ensureScriptLoaded(version: string = 'latest'): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tif (loaded) return loaded;\n\n\tloaded = new Promise<void>((resolve, reject) => {\n\t\tconst url = `${buildBase(version)}/roxy-ui.js`;\n\t\tlet existing = document.getElementById(SCRIPT_ID) as HTMLScriptElement | null;\n\t\tif (existing) {\n\t\t\tif (existing.dataset.loaded === 'true') {\n\t\t\t\tresolve();\n\t\t\t} else {\n\t\t\t\texisting.addEventListener('load', () => resolve());\n\t\t\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\texisting = document.createElement('script');\n\t\texisting.id = SCRIPT_ID;\n\t\texisting.src = url;\n\t\texisting.async = true;\n\t\texisting.crossOrigin = 'anonymous';\n\t\texisting.addEventListener('load', () => {\n\t\t\texisting!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\tdocument.head.appendChild(existing);\n\t});\n\treturn loaded;\n}\n\n// Default export retained for convenience; matches the named export.\nexport default ensureScriptLoaded;\n// Surfaces the embedded @roxyapi/ui version this build of @roxyapi/ui-react\n// was generated against. Useful for diagnostics; not load-bearing.\nexport const ROXY_UI_VERSION = \"0.8.1\";\n"],
|
|
5
5
|
"mappings": "AAAA,UAAYA,MAAW,QCSvB,IAAMC,EAAY,oBACZC,EAAkB,2DAClBC,EAAkB,4CAClBC,EAAkB,YAEpBC,EAA+B,KAEnC,SAASC,EAAUC,EAAyB,CAC3C,MAAI,CAACA,GAAWA,IAAY,SAAiBL,EACtC,GAAGC,CAAe,GAAGI,CAAO,GAAGH,CAAe,EACtD,CAEO,SAASI,EAAmBD,EAAkB,SAAyB,CAC7E,OAAI,OAAO,SAAa,IAAoB,QAAQ,QAAQ,EACxDF,IAEJA,EAAS,IAAI,QAAc,CAACI,EAASC,IAAW,CAC/C,IAAMC,EAAM,GAAGL,EAAUC,CAAO,CAAC,cAC7BK,EAAW,SAAS,eAAeX,CAAS,EAChD,GAAIW,EAAU,CACTA,EAAS,QAAQ,SAAW,OAC/BH,EAAQ,GAERG,EAAS,iBAAiB,OAAQ,IAAMH,EAAQ,CAAC,EACjDG,EAAS,iBAAiB,QAAS,IAAMF,EAAO,IAAI,MAAM,qBAAqB,CAAC,CAAC,GAElF,MACD,CACAE,EAAW,SAAS,cAAc,QAAQ,EAC1CA,EAAS,GAAKX,EACdW,EAAS,IAAMD,EACfC,EAAS,MAAQ,GACjBA,EAAS,YAAc,YACvBA,EAAS,iBAAiB,OAAQ,IAAM,CACvCA,EAAU,QAAQ,OAAS,OAC3BH,EAAQ,CACT,CAAC,EACDG,EAAS,iBAAiB,QAAS,IAAMF,EAAO,IAAI,MAAM,qBAAqB,CAAC,CAAC,EACjF,SAAS,KAAK,YAAYE,CAAQ,CACnC,CAAC,EACMP,EACR,CDjCO,IAAMQ,EAA2B,aACvC,SAA4B,CAAE,KAAAC,EAAM,UAAAC,EAAW,MAAAC,EAAO,GAAGC,CAAK,EAAGC,EAAK,CACrE,IAAMC,EAAiB,SAA2B,IAAI,EAChD,sBACLD,EACA,IAAMC,EAAS,QACf,CAAC,CACF,EACA,GAAM,CAACC,EAAQC,CAAS,EAAU,WAAS,EAAK,EAC1C,CAACC,EAAOC,CAAQ,EAAU,WAAuB,IAAI,EAwB3D,OAtBM,YAAU,IAAM,CACrB,IAAIC,EAAS,GACb,OAAAC,EAAmB,EACjB,KAAK,IAAM,CACPD,GAAQH,EAAU,EAAI,CAC3B,CAAC,EACA,MAAOK,GAAiB,CACnBF,GACLD,EAASG,aAAe,MAAQA,EAAM,IAAI,MAAM,OAAOA,CAAG,CAAC,CAAC,CAC7D,CAAC,EACK,IAAM,CACZF,EAAS,EACV,CACD,EAAG,CAAC,CAAC,EAEC,YAAU,IAAM,CACrB,IAAMG,EAAKR,EAAS,QAChBQ,GAAMb,IAAS,SACjBa,EAAoC,KAAOb,EAE9C,EAAG,CAACA,EAAMM,CAAM,CAAC,EAEbE,EACU,gBACZ,MACA,CAAE,KAAM,QAAS,UAAAP,EAAW,MAAAC,CAAM,EAClC,+BAA+BM,EAAM,OAAO,EAC7C,EAGY,gBAAc,uBAAwB,CAClD,IAAKH,EACL,UAAAJ,EACA,MAAAC,EACA,GAAGC,CACJ,CAAC,CACF,CACD",
|
|
6
6
|
"names": ["React", "SCRIPT_ID", "CDN_BASE_LATEST", "CDN_BASE_PREFIX", "CDN_BASE_SUFFIX", "loaded", "buildBase", "version", "ensureScriptLoaded", "resolve", "reject", "url", "existing", "RoxyChoghadiyaGrid", "data", "className", "style", "rest", "ref", "internal", "loaded", "setLoaded", "error", "setError", "active", "ensureScriptLoaded", "err", "el"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/compatibility-card.tsx", "../../src/load-ui.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\nimport type { CalculateBioCompatibilityResponse, CalculateCompatibilityResponse, CalculateNumCompatibilityResponse } from '@roxyapi/ui/types';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children' | 'data'\n>;\n\nexport interface RoxyCompatibilityCardProps extends ElementAttrs {\n\t/** Spec-derived response payload. Pass the raw RoxyAPI response. */\n\tdata?: CalculateCompatibilityResponse | CalculateNumCompatibilityResponse | CalculateBioCompatibilityResponse;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\t/** Which compatibility domain the response is from. Themes the card and labels the category breakdown. */\n\tmode?: 'astrology' | 'numerology' | 'biorhythm';\n\n}\n\nexport const RoxyCompatibilityCard = React.forwardRef<HTMLElement | null, RoxyCompatibilityCardProps>(\n\tfunction RoxyCompatibilityCard({ data, className, style, mode, ...rest }, ref) {\n\t\tconst internal = React.useRef<HTMLElement | null>(null);\n\t\tReact.useImperativeHandle<HTMLElement | null, HTMLElement | null>(\n\t\t\tref,\n\t\t\t() => internal.current,\n\t\t\t[],\n\t\t);\n\t\tconst [loaded, setLoaded] = React.useState(false);\n\t\tconst [error, setError] = React.useState<Error | null>(null);\n\n\t\tReact.useEffect(() => {\n\t\t\tlet active = true;\n\t\t\tensureScriptLoaded()\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (active) setLoaded(true);\n\t\t\t\t})\n\t\t\t\t.catch((err: unknown) => {\n\t\t\t\t\tif (!active) return;\n\t\t\t\t\tsetError(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\t});\n\t\t\treturn () => {\n\t\t\t\tactive = false;\n\t\t\t};\n\t\t}, []);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && data !== undefined) {\n\t\t\t\t(el as unknown as { data: unknown }).data = data;\n\t\t\t}\n\t\t}, [data, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && mode !== undefined) {\n\t\t\t\t(el as unknown as { mode: 'astrology' | 'numerology' | 'biorhythm' }).mode = mode;\n\t\t\t}\n\t\t}, [mode, loaded]);\n\n\t\tif (error) {\n\t\t\treturn React.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ role: 'alert', className, style },\n\t\t\t\t`Roxy UI script load failed: ${error.message}`,\n\t\t\t);\n\t\t}\n\n\t\treturn React.createElement('roxy-compatibility-card', {\n\t\t\tref: internal,\n\t\t\tclassName,\n\t\t\tstyle,\n\t\t\t...rest,\n\t\t});\n\t},\n);\n", "/**\n * Loads the matching component bundle on first mount. Idempotent across\n * many components on the same page. Skips on the server (no document) so\n * React server components and Next.js SSR work without a flash.\n *\n * Pass an explicit `version` (e.g. `'0.1.5'`) to pin the loaded bundle to a\n * specific @roxyapi/ui release; the default ('latest') resolves to whatever\n * the CDN currently serves for @latest.\n */\nconst SCRIPT_ID = 'roxyapi-ui-loader';\nconst CDN_BASE_LATEST = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn\";\nconst CDN_BASE_PREFIX = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@\";\nconst CDN_BASE_SUFFIX = \"/dist/cdn\";\n\nlet loaded: Promise<void> | null = null;\n\nfunction buildBase(version: string): string {\n\tif (!version || version === 'latest') return CDN_BASE_LATEST;\n\treturn `${CDN_BASE_PREFIX}${version}${CDN_BASE_SUFFIX}`;\n}\n\nexport function ensureScriptLoaded(version: string = 'latest'): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tif (loaded) return loaded;\n\n\tloaded = new Promise<void>((resolve, reject) => {\n\t\tconst url = `${buildBase(version)}/roxy-ui.js`;\n\t\tlet existing = document.getElementById(SCRIPT_ID) as HTMLScriptElement | null;\n\t\tif (existing) {\n\t\t\tif (existing.dataset.loaded === 'true') {\n\t\t\t\tresolve();\n\t\t\t} else {\n\t\t\t\texisting.addEventListener('load', () => resolve());\n\t\t\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\texisting = document.createElement('script');\n\t\texisting.id = SCRIPT_ID;\n\t\texisting.src = url;\n\t\texisting.async = true;\n\t\texisting.crossOrigin = 'anonymous';\n\t\texisting.addEventListener('load', () => {\n\t\t\texisting!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\tdocument.head.appendChild(existing);\n\t});\n\treturn loaded;\n}\n\n// Default export retained for convenience; matches the named export.\nexport default ensureScriptLoaded;\n// Surfaces the embedded @roxyapi/ui version this build of @roxyapi/ui-react\n// was generated against. Useful for diagnostics; not load-bearing.\nexport const ROXY_UI_VERSION = \"0.
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\nimport type { CalculateBioCompatibilityResponse, CalculateCompatibilityResponse, CalculateNumCompatibilityResponse } from '@roxyapi/ui/types';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children' | 'data'\n>;\n\nexport interface RoxyCompatibilityCardProps extends ElementAttrs {\n\t/** Spec-derived response payload. Pass the raw RoxyAPI response. */\n\tdata?: CalculateCompatibilityResponse | CalculateNumCompatibilityResponse | CalculateBioCompatibilityResponse;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\t/** Which compatibility domain the response is from. Themes the card and labels the category breakdown. */\n\tmode?: 'astrology' | 'numerology' | 'biorhythm';\n\n}\n\nexport const RoxyCompatibilityCard = React.forwardRef<HTMLElement | null, RoxyCompatibilityCardProps>(\n\tfunction RoxyCompatibilityCard({ data, className, style, mode, ...rest }, ref) {\n\t\tconst internal = React.useRef<HTMLElement | null>(null);\n\t\tReact.useImperativeHandle<HTMLElement | null, HTMLElement | null>(\n\t\t\tref,\n\t\t\t() => internal.current,\n\t\t\t[],\n\t\t);\n\t\tconst [loaded, setLoaded] = React.useState(false);\n\t\tconst [error, setError] = React.useState<Error | null>(null);\n\n\t\tReact.useEffect(() => {\n\t\t\tlet active = true;\n\t\t\tensureScriptLoaded()\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (active) setLoaded(true);\n\t\t\t\t})\n\t\t\t\t.catch((err: unknown) => {\n\t\t\t\t\tif (!active) return;\n\t\t\t\t\tsetError(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\t});\n\t\t\treturn () => {\n\t\t\t\tactive = false;\n\t\t\t};\n\t\t}, []);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && data !== undefined) {\n\t\t\t\t(el as unknown as { data: unknown }).data = data;\n\t\t\t}\n\t\t}, [data, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && mode !== undefined) {\n\t\t\t\t(el as unknown as { mode: 'astrology' | 'numerology' | 'biorhythm' }).mode = mode;\n\t\t\t}\n\t\t}, [mode, loaded]);\n\n\t\tif (error) {\n\t\t\treturn React.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ role: 'alert', className, style },\n\t\t\t\t`Roxy UI script load failed: ${error.message}`,\n\t\t\t);\n\t\t}\n\n\t\treturn React.createElement('roxy-compatibility-card', {\n\t\t\tref: internal,\n\t\t\tclassName,\n\t\t\tstyle,\n\t\t\t...rest,\n\t\t});\n\t},\n);\n", "/**\n * Loads the matching component bundle on first mount. Idempotent across\n * many components on the same page. Skips on the server (no document) so\n * React server components and Next.js SSR work without a flash.\n *\n * Pass an explicit `version` (e.g. `'0.1.5'`) to pin the loaded bundle to a\n * specific @roxyapi/ui release; the default ('latest') resolves to whatever\n * the CDN currently serves for @latest.\n */\nconst SCRIPT_ID = 'roxyapi-ui-loader';\nconst CDN_BASE_LATEST = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn\";\nconst CDN_BASE_PREFIX = \"https://cdn.jsdelivr.net/npm/@roxyapi/ui@\";\nconst CDN_BASE_SUFFIX = \"/dist/cdn\";\n\nlet loaded: Promise<void> | null = null;\n\nfunction buildBase(version: string): string {\n\tif (!version || version === 'latest') return CDN_BASE_LATEST;\n\treturn `${CDN_BASE_PREFIX}${version}${CDN_BASE_SUFFIX}`;\n}\n\nexport function ensureScriptLoaded(version: string = 'latest'): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tif (loaded) return loaded;\n\n\tloaded = new Promise<void>((resolve, reject) => {\n\t\tconst url = `${buildBase(version)}/roxy-ui.js`;\n\t\tlet existing = document.getElementById(SCRIPT_ID) as HTMLScriptElement | null;\n\t\tif (existing) {\n\t\t\tif (existing.dataset.loaded === 'true') {\n\t\t\t\tresolve();\n\t\t\t} else {\n\t\t\t\texisting.addEventListener('load', () => resolve());\n\t\t\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\texisting = document.createElement('script');\n\t\texisting.id = SCRIPT_ID;\n\t\texisting.src = url;\n\t\texisting.async = true;\n\t\texisting.crossOrigin = 'anonymous';\n\t\texisting.addEventListener('load', () => {\n\t\t\texisting!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\texisting.addEventListener('error', () => reject(new Error('roxy-ui load failed')));\n\t\tdocument.head.appendChild(existing);\n\t});\n\treturn loaded;\n}\n\n// Default export retained for convenience; matches the named export.\nexport default ensureScriptLoaded;\n// Surfaces the embedded @roxyapi/ui version this build of @roxyapi/ui-react\n// was generated against. Useful for diagnostics; not load-bearing.\nexport const ROXY_UI_VERSION = \"0.8.1\";\n"],
|
|
5
5
|
"mappings": "AAAA,UAAYA,MAAW,QCSvB,IAAMC,EAAY,oBACZC,EAAkB,2DAClBC,EAAkB,4CAClBC,EAAkB,YAEpBC,EAA+B,KAEnC,SAASC,EAAUC,EAAyB,CAC3C,MAAI,CAACA,GAAWA,IAAY,SAAiBL,EACtC,GAAGC,CAAe,GAAGI,CAAO,GAAGH,CAAe,EACtD,CAEO,SAASI,EAAmBD,EAAkB,SAAyB,CAC7E,OAAI,OAAO,SAAa,IAAoB,QAAQ,QAAQ,EACxDF,IAEJA,EAAS,IAAI,QAAc,CAACI,EAASC,IAAW,CAC/C,IAAMC,EAAM,GAAGL,EAAUC,CAAO,CAAC,cAC7BK,EAAW,SAAS,eAAeX,CAAS,EAChD,GAAIW,EAAU,CACTA,EAAS,QAAQ,SAAW,OAC/BH,EAAQ,GAERG,EAAS,iBAAiB,OAAQ,IAAMH,EAAQ,CAAC,EACjDG,EAAS,iBAAiB,QAAS,IAAMF,EAAO,IAAI,MAAM,qBAAqB,CAAC,CAAC,GAElF,MACD,CACAE,EAAW,SAAS,cAAc,QAAQ,EAC1CA,EAAS,GAAKX,EACdW,EAAS,IAAMD,EACfC,EAAS,MAAQ,GACjBA,EAAS,YAAc,YACvBA,EAAS,iBAAiB,OAAQ,IAAM,CACvCA,EAAU,QAAQ,OAAS,OAC3BH,EAAQ,CACT,CAAC,EACDG,EAAS,iBAAiB,QAAS,IAAMF,EAAO,IAAI,MAAM,qBAAqB,CAAC,CAAC,EACjF,SAAS,KAAK,YAAYE,CAAQ,CACnC,CAAC,EACMP,EACR,CD/BO,IAAMQ,EAA8B,aAC1C,SAA+B,CAAE,KAAAC,EAAM,UAAAC,EAAW,MAAAC,EAAO,KAAAC,EAAM,GAAGC,CAAK,EAAGC,EAAK,CAC9E,IAAMC,EAAiB,SAA2B,IAAI,EAChD,sBACLD,EACA,IAAMC,EAAS,QACf,CAAC,CACF,EACA,GAAM,CAACC,EAAQC,CAAS,EAAU,WAAS,EAAK,EAC1C,CAACC,EAAOC,CAAQ,EAAU,WAAuB,IAAI,EA+B3D,OA7BM,YAAU,IAAM,CACrB,IAAIC,EAAS,GACb,OAAAC,EAAmB,EACjB,KAAK,IAAM,CACPD,GAAQH,EAAU,EAAI,CAC3B,CAAC,EACA,MAAOK,GAAiB,CACnBF,GACLD,EAASG,aAAe,MAAQA,EAAM,IAAI,MAAM,OAAOA,CAAG,CAAC,CAAC,CAC7D,CAAC,EACK,IAAM,CACZF,EAAS,EACV,CACD,EAAG,CAAC,CAAC,EAEC,YAAU,IAAM,CACrB,IAAMG,EAAKR,EAAS,QAChBQ,GAAMd,IAAS,SACjBc,EAAoC,KAAOd,EAE9C,EAAG,CAACA,EAAMO,CAAM,CAAC,EAEX,YAAU,IAAM,CACrB,IAAMO,EAAKR,EAAS,QAChBQ,GAAMX,IAAS,SACjBW,EAAqE,KAAOX,EAE/E,EAAG,CAACA,EAAMI,CAAM,CAAC,EAEbE,EACU,gBACZ,MACA,CAAE,KAAM,QAAS,UAAAR,EAAW,MAAAC,CAAM,EAClC,+BAA+BO,EAAM,OAAO,EAC7C,EAGY,gBAAc,0BAA2B,CACrD,IAAKH,EACL,UAAAL,EACA,MAAAC,EACA,GAAGE,CACJ,CAAC,CACF,CACD",
|
|
6
6
|
"names": ["React", "SCRIPT_ID", "CDN_BASE_LATEST", "CDN_BASE_PREFIX", "CDN_BASE_SUFFIX", "loaded", "buildBase", "version", "ensureScriptLoaded", "resolve", "reject", "url", "existing", "RoxyCompatibilityCard", "data", "className", "style", "mode", "rest", "ref", "internal", "loaded", "setLoaded", "error", "setError", "active", "ensureScriptLoaded", "err", "el"]
|
|
7
7
|
}
|