@hadyfayed/filament-react-wrapper
Version:
Enterprise React integration for Laravel/Filament - Smart asset loading, 90%+ React-PHP function mapping, no-plugin Filament integration
63 lines (54 loc) • 1.92 kB
text/typescript
/**
* Public type definitions for React Wrapper
*/
import React from 'react';
// Re-export key interfaces
export type { IComponentDefinition, IComponentRegistry } from '../interfaces/IComponentRegistry';
export type {
IStateManagerState,
IStateManager,
IStatePersistence,
} from '../interfaces/IStateManager';
// Import interfaces
import type { IComponentRegistry } from '../interfaces/IComponentRegistry';
import type { IStateManager, IStatePersistence } from '../interfaces/IStateManager';
// Main API interface with proper typing
export interface ReactWrapperAPI {
readonly componentRegistry: IComponentRegistry;
readonly universalReactRenderer: IUniversalRenderer;
readonly globalStateManager: IStateManager;
readonly statePersistenceService: IStatePersistence;
readonly devTools: IDevTools;
readonly codeSplittingService: ICodeSplittingService;
readonly componentVersioningService: IVersioningService;
readonly bootstrap: () => boolean;
}
// Service interfaces
export interface IUniversalRenderer {
render(options: {
component: string;
props?: Record<string, unknown>;
statePath?: string;
containerId: string;
onDataChange?: (data: unknown) => void;
onError?: (error: Error) => void;
}): void;
unmount(containerId: string): void;
isRendered(containerId: string): boolean;
}
export interface IDevTools {
enable(): void;
disable(): void;
isEnabled(): boolean;
log(message: string, data?: unknown): void;
}
export interface ICodeSplittingService {
loadComponent(name: string): Promise<React.ComponentType<Record<string, unknown>>>;
preloadComponent(name: string): Promise<void>;
isLoaded(name: string): boolean;
}
export interface IVersioningService {
getVersion(componentName: string): string | undefined;
setVersion(componentName: string, version: string): void;
isCompatible(componentName: string, requiredVersion: string): boolean;
}