import { ComponentType } from 'react'; import { UISchema } from '../types'; /** * Supported platform types */ export type PlatformType = 'pc-web' | 'mobile-web' | 'mobile-native' | 'pc-desktop'; /** * Component category types */ export type ComponentCategory = 'input' | 'layout' | 'display' | 'feedback' | 'navigation'; /** * Schema definition for component props validation */ export interface PropSchema { /** Property type */ type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'function'; /** Whether the property is required */ required?: boolean; /** Default value */ default?: unknown; /** Description of the property */ description?: string; /** Enum values for string type */ enum?: string[]; } /** * Component usage example */ export interface ComponentExample { /** Example title */ title: string; /** Example description */ description: string; /** Example UI schema */ schema: UISchema; /** Preview image URL */ preview?: string; } /** * Component definition for registration (Enhanced) */ export interface ComponentDefinition { /** Component name/type identifier */ name: string; /** Component version (semver format) */ version?: string; /** Supported platforms */ platforms?: PlatformType[]; /** The actual React component */ component: ComponentType>; /** Props schema for validation */ propsSchema?: Record; /** Component description */ description?: string; /** Component category for organization */ category?: ComponentCategory | string; /** Usage examples */ examples?: ComponentExample[]; /** Icon name (from icon registry) */ icon?: string; /** Searchable tags */ tags?: string[]; /** Whether component is deprecated */ deprecated?: boolean; /** Deprecation message with migration guide */ deprecationMessage?: string; } /** * Validation result for component definition */ export interface ComponentValidationResult { valid: boolean; errors: string[]; } /** * Parse storage key to extract name and version * Exported for potential future use in version management */ export declare function parseStorageKey(key: string): { name: string; version?: string; }; /** * Validates a component definition */ export declare function validateComponentDefinition(definition: Partial): ComponentValidationResult; /** * Component Registry class (Enhanced) * * Manages registration and lookup of UI components with support for: * - Multi-platform components * - Version management * - Category filtering * - Full-text search */ export declare class ComponentRegistry { private components; private versionedComponents; private componentVersions; /** * Register a component definition * @param definition - The component definition to register * @throws Error if the definition is invalid */ register(definition: ComponentDefinition): void; /** * Get a component definition by name, optionally filtered by platform and version * @param name - The component name * @param platform - Optional platform filter * @param version - Optional version (returns specific version if provided) * @returns The component definition or undefined if not found */ get(name: string, platform?: PlatformType, version?: string): ComponentDefinition | undefined; /** * Get all registered component definitions * @param platform - Optional platform filter * @returns Array of all component definitions */ getAll(platform?: PlatformType): ComponentDefinition[]; /** * Get components by category * @param category - The category to filter by * @param platform - Optional platform filter * @returns Array of component definitions in the category */ getByCategory(category: string, platform?: PlatformType): ComponentDefinition[]; /** * Search components by name, description, or tags * @param query - Search query string * @param platform - Optional platform filter * @returns Array of matching component definitions */ search(query: string, platform?: PlatformType): ComponentDefinition[]; /** * Get all versions of a component * @param name - The component name * @returns Array of version strings, sorted descending */ getVersions(name: string): string[]; /** * Check if a component is registered * @param name - The component name * @returns True if the component is registered */ has(name: string): boolean; /** * Unregister a component * @param name - The component name to unregister * @param version - Optional specific version to unregister * @returns True if the component was unregistered */ unregister(name: string, version?: string): boolean; /** * Get the number of registered components (unique names) */ get size(): number; /** * Clear all registered components */ clear(): void; /** * Get all unique categories * @param platform - Optional platform filter * @returns Array of category names */ getCategories(platform?: PlatformType): string[]; /** * Get component count by category * @param platform - Optional platform filter * @returns Map of category to count */ getCategoryCounts(platform?: PlatformType): Record; /** * Check if a component supports a specific platform * @param name - The component name * @param platform - The platform to check * @returns True if supported, false if not, undefined if component not found */ isSupported(name: string, platform: PlatformType): boolean | undefined; } /** * Default global component registry instance */ export declare const defaultRegistry: ComponentRegistry; //# sourceMappingURL=component-registry.d.ts.map