{"version":3,"file":"component-registry.cjs","sources":["../../../../../src/lib/component-registry.ts"],"sourcesContent":["/**\r\n * Component Registry (Enhanced)\r\n * \r\n * Manages registration and lookup of UI components for the llm2ui system.\r\n * Supports multi-platform components, versioning, search, and categorization.\r\n * \r\n * @module component-registry\r\n * @see Requirements 1.1, 7.1, 10.1, 10.2\r\n */\r\n\r\nimport type { ComponentType } from 'react';\r\nimport type { UISchema } from '../types';\r\n\r\n/**\r\n * Supported platform types\r\n */\r\nexport type PlatformType = 'pc-web' | 'mobile-web' | 'mobile-native' | 'pc-desktop';\r\n\r\n/**\r\n * Component category types\r\n */\r\nexport type ComponentCategory = 'input' | 'layout' | 'display' | 'feedback' | 'navigation';\r\n\r\n/**\r\n * Schema definition for component props validation\r\n */\r\nexport interface PropSchema {\r\n  /** Property type */\r\n  type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'function';\r\n  /** Whether the property is required */\r\n  required?: boolean;\r\n  /** Default value */\r\n  default?: unknown;\r\n  /** Description of the property */\r\n  description?: string;\r\n  /** Enum values for string type */\r\n  enum?: string[];\r\n}\r\n\r\n/**\r\n * Component usage example\r\n */\r\nexport interface ComponentExample {\r\n  /** Example title */\r\n  title: string;\r\n  /** Example description */\r\n  description: string;\r\n  /** Example UI schema */\r\n  schema: UISchema;\r\n  /** Preview image URL */\r\n  preview?: string;\r\n}\r\n\r\n/**\r\n * Component definition for registration (Enhanced)\r\n */\r\nexport interface ComponentDefinition {\r\n  /** Component name/type identifier */\r\n  name: string;\r\n  /** Component version (semver format) */\r\n  version?: string;\r\n  /** Supported platforms */\r\n  platforms?: PlatformType[];\r\n  /** The actual React component */\r\n  component: ComponentType<Record<string, unknown>>;\r\n  /** Props schema for validation */\r\n  propsSchema?: Record<string, PropSchema>;\r\n  /** Component description */\r\n  description?: string;\r\n  /** Component category for organization */\r\n  category?: ComponentCategory | string;\r\n  /** Usage examples */\r\n  examples?: ComponentExample[];\r\n  /** Icon name (from icon registry) */\r\n  icon?: string;\r\n  /** Searchable tags */\r\n  tags?: string[];\r\n  /** Whether component is deprecated */\r\n  deprecated?: boolean;\r\n  /** Deprecation message with migration guide */\r\n  deprecationMessage?: string;\r\n}\r\n\r\n/**\r\n * Validation result for component definition\r\n */\r\nexport interface ComponentValidationResult {\r\n  valid: boolean;\r\n  errors: string[];\r\n}\r\n\r\n/**\r\n * Internal storage key for versioned components\r\n */\r\nfunction createStorageKey(name: string, version?: string): string {\r\n  return version ? `${name}@${version}` : name;\r\n}\r\n\r\n/**\r\n * Parse storage key to extract name and version\r\n * Exported for potential future use in version management\r\n */\r\nexport function parseStorageKey(key: string): { name: string; version?: string } {\r\n  const atIndex = key.lastIndexOf('@');\r\n  if (atIndex > 0) {\r\n    return {\r\n      name: key.substring(0, atIndex),\r\n      version: key.substring(atIndex + 1),\r\n    };\r\n  }\r\n  return { name: key };\r\n}\r\n\r\n/**\r\n * Validates a component definition\r\n */\r\nexport function validateComponentDefinition(\r\n  definition: Partial<ComponentDefinition>\r\n): ComponentValidationResult {\r\n  const errors: string[] = [];\r\n\r\n  if (!definition.name || typeof definition.name !== 'string') {\r\n    errors.push('Component name is required and must be a string');\r\n  } else if (definition.name.trim() === '') {\r\n    errors.push('Component name cannot be empty');\r\n  }\r\n\r\n  if (!definition.component) {\r\n    errors.push('Component is required');\r\n  } else if (typeof definition.component !== 'function' && typeof definition.component !== 'object') {\r\n    errors.push('Component must be a function or object (React component)');\r\n  }\r\n\r\n  if (definition.version !== undefined) {\r\n    if (typeof definition.version !== 'string' || definition.version.trim() === '') {\r\n      errors.push('Version must be a non-empty string');\r\n    }\r\n  }\r\n\r\n  if (definition.platforms !== undefined) {\r\n    if (!Array.isArray(definition.platforms)) {\r\n      errors.push('Platforms must be an array');\r\n    } else {\r\n      const validPlatforms: PlatformType[] = ['pc-web', 'mobile-web', 'mobile-native', 'pc-desktop'];\r\n      for (const platform of definition.platforms) {\r\n        if (!validPlatforms.includes(platform)) {\r\n          errors.push(`Invalid platform: ${platform}`);\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  if (definition.propsSchema !== undefined) {\r\n    if (typeof definition.propsSchema !== 'object' || definition.propsSchema === null) {\r\n      errors.push('propsSchema must be an object');\r\n    } else {\r\n      for (const [propName, schema] of Object.entries(definition.propsSchema)) {\r\n        if (!schema || typeof schema !== 'object') {\r\n          errors.push(`Invalid schema for prop \"${propName}\"`);\r\n          continue;\r\n        }\r\n        const validTypes = ['string', 'number', 'boolean', 'object', 'array', 'function'];\r\n        if (!schema.type || !validTypes.includes(schema.type)) {\r\n          errors.push(`Invalid type for prop \"${propName}\": must be one of ${validTypes.join(', ')}`);\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  // Validate examples array\r\n  if (definition.examples !== undefined) {\r\n    if (!Array.isArray(definition.examples)) {\r\n      errors.push('Examples must be an array');\r\n    } else {\r\n      for (let i = 0; i < definition.examples.length; i++) {\r\n        const example = definition.examples[i];\r\n        if (!example || typeof example !== 'object') {\r\n          errors.push(`Example at index ${i} must be an object`);\r\n          continue;\r\n        }\r\n        if (!example.title || typeof example.title !== 'string') {\r\n          errors.push(`Example at index ${i} must have a title string`);\r\n        }\r\n        if (!example.description || typeof example.description !== 'string') {\r\n          errors.push(`Example at index ${i} must have a description string`);\r\n        }\r\n        if (!example.schema || typeof example.schema !== 'object') {\r\n          errors.push(`Example at index ${i} must have a schema object`);\r\n        }\r\n        if (example.preview !== undefined && typeof example.preview !== 'string') {\r\n          errors.push(`Example at index ${i} preview must be a string if provided`);\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  // Validate tags array\r\n  if (definition.tags !== undefined) {\r\n    if (!Array.isArray(definition.tags)) {\r\n      errors.push('Tags must be an array');\r\n    } else {\r\n      for (let i = 0; i < definition.tags.length; i++) {\r\n        if (typeof definition.tags[i] !== 'string') {\r\n          errors.push(`Tag at index ${i} must be a string`);\r\n        } else if (definition.tags[i].trim() === '') {\r\n          errors.push(`Tag at index ${i} cannot be empty`);\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  // Validate category\r\n  if (definition.category !== undefined) {\r\n    const validCategories: ComponentCategory[] = ['input', 'layout', 'display', 'feedback', 'navigation'];\r\n    if (typeof definition.category !== 'string') {\r\n      errors.push('Category must be a string');\r\n    } else if (!validCategories.includes(definition.category as ComponentCategory)) {\r\n      // Allow custom categories but warn (not an error for extensibility)\r\n      // This is intentionally not an error to allow custom categories\r\n    }\r\n  }\r\n\r\n  // Validate icon\r\n  if (definition.icon !== undefined) {\r\n    if (typeof definition.icon !== 'string') {\r\n      errors.push('Icon must be a string');\r\n    }\r\n  }\r\n\r\n  // Validate deprecated flag\r\n  if (definition.deprecated !== undefined) {\r\n    if (typeof definition.deprecated !== 'boolean') {\r\n      errors.push('Deprecated must be a boolean');\r\n    }\r\n  }\r\n\r\n  // Validate deprecationMessage\r\n  if (definition.deprecationMessage !== undefined) {\r\n    if (typeof definition.deprecationMessage !== 'string') {\r\n      errors.push('DeprecationMessage must be a string');\r\n    }\r\n  }\r\n\r\n  return {\r\n    valid: errors.length === 0,\r\n    errors,\r\n  };\r\n}\r\n\r\n/**\r\n * Component Registry class (Enhanced)\r\n * \r\n * Manages registration and lookup of UI components with support for:\r\n * - Multi-platform components\r\n * - Version management\r\n * - Category filtering\r\n * - Full-text search\r\n */\r\nexport class ComponentRegistry {\r\n  private components: Map<string, ComponentDefinition> = new Map();\r\n  private versionedComponents: Map<string, ComponentDefinition> = new Map();\r\n  private componentVersions: Map<string, Set<string>> = new Map();\r\n\r\n  /**\r\n   * Register a component definition\r\n   * @param definition - The component definition to register\r\n   * @throws Error if the definition is invalid\r\n   */\r\n  register(definition: ComponentDefinition): void {\r\n    const validation = validateComponentDefinition(definition);\r\n    if (!validation.valid) {\r\n      throw new Error(`Invalid component definition: ${validation.errors.join(', ')}`);\r\n    }\r\n\r\n    // Store as latest (unversioned)\r\n    this.components.set(definition.name, definition);\r\n\r\n    // Store versioned if version provided\r\n    if (definition.version) {\r\n      const versionedKey = createStorageKey(definition.name, definition.version);\r\n      this.versionedComponents.set(versionedKey, definition);\r\n\r\n      // Track versions\r\n      if (!this.componentVersions.has(definition.name)) {\r\n        this.componentVersions.set(definition.name, new Set());\r\n      }\r\n      this.componentVersions.get(definition.name)!.add(definition.version);\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Get a component definition by name, optionally filtered by platform and version\r\n   * @param name - The component name\r\n   * @param platform - Optional platform filter\r\n   * @param version - Optional version (returns specific version if provided)\r\n   * @returns The component definition or undefined if not found\r\n   */\r\n  get(\r\n    name: string,\r\n    platform?: PlatformType,\r\n    version?: string\r\n  ): ComponentDefinition | undefined {\r\n    let definition: ComponentDefinition | undefined;\r\n\r\n    if (version) {\r\n      const versionedKey = createStorageKey(name, version);\r\n      definition = this.versionedComponents.get(versionedKey);\r\n    } else {\r\n      definition = this.components.get(name);\r\n    }\r\n\r\n    if (!definition) return undefined;\r\n\r\n    // Filter by platform if specified\r\n    if (platform && definition.platforms && definition.platforms.length > 0) {\r\n      if (!definition.platforms.includes(platform)) {\r\n        return undefined;\r\n      }\r\n    }\r\n\r\n    return definition;\r\n  }\r\n\r\n  /**\r\n   * Get all registered component definitions\r\n   * @param platform - Optional platform filter\r\n   * @returns Array of all component definitions\r\n   */\r\n  getAll(platform?: PlatformType): ComponentDefinition[] {\r\n    const all = Array.from(this.components.values());\r\n    \r\n    if (!platform) return all;\r\n\r\n    return all.filter(def => {\r\n      // If no platforms specified, assume available on all platforms\r\n      if (!def.platforms || def.platforms.length === 0) return true;\r\n      return def.platforms.includes(platform);\r\n    });\r\n  }\r\n\r\n  /**\r\n   * Get components by category\r\n   * @param category - The category to filter by\r\n   * @param platform - Optional platform filter\r\n   * @returns Array of component definitions in the category\r\n   */\r\n  getByCategory(category: string, platform?: PlatformType): ComponentDefinition[] {\r\n    return this.getAll(platform).filter(def => def.category === category);\r\n  }\r\n\r\n  /**\r\n   * Search components by name, description, or tags\r\n   * @param query - Search query string\r\n   * @param platform - Optional platform filter\r\n   * @returns Array of matching component definitions\r\n   */\r\n  search(query: string, platform?: PlatformType): ComponentDefinition[] {\r\n    const lowerQuery = query.toLowerCase().trim();\r\n    if (!lowerQuery) return this.getAll(platform);\r\n\r\n    return this.getAll(platform).filter(def => {\r\n      // Search in name\r\n      if (def.name.toLowerCase().includes(lowerQuery)) return true;\r\n      \r\n      // Search in description\r\n      if (def.description?.toLowerCase().includes(lowerQuery)) return true;\r\n      \r\n      // Search in tags\r\n      if (def.tags?.some(tag => tag.toLowerCase().includes(lowerQuery))) return true;\r\n\r\n      return false;\r\n    });\r\n  }\r\n\r\n  /**\r\n   * Get all versions of a component\r\n   * @param name - The component name\r\n   * @returns Array of version strings, sorted descending\r\n   */\r\n  getVersions(name: string): string[] {\r\n    const versions = this.componentVersions.get(name);\r\n    if (!versions) return [];\r\n    \r\n    return Array.from(versions).sort((a, b) => {\r\n      // Simple semver-like comparison\r\n      const partsA = a.split('.').map(Number);\r\n      const partsB = b.split('.').map(Number);\r\n      \r\n      for (let i = 0; i < Math.max(partsA.length, partsB.length); i++) {\r\n        const numA = partsA[i] || 0;\r\n        const numB = partsB[i] || 0;\r\n        if (numA !== numB) return numB - numA; // Descending\r\n      }\r\n      return 0;\r\n    });\r\n  }\r\n\r\n  /**\r\n   * Check if a component is registered\r\n   * @param name - The component name\r\n   * @returns True if the component is registered\r\n   */\r\n  has(name: string): boolean {\r\n    return this.components.has(name);\r\n  }\r\n\r\n  /**\r\n   * Unregister a component\r\n   * @param name - The component name to unregister\r\n   * @param version - Optional specific version to unregister\r\n   * @returns True if the component was unregistered\r\n   */\r\n  unregister(name: string, version?: string): boolean {\r\n    if (version) {\r\n      const versionedKey = createStorageKey(name, version);\r\n      const removed = this.versionedComponents.delete(versionedKey);\r\n      \r\n      if (removed) {\r\n        const versions = this.componentVersions.get(name);\r\n        if (versions) {\r\n          versions.delete(version);\r\n          if (versions.size === 0) {\r\n            this.componentVersions.delete(name);\r\n          }\r\n        }\r\n      }\r\n      return removed;\r\n    }\r\n\r\n    // Remove all versions\r\n    const versions = this.componentVersions.get(name);\r\n    if (versions) {\r\n      for (const v of versions) {\r\n        const versionedKey = createStorageKey(name, v);\r\n        this.versionedComponents.delete(versionedKey);\r\n      }\r\n      this.componentVersions.delete(name);\r\n    }\r\n\r\n    return this.components.delete(name);\r\n  }\r\n\r\n  /**\r\n   * Get the number of registered components (unique names)\r\n   */\r\n  get size(): number {\r\n    return this.components.size;\r\n  }\r\n\r\n  /**\r\n   * Clear all registered components\r\n   */\r\n  clear(): void {\r\n    this.components.clear();\r\n    this.versionedComponents.clear();\r\n    this.componentVersions.clear();\r\n  }\r\n\r\n  /**\r\n   * Get all unique categories\r\n   * @param platform - Optional platform filter\r\n   * @returns Array of category names\r\n   */\r\n  getCategories(platform?: PlatformType): string[] {\r\n    const categories = new Set<string>();\r\n    for (const def of this.getAll(platform)) {\r\n      if (def.category) {\r\n        categories.add(def.category);\r\n      }\r\n    }\r\n    return Array.from(categories).sort();\r\n  }\r\n\r\n  /**\r\n   * Get component count by category\r\n   * @param platform - Optional platform filter\r\n   * @returns Map of category to count\r\n   */\r\n  getCategoryCounts(platform?: PlatformType): Record<string, number> {\r\n    const counts: Record<string, number> = {};\r\n    for (const def of this.getAll(platform)) {\r\n      const category = def.category || 'uncategorized';\r\n      counts[category] = (counts[category] || 0) + 1;\r\n    }\r\n    return counts;\r\n  }\r\n\r\n  /**\r\n   * Check if a component supports a specific platform\r\n   * @param name - The component name\r\n   * @param platform - The platform to check\r\n   * @returns True if supported, false if not, undefined if component not found\r\n   */\r\n  isSupported(name: string, platform: PlatformType): boolean | undefined {\r\n    const def = this.components.get(name);\r\n    if (!def) return undefined;\r\n    \r\n    // If no platforms specified, assume all platforms supported\r\n    if (!def.platforms || def.platforms.length === 0) return true;\r\n    \r\n    return def.platforms.includes(platform);\r\n  }\r\n}\r\n\r\n/**\r\n * Default global component registry instance\r\n */\r\nexport const defaultRegistry = new ComponentRegistry();\r\n"],"names":["createStorageKey","name","version","validateComponentDefinition","definition","errors","validPlatforms","platform","propName","schema","validTypes","i","example","ComponentRegistry","__publicField","validation","versionedKey","all","def","category","query","lowerQuery","tag","versions","a","b","partsA","partsB","numA","numB","removed","v","categories","counts","defaultRegistry"],"mappings":"oPA8FA,SAASA,EAAiBC,EAAcC,EAA0B,CAChE,OAAOA,EAAU,GAAGD,CAAI,IAAIC,CAAO,GAAKD,CAC1C,CAoBO,SAASE,EACdC,EAC2B,CAC3B,MAAMC,EAAmB,CAAA,EAoBzB,GAlBI,CAACD,EAAW,MAAQ,OAAOA,EAAW,MAAS,SACjDC,EAAO,KAAK,iDAAiD,EACpDD,EAAW,KAAK,KAAA,IAAW,IACpCC,EAAO,KAAK,gCAAgC,EAGzCD,EAAW,UAEL,OAAOA,EAAW,WAAc,YAAc,OAAOA,EAAW,WAAc,UACvFC,EAAO,KAAK,0DAA0D,EAFtEA,EAAO,KAAK,uBAAuB,EAKjCD,EAAW,UAAY,SACrB,OAAOA,EAAW,SAAY,UAAYA,EAAW,QAAQ,KAAA,IAAW,KAC1EC,EAAO,KAAK,oCAAoC,EAIhDD,EAAW,YAAc,OAC3B,GAAI,CAAC,MAAM,QAAQA,EAAW,SAAS,EACrCC,EAAO,KAAK,4BAA4B,MACnC,CACL,MAAMC,EAAiC,CAAC,SAAU,aAAc,gBAAiB,YAAY,EAC7F,UAAWC,KAAYH,EAAW,UAC3BE,EAAe,SAASC,CAAQ,GACnCF,EAAO,KAAK,qBAAqBE,CAAQ,EAAE,CAGjD,CAGF,GAAIH,EAAW,cAAgB,OAC7B,GAAI,OAAOA,EAAW,aAAgB,UAAYA,EAAW,cAAgB,KAC3EC,EAAO,KAAK,+BAA+B,MAE3C,UAAW,CAACG,EAAUC,CAAM,IAAK,OAAO,QAAQL,EAAW,WAAW,EAAG,CACvE,GAAI,CAACK,GAAU,OAAOA,GAAW,SAAU,CACzCJ,EAAO,KAAK,4BAA4BG,CAAQ,GAAG,EACnD,QACF,CACA,MAAME,EAAa,CAAC,SAAU,SAAU,UAAW,SAAU,QAAS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