UNPKG

stratakit

Version:

stratakit - Meta-framework React puro con Auto Router automático, file-based routing, SEO automático y performance superior

54 lines (53 loc) 1.87 kB
import React from 'react'; import { Route } from './types'; export interface RouterContextType { currentRoute: Route | null; isNavigating: boolean; navigationHistory: string[]; navigate: (path: string, options?: AdvancedNavigationOptions) => Promise<boolean>; canNavigate: (path: string) => Promise<boolean>; addRoute: (route: Route) => void; removeRoute: (path: string) => void; updateRoute: (path: string, updates: Partial<Route>) => void; } export interface AdvancedNavigationOptions { replace?: boolean; state?: any; scrollToTop?: boolean; animate?: boolean; } export declare const useRouter: () => RouterContextType; interface AdvancedRouterProviderProps { children: React.ReactNode; routes: Route[]; fallback?: React.ComponentType; loadingComponent?: React.ComponentType; errorComponent?: React.ComponentType<{ error: Error; }>; } export declare const AdvancedRouterProvider: React.FC<AdvancedRouterProviderProps>; export declare const useNavigation: () => { navigate: (path: string, options?: AdvancedNavigationOptions) => Promise<boolean>; canNavigate: (path: string) => Promise<boolean>; isNavigating: boolean; }; export declare const useRoutes: () => { addRoute: (route: Route) => void; removeRoute: (path: string) => void; updateRoute: (path: string, updates: Partial<Route>) => void; currentRoute: Route | null; }; export declare const useGuards: () => { checkGuard: (guardName: string) => Promise<boolean>; currentRoute: Route | null; }; export declare const useMiddlewares: () => { executeMiddleware: (middlewareName: string, data?: any) => Promise<any>; currentRoute: Route | null; }; export declare const RouteRenderer: React.FC<{ routes: Route[]; fallback?: React.ComponentType; }>; export default AdvancedRouterProvider;