import * as react_jsx_runtime0 from "react/jsx-runtime"; import { Condition, ConnectOptions, ConnectOptions as ConnectOptions$1, GetConfigOptions, GetConfigOptions as GetConfigOptions$1, GetReplaneSnapshotOptions, InMemoryReplane, InMemoryReplaneOptions, Override, Replane, Replane as Replane$1, ReplaneContext, ReplaneError, ReplaneErrorCode, ReplaneLogger, ReplaneOptions, ReplaneOptions as ReplaneOptions$1, ReplaneSnapshot, SetConfigOptions, getReplaneSnapshot } from "@replanejs/sdk"; import { ReactNode } from "react"; //#region src/types.d.ts type UntypedReplaneConfig = Record; /** * Props for ReplaneProvider when using a pre-created client. */ interface ReplaneProviderWithClientProps { /** Pre-created Replane client instance */ client: Replane$1; children: ReactNode; } /** * Props for ReplaneProvider when letting it manage the client internally. */ interface ReplaneProviderWithOptionsProps extends ReplaneOptions$1 { children: ReactNode; /** * Connection options for connecting to the Replane server. * Pass null to explicitly skip connection (client will use defaults/snapshot only). */ connection: ConnectOptions$1 | null; /** * Optional loading component to show while the client is initializing. * If not provided and suspense is false/undefined, children will not render until ready. * Ignored when snapshot is provided (restoration is synchronous). */ loader?: ReactNode; /** * If true, uses React Suspense for loading state. * The provider will throw a promise that Suspense can catch. * Ignored when snapshot is provided (restoration is synchronous). * @default false */ suspense?: boolean; /** * If true, the client will be connected asynchronously. Make sure to provide defaults or snapshot. * @default false */ async?: boolean; } type ReplaneProviderProps = ReplaneProviderWithClientProps | ReplaneProviderWithOptionsProps; /** * Type guard to check if props contain a pre-created client. */ //#endregion //#region src/provider.d.ts /** * Provider component that makes a Replane client available to the component tree. * * Can be used in several ways: * * 1. With a pre-created client: * ```tsx * const client = new Replane({ defaults: { ... } }); * await client.connect({ baseUrl: '...', sdkKey: '...' }); * * * * ``` * * 2. With options (client managed internally): * ```tsx * }> * } * > * * * * ``` * * 3. With Suspense: * ```tsx * }> * }> * * * * * * ``` * * 4. With a snapshot (for SSR/hydration): * ```tsx * // On the server, get a snapshot from the client * const snapshot = serverClient.getSnapshot(); * * // On the client, restore from the snapshot with live updates * * * * ``` * * Errors during client initialization are thrown during rendering, * allowing them to be caught by React Error Boundaries. */ declare function ReplaneProvider(props: ReplaneProviderProps): react_jsx_runtime0.JSX.Element; //# sourceMappingURL=provider.d.ts.map //#endregion //#region src/hooks.d.ts declare function useReplane(): Replane$1; declare function useConfig(name: string, options?: GetConfigOptions$1): T; /** * Creates a typed version of useReplane hook. * * @example * ```tsx * interface AppConfigs { * theme: { darkMode: boolean }; * features: { beta: boolean }; * } * * const useAppReplane = createReplaneHook(); * * function MyComponent() { * const replane = useAppReplane(); * // replane.get("theme") returns { darkMode: boolean } * } * ``` */ declare function createReplaneHook(): () => Replane$1; /** * Creates a typed version of useConfig hook. * * @example * ```tsx * interface AppConfigs { * theme: { darkMode: boolean }; * features: { beta: boolean }; * } * * const useAppConfig = createConfigHook(); * * function MyComponent() { * const theme = useAppConfig("theme"); * // theme is typed as { darkMode: boolean } * } * ``` */ declare function createConfigHook(): (name: K, options?: GetConfigOptions$1) => TConfigs[K]; //# sourceMappingURL=hooks.d.ts.map //#endregion //#region src/useReplaneClient.d.ts /** * Clear the suspense cache for a specific connection configuration. * Useful for testing or when you need to force re-initialization. */ declare function clearSuspenseCache(connection?: ConnectOptions$1): void; //#endregion export { type Condition, type ConnectOptions, type GetConfigOptions, type GetReplaneSnapshotOptions, InMemoryReplane, type InMemoryReplaneOptions, type Override, Replane, type ReplaneContext, ReplaneError, ReplaneErrorCode, type ReplaneLogger, type ReplaneOptions, ReplaneProvider, type ReplaneProviderProps, type ReplaneProviderWithClientProps, type ReplaneProviderWithOptionsProps, type ReplaneSnapshot, type SetConfigOptions, clearSuspenseCache, createConfigHook, createReplaneHook, getReplaneSnapshot, useConfig, useReplane }; //# sourceMappingURL=index.d.cts.map