@roxyapi/ui-react 0.45.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +11 -4
- package/README.md +3 -3
- package/dist/components/almanac-day.js +1 -1
- package/dist/components/almanac-day.js.map +1 -1
- package/dist/components/angel-number-card.js +1 -1
- package/dist/components/angel-number-card.js.map +1 -1
- package/dist/components/angel-number-lookup.js +1 -1
- package/dist/components/angel-number-lookup.js.map +1 -1
- package/dist/components/arudha-padas.js +1 -1
- package/dist/components/arudha-padas.js.map +1 -1
- package/dist/components/ashtakavarga-grid.js +1 -1
- package/dist/components/ashtakavarga-grid.js.map +1 -1
- package/dist/components/aspects-table.js +1 -1
- package/dist/components/aspects-table.js.map +1 -1
- package/dist/components/astrocartography-map.js +1 -1
- package/dist/components/astrocartography-map.js.map +1 -1
- package/dist/components/bazi-chart.js +1 -1
- package/dist/components/bazi-chart.js.map +1 -1
- package/dist/components/bhav-chalit-table.js +1 -1
- package/dist/components/bhav-chalit-table.js.map +1 -1
- package/dist/components/bhava-bala-table.js +1 -1
- package/dist/components/bhava-bala-table.js.map +1 -1
- package/dist/components/biorhythm-chart.js +1 -1
- package/dist/components/biorhythm-chart.js.map +1 -1
- package/dist/components/bodygraph.js +1 -1
- package/dist/components/bodygraph.js.map +1 -1
- package/dist/components/chara-karakas.js +1 -1
- package/dist/components/chara-karakas.js.map +1 -1
- package/dist/components/choghadiya-grid.js +1 -1
- package/dist/components/choghadiya-grid.js.map +1 -1
- package/dist/components/compatibility-card.js +1 -1
- package/dist/components/compatibility-card.js.map +1 -1
- package/dist/components/crystal-card.js +1 -1
- package/dist/components/crystal-card.js.map +1 -1
- package/dist/components/crystal-grid.js +1 -1
- package/dist/components/crystal-grid.js.map +1 -1
- package/dist/components/dasha-timeline.js +1 -1
- package/dist/components/dasha-timeline.js.map +1 -1
- package/dist/components/data.js +1 -1
- package/dist/components/data.js.map +1 -1
- package/dist/components/divisional-chart.js +1 -1
- package/dist/components/divisional-chart.js.map +1 -1
- package/dist/components/dosha-card.js +1 -1
- package/dist/components/dosha-card.js.map +1 -1
- package/dist/components/dosha-constitution.js +1 -1
- package/dist/components/dosha-constitution.js.map +1 -1
- package/dist/components/dream-card.js +1 -1
- package/dist/components/dream-card.js.map +1 -1
- package/dist/components/dream-search.js +1 -1
- package/dist/components/dream-search.js.map +1 -1
- package/dist/components/endpoint-form.js +1 -1
- package/dist/components/endpoint-form.js.map +1 -1
- package/dist/components/ephemeris-table.js +1 -1
- package/dist/components/ephemeris-table.js.map +1 -1
- package/dist/components/fixed-stars.js +1 -1
- package/dist/components/fixed-stars.js.map +1 -1
- package/dist/components/flying-star-chart.js +1 -1
- package/dist/components/flying-star-chart.js.map +1 -1
- package/dist/components/forecast-digest.js +1 -1
- package/dist/components/forecast-digest.js.map +1 -1
- package/dist/components/forecast-timeline.js +1 -1
- package/dist/components/forecast-timeline.js.map +1 -1
- package/dist/components/gematria.js +1 -1
- package/dist/components/gematria.js.map +1 -1
- package/dist/components/gochara-table.js +1 -1
- package/dist/components/gochara-table.js.map +1 -1
- package/dist/components/guna-milan.js +1 -1
- package/dist/components/guna-milan.js.map +1 -1
- package/dist/components/hd-connection.js +1 -1
- package/dist/components/hd-connection.js.map +1 -1
- package/dist/components/hd-penta.js +1 -1
- package/dist/components/hd-penta.js.map +1 -1
- package/dist/components/hd-type-card.js +1 -1
- package/dist/components/hd-type-card.js.map +1 -1
- package/dist/components/hd-variables.js +1 -1
- package/dist/components/hd-variables.js.map +1 -1
- package/dist/components/heliacal-table.js +1 -1
- package/dist/components/heliacal-table.js.map +1 -1
- package/dist/components/hexagram.js +1 -1
- package/dist/components/hexagram.js.map +1 -1
- package/dist/components/hora-table.js +1 -1
- package/dist/components/hora-table.js.map +1 -1
- package/dist/components/horoscope-card.js +1 -1
- package/dist/components/horoscope-card.js.map +1 -1
- package/dist/components/kp-chart.js +1 -1
- package/dist/components/kp-chart.js.map +1 -1
- package/dist/components/kp-finance-card.js +1 -1
- package/dist/components/kp-finance-card.js.map +1 -1
- package/dist/components/kp-planets-table.js +1 -1
- package/dist/components/kp-planets-table.js.map +1 -1
- package/dist/components/kp-ruling-planets.js +1 -1
- package/dist/components/kp-ruling-planets.js.map +1 -1
- package/dist/components/kua-card.js +1 -1
- package/dist/components/kua-card.js.map +1 -1
- package/dist/components/local-space-compass.js +1 -1
- package/dist/components/local-space-compass.js.map +1 -1
- package/dist/components/location-search.js +1 -1
- package/dist/components/location-search.js.map +1 -1
- package/dist/components/luck-pillars.js +1 -1
- package/dist/components/luck-pillars.js.map +1 -1
- package/dist/components/mayan-day-sign.js +1 -1
- package/dist/components/mayan-day-sign.js.map +1 -1
- package/dist/components/moon-phase.js +1 -1
- package/dist/components/moon-phase.js.map +1 -1
- package/dist/components/nakshatra-card.js +1 -1
- package/dist/components/nakshatra-card.js.map +1 -1
- package/dist/components/natal-chart.js +1 -1
- package/dist/components/natal-chart.js.map +1 -1
- package/dist/components/numerology-card.js +1 -1
- package/dist/components/numerology-card.js.map +1 -1
- package/dist/components/panchang-table.js +1 -1
- package/dist/components/panchang-table.js.map +1 -1
- package/dist/components/positions-table.js +1 -1
- package/dist/components/positions-table.js.map +1 -1
- package/dist/components/profection-card.js +1 -1
- package/dist/components/profection-card.js.map +1 -1
- package/dist/components/reference-card.js +1 -1
- package/dist/components/reference-card.js.map +1 -1
- package/dist/components/relocation-wheel.js +1 -1
- package/dist/components/relocation-wheel.js.map +1 -1
- package/dist/components/shadbala-table.js +1 -1
- package/dist/components/shadbala-table.js.map +1 -1
- package/dist/components/synastry-chart.js +1 -1
- package/dist/components/synastry-chart.js.map +1 -1
- package/dist/components/tarot-card.js +1 -1
- package/dist/components/tarot-card.js.map +1 -1
- package/dist/components/tarot-catalog.js +1 -1
- package/dist/components/tarot-catalog.js.map +1 -1
- package/dist/components/tarot-spread.js +1 -1
- package/dist/components/tarot-spread.js.map +1 -1
- package/dist/components/transit-wheel.js +1 -1
- package/dist/components/transit-wheel.js.map +1 -1
- package/dist/components/transits-table.js +1 -1
- package/dist/components/transits-table.js.map +1 -1
- package/dist/components/upagraha-table.js +1 -1
- package/dist/components/upagraha-table.js.map +1 -1
- package/dist/components/vastu-mandala.js +1 -1
- package/dist/components/vastu-mandala.js.map +1 -1
- package/dist/components/vedic-aspects.js +1 -1
- package/dist/components/vedic-aspects.js.map +1 -1
- package/dist/components/vedic-daily.js +1 -1
- package/dist/components/vedic-daily.js.map +1 -1
- package/dist/components/vedic-kundli.js +1 -1
- package/dist/components/vedic-kundli.js.map +1 -1
- package/dist/components/vedic-planets-table.js +1 -1
- package/dist/components/vedic-planets-table.js.map +1 -1
- package/dist/components/western-planets-table.js +1 -1
- package/dist/components/western-planets-table.js.map +1 -1
- package/dist/components/yoga-list.js +1 -1
- package/dist/components/yoga-list.js.map +1 -1
- package/dist/components/zodiac-card.js +1 -1
- package/dist/components/zodiac-card.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/load-ui.d.ts +1 -1
- package/dist/load-ui.js +1 -1
- package/dist/load-ui.js.map +1 -1
- package/dist/types/types.gen.d.ts +109 -76
- package/dist/types/types.gen.d.ts.map +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -157,6 +157,13 @@ element.data = data;
|
|
|
157
157
|
|
|
158
158
|
Every snippet below follows this rule.
|
|
159
159
|
|
|
160
|
+
A second silent failure: assigning `data` before the element is defined. With a deferred script tag, a property set on a tag the bundle has not upgraded yet shadows the accessor the component later defines, and the card stays empty with no error. Wait for the definition first:
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
await customElements.whenDefined(element.localName);
|
|
164
|
+
element.data = data;
|
|
165
|
+
```
|
|
166
|
+
|
|
160
167
|
### 2. Hardcoded coordinates
|
|
161
168
|
|
|
162
169
|
Every chart endpoint (Western, Vedic, KP, synastry, transits, dasha, dosha, panchang) needs `latitude`, `longitude`, and `timezone`. Never ask the user to type coordinates. Call `/location/search` first, then feed the result into the chart endpoint.
|
|
@@ -428,18 +435,18 @@ When you do not want a backend at all, mint a **publishable key** (`pk_live_*` /
|
|
|
428
435
|
></roxy-natal-chart>
|
|
429
436
|
```
|
|
430
437
|
|
|
431
|
-
That single element renders a schema-driven form (a zodiac/enum tile picker, a boolean toggle, native date and time inputs, a city search for endpoints that need coordinates, and one card per record for a request that takes several, such as the members of a penta, with `Add` and `Remove` inside the bounds the API declares), fetches on submit, and shows a loading then error-or-result state. Optional fields collapse under one Advanced disclosure, and a form whose only required field is an enum submits on selection (tap a sign, pick a nakshatra, get a reading, no button). When the API rejects a request it names the fields it rejected, and the form prints each message under that input, marks it, opens the Advanced disclosure if the field sits there, and summarises the rejections by field label above the form; editing a field clears its message. The result keeps a re-query affordance: a single-enum picker stays above the result and refetches when the selection changes, any other form gets a compact Edit query control that restores it with the previous values. `method` defaults to `POST`; set `method="GET"` for GET endpoints. Set `data-endpoint` to the spec path without the leading slash (`dreams/symbols/{id}`, `astrology/horoscope/{sign}/daily`).
|
|
438
|
+
That single element renders a schema-driven form (a zodiac/enum tile picker, a boolean toggle, native date and time inputs, a city search for endpoints that need coordinates or a timezone, and one card per record for a request that takes several, such as the members of a penta, with `Add` and `Remove` inside the bounds the API declares), fetches on submit, and shows a loading then error-or-result state. Optional fields collapse under one Advanced disclosure, and a form whose only required field is an enum submits on selection (tap a sign, pick a nakshatra, get a reading, no button). When the API rejects a request it names the fields it rejected, and the form prints each message under that input, marks it, opens the Advanced disclosure if the field sits there, and summarises the rejections by field label above the form; editing a field clears its message. The result keeps a re-query affordance: a single-enum picker stays above the result and refetches when the selection changes, any other form gets a compact Edit query control that restores it with the previous values. `method` defaults to `POST`; set `method="GET"` for GET endpoints. Set `data-endpoint` to the spec path without the leading slash (`dreams/symbols/{id}`, `astrology/horoscope/{sign}/daily`).
|
|
432
439
|
|
|
433
440
|
**Key handling is the contract. The component enforces it, not you:**
|
|
434
441
|
|
|
435
442
|
- The publishable key is safe in client code: it is origin-restricted (any other origin gets 403) and cannot read your account.
|
|
436
|
-
- A **secret key never works here.** If `publishable-key` is not a `pk_` key the component
|
|
443
|
+
- A **secret key never works here.** If `publishable-key` is not a `pk_` key, or is still the `pk_live_YOUR_KEY` sample from a copied snippet, the component shows the reason in place of its form, sends nothing, and emits a `roxy-validation-error` event whose `reason` is `possible-secret-key` or `sample-key`. A secret key cannot leak through self-fetch even by mistake.
|
|
437
444
|
- A component that cannot draw a response it received (a shape it was not written for) falls back to the generic `<roxy-data>` table for that response and emits a `roxy-render-error` event with the exception, so a page never keeps a loading placeholder on screen.
|
|
438
445
|
- For production with a backend, prefer controlled mode (Patterns 1, 6, 7): the server fetches with the `sk_` key and injects the response, so no key of any kind reaches the browser.
|
|
439
446
|
|
|
440
447
|
In React, the same props are typed: `<RoxyNatalChart endpoint="astrology/natal-chart" publishableKey={process.env.NEXT_PUBLIC_ROXY_PK} />`.
|
|
441
448
|
|
|
442
|
-
**Three optional attributes on the self-fetch element.** `lang` sets the response language (`en`, `tr`, `de`, `es`, `hi`, `pt`, `fr`, `ru`, `zh-Hans`, `zh-Hant`): put it on the element (`<roxy-horoscope-card lang="de" ...>`) and the form routes it to the `?lang=` query on submit, so visitors never see a language field. `submit-label` overrides the derived button label. `attribution` renders a small "Spiritual data by RoxyAPI" credit under the result: off by default on every path
|
|
449
|
+
**Three optional attributes on the self-fetch element.** `lang` sets the response language (`en`, `tr`, `de`, `es`, `hi`, `pt`, `fr`, `ru`, `zh-Hans`, `zh-Hant`): put it on the element (`<roxy-horoscope-card lang="de" ...>`) and the form routes it to the `?lang=` query on submit, so visitors never see a language field. `submit-label` overrides the derived button label. `attribution` renders a small "Spiritual data by RoxyAPI" credit under the result: off by default on every path. The one-tag script below forwards `data-submit-label`, `data-attribution`, `data-hide-sections` and `data-hide-readings` to the element and never sends them as request parameters. None of these apply in controlled mode. A list that shows one entry per tile (the dream search, the crystal grid) opens the picked entry in place under its tiles when it holds the key, and every pick also emits `roxy-symbol-select` for a page that pairs its own card. Any element that carries a key exposes `load({ path, method, query })`, which fetches one request into it and renders the result as assigned data.
|
|
443
450
|
|
|
444
451
|
**One tag, no element wiring.** For the simplest embed, load `dist/cdn/widgets.js` and drop a `<div data-roxy-widget="{slug}" data-publishable-key="pk_live_...">`. The script mounts the matching component from a generated slug map: with every path parameter supplied as a `data-*` attribute (`data-sign`, `data-id`) it fetches on mount, otherwise it renders the same input form. A second `data-*` attribute picks a variant (`data-period`, `data-mode`, `data-type`, `data-spread`). To keep every key on your own server instead, drop the publishable key and give the tag `data-submit-url` and `data-location-url`: the widget renders the form and routes both its requests there. `data-submit-context` rides along with the submitted one.
|
|
445
452
|
|
|
@@ -667,7 +674,7 @@ Both are off by default. `hide-sections` takes a comma-separated list, is case-i
|
|
|
667
674
|
| `section` | Any structural block, paired with a specific name (`section patterns`), so `::part(patterns)` targets that block alone |
|
|
668
675
|
| `readings` | The interpretation accordion |
|
|
669
676
|
| `reading` | One disclosure card inside it |
|
|
670
|
-
| `hint` | The help text under a field of the built-in form, which quotes the API reference for that field. Hide it with `::part(hint)` on a page written for a reader who did not come for the reference; the label, the input and the validation stay |
|
|
677
|
+
| `hint` | The help text under a field of the built-in form, which quotes the API reference for that field. Hide it with `::part(hint)` on a page written for a reader who did not come for the reference, or with `hide-sections="hint"` on one element (the copy-paste snippets carry it); the label, the input and the validation stay |
|
|
671
678
|
| `field-error` | One message the API returned about one input of the built-in form, printed under it, or about one record card, printed on it |
|
|
672
679
|
| `detail` | The row a list opened in place under its tiles (dream search, crystal grid); the card inside is themed through the tokens |
|
|
673
680
|
| `form`, `loading`, `error`, `edit-bar`, `attribution` | The built-in states, on every component |
|
package/README.md
CHANGED
|
@@ -822,11 +822,11 @@ Two key types. **Secret keys** (`sk_*`) grant full account access: use them serv
|
|
|
822
822
|
Two ways to feed a component, and the key rule for each:
|
|
823
823
|
|
|
824
824
|
- **Controlled (recommended for production).** Your server fetches with the secret key and passes the response in via the `data` property or a `roxy-data` JSON island. No key of any kind reaches the browser. This is what the WordPress plugin and the server-rendered patterns do.
|
|
825
|
-
- **Self-fetch (no backend).** Give the component a `data-endpoint` and a `publishable-key` and it renders its own form and fetches in the browser. Only publishable keys work here: a secret key is refused client-side, so the component sends nothing and raises a validation error. A secret key cannot leak through self-fetch.
|
|
825
|
+
- **Self-fetch (no backend).** Give the component a `data-endpoint` and a `publishable-key` and it renders its own form and fetches in the browser. Only publishable keys work here: a secret key, or the `pk_live_YOUR_KEY` sample left in a copied snippet, is refused client-side, so the component shows the reason in place of its form, sends nothing and raises a validation error. A secret key cannot leak through self-fetch.
|
|
826
826
|
|
|
827
827
|
Set `ROXY_API_KEY` to your secret key in your server env for the server-side SDK examples on this page. For self-fetch embedding with no backend, use a publishable key (see the fully client-side pattern in [`AGENTS.md`](AGENTS.md)).
|
|
828
828
|
|
|
829
|
-
The self-fetch form renders spec-driven inputs (a zodiac tile picker, a boolean toggle, native date and time, a city search, and one card per record for a request that takes several, with `Add` and `Remove` inside the bounds the API declares), collapses optional fields under one Advanced disclosure, reads a `lang` attribute for localized responses, and prints what the API rejects under the input it rejected, marked and summarised by label. When the page routes RoxyAPI traffic through your own server instead, `submit-url` names the route that answers the submitted request and `location-url` names the one that answers the city search, so both halves of a birth-data form go to your server and no key of any kind reaches the browser. `submit-context` takes a JSON object of your own and hands it to that route as `context` beside the request, which is where a page attaches its own verification data to a submission. For the simplest embed, load `dist/cdn/widgets.js` and drop one `<div data-roxy-widget="{slug}" data-publishable-key="pk_live_...">`: with the required attributes present it fetches on mount, otherwise it renders the form. That tag takes `data-submit-url`, `data-location-url` and `data-submit-context` too, so a one-tag embed can route both its requests through your server and carry no key at all. A single `<link>` to the [practitioner theme preset](https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/styles/themes/practitioner.css) restyles every widget on the page. A list that shows one entry per tile (the dream search, the crystal grid) opens the picked entry in place under its tiles when it holds the key, and every pick also emits `roxy-symbol-select` for a page that pairs its own card. Any element that carries a key exposes `load({ path, method, query })`, which fetches one request into it and renders the result as assigned data.
|
|
829
|
+
The self-fetch form renders spec-driven inputs (a zodiac tile picker, a boolean toggle, native date and time, a city search wherever the request takes coordinates or a timezone, and one card per record for a request that takes several, with `Add` and `Remove` inside the bounds the API declares), collapses optional fields under one Advanced disclosure, reads a `lang` attribute for localized responses, and prints what the API rejects under the input it rejected, marked and summarised by label. When the page routes RoxyAPI traffic through your own server instead, `submit-url` names the route that answers the submitted request and `location-url` names the one that answers the city search, so both halves of a birth-data form go to your server and no key of any kind reaches the browser. `submit-context` takes a JSON object of your own and hands it to that route as `context` beside the request, which is where a page attaches its own verification data to a submission. For the simplest embed, load `dist/cdn/widgets.js` and drop one `<div data-roxy-widget="{slug}" data-publishable-key="pk_live_...">`: with the required attributes present it fetches on mount, otherwise it renders the form. That tag takes `data-submit-url`, `data-location-url` and `data-submit-context` too, so a one-tag embed can route both its requests through your server and carry no key at all. A single `<link>` to the [practitioner theme preset](https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/styles/themes/practitioner.css) restyles every widget on the page. A list that shows one entry per tile (the dream search, the crystal grid) opens the picked entry in place under its tiles when it holds the key, and every pick also emits `roxy-symbol-select` for a page that pairs its own card. Any element that carries a key exposes `load({ path, method, query })`, which fetches one request into it and renders the result as assigned data.
|
|
830
830
|
|
|
831
831
|
## Distribution
|
|
832
832
|
|
|
@@ -972,7 +972,7 @@ roxy-natal-chart::part(card) {
|
|
|
972
972
|
}
|
|
973
973
|
```
|
|
974
974
|
|
|
975
|
-
The parts: `card`, `header`, `chart`, `legend`, `details`, `table`, `tablist`, `tab`, `panel`, `section`, `readings`, `reading`, `detail` (the row a list opened in place), plus `form`, `hint`, `field-error`, `loading`, `error`, `edit-bar` and `attribution` on the built-in states. `hint` is the help text under a field of the built-in form, which quotes the API reference for that field: hide it with `::part(hint)` when the page is written for a reader who did not come for the reference, and the label, the input and its validation stay. A `section` also carries its own name, which is what `::part(patterns)` above targets, so any single block can be dropped or restyled on its own.
|
|
975
|
+
The parts: `card`, `header`, `chart`, `legend`, `details`, `table`, `tablist`, `tab`, `panel`, `section`, `readings`, `reading`, `detail` (the row a list opened in place), plus `form`, `hint`, `field-error`, `loading`, `error`, `edit-bar` and `attribution` on the built-in states. `hint` is the help text under a field of the built-in form, which quotes the API reference for that field: hide it with `::part(hint)` when the page is written for a reader who did not come for the reference, or with `hide-sections="hint"` on one element, and the label, the input and its validation stay. The copy-paste snippets carry `hide-sections="hint"` already. A `section` also carries its own name, which is what `::part(patterns)` above targets, so any single block can be dropped or restyled on its own.
|
|
976
976
|
|
|
977
977
|
That list is the shared vocabulary, not the whole set. **[`components-catalog.json`](https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/components-catalog.json) carries a `parts` array for every component**, so you can read the exact names a component answers to instead of guessing or inspecting the DOM. A name means the same block wherever it appears, which is what makes one rule enough: `::part(aspects)` reaches the aspect grid on a natal chart, the aspect list on an aspects table and the transit aspects on a transits table alike.
|
|
978
978
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as n from"react";var I="0.
|
|
1
|
+
import*as n from"react";var I="0.47.0",b="roxyapi-ui-loader",M="https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn",_="https://cdn.jsdelivr.net/npm/@roxyapi/ui@",$="/dist/cdn",d=null;function C(a){return!a||a==="latest"?M:`${_}${a}${$}`}function v(a=I,i){return typeof document>"u"?Promise.resolve():d||(d=new Promise((o,c)=>{let u=`${i??C(a)}/roxy-ui.js`,r=document.getElementById(b);if(r){r.dataset.loaded==="true"?o():(r.addEventListener("load",()=>o()),r.addEventListener("error",()=>c(new Error("roxy-ui load failed"))));return}r=document.createElement("script"),r.id=b,r.src=u,r.async=!0,r.crossOrigin="anonymous",r.addEventListener("load",()=>{r.dataset.loaded="true",o()}),r.addEventListener("error",()=>c(new Error("roxy-ui load failed"))),document.head.appendChild(r)}),d)}var B=n.forwardRef(function({data:i,className:o,style:c,mode:u,endpoint:r,method:l,publishableKey:f,baseUrl:m,submitUrl:E,submitContext:p,locationUrl:R,specUrl:g,lang:y,submitLabel:w,remember:L,attribution:x,hideReadings:k,hideSections:h,...P},T){let t=n.useRef(null);n.useImperativeHandle(T,()=>t.current,[]);let[s,D]=n.useState(!1),[A,H]=n.useState(null);return n.useEffect(()=>{let e=!0;return v().then(()=>{e&&D(!0)}).catch(S=>{e&&H(S instanceof Error?S:new Error(String(S)))}),()=>{e=!1}},[]),n.useEffect(()=>{let e=t.current;e&&i!==void 0&&(e.data=i)},[i,s]),n.useEffect(()=>{let e=t.current;e&&u!==void 0&&(e.mode=u)},[u,s]),n.useEffect(()=>{let e=t.current;e&&r!==void 0&&(e.endpoint=r)},[r,s]),n.useEffect(()=>{let e=t.current;e&&l!==void 0&&(e.method=l)},[l,s]),n.useEffect(()=>{let e=t.current;e&&f!==void 0&&(e.publishableKey=f)},[f,s]),n.useEffect(()=>{let e=t.current;e&&m!==void 0&&(e.baseUrl=m)},[m,s]),n.useEffect(()=>{let e=t.current;e&&E!==void 0&&(e.submitUrl=E)},[E,s]),n.useEffect(()=>{let e=t.current;e&&p!==void 0&&(e.submitContext=p)},[p,s]),n.useEffect(()=>{let e=t.current;e&&R!==void 0&&(e.locationUrl=R)},[R,s]),n.useEffect(()=>{let e=t.current;e&&g!==void 0&&(e.specUrl=g)},[g,s]),n.useEffect(()=>{let e=t.current;e&&y!==void 0&&(e.lang=y)},[y,s]),n.useEffect(()=>{let e=t.current;e&&w!==void 0&&(e.submitLabel=w)},[w,s]),n.useEffect(()=>{let e=t.current;e&&L!==void 0&&(e.remember=L)},[L,s]),n.useEffect(()=>{let e=t.current;e&&x!==void 0&&(e.attribution=x)},[x,s]),n.useEffect(()=>{let e=t.current;e&&k!==void 0&&(e.hideReadings=k)},[k,s]),n.useEffect(()=>{let e=t.current;e&&h!==void 0&&(e.hideSections=h)},[h,s]),A?n.createElement("div",{role:"alert",className:o,style:c},`Roxy UI script load failed: ${A.message}`):n.createElement("roxy-almanac-day",{ref:t,className:o,style:c,...P})});export{B as RoxyAlmanacDay};
|
|
2
2
|
//# sourceMappingURL=almanac-day.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/almanac-day.tsx", "../../src/load-ui.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\nimport type { GetAlmanacDayResponse, GetMonthlyAlmanacResponse, LookupAuspiciousDaysResponse } from '../types/index.js';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children' | 'data'\n>;\n\nexport interface RoxyAlmanacDayProps extends ElementAttrs {\n\t/** Spec-derived response payload. Pass the raw RoxyAPI response. */\n\tdata?: GetAlmanacDayResponse | GetMonthlyAlmanacResponse | LookupAuspiciousDaysResponse;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\t/** Which read the response is: one almanac day as a card, a whole month of them as rows, or the days a search returned for one activity. */\n\tmode?: 'day' | 'month' | 'auspicious';\n\t/** Endpoint path for built-in self-fetch (uncontrolled mode), e.g. \"astrology/natal-chart\". The component renders its own input form, fetches with the publishable key, and displays the result. Leave unset for controlled mode (pass `data`). */\n\tendpoint?: string;\n\t/** HTTP method for the self-fetch request. Defaults to POST. */\n\tmethod?: 'GET' | 'POST';\n\t/** Browser-safe publishable key (pk_) for self-fetch. A secret key is refused client-side and never sent. */\n\tpublishableKey?: string;\n\t/** Override the API origin for self-hosted or proxied deployments. Absolute, or relative to the page for a same-origin route. */\n\tbaseUrl?: string;\n\t/** Your own backend route, which holds the secret key. Self-fetch POSTs `{ path, method, body, query }` there instead of calling RoxyAPI directly and renders the JSON your route returns, so no key of any kind reaches the browser. */\n\tsubmitUrl?: string;\n\t/** An object of your own, sent to your submitUrl route as `context` beside the request, so a page can attach its own verification data to a proxied submission. Passed through untouched and never read by the component: what it holds is for your page and your route to agree on. Unset, nothing is added and the route receives the request exactly as before. Rides the submitUrl path only; a direct call sends what the endpoint declares. */\n\tsubmitContext?: Record<string, unknown>;\n\t/** Where the self-fetch form city search sends its request, absolute or relative to the page. The companion of submitUrl: the city search is a GET the form issues on its own while a visitor types, so a page that routes its API traffic through its own server names that route here as well. Unset, the search calls the public location endpoint. */\n\tlocationUrl?: string;\n\t/** Override the OpenAPI spec URL the self-fetch form introspects. */\n\tspecUrl?: string;\n\t/** Response language for self-fetch, forwarded to the API `lang` query parameter (en, tr, de, es, hi, pt, fr, ru). The form never shows a language field; the site owner sets it here. Defaults to English. */\n\tlang?: string;\n\t/** Override the self-fetch form submit-button label. Empty derives an outcome-first label from the endpoint (Get reading, Generate, Compare, Cast). */\n\tsubmitLabel?: string;\n\t/** Persist the last self-fetch form values in sessionStorage, keyed by endpoint, and prefill the form when the visitor returns. Off by default. */\n\tremember?: boolean;\n\t/** Render a small \"Spiritual data by RoxyAPI\" credit under a self-fetch result, linking back to RoxyAPI. Off by default; set any value to enable, or \"off\" to force it off. Never shown in controlled mode. */\n\tattribution?: string;\n\t/** Render the chart and the data and omit the written interpretation. Off by default. Use it when the page supplies its own words: the wheels, tables, grids, legends and numbers stay, and the interpretive prose is left out of the markup entirely. */\n\thideReadings?: boolean;\n\t/** Comma-separated list of `part` names to take off this component, for example \"patterns\" or \"patterns, legend\". Per element rather than per site, so the same component can drop a block on one page and keep it on another with no CSS. Sibling of hideReadings and a different tool: this hides a whole block whatever it contains, where hideReadings drops interpretive prose out of the markup. Names come from the `parts` array in components-catalog.json; a name the component does not carry hides nothing and is not an error. */\n\thideSections?: string;\n\n}\n\nexport const RoxyAlmanacDay = React.forwardRef<HTMLElement | null, RoxyAlmanacDayProps>(\n\tfunction RoxyAlmanacDay({ data, className, style, mode, endpoint, method, publishableKey, baseUrl, submitUrl, submitContext, locationUrl, specUrl, lang, submitLabel, remember, attribution, hideReadings, hideSections, ...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: 'day' | 'month' | 'auspicious' }).mode = mode;\n\t\t\t}\n\t\t}, [mode, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && endpoint !== undefined) {\n\t\t\t\t(el as unknown as { endpoint: string }).endpoint = endpoint;\n\t\t\t}\n\t\t}, [endpoint, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && method !== undefined) {\n\t\t\t\t(el as unknown as { method: 'GET' | 'POST' }).method = method;\n\t\t\t}\n\t\t}, [method, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && publishableKey !== undefined) {\n\t\t\t\t(el as unknown as { publishableKey: string }).publishableKey = publishableKey;\n\t\t\t}\n\t\t}, [publishableKey, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && baseUrl !== undefined) {\n\t\t\t\t(el as unknown as { baseUrl: string }).baseUrl = baseUrl;\n\t\t\t}\n\t\t}, [baseUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitUrl !== undefined) {\n\t\t\t\t(el as unknown as { submitUrl: string }).submitUrl = submitUrl;\n\t\t\t}\n\t\t}, [submitUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitContext !== undefined) {\n\t\t\t\t(el as unknown as { submitContext: Record<string, unknown> }).submitContext = submitContext;\n\t\t\t}\n\t\t}, [submitContext, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && locationUrl !== undefined) {\n\t\t\t\t(el as unknown as { locationUrl: string }).locationUrl = locationUrl;\n\t\t\t}\n\t\t}, [locationUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && specUrl !== undefined) {\n\t\t\t\t(el as unknown as { specUrl: string }).specUrl = specUrl;\n\t\t\t}\n\t\t}, [specUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && lang !== undefined) {\n\t\t\t\t(el as unknown as { lang: string }).lang = lang;\n\t\t\t}\n\t\t}, [lang, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitLabel !== undefined) {\n\t\t\t\t(el as unknown as { submitLabel: string }).submitLabel = submitLabel;\n\t\t\t}\n\t\t}, [submitLabel, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && remember !== undefined) {\n\t\t\t\t(el as unknown as { remember: boolean }).remember = remember;\n\t\t\t}\n\t\t}, [remember, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && attribution !== undefined) {\n\t\t\t\t(el as unknown as { attribution: string }).attribution = attribution;\n\t\t\t}\n\t\t}, [attribution, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && hideReadings !== undefined) {\n\t\t\t\t(el as unknown as { hideReadings: boolean }).hideReadings = hideReadings;\n\t\t\t}\n\t\t}, [hideReadings, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && hideSections !== undefined) {\n\t\t\t\t(el as unknown as { hideSections: string }).hideSections = hideSections;\n\t\t\t}\n\t\t}, [hideSections, 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-almanac-day', {\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 * {@link ensureLocaleLoaded} is the other half and is OPT-IN: it loads the label\n * catalogue for one language from the same release, so a non-English app calls\n * both. There is one catalogue, shipped by `@roxyapi/ui` and read by every\n * wrapper, so nothing is restated here.\n *\n * Defaults to the EXACT @roxyapi/ui release this wrapper was built against, so\n * `@roxyapi/ui-vue@x.y.z` always runs `@roxyapi/ui@x.y.z` and a lockfile actually\n * pins the runtime: it is a fixed version rather than a moving alias, so a later\n * @roxyapi/ui release cannot change the elements under an existing install.\n *\n * Pass an explicit `version` to override, or 'latest' to opt back into floating.\n *\n * Pass `baseUrl` to serve the bundle from your own origin instead of the CDN, which is\n * what an air-gapped install or a strict Content-Security-Policy needs: copy\n * `node_modules/@roxyapi/ui/dist/cdn/` onto your host and call this once at app entry,\n * before any component mounts. The loader keeps a single shared promise, so the first\n * call wins and every component reuses it.\n */\n/** The @roxyapi/ui release this wrapper was generated against. The loader defaults to it, so the wrapper version in your lockfile is the runtime you actually get. */\nexport const ROXY_UI_VERSION = \"0.45.0\";\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(\n\tversion: string = ROXY_UI_VERSION,\n\tbaseUrl?: string,\n): 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 = `${baseUrl ?? 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/** Every language a label catalogue ships for. English is absent on purpose: the catalogue key IS the English string, so an English page downloads nothing. */\nexport const ROXY_UI_LOCALES = [\"de\",\"es\",\"fr\",\"hi\",\"pt\",\"ru\",\"tr\",\"zh-Hans\",\"zh-Hant\"] as const;\n\nconst localesLoaded = new Map<string, Promise<void>>();\n\n/**\n * Load the label catalogue for one language, so the components write their own\n * headings, buttons, empty states and form labels in it.\n *\n * Call it once at app entry, beside `ensureScriptLoaded`. The components read the\n * language from the page (their own `lang` attribute, the nearest ancestor\n * carrying one, or `<html lang>`), so this call supplies the WORDS and the page\n * supplies the CHOICE. Loading a catalogue a page never asks for is harmless.\n *\n * `es-AR`, `es-MX` and `es-419` all resolve to the `es` catalogue, so pass the\n * page tag as it stands. English resolves to nothing at all and is not an error:\n * the catalogue is keyed by the English text, so an English page needs no payload.\n * A language outside `ROXY_UI_LOCALES` resolves the same way rather than appending\n * a script tag that 404s.\n *\n * `version` and `baseUrl` behave exactly as they do for {@link ensureScriptLoaded},\n * and passing the same `baseUrl` to both is what an air-gapped or strict-CSP host\n * needs: copy `node_modules/@roxyapi/ui/dist/cdn/` onto your own origin, which\n * carries `locales/` beside `roxy-ui.js`.\n *\n * @example\n * ```ts\n * import { ensureScriptLoaded, ensureLocaleLoaded } from '@roxyapi/ui-react';\n *\n * ensureScriptLoaded();\n * ensureLocaleLoaded(document.documentElement.lang);\n * ```\n */\nexport function ensureLocaleLoaded(\n\tlang: string,\n\tversion: string = ROXY_UI_VERSION,\n\tbaseUrl?: string,\n): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tconst base = (lang || '').toLowerCase().split('-')[0] ?? '';\n\tif (!(ROXY_UI_LOCALES as readonly string[]).includes(base)) {\n\t\treturn Promise.resolve();\n\t}\n\tconst existing = localesLoaded.get(base);\n\tif (existing) return existing;\n\n\tconst pending = new Promise<void>((resolve, reject) => {\n\t\tconst id = `${SCRIPT_ID}-locale-${base}`;\n\t\tlet el = document.getElementById(id) as HTMLScriptElement | null;\n\t\tif (el) {\n\t\t\tif (el.dataset.loaded === 'true') resolve();\n\t\t\telse {\n\t\t\t\tel.addEventListener('load', () => resolve());\n\t\t\t\tel.addEventListener('error', () => reject(new Error(`roxy-ui locale ${base} load failed`)));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tel = document.createElement('script');\n\t\tel.id = id;\n\t\tel.src = `${baseUrl ?? buildBase(version)}/locales/${base}.js`;\n\t\tel.async = true;\n\t\tel.crossOrigin = 'anonymous';\n\t\tel.addEventListener('load', () => {\n\t\t\tel!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\tel.addEventListener('error', () => reject(new Error(`roxy-ui locale ${base} load failed`)));\n\t\tdocument.head.appendChild(el);\n\t});\n\tlocalesLoaded.set(base, pending);\n\treturn pending;\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.\n"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\nimport type { GetAlmanacDayResponse, GetMonthlyAlmanacResponse, LookupAuspiciousDaysResponse } from '../types/index.js';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children' | 'data'\n>;\n\nexport interface RoxyAlmanacDayProps extends ElementAttrs {\n\t/** Spec-derived response payload. Pass the raw RoxyAPI response. */\n\tdata?: GetAlmanacDayResponse | GetMonthlyAlmanacResponse | LookupAuspiciousDaysResponse;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\t/** Which read the response is: one almanac day as a card, a whole month of them as rows, or the days a search returned for one activity. */\n\tmode?: 'day' | 'month' | 'auspicious';\n\t/** Endpoint path for built-in self-fetch (uncontrolled mode), e.g. \"astrology/natal-chart\". The component renders its own input form, fetches with the publishable key, and displays the result. Leave unset for controlled mode (pass `data`). */\n\tendpoint?: string;\n\t/** HTTP method for the self-fetch request. Defaults to POST. */\n\tmethod?: 'GET' | 'POST';\n\t/** Browser-safe publishable key (pk_) for self-fetch. A secret key is refused client-side and never sent. */\n\tpublishableKey?: string;\n\t/** Override the API origin for self-hosted or proxied deployments. Absolute, or relative to the page for a same-origin route. */\n\tbaseUrl?: string;\n\t/** Your own backend route, which holds the secret key. Self-fetch POSTs `{ path, method, body, query }` there instead of calling RoxyAPI directly and renders the JSON your route returns, so no key of any kind reaches the browser. */\n\tsubmitUrl?: string;\n\t/** An object of your own, sent to your submitUrl route as `context` beside the request, so a page can attach its own verification data to a proxied submission. Passed through untouched and never read by the component: what it holds is for your page and your route to agree on. Unset, nothing is added and the route receives the request exactly as before. Rides the submitUrl path only; a direct call sends what the endpoint declares. */\n\tsubmitContext?: Record<string, unknown>;\n\t/** Where the self-fetch form city search sends its request, absolute or relative to the page. The companion of submitUrl: the city search is a GET the form issues on its own while a visitor types, so a page that routes its API traffic through its own server names that route here as well. Unset, the search calls the public location endpoint. */\n\tlocationUrl?: string;\n\t/** Override the OpenAPI spec URL the self-fetch form introspects. */\n\tspecUrl?: string;\n\t/** Response language for self-fetch, forwarded to the API `lang` query parameter (en, tr, de, es, hi, pt, fr, ru). The form never shows a language field; the site owner sets it here. Defaults to English. */\n\tlang?: string;\n\t/** Override the self-fetch form submit-button label. Empty derives an outcome-first label from the endpoint (Get reading, Generate, Compare, Cast). */\n\tsubmitLabel?: string;\n\t/** Persist the last self-fetch form values in sessionStorage, keyed by endpoint, and prefill the form when the visitor returns. Off by default. */\n\tremember?: boolean;\n\t/** Render a small \"Spiritual data by RoxyAPI\" credit under a self-fetch result, linking back to RoxyAPI. Off by default; set any value to enable, or \"off\" to force it off. Never shown in controlled mode. */\n\tattribution?: string;\n\t/** Render the chart and the data and omit the written interpretation. Off by default. Use it when the page supplies its own words: the wheels, tables, grids, legends and numbers stay, and the interpretive prose is left out of the markup entirely. */\n\thideReadings?: boolean;\n\t/** Comma-separated list of `part` names to take off this component, for example \"patterns\" or \"patterns, legend\". Per element rather than per site, so the same component can drop a block on one page and keep it on another with no CSS. Sibling of hideReadings and a different tool: this hides a whole block whatever it contains, where hideReadings drops interpretive prose out of the markup. Names come from the `parts` array in components-catalog.json; a name the component does not carry hides nothing and is not an error. */\n\thideSections?: string;\n\n}\n\nexport const RoxyAlmanacDay = React.forwardRef<HTMLElement | null, RoxyAlmanacDayProps>(\n\tfunction RoxyAlmanacDay({ data, className, style, mode, endpoint, method, publishableKey, baseUrl, submitUrl, submitContext, locationUrl, specUrl, lang, submitLabel, remember, attribution, hideReadings, hideSections, ...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: 'day' | 'month' | 'auspicious' }).mode = mode;\n\t\t\t}\n\t\t}, [mode, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && endpoint !== undefined) {\n\t\t\t\t(el as unknown as { endpoint: string }).endpoint = endpoint;\n\t\t\t}\n\t\t}, [endpoint, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && method !== undefined) {\n\t\t\t\t(el as unknown as { method: 'GET' | 'POST' }).method = method;\n\t\t\t}\n\t\t}, [method, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && publishableKey !== undefined) {\n\t\t\t\t(el as unknown as { publishableKey: string }).publishableKey = publishableKey;\n\t\t\t}\n\t\t}, [publishableKey, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && baseUrl !== undefined) {\n\t\t\t\t(el as unknown as { baseUrl: string }).baseUrl = baseUrl;\n\t\t\t}\n\t\t}, [baseUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitUrl !== undefined) {\n\t\t\t\t(el as unknown as { submitUrl: string }).submitUrl = submitUrl;\n\t\t\t}\n\t\t}, [submitUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitContext !== undefined) {\n\t\t\t\t(el as unknown as { submitContext: Record<string, unknown> }).submitContext = submitContext;\n\t\t\t}\n\t\t}, [submitContext, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && locationUrl !== undefined) {\n\t\t\t\t(el as unknown as { locationUrl: string }).locationUrl = locationUrl;\n\t\t\t}\n\t\t}, [locationUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && specUrl !== undefined) {\n\t\t\t\t(el as unknown as { specUrl: string }).specUrl = specUrl;\n\t\t\t}\n\t\t}, [specUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && lang !== undefined) {\n\t\t\t\t(el as unknown as { lang: string }).lang = lang;\n\t\t\t}\n\t\t}, [lang, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitLabel !== undefined) {\n\t\t\t\t(el as unknown as { submitLabel: string }).submitLabel = submitLabel;\n\t\t\t}\n\t\t}, [submitLabel, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && remember !== undefined) {\n\t\t\t\t(el as unknown as { remember: boolean }).remember = remember;\n\t\t\t}\n\t\t}, [remember, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && attribution !== undefined) {\n\t\t\t\t(el as unknown as { attribution: string }).attribution = attribution;\n\t\t\t}\n\t\t}, [attribution, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && hideReadings !== undefined) {\n\t\t\t\t(el as unknown as { hideReadings: boolean }).hideReadings = hideReadings;\n\t\t\t}\n\t\t}, [hideReadings, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && hideSections !== undefined) {\n\t\t\t\t(el as unknown as { hideSections: string }).hideSections = hideSections;\n\t\t\t}\n\t\t}, [hideSections, 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-almanac-day', {\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 * {@link ensureLocaleLoaded} is the other half and is OPT-IN: it loads the label\n * catalogue for one language from the same release, so a non-English app calls\n * both. There is one catalogue, shipped by `@roxyapi/ui` and read by every\n * wrapper, so nothing is restated here.\n *\n * Defaults to the EXACT @roxyapi/ui release this wrapper was built against, so\n * `@roxyapi/ui-vue@x.y.z` always runs `@roxyapi/ui@x.y.z` and a lockfile actually\n * pins the runtime: it is a fixed version rather than a moving alias, so a later\n * @roxyapi/ui release cannot change the elements under an existing install.\n *\n * Pass an explicit `version` to override, or 'latest' to opt back into floating.\n *\n * Pass `baseUrl` to serve the bundle from your own origin instead of the CDN, which is\n * what an air-gapped install or a strict Content-Security-Policy needs: copy\n * `node_modules/@roxyapi/ui/dist/cdn/` onto your host and call this once at app entry,\n * before any component mounts. The loader keeps a single shared promise, so the first\n * call wins and every component reuses it.\n */\n/** The @roxyapi/ui release this wrapper was generated against. The loader defaults to it, so the wrapper version in your lockfile is the runtime you actually get. */\nexport const ROXY_UI_VERSION = \"0.47.0\";\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(\n\tversion: string = ROXY_UI_VERSION,\n\tbaseUrl?: string,\n): 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 = `${baseUrl ?? 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/** Every language a label catalogue ships for. English is absent on purpose: the catalogue key IS the English string, so an English page downloads nothing. */\nexport const ROXY_UI_LOCALES = [\"de\",\"es\",\"fr\",\"hi\",\"pt\",\"ru\",\"tr\",\"zh-Hans\",\"zh-Hant\"] as const;\n\nconst localesLoaded = new Map<string, Promise<void>>();\n\n/**\n * Load the label catalogue for one language, so the components write their own\n * headings, buttons, empty states and form labels in it.\n *\n * Call it once at app entry, beside `ensureScriptLoaded`. The components read the\n * language from the page (their own `lang` attribute, the nearest ancestor\n * carrying one, or `<html lang>`), so this call supplies the WORDS and the page\n * supplies the CHOICE. Loading a catalogue a page never asks for is harmless.\n *\n * `es-AR`, `es-MX` and `es-419` all resolve to the `es` catalogue, so pass the\n * page tag as it stands. English resolves to nothing at all and is not an error:\n * the catalogue is keyed by the English text, so an English page needs no payload.\n * A language outside `ROXY_UI_LOCALES` resolves the same way rather than appending\n * a script tag that 404s.\n *\n * `version` and `baseUrl` behave exactly as they do for {@link ensureScriptLoaded},\n * and passing the same `baseUrl` to both is what an air-gapped or strict-CSP host\n * needs: copy `node_modules/@roxyapi/ui/dist/cdn/` onto your own origin, which\n * carries `locales/` beside `roxy-ui.js`.\n *\n * @example\n * ```ts\n * import { ensureScriptLoaded, ensureLocaleLoaded } from '@roxyapi/ui-react';\n *\n * ensureScriptLoaded();\n * ensureLocaleLoaded(document.documentElement.lang);\n * ```\n */\nexport function ensureLocaleLoaded(\n\tlang: string,\n\tversion: string = ROXY_UI_VERSION,\n\tbaseUrl?: string,\n): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tconst base = (lang || '').toLowerCase().split('-')[0] ?? '';\n\tif (!(ROXY_UI_LOCALES as readonly string[]).includes(base)) {\n\t\treturn Promise.resolve();\n\t}\n\tconst existing = localesLoaded.get(base);\n\tif (existing) return existing;\n\n\tconst pending = new Promise<void>((resolve, reject) => {\n\t\tconst id = `${SCRIPT_ID}-locale-${base}`;\n\t\tlet el = document.getElementById(id) as HTMLScriptElement | null;\n\t\tif (el) {\n\t\t\tif (el.dataset.loaded === 'true') resolve();\n\t\t\telse {\n\t\t\t\tel.addEventListener('load', () => resolve());\n\t\t\t\tel.addEventListener('error', () => reject(new Error(`roxy-ui locale ${base} load failed`)));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tel = document.createElement('script');\n\t\tel.id = id;\n\t\tel.src = `${baseUrl ?? buildBase(version)}/locales/${base}.js`;\n\t\tel.async = true;\n\t\tel.crossOrigin = 'anonymous';\n\t\tel.addEventListener('load', () => {\n\t\t\tel!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\tel.addEventListener('error', () => reject(new Error(`roxy-ui locale ${base} load failed`)));\n\t\tdocument.head.appendChild(el);\n\t});\n\tlocalesLoaded.set(base, pending);\n\treturn pending;\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.\n"],
|
|
5
5
|
"mappings": "AAAA,UAAYA,MAAW,QCwBhB,IAAMC,EAAkB,SAEzBC,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,EACfD,EAAkBP,EAClBS,EACgB,CAChB,OAAI,OAAO,SAAa,IAAoB,QAAQ,QAAQ,EACxDJ,IAEJA,EAAS,IAAI,QAAc,CAACK,EAASC,IAAW,CAC/C,IAAMC,E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BASE_LATEST", "CDN_BASE_PREFIX", "CDN_BASE_SUFFIX", "loaded", "buildBase", "version", "ensureScriptLoaded", "baseUrl", "resolve", "reject", "url", "existing", "RoxyAlmanacDay", "data", "className", "style", "mode", "endpoint", "method", "publishableKey", "baseUrl", "submitUrl", "submitContext", "locationUrl", "specUrl", "lang", "submitLabel", "remember", "attribution", "hideReadings", "hideSections", "rest", "ref", "internal", "loaded", "setLoaded", "error", "setError", "active", "ensureScriptLoaded", "err", "el"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as n from"react";var H="0.
|
|
1
|
+
import*as n from"react";var H="0.47.0",h="roxyapi-ui-loader",I="https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn",_="https://cdn.jsdelivr.net/npm/@roxyapi/ui@",$="/dist/cdn",c=null;function N(o){return!o||o==="latest"?I:`${_}${o}${$}`}function v(o=H,a){return typeof document>"u"?Promise.resolve():c||(c=new Promise((i,d)=>{let u=`${a??N(o)}/roxy-ui.js`,t=document.getElementById(h);if(t){t.dataset.loaded==="true"?i():(t.addEventListener("load",()=>i()),t.addEventListener("error",()=>d(new Error("roxy-ui load failed"))));return}t=document.createElement("script"),t.id=h,t.src=u,t.async=!0,t.crossOrigin="anonymous",t.addEventListener("load",()=>{t.dataset.loaded="true",i()}),t.addEventListener("error",()=>d(new Error("roxy-ui load failed"))),document.head.appendChild(t)}),c)}var U=n.forwardRef(function({data:a,className:i,style:d,endpoint:u,method:t,publishableKey:l,baseUrl:f,submitUrl:m,submitContext:E,locationUrl:g,specUrl:p,lang:R,submitLabel:w,remember:y,attribution:L,hideReadings:x,hideSections:b,...P},T){let r=n.useRef(null);n.useImperativeHandle(T,()=>r.current,[]);let[s,A]=n.useState(!1),[k,C]=n.useState(null);return n.useEffect(()=>{let e=!0;return v().then(()=>{e&&A(!0)}).catch(S=>{e&&C(S instanceof Error?S:new Error(String(S)))}),()=>{e=!1}},[]),n.useEffect(()=>{let e=r.current;e&&a!==void 0&&(e.data=a)},[a,s]),n.useEffect(()=>{let e=r.current;e&&u!==void 0&&(e.endpoint=u)},[u,s]),n.useEffect(()=>{let e=r.current;e&&t!==void 0&&(e.method=t)},[t,s]),n.useEffect(()=>{let e=r.current;e&&l!==void 0&&(e.publishableKey=l)},[l,s]),n.useEffect(()=>{let e=r.current;e&&f!==void 0&&(e.baseUrl=f)},[f,s]),n.useEffect(()=>{let e=r.current;e&&m!==void 0&&(e.submitUrl=m)},[m,s]),n.useEffect(()=>{let e=r.current;e&&E!==void 0&&(e.submitContext=E)},[E,s]),n.useEffect(()=>{let e=r.current;e&&g!==void 0&&(e.locationUrl=g)},[g,s]),n.useEffect(()=>{let e=r.current;e&&p!==void 0&&(e.specUrl=p)},[p,s]),n.useEffect(()=>{let e=r.current;e&&R!==void 0&&(e.lang=R)},[R,s]),n.useEffect(()=>{let e=r.current;e&&w!==void 0&&(e.submitLabel=w)},[w,s]),n.useEffect(()=>{let e=r.current;e&&y!==void 0&&(e.remember=y)},[y,s]),n.useEffect(()=>{let e=r.current;e&&L!==void 0&&(e.attribution=L)},[L,s]),n.useEffect(()=>{let e=r.current;e&&x!==void 0&&(e.hideReadings=x)},[x,s]),n.useEffect(()=>{let e=r.current;e&&b!==void 0&&(e.hideSections=b)},[b,s]),k?n.createElement("div",{role:"alert",className:i,style:d},`Roxy UI script load failed: ${k.message}`):n.createElement("roxy-angel-number-card",{ref:r,className:i,style:d,...P})});export{U as RoxyAngelNumberCard};
|
|
2
2
|
//# sourceMappingURL=angel-number-card.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/angel-number-card.tsx", "../../src/load-ui.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\nimport type { GetAngelNumberResponse } from '../types/index.js';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children' | 'data'\n>;\n\nexport interface RoxyAngelNumberCardProps extends ElementAttrs {\n\t/** Spec-derived response payload. Pass the raw RoxyAPI response. */\n\tdata?: GetAngelNumberResponse;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\t/** Endpoint path for built-in self-fetch (uncontrolled mode), e.g. \"astrology/natal-chart\". The component renders its own input form, fetches with the publishable key, and displays the result. Leave unset for controlled mode (pass `data`). */\n\tendpoint?: string;\n\t/** HTTP method for the self-fetch request. Defaults to POST. */\n\tmethod?: 'GET' | 'POST';\n\t/** Browser-safe publishable key (pk_) for self-fetch. A secret key is refused client-side and never sent. */\n\tpublishableKey?: string;\n\t/** Override the API origin for self-hosted or proxied deployments. Absolute, or relative to the page for a same-origin route. */\n\tbaseUrl?: string;\n\t/** Your own backend route, which holds the secret key. Self-fetch POSTs `{ path, method, body, query }` there instead of calling RoxyAPI directly and renders the JSON your route returns, so no key of any kind reaches the browser. */\n\tsubmitUrl?: string;\n\t/** An object of your own, sent to your submitUrl route as `context` beside the request, so a page can attach its own verification data to a proxied submission. Passed through untouched and never read by the component: what it holds is for your page and your route to agree on. Unset, nothing is added and the route receives the request exactly as before. Rides the submitUrl path only; a direct call sends what the endpoint declares. */\n\tsubmitContext?: Record<string, unknown>;\n\t/** Where the self-fetch form city search sends its request, absolute or relative to the page. The companion of submitUrl: the city search is a GET the form issues on its own while a visitor types, so a page that routes its API traffic through its own server names that route here as well. Unset, the search calls the public location endpoint. */\n\tlocationUrl?: string;\n\t/** Override the OpenAPI spec URL the self-fetch form introspects. */\n\tspecUrl?: string;\n\t/** Response language for self-fetch, forwarded to the API `lang` query parameter (en, tr, de, es, hi, pt, fr, ru). The form never shows a language field; the site owner sets it here. Defaults to English. */\n\tlang?: string;\n\t/** Override the self-fetch form submit-button label. Empty derives an outcome-first label from the endpoint (Get reading, Generate, Compare, Cast). */\n\tsubmitLabel?: string;\n\t/** Persist the last self-fetch form values in sessionStorage, keyed by endpoint, and prefill the form when the visitor returns. Off by default. */\n\tremember?: boolean;\n\t/** Render a small \"Spiritual data by RoxyAPI\" credit under a self-fetch result, linking back to RoxyAPI. Off by default; set any value to enable, or \"off\" to force it off. Never shown in controlled mode. */\n\tattribution?: string;\n\t/** Render the chart and the data and omit the written interpretation. Off by default. Use it when the page supplies its own words: the wheels, tables, grids, legends and numbers stay, and the interpretive prose is left out of the markup entirely. */\n\thideReadings?: boolean;\n\t/** Comma-separated list of `part` names to take off this component, for example \"patterns\" or \"patterns, legend\". Per element rather than per site, so the same component can drop a block on one page and keep it on another with no CSS. Sibling of hideReadings and a different tool: this hides a whole block whatever it contains, where hideReadings drops interpretive prose out of the markup. Names come from the `parts` array in components-catalog.json; a name the component does not carry hides nothing and is not an error. */\n\thideSections?: string;\n\n}\n\nexport const RoxyAngelNumberCard = React.forwardRef<HTMLElement | null, RoxyAngelNumberCardProps>(\n\tfunction RoxyAngelNumberCard({ data, className, style, endpoint, method, publishableKey, baseUrl, submitUrl, submitContext, locationUrl, specUrl, lang, submitLabel, remember, attribution, hideReadings, hideSections, ...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 && endpoint !== undefined) {\n\t\t\t\t(el as unknown as { endpoint: string }).endpoint = endpoint;\n\t\t\t}\n\t\t}, [endpoint, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && method !== undefined) {\n\t\t\t\t(el as unknown as { method: 'GET' | 'POST' }).method = method;\n\t\t\t}\n\t\t}, [method, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && publishableKey !== undefined) {\n\t\t\t\t(el as unknown as { publishableKey: string }).publishableKey = publishableKey;\n\t\t\t}\n\t\t}, [publishableKey, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && baseUrl !== undefined) {\n\t\t\t\t(el as unknown as { baseUrl: string }).baseUrl = baseUrl;\n\t\t\t}\n\t\t}, [baseUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitUrl !== undefined) {\n\t\t\t\t(el as unknown as { submitUrl: string }).submitUrl = submitUrl;\n\t\t\t}\n\t\t}, [submitUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitContext !== undefined) {\n\t\t\t\t(el as unknown as { submitContext: Record<string, unknown> }).submitContext = submitContext;\n\t\t\t}\n\t\t}, [submitContext, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && locationUrl !== undefined) {\n\t\t\t\t(el as unknown as { locationUrl: string }).locationUrl = locationUrl;\n\t\t\t}\n\t\t}, [locationUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && specUrl !== undefined) {\n\t\t\t\t(el as unknown as { specUrl: string }).specUrl = specUrl;\n\t\t\t}\n\t\t}, [specUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && lang !== undefined) {\n\t\t\t\t(el as unknown as { lang: string }).lang = lang;\n\t\t\t}\n\t\t}, [lang, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitLabel !== undefined) {\n\t\t\t\t(el as unknown as { submitLabel: string }).submitLabel = submitLabel;\n\t\t\t}\n\t\t}, [submitLabel, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && remember !== undefined) {\n\t\t\t\t(el as unknown as { remember: boolean }).remember = remember;\n\t\t\t}\n\t\t}, [remember, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && attribution !== undefined) {\n\t\t\t\t(el as unknown as { attribution: string }).attribution = attribution;\n\t\t\t}\n\t\t}, [attribution, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && hideReadings !== undefined) {\n\t\t\t\t(el as unknown as { hideReadings: boolean }).hideReadings = hideReadings;\n\t\t\t}\n\t\t}, [hideReadings, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && hideSections !== undefined) {\n\t\t\t\t(el as unknown as { hideSections: string }).hideSections = hideSections;\n\t\t\t}\n\t\t}, [hideSections, 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-angel-number-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 * {@link ensureLocaleLoaded} is the other half and is OPT-IN: it loads the label\n * catalogue for one language from the same release, so a non-English app calls\n * both. There is one catalogue, shipped by `@roxyapi/ui` and read by every\n * wrapper, so nothing is restated here.\n *\n * Defaults to the EXACT @roxyapi/ui release this wrapper was built against, so\n * `@roxyapi/ui-vue@x.y.z` always runs `@roxyapi/ui@x.y.z` and a lockfile actually\n * pins the runtime: it is a fixed version rather than a moving alias, so a later\n * @roxyapi/ui release cannot change the elements under an existing install.\n *\n * Pass an explicit `version` to override, or 'latest' to opt back into floating.\n *\n * Pass `baseUrl` to serve the bundle from your own origin instead of the CDN, which is\n * what an air-gapped install or a strict Content-Security-Policy needs: copy\n * `node_modules/@roxyapi/ui/dist/cdn/` onto your host and call this once at app entry,\n * before any component mounts. The loader keeps a single shared promise, so the first\n * call wins and every component reuses it.\n */\n/** The @roxyapi/ui release this wrapper was generated against. The loader defaults to it, so the wrapper version in your lockfile is the runtime you actually get. */\nexport const ROXY_UI_VERSION = \"0.45.0\";\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(\n\tversion: string = ROXY_UI_VERSION,\n\tbaseUrl?: string,\n): 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 = `${baseUrl ?? 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/** Every language a label catalogue ships for. English is absent on purpose: the catalogue key IS the English string, so an English page downloads nothing. */\nexport const ROXY_UI_LOCALES = [\"de\",\"es\",\"fr\",\"hi\",\"pt\",\"ru\",\"tr\",\"zh-Hans\",\"zh-Hant\"] as const;\n\nconst localesLoaded = new Map<string, Promise<void>>();\n\n/**\n * Load the label catalogue for one language, so the components write their own\n * headings, buttons, empty states and form labels in it.\n *\n * Call it once at app entry, beside `ensureScriptLoaded`. The components read the\n * language from the page (their own `lang` attribute, the nearest ancestor\n * carrying one, or `<html lang>`), so this call supplies the WORDS and the page\n * supplies the CHOICE. Loading a catalogue a page never asks for is harmless.\n *\n * `es-AR`, `es-MX` and `es-419` all resolve to the `es` catalogue, so pass the\n * page tag as it stands. English resolves to nothing at all and is not an error:\n * the catalogue is keyed by the English text, so an English page needs no payload.\n * A language outside `ROXY_UI_LOCALES` resolves the same way rather than appending\n * a script tag that 404s.\n *\n * `version` and `baseUrl` behave exactly as they do for {@link ensureScriptLoaded},\n * and passing the same `baseUrl` to both is what an air-gapped or strict-CSP host\n * needs: copy `node_modules/@roxyapi/ui/dist/cdn/` onto your own origin, which\n * carries `locales/` beside `roxy-ui.js`.\n *\n * @example\n * ```ts\n * import { ensureScriptLoaded, ensureLocaleLoaded } from '@roxyapi/ui-react';\n *\n * ensureScriptLoaded();\n * ensureLocaleLoaded(document.documentElement.lang);\n * ```\n */\nexport function ensureLocaleLoaded(\n\tlang: string,\n\tversion: string = ROXY_UI_VERSION,\n\tbaseUrl?: string,\n): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tconst base = (lang || '').toLowerCase().split('-')[0] ?? '';\n\tif (!(ROXY_UI_LOCALES as readonly string[]).includes(base)) {\n\t\treturn Promise.resolve();\n\t}\n\tconst existing = localesLoaded.get(base);\n\tif (existing) return existing;\n\n\tconst pending = new Promise<void>((resolve, reject) => {\n\t\tconst id = `${SCRIPT_ID}-locale-${base}`;\n\t\tlet el = document.getElementById(id) as HTMLScriptElement | null;\n\t\tif (el) {\n\t\t\tif (el.dataset.loaded === 'true') resolve();\n\t\t\telse {\n\t\t\t\tel.addEventListener('load', () => resolve());\n\t\t\t\tel.addEventListener('error', () => reject(new Error(`roxy-ui locale ${base} load failed`)));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tel = document.createElement('script');\n\t\tel.id = id;\n\t\tel.src = `${baseUrl ?? buildBase(version)}/locales/${base}.js`;\n\t\tel.async = true;\n\t\tel.crossOrigin = 'anonymous';\n\t\tel.addEventListener('load', () => {\n\t\t\tel!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\tel.addEventListener('error', () => reject(new Error(`roxy-ui locale ${base} load failed`)));\n\t\tdocument.head.appendChild(el);\n\t});\n\tlocalesLoaded.set(base, pending);\n\treturn pending;\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.\n"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\nimport type { GetAngelNumberResponse } from '../types/index.js';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children' | 'data'\n>;\n\nexport interface RoxyAngelNumberCardProps extends ElementAttrs {\n\t/** Spec-derived response payload. Pass the raw RoxyAPI response. */\n\tdata?: GetAngelNumberResponse;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\t/** Endpoint path for built-in self-fetch (uncontrolled mode), e.g. \"astrology/natal-chart\". The component renders its own input form, fetches with the publishable key, and displays the result. Leave unset for controlled mode (pass `data`). */\n\tendpoint?: string;\n\t/** HTTP method for the self-fetch request. Defaults to POST. */\n\tmethod?: 'GET' | 'POST';\n\t/** Browser-safe publishable key (pk_) for self-fetch. A secret key is refused client-side and never sent. */\n\tpublishableKey?: string;\n\t/** Override the API origin for self-hosted or proxied deployments. Absolute, or relative to the page for a same-origin route. */\n\tbaseUrl?: string;\n\t/** Your own backend route, which holds the secret key. Self-fetch POSTs `{ path, method, body, query }` there instead of calling RoxyAPI directly and renders the JSON your route returns, so no key of any kind reaches the browser. */\n\tsubmitUrl?: string;\n\t/** An object of your own, sent to your submitUrl route as `context` beside the request, so a page can attach its own verification data to a proxied submission. Passed through untouched and never read by the component: what it holds is for your page and your route to agree on. Unset, nothing is added and the route receives the request exactly as before. Rides the submitUrl path only; a direct call sends what the endpoint declares. */\n\tsubmitContext?: Record<string, unknown>;\n\t/** Where the self-fetch form city search sends its request, absolute or relative to the page. The companion of submitUrl: the city search is a GET the form issues on its own while a visitor types, so a page that routes its API traffic through its own server names that route here as well. Unset, the search calls the public location endpoint. */\n\tlocationUrl?: string;\n\t/** Override the OpenAPI spec URL the self-fetch form introspects. */\n\tspecUrl?: string;\n\t/** Response language for self-fetch, forwarded to the API `lang` query parameter (en, tr, de, es, hi, pt, fr, ru). The form never shows a language field; the site owner sets it here. Defaults to English. */\n\tlang?: string;\n\t/** Override the self-fetch form submit-button label. Empty derives an outcome-first label from the endpoint (Get reading, Generate, Compare, Cast). */\n\tsubmitLabel?: string;\n\t/** Persist the last self-fetch form values in sessionStorage, keyed by endpoint, and prefill the form when the visitor returns. Off by default. */\n\tremember?: boolean;\n\t/** Render a small \"Spiritual data by RoxyAPI\" credit under a self-fetch result, linking back to RoxyAPI. Off by default; set any value to enable, or \"off\" to force it off. Never shown in controlled mode. */\n\tattribution?: string;\n\t/** Render the chart and the data and omit the written interpretation. Off by default. Use it when the page supplies its own words: the wheels, tables, grids, legends and numbers stay, and the interpretive prose is left out of the markup entirely. */\n\thideReadings?: boolean;\n\t/** Comma-separated list of `part` names to take off this component, for example \"patterns\" or \"patterns, legend\". Per element rather than per site, so the same component can drop a block on one page and keep it on another with no CSS. Sibling of hideReadings and a different tool: this hides a whole block whatever it contains, where hideReadings drops interpretive prose out of the markup. Names come from the `parts` array in components-catalog.json; a name the component does not carry hides nothing and is not an error. */\n\thideSections?: string;\n\n}\n\nexport const RoxyAngelNumberCard = React.forwardRef<HTMLElement | null, RoxyAngelNumberCardProps>(\n\tfunction RoxyAngelNumberCard({ data, className, style, endpoint, method, publishableKey, baseUrl, submitUrl, submitContext, locationUrl, specUrl, lang, submitLabel, remember, attribution, hideReadings, hideSections, ...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 && endpoint !== undefined) {\n\t\t\t\t(el as unknown as { endpoint: string }).endpoint = endpoint;\n\t\t\t}\n\t\t}, [endpoint, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && method !== undefined) {\n\t\t\t\t(el as unknown as { method: 'GET' | 'POST' }).method = method;\n\t\t\t}\n\t\t}, [method, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && publishableKey !== undefined) {\n\t\t\t\t(el as unknown as { publishableKey: string }).publishableKey = publishableKey;\n\t\t\t}\n\t\t}, [publishableKey, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && baseUrl !== undefined) {\n\t\t\t\t(el as unknown as { baseUrl: string }).baseUrl = baseUrl;\n\t\t\t}\n\t\t}, [baseUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitUrl !== undefined) {\n\t\t\t\t(el as unknown as { submitUrl: string }).submitUrl = submitUrl;\n\t\t\t}\n\t\t}, [submitUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitContext !== undefined) {\n\t\t\t\t(el as unknown as { submitContext: Record<string, unknown> }).submitContext = submitContext;\n\t\t\t}\n\t\t}, [submitContext, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && locationUrl !== undefined) {\n\t\t\t\t(el as unknown as { locationUrl: string }).locationUrl = locationUrl;\n\t\t\t}\n\t\t}, [locationUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && specUrl !== undefined) {\n\t\t\t\t(el as unknown as { specUrl: string }).specUrl = specUrl;\n\t\t\t}\n\t\t}, [specUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && lang !== undefined) {\n\t\t\t\t(el as unknown as { lang: string }).lang = lang;\n\t\t\t}\n\t\t}, [lang, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitLabel !== undefined) {\n\t\t\t\t(el as unknown as { submitLabel: string }).submitLabel = submitLabel;\n\t\t\t}\n\t\t}, [submitLabel, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && remember !== undefined) {\n\t\t\t\t(el as unknown as { remember: boolean }).remember = remember;\n\t\t\t}\n\t\t}, [remember, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && attribution !== undefined) {\n\t\t\t\t(el as unknown as { attribution: string }).attribution = attribution;\n\t\t\t}\n\t\t}, [attribution, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && hideReadings !== undefined) {\n\t\t\t\t(el as unknown as { hideReadings: boolean }).hideReadings = hideReadings;\n\t\t\t}\n\t\t}, [hideReadings, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && hideSections !== undefined) {\n\t\t\t\t(el as unknown as { hideSections: string }).hideSections = hideSections;\n\t\t\t}\n\t\t}, [hideSections, 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-angel-number-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 * {@link ensureLocaleLoaded} is the other half and is OPT-IN: it loads the label\n * catalogue for one language from the same release, so a non-English app calls\n * both. There is one catalogue, shipped by `@roxyapi/ui` and read by every\n * wrapper, so nothing is restated here.\n *\n * Defaults to the EXACT @roxyapi/ui release this wrapper was built against, so\n * `@roxyapi/ui-vue@x.y.z` always runs `@roxyapi/ui@x.y.z` and a lockfile actually\n * pins the runtime: it is a fixed version rather than a moving alias, so a later\n * @roxyapi/ui release cannot change the elements under an existing install.\n *\n * Pass an explicit `version` to override, or 'latest' to opt back into floating.\n *\n * Pass `baseUrl` to serve the bundle from your own origin instead of the CDN, which is\n * what an air-gapped install or a strict Content-Security-Policy needs: copy\n * `node_modules/@roxyapi/ui/dist/cdn/` onto your host and call this once at app entry,\n * before any component mounts. The loader keeps a single shared promise, so the first\n * call wins and every component reuses it.\n */\n/** The @roxyapi/ui release this wrapper was generated against. The loader defaults to it, so the wrapper version in your lockfile is the runtime you actually get. */\nexport const ROXY_UI_VERSION = \"0.47.0\";\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(\n\tversion: string = ROXY_UI_VERSION,\n\tbaseUrl?: string,\n): 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 = `${baseUrl ?? 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/** Every language a label catalogue ships for. English is absent on purpose: the catalogue key IS the English string, so an English page downloads nothing. */\nexport const ROXY_UI_LOCALES = [\"de\",\"es\",\"fr\",\"hi\",\"pt\",\"ru\",\"tr\",\"zh-Hans\",\"zh-Hant\"] as const;\n\nconst localesLoaded = new Map<string, Promise<void>>();\n\n/**\n * Load the label catalogue for one language, so the components write their own\n * headings, buttons, empty states and form labels in it.\n *\n * Call it once at app entry, beside `ensureScriptLoaded`. The components read the\n * language from the page (their own `lang` attribute, the nearest ancestor\n * carrying one, or `<html lang>`), so this call supplies the WORDS and the page\n * supplies the CHOICE. Loading a catalogue a page never asks for is harmless.\n *\n * `es-AR`, `es-MX` and `es-419` all resolve to the `es` catalogue, so pass the\n * page tag as it stands. English resolves to nothing at all and is not an error:\n * the catalogue is keyed by the English text, so an English page needs no payload.\n * A language outside `ROXY_UI_LOCALES` resolves the same way rather than appending\n * a script tag that 404s.\n *\n * `version` and `baseUrl` behave exactly as they do for {@link ensureScriptLoaded},\n * and passing the same `baseUrl` to both is what an air-gapped or strict-CSP host\n * needs: copy `node_modules/@roxyapi/ui/dist/cdn/` onto your own origin, which\n * carries `locales/` beside `roxy-ui.js`.\n *\n * @example\n * ```ts\n * import { ensureScriptLoaded, ensureLocaleLoaded } from '@roxyapi/ui-react';\n *\n * ensureScriptLoaded();\n * ensureLocaleLoaded(document.documentElement.lang);\n * ```\n */\nexport function ensureLocaleLoaded(\n\tlang: string,\n\tversion: string = ROXY_UI_VERSION,\n\tbaseUrl?: string,\n): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tconst base = (lang || '').toLowerCase().split('-')[0] ?? '';\n\tif (!(ROXY_UI_LOCALES as readonly string[]).includes(base)) {\n\t\treturn Promise.resolve();\n\t}\n\tconst existing = localesLoaded.get(base);\n\tif (existing) return existing;\n\n\tconst pending = new Promise<void>((resolve, reject) => {\n\t\tconst id = `${SCRIPT_ID}-locale-${base}`;\n\t\tlet el = document.getElementById(id) as HTMLScriptElement | null;\n\t\tif (el) {\n\t\t\tif (el.dataset.loaded === 'true') resolve();\n\t\t\telse {\n\t\t\t\tel.addEventListener('load', () => resolve());\n\t\t\t\tel.addEventListener('error', () => reject(new Error(`roxy-ui locale ${base} load failed`)));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tel = document.createElement('script');\n\t\tel.id = id;\n\t\tel.src = `${baseUrl ?? buildBase(version)}/locales/${base}.js`;\n\t\tel.async = true;\n\t\tel.crossOrigin = 'anonymous';\n\t\tel.addEventListener('load', () => {\n\t\t\tel!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\tel.addEventListener('error', () => reject(new Error(`roxy-ui locale ${base} load failed`)));\n\t\tdocument.head.appendChild(el);\n\t});\n\tlocalesLoaded.set(base, pending);\n\treturn pending;\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.\n"],
|
|
5
5
|
"mappings": "AAAA,UAAYA,MAAW,QCwBhB,IAAMC,EAAkB,SAEzBC,EAAY,oBACZC,EAAkB,2DAClBC,EAAkB,4CAClBC,EAAkB,YAEpBC,EAA+B,KAEnC,SAASC,EAAUC,EAAyB,CAC3C,MA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ACA,GAAGe,CACJ,CAAC,CACF,CACD",
|
|
6
6
|
"names": ["React", "ROXY_UI_VERSION", "SCRIPT_ID", "CDN_BASE_LATEST", "CDN_BASE_PREFIX", "CDN_BASE_SUFFIX", "loaded", "buildBase", "version", "ensureScriptLoaded", "baseUrl", "resolve", "reject", "url", "existing", "RoxyAngelNumberCard", "data", "className", "style", "endpoint", "method", "publishableKey", "baseUrl", "submitUrl", "submitContext", "locationUrl", "specUrl", "lang", "submitLabel", "remember", "attribution", "hideReadings", "hideSections", "rest", "ref", "internal", "loaded", "setLoaded", "error", "setError", "active", "ensureScriptLoaded", "err", "el"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as n from"react";var I="0.
|
|
1
|
+
import*as n from"react";var I="0.47.0",h="roxyapi-ui-loader",_="https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn",$="https://cdn.jsdelivr.net/npm/@roxyapi/ui@",C="/dist/cdn",c=null;function N(o){return!o||o==="latest"?_:`${$}${o}${C}`}function v(o=I,a){return typeof document>"u"?Promise.resolve():c||(c=new Promise((i,u)=>{let d=`${a??N(o)}/roxy-ui.js`,t=document.getElementById(h);if(t){t.dataset.loaded==="true"?i():(t.addEventListener("load",()=>i()),t.addEventListener("error",()=>u(new Error("roxy-ui load failed"))));return}t=document.createElement("script"),t.id=h,t.src=d,t.async=!0,t.crossOrigin="anonymous",t.addEventListener("load",()=>{t.dataset.loaded="true",i()}),t.addEventListener("error",()=>u(new Error("roxy-ui load failed"))),document.head.appendChild(t)}),c)}var U=n.forwardRef(function({data:a,className:i,style:u,endpoint:d,method:t,publishableKey:l,baseUrl:f,submitUrl:m,submitContext:E,locationUrl:p,specUrl:g,lang:R,submitLabel:L,remember:w,attribution:y,hideReadings:x,hideSections:k,...P},T){let r=n.useRef(null);n.useImperativeHandle(T,()=>r.current,[]);let[s,A]=n.useState(!1),[S,H]=n.useState(null);return n.useEffect(()=>{let e=!0;return v().then(()=>{e&&A(!0)}).catch(b=>{e&&H(b instanceof Error?b:new Error(String(b)))}),()=>{e=!1}},[]),n.useEffect(()=>{let e=r.current;e&&a!==void 0&&(e.data=a)},[a,s]),n.useEffect(()=>{let e=r.current;e&&d!==void 0&&(e.endpoint=d)},[d,s]),n.useEffect(()=>{let e=r.current;e&&t!==void 0&&(e.method=t)},[t,s]),n.useEffect(()=>{let e=r.current;e&&l!==void 0&&(e.publishableKey=l)},[l,s]),n.useEffect(()=>{let e=r.current;e&&f!==void 0&&(e.baseUrl=f)},[f,s]),n.useEffect(()=>{let e=r.current;e&&m!==void 0&&(e.submitUrl=m)},[m,s]),n.useEffect(()=>{let e=r.current;e&&E!==void 0&&(e.submitContext=E)},[E,s]),n.useEffect(()=>{let e=r.current;e&&p!==void 0&&(e.locationUrl=p)},[p,s]),n.useEffect(()=>{let e=r.current;e&&g!==void 0&&(e.specUrl=g)},[g,s]),n.useEffect(()=>{let e=r.current;e&&R!==void 0&&(e.lang=R)},[R,s]),n.useEffect(()=>{let e=r.current;e&&L!==void 0&&(e.submitLabel=L)},[L,s]),n.useEffect(()=>{let e=r.current;e&&w!==void 0&&(e.remember=w)},[w,s]),n.useEffect(()=>{let e=r.current;e&&y!==void 0&&(e.attribution=y)},[y,s]),n.useEffect(()=>{let e=r.current;e&&x!==void 0&&(e.hideReadings=x)},[x,s]),n.useEffect(()=>{let e=r.current;e&&k!==void 0&&(e.hideSections=k)},[k,s]),S?n.createElement("div",{role:"alert",className:i,style:u},`Roxy UI script load failed: ${S.message}`):n.createElement("roxy-angel-number-lookup",{ref:r,className:i,style:u,...P})});export{U as RoxyAngelNumberLookup};
|
|
2
2
|
//# sourceMappingURL=angel-number-lookup.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/angel-number-lookup.tsx", "../../src/load-ui.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\nimport type { AnalyzeNumberSequenceResponse } from '../types/index.js';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children' | 'data'\n>;\n\nexport interface RoxyAngelNumberLookupProps extends ElementAttrs {\n\t/** Spec-derived response payload. Pass the raw RoxyAPI response. */\n\tdata?: AnalyzeNumberSequenceResponse;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\t/** Endpoint path for built-in self-fetch (uncontrolled mode), e.g. \"astrology/natal-chart\". The component renders its own input form, fetches with the publishable key, and displays the result. Leave unset for controlled mode (pass `data`). */\n\tendpoint?: string;\n\t/** HTTP method for the self-fetch request. Defaults to POST. */\n\tmethod?: 'GET' | 'POST';\n\t/** Browser-safe publishable key (pk_) for self-fetch. A secret key is refused client-side and never sent. */\n\tpublishableKey?: string;\n\t/** Override the API origin for self-hosted or proxied deployments. Absolute, or relative to the page for a same-origin route. */\n\tbaseUrl?: string;\n\t/** Your own backend route, which holds the secret key. Self-fetch POSTs `{ path, method, body, query }` there instead of calling RoxyAPI directly and renders the JSON your route returns, so no key of any kind reaches the browser. */\n\tsubmitUrl?: string;\n\t/** An object of your own, sent to your submitUrl route as `context` beside the request, so a page can attach its own verification data to a proxied submission. Passed through untouched and never read by the component: what it holds is for your page and your route to agree on. Unset, nothing is added and the route receives the request exactly as before. Rides the submitUrl path only; a direct call sends what the endpoint declares. */\n\tsubmitContext?: Record<string, unknown>;\n\t/** Where the self-fetch form city search sends its request, absolute or relative to the page. The companion of submitUrl: the city search is a GET the form issues on its own while a visitor types, so a page that routes its API traffic through its own server names that route here as well. Unset, the search calls the public location endpoint. */\n\tlocationUrl?: string;\n\t/** Override the OpenAPI spec URL the self-fetch form introspects. */\n\tspecUrl?: string;\n\t/** Response language for self-fetch, forwarded to the API `lang` query parameter (en, tr, de, es, hi, pt, fr, ru). The form never shows a language field; the site owner sets it here. Defaults to English. */\n\tlang?: string;\n\t/** Override the self-fetch form submit-button label. Empty derives an outcome-first label from the endpoint (Get reading, Generate, Compare, Cast). */\n\tsubmitLabel?: string;\n\t/** Persist the last self-fetch form values in sessionStorage, keyed by endpoint, and prefill the form when the visitor returns. Off by default. */\n\tremember?: boolean;\n\t/** Render a small \"Spiritual data by RoxyAPI\" credit under a self-fetch result, linking back to RoxyAPI. Off by default; set any value to enable, or \"off\" to force it off. Never shown in controlled mode. */\n\tattribution?: string;\n\t/** Render the chart and the data and omit the written interpretation. Off by default. Use it when the page supplies its own words: the wheels, tables, grids, legends and numbers stay, and the interpretive prose is left out of the markup entirely. */\n\thideReadings?: boolean;\n\t/** Comma-separated list of `part` names to take off this component, for example \"patterns\" or \"patterns, legend\". Per element rather than per site, so the same component can drop a block on one page and keep it on another with no CSS. Sibling of hideReadings and a different tool: this hides a whole block whatever it contains, where hideReadings drops interpretive prose out of the markup. Names come from the `parts` array in components-catalog.json; a name the component does not carry hides nothing and is not an error. */\n\thideSections?: string;\n\n}\n\nexport const RoxyAngelNumberLookup = React.forwardRef<HTMLElement | null, RoxyAngelNumberLookupProps>(\n\tfunction RoxyAngelNumberLookup({ data, className, style, endpoint, method, publishableKey, baseUrl, submitUrl, submitContext, locationUrl, specUrl, lang, submitLabel, remember, attribution, hideReadings, hideSections, ...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 && endpoint !== undefined) {\n\t\t\t\t(el as unknown as { endpoint: string }).endpoint = endpoint;\n\t\t\t}\n\t\t}, [endpoint, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && method !== undefined) {\n\t\t\t\t(el as unknown as { method: 'GET' | 'POST' }).method = method;\n\t\t\t}\n\t\t}, [method, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && publishableKey !== undefined) {\n\t\t\t\t(el as unknown as { publishableKey: string }).publishableKey = publishableKey;\n\t\t\t}\n\t\t}, [publishableKey, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && baseUrl !== undefined) {\n\t\t\t\t(el as unknown as { baseUrl: string }).baseUrl = baseUrl;\n\t\t\t}\n\t\t}, [baseUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitUrl !== undefined) {\n\t\t\t\t(el as unknown as { submitUrl: string }).submitUrl = submitUrl;\n\t\t\t}\n\t\t}, [submitUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitContext !== undefined) {\n\t\t\t\t(el as unknown as { submitContext: Record<string, unknown> }).submitContext = submitContext;\n\t\t\t}\n\t\t}, [submitContext, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && locationUrl !== undefined) {\n\t\t\t\t(el as unknown as { locationUrl: string }).locationUrl = locationUrl;\n\t\t\t}\n\t\t}, [locationUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && specUrl !== undefined) {\n\t\t\t\t(el as unknown as { specUrl: string }).specUrl = specUrl;\n\t\t\t}\n\t\t}, [specUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && lang !== undefined) {\n\t\t\t\t(el as unknown as { lang: string }).lang = lang;\n\t\t\t}\n\t\t}, [lang, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitLabel !== undefined) {\n\t\t\t\t(el as unknown as { submitLabel: string }).submitLabel = submitLabel;\n\t\t\t}\n\t\t}, [submitLabel, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && remember !== undefined) {\n\t\t\t\t(el as unknown as { remember: boolean }).remember = remember;\n\t\t\t}\n\t\t}, [remember, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && attribution !== undefined) {\n\t\t\t\t(el as unknown as { attribution: string }).attribution = attribution;\n\t\t\t}\n\t\t}, [attribution, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && hideReadings !== undefined) {\n\t\t\t\t(el as unknown as { hideReadings: boolean }).hideReadings = hideReadings;\n\t\t\t}\n\t\t}, [hideReadings, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && hideSections !== undefined) {\n\t\t\t\t(el as unknown as { hideSections: string }).hideSections = hideSections;\n\t\t\t}\n\t\t}, [hideSections, 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-angel-number-lookup', {\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 * {@link ensureLocaleLoaded} is the other half and is OPT-IN: it loads the label\n * catalogue for one language from the same release, so a non-English app calls\n * both. There is one catalogue, shipped by `@roxyapi/ui` and read by every\n * wrapper, so nothing is restated here.\n *\n * Defaults to the EXACT @roxyapi/ui release this wrapper was built against, so\n * `@roxyapi/ui-vue@x.y.z` always runs `@roxyapi/ui@x.y.z` and a lockfile actually\n * pins the runtime: it is a fixed version rather than a moving alias, so a later\n * @roxyapi/ui release cannot change the elements under an existing install.\n *\n * Pass an explicit `version` to override, or 'latest' to opt back into floating.\n *\n * Pass `baseUrl` to serve the bundle from your own origin instead of the CDN, which is\n * what an air-gapped install or a strict Content-Security-Policy needs: copy\n * `node_modules/@roxyapi/ui/dist/cdn/` onto your host and call this once at app entry,\n * before any component mounts. The loader keeps a single shared promise, so the first\n * call wins and every component reuses it.\n */\n/** The @roxyapi/ui release this wrapper was generated against. The loader defaults to it, so the wrapper version in your lockfile is the runtime you actually get. */\nexport const ROXY_UI_VERSION = \"0.45.0\";\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(\n\tversion: string = ROXY_UI_VERSION,\n\tbaseUrl?: string,\n): 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 = `${baseUrl ?? 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/** Every language a label catalogue ships for. English is absent on purpose: the catalogue key IS the English string, so an English page downloads nothing. */\nexport const ROXY_UI_LOCALES = [\"de\",\"es\",\"fr\",\"hi\",\"pt\",\"ru\",\"tr\",\"zh-Hans\",\"zh-Hant\"] as const;\n\nconst localesLoaded = new Map<string, Promise<void>>();\n\n/**\n * Load the label catalogue for one language, so the components write their own\n * headings, buttons, empty states and form labels in it.\n *\n * Call it once at app entry, beside `ensureScriptLoaded`. The components read the\n * language from the page (their own `lang` attribute, the nearest ancestor\n * carrying one, or `<html lang>`), so this call supplies the WORDS and the page\n * supplies the CHOICE. Loading a catalogue a page never asks for is harmless.\n *\n * `es-AR`, `es-MX` and `es-419` all resolve to the `es` catalogue, so pass the\n * page tag as it stands. English resolves to nothing at all and is not an error:\n * the catalogue is keyed by the English text, so an English page needs no payload.\n * A language outside `ROXY_UI_LOCALES` resolves the same way rather than appending\n * a script tag that 404s.\n *\n * `version` and `baseUrl` behave exactly as they do for {@link ensureScriptLoaded},\n * and passing the same `baseUrl` to both is what an air-gapped or strict-CSP host\n * needs: copy `node_modules/@roxyapi/ui/dist/cdn/` onto your own origin, which\n * carries `locales/` beside `roxy-ui.js`.\n *\n * @example\n * ```ts\n * import { ensureScriptLoaded, ensureLocaleLoaded } from '@roxyapi/ui-react';\n *\n * ensureScriptLoaded();\n * ensureLocaleLoaded(document.documentElement.lang);\n * ```\n */\nexport function ensureLocaleLoaded(\n\tlang: string,\n\tversion: string = ROXY_UI_VERSION,\n\tbaseUrl?: string,\n): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tconst base = (lang || '').toLowerCase().split('-')[0] ?? '';\n\tif (!(ROXY_UI_LOCALES as readonly string[]).includes(base)) {\n\t\treturn Promise.resolve();\n\t}\n\tconst existing = localesLoaded.get(base);\n\tif (existing) return existing;\n\n\tconst pending = new Promise<void>((resolve, reject) => {\n\t\tconst id = `${SCRIPT_ID}-locale-${base}`;\n\t\tlet el = document.getElementById(id) as HTMLScriptElement | null;\n\t\tif (el) {\n\t\t\tif (el.dataset.loaded === 'true') resolve();\n\t\t\telse {\n\t\t\t\tel.addEventListener('load', () => resolve());\n\t\t\t\tel.addEventListener('error', () => reject(new Error(`roxy-ui locale ${base} load failed`)));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tel = document.createElement('script');\n\t\tel.id = id;\n\t\tel.src = `${baseUrl ?? buildBase(version)}/locales/${base}.js`;\n\t\tel.async = true;\n\t\tel.crossOrigin = 'anonymous';\n\t\tel.addEventListener('load', () => {\n\t\t\tel!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\tel.addEventListener('error', () => reject(new Error(`roxy-ui locale ${base} load failed`)));\n\t\tdocument.head.appendChild(el);\n\t});\n\tlocalesLoaded.set(base, pending);\n\treturn pending;\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.\n"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\nimport type { AnalyzeNumberSequenceResponse } from '../types/index.js';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children' | 'data'\n>;\n\nexport interface RoxyAngelNumberLookupProps extends ElementAttrs {\n\t/** Spec-derived response payload. Pass the raw RoxyAPI response. */\n\tdata?: AnalyzeNumberSequenceResponse;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\t/** Endpoint path for built-in self-fetch (uncontrolled mode), e.g. \"astrology/natal-chart\". The component renders its own input form, fetches with the publishable key, and displays the result. Leave unset for controlled mode (pass `data`). */\n\tendpoint?: string;\n\t/** HTTP method for the self-fetch request. Defaults to POST. */\n\tmethod?: 'GET' | 'POST';\n\t/** Browser-safe publishable key (pk_) for self-fetch. A secret key is refused client-side and never sent. */\n\tpublishableKey?: string;\n\t/** Override the API origin for self-hosted or proxied deployments. Absolute, or relative to the page for a same-origin route. */\n\tbaseUrl?: string;\n\t/** Your own backend route, which holds the secret key. Self-fetch POSTs `{ path, method, body, query }` there instead of calling RoxyAPI directly and renders the JSON your route returns, so no key of any kind reaches the browser. */\n\tsubmitUrl?: string;\n\t/** An object of your own, sent to your submitUrl route as `context` beside the request, so a page can attach its own verification data to a proxied submission. Passed through untouched and never read by the component: what it holds is for your page and your route to agree on. Unset, nothing is added and the route receives the request exactly as before. Rides the submitUrl path only; a direct call sends what the endpoint declares. */\n\tsubmitContext?: Record<string, unknown>;\n\t/** Where the self-fetch form city search sends its request, absolute or relative to the page. The companion of submitUrl: the city search is a GET the form issues on its own while a visitor types, so a page that routes its API traffic through its own server names that route here as well. Unset, the search calls the public location endpoint. */\n\tlocationUrl?: string;\n\t/** Override the OpenAPI spec URL the self-fetch form introspects. */\n\tspecUrl?: string;\n\t/** Response language for self-fetch, forwarded to the API `lang` query parameter (en, tr, de, es, hi, pt, fr, ru). The form never shows a language field; the site owner sets it here. Defaults to English. */\n\tlang?: string;\n\t/** Override the self-fetch form submit-button label. Empty derives an outcome-first label from the endpoint (Get reading, Generate, Compare, Cast). */\n\tsubmitLabel?: string;\n\t/** Persist the last self-fetch form values in sessionStorage, keyed by endpoint, and prefill the form when the visitor returns. Off by default. */\n\tremember?: boolean;\n\t/** Render a small \"Spiritual data by RoxyAPI\" credit under a self-fetch result, linking back to RoxyAPI. Off by default; set any value to enable, or \"off\" to force it off. Never shown in controlled mode. */\n\tattribution?: string;\n\t/** Render the chart and the data and omit the written interpretation. Off by default. Use it when the page supplies its own words: the wheels, tables, grids, legends and numbers stay, and the interpretive prose is left out of the markup entirely. */\n\thideReadings?: boolean;\n\t/** Comma-separated list of `part` names to take off this component, for example \"patterns\" or \"patterns, legend\". Per element rather than per site, so the same component can drop a block on one page and keep it on another with no CSS. Sibling of hideReadings and a different tool: this hides a whole block whatever it contains, where hideReadings drops interpretive prose out of the markup. Names come from the `parts` array in components-catalog.json; a name the component does not carry hides nothing and is not an error. */\n\thideSections?: string;\n\n}\n\nexport const RoxyAngelNumberLookup = React.forwardRef<HTMLElement | null, RoxyAngelNumberLookupProps>(\n\tfunction RoxyAngelNumberLookup({ data, className, style, endpoint, method, publishableKey, baseUrl, submitUrl, submitContext, locationUrl, specUrl, lang, submitLabel, remember, attribution, hideReadings, hideSections, ...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 && endpoint !== undefined) {\n\t\t\t\t(el as unknown as { endpoint: string }).endpoint = endpoint;\n\t\t\t}\n\t\t}, [endpoint, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && method !== undefined) {\n\t\t\t\t(el as unknown as { method: 'GET' | 'POST' }).method = method;\n\t\t\t}\n\t\t}, [method, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && publishableKey !== undefined) {\n\t\t\t\t(el as unknown as { publishableKey: string }).publishableKey = publishableKey;\n\t\t\t}\n\t\t}, [publishableKey, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && baseUrl !== undefined) {\n\t\t\t\t(el as unknown as { baseUrl: string }).baseUrl = baseUrl;\n\t\t\t}\n\t\t}, [baseUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitUrl !== undefined) {\n\t\t\t\t(el as unknown as { submitUrl: string }).submitUrl = submitUrl;\n\t\t\t}\n\t\t}, [submitUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitContext !== undefined) {\n\t\t\t\t(el as unknown as { submitContext: Record<string, unknown> }).submitContext = submitContext;\n\t\t\t}\n\t\t}, [submitContext, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && locationUrl !== undefined) {\n\t\t\t\t(el as unknown as { locationUrl: string }).locationUrl = locationUrl;\n\t\t\t}\n\t\t}, [locationUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && specUrl !== undefined) {\n\t\t\t\t(el as unknown as { specUrl: string }).specUrl = specUrl;\n\t\t\t}\n\t\t}, [specUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && lang !== undefined) {\n\t\t\t\t(el as unknown as { lang: string }).lang = lang;\n\t\t\t}\n\t\t}, [lang, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitLabel !== undefined) {\n\t\t\t\t(el as unknown as { submitLabel: string }).submitLabel = submitLabel;\n\t\t\t}\n\t\t}, [submitLabel, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && remember !== undefined) {\n\t\t\t\t(el as unknown as { remember: boolean }).remember = remember;\n\t\t\t}\n\t\t}, [remember, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && attribution !== undefined) {\n\t\t\t\t(el as unknown as { attribution: string }).attribution = attribution;\n\t\t\t}\n\t\t}, [attribution, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && hideReadings !== undefined) {\n\t\t\t\t(el as unknown as { hideReadings: boolean }).hideReadings = hideReadings;\n\t\t\t}\n\t\t}, [hideReadings, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && hideSections !== undefined) {\n\t\t\t\t(el as unknown as { hideSections: string }).hideSections = hideSections;\n\t\t\t}\n\t\t}, [hideSections, 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-angel-number-lookup', {\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 * {@link ensureLocaleLoaded} is the other half and is OPT-IN: it loads the label\n * catalogue for one language from the same release, so a non-English app calls\n * both. There is one catalogue, shipped by `@roxyapi/ui` and read by every\n * wrapper, so nothing is restated here.\n *\n * Defaults to the EXACT @roxyapi/ui release this wrapper was built against, so\n * `@roxyapi/ui-vue@x.y.z` always runs `@roxyapi/ui@x.y.z` and a lockfile actually\n * pins the runtime: it is a fixed version rather than a moving alias, so a later\n * @roxyapi/ui release cannot change the elements under an existing install.\n *\n * Pass an explicit `version` to override, or 'latest' to opt back into floating.\n *\n * Pass `baseUrl` to serve the bundle from your own origin instead of the CDN, which is\n * what an air-gapped install or a strict Content-Security-Policy needs: copy\n * `node_modules/@roxyapi/ui/dist/cdn/` onto your host and call this once at app entry,\n * before any component mounts. The loader keeps a single shared promise, so the first\n * call wins and every component reuses it.\n */\n/** The @roxyapi/ui release this wrapper was generated against. The loader defaults to it, so the wrapper version in your lockfile is the runtime you actually get. */\nexport const ROXY_UI_VERSION = \"0.47.0\";\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(\n\tversion: string = ROXY_UI_VERSION,\n\tbaseUrl?: string,\n): 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 = `${baseUrl ?? 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/** Every language a label catalogue ships for. English is absent on purpose: the catalogue key IS the English string, so an English page downloads nothing. */\nexport const ROXY_UI_LOCALES = [\"de\",\"es\",\"fr\",\"hi\",\"pt\",\"ru\",\"tr\",\"zh-Hans\",\"zh-Hant\"] as const;\n\nconst localesLoaded = new Map<string, Promise<void>>();\n\n/**\n * Load the label catalogue for one language, so the components write their own\n * headings, buttons, empty states and form labels in it.\n *\n * Call it once at app entry, beside `ensureScriptLoaded`. The components read the\n * language from the page (their own `lang` attribute, the nearest ancestor\n * carrying one, or `<html lang>`), so this call supplies the WORDS and the page\n * supplies the CHOICE. Loading a catalogue a page never asks for is harmless.\n *\n * `es-AR`, `es-MX` and `es-419` all resolve to the `es` catalogue, so pass the\n * page tag as it stands. English resolves to nothing at all and is not an error:\n * the catalogue is keyed by the English text, so an English page needs no payload.\n * A language outside `ROXY_UI_LOCALES` resolves the same way rather than appending\n * a script tag that 404s.\n *\n * `version` and `baseUrl` behave exactly as they do for {@link ensureScriptLoaded},\n * and passing the same `baseUrl` to both is what an air-gapped or strict-CSP host\n * needs: copy `node_modules/@roxyapi/ui/dist/cdn/` onto your own origin, which\n * carries `locales/` beside `roxy-ui.js`.\n *\n * @example\n * ```ts\n * import { ensureScriptLoaded, ensureLocaleLoaded } from '@roxyapi/ui-react';\n *\n * ensureScriptLoaded();\n * ensureLocaleLoaded(document.documentElement.lang);\n * ```\n */\nexport function ensureLocaleLoaded(\n\tlang: string,\n\tversion: string = ROXY_UI_VERSION,\n\tbaseUrl?: string,\n): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tconst base = (lang || '').toLowerCase().split('-')[0] ?? '';\n\tif (!(ROXY_UI_LOCALES as readonly string[]).includes(base)) {\n\t\treturn Promise.resolve();\n\t}\n\tconst existing = localesLoaded.get(base);\n\tif (existing) return existing;\n\n\tconst pending = new Promise<void>((resolve, reject) => {\n\t\tconst id = `${SCRIPT_ID}-locale-${base}`;\n\t\tlet el = document.getElementById(id) as HTMLScriptElement | null;\n\t\tif (el) {\n\t\t\tif (el.dataset.loaded === 'true') resolve();\n\t\t\telse {\n\t\t\t\tel.addEventListener('load', () => resolve());\n\t\t\t\tel.addEventListener('error', () => reject(new Error(`roxy-ui locale ${base} load failed`)));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tel = document.createElement('script');\n\t\tel.id = id;\n\t\tel.src = `${baseUrl ?? buildBase(version)}/locales/${base}.js`;\n\t\tel.async = true;\n\t\tel.crossOrigin = 'anonymous';\n\t\tel.addEventListener('load', () => {\n\t\t\tel!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\tel.addEventListener('error', () => reject(new Error(`roxy-ui locale ${base} load failed`)));\n\t\tdocument.head.appendChild(el);\n\t});\n\tlocalesLoaded.set(base, pending);\n\treturn pending;\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.\n"],
|
|
5
5
|
"mappings": "AAAA,UAAYA,MAAW,QC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AAM,QAAS,UAAArB,EAAW,MAAAC,CAAM,EAClC,+BAA+BoB,EAAM,OAAO,EAC7C,EAGY,gBAAc,2BAA4B,CACtD,IAAKH,EACL,UAAAlB,EACA,MAAAC,EACA,GAAGe,CACJ,CAAC,CACF,CACD",
|
|
6
6
|
"names": ["React", "ROXY_UI_VERSION", "SCRIPT_ID", "CDN_BASE_LATEST", "CDN_BASE_PREFIX", "CDN_BASE_SUFFIX", "loaded", "buildBase", "version", "ensureScriptLoaded", "baseUrl", "resolve", "reject", "url", "existing", "RoxyAngelNumberLookup", "data", "className", "style", "endpoint", "method", "publishableKey", "baseUrl", "submitUrl", "submitContext", "locationUrl", "specUrl", "lang", "submitLabel", "remember", "attribution", "hideReadings", "hideSections", "rest", "ref", "internal", "loaded", "setLoaded", "error", "setError", "active", "ensureScriptLoaded", "err", "el"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as n from"react";var I="0.
|
|
1
|
+
import*as n from"react";var I="0.47.0",k="roxyapi-ui-loader",_="https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn",$="https://cdn.jsdelivr.net/npm/@roxyapi/ui@",C="/dist/cdn",c=null;function M(a){return!a||a==="latest"?_:`${$}${a}${C}`}function b(a=I,i){return typeof document>"u"?Promise.resolve():c||(c=new Promise((o,d)=>{let u=`${i??M(a)}/roxy-ui.js`,t=document.getElementById(k);if(t){t.dataset.loaded==="true"?o():(t.addEventListener("load",()=>o()),t.addEventListener("error",()=>d(new Error("roxy-ui load failed"))));return}t=document.createElement("script"),t.id=k,t.src=u,t.async=!0,t.crossOrigin="anonymous",t.addEventListener("load",()=>{t.dataset.loaded="true",o()}),t.addEventListener("error",()=>d(new Error("roxy-ui load failed"))),document.head.appendChild(t)}),c)}var B=n.forwardRef(function({data:i,className:o,style:d,endpoint:u,method:t,publishableKey:l,baseUrl:f,submitUrl:E,submitContext:m,locationUrl:p,specUrl:g,lang:R,submitLabel:w,remember:y,attribution:L,hideReadings:x,hideSections:h,...v},T){let r=n.useRef(null);n.useImperativeHandle(T,()=>r.current,[]);let[s,A]=n.useState(!1),[S,H]=n.useState(null);return n.useEffect(()=>{let e=!0;return b().then(()=>{e&&A(!0)}).catch(P=>{e&&H(P instanceof Error?P:new Error(String(P)))}),()=>{e=!1}},[]),n.useEffect(()=>{let e=r.current;e&&i!==void 0&&(e.data=i)},[i,s]),n.useEffect(()=>{let e=r.current;e&&u!==void 0&&(e.endpoint=u)},[u,s]),n.useEffect(()=>{let e=r.current;e&&t!==void 0&&(e.method=t)},[t,s]),n.useEffect(()=>{let e=r.current;e&&l!==void 0&&(e.publishableKey=l)},[l,s]),n.useEffect(()=>{let e=r.current;e&&f!==void 0&&(e.baseUrl=f)},[f,s]),n.useEffect(()=>{let e=r.current;e&&E!==void 0&&(e.submitUrl=E)},[E,s]),n.useEffect(()=>{let e=r.current;e&&m!==void 0&&(e.submitContext=m)},[m,s]),n.useEffect(()=>{let e=r.current;e&&p!==void 0&&(e.locationUrl=p)},[p,s]),n.useEffect(()=>{let e=r.current;e&&g!==void 0&&(e.specUrl=g)},[g,s]),n.useEffect(()=>{let e=r.current;e&&R!==void 0&&(e.lang=R)},[R,s]),n.useEffect(()=>{let e=r.current;e&&w!==void 0&&(e.submitLabel=w)},[w,s]),n.useEffect(()=>{let e=r.current;e&&y!==void 0&&(e.remember=y)},[y,s]),n.useEffect(()=>{let e=r.current;e&&L!==void 0&&(e.attribution=L)},[L,s]),n.useEffect(()=>{let e=r.current;e&&x!==void 0&&(e.hideReadings=x)},[x,s]),n.useEffect(()=>{let e=r.current;e&&h!==void 0&&(e.hideSections=h)},[h,s]),S?n.createElement("div",{role:"alert",className:o,style:d},`Roxy UI script load failed: ${S.message}`):n.createElement("roxy-arudha-padas",{ref:r,className:o,style:d,...v})});export{B as RoxyArudhaPadas};
|
|
2
2
|
//# sourceMappingURL=arudha-padas.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/arudha-padas.tsx", "../../src/load-ui.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\nimport type { ArudhaResponse } from '../types/index.js';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children' | 'data'\n>;\n\nexport interface RoxyArudhaPadasProps extends ElementAttrs {\n\t/** Spec-derived response payload. Pass the raw RoxyAPI response. */\n\tdata?: ArudhaResponse;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\t/** Endpoint path for built-in self-fetch (uncontrolled mode), e.g. \"astrology/natal-chart\". The component renders its own input form, fetches with the publishable key, and displays the result. Leave unset for controlled mode (pass `data`). */\n\tendpoint?: string;\n\t/** HTTP method for the self-fetch request. Defaults to POST. */\n\tmethod?: 'GET' | 'POST';\n\t/** Browser-safe publishable key (pk_) for self-fetch. A secret key is refused client-side and never sent. */\n\tpublishableKey?: string;\n\t/** Override the API origin for self-hosted or proxied deployments. Absolute, or relative to the page for a same-origin route. */\n\tbaseUrl?: string;\n\t/** Your own backend route, which holds the secret key. Self-fetch POSTs `{ path, method, body, query }` there instead of calling RoxyAPI directly and renders the JSON your route returns, so no key of any kind reaches the browser. */\n\tsubmitUrl?: string;\n\t/** An object of your own, sent to your submitUrl route as `context` beside the request, so a page can attach its own verification data to a proxied submission. Passed through untouched and never read by the component: what it holds is for your page and your route to agree on. Unset, nothing is added and the route receives the request exactly as before. Rides the submitUrl path only; a direct call sends what the endpoint declares. */\n\tsubmitContext?: Record<string, unknown>;\n\t/** Where the self-fetch form city search sends its request, absolute or relative to the page. The companion of submitUrl: the city search is a GET the form issues on its own while a visitor types, so a page that routes its API traffic through its own server names that route here as well. Unset, the search calls the public location endpoint. */\n\tlocationUrl?: string;\n\t/** Override the OpenAPI spec URL the self-fetch form introspects. */\n\tspecUrl?: string;\n\t/** Response language for self-fetch, forwarded to the API `lang` query parameter (en, tr, de, es, hi, pt, fr, ru). The form never shows a language field; the site owner sets it here. Defaults to English. */\n\tlang?: string;\n\t/** Override the self-fetch form submit-button label. Empty derives an outcome-first label from the endpoint (Get reading, Generate, Compare, Cast). */\n\tsubmitLabel?: string;\n\t/** Persist the last self-fetch form values in sessionStorage, keyed by endpoint, and prefill the form when the visitor returns. Off by default. */\n\tremember?: boolean;\n\t/** Render a small \"Spiritual data by RoxyAPI\" credit under a self-fetch result, linking back to RoxyAPI. Off by default; set any value to enable, or \"off\" to force it off. Never shown in controlled mode. */\n\tattribution?: string;\n\t/** Render the chart and the data and omit the written interpretation. Off by default. Use it when the page supplies its own words: the wheels, tables, grids, legends and numbers stay, and the interpretive prose is left out of the markup entirely. */\n\thideReadings?: boolean;\n\t/** Comma-separated list of `part` names to take off this component, for example \"patterns\" or \"patterns, legend\". Per element rather than per site, so the same component can drop a block on one page and keep it on another with no CSS. Sibling of hideReadings and a different tool: this hides a whole block whatever it contains, where hideReadings drops interpretive prose out of the markup. Names come from the `parts` array in components-catalog.json; a name the component does not carry hides nothing and is not an error. */\n\thideSections?: string;\n\n}\n\nexport const RoxyArudhaPadas = React.forwardRef<HTMLElement | null, RoxyArudhaPadasProps>(\n\tfunction RoxyArudhaPadas({ data, className, style, endpoint, method, publishableKey, baseUrl, submitUrl, submitContext, locationUrl, specUrl, lang, submitLabel, remember, attribution, hideReadings, hideSections, ...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 && endpoint !== undefined) {\n\t\t\t\t(el as unknown as { endpoint: string }).endpoint = endpoint;\n\t\t\t}\n\t\t}, [endpoint, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && method !== undefined) {\n\t\t\t\t(el as unknown as { method: 'GET' | 'POST' }).method = method;\n\t\t\t}\n\t\t}, [method, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && publishableKey !== undefined) {\n\t\t\t\t(el as unknown as { publishableKey: string }).publishableKey = publishableKey;\n\t\t\t}\n\t\t}, [publishableKey, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && baseUrl !== undefined) {\n\t\t\t\t(el as unknown as { baseUrl: string }).baseUrl = baseUrl;\n\t\t\t}\n\t\t}, [baseUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitUrl !== undefined) {\n\t\t\t\t(el as unknown as { submitUrl: string }).submitUrl = submitUrl;\n\t\t\t}\n\t\t}, [submitUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitContext !== undefined) {\n\t\t\t\t(el as unknown as { submitContext: Record<string, unknown> }).submitContext = submitContext;\n\t\t\t}\n\t\t}, [submitContext, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && locationUrl !== undefined) {\n\t\t\t\t(el as unknown as { locationUrl: string }).locationUrl = locationUrl;\n\t\t\t}\n\t\t}, [locationUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && specUrl !== undefined) {\n\t\t\t\t(el as unknown as { specUrl: string }).specUrl = specUrl;\n\t\t\t}\n\t\t}, [specUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && lang !== undefined) {\n\t\t\t\t(el as unknown as { lang: string }).lang = lang;\n\t\t\t}\n\t\t}, [lang, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitLabel !== undefined) {\n\t\t\t\t(el as unknown as { submitLabel: string }).submitLabel = submitLabel;\n\t\t\t}\n\t\t}, [submitLabel, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && remember !== undefined) {\n\t\t\t\t(el as unknown as { remember: boolean }).remember = remember;\n\t\t\t}\n\t\t}, [remember, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && attribution !== undefined) {\n\t\t\t\t(el as unknown as { attribution: string }).attribution = attribution;\n\t\t\t}\n\t\t}, [attribution, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && hideReadings !== undefined) {\n\t\t\t\t(el as unknown as { hideReadings: boolean }).hideReadings = hideReadings;\n\t\t\t}\n\t\t}, [hideReadings, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && hideSections !== undefined) {\n\t\t\t\t(el as unknown as { hideSections: string }).hideSections = hideSections;\n\t\t\t}\n\t\t}, [hideSections, 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-arudha-padas', {\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 * {@link ensureLocaleLoaded} is the other half and is OPT-IN: it loads the label\n * catalogue for one language from the same release, so a non-English app calls\n * both. There is one catalogue, shipped by `@roxyapi/ui` and read by every\n * wrapper, so nothing is restated here.\n *\n * Defaults to the EXACT @roxyapi/ui release this wrapper was built against, so\n * `@roxyapi/ui-vue@x.y.z` always runs `@roxyapi/ui@x.y.z` and a lockfile actually\n * pins the runtime: it is a fixed version rather than a moving alias, so a later\n * @roxyapi/ui release cannot change the elements under an existing install.\n *\n * Pass an explicit `version` to override, or 'latest' to opt back into floating.\n *\n * Pass `baseUrl` to serve the bundle from your own origin instead of the CDN, which is\n * what an air-gapped install or a strict Content-Security-Policy needs: copy\n * `node_modules/@roxyapi/ui/dist/cdn/` onto your host and call this once at app entry,\n * before any component mounts. The loader keeps a single shared promise, so the first\n * call wins and every component reuses it.\n */\n/** The @roxyapi/ui release this wrapper was generated against. The loader defaults to it, so the wrapper version in your lockfile is the runtime you actually get. */\nexport const ROXY_UI_VERSION = \"0.45.0\";\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(\n\tversion: string = ROXY_UI_VERSION,\n\tbaseUrl?: string,\n): 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 = `${baseUrl ?? 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/** Every language a label catalogue ships for. English is absent on purpose: the catalogue key IS the English string, so an English page downloads nothing. */\nexport const ROXY_UI_LOCALES = [\"de\",\"es\",\"fr\",\"hi\",\"pt\",\"ru\",\"tr\",\"zh-Hans\",\"zh-Hant\"] as const;\n\nconst localesLoaded = new Map<string, Promise<void>>();\n\n/**\n * Load the label catalogue for one language, so the components write their own\n * headings, buttons, empty states and form labels in it.\n *\n * Call it once at app entry, beside `ensureScriptLoaded`. The components read the\n * language from the page (their own `lang` attribute, the nearest ancestor\n * carrying one, or `<html lang>`), so this call supplies the WORDS and the page\n * supplies the CHOICE. Loading a catalogue a page never asks for is harmless.\n *\n * `es-AR`, `es-MX` and `es-419` all resolve to the `es` catalogue, so pass the\n * page tag as it stands. English resolves to nothing at all and is not an error:\n * the catalogue is keyed by the English text, so an English page needs no payload.\n * A language outside `ROXY_UI_LOCALES` resolves the same way rather than appending\n * a script tag that 404s.\n *\n * `version` and `baseUrl` behave exactly as they do for {@link ensureScriptLoaded},\n * and passing the same `baseUrl` to both is what an air-gapped or strict-CSP host\n * needs: copy `node_modules/@roxyapi/ui/dist/cdn/` onto your own origin, which\n * carries `locales/` beside `roxy-ui.js`.\n *\n * @example\n * ```ts\n * import { ensureScriptLoaded, ensureLocaleLoaded } from '@roxyapi/ui-react';\n *\n * ensureScriptLoaded();\n * ensureLocaleLoaded(document.documentElement.lang);\n * ```\n */\nexport function ensureLocaleLoaded(\n\tlang: string,\n\tversion: string = ROXY_UI_VERSION,\n\tbaseUrl?: string,\n): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tconst base = (lang || '').toLowerCase().split('-')[0] ?? '';\n\tif (!(ROXY_UI_LOCALES as readonly string[]).includes(base)) {\n\t\treturn Promise.resolve();\n\t}\n\tconst existing = localesLoaded.get(base);\n\tif (existing) return existing;\n\n\tconst pending = new Promise<void>((resolve, reject) => {\n\t\tconst id = `${SCRIPT_ID}-locale-${base}`;\n\t\tlet el = document.getElementById(id) as HTMLScriptElement | null;\n\t\tif (el) {\n\t\t\tif (el.dataset.loaded === 'true') resolve();\n\t\t\telse {\n\t\t\t\tel.addEventListener('load', () => resolve());\n\t\t\t\tel.addEventListener('error', () => reject(new Error(`roxy-ui locale ${base} load failed`)));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tel = document.createElement('script');\n\t\tel.id = id;\n\t\tel.src = `${baseUrl ?? buildBase(version)}/locales/${base}.js`;\n\t\tel.async = true;\n\t\tel.crossOrigin = 'anonymous';\n\t\tel.addEventListener('load', () => {\n\t\t\tel!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\tel.addEventListener('error', () => reject(new Error(`roxy-ui locale ${base} load failed`)));\n\t\tdocument.head.appendChild(el);\n\t});\n\tlocalesLoaded.set(base, pending);\n\treturn pending;\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.\n"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { ensureScriptLoaded } from '../load-ui.js';\nimport type { ArudhaResponse } from '../types/index.js';\n\ntype ElementAttrs = Omit<\n\tReact.HTMLAttributes<HTMLElement>,\n\t'children' | 'data'\n>;\n\nexport interface RoxyArudhaPadasProps extends ElementAttrs {\n\t/** Spec-derived response payload. Pass the raw RoxyAPI response. */\n\tdata?: ArudhaResponse;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\t/** Endpoint path for built-in self-fetch (uncontrolled mode), e.g. \"astrology/natal-chart\". The component renders its own input form, fetches with the publishable key, and displays the result. Leave unset for controlled mode (pass `data`). */\n\tendpoint?: string;\n\t/** HTTP method for the self-fetch request. Defaults to POST. */\n\tmethod?: 'GET' | 'POST';\n\t/** Browser-safe publishable key (pk_) for self-fetch. A secret key is refused client-side and never sent. */\n\tpublishableKey?: string;\n\t/** Override the API origin for self-hosted or proxied deployments. Absolute, or relative to the page for a same-origin route. */\n\tbaseUrl?: string;\n\t/** Your own backend route, which holds the secret key. Self-fetch POSTs `{ path, method, body, query }` there instead of calling RoxyAPI directly and renders the JSON your route returns, so no key of any kind reaches the browser. */\n\tsubmitUrl?: string;\n\t/** An object of your own, sent to your submitUrl route as `context` beside the request, so a page can attach its own verification data to a proxied submission. Passed through untouched and never read by the component: what it holds is for your page and your route to agree on. Unset, nothing is added and the route receives the request exactly as before. Rides the submitUrl path only; a direct call sends what the endpoint declares. */\n\tsubmitContext?: Record<string, unknown>;\n\t/** Where the self-fetch form city search sends its request, absolute or relative to the page. The companion of submitUrl: the city search is a GET the form issues on its own while a visitor types, so a page that routes its API traffic through its own server names that route here as well. Unset, the search calls the public location endpoint. */\n\tlocationUrl?: string;\n\t/** Override the OpenAPI spec URL the self-fetch form introspects. */\n\tspecUrl?: string;\n\t/** Response language for self-fetch, forwarded to the API `lang` query parameter (en, tr, de, es, hi, pt, fr, ru). The form never shows a language field; the site owner sets it here. Defaults to English. */\n\tlang?: string;\n\t/** Override the self-fetch form submit-button label. Empty derives an outcome-first label from the endpoint (Get reading, Generate, Compare, Cast). */\n\tsubmitLabel?: string;\n\t/** Persist the last self-fetch form values in sessionStorage, keyed by endpoint, and prefill the form when the visitor returns. Off by default. */\n\tremember?: boolean;\n\t/** Render a small \"Spiritual data by RoxyAPI\" credit under a self-fetch result, linking back to RoxyAPI. Off by default; set any value to enable, or \"off\" to force it off. Never shown in controlled mode. */\n\tattribution?: string;\n\t/** Render the chart and the data and omit the written interpretation. Off by default. Use it when the page supplies its own words: the wheels, tables, grids, legends and numbers stay, and the interpretive prose is left out of the markup entirely. */\n\thideReadings?: boolean;\n\t/** Comma-separated list of `part` names to take off this component, for example \"patterns\" or \"patterns, legend\". Per element rather than per site, so the same component can drop a block on one page and keep it on another with no CSS. Sibling of hideReadings and a different tool: this hides a whole block whatever it contains, where hideReadings drops interpretive prose out of the markup. Names come from the `parts` array in components-catalog.json; a name the component does not carry hides nothing and is not an error. */\n\thideSections?: string;\n\n}\n\nexport const RoxyArudhaPadas = React.forwardRef<HTMLElement | null, RoxyArudhaPadasProps>(\n\tfunction RoxyArudhaPadas({ data, className, style, endpoint, method, publishableKey, baseUrl, submitUrl, submitContext, locationUrl, specUrl, lang, submitLabel, remember, attribution, hideReadings, hideSections, ...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 && endpoint !== undefined) {\n\t\t\t\t(el as unknown as { endpoint: string }).endpoint = endpoint;\n\t\t\t}\n\t\t}, [endpoint, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && method !== undefined) {\n\t\t\t\t(el as unknown as { method: 'GET' | 'POST' }).method = method;\n\t\t\t}\n\t\t}, [method, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && publishableKey !== undefined) {\n\t\t\t\t(el as unknown as { publishableKey: string }).publishableKey = publishableKey;\n\t\t\t}\n\t\t}, [publishableKey, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && baseUrl !== undefined) {\n\t\t\t\t(el as unknown as { baseUrl: string }).baseUrl = baseUrl;\n\t\t\t}\n\t\t}, [baseUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitUrl !== undefined) {\n\t\t\t\t(el as unknown as { submitUrl: string }).submitUrl = submitUrl;\n\t\t\t}\n\t\t}, [submitUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitContext !== undefined) {\n\t\t\t\t(el as unknown as { submitContext: Record<string, unknown> }).submitContext = submitContext;\n\t\t\t}\n\t\t}, [submitContext, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && locationUrl !== undefined) {\n\t\t\t\t(el as unknown as { locationUrl: string }).locationUrl = locationUrl;\n\t\t\t}\n\t\t}, [locationUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && specUrl !== undefined) {\n\t\t\t\t(el as unknown as { specUrl: string }).specUrl = specUrl;\n\t\t\t}\n\t\t}, [specUrl, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && lang !== undefined) {\n\t\t\t\t(el as unknown as { lang: string }).lang = lang;\n\t\t\t}\n\t\t}, [lang, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && submitLabel !== undefined) {\n\t\t\t\t(el as unknown as { submitLabel: string }).submitLabel = submitLabel;\n\t\t\t}\n\t\t}, [submitLabel, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && remember !== undefined) {\n\t\t\t\t(el as unknown as { remember: boolean }).remember = remember;\n\t\t\t}\n\t\t}, [remember, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && attribution !== undefined) {\n\t\t\t\t(el as unknown as { attribution: string }).attribution = attribution;\n\t\t\t}\n\t\t}, [attribution, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && hideReadings !== undefined) {\n\t\t\t\t(el as unknown as { hideReadings: boolean }).hideReadings = hideReadings;\n\t\t\t}\n\t\t}, [hideReadings, loaded]);\n\n\t\tReact.useEffect(() => {\n\t\t\tconst el = internal.current;\n\t\t\tif (el && hideSections !== undefined) {\n\t\t\t\t(el as unknown as { hideSections: string }).hideSections = hideSections;\n\t\t\t}\n\t\t}, [hideSections, 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-arudha-padas', {\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 * {@link ensureLocaleLoaded} is the other half and is OPT-IN: it loads the label\n * catalogue for one language from the same release, so a non-English app calls\n * both. There is one catalogue, shipped by `@roxyapi/ui` and read by every\n * wrapper, so nothing is restated here.\n *\n * Defaults to the EXACT @roxyapi/ui release this wrapper was built against, so\n * `@roxyapi/ui-vue@x.y.z` always runs `@roxyapi/ui@x.y.z` and a lockfile actually\n * pins the runtime: it is a fixed version rather than a moving alias, so a later\n * @roxyapi/ui release cannot change the elements under an existing install.\n *\n * Pass an explicit `version` to override, or 'latest' to opt back into floating.\n *\n * Pass `baseUrl` to serve the bundle from your own origin instead of the CDN, which is\n * what an air-gapped install or a strict Content-Security-Policy needs: copy\n * `node_modules/@roxyapi/ui/dist/cdn/` onto your host and call this once at app entry,\n * before any component mounts. The loader keeps a single shared promise, so the first\n * call wins and every component reuses it.\n */\n/** The @roxyapi/ui release this wrapper was generated against. The loader defaults to it, so the wrapper version in your lockfile is the runtime you actually get. */\nexport const ROXY_UI_VERSION = \"0.47.0\";\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(\n\tversion: string = ROXY_UI_VERSION,\n\tbaseUrl?: string,\n): 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 = `${baseUrl ?? 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/** Every language a label catalogue ships for. English is absent on purpose: the catalogue key IS the English string, so an English page downloads nothing. */\nexport const ROXY_UI_LOCALES = [\"de\",\"es\",\"fr\",\"hi\",\"pt\",\"ru\",\"tr\",\"zh-Hans\",\"zh-Hant\"] as const;\n\nconst localesLoaded = new Map<string, Promise<void>>();\n\n/**\n * Load the label catalogue for one language, so the components write their own\n * headings, buttons, empty states and form labels in it.\n *\n * Call it once at app entry, beside `ensureScriptLoaded`. The components read the\n * language from the page (their own `lang` attribute, the nearest ancestor\n * carrying one, or `<html lang>`), so this call supplies the WORDS and the page\n * supplies the CHOICE. Loading a catalogue a page never asks for is harmless.\n *\n * `es-AR`, `es-MX` and `es-419` all resolve to the `es` catalogue, so pass the\n * page tag as it stands. English resolves to nothing at all and is not an error:\n * the catalogue is keyed by the English text, so an English page needs no payload.\n * A language outside `ROXY_UI_LOCALES` resolves the same way rather than appending\n * a script tag that 404s.\n *\n * `version` and `baseUrl` behave exactly as they do for {@link ensureScriptLoaded},\n * and passing the same `baseUrl` to both is what an air-gapped or strict-CSP host\n * needs: copy `node_modules/@roxyapi/ui/dist/cdn/` onto your own origin, which\n * carries `locales/` beside `roxy-ui.js`.\n *\n * @example\n * ```ts\n * import { ensureScriptLoaded, ensureLocaleLoaded } from '@roxyapi/ui-react';\n *\n * ensureScriptLoaded();\n * ensureLocaleLoaded(document.documentElement.lang);\n * ```\n */\nexport function ensureLocaleLoaded(\n\tlang: string,\n\tversion: string = ROXY_UI_VERSION,\n\tbaseUrl?: string,\n): Promise<void> {\n\tif (typeof document === 'undefined') return Promise.resolve();\n\tconst base = (lang || '').toLowerCase().split('-')[0] ?? '';\n\tif (!(ROXY_UI_LOCALES as readonly string[]).includes(base)) {\n\t\treturn Promise.resolve();\n\t}\n\tconst existing = localesLoaded.get(base);\n\tif (existing) return existing;\n\n\tconst pending = new Promise<void>((resolve, reject) => {\n\t\tconst id = `${SCRIPT_ID}-locale-${base}`;\n\t\tlet el = document.getElementById(id) as HTMLScriptElement | null;\n\t\tif (el) {\n\t\t\tif (el.dataset.loaded === 'true') resolve();\n\t\t\telse {\n\t\t\t\tel.addEventListener('load', () => resolve());\n\t\t\t\tel.addEventListener('error', () => reject(new Error(`roxy-ui locale ${base} load failed`)));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tel = document.createElement('script');\n\t\tel.id = id;\n\t\tel.src = `${baseUrl ?? buildBase(version)}/locales/${base}.js`;\n\t\tel.async = true;\n\t\tel.crossOrigin = 'anonymous';\n\t\tel.addEventListener('load', () => {\n\t\t\tel!.dataset.loaded = 'true';\n\t\t\tresolve();\n\t\t});\n\t\tel.addEventListener('error', () => reject(new Error(`roxy-ui locale ${base} load failed`)));\n\t\tdocument.head.appendChild(el);\n\t});\n\tlocalesLoaded.set(base, pending);\n\treturn pending;\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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EAAG,CAACA,EAAcI,CAAM,CAAC,EAErBE,EACU,gBACZ,MACA,CAAE,KAAM,QAAS,UAAArB,EAAW,MAAAC,CAAM,EAClC,+BAA+BoB,EAAM,OAAO,EAC7C,EAGY,gBAAc,oBAAqB,CAC/C,IAAKH,EACL,UAAAlB,EACA,MAAAC,EACA,GAAGe,CACJ,CAAC,CACF,CACD",
|
|
6
6
|
"names": ["React", "ROXY_UI_VERSION", "SCRIPT_ID", "CDN_BASE_LATEST", "CDN_BASE_PREFIX", "CDN_BASE_SUFFIX", "loaded", "buildBase", "version", "ensureScriptLoaded", "baseUrl", "resolve", "reject", "url", "existing", "RoxyArudhaPadas", "data", "className", "style", "endpoint", "method", "publishableKey", "baseUrl", "submitUrl", "submitContext", "locationUrl", "specUrl", "lang", "submitLabel", "remember", "attribution", "hideReadings", "hideSections", "rest", "ref", "internal", "loaded", "setLoaded", "error", "setError", "active", "ensureScriptLoaded", "err", "el"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as n from"react";var I="0.
|
|
1
|
+
import*as n from"react";var I="0.47.0",S="roxyapi-ui-loader",_="https://cdn.jsdelivr.net/npm/@roxyapi/ui@latest/dist/cdn",$="https://cdn.jsdelivr.net/npm/@roxyapi/ui@",C="/dist/cdn",c=null;function M(a){return!a||a==="latest"?_:`${$}${a}${C}`}function b(a=I,o){return typeof document>"u"?Promise.resolve():c||(c=new Promise((i,d)=>{let u=`${o??M(a)}/roxy-ui.js`,t=document.getElementById(S);if(t){t.dataset.loaded==="true"?i():(t.addEventListener("load",()=>i()),t.addEventListener("error",()=>d(new Error("roxy-ui load failed"))));return}t=document.createElement("script"),t.id=S,t.src=u,t.async=!0,t.crossOrigin="anonymous",t.addEventListener("load",()=>{t.dataset.loaded="true",i()}),t.addEventListener("error",()=>d(new Error("roxy-ui load failed"))),document.head.appendChild(t)}),c)}var B=n.forwardRef(function({data:o,className:i,style:d,endpoint:u,method:t,publishableKey:l,baseUrl:f,submitUrl:E,submitContext:g,locationUrl:m,specUrl:p,lang:R,submitLabel:w,remember:y,attribution:L,hideReadings:k,hideSections:x,...P},T){let r=n.useRef(null);n.useImperativeHandle(T,()=>r.current,[]);let[s,A]=n.useState(!1),[v,H]=n.useState(null);return n.useEffect(()=>{let e=!0;return b().then(()=>{e&&A(!0)}).catch(h=>{e&&H(h instanceof Error?h:new Error(String(h)))}),()=>{e=!1}},[]),n.useEffect(()=>{let e=r.current;e&&o!==void 0&&(e.data=o)},[o,s]),n.useEffect(()=>{let e=r.current;e&&u!==void 0&&(e.endpoint=u)},[u,s]),n.useEffect(()=>{let e=r.current;e&&t!==void 0&&(e.method=t)},[t,s]),n.useEffect(()=>{let e=r.current;e&&l!==void 0&&(e.publishableKey=l)},[l,s]),n.useEffect(()=>{let e=r.current;e&&f!==void 0&&(e.baseUrl=f)},[f,s]),n.useEffect(()=>{let e=r.current;e&&E!==void 0&&(e.submitUrl=E)},[E,s]),n.useEffect(()=>{let e=r.current;e&&g!==void 0&&(e.submitContext=g)},[g,s]),n.useEffect(()=>{let e=r.current;e&&m!==void 0&&(e.locationUrl=m)},[m,s]),n.useEffect(()=>{let e=r.current;e&&p!==void 0&&(e.specUrl=p)},[p,s]),n.useEffect(()=>{let e=r.current;e&&R!==void 0&&(e.lang=R)},[R,s]),n.useEffect(()=>{let e=r.current;e&&w!==void 0&&(e.submitLabel=w)},[w,s]),n.useEffect(()=>{let e=r.current;e&&y!==void 0&&(e.remember=y)},[y,s]),n.useEffect(()=>{let e=r.current;e&&L!==void 0&&(e.attribution=L)},[L,s]),n.useEffect(()=>{let e=r.current;e&&k!==void 0&&(e.hideReadings=k)},[k,s]),n.useEffect(()=>{let e=r.current;e&&x!==void 0&&(e.hideSections=x)},[x,s]),v?n.createElement("div",{role:"alert",className:i,style:d},`Roxy UI script load failed: ${v.message}`):n.createElement("roxy-ashtakavarga-grid",{ref:r,className:i,style:d,...P})});export{B as RoxyAshtakavargaGrid};
|
|
2
2
|
//# sourceMappingURL=ashtakavarga-grid.js.map
|