import { HydrationStatus, HydrationBoundaryId } from '../types'; /** * Extended status information with computed properties. */ export interface UseHydrationStatusReturn extends HydrationStatus { /** * Whether the boundary is fully hydrated and interactive. */ readonly isHydrated: boolean; /** * Whether the boundary is currently hydrating. */ readonly isHydrating: boolean; /** * Whether the boundary is pending hydration. */ readonly isPending: boolean; /** * Whether the boundary encountered an error. */ readonly hasError: boolean; /** * Whether the boundary was skipped (SSR-only). */ readonly isSkipped: boolean; /** * Progress percentage (0-100) based on state. */ readonly progress: number; /** * Human-readable status description. */ readonly description: string; } /** * Options for the useHydrationStatus hook. */ export interface UseHydrationStatusOptions { /** * Polling interval in milliseconds for status updates. * Set to 0 to disable polling (only event-driven updates). * * @default 100 */ readonly pollInterval?: number; /** * Whether to subscribe to scheduler events for real-time updates. * * @default true */ readonly subscribeToEvents?: boolean; } /** * Hook for tracking the hydration status of a specific boundary. * * Provides real-time status updates with computed convenience properties. * * @param boundaryId - ID of the boundary to track (string will be converted) * @param options - Hook options * @returns Extended hydration status with computed properties * * @example * ```tsx * function StatusIndicator({ boundaryId }: { boundaryId: string }) { * const { * isHydrated, * isHydrating, * isPending, * hasError, * progress, * description, * duration, * } = useHydrationStatus(boundaryId); * * if (hasError) { * return {description}; * } * * return ( *
* * {description} * {isHydrated && duration && ( * Hydrated in {duration.toFixed(0)}ms * )} *
* ); * } * ``` */ export declare function useHydrationStatus(boundaryId: string | HydrationBoundaryId, options?: UseHydrationStatusOptions): UseHydrationStatusReturn; /** * Hook for checking if a boundary is hydrated. * * Simplified hook when only hydration completion matters. * * @param boundaryId - ID of the boundary to check * @returns true if the boundary is fully hydrated * * @example * ```tsx * function InteractiveButton({ boundaryId }: { boundaryId: string }) { * const isHydrated = useIsHydrated(boundaryId); * * return ( * * ); * } * ``` */ export declare function useIsHydrated(boundaryId: string | HydrationBoundaryId): boolean; /** * Hook for waiting until a boundary is hydrated. * * Returns a promise that resolves when the boundary is hydrated. * Useful for imperative code that needs to wait for hydration. * * @param boundaryId - ID of the boundary to wait for * @param timeout - Maximum time to wait in milliseconds (default: 10000) * @returns Promise that resolves when hydrated * * @example * ```tsx * function ComponentWithEffect({ boundaryId }: { boundaryId: string }) { * const waitForHydration = useWaitForHydration(boundaryId); * * useEffect(() => { * async function init() { * await waitForHydration(); * // Safe to interact with hydrated component now * performPostHydrationSetup(); * } * init(); * }, [waitForHydration]); * * return
...
; * } * ``` */ export declare function useWaitForHydration(boundaryId: string | HydrationBoundaryId, timeout?: number): () => Promise;