@funkit/connect-rn 0.2.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/README.md +21 -0
  2. package/dist/index.d.ts +21 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +2694 -0
  5. package/dist/index.js.map +7 -0
  6. package/dist/src/flow/FunkitFlowProvider.d.ts +20 -0
  7. package/dist/src/flow/FunkitFlowProvider.d.ts.map +1 -0
  8. package/dist/src/flow/depositFlowConfig.d.ts +70 -0
  9. package/dist/src/flow/depositFlowConfig.d.ts.map +1 -0
  10. package/dist/src/geo/useUserIpInfo.d.ts +22 -0
  11. package/dist/src/geo/useUserIpInfo.d.ts.map +1 -0
  12. package/dist/src/icons/ChainClusterIcon.d.ts +12 -0
  13. package/dist/src/icons/ChainClusterIcon.d.ts.map +1 -0
  14. package/dist/src/icons/FunIcon.d.ts +18 -0
  15. package/dist/src/icons/FunIcon.d.ts.map +1 -0
  16. package/dist/src/icons/assetLogos.d.ts +12 -0
  17. package/dist/src/icons/assetLogos.d.ts.map +1 -0
  18. package/dist/src/icons/funIconUri.d.ts +16 -0
  19. package/dist/src/icons/funIconUri.d.ts.map +1 -0
  20. package/dist/src/identity/IdentityContext.d.ts +52 -0
  21. package/dist/src/identity/IdentityContext.d.ts.map +1 -0
  22. package/dist/src/logging/consoleLogTransport.d.ts +10 -0
  23. package/dist/src/logging/consoleLogTransport.d.ts.map +1 -0
  24. package/dist/src/logging/datadogHttpLogTransport.d.ts +46 -0
  25. package/dist/src/logging/datadogHttpLogTransport.d.ts.map +1 -0
  26. package/dist/src/logging/logger.d.ts +9 -0
  27. package/dist/src/logging/logger.d.ts.map +1 -0
  28. package/dist/src/providers/FunkitProvider.d.ts +55 -0
  29. package/dist/src/providers/FunkitProvider.d.ts.map +1 -0
  30. package/dist/src/providers/FunkitStatsigProvider.d.ts +13 -0
  31. package/dist/src/providers/FunkitStatsigProvider.d.ts.map +1 -0
  32. package/dist/src/providers/index.d.ts +2 -0
  33. package/dist/src/providers/index.d.ts.map +1 -0
  34. package/dist/src/providers/useFunkitCheckout.d.ts +14 -0
  35. package/dist/src/providers/useFunkitCheckout.d.ts.map +1 -0
  36. package/dist/src/screens/AddMoneyScreen.d.ts +31 -0
  37. package/dist/src/screens/AddMoneyScreen.d.ts.map +1 -0
  38. package/dist/src/screens/ChooseChainScreen.d.ts +35 -0
  39. package/dist/src/screens/ChooseChainScreen.d.ts.map +1 -0
  40. package/dist/src/screens/CryptoCashToggle.d.ts +17 -0
  41. package/dist/src/screens/CryptoCashToggle.d.ts.map +1 -0
  42. package/dist/src/screens/QrCodeScreen.d.ts +26 -0
  43. package/dist/src/screens/QrCodeScreen.d.ts.map +1 -0
  44. package/dist/src/screens/SupportedTokensScreen.d.ts +44 -0
  45. package/dist/src/screens/SupportedTokensScreen.d.ts.map +1 -0
  46. package/dist/src/screens/TransferCryptoScreen.d.ts +29 -0
  47. package/dist/src/screens/TransferCryptoScreen.d.ts.map +1 -0
  48. package/dist/src/statsig/StatsigClientRN.d.ts +6 -0
  49. package/dist/src/statsig/StatsigClientRN.d.ts.map +1 -0
  50. package/dist/src/statsig/StatsigProviderRN.d.ts +7 -0
  51. package/dist/src/statsig/StatsigProviderRN.d.ts.map +1 -0
  52. package/dist/src/statsig/appVisibilityShim.d.ts +2 -0
  53. package/dist/src/statsig/appVisibilityShim.d.ts.map +1 -0
  54. package/dist/src/statsig/preloadedAsyncStorage.d.ts +3 -0
  55. package/dist/src/statsig/preloadedAsyncStorage.d.ts.map +1 -0
  56. package/dist/src/statsig/rnSetup.d.ts +3 -0
  57. package/dist/src/statsig/rnSetup.d.ts.map +1 -0
  58. package/dist/src/statsig/statsigMetadata.d.ts +2 -0
  59. package/dist/src/statsig/statsigMetadata.d.ts.map +1 -0
  60. package/dist/src/statsig/useClientAsyncInitRN.d.ts +7 -0
  61. package/dist/src/statsig/useClientAsyncInitRN.d.ts.map +1 -0
  62. package/dist/src/statsig/useClientBootstrapInitRN.d.ts +4 -0
  63. package/dist/src/statsig/useClientBootstrapInitRN.d.ts.map +1 -0
  64. package/dist/src/swapped/SwappedScreen.d.ts +21 -0
  65. package/dist/src/swapped/SwappedScreen.d.ts.map +1 -0
  66. package/dist/src/swapped/SwappedWebView.d.ts +18 -0
  67. package/dist/src/swapped/SwappedWebView.d.ts.map +1 -0
  68. package/dist/src/swapped/webViewSwappedTransport.d.ts +47 -0
  69. package/dist/src/swapped/webViewSwappedTransport.d.ts.map +1 -0
  70. package/dist/src/theme/FunkitProvider.d.ts +45 -0
  71. package/dist/src/theme/FunkitProvider.d.ts.map +1 -0
  72. package/dist/src/theme/FunkitThemeProvider.d.ts +50 -0
  73. package/dist/src/theme/FunkitThemeProvider.d.ts.map +1 -0
  74. package/dist/src/theme/index.d.ts +7 -0
  75. package/dist/src/theme/index.d.ts.map +1 -0
  76. package/dist/src/theme/restyle.d.ts +5125 -0
  77. package/dist/src/theme/restyle.d.ts.map +1 -0
  78. package/dist/src/theme/toRestyleTheme.d.ts +448 -0
  79. package/dist/src/theme/toRestyleTheme.d.ts.map +1 -0
  80. package/dist/src/theme/tokens.d.ts +115 -0
  81. package/dist/src/theme/tokens.d.ts.map +1 -0
  82. package/dist/src/theme/useColorScheme.d.ts +25 -0
  83. package/dist/src/theme/useColorScheme.d.ts.map +1 -0
  84. package/dist/src/theme/useFunkitTheme.d.ts +29 -0
  85. package/dist/src/theme/useFunkitTheme.d.ts.map +1 -0
  86. package/dist/src/transfer/QrCode.d.ts +15 -0
  87. package/dist/src/transfer/QrCode.d.ts.map +1 -0
  88. package/dist/src/transfer/clipboard.d.ts +15 -0
  89. package/dist/src/transfer/clipboard.d.ts.map +1 -0
  90. package/dist/src/transfer/fops.d.ts +26 -0
  91. package/dist/src/transfer/fops.d.ts.map +1 -0
  92. package/dist/src/transfer/formatDepositAddress.d.ts +9 -0
  93. package/dist/src/transfer/formatDepositAddress.d.ts.map +1 -0
  94. package/dist/src/transfer/hooks/useFops.d.ts +38 -0
  95. package/dist/src/transfer/hooks/useFops.d.ts.map +1 -0
  96. package/dist/src/transfer/hooks/useSupportedTokens.d.ts +26 -0
  97. package/dist/src/transfer/hooks/useSupportedTokens.d.ts.map +1 -0
  98. package/dist/src/transfer/hooks/useTokenTransfer.d.ts +33 -0
  99. package/dist/src/transfer/hooks/useTokenTransfer.d.ts.map +1 -0
  100. package/dist/src/transfer/hooks/useTransferInit.d.ts +27 -0
  101. package/dist/src/transfer/hooks/useTransferInit.d.ts.map +1 -0
  102. package/dist/src/transfer/hooks/useUDAParams.d.ts +9 -0
  103. package/dist/src/transfer/hooks/useUDAParams.d.ts.map +1 -0
  104. package/dist/src/transfer/supportedTokens.d.ts +23 -0
  105. package/dist/src/transfer/supportedTokens.d.ts.map +1 -0
  106. package/dist/src/version.d.ts +2 -0
  107. package/dist/src/version.d.ts.map +1 -0
  108. package/package.json +80 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rnSetup.d.ts","sourceRoot":"","sources":["../../../src/statsig/rnSetup.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAIvB,MAAM,yBAAyB,CAAA;AAWhC,wBAAgB,0BAA0B,CACxC,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,IAAI,EACnE,OAAO,EAAE,iBAAiB,GACzB,IAAI,CAaN"}
