@openreceive/browser 0.4.1 → 0.4.3

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/dist/headless.js CHANGED
@@ -14,6 +14,8 @@ import {
14
14
  OPENRECEIVE_PAYMENT_WIZARD_ATTRIBUTES,
15
15
  OPENRECEIVE_PAYMENT_WIZARD_SELECTORS,
16
16
  OPENRECEIVE_PROVIDER_PREVIEW_LIMIT,
17
+ OPENRECEIVE_STYLE_ROOT_ATTRIBUTE,
18
+ OPENRECEIVE_STYLE_ROOT_SELECTOR,
17
19
  OPENRECEIVE_THEME_STORAGE_KEY,
18
20
  OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES,
19
21
  OPENRECEIVE_THEME_TOGGLE_ELEMENT_EVENTS,
@@ -119,7 +121,7 @@ import {
119
121
  swapOptionLimitSentence,
120
122
  swapPickerKey,
121
123
  updatePaymentWizardSelection
122
- } from "./chunk-64ROVMMY.js";
124
+ } from "./chunk-VZ7M7ZUE.js";
123
125
 
124
126
  // src/headless.ts
125
127
  import { createAssetBaseUrlResolver, getPaymentWizardRoutes } from "@openreceive/provider-data";
@@ -542,7 +544,12 @@ function createCheckoutShellModel(snapshot, options = {}) {
542
544
  const ownTheme = options.themeToggle !== false;
543
545
  return {
544
546
  theme,
545
- rootAttributes: ownTheme ? theme.attributes : {},
547
+ // The scope marker is unconditional: the shipped stylesheet only reaches
548
+ // elements under it, whoever owns the theme.
549
+ rootAttributes: {
550
+ [OPENRECEIVE_STYLE_ROOT_ATTRIBUTE]: "",
551
+ ...ownTheme ? theme.attributes : {}
552
+ },
546
553
  checkout: {
547
554
  tagName: OPENRECEIVE_CHECKOUT_ELEMENT_TAG_NAME,
548
555
  attributes: createCheckoutElementAttributes(snapshot, {
@@ -626,6 +633,8 @@ export {
626
633
  OPENRECEIVE_PAYMENT_WIZARD_ATTRIBUTES,
627
634
  OPENRECEIVE_PAYMENT_WIZARD_SELECTORS,
628
635
  OPENRECEIVE_PROVIDER_PREVIEW_LIMIT,
636
+ OPENRECEIVE_STYLE_ROOT_ATTRIBUTE,
637
+ OPENRECEIVE_STYLE_ROOT_SELECTOR,
629
638
  OPENRECEIVE_THEME_STORAGE_KEY,
630
639
  OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES,
631
640
  OPENRECEIVE_THEME_TOGGLE_ELEMENT_EVENTS,
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { aT as BrowserLogLevel } from './status-CzIEJWjS.js';
2
- export { aU as BrowserLogEntry, X as BrowserLogger, B as BrowserLoggerOption, Y as BrowserRequestError, Z as CheckoutController, _ as CheckoutControllerOptions, h as CheckoutSnapshot, j as CheckoutState, aV as CopyInvoiceOptions, aW as GuestCheckoutResumeController, aX as GuestCheckoutResumeOptions, aY as OpenWalletOptions, aZ as PrepareCheckoutOptions, a_ as QrOptions, a$ as RequestCheckoutOptions, ao as Status, b0 as StatusInvoiceLike, U as UnixSeconds, at as copyInvoice, av as createCheckoutController, b1 as createGuestCheckoutResume, b2 as createGuestOrderFetcher, b3 as createLightningUri, b4 as createQrPngDataUrl, aA as createQrSvg, aG as deriveStatus, aH as enterCheckoutResumePath, aP as openWallet, aR as prepareCheckout, aS as requestCheckout } from './status-CzIEJWjS.js';
1
+ import { aW as BrowserLogLevel } from './status-iwqocz21.js';
2
+ export { aX as BrowserLogEntry, X as BrowserLogger, B as BrowserLoggerOption, Y as BrowserRequestError, Z as CheckoutController, _ as CheckoutControllerOptions, h as CheckoutSnapshot, j as CheckoutState, aY as CopyInvoiceOptions, aZ as GuestCheckoutResumeController, a_ as GuestCheckoutResumeOptions, a$ as OpenWalletOptions, b0 as PrepareCheckoutOptions, b1 as QrOptions, b2 as RequestCheckoutOptions, ar as Status, b3 as StatusInvoiceLike, U as UnixSeconds, aw as copyInvoice, ay as createCheckoutController, b4 as createGuestCheckoutResume, b5 as createGuestOrderFetcher, b6 as createLightningUri, b7 as createQrPngDataUrl, aD as createQrSvg, aJ as deriveStatus, aK as enterCheckoutResumePath, aS as openWallet, aU as prepareCheckout, aV as requestCheckout } from './status-iwqocz21.js';
3
3
  import '@openreceive/provider-data';
4
4
  import '@openreceive/core';
5
5
 
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  openWallet,
14
14
  prepareCheckout,
15
15
  requestCheckout
16
- } from "./chunk-64ROVMMY.js";
16
+ } from "./chunk-VZ7M7ZUE.js";
17
17
  export {
18
18
  BrowserRequestError,
19
19
  copyInvoice,
@@ -24,7 +24,7 @@ declare function formatFiatAmount(fiat: {
24
24
  readonly currency?: string;
25
25
  readonly value?: string;
26
26
  } | null | undefined): string | undefined;
27
- /** Combined QR caption, e.g. `19,174 sats / $12.00 US`. */
27
+ /** Combined QR caption, e.g. `19,174 sats / $12.00 USD` — the ISO code, because "$" alone does not say which dollar. */
28
28
  declare function formatAmountCaption(options: {
29
29
  readonly amountLabel?: string;
30
30
  readonly fiatLabel?: string;
@@ -183,6 +183,18 @@ declare const OPENRECEIVE_CHECKOUT_DATA_SELECTORS: {
183
183
  readonly theme: "[data-openreceive-theme]";
184
184
  readonly themeToggle: "[data-openreceive-theme-toggle]";
185
185
  };
186
+ /**
187
+ * The stylesheet scope marker. The shipped `styles.css` is rewritten at build
188
+ * time (tools/package/scope-styles.mjs) so every rule — preflight, theme
189
+ * variables, daisyUI components — applies only on or under an element carrying
190
+ * this attribute; loaded into a host page it is otherwise inert. Every
191
+ * light-DOM entry the packages render stamps it (React `<Checkout>` and
192
+ * `<ThemeToggle>`, the Vue/Svelte/Angular shell). Custom markup styled from
193
+ * `orClasses` needs it on its own container, together with the resolved
194
+ * `data-theme`, because the theme palette no longer flows from `:root`.
195
+ */
196
+ declare const OPENRECEIVE_STYLE_ROOT_ATTRIBUTE: "data-openreceive-root";
197
+ declare const OPENRECEIVE_STYLE_ROOT_SELECTOR: "[data-openreceive-root]";
186
198
  declare const OPENRECEIVE_CHECKOUT_ELEMENT_PARTS: {
187
199
  readonly copy: "copy";
188
200
  readonly startOver: "start-over";
@@ -730,7 +742,7 @@ interface CheckoutShellThemeToggleBinding {
730
742
  }
731
743
  interface CheckoutShellModel {
732
744
  readonly theme: ThemeModel;
733
- readonly rootAttributes: Partial<ThemeModel["attributes"]>;
745
+ readonly rootAttributes: CheckoutShellRootAttributes;
734
746
  readonly checkout: CheckoutShellCheckoutBinding;
735
747
  readonly themeToggle: CheckoutShellThemeToggleBinding | null;
736
748
  }
@@ -746,7 +758,7 @@ interface CreateCheckoutShellOptions extends CheckoutShellOptions {
746
758
  }
747
759
  interface CheckoutShellElements {
748
760
  readonly theme: ThemeModel;
749
- readonly rootAttributes: Partial<ThemeModel["attributes"]>;
761
+ readonly rootAttributes: CheckoutShellRootAttributes;
750
762
  readonly checkout: HTMLElement;
751
763
  readonly themeToggle: HTMLElement | null;
752
764
  }
@@ -979,6 +991,14 @@ interface ThemeModel {
979
991
  readonly theme: ResolvedTheme;
980
992
  };
981
993
  }
994
+ /**
995
+ * What the Vue/Svelte/Angular shell `<section>` carries: the stylesheet scope
996
+ * marker always (see OPENRECEIVE_STYLE_ROOT_ATTRIBUTE in dom-contract.ts), the
997
+ * theme stamp only when the shell owns the theme.
998
+ */
999
+ type CheckoutShellRootAttributes = Partial<ThemeModel["attributes"]> & {
1000
+ readonly "data-openreceive-root": "";
1001
+ };
982
1002
  interface PaymentWizardSelection {
983
1003
  readonly selectedMethod: PaymentMethod | null;
984
1004
  readonly selectedBitcoinRoute: string | null;
@@ -1291,4 +1311,4 @@ declare function deriveStatus(invoice: StatusInvoiceLike, options?: {
1291
1311
  readonly now?: UnixSeconds;
1292
1312
  }): Status;
1293
1313
 
1294
- export { type CheckoutPhase as $, type ThemeToggleElementAttributeOptions as A, type BrowserLoggerOption as B, type CheckoutInvoiceSnapshot as C, type ThemeToggleElementAttributes as D, type StoredThemeModelOptions as E, type ThemeModel as F, type ThemeModelOptions as G, type ReadThemePreferenceOptions as H, type ThemeControlTargets as I, type ThemeStorageOptions as J, type PaymentWizardControllerOptions as K, type PaymentWizardController as L, type PaymentWizardSelection as M, type PaymentWizardModel as N, type WizardRouteDisplay as O, type PaymentIconId as P, type PaymentWizardSelectionAction as Q, type ResolvedTheme as R, type SwapDisplayModel as S, type ThemePreference as T, type UnixSeconds as U, type BrowserLogContext as V, type WizardRouteAssetDisplay as W, type BrowserLogger as X, BrowserRequestError as Y, type CheckoutController as Z, type CheckoutControllerOptions as _, type ParseOpenReceiveOptionalIntegerOptions as a, type RequestCheckoutOptions as a$, type CheckoutStatusRefresh as a0, OPENRECEIVE_CHECKOUT_DATA_ATTRIBUTES as a1, OPENRECEIVE_CHECKOUT_DATA_SELECTORS as a2, OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES as a3, OPENRECEIVE_CHECKOUT_ELEMENT_EVENTS as a4, OPENRECEIVE_CHECKOUT_ELEMENT_PARTS as a5, OPENRECEIVE_CHECKOUT_ELEMENT_PART_SELECTORS as a6, OPENRECEIVE_CHECKOUT_ELEMENT_SLOTS as a7, OPENRECEIVE_CHECKOUT_ELEMENT_TAG_NAME as a8, OPENRECEIVE_COPY_FEEDBACK_MS as a9, createQrSvg as aA, createQrSvgController as aB, createStatusFetcher as aC, createThemeChangeEvent as aD, currentCheckoutUrl as aE, deriveCheckoutStateLabels as aF, deriveStatus as aG, enterCheckoutResumePath as aH, escapeHtml as aI, formatAmountCaption as aJ, formatDepositAmount as aK, formatFiatAmount as aL, formatMsats as aM, formatSwapLimit as aN, formatUnixTime as aO, openWallet as aP, paymentIconSvgs as aQ, prepareCheckout as aR, requestCheckout as aS, type BrowserLogLevel as aT, type BrowserLogEntry as aU, type CopyInvoiceOptions as aV, type GuestCheckoutResumeController as aW, type GuestCheckoutResumeOptions as aX, type OpenWalletOptions as aY, type PrepareCheckoutOptions as aZ, type QrOptions as a_, OPENRECEIVE_DEFAULT_POLL_INTERVAL_MS as aa, OPENRECEIVE_DEFAULT_PREFIX as ab, OPENRECEIVE_PAYMENT_WIZARD_ATTRIBUTES as ac, OPENRECEIVE_PAYMENT_WIZARD_SELECTORS as ad, OPENRECEIVE_PROVIDER_PREVIEW_LIMIT as ae, OPENRECEIVE_THEME_STORAGE_KEY as af, OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES as ag, OPENRECEIVE_THEME_TOGGLE_ELEMENT_EVENTS as ah, OPENRECEIVE_THEME_TOGGLE_ELEMENT_PARTS as ai, OPENRECEIVE_THEME_TOGGLE_ELEMENT_PART_SELECTORS as aj, OPENRECEIVE_THEME_TOGGLE_ELEMENT_TAG_NAME as ak, type QrEncoder as al, type QrSvgController as am, type QrSvgControllerOptions as an, type Status as ao, type SwapCopyRow as ap, type SwapRefundStaging as aq, type WizardProviderDisplay as ar, assertDisplayInvoice as as, copyInvoice as at, createCheckoutActionEvent as au, createCheckoutController as av, createCheckoutErrorEvent as aw, createCheckoutProviderCopyEvent as ax, createCheckoutStateEvent as ay, createQrPayloadSvg as az, type PaymentMethod as b, type StatusInvoiceLike as b0, createGuestCheckoutResume as b1, createGuestOrderFetcher as b2, createLightningUri as b3, createQrPngDataUrl as b4, type PaymentMethodOption as c, type TickingValueOptions as d, type TickingValueController as e, type TransientFeedbackOptions as f, type TransientFeedbackController as g, type CheckoutSnapshot as h, type SwapDepositRisk as i, type CheckoutState as j, type TransactionDetailsInput as k, type TransactionDetailRow as l, type CreateCheckoutStateOptions as m, type CheckoutStatusModelInput as n, type CheckoutStatusModel as o, type CheckoutPaymentMethod as p, type ThemeAttributeTarget as q, type CheckoutElementAttributes as r, type CheckoutElementAttributeOptions as s, type CheckoutElementEventHandlers as t, type CheckoutElementListeners as u, type CreateCheckoutShellOptions as v, type CheckoutShellElements as w, type CheckoutShellOptions as x, type CheckoutShellModel as y, type CreateOpenReceiveThemeToggleElementOptions as z };
1314
+ export { type CheckoutPhase as $, type ThemeToggleElementAttributeOptions as A, type BrowserLoggerOption as B, type CheckoutInvoiceSnapshot as C, type ThemeToggleElementAttributes as D, type StoredThemeModelOptions as E, type ThemeModel as F, type ThemeModelOptions as G, type ReadThemePreferenceOptions as H, type ThemeControlTargets as I, type ThemeStorageOptions as J, type PaymentWizardControllerOptions as K, type PaymentWizardController as L, type PaymentWizardSelection as M, type PaymentWizardModel as N, type WizardRouteDisplay as O, type PaymentIconId as P, type PaymentWizardSelectionAction as Q, type ResolvedTheme as R, type SwapDisplayModel as S, type ThemePreference as T, type UnixSeconds as U, type BrowserLogContext as V, type WizardRouteAssetDisplay as W, type BrowserLogger as X, BrowserRequestError as Y, type CheckoutController as Z, type CheckoutControllerOptions as _, type ParseOpenReceiveOptionalIntegerOptions as a, type OpenWalletOptions as a$, type CheckoutShellRootAttributes as a0, type CheckoutStatusRefresh as a1, OPENRECEIVE_CHECKOUT_DATA_ATTRIBUTES as a2, OPENRECEIVE_CHECKOUT_DATA_SELECTORS as a3, OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES as a4, OPENRECEIVE_CHECKOUT_ELEMENT_EVENTS as a5, OPENRECEIVE_CHECKOUT_ELEMENT_PARTS as a6, OPENRECEIVE_CHECKOUT_ELEMENT_PART_SELECTORS as a7, OPENRECEIVE_CHECKOUT_ELEMENT_SLOTS as a8, OPENRECEIVE_CHECKOUT_ELEMENT_TAG_NAME as a9, createCheckoutProviderCopyEvent as aA, createCheckoutStateEvent as aB, createQrPayloadSvg as aC, createQrSvg as aD, createQrSvgController as aE, createStatusFetcher as aF, createThemeChangeEvent as aG, currentCheckoutUrl as aH, deriveCheckoutStateLabels as aI, deriveStatus as aJ, enterCheckoutResumePath as aK, escapeHtml as aL, formatAmountCaption as aM, formatDepositAmount as aN, formatFiatAmount as aO, formatMsats as aP, formatSwapLimit as aQ, formatUnixTime as aR, openWallet as aS, paymentIconSvgs as aT, prepareCheckout as aU, requestCheckout as aV, type BrowserLogLevel as aW, type BrowserLogEntry as aX, type CopyInvoiceOptions as aY, type GuestCheckoutResumeController as aZ, type GuestCheckoutResumeOptions as a_, OPENRECEIVE_COPY_FEEDBACK_MS as aa, OPENRECEIVE_DEFAULT_POLL_INTERVAL_MS as ab, OPENRECEIVE_DEFAULT_PREFIX as ac, OPENRECEIVE_PAYMENT_WIZARD_ATTRIBUTES as ad, OPENRECEIVE_PAYMENT_WIZARD_SELECTORS as ae, OPENRECEIVE_PROVIDER_PREVIEW_LIMIT as af, OPENRECEIVE_STYLE_ROOT_ATTRIBUTE as ag, OPENRECEIVE_STYLE_ROOT_SELECTOR as ah, OPENRECEIVE_THEME_STORAGE_KEY as ai, OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES as aj, OPENRECEIVE_THEME_TOGGLE_ELEMENT_EVENTS as ak, OPENRECEIVE_THEME_TOGGLE_ELEMENT_PARTS as al, OPENRECEIVE_THEME_TOGGLE_ELEMENT_PART_SELECTORS as am, OPENRECEIVE_THEME_TOGGLE_ELEMENT_TAG_NAME as an, type QrEncoder as ao, type QrSvgController as ap, type QrSvgControllerOptions as aq, type Status as ar, type SwapCopyRow as as, type SwapRefundStaging as at, type WizardProviderDisplay as au, assertDisplayInvoice as av, copyInvoice as aw, createCheckoutActionEvent as ax, createCheckoutController as ay, createCheckoutErrorEvent as az, type PaymentMethod as b, type PrepareCheckoutOptions as b0, type QrOptions as b1, type RequestCheckoutOptions as b2, type StatusInvoiceLike as b3, createGuestCheckoutResume as b4, createGuestOrderFetcher as b5, createLightningUri as b6, createQrPngDataUrl as b7, type PaymentMethodOption as c, type TickingValueOptions as d, type TickingValueController as e, type TransientFeedbackOptions as f, type TransientFeedbackController as g, type CheckoutSnapshot as h, type SwapDepositRisk as i, type CheckoutState as j, type TransactionDetailsInput as k, type TransactionDetailRow as l, type CreateCheckoutStateOptions as m, type CheckoutStatusModelInput as n, type CheckoutStatusModel as o, type CheckoutPaymentMethod as p, type ThemeAttributeTarget as q, type CheckoutElementAttributes as r, type CheckoutElementAttributeOptions as s, type CheckoutElementEventHandlers as t, type CheckoutElementListeners as u, type CreateCheckoutShellOptions as v, type CheckoutShellElements as w, type CheckoutShellOptions as x, type CheckoutShellModel as y, type CreateOpenReceiveThemeToggleElementOptions as z };