import { default as React } from 'react'; import { PredictivePrefetchConfig, RoutePrediction, PrefetchableRoute } from './PredictivePrefetch'; /** * Options for the predictive prefetch hook */ export interface UsePredictivePrefetchOptions { /** Enable automatic prefetching after navigation */ autoPrefetch?: boolean; /** Delay before prefetching predicted routes (ms) */ prefetchDelay?: number; /** Enable navigation tracking for learning */ enableTracking?: boolean; /** Engine configuration */ config?: PredictivePrefetchConfig; } /** * Return value from usePredictivePrefetch */ export interface UsePredictivePrefetchReturn { /** Current route predictions */ predictions: RoutePrediction[]; /** Manually trigger prefetch for predicted routes */ prefetchPredicted: () => Promise; /** Prefetch a specific route */ prefetchRoute: (path: string) => Promise; /** Register additional prefetchable routes */ registerRoutes: (routes: PrefetchableRoute[]) => void; /** Get analytics about learned patterns */ getAnalytics: () => { totalTransitions: number; uniqueRoutes: number; timePatterns: number; topRoutes: Array<{ route: string; visits: number; }>; }; /** Navigate with optimistic prefetching */ navigateWithPrefetch: (to: string) => void; /** Clear all learned patterns */ clearPatterns: () => void; } /** * Hook for predictive prefetching with react-router integration. * * Automatically tracks navigation patterns and prefetches likely next routes. * * @example * ```tsx * function App() { * const { predictions, navigateWithPrefetch } = usePredictivePrefetch(); * * return ( * * ); * } * ``` */ export declare function usePredictivePrefetch(options?: UsePredictivePrefetchOptions): UsePredictivePrefetchReturn; /** * Props for PredictiveLink component */ export interface PredictiveLinkProps extends React.AnchorHTMLAttributes { /** Target route */ to: string; /** Prefetch strategy */ prefetchStrategy?: 'hover' | 'viewport' | 'immediate' | 'none'; /** Custom loader for code splitting */ loader?: () => Promise; /** Children */ children: React.ReactNode; } /** * Link component with predictive prefetching. * Prefetches the route on hover, focus, or when entering viewport. * * @example * ```tsx * * Go to Dashboard * * ``` */ export declare function PredictiveLink({ to, prefetchStrategy, loader, children, ...props }: PredictiveLinkProps): React.JSX.Element;