@@ -0,0 +1,2 @@
1
+ export declare function getStatsigMetadataAdditions(): Record<string, string | undefined>;
2
+ //# sourceMappingURL=statsigMetadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statsigMetadata.d.ts","sourceRoot":"","sources":["../../../src/statsig/statsigMetadata.ts"],"names":[],"mappings":"AAgCA,wBAAgB,2BAA2B,IAAI,MAAM,CACnD,MAAM,EACN,MAAM,GAAG,SAAS,CACnB,CAWA"}
@@ -0,0 +1,7 @@
1
+ import { type StatsigOptions, type StatsigUser } from '@statsig/react-bindings';
2
+ import { StatsigClientRN } from './StatsigClientRN';
3
+ export declare function useClientAsyncInitRN(sdkKey: string, initialUser: StatsigUser, statsigOptions?: StatsigOptions | null): {
4
+ isLoading: boolean;
5
+ client: StatsigClientRN;
6
+ };
7
+ //# sourceMappingURL=useClientAsyncInitRN.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useClientAsyncInitRN.d.ts","sourceRoot":"","sources":["../../../src/statsig/useClientAsyncInitRN.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,WAAW,EAEjB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAInD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,cAAc,GAAE,cAAc,GAAG,IAAW,GAC3C;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,CAUjD"}
@@ -0,0 +1,4 @@
1
+ import { type StatsigOptions, type StatsigUser } from '@statsig/react-bindings';
2
+ import { StatsigClientRN } from './StatsigClientRN';
3
+ export declare function useClientBootstrapInitRN(sdkKey: string, initialUser: StatsigUser, initialValues: string, statsigOptions?: StatsigOptions | null): StatsigClientRN;
4
+ //# sourceMappingURL=useClientBootstrapInitRN.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useClientBootstrapInitRN.d.ts","sourceRoot":"","sources":["../../../src/statsig/useClientBootstrapInitRN.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,WAAW,EAEjB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAKnD,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,MAAM,EACrB,cAAc,GAAE,cAAc,GAAG,IAAW,GAC3C,eAAe,CAWjB"}
@@ -0,0 +1,21 @@
1
+ export interface SwappedScreenProps {
2
+ /** The selected FOP's `embeddedFlowUrl` to load in the embed. */
3
+ url: string;
4
+ /** Close the whole flow (embed asked to exit, e.g. its own ✕). */
5
+ onClose: () => void;
6
+ /** Go back to the Add money list (embed's own back, or a new deposit). */
7
+ onBack: () => void;
8
+ /** Fired when the embed reports a successful transaction. */
9
+ onSuccess?: () => void;
10
+ }
11
+ /**
12
+ * Full-screen host for the Swapped embedded payment flow ({@link SwappedWebView})
13
+ * — reached when the user picks a cash method (Card / Apple Pay / …) on Add
14
+ * money. The embed ships its **own** top bar (back / title / close), so we
15
+ * render no React Native header here (avoids a double nav bar) and instead drive
16
+ * flow navigation from the embed's messages, mirroring web's
17
+ * `SwappedIframeController`: back / new-deposit → {@link onBack}, close →
18
+ * {@link onClose}, transaction-successful → {@link onSuccess}. Others log only.
19
+ */
20
+ export declare function SwappedScreen({ url, onClose, onBack, onSuccess, }: SwappedScreenProps): import("react/jsx-runtime").JSX.Element;
21
+ //# sourceMappingURL=SwappedScreen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SwappedScreen.d.ts","sourceRoot":"","sources":["../../../src/swapped/SwappedScreen.tsx"],"names":[],"mappings":"AAQA,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,GAAG,EAAE,MAAM,CAAA;IACX,kEAAkE;IAClE,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,0EAA0E;IAC1E,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,EAC5B,GAAG,EACH,OAAO,EACP,MAAM,EACN,SAAS,GACV,EAAE,kBAAkB,2CAuCpB"}
@@ -0,0 +1,18 @@
1
+ import type { SwappedInboundMessage } from '@funkit/connect-core';
2
+ import type { ViewStyle } from 'react-native';
3
+ export interface SwappedWebViewProps {
4
+ /** The selected FOP's `embeddedFlowUrl` (a swapped.com/.dev widget URL). */
5
+ url: string;
6
+ /** Typed, origin-validated inbound messages from the embed. */
7
+ onMessage: (msg: SwappedInboundMessage) => void;
8
+ style?: ViewStyle;
9
+ }
10
+ /**
11
+ * Renders the Swapped embedded payment flow in a `WebView` and bridges its
12
+ * messages to the typed {@link SwappedTransport} contract — the React Native
13
+ * counterpart of web's iframe. The {@link SWAPPED_WEBVIEW_INJECTED_JS} bridge
14
+ * redirects the embed's `postMessage` to the native channel; `onMessage` is
15
+ * parsed + origin-validated before reaching the handler.
16
+ */
17
+ export declare function SwappedWebView({ url, onMessage, style }: SwappedWebViewProps): import("react/jsx-runtime").JSX.Element;
18
+ //# sourceMappingURL=SwappedWebView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SwappedWebView.d.ts","sourceRoot":"","sources":["../../../src/swapped/SwappedWebView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAS7C,MAAM,WAAW,mBAAmB;IAClC,4EAA4E;IAC5E,GAAG,EAAE,MAAM,CAAA;IACX,+DAA+D;IAC/D,SAAS,EAAE,CAAC,GAAG,EAAE,qBAAqB,KAAK,IAAI,CAAA;IAC/C,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,mBAAmB,2CAkE5E"}
@@ -0,0 +1,47 @@
1
+ import { type SwappedInboundMessage, type SwappedTransport } from '@funkit/connect-core';
2
+ /**
3
+ * Injected into the Swapped WebView before its content loads. The embed talks
4
+ * to its host by calling `window.parent.postMessage(obj, targetOrigin)` (the
5
+ * web iframe contract); inside a `WebView` there is no real parent, so we
6
+ * redirect those calls to React Native's `window.ReactNativeWebView.postMessage`
7
+ * bridge (which only accepts strings), JSON-stringifying the payload. The RN
8
+ * side parses + origin-validates via {@link handleWebViewMessage}.
9
+ *
10
+ * This is the proven bridge from the connect-rn prototype; it makes the embed →
11
+ * native direction work identically on iOS and Android.
12
+ */
13
+ export declare const SWAPPED_WEBVIEW_INJECTED_JS = "(function () {\n function forwardToNative(message) {\n try {\n var data = typeof message === 'string' ? message : JSON.stringify(message);\n window.ReactNativeWebView && window.ReactNativeWebView.postMessage(data);\n } catch (e) {}\n }\n // The embed posts to window.parent (and sometimes window) \u2014 redirect both.\n try { if (window.parent) { window.parent.postMessage = forwardToNative; } } catch (e) {}\n try { window.postMessage = forwardToNative; } catch (e) {}\n true;\n})();\ntrue;";
14
+ /**
15
+ * Parse + validate a raw WebView `onMessage` payload into a typed inbound
16
+ * Swapped message. Returns `null` (drop the message) when:
17
+ * - the payload isn't valid JSON with a string `type`, or
18
+ * - a `url` is supplied whose origin isn't a Swapped origin (mirrors web's
19
+ * `isSwappedOrigin(event.origin)` guard in the iframe transport).
20
+ *
21
+ * `url` is the WebView's current page URL (`nativeEvent.url`); when omitted the
22
+ * origin check is skipped (the caller already trusts the source).
23
+ */
24
+ export declare function handleWebViewMessage(rawData: unknown, url?: string): SwappedInboundMessage | null;
25
+ /** Minimal surface of `react-native-webview`'s ref the transport needs. */
26
+ export interface WebViewLike {
27
+ postMessage(data: string): void;
28
+ }
29
+ export interface WebViewSwappedTransport {
30
+ /** Implements the shared {@link SwappedTransport} contract. */
31
+ transport: SwappedTransport;
32
+ /**
33
+ * Feed a raw WebView `onMessage` payload (+ optional page url) through origin
34
+ * validation and fan it out to `transport.onMessage` subscribers.
35
+ */
36
+ dispatch(rawData: unknown, url?: string): void;
37
+ }
38
+ /**
39
+ * React Native {@link SwappedTransport}: bridges the typed Swapped message
40
+ * contract over a `WebView` instead of web's `<iframe>` + `window.postMessage`.
41
+ * `send` posts to the embed via the WebView ref ({@link WebViewLike}); inbound
42
+ * messages arrive through {@link dispatch} (wired to the WebView's `onMessage`).
43
+ */
44
+ export declare function createWebViewSwappedTransport({ getWebView, }: {
45
+ getWebView: () => WebViewLike | null;
46
+ }): WebViewSwappedTransport;
47
+ //# sourceMappingURL=webViewSwappedTransport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webViewSwappedTransport.d.ts","sourceRoot":"","sources":["../../../src/swapped/webViewSwappedTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAE1B,KAAK,gBAAgB,EAEtB,MAAM,sBAAsB,CAAA;AAE7B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,2BAA2B,ugBAYlC,CAAA;AAEN;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,GAAG,CAAC,EAAE,MAAM,GACX,qBAAqB,GAAG,IAAI,CAmB9B;AAED,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC;AAED,MAAM,WAAW,uBAAuB;IACtC,+DAA+D;IAC/D,SAAS,EAAE,gBAAgB,CAAA;IAC3B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/C;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,EAC5C,UAAU,GACX,EAAE;IACD,UAAU,EAAE,MAAM,WAAW,GAAG,IAAI,CAAA;CACrC,GAAG,uBAAuB,CA8B1B"}
@@ -0,0 +1,45 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type ColorScheme } from './useColorScheme';
3
+ import type { FunkitThemeSet } from './useFunkitTheme';
4
+ interface FunkitColorSchemeValue {
5
+ /** The active, resolved color scheme. */
6
+ colorScheme: ColorScheme;
7
+ /**
8
+ * Flip light↔dark, or set a specific scheme when an argument is given.
9
+ * **No-op when the provider's `colorScheme` prop is set** (controlled mode) —
10
+ * the host owns the scheme in that case.
11
+ */
12
+ toggleColorScheme: (next?: ColorScheme) => void;
13
+ /** True when the scheme is forced by the `colorScheme` prop (uncontrolled toggle disabled). */
14
+ isControlled: boolean;
15
+ }
16
+ export interface FunkitProviderProps {
17
+ children: ReactNode;
18
+ /**
19
+ * The light/dark Restyle theme set. Defaults to the built-in Fun Mobile
20
+ * themes. Pass `{ light, dark }` from `toRestyleTheme(...)` to customize.
21
+ */
22
+ themes?: FunkitThemeSet;
23
+ /**
24
+ * Force a color scheme. When provided the provider is **controlled**: it
25
+ * always renders this scheme, ignores the system Appearance, and
26
+ * `toggleColorScheme()` becomes a no-op. When omitted the provider is
27
+ * **uncontrolled**: the scheme follows the system Appearance and can be
28
+ * flipped with `toggleColorScheme()`.
29
+ */
30
+ colorScheme?: ColorScheme;
31
+ }
32
+ /**
33
+ * Top-level provider for `@funkit/connect-rn`. Wires the active Restyle theme
34
+ * (selected from `themes` by color scheme) into Restyle's `ThemeProvider`, and
35
+ * exposes the scheme + a manual toggle via {@link useFunkitColorScheme}.
36
+ */
37
+ export declare function FunkitProvider({ children, themes, colorScheme, }: FunkitProviderProps): import("react/jsx-runtime").JSX.Element;
38
+ /**
39
+ * Read the active color scheme and toggle it. Must be used within a
40
+ * {@link FunkitProvider}. `toggleColorScheme` is a no-op when the provider is
41
+ * in controlled mode (a `colorScheme` prop was passed).
42
+ */
43
+ export declare function useFunkitColorScheme(): FunkitColorSchemeValue;
44
+ export {};
45
+ //# sourceMappingURL=FunkitProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FunkitProvider.d.ts","sourceRoot":"","sources":["../../../src/theme/FunkitProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AAGd,OAAO,EACL,KAAK,WAAW,EAGjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAItD,UAAU,sBAAsB;IAC9B,yCAAyC;IACzC,WAAW,EAAE,WAAW,CAAA;IACxB;;;;OAIG;IACH,iBAAiB,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,IAAI,CAAA;IAC/C,+FAA+F;IAC/F,YAAY,EAAE,OAAO,CAAA;CACtB;AAMD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,SAAS,CAAA;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,MAAuB,EACvB,WAAW,GACZ,EAAE,mBAAmB,2CAqCrB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,sBAAsB,CAM7D"}
@@ -0,0 +1,50 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type ColorScheme } from './useColorScheme';
3
+ import { type FunkitThemeSet } from './useFunkitTheme';
4
+ interface FunkitColorSchemeValue {
5
+ /** The active, resolved color scheme. */
6
+ colorScheme: ColorScheme;
7
+ /**
8
+ * Flip light↔dark, or set a specific scheme when an argument is given.
9
+ * **No-op when the provider's `colorScheme` prop is set** (controlled mode) —
10
+ * the host owns the scheme in that case.
11
+ */
12
+ toggleColorScheme: (next?: ColorScheme) => void;
13
+ /** True when the scheme is forced by the `colorScheme` prop (uncontrolled toggle disabled). */
14
+ isControlled: boolean;
15
+ }
16
+ export interface FunkitThemeProviderProps {
17
+ children: ReactNode;
18
+ /**
19
+ * The light/dark Restyle theme set. Defaults to the built-in Fun Mobile
20
+ * themes. Pass `{ light, dark }` from `toRestyleTheme(...)` to customize.
21
+ */
22
+ themes?: FunkitThemeSet;
23
+ /**
24
+ * Force a color scheme. When provided the provider is **controlled**: it
25
+ * always renders this scheme, ignores the system Appearance, and
26
+ * `toggleColorScheme()` becomes a no-op. When omitted the provider is
27
+ * **uncontrolled**: the scheme follows the system Appearance and can be
28
+ * flipped with `toggleColorScheme()`.
29
+ */
30
+ colorScheme?: ColorScheme;
31
+ }
32
+ /**
33
+ * The styling layer for `@funkit/connect-rn`. Resolves the active Restyle theme
34
+ * (selected from `themes` by color scheme), wires it into Restyle's
35
+ * `ThemeProvider`, and exposes the scheme + a manual toggle via
36
+ * {@link useFunkitColorScheme}.
37
+ *
38
+ * This is an internal-ish provider — host apps mount the user-facing
39
+ * {@link FunkitProvider}, which passes `themes` / `colorScheme` down to this.
40
+ */
41
+ export declare function FunkitThemeProvider({ children, themes, colorScheme, }: FunkitThemeProviderProps): import("react/jsx-runtime").JSX.Element;
42
+ /**
43
+ * Read the active color scheme and toggle it. Must be used within a
44
+ * {@link FunkitProvider} (which mounts {@link FunkitThemeProvider}).
45
+ * `toggleColorScheme` is a no-op when the provider is in controlled mode (a
46
+ * `colorScheme` prop was passed).
47
+ */
48
+ export declare function useFunkitColorScheme(): FunkitColorSchemeValue;
49
+ export {};
50
+ //# sourceMappingURL=FunkitThemeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FunkitThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/theme/FunkitThemeProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AAGd,OAAO,EACL,KAAK,WAAW,EAGjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,kBAAkB,CAAA;AAOnE,UAAU,sBAAsB;IAC9B,yCAAyC;IACzC,WAAW,EAAE,WAAW,CAAA;IACxB;;;;OAIG;IACH,iBAAiB,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,IAAI,CAAA;IAC/C,+FAA+F;IAC/F,YAAY,EAAE,OAAO,CAAA;CACtB;AAMD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,SAAS,CAAA;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,MAAuB,EACvB,WAAW,GACZ,EAAE,wBAAwB,2CAqC1B;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,sBAAsB,CAM7D"}
@@ -0,0 +1,7 @@
1
+ export * from './tokens';
2
+ export * from './toRestyleTheme';
3
+ export * from './useColorScheme';
4
+ export * from './useFunkitTheme';
5
+ export * from './restyle';
6
+ export * from './FunkitThemeProvider';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,WAAW,CAAA;AACzB,cAAc,uBAAuB,CAAA"}