UNPKG

@wizecorp/stratusjs

Version:
35 lines 1.33 kB
import React from 'react'; import type { PageComponent } from '../core/types'; export type MiddlewareFunction = (Component: PageComponent) => PageComponent; /** * Compose multiple middleware together */ export declare function composeMiddleware(...middlewares: MiddlewareFunction[]): MiddlewareFunction; /** * Simple authentication middleware */ export interface AuthOptions { isAuthenticated?: () => boolean; redirectTo?: string; fallback?: React.ReactNode; } export declare const withAuth: (options?: AuthOptions) => (Component: PageComponent) => PageComponent; /** * Layout middleware (simplified version) */ export declare const withLayout: (Layout: React.ComponentType<{ children: React.ReactNode; }>) => (Component: PageComponent) => PageComponent; /** * Error handling middleware */ export interface ErrorBoundaryOptions { fallback?: React.ComponentType<{ error: Error; retry: () => void; }>; onError?: (error: Error, errorInfo: any) => void; } export declare const withErrorBoundary: (options?: ErrorBoundaryOptions) => (Component: PageComponent) => PageComponent; export declare const createMiddleware: (fn: (Component: PageComponent, ...args: any[]) => PageComponent) => (...args: any[]) => (Component: PageComponent) => PageComponent; //# sourceMappingURL=index.d.ts.map